diff options
author | Johannes Schickel | 2014-06-05 16:27:44 +0200 |
---|---|---|
committer | Johannes Schickel | 2014-06-05 16:27:44 +0200 |
commit | 450924a0c72bfdcdee627e2da4782853b94bd866 (patch) | |
tree | df13fbf05220cc827873617f36ec1c37d246c16f | |
parent | d76c375c3f060db0912cce26b5b38b94cb3ad414 (diff) | |
parent | 025556d9a54b8b53c2cf8d3d6627d7ce2d42c934 (diff) | |
download | scummvm-rg350-450924a0c72bfdcdee627e2da4782853b94bd866.tar.gz scummvm-rg350-450924a0c72bfdcdee627e2da4782853b94bd866.tar.bz2 scummvm-rg350-450924a0c72bfdcdee627e2da4782853b94bd866.zip |
Merge pull request #465 from digitall/debugRework
Add "all" option for debug flags to GUI::Debugger base class.
-rw-r--r-- | common/debug-channels.h | 11 | ||||
-rw-r--r-- | common/debug.cpp | 11 | ||||
-rw-r--r-- | engines/groovie/cursor.cpp | 18 | ||||
-rw-r--r-- | engines/groovie/groovie.cpp | 21 | ||||
-rw-r--r-- | engines/groovie/groovie.h | 24 | ||||
-rw-r--r-- | engines/groovie/music.cpp | 38 | ||||
-rw-r--r-- | engines/groovie/player.cpp | 6 | ||||
-rw-r--r-- | engines/groovie/resource.cpp | 10 | ||||
-rw-r--r-- | engines/groovie/roq.cpp | 26 | ||||
-rw-r--r-- | engines/groovie/script.cpp | 265 | ||||
-rw-r--r-- | engines/groovie/vdx.cpp | 37 | ||||
-rw-r--r-- | gui/debugger.cpp | 14 |
12 files changed, 240 insertions, 241 deletions
diff --git a/common/debug-channels.h b/common/debug-channels.h index 83f416a3b8..1414a1053a 100644 --- a/common/debug-channels.h +++ b/common/debug-channels.h @@ -95,8 +95,6 @@ public: */ bool disableDebugChannel(const String &name); - - typedef List<DebugChannel> DebugChannelList; /** @@ -106,6 +104,15 @@ public: */ DebugChannelList listDebugChannels(); + /** + * Enable all debug channels. + */ + void enableAllDebugChannels(); + + /** + * Disable all debug channels. + */ + void disableAllDebugChannels(); /** * Test whether the given debug channel is enabled. diff --git a/common/debug.cpp b/common/debug.cpp index 58cc0287a8..b8c345e4f0 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -85,7 +85,6 @@ bool DebugManager::disableDebugChannel(const String &name) { } } - DebugManager::DebugChannelList DebugManager::listDebugChannels() { DebugChannelList tmp; for (DebugChannelMap::iterator i = gDebugChannels.begin(); i != gDebugChannels.end(); ++i) @@ -95,6 +94,16 @@ DebugManager::DebugChannelList DebugManager::listDebugChannels() { return tmp; } +void DebugManager::enableAllDebugChannels() { + for (DebugChannelMap::iterator i = gDebugChannels.begin(); i != gDebugChannels.end(); ++i) + enableDebugChannel(i->_value.name); +} + +void DebugManager::disableAllDebugChannels() { + for (DebugChannelMap::iterator i = gDebugChannels.begin(); i != gDebugChannels.end(); ++i) + disableDebugChannel(i->_value.name); +} + bool DebugManager::isDebugChannelEnabled(uint32 channel) { // Debug level 11 turns on all special debug level messages if (gDebugLevel == 11) diff --git a/engines/groovie/cursor.cpp b/engines/groovie/cursor.cpp index 65f3e108b8..442f0bfada 100644 --- a/engines/groovie/cursor.cpp +++ b/engines/groovie/cursor.cpp @@ -107,8 +107,8 @@ Cursor_t7g::Cursor_t7g(uint8 *img, uint8 *pal) : _img = img + 5; - debugC(1, kGroovieDebugCursor | kGroovieDebugAll, "Groovie::Cursor: width: %d, height: %d, frames:%d", _width, _height, _numFrames); - debugC(1, kGroovieDebugCursor | kGroovieDebugUnknown | kGroovieDebugAll, "Groovie::Cursor: elinor: 0x%02X (%d), 0x%02X (%d)", elinor1, elinor1, elinor2, elinor2); + debugC(1, kDebugCursor, "Groovie::Cursor: width: %d, height: %d, frames:%d", _width, _height, _numFrames); + debugC(1, kDebugCursor | kDebugUnknown, "Groovie::Cursor: elinor: 0x%02X (%d), 0x%02X (%d)", elinor1, elinor1, elinor2, elinor2); } void Cursor_t7g::enable() { @@ -262,26 +262,26 @@ Cursor_v2::Cursor_v2(Common::File &file) { _img = new byte[_width * _height * _numFrames * 4]; - debugC(1, kGroovieDebugCursor | kGroovieDebugAll, "Groovie::Cursor: width: %d, height: %d, frames:%d", _width, _height, _numFrames); + debugC(1, kDebugCursor, "Groovie::Cursor: width: %d, height: %d, frames:%d", _width, _height, _numFrames); uint16 tmp16 = file.readUint16LE(); - debugC(5, kGroovieDebugCursor | kGroovieDebugAll, "hotspot x?: %d\n", tmp16); + debugC(5, kDebugCursor, "hotspot x?: %d\n", tmp16); tmp16 = file.readUint16LE(); - debugC(5, kGroovieDebugCursor | kGroovieDebugAll, "hotspot y?: %d\n", tmp16); + debugC(5, kDebugCursor, "hotspot y?: %d\n", tmp16); int loop2count = file.readUint16LE(); - debugC(5, kGroovieDebugCursor | kGroovieDebugAll, "loop2count?: %d\n", loop2count); + debugC(5, kDebugCursor, "loop2count?: %d\n", loop2count); for (int l = 0; l < loop2count; l++) { tmp16 = file.readUint16LE(); - debugC(5, kGroovieDebugCursor | kGroovieDebugAll, "loop2a: %d\n", tmp16); // Index frame can merge to/from? + debugC(5, kDebugCursor, "loop2a: %d\n", tmp16); // Index frame can merge to/from? tmp16 = file.readUint16LE(); - debugC(5, kGroovieDebugCursor | kGroovieDebugAll, "loop2b: %d\n", tmp16); // Number of frames? + debugC(5, kDebugCursor, "loop2b: %d\n", tmp16); // Number of frames? } file.read(pal, 0x20 * 3); for (int f = 0; f < _numFrames; f++) { uint32 tmp32 = file.readUint32LE(); - debugC(5, kGroovieDebugCursor | kGroovieDebugAll, "loop3: %d\n", tmp32); + debugC(5, kDebugCursor, "loop3: %d\n", tmp32); byte *data = new byte[tmp32]; file.read(data, tmp32); diff --git a/engines/groovie/groovie.cpp b/engines/groovie/groovie.cpp index 427b1c866a..b42cf09245 100644 --- a/engines/groovie/groovie.cpp +++ b/engines/groovie/groovie.cpp @@ -68,17 +68,16 @@ GroovieEngine::GroovieEngine(OSystem *syst, const GroovieGameDescription *gd) : _modeSpeed = kGroovieSpeedFast; // Initialize the custom debug levels - DebugMan.addDebugChannel(kGroovieDebugAll, "All", "Debug everything"); - DebugMan.addDebugChannel(kGroovieDebugVideo, "Video", "Debug video and audio playback"); - DebugMan.addDebugChannel(kGroovieDebugResource, "Resource", "Debug resouce management"); - DebugMan.addDebugChannel(kGroovieDebugScript, "Script", "Debug the scripts"); - DebugMan.addDebugChannel(kGroovieDebugUnknown, "Unknown", "Report values of unknown data in files"); - DebugMan.addDebugChannel(kGroovieDebugHotspots, "Hotspots", "Show the hotspots"); - DebugMan.addDebugChannel(kGroovieDebugCursor, "Cursor", "Debug cursor decompression / switching"); - DebugMan.addDebugChannel(kGroovieDebugMIDI, "MIDI", "Debug MIDI / XMIDI files"); - DebugMan.addDebugChannel(kGroovieDebugScriptvars, "Scriptvars", "Print out any change to script variables"); - DebugMan.addDebugChannel(kGroovieDebugCell, "Cell", "Debug the cell game (in the microscope)"); - DebugMan.addDebugChannel(kGroovieDebugFast, "Fast", "Play videos quickly, with no sound (unstable)"); + DebugMan.addDebugChannel(kDebugVideo, "Video", "Debug video and audio playback"); + DebugMan.addDebugChannel(kDebugResource, "Resource", "Debug resouce management"); + DebugMan.addDebugChannel(kDebugScript, "Script", "Debug the scripts"); + DebugMan.addDebugChannel(kDebugUnknown, "Unknown", "Report values of unknown data in files"); + DebugMan.addDebugChannel(kDebugHotspots, "Hotspots", "Show the hotspots"); + DebugMan.addDebugChannel(kDebugCursor, "Cursor", "Debug cursor decompression / switching"); + DebugMan.addDebugChannel(kDebugMIDI, "MIDI", "Debug MIDI / XMIDI files"); + DebugMan.addDebugChannel(kDebugScriptvars, "Scriptvars", "Print out any change to script variables"); + DebugMan.addDebugChannel(kDebugCell, "Cell", "Debug the cell game (in the microscope)"); + DebugMan.addDebugChannel(kDebugFast, "Fast", "Play videos quickly, with no sound (unstable)"); } GroovieEngine::~GroovieEngine() { diff --git a/engines/groovie/groovie.h b/engines/groovie/groovie.h index 9fe6b0c2f5..d442d39cb2 100644 --- a/engines/groovie/groovie.h +++ b/engines/groovie/groovie.h @@ -58,18 +58,18 @@ class Script; class VideoPlayer; enum DebugLevels { - kGroovieDebugAll = 1 << 0, - kGroovieDebugVideo = 1 << 1, - kGroovieDebugResource = 1 << 2, - kGroovieDebugScript = 1 << 3, - kGroovieDebugUnknown = 1 << 4, - kGroovieDebugHotspots = 1 << 5, - kGroovieDebugCursor = 1 << 6, - kGroovieDebugMIDI = 1 << 7, - kGroovieDebugScriptvars = 1 << 8, - kGroovieDebugCell = 1 << 9, - kGroovieDebugFast = 1 << 10 - // the current limitation is 32 debug levels (1 << 31 is the last one) + kDebugVideo = 1 << 0, + kDebugResource = 1 << 1, + kDebugScript = 1 << 2, + kDebugUnknown = 1 << 3, + kDebugHotspots = 1 << 4, + kDebugCursor = 1 << 5, + kDebugMIDI = 1 << 6, + kDebugScriptvars = 1 << 7, + kDebugCell = 1 << 8, + kDebugFast = 1 << 9 + // the current limitation is 32 debug levels (1 << 31 is the last one) + // but some are used by system, so avoid high values. }; /** diff --git a/engines/groovie/music.cpp b/engines/groovie/music.cpp index 390f47f084..2c164e020c 100644 --- a/engines/groovie/music.cpp +++ b/engines/groovie/music.cpp @@ -64,7 +64,7 @@ void MusicPlayer::playSong(uint32 fileref) { void MusicPlayer::setBackgroundSong(uint32 fileref) { Common::StackLock lock(_mutex); - debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Changing the background song: %04X", fileref); + debugC(1, kDebugMIDI, "Groovie::Music: Changing the background song: %04X", fileref); _backgroundFileRef = fileref; } @@ -86,7 +86,7 @@ void MusicPlayer::playCD(uint8 track) { // Stop the MIDI playback unload(); - debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Playing CD track %d", track); + debugC(1, kDebugMIDI, "Groovie::Music: Playing CD track %d", track); if (track == 3) { // This is the credits song, start at 23:20 @@ -136,9 +136,9 @@ void MusicPlayer::playCD(uint8 track) { } void MusicPlayer::startBackground() { - debugC(3, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: startBackground()"); + debugC(3, kDebugMIDI, "Groovie::Music: startBackground()"); if (!_isPlaying && _backgroundFileRef) { - debugC(3, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Starting the background song (0x%4X)", _backgroundFileRef); + debugC(3, kDebugMIDI, "Groovie::Music: Starting the background song (0x%4X)", _backgroundFileRef); play(_backgroundFileRef, true); } } @@ -158,7 +158,7 @@ void MusicPlayer::setUserVolume(uint16 volume) { void MusicPlayer::setGameVolume(uint16 volume, uint16 time) { Common::StackLock lock(_mutex); - debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Setting game volume from %d to %d in %dms", _gameVolume, volume, time); + debugC(1, kDebugMIDI, "Groovie::Music: Setting game volume from %d to %d in %dms", _gameVolume, volume, time); // Save the start parameters of the fade _fadingStartTime = _vm->_system->getMillis(); @@ -183,12 +183,12 @@ bool MusicPlayer::play(uint32 fileref, bool loop) { } void MusicPlayer::applyFading() { - debugC(6, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: applyFading() _fadingStartTime = %d, _fadingDuration = %d, _fadingStartVolume = %d, _fadingEndVolume = %d", _fadingStartTime, _fadingDuration, _fadingStartVolume, _fadingEndVolume); + debugC(6, kDebugMIDI, "Groovie::Music: applyFading() _fadingStartTime = %d, _fadingDuration = %d, _fadingStartVolume = %d, _fadingEndVolume = %d", _fadingStartTime, _fadingDuration, _fadingStartVolume, _fadingEndVolume); Common::StackLock lock(_mutex); // Calculate the passed time uint32 time = _vm->_system->getMillis() - _fadingStartTime; - debugC(6, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: time = %d, _gameVolume = %d", time, _gameVolume); + debugC(6, kDebugMIDI, "Groovie::Music: time = %d, _gameVolume = %d", time, _gameVolume); if (time >= _fadingDuration) { // Set the end volume _gameVolume = _fadingEndVolume; @@ -200,7 +200,7 @@ void MusicPlayer::applyFading() { if (_gameVolume == _fadingEndVolume) { // If we were fading to 0, stop the playback and restore the volume if (_fadingEndVolume == 0) { - debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Faded to zero: end of song. _fadingEndVolume set to 100"); + debugC(1, kDebugMIDI, "Groovie::Music: Faded to zero: end of song. _fadingEndVolume set to 100"); unload(); } } @@ -210,7 +210,7 @@ void MusicPlayer::applyFading() { } void MusicPlayer::onTimer(void *refCon) { - debugC(9, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: onTimer()"); + debugC(9, kDebugMIDI, "Groovie::Music: onTimer()"); MusicPlayer *music = (MusicPlayer *)refCon; Common::StackLock lock(music->_mutex); @@ -225,7 +225,7 @@ void MusicPlayer::onTimer(void *refCon) { } void MusicPlayer::unload() { - debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Stopping the playback"); + debugC(1, kDebugMIDI, "Groovie::Music: Stopping the playback"); // Set the new state _isPlaying = false; @@ -319,7 +319,7 @@ void MusicPlayerMidi::updateChanVolume(byte channel) { } void MusicPlayerMidi::endTrack() { - debugC(3, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: endTrack()"); + debugC(3, kDebugMIDI, "Groovie::Music: endTrack()"); unload(); } @@ -439,7 +439,7 @@ void MusicPlayerXMI::send(uint32 b) { byte chan = b & 0xF; byte bank = (b >> 16) & 0xFF; - debugC(5, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Selecting bank %X for channel %X", bank, chan); + debugC(5, kDebugMIDI, "Groovie::Music: Selecting bank %X for channel %X", bank, chan); _chanBanks[chan] = bank; return; } else if ((b & 0xF0) == 0xC0) { // Program change @@ -450,7 +450,7 @@ void MusicPlayerXMI::send(uint32 b) { byte chan = b & 0xF; byte patch = (b >> 8) & 0xFF; - debugC(5, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Setting custom patch %X from bank %X to channel %X", patch, _chanBanks[chan], chan); + debugC(5, kDebugMIDI, "Groovie::Music: Setting custom patch %X from bank %X to channel %X", patch, _chanBanks[chan], chan); // Try to find the requested patch from the previously // specified bank @@ -475,7 +475,7 @@ void MusicPlayerXMI::send(uint32 b) { } bool MusicPlayerXMI::load(uint32 fileref, bool loop) { - debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Starting the playback of song: %04X", fileref); + debugC(1, kDebugMIDI, "Groovie::Music: Starting the playback of song: %04X", fileref); // Open the song resource Common::SeekableReadStream *file = _vm->_resMan->open(fileref); @@ -489,7 +489,7 @@ bool MusicPlayerXMI::load(uint32 fileref, bool loop) { void MusicPlayerXMI::loadTimbres(const Common::String &filename) { // Load the Global Timbre Library format as documented in AIL2 - debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Loading the GTL file %s", filename.c_str()); + debugC(1, kDebugMIDI, "Groovie::Music: Loading the GTL file %s", filename.c_str()); // Does it exist? if (!Common::File::exists(filename)) { @@ -537,7 +537,7 @@ void MusicPlayerXMI::loadTimbres(const Common::String &filename) { // Read the timbre data gtl->read(_timbres[i].data, _timbres[i].size); - debugC(5, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Loaded patch %x in bank %x with size %d", + debugC(5, kDebugMIDI, "Groovie::Music: Loaded patch %x in bank %x with size %d", _timbres[i].patch, _timbres[i].bank, _timbres[i].size); } @@ -636,7 +636,7 @@ void setRolandInstrument(MidiDriver *drv, byte channel, byte *instrument) { // Show the timbre name as extra debug information Common::String name((char *)instrument, 10); - debugC(5, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Setting MT32 timbre '%s' to channel %d", name.c_str(), channel); + debugC(5, kDebugMIDI, "Groovie::Music: Setting MT32 timbre '%s' to channel %d", name.c_str(), channel); sysex.roland_id = 0x41; sysex.device_id = channel; // Unit# @@ -702,7 +702,7 @@ MusicPlayerMac_t7g::MusicPlayerMac_t7g(GroovieEngine *vm) : MusicPlayerMidi(vm) } bool MusicPlayerMac_t7g::load(uint32 fileref, bool loop) { - debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Starting the playback of song: %04X", fileref); + debugC(1, kDebugMIDI, "Groovie::Music: Starting the playback of song: %04X", fileref); // First try for compressed MIDI Common::SeekableReadStream *file = _vm->_macResFork->getResource(MKTAG('c','m','i','d'), fileref & 0x3FF); @@ -789,7 +789,7 @@ MusicPlayerMac_v2::MusicPlayerMac_v2(GroovieEngine *vm) : MusicPlayerMidi(vm) { } bool MusicPlayerMac_v2::load(uint32 fileref, bool loop) { - debugC(1, kGroovieDebugMIDI | kGroovieDebugAll, "Groovie::Music: Starting the playback of song: %04X", fileref); + debugC(1, kDebugMIDI, "Groovie::Music: Starting the playback of song: %04X", fileref); // Find correct filename ResInfo info; diff --git a/engines/groovie/player.cpp b/engines/groovie/player.cpp index 16cb3c47ff..c1b90fbd2c 100644 --- a/engines/groovie/player.cpp +++ b/engines/groovie/player.cpp @@ -94,13 +94,13 @@ void VideoPlayer::waitFrame() { } else { uint32 millisDiff = currTime - _lastFrameTime; if (millisDiff < _millisBetweenFrames) { - debugC(7, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::Player: Delaying %d (currTime=%d, _lastFrameTime=%d, millisDiff=%d, _millisBetweenFrame=%d)", + debugC(7, kDebugVideo, "Groovie::Player: Delaying %d (currTime=%d, _lastFrameTime=%d, millisDiff=%d, _millisBetweenFrame=%d)", _millisBetweenFrames - millisDiff, currTime, _lastFrameTime, millisDiff, _millisBetweenFrames); _syst->delayMillis(_millisBetweenFrames - millisDiff); currTime = _syst->getMillis(); - debugC(7, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::Player: Finished delay at %d", currTime); + debugC(7, kDebugVideo, "Groovie::Player: Finished delay at %d", currTime); } - debugC(6, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::Player: Frame displayed at %d (%f FPS)", currTime, 1000.0 / (currTime - _lastFrameTime)); + debugC(6, kDebugVideo, "Groovie::Player: Frame displayed at %d (%f FPS)", currTime, 1000.0 / (currTime - _lastFrameTime)); _lastFrameTime = currTime; } } diff --git a/engines/groovie/resource.cpp b/engines/groovie/resource.cpp index 8229d02d91..75eba95240 100644 --- a/engines/groovie/resource.cpp +++ b/engines/groovie/resource.cpp @@ -47,7 +47,7 @@ Common::SeekableReadStream *ResMan::open(uint32 fileRef) { return NULL; } - debugC(1, kGroovieDebugResource | kGroovieDebugAll, "Groovie::Resource: Opening resource 0x%04X (%s, %d, %d)", fileRef, _gjds[resInfo.gjd].c_str(), resInfo.offset, resInfo.size); + debugC(1, kDebugResource, "Groovie::Resource: Opening resource 0x%04X (%s, %d, %d)", fileRef, _gjds[resInfo.gjd].c_str(), resInfo.offset, resInfo.size); // Does it exist? if (!Common::File::exists(_gjds[resInfo.gjd])) { @@ -120,7 +120,7 @@ uint32 ResMan_t7g::getRef(Common::String name, Common::String scriptname) { // Test whether it's the resource we're searching Common::String resname(readname, 12); if (resname.hasPrefix(name.c_str())) { - debugC(2, kGroovieDebugResource | kGroovieDebugAll, "Groovie::Resource: Resource %12s matches %s", readname, name.c_str()); + debugC(2, kDebugResource, "Groovie::Resource: Resource %12s matches %s", readname, name.c_str()); found = true; } @@ -173,7 +173,7 @@ bool ResMan_t7g::getResInfo(uint32 fileRef, ResInfo &resInfo) { char resname[13]; rlFile->read(resname, 12); resname[12] = 0; - debugC(2, kGroovieDebugResource | kGroovieDebugAll, "Groovie::Resource: Resource name: %12s", resname); + debugC(2, kDebugResource, "Groovie::Resource: Resource name: %12s", resname); resInfo.filename = resname; // Read the resource information @@ -240,7 +240,7 @@ uint32 ResMan_v2::getRef(Common::String name, Common::String scriptname) { // Test whether it's the resource we're searching Common::String resname(readname, 18); if (resname.hasPrefix(name.c_str())) { - debugC(2, kGroovieDebugResource | kGroovieDebugAll, "Groovie::Resource: Resource %18s matches %s", readname, name.c_str()); + debugC(2, kDebugResource, "Groovie::Resource: Resource %18s matches %s", readname, name.c_str()); found = true; break; } @@ -284,7 +284,7 @@ bool ResMan_v2::getResInfo(uint32 fileRef, ResInfo &resInfo) { char resname[19]; resname[18] = 0; rlFile.read(resname, 18); - debugC(2, kGroovieDebugResource | kGroovieDebugAll, "Groovie::Resource: Resource name: %18s", resname); + debugC(2, kDebugResource, "Groovie::Resource: Resource name: %18s", resname); resInfo.filename = resname; // 6 padding bytes? (it looks like they're always 0) diff --git a/engines/groovie/roq.cpp b/engines/groovie/roq.cpp index 3b82543695..379fcabc07 100644 --- a/engines/groovie/roq.cpp +++ b/engines/groovie/roq.cpp @@ -64,7 +64,7 @@ ROQPlayer::~ROQPlayer() { uint16 ROQPlayer::loadInternal() { // Begin reading the file - debugC(1, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::ROQ: Loading video"); + debugC(1, kDebugVideo, "Groovie::ROQ: Loading video"); // Read the file header ROQBlockHeader blockHeader; @@ -131,7 +131,7 @@ void ROQPlayer::buildShowBuf() { } bool ROQPlayer::playFrameInternal() { - debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::ROQ: Playing frame"); + debugC(5, kDebugVideo, "Groovie::ROQ: Playing frame"); // Process the needed blocks until the next video frame bool endframe = false; @@ -168,9 +168,9 @@ bool ROQPlayer::readBlockHeader(ROQBlockHeader &blockHeader) { blockHeader.size = _file->readUint32LE(); blockHeader.param = _file->readUint16LE(); - debugC(10, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::ROQ: Block type = 0x%02X", blockHeader.type); - debugC(10, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::ROQ: Block size = 0x%08X", blockHeader.size); - debugC(10, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::ROQ: Block param = 0x%04X", blockHeader.param); + debugC(10, kDebugVideo, "Groovie::ROQ: Block type = 0x%02X", blockHeader.type); + debugC(10, kDebugVideo, "Groovie::ROQ: Block size = 0x%08X", blockHeader.size); + debugC(10, kDebugVideo, "Groovie::ROQ: Block param = 0x%04X", blockHeader.param); return true; } @@ -238,7 +238,7 @@ bool ROQPlayer::processBlock() { } bool ROQPlayer::processBlockInfo(ROQBlockHeader &blockHeader) { - debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::ROQ: Processing info block"); + debugC(5, kDebugVideo, "Groovie::ROQ: Processing info block"); // Verify the block header if (blockHeader.type != 0x1001 || blockHeader.size != 8 || (blockHeader.param != 0 && blockHeader.param != 1)) { @@ -285,7 +285,7 @@ bool ROQPlayer::processBlockInfo(ROQBlockHeader &blockHeader) { } bool ROQPlayer::processBlockQuadCodebook(ROQBlockHeader &blockHeader) { - debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::ROQ: Processing quad codebook block"); + debugC(5, kDebugVideo, "Groovie::ROQ: Processing quad codebook block"); // Get the number of 2x2 pixel blocks to read int newNum2blocks = blockHeader.param >> 8; @@ -333,7 +333,7 @@ bool ROQPlayer::processBlockQuadCodebook(ROQBlockHeader &blockHeader) { } bool ROQPlayer::processBlockQuadVector(ROQBlockHeader &blockHeader) { - debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::ROQ: Processing quad vector block"); + debugC(5, kDebugVideo, "Groovie::ROQ: Processing quad vector block"); // Get the mean motion vectors int8 Mx = blockHeader.param >> 8; @@ -396,7 +396,7 @@ void ROQPlayer::processBlockQuadVectorBlock(int baseX, int baseY, int8 Mx, int8 } void ROQPlayer::processBlockQuadVectorBlockSub(int baseX, int baseY, int8 Mx, int8 My) { - debugC(6, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::ROQ: Processing quad vector sub block"); + debugC(6, kDebugVideo, "Groovie::ROQ: Processing quad vector sub block"); uint16 codingType = getCodingType(); switch (codingType) { @@ -422,7 +422,7 @@ void ROQPlayer::processBlockQuadVectorBlockSub(int baseX, int baseY, int8 Mx, in } bool ROQPlayer::processBlockStill(ROQBlockHeader &blockHeader) { - debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::ROQ: Processing still (JPEG) block"); + debugC(5, kDebugVideo, "Groovie::ROQ: Processing still (JPEG) block"); Image::JPEGDecoder jpg; @@ -440,7 +440,7 @@ bool ROQPlayer::processBlockStill(ROQBlockHeader &blockHeader) { } bool ROQPlayer::processBlockSoundMono(ROQBlockHeader &blockHeader) { - debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::ROQ: Processing mono sound block"); + debugC(5, kDebugVideo, "Groovie::ROQ: Processing mono sound block"); // Verify the block header if (blockHeader.type != 0x1020) { @@ -483,7 +483,7 @@ bool ROQPlayer::processBlockSoundMono(ROQBlockHeader &blockHeader) { } bool ROQPlayer::processBlockSoundStereo(ROQBlockHeader &blockHeader) { - debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::ROQ: Processing stereo sound block"); + debugC(5, kDebugVideo, "Groovie::ROQ: Processing stereo sound block"); // Verify the block header if (blockHeader.type != 0x1021) { @@ -539,7 +539,7 @@ bool ROQPlayer::processBlockSoundStereo(ROQBlockHeader &blockHeader) { } bool ROQPlayer::processBlockAudioContainer(ROQBlockHeader &blockHeader) { - debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::ROQ: Processing audio container block: 0x%04X", blockHeader.param); + debugC(5, kDebugVideo, "Groovie::ROQ: Processing audio container block: 0x%04X", blockHeader.param); return true; } diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp index 308811635e..7625151082 100644 --- a/engines/groovie/script.cpp +++ b/engines/groovie/script.cpp @@ -47,26 +47,6 @@ namespace Groovie { -static void debugScript(int level, bool nl, const char *s, ...) GCC_PRINTF(3, 4); - -static void debugScript(int level, bool nl, const char *s, ...) { - char buf[STRINGBUFLEN]; - va_list va; - - if (!DebugMan.isDebugChannelEnabled(kGroovieDebugScript) && - !DebugMan.isDebugChannelEnabled(kGroovieDebugAll)) - return; - - va_start(va, s); - vsnprintf(buf, STRINGBUFLEN, s, va); - va_end(va); - - if (nl) - debug(level, "%s", buf); - else - debugN(level, "%s", buf); -} - Script::Script(GroovieEngine *vm, EngineVersion version) : _code(NULL), _savedCode(NULL), _stacktop(0), _debugger(NULL), _vm(vm), _videoFile(NULL), _videoRef(0), _staufsMove(NULL), _lastCursor(0xff), @@ -120,7 +100,7 @@ Script::~Script() { void Script::setVariable(uint16 variablenum, byte value) { _variables[variablenum] = value; - debugC(1, kGroovieDebugScriptvars | kGroovieDebugAll, "script variable[0x%03X] = %d (0x%04X)", variablenum, value, value); + debugC(1, kDebugScriptvars, "script variable[0x%03X] = %d (0x%04X)", variablenum, value, value); } void Script::setDebugger(Debugger *debugger) { @@ -229,7 +209,7 @@ void Script::step() { // Only output if we're not re-doing the previous instruction if (_currentInstruction != _oldInstruction) { - debugScript(1, false, "%s", _debugString.c_str()); + debugCN(1, kDebugScript, "%s", _debugString.c_str()); _oldInstruction = _currentInstruction; } @@ -354,7 +334,7 @@ uint32 Script::getVideoRefString() { // Add a trailing dot str += 0x2E; - debugScript(0, false, "%s", str.c_str()); + debugCN(0, kDebugScript, "%s", str.c_str()); // Extract the script name. Common::String scriptname(_scriptFile.c_str(), _scriptFile.size() - 4); @@ -369,8 +349,7 @@ bool Script::hotspot(Common::Rect rect, uint16 address, uint8 cursor) { bool contained = rect.contains(mousepos); // Show hotspots when debugging - if (DebugMan.isDebugChannelEnabled(kGroovieDebugHotspots) || - DebugMan.isDebugChannelEnabled(kGroovieDebugAll)) { + if (DebugMan.isDebugChannelEnabled(kDebugHotspots)) { rect.translate(0, -80); _vm->_graphicsMan->_foreground.frameRect(rect, 250); _vm->_system->copyRectToScreen(_vm->_graphicsMan->_foreground.getPixels(), _vm->_graphicsMan->_foreground.pitch, 0, 80, 640, 320); @@ -416,7 +395,7 @@ void Script::savegame(uint slot) { Common::OutSaveFile *file = SaveLoad::openForSaving(ConfMan.getActiveDomainName(), slot); if (!file) { - debugC(9, kGroovieDebugScript, "Save file pointer is null"); + debugC(9, kDebugScript, "Save file pointer is null"); GUI::MessageDialog dialog(_("Failed to save game"), _("OK")); dialog.runModal(); return; @@ -462,32 +441,32 @@ void Script::o_invalid() { } void Script::o_nop() { - debugScript(1, true, "NOP"); + debugC(1, kDebugScript, "NOP"); } void Script::o_nop8() { uint8 tmp = readScript8bits(); - debugScript(1, true, "NOP8: 0x%02X", tmp); + debugC(1, kDebugScript, "NOP8: 0x%02X", tmp); } void Script::o_nop16() { uint16 tmp = readScript16bits(); - debugScript(1, true, "NOP16: 0x%04X", tmp); + debugC(1, kDebugScript, "NOP16: 0x%04X", tmp); } void Script::o_nop32() { uint32 tmp = readScript32bits(); - debugScript(1, true, "NOP32: 0x%08X", tmp); + debugC(1, kDebugScript, "NOP32: 0x%08X", tmp); } void Script::o_nop8or16() { uint16 tmp = readScript8or16bits(); - debugScript(1, true, "NOP8OR16: 0x%04X", tmp); + debugC(1, kDebugScript, "NOP8OR16: 0x%04X", tmp); } void Script::o_playsong() { // 0x02 uint16 fileref = readScript16bits(); - debugScript(1, true, "PlaySong(0x%04X): Play xmidi file", fileref); + debugC(1, kDebugScript, "PlaySong(0x%04X): Play xmidi file", fileref); if (fileref == 0x4C17) { warning("this song is special somehow"); // don't save the reference? @@ -496,33 +475,33 @@ void Script::o_playsong() { // 0x02 } void Script::o_bf9on() { // 0x03 - debugScript(1, true, "BF9ON: bitflag 9 turned on"); + debugC(1, kDebugScript, "BF9ON: bitflag 9 turned on"); _bitflags |= 1 << 9; } void Script::o_palfadeout() { - debugScript(1, true, "PALFADEOUT"); + debugC(1, kDebugScript, "PALFADEOUT"); _vm->_graphicsMan->fadeOut(); } void Script::o_bf8on() { // 0x05 - debugScript(1, true, "BF8ON: bitflag 8 turned on"); + debugC(1, kDebugScript, "BF8ON: bitflag 8 turned on"); _bitflags |= 1 << 8; } void Script::o_bf6on() { // 0x06 - debugScript(1, true, "BF6ON: bitflag 6 turned on"); + debugC(1, kDebugScript, "BF6ON: bitflag 6 turned on"); _bitflags |= 1 << 6; } void Script::o_bf7on() { // 0x07 - debugScript(1, true, "BF7ON: bitflag 7 turned on"); + debugC(1, kDebugScript, "BF7ON: bitflag 7 turned on"); _bitflags |= 1 << 7; } void Script::o_setbackgroundsong() { // 0x08 uint16 fileref = readScript16bits(); - debugScript(1, true, "SetBackgroundSong(0x%04X)", fileref); + debugC(1, kDebugScript, "SetBackgroundSong(0x%04X)", fileref); _vm->_musicPlayer->setBackgroundSong(fileref); } @@ -531,15 +510,15 @@ void Script::o_videofromref() { // 0x09 // Show the debug information just when starting the playback if (fileref != _videoRef) { - debugScript(1, false, "VIDEOFROMREF(0x%04X) (Not fully imp): Play video file from ref", fileref); - debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Playing video 0x%04X via 0x09", fileref); + debugC(1, kDebugScript, "VIDEOFROMREF(0x%04X) (Not fully imp): Play video file from ref", fileref); + debugC(5, kDebugVideo, "Playing video 0x%04X via 0x09", fileref); } switch (fileref) { case 0x1C03: // Trilobyte logo case 0x1C04: // Virgin logo case 0x1C05: // Credits if (fileref != _videoRef) { - debugScript(1, true, "Use external file if available"); + debugC(1, kDebugScript, "Use external file if available"); } break; @@ -551,12 +530,12 @@ void Script::o_videofromref() { // 0x09 case 0x206D: // Cards on table puzzle (bedroom) case 0x2001: // Coins on table puzzle (bedroom) if (fileref != _videoRef) { - debugScript(1, false, " (This video is special somehow!)"); + debugCN(1, kDebugScript, " (This video is special somehow!)"); warning("(This video (0x%04X) is special somehow!)", fileref); } } if (fileref != _videoRef) { - debugScript(1, false, "\n"); + debugCN(1, kDebugScript, "\n"); } // Play the video if (!playvideofromref(fileref)) { @@ -570,14 +549,14 @@ bool Script::playvideofromref(uint32 fileref) { if (fileref != _videoRef) { // Debug bitflags - debugScript(1, false, "Play video 0x%04X (bitflags:", fileref); + debugCN(1, kDebugScript, "Play video 0x%04X (bitflags:", fileref); for (int i = 15; i >= 0; i--) { - debugScript(1, false, "%d", _bitflags & (1 << i)? 1 : 0); + debugCN(1, kDebugScript, "%d", _bitflags & (1 << i)? 1 : 0); if (i % 4 == 0) { - debugScript(1, false, " "); + debugCN(1, kDebugScript, " "); } } - debugScript(1, true, " <- 0)"); + debugC(1, kDebugScript, " <- 0)"); // Close the previous video file if (_videoFile) { @@ -634,7 +613,7 @@ bool Script::playvideofromref(uint32 fileref) { _eventKbdChar = 0; // Newline - debugScript(1, false, "\n"); + debugCN(1, kDebugScript, "\n"); } // Let the caller know if the video has ended @@ -646,12 +625,12 @@ bool Script::playvideofromref(uint32 fileref) { } void Script::o_bf5on() { // 0x0A - debugScript(1, true, "BF5ON: bitflag 5 turned on"); + debugC(1, kDebugScript, "BF5ON: bitflag 5 turned on"); _bitflags |= 1 << 5; } void Script::o_inputloopstart() { //0x0B - debugScript(5, true, "Input loop start"); + debugC(5, kDebugScript, "Input loop start"); // Reset the input action and the mouse cursor _inputAction = -1; @@ -675,7 +654,7 @@ void Script::o_keyboardaction() { uint8 val = readScript8bits(); uint16 address = readScript16bits(); - debugScript(5, true, "Test key == 0x%02X @0x%04X", val, address); + debugC(5, kDebugScript, "Test key == 0x%02X @0x%04X", val, address); // If there's an already planned action, do nothing if (_inputAction != -1) { @@ -700,7 +679,7 @@ void Script::o_hotspot_rect() { uint16 address = readScript16bits(); uint8 cursor = readScript8bits(); - debugScript(5, true, "HOTSPOT-RECT(%d,%d,%d,%d) @0x%04X cursor=%d", left, top, right, bottom, address, cursor); + debugC(5, kDebugScript, "HOTSPOT-RECT(%d,%d,%d,%d) @0x%04X cursor=%d", left, top, right, bottom, address, cursor); // Mark the specified rectangle Common::Rect rect(left, top, right, bottom); @@ -710,7 +689,7 @@ void Script::o_hotspot_rect() { void Script::o_hotspot_left() { uint16 address = readScript16bits(); - debugScript(5, true, "HOTSPOT-LEFT @0x%04X", address); + debugC(5, kDebugScript, "HOTSPOT-LEFT @0x%04X", address); // Mark the leftmost 100 pixels of the game area Common::Rect rect(0, 80, 100, 400); @@ -720,7 +699,7 @@ void Script::o_hotspot_left() { void Script::o_hotspot_right() { uint16 address = readScript16bits(); - debugScript(5, true, "HOTSPOT-RIGHT @0x%04X", address); + debugC(5, kDebugScript, "HOTSPOT-RIGHT @0x%04X", address); // Mark the rightmost 100 pixels of the game area Common::Rect rect(540, 80, 640, 400); @@ -730,7 +709,7 @@ void Script::o_hotspot_right() { void Script::o_hotspot_center() { uint16 address = readScript16bits(); - debugScript(5, true, "HOTSPOT-CENTER @0x%04X", address); + debugC(5, kDebugScript, "HOTSPOT-CENTER @0x%04X", address); // Mark the centermost 240 pixels of the game area Common::Rect rect(200, 80, 440, 400); @@ -740,7 +719,7 @@ void Script::o_hotspot_center() { void Script::o_hotspot_current() { uint16 address = readScript16bits(); - debugScript(5, true, "HOTSPOT-CURRENT @0x%04X", address); + debugC(5, kDebugScript, "HOTSPOT-CURRENT @0x%04X", address); // The original interpreter doesn't check the position, so accept the // whole screen @@ -749,7 +728,7 @@ void Script::o_hotspot_current() { } void Script::o_inputloopend() { - debugScript(5, true, "Input loop end"); + debugC(5, kDebugScript, "Input loop end"); // Handle the predefined hotspots if (_hotspotTopAction) { @@ -802,7 +781,7 @@ void Script::o_random() { uint16 varnum = readScript8or16bits(); uint8 maxnum = readScript8bits(); - debugScript(1, true, "RANDOM: var[0x%04X] = rand(%d)", varnum, maxnum); + debugC(1, kDebugScript, "RANDOM: var[0x%04X] = rand(%d)", varnum, maxnum); setVariable(varnum, _random.getRandomNumber(maxnum)); } @@ -810,7 +789,7 @@ void Script::o_random() { void Script::o_jmp() { uint16 address = readScript16bits(); - debugScript(1, true, "JMP @0x%04X", address); + debugC(1, kDebugScript, "JMP @0x%04X", address); // Set the current address _currentInstruction = address; @@ -819,18 +798,18 @@ void Script::o_jmp() { void Script::o_loadstring() { uint16 varnum = readScript8or16bits(); - debugScript(1, false, "LOADSTRING var[0x%04X..] =", varnum); + debugCN(1, kDebugScript, "LOADSTRING var[0x%04X..] =", varnum); do { setVariable(varnum++, readScriptChar(true, true, true)); - debugScript(1, false, " 0x%02X", _variables[varnum - 1]); + debugCN(1, kDebugScript, " 0x%02X", _variables[varnum - 1]); } while (!(getCodeByte(_currentInstruction - 1) & 0x80)); - debugScript(1, false, "\n"); + debugCN(1, kDebugScript, "\n"); } void Script::o_ret() { uint8 val = readScript8bits(); - debugScript(1, true, "RET %d", val); + debugC(1, kDebugScript, "RET %d", val); // Set the return value setVariable(0x102, val); @@ -847,7 +826,7 @@ void Script::o_ret() { void Script::o_call() { uint16 address = readScript16bits(); - debugScript(1, true, "CALL @0x%04X", address); + debugC(1, kDebugScript, "CALL @0x%04X", address); // Save return address in the call stack _stack[_stacktop] = _currentInstruction; @@ -860,7 +839,7 @@ void Script::o_call() { void Script::o_sleep() { uint16 time = readScript16bits(); - debugScript(1, true, "SLEEP 0x%04X", time); + debugC(1, kDebugScript, "SLEEP 0x%04X", time); _vm->_system->delayMillis(time * 3); } @@ -869,7 +848,7 @@ void Script::o_strcmpnejmp() { // 0x1A uint16 varnum = readScript8or16bits(); uint8 result = 1; - debugScript(1, false, "STRCMP-NEJMP: var[0x%04X..],", varnum); + debugCN(1, kDebugScript, "STRCMP-NEJMP: var[0x%04X..],", varnum); do { uint8 val = readScriptChar(true, true, true); @@ -878,33 +857,33 @@ void Script::o_strcmpnejmp() { // 0x1A result = 0; } varnum++; - debugScript(1, false, " 0x%02X", val); + debugCN(1, kDebugScript, " 0x%02X", val); } while (!(getCodeByte(_currentInstruction - 1) & 0x80)); uint16 address = readScript16bits(); if (!result) { - debugScript(1, true, " jumping to @0x%04X", address); + debugC(1, kDebugScript, " jumping to @0x%04X", address); _currentInstruction = address; } else { - debugScript(1, true, " not jumping"); + debugC(1, kDebugScript, " not jumping"); } } void Script::o_xor_obfuscate() { uint16 varnum = readScript8or16bits(); - debugScript(1, false, "XOR OBFUSCATE: var[0x%04X..] = ", varnum); + debugCN(1, kDebugScript, "XOR OBFUSCATE: var[0x%04X..] = ", varnum); do { uint8 val = readScript8bits(); _firstbit = ((val & 0x80) != 0); val &= 0x4F; setVariable(varnum, _variables[varnum] ^ val); - debugScript(1, false, "%c", _variables[varnum]); + debugCN(1, kDebugScript, "%c", _variables[varnum]); varnum++; } while (!_firstbit); - debugScript(1, false, "\n"); + debugCN(1, kDebugScript, "\n"); } void Script::o_vdxtransition() { // 0x1C @@ -912,8 +891,8 @@ void Script::o_vdxtransition() { // 0x1C // Show the debug information just when starting the playback if (fileref != _videoRef) { - debugScript(1, true, "VDX transition fileref = 0x%04X", fileref); - debugC(1, kGroovieDebugVideo | kGroovieDebugAll, "Playing video 0x%04X with transition", fileref); + debugC(1, kDebugScript, "VDX transition fileref = 0x%04X", fileref); + debugC(1, kDebugVideo, "Playing video 0x%04X with transition", fileref); } // Set bit 1 @@ -938,7 +917,7 @@ void Script::o_swap() { uint16 varnum1 = readScript8or16bits(); uint16 varnum2 = readScript16bits(); - debugScript(1, true, "SWAP var[0x%04X] <-> var[0x%04X]", varnum1, varnum2); + debugC(1, kDebugScript, "SWAP var[0x%04X] <-> var[0x%04X]", varnum1, varnum2); uint8 tmp = _variables[varnum1]; setVariable(varnum1, _variables[varnum2]); @@ -948,7 +927,7 @@ void Script::o_swap() { void Script::o_inc() { uint16 varnum = readScript8or16bits(); - debugScript(1, true, "INC var[0x%04X]", varnum); + debugC(1, kDebugScript, "INC var[0x%04X]", varnum); setVariable(varnum, _variables[varnum] + 1); } @@ -956,7 +935,7 @@ void Script::o_inc() { void Script::o_dec() { uint16 varnum = readScript8or16bits(); - debugScript(1, true, "DEC var[0x%04X]", varnum); + debugC(1, kDebugScript, "DEC var[0x%04X]", varnum); setVariable(varnum, _variables[varnum] - 1); } @@ -982,7 +961,7 @@ void Script::o_strcmpnejmp_var() { // 0x21 } void Script::o_copybgtofg() { // 0x22 - debugScript(1, true, "COPY_BG_TO_FG"); + debugC(1, kDebugScript, "COPY_BG_TO_FG"); memcpy(_vm->_graphicsMan->_foreground.getPixels(), _vm->_graphicsMan->_background.getPixels(), 640 * 320); } @@ -990,7 +969,7 @@ void Script::o_strcmpeqjmp() { // 0x23 uint16 varnum = readScript8or16bits(); uint8 result = 1; - debugScript(1, false, "STRCMP-EQJMP: var[0x%04X..],", varnum); + debugCN(1, kDebugScript, "STRCMP-EQJMP: var[0x%04X..],", varnum); do { uint8 val = readScriptChar(true, true, true); @@ -998,15 +977,15 @@ void Script::o_strcmpeqjmp() { // 0x23 result = 0; } varnum++; - debugScript(1, false, " 0x%02X", val); + debugCN(1, kDebugScript, " 0x%02X", val); } while (!(getCodeByte(_currentInstruction - 1) & 0x80)); uint16 address = readScript16bits(); if (result) { - debugScript(1, true, " jumping to @0x%04X", address); + debugC(1, kDebugScript, " jumping to @0x%04X", address); _currentInstruction = address; } else { - debugScript(1, true, " not jumping"); + debugC(1, kDebugScript, " not jumping"); } } @@ -1014,7 +993,7 @@ void Script::o_mov() { uint16 varnum1 = readScript8or16bits(); uint16 varnum2 = readScript16bits(); - debugScript(1, true, "MOV var[0x%04X] = var[0x%04X]", varnum1, varnum2); + debugC(1, kDebugScript, "MOV var[0x%04X] = var[0x%04X]", varnum1, varnum2); setVariable(varnum1, _variables[varnum2]); } @@ -1023,7 +1002,7 @@ void Script::o_add() { uint16 varnum1 = readScript8or16bits(); uint16 varnum2 = readScript16bits(); - debugScript(1, true, "ADD var[0x%04X] += var[0x%04X]", varnum1, varnum2); + debugC(1, kDebugScript, "ADD var[0x%04X] += var[0x%04X]", varnum1, varnum2); setVariable(varnum1, _variables[varnum1] + _variables[varnum2]); } @@ -1034,7 +1013,7 @@ void Script::o_videofromstring1() { // Show the debug information just when starting the playback if (fileref != _videoRef) { - debugScript(0, true, "VIDEOFROMSTRING1 0x%04X", fileref); + debugC(0, kDebugScript, "VIDEOFROMSTRING1 0x%04X", fileref); } // Play the video @@ -1050,7 +1029,7 @@ void Script::o_videofromstring2() { // Show the debug information just when starting the playback if (fileref != _videoRef) { - debugScript(0, true, "VIDEOFROMSTRING2 0x%04X", fileref); + debugC(0, kDebugScript, "VIDEOFROMSTRING2 0x%04X", fileref); } // Set bit 1 @@ -1069,11 +1048,11 @@ void Script::o_videofromstring2() { } void Script::o_stopmidi() { - debugScript(1, true, "STOPMIDI (TODO)"); + debugC(1, kDebugScript, "STOPMIDI (TODO)"); } void Script::o_endscript() { - debugScript(1, true, "END OF SCRIPT"); + debugC(1, kDebugScript, "END OF SCRIPT"); _vm->quitGame(); } @@ -1081,7 +1060,7 @@ void Script::o_sethotspottop() { uint16 address = readScript16bits(); uint8 cursor = readScript8bits(); - debugScript(5, true, "SETHOTSPOTTOP @0x%04X cursor=%d", address, cursor); + debugC(5, kDebugScript, "SETHOTSPOTTOP @0x%04X cursor=%d", address, cursor); _hotspotTopAction = address; _hotspotTopCursor = cursor; @@ -1091,7 +1070,7 @@ void Script::o_sethotspotbottom() { uint16 address = readScript16bits(); uint8 cursor = readScript8bits(); - debugScript(5, true, "SETHOTSPOTBOTTOM @0x%04X cursor=%d", address, cursor); + debugC(5, kDebugScript, "SETHOTSPOTBOTTOM @0x%04X cursor=%d", address, cursor); _hotspotBottomAction = address; _hotspotBottomCursor = cursor; @@ -1101,7 +1080,7 @@ void Script::o_loadgame() { uint16 varnum = readScript8or16bits(); uint8 slot = _variables[varnum]; - debugScript(1, true, "LOADGAME var[0x%04X] -> slot=%d (TODO)", varnum, slot); + debugC(1, kDebugScript, "LOADGAME var[0x%04X] -> slot=%d (TODO)", varnum, slot); loadgame(slot); _vm->_system->fillScreen(0); @@ -1111,7 +1090,7 @@ void Script::o_savegame() { uint16 varnum = readScript8or16bits(); uint8 slot = _variables[varnum]; - debugScript(1, true, "SAVEGAME var[0x%04X] -> slot=%d (TODO)", varnum, slot); + debugC(1, kDebugScript, "SAVEGAME var[0x%04X] -> slot=%d (TODO)", varnum, slot); savegame(slot); } @@ -1119,7 +1098,7 @@ void Script::o_savegame() { void Script::o_hotspotbottom_4() { //0x30 uint16 address = readScript16bits(); - debugScript(5, true, "HOTSPOT-BOTTOM @0x%04X", address); + debugC(5, kDebugScript, "HOTSPOT-BOTTOM @0x%04X", address); // Mark the 80 pixels under the game area Common::Rect rect(0, 400, 640, 480); @@ -1130,7 +1109,7 @@ void Script::o_midivolume() { uint16 arg1 = readScript16bits(); uint16 arg2 = readScript16bits(); - debugScript(1, true, "MIDI volume: %d %d", arg1, arg2); + debugC(1, kDebugScript, "MIDI volume: %d %d", arg1, arg2); _vm->_musicPlayer->setGameVolume(arg1, arg2); } @@ -1139,13 +1118,13 @@ void Script::o_jne() { uint16 varnum2 = readScript16bits(); uint16 address = readScript16bits(); - debugScript(1, false, "JNE: var[var[0x%04X] - 0x31] != var[0x%04X] @0x%04X", varnum1, varnum2, address); + debugCN(1, kDebugScript, "JNE: var[var[0x%04X] - 0x31] != var[0x%04X] @0x%04X", varnum1, varnum2, address); if (_variables[_variables[varnum1] - 0x31] != _variables[varnum2]) { _currentInstruction = address; - debugScript(1, true, " jumping to @0x%04X", address); + debugC(1, kDebugScript, " jumping to @0x%04X", address); } else { - debugScript(1, true, " not jumping"); + debugC(1, kDebugScript, " not jumping"); } } @@ -1153,19 +1132,19 @@ void Script::o_loadstringvar() { uint16 varnum = readScript8or16bits(); varnum = _variables[varnum] - 0x31; - debugScript(1, false, "LOADSTRINGVAR var[0x%04X..] =", varnum); + debugCN(1, kDebugScript, "LOADSTRINGVAR var[0x%04X..] =", varnum); do { setVariable(varnum++, readScriptChar(true, true, true)); - debugScript(1, false, " 0x%02X", _variables[varnum - 1]); + debugCN(1, kDebugScript, " 0x%02X", _variables[varnum - 1]); } while (!(getCodeByte(_currentInstruction - 1) & 0x80)); - debugScript(1, false, "\n"); + debugCN(1, kDebugScript, "\n"); } void Script::o_chargreatjmp() { uint16 varnum = readScript8or16bits(); uint8 result = 0; - debugScript(1, false, "CHARGREAT-JMP: var[0x%04X..],", varnum); + debugCN(1, kDebugScript, "CHARGREAT-JMP: var[0x%04X..],", varnum); do { uint8 val = readScriptChar(true, true, true); @@ -1173,20 +1152,20 @@ void Script::o_chargreatjmp() { result = 1; } varnum++; - debugScript(1, false, " 0x%02X", val); + debugCN(1, kDebugScript, " 0x%02X", val); } while (!(getCodeByte(_currentInstruction - 1) & 0x80)); uint16 address = readScript16bits(); if (result) { - debugScript(1, true, " jumping to @0x%04X", address); + debugC(1, kDebugScript, " jumping to @0x%04X", address); _currentInstruction = address; } else { - debugScript(1, true, " not jumping"); + debugC(1, kDebugScript, " not jumping"); } } void Script::o_bf7off() { - debugScript(1, true, "BF7OFF: bitflag 7 turned off"); + debugC(1, kDebugScript, "BF7OFF: bitflag 7 turned off"); _bitflags &= ~(1 << 7); } @@ -1194,7 +1173,7 @@ void Script::o_charlessjmp() { uint16 varnum = readScript8or16bits(); uint8 result = 0; - debugScript(1, false, "CHARLESS-JMP: var[0x%04X..],", varnum); + debugCN(1, kDebugScript, "CHARLESS-JMP: var[0x%04X..],", varnum); do { uint8 val = readScriptChar(true, true, true); @@ -1202,15 +1181,15 @@ void Script::o_charlessjmp() { result = 1; } varnum++; - debugScript(1, false, " 0x%02X", val); + debugCN(1, kDebugScript, " 0x%02X", val); } while (!(getCodeByte(_currentInstruction - 1) & 0x80)); uint16 address = readScript16bits(); if (result) { - debugScript(1, true, " jumping to @0x%04X", address); + debugC(1, kDebugScript, " jumping to @0x%04X", address); _currentInstruction = address; } else { - debugScript(1, true, " not jumping"); + debugC(1, kDebugScript, " not jumping"); } } @@ -1262,7 +1241,7 @@ void Script::o_copyrecttobg() { // 0x37 uint32 offset = 0; byte *fg, *bg; - debugScript(1, true, "COPYRECT((%d,%d)->(%d,%d))", left, top, right, bottom); + debugC(1, kDebugScript, "COPYRECT((%d,%d)->(%d,%d))", left, top, right, bottom); fg = (byte *)_vm->_graphicsMan->_foreground.getBasePtr(left, top - 80); bg = (byte *)_vm->_graphicsMan->_background.getBasePtr(left, top - 80); @@ -1275,13 +1254,13 @@ void Script::o_copyrecttobg() { // 0x37 } void Script::o_restorestkpnt() { - debugScript(1, true, "Restore stack pointer from saved (TODO)"); + debugC(1, kDebugScript, "Restore stack pointer from saved (TODO)"); } void Script::o_obscureswap() { uint16 var1, var2, tmp; - debugScript(1, true, "OBSCSWAP"); + debugC(1, kDebugScript, "OBSCSWAP"); // Read the first variable var1 = readScriptChar(false, true, true) * 10; @@ -1301,7 +1280,7 @@ void Script::o_printstring() { char stringstorage[15]; uint8 counter = 0; - debugScript(1, true, "PRINTSTRING"); + debugC(1, kDebugScript, "PRINTSTRING"); memset(stringstorage, 0, 15); do { @@ -1339,7 +1318,7 @@ void Script::o_hotspot_slot() { uint16 address = readScript16bits(); uint16 cursor = readScript8bits(); - debugScript(1, true, "HOTSPOT-SLOT %d (%d,%d,%d,%d) @0x%04X cursor=%d (TODO)", slot, left, top, right, bottom, address, cursor); + debugC(1, kDebugScript, "HOTSPOT-SLOT %d (%d,%d,%d,%d) @0x%04X cursor=%d (TODO)", slot, left, top, right, bottom, address, cursor); Common::Rect rect(left, top, right, bottom); if (hotspot(rect, address, cursor)) { @@ -1377,7 +1356,7 @@ void Script::o_hotspot_slot() { } void Script::o_checkvalidsaves() { - debugScript(1, true, "CHECKVALIDSAVES"); + debugC(1, kDebugScript, "CHECKVALIDSAVES"); // Reset the array of valid saves and the savegame names cache for (int i = 0; i < 10; i++) { @@ -1394,7 +1373,7 @@ void Script::o_checkvalidsaves() { while (it != list.end()) { int8 slot = it->getSaveSlot(); if (SaveLoad::isSlotValid(slot)) { - debugScript(2, true, " Found valid savegame: %s", it->getDescription().c_str()); + debugC(2, kDebugScript, " Found valid savegame: %s", it->getDescription().c_str()); // Mark this slot as used setVariable(slot, 1); @@ -1408,11 +1387,11 @@ void Script::o_checkvalidsaves() { // Save the number of valid saves setVariable(0x104, count); - debugScript(1, true, " Found %d valid savegames", count); + debugC(1, kDebugScript, " Found %d valid savegames", count); } void Script::o_resetvars() { - debugScript(1, true, "RESETVARS"); + debugC(1, kDebugScript, "RESETVARS"); for (int i = 0; i < 0x100; i++) { setVariable(i, 0); } @@ -1422,7 +1401,7 @@ void Script::o_mod() { uint16 varnum = readScript8or16bits(); uint8 val = readScript8bits(); - debugScript(1, true, "MOD var[0x%04X] %%= %d", varnum, val); + debugC(1, kDebugScript, "MOD var[0x%04X] %%= %d", varnum, val); setVariable(varnum, _variables[varnum] % val); } @@ -1434,7 +1413,7 @@ void Script::o_loadscript() { while ((c = readScript8bits())) { filename += c; } - debugScript(1, true, "LOADSCRIPT %s", filename.c_str()); + debugC(1, kDebugScript, "LOADSCRIPT %s", filename.c_str()); // Just 1 level of sub-scripts are allowed if (_savedCode) { @@ -1469,7 +1448,7 @@ void Script::o_setvideoorigin() { // Set bitflag 7 _bitflags |= 1 << 7; - debugScript(1, true, "SetVideoOrigin(0x%04X,0x%04X) (%d, %d)", origX, origY, origX, origY); + debugC(1, kDebugScript, "SetVideoOrigin(0x%04X,0x%04X) (%d, %d)", origX, origY, origX, origY); _vm->_videoPlayer->setOrigin(origX, origY); } @@ -1477,7 +1456,7 @@ void Script::o_sub() { uint16 varnum1 = readScript8or16bits(); uint16 varnum2 = readScript16bits(); - debugScript(1, true, "SUB var[0x%04X] -= var[0x%04X]", varnum1, varnum2); + debugC(1, kDebugScript, "SUB var[0x%04X] -= var[0x%04X]", varnum1, varnum2); setVariable(varnum1, _variables[varnum1] - _variables[varnum2]); } @@ -1487,7 +1466,7 @@ void Script::o_cellmove() { byte *scriptBoard = &_variables[0x19]; byte startX, startY, endX, endY; - debugScript(1, true, "CELL MOVE var[0x%02X]", depth); + debugC(1, kDebugScript, "CELL MOVE var[0x%02X]", depth); if (!_staufsMove) _staufsMove = new CellGame; @@ -1510,7 +1489,7 @@ void Script::o_cellmove() { void Script::o_returnscript() { uint8 val = readScript8bits(); - debugScript(1, true, "RETURNSCRIPT @0x%02X", val); + debugC(1, kDebugScript, "RETURNSCRIPT @0x%02X", val); // Are we returning from a sub-script? if (!_savedCode) { @@ -1543,7 +1522,7 @@ void Script::o_returnscript() { void Script::o_sethotspotright() { uint16 address = readScript16bits(); - debugScript(1, true, "SETHOTSPOTRIGHT @0x%04X", address); + debugC(1, kDebugScript, "SETHOTSPOTRIGHT @0x%04X", address); _hotspotRightAction = address; } @@ -1551,13 +1530,13 @@ void Script::o_sethotspotright() { void Script::o_sethotspotleft() { uint16 address = readScript16bits(); - debugScript(1, true, "SETHOTSPOTLEFT @0x%04X", address); + debugC(1, kDebugScript, "SETHOTSPOTLEFT @0x%04X", address); _hotspotLeftAction = address; } void Script::o_getcd() { - debugScript(1, true, "GETCD"); + debugC(1, kDebugScript, "GETCD"); // By default set it to no CD available int8 cd = -1; @@ -1584,7 +1563,7 @@ void Script::o_getcd() { void Script::o_playcd() { uint8 val = readScript8bits(); - debugScript(1, true, "PLAYCD %d", val); + debugC(1, kDebugScript, "PLAYCD %d", val); if (val == 2) { // TODO: Play the alternative logo @@ -1596,7 +1575,7 @@ void Script::o_playcd() { void Script::o_musicdelay() { uint16 delay = readScript16bits(); - debugScript(1, true, "MUSICDELAY %d", delay); + debugC(1, kDebugScript, "MUSICDELAY %d", delay); _vm->_musicPlayer->setBackgroundDelay(delay); } @@ -1608,7 +1587,7 @@ void Script::o_hotspot_outrect() { uint16 bottom = readScript16bits(); uint16 address = readScript16bits(); - debugScript(1, true, "HOTSPOT-OUTRECT(%d,%d,%d,%d) @0x%04X (TODO)", left, top, right, bottom, address); + debugC(1, kDebugScript, "HOTSPOT-OUTRECT(%d,%d,%d,%d) @0x%04X (TODO)", left, top, right, bottom, address); // Test if the current mouse position is outside the specified rectangle Common::Rect rect(left, top, right, bottom); @@ -1626,25 +1605,25 @@ void Script::o_stub56() { uint8 val2 = readScript8bits(); uint8 val3 = readScript8bits(); - debugScript(1, true, "STUB56: 0x%08X 0x%02X 0x%02X", val1, val2, val3); + debugC(1, kDebugScript, "STUB56: 0x%08X 0x%02X 0x%02X", val1, val2, val3); } void Script::o_stub59() { uint16 val1 = readScript8or16bits(); uint8 val2 = readScript8bits(); - debugScript(1, true, "STUB59: 0x%04X 0x%02X", val1, val2); + debugC(1, kDebugScript, "STUB59: 0x%04X 0x%02X", val1, val2); } void Script::o2_playsong() { uint32 fileref = readScript32bits(); - debugScript(1, true, "PlaySong(0x%08X): Play xmidi file", fileref); + debugC(1, kDebugScript, "PlaySong(0x%08X): Play xmidi file", fileref); _vm->_musicPlayer->playSong(fileref); } void Script::o2_setbackgroundsong() { uint32 fileref = readScript32bits(); - debugScript(1, true, "SetBackgroundSong(0x%08X)", fileref); + debugC(1, kDebugScript, "SetBackgroundSong(0x%08X)", fileref); _vm->_musicPlayer->setBackgroundSong(fileref); } @@ -1653,8 +1632,8 @@ void Script::o2_videofromref() { // Show the debug information just when starting the playback if (fileref != _videoRef) { - debugScript(1, true, "VIDEOFROMREF(0x%08X) (Not fully imp): Play video file from ref", fileref); - debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Playing video 0x%08X via 0x09", fileref); + debugC(1, kDebugScript, "VIDEOFROMREF(0x%08X) (Not fully imp): Play video file from ref", fileref); + debugC(5, kDebugVideo, "Playing video 0x%08X via 0x09", fileref); } // Play the video @@ -1669,8 +1648,8 @@ void Script::o2_vdxtransition() { // Show the debug information just when starting the playback if (fileref != _videoRef) { - debugScript(1, true, "VDX transition fileref = 0x%08X", fileref); - debugC(1, kGroovieDebugVideo | kGroovieDebugAll, "Playing video 0x%08X with transition", fileref); + debugC(1, kDebugScript, "VDX transition fileref = 0x%08X", fileref); + debugC(1, kDebugVideo, "Playing video 0x%08X with transition", fileref); } // Set bit 1 @@ -1691,30 +1670,30 @@ void Script::o2_vdxtransition() { void Script::o2_copyscreentobg() { uint16 val = readScript16bits(); - debugScript(1, true, "CopyScreenToBG3: 0x%04X", val); + debugC(1, kDebugScript, "CopyScreenToBG3: 0x%04X", val); error("Unimplemented Opcode 0x4F"); } void Script::o2_copybgtoscreen() { uint16 val = readScript16bits(); - debugScript(1, true, "CopyBG3ToScreen: 0x%04X", val); + debugC(1, kDebugScript, "CopyBG3ToScreen: 0x%04X", val); error("Unimplemented Opcode 0x50"); } void Script::o2_setvideoskip() { _videoSkipAddress = readScript16bits(); - debugScript(1, true, "SetVideoSkip (0x%04X)", _videoSkipAddress); + debugC(1, kDebugScript, "SetVideoSkip (0x%04X)", _videoSkipAddress); } void Script::o2_stub52() { uint8 arg = readScript8bits(); - debugScript(1, true, "STUB52 (0x%02X)", arg); + debugC(1, kDebugScript, "STUB52 (0x%02X)", arg); } void Script::o2_setscriptend() { uint16 arg = readScript16bits(); - debugScript(1, true, "SetScriptEnd (0x%04X)", arg); + debugC(1, kDebugScript, "SetScriptEnd (0x%04X)", arg); } Script::OpcodeFunc Script::_opcodesT7G[NUM_OPCODES] = { diff --git a/engines/groovie/vdx.cpp b/engines/groovie/vdx.cpp index 4626a6f81b..09c2e0d3ea 100644 --- a/engines/groovie/vdx.cpp +++ b/engines/groovie/vdx.cpp @@ -56,8 +56,7 @@ void VDXPlayer::setOrigin(int16 x, int16 y) { } uint16 VDXPlayer::loadInternal() { - if (DebugMan.isDebugChannelEnabled(kGroovieDebugVideo) || - DebugMan.isDebugChannelEnabled(kGroovieDebugAll)) { + if (DebugMan.isDebugChannelEnabled(kDebugVideo)) { int8 i; debugN(1, "Groovie::VDX: New VDX: bitflags are "); for (i = 15; i >= 0; i--) { @@ -106,24 +105,24 @@ uint16 VDXPlayer::loadInternal() { //_flagUpdateStill = _flagNine || _flagSix; // Begin reading the file - debugC(1, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::VDX: Playing video"); + debugC(1, kDebugVideo, "Groovie::VDX: Playing video"); if (_file->readUint16LE() != VDX_IDENT) { error("Groovie::VDX: This does not appear to be a 7th guest VDX file"); return 0; } else { - debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::VDX: VDX file identified correctly"); + debugC(5, kDebugVideo, "Groovie::VDX: VDX file identified correctly"); } uint16 tmp; // Skip unknown data: 6 bytes, ref Martine tmp = _file->readUint16LE(); - debugC(2, kGroovieDebugVideo | kGroovieDebugUnknown | kGroovieDebugAll, "Groovie::VDX: Martine1 = 0x%04X", tmp); + debugC(2, kDebugVideo | kDebugUnknown, "Groovie::VDX: Martine1 = 0x%04X", tmp); tmp = _file->readUint16LE(); - debugC(2, kGroovieDebugVideo | kGroovieDebugUnknown | kGroovieDebugAll, "Groovie::VDX: Martine2 = 0x%04X", tmp); + debugC(2, kDebugVideo | kDebugUnknown, "Groovie::VDX: Martine2 = 0x%04X", tmp); tmp = _file->readUint16LE(); - debugC(2, kGroovieDebugVideo | kGroovieDebugUnknown | kGroovieDebugAll, "Groovie::VDX: Martine3 (FPS?) = %d", tmp); + debugC(2, kDebugVideo | kDebugUnknown, "Groovie::VDX: Martine3 (FPS?) = %d", tmp); return tmp; } @@ -144,7 +143,7 @@ bool VDXPlayer::playFrameInternal() { if (_file->eos()) break; - debugC(5, kGroovieDebugVideo | kGroovieDebugUnknown | kGroovieDebugAll, "Groovie::VDX: Edward = 0x%04X", tmp); + debugC(5, kDebugVideo | kDebugUnknown, "Groovie::VDX: Edward = 0x%04X", tmp); // Read the chunk data and decompress if needed if (compSize) @@ -159,18 +158,18 @@ bool VDXPlayer::playFrameInternal() { // Use the current chunk switch (currRes) { case 0x00: - debugC(6, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::VDX: Replay frame"); + debugC(6, kDebugVideo, "Groovie::VDX: Replay frame"); break; case 0x20: - debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::VDX: Still frame"); + debugC(5, kDebugVideo, "Groovie::VDX: Still frame"); getStill(vdxData); break; case 0x25: - debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::VDX: Animation frame"); + debugC(5, kDebugVideo, "Groovie::VDX: Animation frame"); getDelta(vdxData); break; case 0x80: - debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::VDX: Sound resource"); + debugC(5, kDebugVideo, "Groovie::VDX: Sound resource"); chunkSound(vdxData); break; default: @@ -182,7 +181,7 @@ bool VDXPlayer::playFrameInternal() { // Wait until the current frame can be shown - if (!DebugMan.isDebugChannelEnabled(kGroovieDebugFast)) { + if (!DebugMan.isDebugChannelEnabled(kDebugFast)) { waitFrame(); } // TODO: Move it to a better place @@ -344,13 +343,13 @@ void VDXPlayer::getDelta(Common::ReadStream *in) { void VDXPlayer::getStill(Common::ReadStream *in) { uint16 numXTiles = in->readUint16LE(); - debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::VDX: numXTiles=%d", numXTiles); + debugC(5, kDebugVideo, "Groovie::VDX: numXTiles=%d", numXTiles); uint16 numYTiles = in->readUint16LE(); - debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::VDX: numYTiles=%d", numYTiles); + debugC(5, kDebugVideo, "Groovie::VDX: numYTiles=%d", numYTiles); // It's skipped in the original: uint16 colorDepth = in->readUint16LE(); - debugC(5, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::VDX: colorDepth=%d", colorDepth); + debugC(5, kDebugVideo, "Groovie::VDX: colorDepth=%d", colorDepth); uint16 imageWidth = TILE_SIZE * numXTiles; @@ -423,7 +422,7 @@ void VDXPlayer::getStill(Common::ReadStream *in) { */ } else { // Skip the remaining data - debugC(10, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::VDX: Skipping still frame"); + debugC(10, kDebugVideo, "Groovie::VDX: Skipping still frame"); while (!in->eos()) { in->readByte(); } @@ -538,7 +537,7 @@ void VDXPlayer::chunkSound(Common::ReadStream *in) { byte *data = (byte *)malloc(60000); int chunksize = in->read(data, 60000); - if (!DebugMan.isDebugChannelEnabled(kGroovieDebugFast)) { + if (!DebugMan.isDebugChannelEnabled(kDebugFast)) { _audioStream->queueBuffer(data, chunksize, DisposeAfterUse::YES, Audio::FLAG_UNSIGNED); } } @@ -563,7 +562,7 @@ void VDXPlayer::setPalette(uint8 *palette) { if (_flagSkipPalette) return; - debugC(7, kGroovieDebugVideo | kGroovieDebugAll, "Groovie::VDX: Setting palette"); + debugC(7, kDebugVideo, "Groovie::VDX: Setting palette"); _syst->getPaletteManager()->setPalette(palette, 0, 256); } diff --git a/gui/debugger.cpp b/gui/debugger.cpp index 4d97338b9c..21d49774af 100644 --- a/gui/debugger.cpp +++ b/gui/debugger.cpp @@ -542,9 +542,12 @@ bool Debugger::cmdDebugFlagsList(int argc, const char **argv) { bool Debugger::cmdDebugFlagEnable(int argc, const char **argv) { if (argc < 2) { - debugPrintf("debugflag_enable <flag>\n"); + debugPrintf("debugflag_enable [<flag> | all]\n"); } else { - if (DebugMan.enableDebugChannel(argv[1])) { + if (Common::String(argv[1]) == "all") { + debugPrintf("Enabled all debug flags\n"); + DebugMan.enableAllDebugChannels(); + } else if (DebugMan.enableDebugChannel(argv[1])) { debugPrintf("Enabled debug flag '%s'\n", argv[1]); } else { debugPrintf("Failed to enable debug flag '%s'\n", argv[1]); @@ -555,9 +558,12 @@ bool Debugger::cmdDebugFlagEnable(int argc, const char **argv) { bool Debugger::cmdDebugFlagDisable(int argc, const char **argv) { if (argc < 2) { - debugPrintf("debugflag_disable <flag>\n"); + debugPrintf("debugflag_disable [<flag> | all]\n"); } else { - if (DebugMan.disableDebugChannel(argv[1])) { + if (Common::String(argv[1]) == "all") { + debugPrintf("Disabled all debug flags\n"); + DebugMan.disableAllDebugChannels(); + } else if (DebugMan.disableDebugChannel(argv[1])) { debugPrintf("Disabled debug flag '%s'\n", argv[1]); } else { debugPrintf("Failed to disable debug flag '%s'\n", argv[1]); |