AGI: Replace report() macro by debug() / warning()

This makes AGI quite a bit less noisy by default.

svn-id: r53868
This commit is contained in:
Max Horn 2010-10-26 22:33:49 +00:00
parent 4e2d1b507a
commit 7c2323bdc3
12 changed files with 41 additions and 49 deletions

View file

@ -360,12 +360,12 @@ int AgiEngine::agiInit() {
switch (getVersion() >> 12) { switch (getVersion() >> 12) {
case 2: case 2:
report("Emulating Sierra AGI v%x.%03x\n", debug("Emulating Sierra AGI v%x.%03x\n",
(int)(getVersion() >> 12) & 0xF, (int)(getVersion() >> 12) & 0xF,
(int)(getVersion()) & 0xFFF); (int)(getVersion()) & 0xFFF);
break; break;
case 3: case 3:
report("Emulating Sierra AGI v%x.002.%03x\n", debug("Emulating Sierra AGI v%x.002.%03x\n",
(int)(getVersion() >> 12) & 0xF, (int)(getVersion() >> 12) & 0xF,
(int)(getVersion()) & 0xFFF); (int)(getVersion()) & 0xFFF);
break; break;
@ -382,10 +382,10 @@ int AgiEngine::agiInit() {
_game.sbuf = _game.sbuf256c; _game.sbuf = _game.sbuf256c;
if (_game.gameFlags & ID_AMIGA) if (_game.gameFlags & ID_AMIGA)
report("Amiga padded game detected.\n"); debug(1, "Amiga padded game detected.");
if (_game.gameFlags & ID_AGDS) if (_game.gameFlags & ID_AGDS)
report("AGDS mode enabled.\n"); debug(1, "AGDS mode enabled.");
ec = _loader->init(); // load vol files, etc ec = _loader->init(); // load vol files, etc
@ -655,7 +655,7 @@ void AgiEngine::initialize() {
_game.state = STATE_LOADED; _game.state = STATE_LOADED;
debugC(2, kDebugLevelMain, "game loaded"); debugC(2, kDebugLevelMain, "game loaded");
} else { } else {
report("Could not open AGI game"); warning("Could not open AGI game");
} }
debugC(2, kDebugLevelMain, "Init sound"); debugC(2, kDebugLevelMain, "Init sound");
@ -703,7 +703,6 @@ Common::Error AgiBase::init() {
Common::Error AgiEngine::go() { Common::Error AgiEngine::go() {
CursorMan.showMouse(true); CursorMan.showMouse(true);
report(" \nAGI engine %s is ready.\n", gScummVMVersion);
if (_game.state < STATE_LOADED) { if (_game.state < STATE_LOADED) {
do { do {
mainCycle(); mainCycle();
@ -747,7 +746,7 @@ void AgiEngine::parseFeatures() {
for (int i = 0; i < numFeatures; i++) { for (int i = 0; i < numFeatures; i++) {
for (const Flags *flag = flags; flag->name; flag++) { for (const Flags *flag = flags; flag->name; flag++) {
if (!scumm_stricmp(feature[i], flag->name)) { if (!scumm_stricmp(feature[i], flag->name)) {
debug(0, "Added feature: %s", flag->name); debug(2, "Added feature: %s", flag->name);
setFeature(flag->flag); setFeature(flag->flag);
break; break;

View file

@ -236,8 +236,6 @@ enum AgiMouseButton {
kAgiMouseButtonMiddle // Middle mouse button kAgiMouseButtonMiddle // Middle mouse button
}; };
#define report printf
enum GameId { enum GameId {
GID_AGI = 1 GID_AGI = 1
}; };

View file

@ -152,7 +152,7 @@ bool Console::Cmd_Flags(int argc, const char **argv) {
for (j = 0; j < 10; j++, i++) { for (j = 0; j < 10; j++, i++) {
DebugPrintf("%c ", _vm->getflag(i) ? 'T' : 'F'); DebugPrintf("%c ", _vm->getflag(i) ? 'T' : 'F');
} }
report("\n"); DebugPrintf("\n");
} }
return true; return true;

View file

@ -319,12 +319,12 @@ int AgiEngine::playGame() {
// We run AGIMOUSE always as a side effect // We run AGIMOUSE always as a side effect
if (getFeatures() & GF_AGIMOUSE || true) if (getFeatures() & GF_AGIMOUSE || true)
report("Using AGI Mouse 1.0 protocol\n"); debug(1, "Using AGI Mouse 1.0 protocol");
if (getFeatures() & GF_AGIPAL) if (getFeatures() & GF_AGIPAL)
debug(1, "Running AGIPAL game"); debug(1, "Running AGIPAL game");
report("Running AGI script.\n"); debug(0, "Running AGI script.\n");
setflag(fEnteredCli, false); setflag(fEnteredCli, false);
setflag(fSaidAcceptedInput, false); setflag(fSaidAcceptedInput, false);

View file

@ -47,7 +47,7 @@ int AgiEngine::setupV2Game(int ver) {
if (getFeatures() & GF_AGDS) if (getFeatures() & GF_AGDS)
setVersion(ver = 0x2440); // ALL AGDS games built for 2.440 setVersion(ver = 0x2440); // ALL AGDS games built for 2.440
report("Setting up for version 0x%04X\n", ver); debug(0, "Setting up for version 0x%04X", ver);
// 'quit' takes 0 args for 2.089 // 'quit' takes 0 args for 2.089
if (ver == 0x2089) if (ver == 0x2089)
@ -70,7 +70,7 @@ int AgiEngine::setupV2Game(int ver) {
int AgiEngine::setupV3Game(int ver) { int AgiEngine::setupV3Game(int ver) {
int ec = errOK; int ec = errOK;
report("Setting up for version 0x%04X\n", ver); debug(0, "Setting up for version 0x%04X", ver);
// 'unknown176' takes 1 arg for 3.002.086, not 0 args. // 'unknown176' takes 1 arg for 3.002.086, not 0 args.
// 'unknown173' also takes 1 arg for 3.002.068, not 0 args. // 'unknown173' also takes 1 arg for 3.002.068, not 0 args.

View file

@ -121,7 +121,6 @@ int AgiEngine::handleController(int key) {
if (_game.controllers[i].keycode == key) { if (_game.controllers[i].keycode == key) {
debugC(3, kDebugLevelInput, "event %d: key press", _game.controllers[i].controller); debugC(3, kDebugLevelInput, "event %d: key press", _game.controllers[i].controller);
_game.controllerOccured[_game.controllers[i].controller] = true; _game.controllerOccured[_game.controllers[i].controller] = true;
report("event AC:%i occurred\n", _game.controllers[i].controller);
return true; return true;
} }
} }

View file

@ -43,7 +43,7 @@ int AgiLoader_v2::loadDir(AgiDir *agid, const char *fname) {
uint32 flen; uint32 flen;
uint i; uint i;
report("Loading directory: %s\n", fname); debug(0, "Loading directory: %s", fname);
if (!fp.open(fname)) { if (!fp.open(fname)) {
return errBadFileOpen; return errBadFileOpen;
@ -157,7 +157,7 @@ uint8 *AgiLoader_v2::loadVolRes(struct AgiDir *agid) {
exit(1); exit(1);
} }
} else { } else {
report("Error: bad signature %04x\n", sig); warning("AgiLoader_v2::loadVolRes: bad signature %04x", sig);
// fprintf (stderr, "ACK! BAD RESOURCE!!!\n"); // fprintf (stderr, "ACK! BAD RESOURCE!!!\n");
return 0; return 0;
} }

View file

@ -46,9 +46,9 @@ int AgiEngine::decodeObjects(uint8 *mem, uint32 flen) {
// if so, its encrypted, else it is not // if so, its encrypted, else it is not
if (READ_LE_UINT16(mem) > flen) { if (READ_LE_UINT16(mem) > flen) {
report("Decrypting objects... "); debugN(0, "Decrypting objects... ");
decrypt(mem, flen); decrypt(mem, flen);
report("done.\n"); debug(0, "done.");
} }
// alloc memory for object list // alloc memory for object list
@ -79,7 +79,7 @@ int AgiEngine::decodeObjects(uint8 *mem, uint32 flen) {
(_objects + i)->name = strdup(""); (_objects + i)->name = strdup("");
} }
} }
report("Reading objects: %d objects read.\n", _game.numObjects); debug(0, "Reading objects: %d objects read.", _game.numObjects);
return errOK; return errOK;
} }
@ -92,8 +92,7 @@ int AgiEngine::loadObjects(const char *fname) {
_objects = NULL; _objects = NULL;
_game.numObjects = 0; _game.numObjects = 0;
debugC(5, kDebugLevelResources, "(fname = %s)", fname); debugC(5, kDebugLevelResources, "(Loading objects '%s')", fname);
report("Loading objects: %s\n", fname);
if (!fp.open(fname)) if (!fp.open(fname))
return errBadFileOpen; return errBadFileOpen;
@ -130,7 +129,7 @@ void AgiEngine::unloadObjects() {
void AgiEngine::objectSetLocation(unsigned int n, int i) { void AgiEngine::objectSetLocation(unsigned int n, int i) {
if (n >= _game.numObjects) { if (n >= _game.numObjects) {
report("Error: Can't access object %d.\n", n); warning("AgiEngine::objectSetLocation: Can't access object %d.\n", n);
return; return;
} }
_objects[n].location = i; _objects[n].location = i;
@ -138,7 +137,7 @@ void AgiEngine::objectSetLocation(unsigned int n, int i) {
int AgiEngine::objectGetLocation(unsigned int n) { int AgiEngine::objectGetLocation(unsigned int n) {
if (n >= _game.numObjects) { if (n >= _game.numObjects) {
report("Error: Can't access object %d.\n", n); warning("AgiEngine::objectGetLocation: Can't access object %d.\n", n);
return 0; return 0;
} }
return _objects[n].location; return _objects[n].location;
@ -146,7 +145,7 @@ int AgiEngine::objectGetLocation(unsigned int n) {
const char *AgiEngine::objectName(unsigned int n) { const char *AgiEngine::objectName(unsigned int n) {
if (n >= _game.numObjects) { if (n >= _game.numObjects) {
report("Error: Can't access object %d.\n", n); warning("AgiEngine::objectName: Can't access object %d.\n", n);
return ""; return "";
} }
return _objects[n].name; return _objects[n].name;

View file

@ -492,7 +492,7 @@ void AgiEngine::cmd_init_joy(uint8 *p) { // do nothing
} }
void AgiEngine::cmd_script_size(uint8 *p) { void AgiEngine::cmd_script_size(uint8 *p) {
report("script.size(%d)\n", p0); debug(0, "script.size(%d)", p0);
} }
void AgiEngine::cmd_cancel_line(uint8 *p) { void AgiEngine::cmd_cancel_line(uint8 *p) {
@ -609,7 +609,7 @@ void AgiEngine::cmd_set_simple(uint8 *p) {
void AgiEngine::cmd_pop_script(uint8 *p) { void AgiEngine::cmd_pop_script(uint8 *p) {
if (getVersion() >= 0x2915) { if (getVersion() >= 0x2915) {
report("pop.script\n"); debug(0, "pop.script");
} }
} }
@ -621,7 +621,7 @@ void AgiEngine::cmd_hold_key(uint8 *p) {
void AgiEngine::cmd_discard_sound(uint8 *p) { void AgiEngine::cmd_discard_sound(uint8 *p) {
if (getVersion() >= 0x2936) { if (getVersion() >= 0x2936) {
report("discard.sound\n"); debug(0, "discard.sound");
} }
} }
@ -1101,7 +1101,7 @@ void AgiEngine::cmd_set_game_id(uint8 *p) {
else else
_game.id[0] = 0; _game.id[0] = 0;
report("Game ID: \"%s\"\n", _game.id); debug(0, "Game ID: \"%s\"", _game.id);
} }
void AgiEngine::cmd_pause(uint8 *p) { void AgiEngine::cmd_pause(uint8 *p) {
@ -1453,7 +1453,7 @@ void AgiEngine::cmd_clear_text_rect(uint8 *p) {
} }
void AgiEngine::cmd_toggle_monitor(uint8 *p) { void AgiEngine::cmd_toggle_monitor(uint8 *p) {
report("toggle.monitor\n"); debug(0, "toggle.monitor");
} }
void AgiEngine::cmd_echo_line(uint8 *p) { void AgiEngine::cmd_echo_line(uint8 *p) {
@ -1510,7 +1510,7 @@ void AgiEngine::cmd_push_script(uint8 *p) {
_game.vars[29] = _mouse.y; _game.vars[29] = _mouse.y;
} else { } else {
if (getVersion() >= 0x2915) { if (getVersion() >= 0x2915) {
report("push.script\n"); debug(0, "push.script");
} }
} }
} }
@ -1518,7 +1518,7 @@ void AgiEngine::cmd_push_script(uint8 *p) {
void AgiEngine::cmd_set_pri_base(uint8 *p) { void AgiEngine::cmd_set_pri_base(uint8 *p) {
int i, x, pri; int i, x, pri;
report("Priority base set to %d\n", p0); debug(0, "Priority base set to %d", p0);
// _game.alt_pri = true; // _game.alt_pri = true;
x = (_HEIGHT - p0) * _HEIGHT / 10; x = (_HEIGHT - p0) * _HEIGHT / 10;

View file

@ -275,11 +275,11 @@ void AgiEngine::debugConsole(int lognum, int mode, const char *str) {
uint8 a, c, z; uint8 a, c, z;
if (str) { if (str) {
report(" %s\n", str); debug(0, " %s", str);
return; return;
} }
report("%03d:%04x ", lognum, ip); debugN(0, "%03d:%04x ", lognum, ip);
switch (*(code + ip)) { switch (*(code + ip)) {
case 0xFC: case 0xFC:
@ -289,7 +289,7 @@ void AgiEngine::debugConsole(int lognum, int mode, const char *str) {
x = logicNamesIf; x = logicNamesIf;
if (_debug.opcodes) { if (_debug.opcodes) {
report("%02X %02X %02X %02X %02X %02X %02X %02X %02X\n" debugN(0, "%02X %02X %02X %02X %02X %02X %02X %02X %02X\n"
" ", " ",
(uint8)*(code + (0 + ip)) & 0xFF, (uint8)*(code + (0 + ip)) & 0xFF,
(uint8)*(code + (1 + ip)) & 0xFF, (uint8)*(code + (1 + ip)) & 0xFF,
@ -301,7 +301,7 @@ void AgiEngine::debugConsole(int lognum, int mode, const char *str) {
(uint8)*(code + (7 + ip)) & 0xFF, (uint8)*(code + (7 + ip)) & 0xFF,
(uint8)*(code + (8 + ip)) & 0xFF); (uint8)*(code + (8 + ip)) & 0xFF);
} }
report("%s ", (x + *(code + ip) - 0xFC)->name); debugN(0, "%s ", (x + *(code + ip) - 0xFC)->name);
break; break;
default: default:
x = mode == lCOMMAND_MODE ? logicNamesCmd : logicNamesTest; x = mode == lCOMMAND_MODE ? logicNamesCmd : logicNamesTest;
@ -309,7 +309,7 @@ void AgiEngine::debugConsole(int lognum, int mode, const char *str) {
c = (unsigned char)(x + *(code + ip))->argMask; c = (unsigned char)(x + *(code + ip))->argMask;
if (_debug.opcodes) { if (_debug.opcodes) {
report("%02X %02X %02X %02X %02X %02X %02X %02X %02X\n" debugN(0, "%02X %02X %02X %02X %02X %02X %02X %02X %02X\n"
" ", " ",
(uint8)*(code + (0 + ip)) & 0xFF, (uint8)*(code + (0 + ip)) & 0xFF,
(uint8)*(code + (1 + ip)) & 0xFF, (uint8)*(code + (1 + ip)) & 0xFF,
@ -321,23 +321,23 @@ void AgiEngine::debugConsole(int lognum, int mode, const char *str) {
(uint8)*(code + (7 + ip)) & 0xFF, (uint8)*(code + (7 + ip)) & 0xFF,
(uint8)*(code + (8 + ip)) & 0xFF); (uint8)*(code + (8 + ip)) & 0xFF);
} }
report("%s ", (x + *(code + ip))->name); debugN(0, "%s ", (x + *(code + ip))->name);
for (z = 1; a > 0;) { for (z = 1; a > 0;) {
if (~c & 0x80) { if (~c & 0x80) {
report("%d", *(code + (ip + z))); debugN(0, "%d", *(code + (ip + z)));
} else { } else {
report("v%d[%d]", *(code + (ip + z)), getvar(*(code + (ip + z)))); debugN(0, "v%d[%d]", *(code + (ip + z)), getvar(*(code + (ip + z))));
} }
c <<= 1; c <<= 1;
z++; z++;
if (--a > 0) if (--a > 0)
report(","); debugN(0, ",");
} }
break; break;
} }
report("\n"); debugN(0, "\n");
} }
} // End of namespace Agi } // End of namespace Agi

View file

@ -95,13 +95,10 @@ SoundGenSarien::SoundGenSarien(AgiEngine *vm, Audio::Mixer *pMixer) : SoundGen(v
break; break;
} }
report("Initializing sound:\n");
report("sound: envelopes ");
if (_env) { if (_env) {
report("enabled (decay=%d, sustain=%d)\n", ENV_DECAY, ENV_SUSTAIN); debug(0, "Initializing sound: envelopes enabled (decay=%d, sustain=%d)", ENV_DECAY, ENV_SUSTAIN);
} else { } else {
report("disabled\n"); debug(0, "Initializing sound: envelopes disabled");
} }
_mixer->playStream(Audio::Mixer::kMusicSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true); _mixer->playStream(Audio::Mixer::kMusicSoundType, &_soundHandle, this, -1, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO, true);

View file

@ -52,10 +52,10 @@ int AgiEngine::loadWords(const char *fname) {
words = NULL; words = NULL;
if (!fp.open(fname)) { if (!fp.open(fname)) {
report("Warning: can't open %s\n", fname); warning("loadWords: can't open %s", fname);
return errOK; // err_BadFileOpen return errOK; // err_BadFileOpen
} }
report("Loading dictionary: %s\n", fname); debug(0, "Loading dictionary: %s", fname);
fp.seek(0, SEEK_END); fp.seek(0, SEEK_END);
flen = fp.pos(); flen = fp.pos();