Reworked kyra debug output system. Now he have special kyra intern debug levels + the global debug levels, for now I enable all kyra debug levels if the global debug level is not -1. see 'toggle_debug' in the kyra debugger and kyra.h for the different levels. (This is just the beginning of it anyway, for example the sound debug level isn't used for now)

svn-id: r20678
This commit is contained in:
Johannes Schickel 2006-02-14 01:19:30 +00:00
parent d91b49c15c
commit 93e9639989
21 changed files with 594 additions and 485 deletions

View file

@ -43,7 +43,7 @@ ScreenAnimator::~ScreenAnimator() {
} }
void ScreenAnimator::init(int actors_, int items_, int sprites_) { void ScreenAnimator::init(int actors_, int items_, int sprites_) {
debug(9, "ScreenAnimator::init(%d, %d, %d)", actors_, items_, sprites_); debug(9, kDebugLevelAnimator, "ScreenAnimator::init(%d, %d, %d)", actors_, items_, sprites_);
_screenObjects = new AnimObject[actors_ + items_ + sprites_]; _screenObjects = new AnimObject[actors_ + items_ + sprites_];
assert(_screenObjects); assert(_screenObjects);
memset(_screenObjects, 0, sizeof(AnimObject) * (actors_ + items_ + sprites_)); memset(_screenObjects, 0, sizeof(AnimObject) * (actors_ + items_ + sprites_));
@ -56,7 +56,7 @@ void ScreenAnimator::init(int actors_, int items_, int sprites_) {
} }
void ScreenAnimator::close() { void ScreenAnimator::close() {
debug(9, "ScreenAnimator::close()"); debug(9, kDebugLevelAnimator, "ScreenAnimator::close()");
if (_initOk) { if (_initOk) {
_initOk = false; _initOk = false;
delete [] _screenObjects; delete [] _screenObjects;
@ -107,7 +107,7 @@ void ScreenAnimator::initAnimStateList() {
} }
void ScreenAnimator::preserveAllBackgrounds() { void ScreenAnimator::preserveAllBackgrounds() {
debug(9, "ScreenAnimator::preserveAllBackgrounds()"); debug(9, kDebugLevelAnimator, "ScreenAnimator::preserveAllBackgrounds()");
uint8 curPage = _screen->_curPage; uint8 curPage = _screen->_curPage;
_screen->_curPage = 2; _screen->_curPage = 2;
@ -123,7 +123,7 @@ void ScreenAnimator::preserveAllBackgrounds() {
} }
void ScreenAnimator::flagAllObjectsForBkgdChange() { void ScreenAnimator::flagAllObjectsForBkgdChange() {
debug(9, "ScreenAnimator::flagAllObjectsForBkgdChange()"); debug(9, kDebugLevelAnimator, "ScreenAnimator::flagAllObjectsForBkgdChange()");
AnimObject *curObject = _objectQueue; AnimObject *curObject = _objectQueue;
while (curObject) { while (curObject) {
curObject->bkgdChangeFlag = 1; curObject->bkgdChangeFlag = 1;
@ -132,7 +132,7 @@ void ScreenAnimator::flagAllObjectsForBkgdChange() {
} }
void ScreenAnimator::flagAllObjectsForRefresh() { void ScreenAnimator::flagAllObjectsForRefresh() {
debug(9, "ScreenAnimator::flagAllObjectsForRefresh()"); debug(9, kDebugLevelAnimator, "ScreenAnimator::flagAllObjectsForRefresh()");
AnimObject *curObject = _objectQueue; AnimObject *curObject = _objectQueue;
while (curObject) { while (curObject) {
curObject->refreshFlag = 1; curObject->refreshFlag = 1;
@ -141,7 +141,7 @@ void ScreenAnimator::flagAllObjectsForRefresh() {
} }
void ScreenAnimator::restoreAllObjectBackgrounds() { void ScreenAnimator::restoreAllObjectBackgrounds() {
debug(9, "ScreenAnimator::restoreAllObjectBackground()"); debug(9, kDebugLevelAnimator, "ScreenAnimator::restoreAllObjectBackground()");
AnimObject *curObject = _objectQueue; AnimObject *curObject = _objectQueue;
_screen->_curPage = 2; _screen->_curPage = 2;
@ -158,7 +158,7 @@ void ScreenAnimator::restoreAllObjectBackgrounds() {
} }
void ScreenAnimator::preserveAnyChangedBackgrounds() { void ScreenAnimator::preserveAnyChangedBackgrounds() {
debug(9, "ScreenAnimator::preserveAnyChangedBackgrounds()"); debug(9, kDebugLevelAnimator, "ScreenAnimator::preserveAnyChangedBackgrounds()");
AnimObject *curObject = _objectQueue; AnimObject *curObject = _objectQueue;
_screen->_curPage = 2; _screen->_curPage = 2;
@ -174,7 +174,7 @@ void ScreenAnimator::preserveAnyChangedBackgrounds() {
} }
void ScreenAnimator::preserveOrRestoreBackground(AnimObject *obj, bool restore) { void ScreenAnimator::preserveOrRestoreBackground(AnimObject *obj, bool restore) {
debug(9, "ScreenAnimator::preserveOrRestoreBackground(0x%X, restore)", obj, restore); debug(9, kDebugLevelAnimator, "ScreenAnimator::preserveOrRestoreBackground(0x%X, restore)", obj, restore);
int x = 0, y = 0, width = obj->width << 3, height = obj->height; int x = 0, y = 0, width = obj->width << 3, height = obj->height;
if (restore) { if (restore) {
@ -209,7 +209,7 @@ void ScreenAnimator::preserveOrRestoreBackground(AnimObject *obj, bool restore)
} }
void ScreenAnimator::prepDrawAllObjects() { void ScreenAnimator::prepDrawAllObjects() {
debug(9, "ScreenAnimator::prepDrawAllObjects()"); debug(9, kDebugLevelAnimator, "ScreenAnimator::prepDrawAllObjects()");
AnimObject *curObject = _objectQueue; AnimObject *curObject = _objectQueue;
int drawPage = 2; int drawPage = 2;
int flagUnk1 = 0, flagUnk2 = 0, flagUnk3 = 0; int flagUnk1 = 0, flagUnk2 = 0, flagUnk3 = 0;
@ -366,7 +366,7 @@ void ScreenAnimator::prepDrawAllObjects() {
} }
void ScreenAnimator::copyChangedObjectsForward(int refreshFlag) { void ScreenAnimator::copyChangedObjectsForward(int refreshFlag) {
debug(9, "ScreenAnimator::copyChangedObjectsForward(%d)", refreshFlag); debug(9, kDebugLevelAnimator, "ScreenAnimator::copyChangedObjectsForward(%d)", refreshFlag);
AnimObject *curObject = _objectQueue; AnimObject *curObject = _objectQueue;
while (curObject) { while (curObject) {
@ -404,7 +404,7 @@ void ScreenAnimator::copyChangedObjectsForward(int refreshFlag) {
} }
void ScreenAnimator::updateAllObjectShapes() { void ScreenAnimator::updateAllObjectShapes() {
debug(9, "ScreenAnimator::updateAllObjectShapes()"); debug(9, kDebugLevelAnimator, "ScreenAnimator::updateAllObjectShapes()");
restoreAllObjectBackgrounds(); restoreAllObjectBackgrounds();
preserveAnyChangedBackgrounds(); preserveAnyChangedBackgrounds();
prepDrawAllObjects(); prepDrawAllObjects();
@ -412,7 +412,7 @@ void ScreenAnimator::updateAllObjectShapes() {
} }
void ScreenAnimator::animRemoveGameItem(int index) { void ScreenAnimator::animRemoveGameItem(int index) {
debug(9, "ScreenAnimator::animRemoveGameItem(%d)", index); debug(9, kDebugLevelAnimator, "ScreenAnimator::animRemoveGameItem(%d)", index);
restoreAllObjectBackgrounds(); restoreAllObjectBackgrounds();
AnimObject *animObj = &_items[index]; AnimObject *animObj = &_items[index];
@ -427,7 +427,7 @@ void ScreenAnimator::animRemoveGameItem(int index) {
} }
void ScreenAnimator::animAddGameItem(int index, uint16 sceneId) { void ScreenAnimator::animAddGameItem(int index, uint16 sceneId) {
debug(9, "ScreenAnimator::animRemoveGameItem(%d, %d)", index, sceneId); debug(9, kDebugLevelAnimator, "ScreenAnimator::animRemoveGameItem(%d, %d)", index, sceneId);
restoreAllObjectBackgrounds(); restoreAllObjectBackgrounds();
assert(sceneId < _vm->_roomTableSize); assert(sceneId < _vm->_roomTableSize);
Room *currentRoom = &_vm->_roomTable[sceneId]; Room *currentRoom = &_vm->_roomTable[sceneId];
@ -453,7 +453,7 @@ void ScreenAnimator::animAddGameItem(int index, uint16 sceneId) {
} }
void ScreenAnimator::animAddNPC(int character) { void ScreenAnimator::animAddNPC(int character) {
debug(9, "ScreenAnimator::animAddNPC(%d)", character); debug(9, kDebugLevelAnimator, "ScreenAnimator::animAddNPC(%d)", character);
restoreAllObjectBackgrounds(); restoreAllObjectBackgrounds();
AnimObject *animObj = &_actors[character]; AnimObject *animObj = &_actors[character];
const Character *ch = &_vm->_characterList[character]; const Character *ch = &_vm->_characterList[character];
@ -477,7 +477,7 @@ void ScreenAnimator::animAddNPC(int character) {
} }
AnimObject *ScreenAnimator::objectRemoveQueue(AnimObject *queue, AnimObject *rem) { AnimObject *ScreenAnimator::objectRemoveQueue(AnimObject *queue, AnimObject *rem) {
debug(9, "ScreenAnimator::objectRemoveQueue(0x%X, 0x%X)", queue, rem); debug(9, kDebugLevelAnimator, "ScreenAnimator::objectRemoveQueue(0x%X, 0x%X)", queue, rem);
AnimObject *cur = queue; AnimObject *cur = queue;
AnimObject *prev = queue; AnimObject *prev = queue;
@ -513,13 +513,13 @@ AnimObject *ScreenAnimator::objectRemoveQueue(AnimObject *queue, AnimObject *rem
} }
AnimObject *ScreenAnimator::objectAddHead(AnimObject *queue, AnimObject *head) { AnimObject *ScreenAnimator::objectAddHead(AnimObject *queue, AnimObject *head) {
debug(9, "ScreenAnimator::objectAddHead(0x%X, 0x%X)", queue, head); debug(9, kDebugLevelAnimator, "ScreenAnimator::objectAddHead(0x%X, 0x%X)", queue, head);
head->nextAnimObject = queue; head->nextAnimObject = queue;
return head; return head;
} }
AnimObject *ScreenAnimator::objectQueue(AnimObject *queue, AnimObject *add) { AnimObject *ScreenAnimator::objectQueue(AnimObject *queue, AnimObject *add) {
debug(9, "ScreenAnimator::objectQueue(0x%X, 0x%X)", queue, add); debug(9, kDebugLevelAnimator, "ScreenAnimator::objectQueue(0x%X, 0x%X)", queue, add);
if (add->drawY <= queue->drawY || !queue) { if (add->drawY <= queue->drawY || !queue) {
add->nextAnimObject = queue; add->nextAnimObject = queue;
return add; return add;
@ -545,7 +545,7 @@ AnimObject *ScreenAnimator::objectQueue(AnimObject *queue, AnimObject *add) {
} }
void ScreenAnimator::addObjectToQueue(AnimObject *object) { void ScreenAnimator::addObjectToQueue(AnimObject *object) {
debug(9, "ScreenAnimator::addObjectToQueue(0x%X)", object); debug(9, kDebugLevelAnimator, "ScreenAnimator::addObjectToQueue(0x%X)", object);
if (!_objectQueue) { if (!_objectQueue) {
_objectQueue = objectAddHead(0, object); _objectQueue = objectAddHead(0, object);
} else { } else {
@ -554,7 +554,7 @@ void ScreenAnimator::addObjectToQueue(AnimObject *object) {
} }
void ScreenAnimator::refreshObject(AnimObject *object) { void ScreenAnimator::refreshObject(AnimObject *object) {
debug(9, "ScreenAnimator::refreshObject(0x%X)", object); debug(9, kDebugLevelAnimator, "ScreenAnimator::refreshObject(0x%X)", object);
_objectQueue = objectRemoveQueue(_objectQueue, object); _objectQueue = objectRemoveQueue(_objectQueue, object);
if (_objectQueue) { if (_objectQueue) {
_objectQueue = objectQueue(_objectQueue, object); _objectQueue = objectQueue(_objectQueue, object);
@ -564,7 +564,7 @@ void ScreenAnimator::refreshObject(AnimObject *object) {
} }
void ScreenAnimator::makeBrandonFaceMouse() { void ScreenAnimator::makeBrandonFaceMouse() {
debug(9, "ScreenAnimator::makeBrandonFaceMouse()"); debug(9, kDebugLevelAnimator, "ScreenAnimator::makeBrandonFaceMouse()");
if (_vm->mouseX() >= _vm->_currentCharacter->x1) { if (_vm->mouseX() >= _vm->_currentCharacter->x1) {
_vm->_currentCharacter->facing = 3; _vm->_currentCharacter->facing = 3;
} else { } else {
@ -575,21 +575,21 @@ void ScreenAnimator::makeBrandonFaceMouse() {
} }
int16 ScreenAnimator::fetchAnimWidth(const uint8 *shape, int16 mult) { int16 ScreenAnimator::fetchAnimWidth(const uint8 *shape, int16 mult) {
debug(9, "ScreenAnimator::fetchAnimWidth(0x%X, %d)", shape, mult); debug(9, kDebugLevelAnimator, "ScreenAnimator::fetchAnimWidth(0x%X, %d)", shape, mult);
if (_vm->features() & GF_TALKIE) if (_vm->features() & GF_TALKIE)
shape += 2; shape += 2;
return (((int16)READ_LE_UINT16((shape+3))) * mult) >> 8; return (((int16)READ_LE_UINT16((shape+3))) * mult) >> 8;
} }
int16 ScreenAnimator::fetchAnimHeight(const uint8 *shape, int16 mult) { int16 ScreenAnimator::fetchAnimHeight(const uint8 *shape, int16 mult) {
debug(9, "ScreenAnimator::fetchAnimHeight(0x%X, %d)", shape, mult); debug(9, kDebugLevelAnimator, "ScreenAnimator::fetchAnimHeight(0x%X, %d)", shape, mult);
if (_vm->features() & GF_TALKIE) if (_vm->features() & GF_TALKIE)
shape += 2; shape += 2;
return (int16)(((int8)*(shape+2)) * mult) >> 8; return (int16)(((int8)*(shape+2)) * mult) >> 8;
} }
void ScreenAnimator::setBrandonAnimSeqSize(int width, int height) { void ScreenAnimator::setBrandonAnimSeqSize(int width, int height) {
debug(9, "ScreenAnimator::setBrandonAnimSeqSize(%d, %d)", width, height); debug(9, kDebugLevelAnimator, "ScreenAnimator::setBrandonAnimSeqSize(%d, %d)", width, height);
restoreAllObjectBackgrounds(); restoreAllObjectBackgrounds();
_brandonAnimSeqSizeWidth = _actors[0].width; _brandonAnimSeqSizeWidth = _actors[0].width;
_brandonAnimSeqSizeHeight = _actors[0].height; _brandonAnimSeqSizeHeight = _actors[0].height;
@ -599,7 +599,7 @@ void ScreenAnimator::setBrandonAnimSeqSize(int width, int height) {
} }
void ScreenAnimator::resetBrandonAnimSeqSize() { void ScreenAnimator::resetBrandonAnimSeqSize() {
debug(9, "ScreenAnimator::resetBrandonAnimSeqSize()"); debug(9, kDebugLevelAnimator, "ScreenAnimator::resetBrandonAnimSeqSize()");
restoreAllObjectBackgrounds(); restoreAllObjectBackgrounds();
_actors[0].width = _brandonAnimSeqSizeWidth; _actors[0].width = _brandonAnimSeqSizeWidth;
_actors[0].height = _brandonAnimSeqSizeHeight; _actors[0].height = _brandonAnimSeqSizeHeight;
@ -607,7 +607,7 @@ void ScreenAnimator::resetBrandonAnimSeqSize() {
} }
void ScreenAnimator::animRefreshNPC(int character) { void ScreenAnimator::animRefreshNPC(int character) {
debug(9, "ScreenAnimator::animRefreshNPC(%d)", character); debug(9, kDebugLevelAnimator, "ScreenAnimator::animRefreshNPC(%d)", character);
AnimObject *animObj = &_actors[character]; AnimObject *animObj = &_actors[character];
Character *ch = &_vm->characterList()[character]; Character *ch = &_vm->characterList()[character];
@ -664,7 +664,7 @@ void ScreenAnimator::animRefreshNPC(int character) {
} }
void ScreenAnimator::setCharacterDefaultFrame(int character) { void ScreenAnimator::setCharacterDefaultFrame(int character) {
debug(9, "ScreenAnimator::setCharacterDefaultFrame()"); debug(9, kDebugLevelAnimator, "ScreenAnimator::setCharacterDefaultFrame()");
static uint16 initFrameTable[] = { static uint16 initFrameTable[] = {
7, 41, 77, 0, 0 7, 41, 77, 0, 0
}; };
@ -677,7 +677,7 @@ void ScreenAnimator::setCharacterDefaultFrame(int character) {
} }
void ScreenAnimator::setCharactersHeight() { void ScreenAnimator::setCharactersHeight() {
debug(9, "ScreenAnimator::setCharactersHeight()"); debug(9, kDebugLevelAnimator, "ScreenAnimator::setCharactersHeight()");
static int8 initHeightTable[] = { static int8 initHeightTable[] = {
48, 40, 48, 47, 56, 48, 40, 48, 47, 56,
44, 42, 47, 38, 35, 44, 42, 47, 38, 35,

View file

@ -44,7 +44,8 @@ Debugger::Debugger(KyraEngine *vm)
DCmd_Register("queryflag", &Debugger::cmd_queryFlag); DCmd_Register("queryflag", &Debugger::cmd_queryFlag);
DCmd_Register("timers", &Debugger::cmd_listTimers); DCmd_Register("timers", &Debugger::cmd_listTimers);
DCmd_Register("settimercountdown", &Debugger::cmd_setTimerCountdown); DCmd_Register("settimercountdown", &Debugger::cmd_setTimerCountdown);
DCmd_Register("give", &Debugger::cmd_giveItem); DCmd_Register("give", &Debugger::cmd_giveItem);
DCmd_Register("toggle_debug", &Debugger::cmd_toggleDebug);
} }
void Debugger::preEnter() { void Debugger::preEnter() {
@ -203,4 +204,62 @@ bool Debugger::cmd_giveItem(int argc, const char **argv) {
return true; return true;
} }
bool Debugger::cmd_toggleDebug(int argc, const char **argv) {
if (argc < 2) {
DebugPrintf("Syntax: toggle_debug <level>\n");
DebugPrintf("Where level is one of:\n");
DebugPrintf("ScriptFuncs, Script, Sprites, Screen, Sound, Animator, Main, GUI, Sequence, Movie\n");
DebugPrintf("or: EALL for enabling all and DALL for disabling all\n");
return true;
}
struct ArgList {
const char* param;
int level;
};
static const ArgList argList[] = {
{ "ScriptFuncs", kDebugLevelScriptFuncs },
{ "Script", kDebugLevelScript },
{ "Sprites", kDebugLevelSprites },
{ "Screen", kDebugLevelScreen },
{ "Sound", kDebugLevelSound },
{ "Animator", kDebugLevelAnimator },
{ "Main", kDebugLevelMain },
{ "GUI", kDebugLevelGUI },
{ "Sequence", kDebugLevelSequence },
{ "Movie", kDebugLevelMovie },
{ 0, 0 },
};
for (int i = 0; argList[i].param != 0; ++i) {
if (!scumm_stricmp(argList[i].param, argv[1])) {
if (!(_vm->debugLevels() & argList[i].level)) {
_vm->enableDebugLevel(argList[i].level);
DebugPrintf("Enabled debug level: '%s'\n", argList[i].param);
} else {
_vm->disableDebugLevel(argList[i].level);
DebugPrintf("Disabled debug level: '%s'\n", argList[i].param);
}
return true;
}
}
if (!scumm_stricmp("EALL", argv[1])) {
for (int i = 0; argList[i].param != 0; ++i) {
_vm->enableDebugLevel(argList[i].level);
}
DebugPrintf("Enabled all debug levels!\n");
} else if (!scumm_stricmp("DALL", argv[1])) {
for (int i = 0; argList[i].param != 0; ++i) {
_vm->disableDebugLevel(argList[i].level);
}
DebugPrintf("Disabled all debug levels!\n");
} else {
DebugPrintf("Unknown debug level: '%s'\n", argv[1]);
}
return true;
}
} // End of namespace Kyra } // End of namespace Kyra

View file

@ -50,6 +50,7 @@ protected:
bool cmd_listTimers(int argc, const char **argv); bool cmd_listTimers(int argc, const char **argv);
bool cmd_setTimerCountdown(int argc, const char **argv); bool cmd_setTimerCountdown(int argc, const char **argv);
bool cmd_giveItem(int argc, const char **argv); bool cmd_giveItem(int argc, const char **argv);
bool cmd_toggleDebug(int argc, const char **argv);
}; };
} // End of namespace Kyra } // End of namespace Kyra

View file

@ -589,7 +589,7 @@ void KyraEngine::gui_getInput() {
} }
int KyraEngine::gui_resumeGame(Button *button) { int KyraEngine::gui_resumeGame(Button *button) {
debug(9, "KyraEngine::gui_resumeGame()"); debug(9, kDebugLevelGUI, "KyraEngine::gui_resumeGame()");
processMenuButton(button); processMenuButton(button);
_displayMenu = false; _displayMenu = false;
@ -648,7 +648,7 @@ void KyraEngine::setupSavegames(Menu &menu, int num) {
} }
int KyraEngine::gui_saveGameMenu(Button *button) { int KyraEngine::gui_saveGameMenu(Button *button) {
debug(9, "KyraEngine::gui_saveGameMenu()"); debug(9, kDebugLevelGUI, "KyraEngine::gui_saveGameMenu()");
processMenuButton(button); processMenuButton(button);
_menu[2].item[5].enabled = true; _menu[2].item[5].enabled = true;
@ -688,7 +688,7 @@ int KyraEngine::gui_saveGameMenu(Button *button) {
} }
int KyraEngine::gui_loadGameMenu(Button *button) { int KyraEngine::gui_loadGameMenu(Button *button) {
debug(9, "KyraEngine::gui_loadGameMenu()"); debug(9, kDebugLevelGUI, "KyraEngine::gui_loadGameMenu()");
if (_menuDirectlyToLoad) if (_menuDirectlyToLoad)
_menu[2].item[5].enabled = false; _menu[2].item[5].enabled = false;
else { else {
@ -772,7 +772,7 @@ void KyraEngine::gui_updateSavegameString() {
} }
int KyraEngine::gui_saveGame(Button *button) { int KyraEngine::gui_saveGame(Button *button) {
debug(9, "KyraEngine::gui_saveGame()"); debug(9, kDebugLevelGUI, "KyraEngine::gui_saveGame()");
processMenuButton(button); processMenuButton(button);
_gameToLoad = button->specialValue; _gameToLoad = button->specialValue;
@ -822,7 +822,7 @@ int KyraEngine::gui_saveGame(Button *button) {
} }
int KyraEngine::gui_savegameConfirm(Button *button) { int KyraEngine::gui_savegameConfirm(Button *button) {
debug(9, "KyraEngine::gui_savegameConfirm()"); debug(9, kDebugLevelGUI, "KyraEngine::gui_savegameConfirm()");
processMenuButton(button); processMenuButton(button);
_displaySubMenu = false; _displaySubMenu = false;
@ -830,7 +830,7 @@ int KyraEngine::gui_savegameConfirm(Button *button) {
} }
int KyraEngine::gui_loadGame(Button *button) { int KyraEngine::gui_loadGame(Button *button) {
debug(9, "KyraEngine::gui_loadGame()"); debug(9, kDebugLevelGUI, "KyraEngine::gui_loadGame()");
processMenuButton(button); processMenuButton(button);
_displaySubMenu = false; _displaySubMenu = false;
_gameToLoad = button->specialValue; _gameToLoad = button->specialValue;
@ -839,7 +839,7 @@ int KyraEngine::gui_loadGame(Button *button) {
} }
int KyraEngine::gui_cancelSubMenu(Button *button) { int KyraEngine::gui_cancelSubMenu(Button *button) {
debug(9, "KyraEngine::gui_cancelLoadGameMenu()"); debug(9, kDebugLevelGUI, "KyraEngine::gui_cancelLoadGameMenu()");
processMenuButton(button); processMenuButton(button);
_displaySubMenu = false; _displaySubMenu = false;
_cancelSubMenu = true; _cancelSubMenu = true;
@ -848,7 +848,7 @@ int KyraEngine::gui_cancelSubMenu(Button *button) {
} }
int KyraEngine::gui_quitPlaying(Button *button) { int KyraEngine::gui_quitPlaying(Button *button) {
debug(9, "KyraEngine::gui_quitPlaying()"); debug(9, kDebugLevelGUI, "KyraEngine::gui_quitPlaying()");
processMenuButton(button); processMenuButton(button);
if (gui_quitConfirm("Are you sure you want to quit playing?")) if (gui_quitConfirm("Are you sure you want to quit playing?"))
@ -862,7 +862,7 @@ int KyraEngine::gui_quitPlaying(Button *button) {
} }
bool KyraEngine::gui_quitConfirm(const char *str) { bool KyraEngine::gui_quitConfirm(const char *str) {
debug(9, "KyraEngine::gui_quitConfirm()"); debug(9, kDebugLevelGUI, "KyraEngine::gui_quitConfirm()");
_screen->loadPageFromDisk("SEENPAGE.TMP", 0); _screen->loadPageFromDisk("SEENPAGE.TMP", 0);
_screen->savePageToDisk("SEENPAGE.TMP", 0); _screen->savePageToDisk("SEENPAGE.TMP", 0);
@ -886,7 +886,7 @@ bool KyraEngine::gui_quitConfirm(const char *str) {
} }
int KyraEngine::gui_quitConfirmYes(Button *button) { int KyraEngine::gui_quitConfirmYes(Button *button) {
debug(9, "KyraEngine::gui_quitConfirmYes()"); debug(9, kDebugLevelGUI, "KyraEngine::gui_quitConfirmYes()");
processMenuButton(button); processMenuButton(button);
_displaySubMenu = false; _displaySubMenu = false;
_cancelSubMenu = false; _cancelSubMenu = false;
@ -895,7 +895,7 @@ int KyraEngine::gui_quitConfirmYes(Button *button) {
} }
int KyraEngine::gui_quitConfirmNo(Button *button) { int KyraEngine::gui_quitConfirmNo(Button *button) {
debug(9, "KyraEngine::gui_quitConfirmNo()"); debug(9, kDebugLevelGUI, "KyraEngine::gui_quitConfirmNo()");
processMenuButton(button); processMenuButton(button);
_displaySubMenu = false; _displaySubMenu = false;
_cancelSubMenu = true; _cancelSubMenu = true;
@ -904,7 +904,7 @@ int KyraEngine::gui_quitConfirmNo(Button *button) {
} }
int KyraEngine::gui_scrollUp(Button *button) { int KyraEngine::gui_scrollUp(Button *button) {
debug(9, "KyraEngine::gui_scrollUp()"); debug(9, kDebugLevelGUI, "KyraEngine::gui_scrollUp()");
processMenuButton(button); processMenuButton(button);
if (_savegameOffset > 0) { if (_savegameOffset > 0) {
@ -916,7 +916,7 @@ int KyraEngine::gui_scrollUp(Button *button) {
} }
int KyraEngine::gui_scrollDown(Button *button) { int KyraEngine::gui_scrollDown(Button *button) {
debug(9, "KyraEngine::gui_scrollDown()"); debug(9, kDebugLevelGUI, "KyraEngine::gui_scrollDown()");
processMenuButton(button); processMenuButton(button);
_savegameOffset++; _savegameOffset++;

View file

@ -53,7 +53,7 @@ int KyraEngine::findDuplicateItemShape(int shape) {
} }
void KyraEngine::addToNoDropRects(int x, int y, int w, int h) { void KyraEngine::addToNoDropRects(int x, int y, int w, int h) {
debug(9, "KyraEngine::addToNoDropRects(%d, %d, %d, %d)", x, y, w, h); debug(9, kDebugLevelMain, "KyraEngine::addToNoDropRects(%d, %d, %d, %d)", x, y, w, h);
for (int rect = 0; rect < 11; ++rect) { for (int rect = 0; rect < 11; ++rect) {
if (_noDropRects[rect].x == -1) { if (_noDropRects[rect].x == -1) {
_noDropRects[rect].x = x; _noDropRects[rect].x = x;
@ -66,12 +66,12 @@ void KyraEngine::addToNoDropRects(int x, int y, int w, int h) {
} }
void KyraEngine::clearNoDropRects() { void KyraEngine::clearNoDropRects() {
debug(9, "KyraEngine::clearNoDropRects()"); debug(9, kDebugLevelMain, "KyraEngine::clearNoDropRects()");
memset(_noDropRects, -1, sizeof(_noDropRects)); memset(_noDropRects, -1, sizeof(_noDropRects));
} }
byte KyraEngine::findFreeItemInScene(int scene) { byte KyraEngine::findFreeItemInScene(int scene) {
debug(9, "KyraEngine::findFreeItemInScene(%d)", scene); debug(9, kDebugLevelMain, "KyraEngine::findFreeItemInScene(%d)", scene);
assert(scene < _roomTableSize); assert(scene < _roomTableSize);
Room *room = &_roomTable[scene]; Room *room = &_roomTable[scene];
for (int i = 0; i < 12; ++i) { for (int i = 0; i < 12; ++i) {
@ -82,7 +82,7 @@ byte KyraEngine::findFreeItemInScene(int scene) {
} }
byte KyraEngine::findItemAtPos(int x, int y) { byte KyraEngine::findItemAtPos(int x, int y) {
debug(9, "KyraEngine::findItemAtPos(%d, %d)", x, y); debug(9, kDebugLevelMain, "KyraEngine::findItemAtPos(%d, %d)", x, y);
assert(_currentCharacter->sceneId < _roomTableSize); assert(_currentCharacter->sceneId < _roomTableSize);
const uint8 *itemsTable = _roomTable[_currentCharacter->sceneId].itemsTable; const uint8 *itemsTable = _roomTable[_currentCharacter->sceneId].itemsTable;
const uint16 *xposOffset = _roomTable[_currentCharacter->sceneId].itemsXPos; const uint16 *xposOffset = _roomTable[_currentCharacter->sceneId].itemsXPos;
@ -118,7 +118,7 @@ byte KyraEngine::findItemAtPos(int x, int y) {
} }
void KyraEngine::placeItemInGenericMapScene(int item, int index) { void KyraEngine::placeItemInGenericMapScene(int item, int index) {
debug(9, "KyraEngine::placeItemInGenericMapScene(%d, %d)", item, index); debug(9, kDebugLevelMain, "KyraEngine::placeItemInGenericMapScene(%d, %d)", item, index);
static const uint16 itemMapSceneMinTable[] = { static const uint16 itemMapSceneMinTable[] = {
0x0000, 0x0011, 0x006D, 0x0025, 0x00C7, 0x0000 0x0000, 0x0011, 0x006D, 0x0025, 0x00C7, 0x0000
}; };
@ -175,7 +175,7 @@ void KyraEngine::placeItemInGenericMapScene(int item, int index) {
} }
void KyraEngine::createMouseItem(int item) { void KyraEngine::createMouseItem(int item) {
debug(9, "KyraEngine::createMouseItem(%d)", item); debug(9, kDebugLevelMain, "KyraEngine::createMouseItem(%d)", item);
_screen->hideMouse(); _screen->hideMouse();
setMouseItem(item); setMouseItem(item);
_itemInHand = item; _itemInHand = item;
@ -183,7 +183,7 @@ void KyraEngine::createMouseItem(int item) {
} }
void KyraEngine::destroyMouseItem() { void KyraEngine::destroyMouseItem() {
debug(9, "KyraEngine::destroyMouseItem()"); debug(9, kDebugLevelMain, "KyraEngine::destroyMouseItem()");
_screen->hideMouse(); _screen->hideMouse();
_screen->setMouseCursor(1, 1, _shapes[4]); _screen->setMouseCursor(1, 1, _shapes[4]);
_itemInHand = -1; _itemInHand = -1;
@ -191,7 +191,7 @@ void KyraEngine::destroyMouseItem() {
} }
void KyraEngine::setMouseItem(int item) { void KyraEngine::setMouseItem(int item) {
debug(9, "KyraEngine::setMouseItem(%d)", item); debug(9, kDebugLevelMain, "KyraEngine::setMouseItem(%d)", item);
if (item == -1) { if (item == -1) {
_screen->setMouseCursor(1, 1, _shapes[10]); _screen->setMouseCursor(1, 1, _shapes[10]);
} else { } else {
@ -200,7 +200,7 @@ void KyraEngine::setMouseItem(int item) {
} }
void KyraEngine::wipeDownMouseItem(int xpos, int ypos) { void KyraEngine::wipeDownMouseItem(int xpos, int ypos) {
debug(9, "KyraEngine::wipeDownMouseItem(%d, %d)", xpos, ypos); debug(9, kDebugLevelMain, "KyraEngine::wipeDownMouseItem(%d, %d)", xpos, ypos);
if (_itemInHand == -1) if (_itemInHand == -1)
return; return;
xpos -= 8; xpos -= 8;
@ -227,7 +227,7 @@ void KyraEngine::wipeDownMouseItem(int xpos, int ypos) {
} }
void KyraEngine::setupSceneItems() { void KyraEngine::setupSceneItems() {
debug(9, "KyraEngine::setupSceneItems()"); debug(9, kDebugLevelMain, "KyraEngine::setupSceneItems()");
uint16 sceneId = _currentCharacter->sceneId; uint16 sceneId = _currentCharacter->sceneId;
assert(sceneId < _roomTableSize); assert(sceneId < _roomTableSize);
Room *currentRoom = &_roomTable[sceneId]; Room *currentRoom = &_roomTable[sceneId];
@ -267,7 +267,7 @@ void KyraEngine::setupSceneItems() {
} }
int KyraEngine::countItemsInScene(uint16 sceneId) { int KyraEngine::countItemsInScene(uint16 sceneId) {
debug(9, "KyraEngine::countItemsInScene(%d)", sceneId); debug(9, kDebugLevelMain, "KyraEngine::countItemsInScene(%d)", sceneId);
assert(sceneId < _roomTableSize); assert(sceneId < _roomTableSize);
Room *currentRoom = &_roomTable[sceneId]; Room *currentRoom = &_roomTable[sceneId];
@ -283,7 +283,7 @@ int KyraEngine::countItemsInScene(uint16 sceneId) {
} }
int KyraEngine::processItemDrop(uint16 sceneId, uint8 item, int x, int y, int unk1, int unk2) { int KyraEngine::processItemDrop(uint16 sceneId, uint8 item, int x, int y, int unk1, int unk2) {
debug(9, "KyraEngine::processItemDrop(%d, %d, %d, %d, %d, %d)", sceneId, item, x, y, unk1, unk2); debug(9, kDebugLevelMain, "KyraEngine::processItemDrop(%d, %d, %d, %d, %d, %d)", sceneId, item, x, y, unk1, unk2);
int freeItem = -1; int freeItem = -1;
uint8 itemIndex = findItemAtPos(x, y); uint8 itemIndex = findItemAtPos(x, y);
if (unk1) { if (unk1) {
@ -448,7 +448,7 @@ int KyraEngine::processItemDrop(uint16 sceneId, uint8 item, int x, int y, int un
} }
void KyraEngine::exchangeItemWithMouseItem(uint16 sceneId, int itemIndex) { void KyraEngine::exchangeItemWithMouseItem(uint16 sceneId, int itemIndex) {
debug(9, "KyraEngine::exchangeItemWithMouseItem(%d, %d)", sceneId, itemIndex); debug(9, kDebugLevelMain, "KyraEngine::exchangeItemWithMouseItem(%d, %d)", sceneId, itemIndex);
_screen->hideMouse(); _screen->hideMouse();
_animator->animRemoveGameItem(itemIndex); _animator->animRemoveGameItem(itemIndex);
assert(sceneId < _roomTableSize); assert(sceneId < _roomTableSize);
@ -468,7 +468,7 @@ void KyraEngine::exchangeItemWithMouseItem(uint16 sceneId, int itemIndex) {
} }
void KyraEngine::addItemToRoom(uint16 sceneId, uint8 item, int itemIndex, int x, int y) { void KyraEngine::addItemToRoom(uint16 sceneId, uint8 item, int itemIndex, int x, int y) {
debug(9, "KyraEngine::addItemToRoom(%d, %d, %d, %d, %d)", sceneId, item, itemIndex, x, y); debug(9, kDebugLevelMain, "KyraEngine::addItemToRoom(%d, %d, %d, %d, %d)", sceneId, item, itemIndex, x, y);
assert(sceneId < _roomTableSize); assert(sceneId < _roomTableSize);
Room *currentRoom = &_roomTable[sceneId]; Room *currentRoom = &_roomTable[sceneId];
currentRoom->itemsTable[itemIndex] = item; currentRoom->itemsTable[itemIndex] = item;
@ -478,7 +478,7 @@ void KyraEngine::addItemToRoom(uint16 sceneId, uint8 item, int itemIndex, int x,
} }
int KyraEngine::checkNoDropRects(int x, int y) { int KyraEngine::checkNoDropRects(int x, int y) {
debug(9, "KyraEngine::checkNoDropRects(%d, %d)", x, y); debug(9, kDebugLevelMain, "KyraEngine::checkNoDropRects(%d, %d)", x, y);
if (_lastProcessedItemHeight < 1 || _lastProcessedItemHeight > 16) { if (_lastProcessedItemHeight < 1 || _lastProcessedItemHeight > 16) {
_lastProcessedItemHeight = 16; _lastProcessedItemHeight = 16;
} }
@ -511,7 +511,7 @@ int KyraEngine::checkNoDropRects(int x, int y) {
} }
int KyraEngine::isDropable(int x, int y) { int KyraEngine::isDropable(int x, int y) {
debug(9, "KyraEngine::isDropable(%d, %d)", x, y); debug(9, kDebugLevelMain, "KyraEngine::isDropable(%d, %d)", x, y);
x -= 8; x -= 8;
y -= 1; y -= 1;
@ -528,7 +528,7 @@ int KyraEngine::isDropable(int x, int y) {
} }
void KyraEngine::itemDropDown(int x, int y, int destX, int destY, byte freeItem, int item) { void KyraEngine::itemDropDown(int x, int y, int destX, int destY, byte freeItem, int item) {
debug(9, "KyraEngine::itemDropDown(%d, %d, %d, %d, %d, %d)", x, y, destX, destY, freeItem, item); debug(9, kDebugLevelMain, "KyraEngine::itemDropDown(%d, %d, %d, %d, %d, %d)", x, y, destX, destY, freeItem, item);
assert(_currentCharacter->sceneId < _roomTableSize); assert(_currentCharacter->sceneId < _roomTableSize);
Room *currentRoom = &_roomTable[_currentCharacter->sceneId]; Room *currentRoom = &_roomTable[_currentCharacter->sceneId];
if (x == destX && y == destY) { if (x == destX && y == destY) {
@ -622,7 +622,7 @@ void KyraEngine::itemDropDown(int x, int y, int destX, int destY, byte freeItem,
} }
void KyraEngine::dropItem(int unk1, int item, int x, int y, int unk2) { void KyraEngine::dropItem(int unk1, int item, int x, int y, int unk2) {
debug(9, "KyraEngine::dropItem(%d, %d, %d, %d, %d)", unk1, item, x, y, unk2); debug(9, kDebugLevelMain, "KyraEngine::dropItem(%d, %d, %d, %d, %d)", unk1, item, x, y, unk2);
if (processItemDrop(_currentCharacter->sceneId, item, x, y, unk1, unk2)) if (processItemDrop(_currentCharacter->sceneId, item, x, y, unk1, unk2))
return; return;
snd_playSoundEffect(54); snd_playSoundEffect(54);
@ -636,7 +636,7 @@ void KyraEngine::dropItem(int unk1, int item, int x, int y, int unk2) {
} }
void KyraEngine::itemSpecialFX(int x, int y, int item) { void KyraEngine::itemSpecialFX(int x, int y, int item) {
debug(9, "KyraEngine::itemSpecialFX(%d, %d, %d)", x, y, item); debug(9, kDebugLevelMain, "KyraEngine::itemSpecialFX(%d, %d, %d)", x, y, item);
if (item == 41) { if (item == 41) {
itemSpecialFX1(x, y, item); itemSpecialFX1(x, y, item);
} else { } else {
@ -645,7 +645,7 @@ void KyraEngine::itemSpecialFX(int x, int y, int item) {
} }
void KyraEngine::itemSpecialFX1(int x, int y, int item) { void KyraEngine::itemSpecialFX1(int x, int y, int item) {
debug(9, "KyraEngine::itemSpecialFX1(%d, %d, %d)", x, y, item); debug(9, kDebugLevelMain, "KyraEngine::itemSpecialFX1(%d, %d, %d)", x, y, item);
uint8 *shape = _shapes[220+item]; uint8 *shape = _shapes[220+item];
x -= 8; x -= 8;
int startY = y; int startY = y;
@ -669,7 +669,7 @@ void KyraEngine::itemSpecialFX1(int x, int y, int item) {
} }
void KyraEngine::itemSpecialFX2(int x, int y, int item) { void KyraEngine::itemSpecialFX2(int x, int y, int item) {
debug(9, "KyraEngine::itemSpecialFX2(%d, %d, %d)", x, y, item); debug(9, kDebugLevelMain, "KyraEngine::itemSpecialFX2(%d, %d, %d)", x, y, item);
x -= 8; x -= 8;
y -= 15; y -= 15;
int yAdd = (int8)(((16 - _itemTable[item].height) >> 1) & 0xFF); int yAdd = (int8)(((16 - _itemTable[item].height) >> 1) & 0xFF);
@ -704,7 +704,7 @@ void KyraEngine::itemSpecialFX2(int x, int y, int item) {
} }
void KyraEngine::magicOutMouseItem(int animIndex, int itemPos) { void KyraEngine::magicOutMouseItem(int animIndex, int itemPos) {
debug(9, "KyraEngine::magicOutMouseItem(%d, %d)", animIndex, itemPos); debug(9, kDebugLevelMain, "KyraEngine::magicOutMouseItem(%d, %d)", animIndex, itemPos);
int videoPageBackUp = _screen->_curPage; int videoPageBackUp = _screen->_curPage;
_screen->_curPage = 0; _screen->_curPage = 0;
int x = 0, y = 0; int x = 0, y = 0;
@ -797,7 +797,7 @@ void KyraEngine::magicOutMouseItem(int animIndex, int itemPos) {
} }
void KyraEngine::magicInMouseItem(int animIndex, int item, int itemPos) { void KyraEngine::magicInMouseItem(int animIndex, int item, int itemPos) {
debug(9, "KyraEngine::magicInMouseItem(%d, %d, %d)", animIndex, item, itemPos); debug(9, kDebugLevelMain, "KyraEngine::magicInMouseItem(%d, %d, %d)", animIndex, item, itemPos);
int videoPageBackUp = _screen->_curPage; int videoPageBackUp = _screen->_curPage;
_screen->_curPage = 0; _screen->_curPage = 0;
int x = 0, y = 0; int x = 0, y = 0;
@ -878,7 +878,7 @@ void KyraEngine::magicInMouseItem(int animIndex, int item, int itemPos) {
} }
void KyraEngine::specialMouseItemFX(int shape, int x, int y, int animIndex, int tableIndex, int loopStart, int maxLoops) { void KyraEngine::specialMouseItemFX(int shape, int x, int y, int animIndex, int tableIndex, int loopStart, int maxLoops) {
debug(9, "KyraEngine::specialMouseItemFX(%d, %d, %d, %d, %d, %d, %d)", shape, x, y, animIndex, tableIndex, loopStart, maxLoops); debug(9, kDebugLevelMain, "KyraEngine::specialMouseItemFX(%d, %d, %d, %d, %d, %d, %d)", shape, x, y, animIndex, tableIndex, loopStart, maxLoops);
static const uint8 table1[] = { static const uint8 table1[] = {
0x23, 0x45, 0x55, 0x72, 0x84, 0xCF, 0x00, 0x00 0x23, 0x45, 0x55, 0x72, 0x84, 0xCF, 0x00, 0x00
}; };
@ -902,7 +902,7 @@ void KyraEngine::specialMouseItemFX(int shape, int x, int y, int animIndex, int
} }
void KyraEngine::processSpecialMouseItemFX(int shape, int x, int y, int tableValue, int loopStart, int maxLoops) { void KyraEngine::processSpecialMouseItemFX(int shape, int x, int y, int tableValue, int loopStart, int maxLoops) {
debug(9, "KyraEngine::processSpecialMouseItemFX(%d, %d, %d, %d, %d, %d)", shape, x, y, tableValue, loopStart, maxLoops); debug(9, kDebugLevelMain, "KyraEngine::processSpecialMouseItemFX(%d, %d, %d, %d, %d, %d)", shape, x, y, tableValue, loopStart, maxLoops);
uint8 shapeColorTable[16]; uint8 shapeColorTable[16];
uint8 *shapePtr = _shapes[4+shape] + 10; uint8 *shapePtr = _shapes[4+shape] + 10;
if (_features & GF_TALKIE) if (_features & GF_TALKIE)
@ -921,7 +921,7 @@ void KyraEngine::processSpecialMouseItemFX(int shape, int x, int y, int tableVal
} }
void KyraEngine::updatePlayerItemsForScene() { void KyraEngine::updatePlayerItemsForScene() {
debug(9, "KyraEngine::updatePlayerItemsForScene()"); debug(9, kDebugLevelMain, "KyraEngine::updatePlayerItemsForScene()");
if (_itemInHand >= 29 && _itemInHand < 33) { if (_itemInHand >= 29 && _itemInHand < 33) {
++_itemInHand; ++_itemInHand;
if (_itemInHand > 33) if (_itemInHand > 33)

View file

@ -189,7 +189,7 @@ DetectedGameList Engine_KYRA_detectGames(const FSList &fslist) {
} }
} }
if (detectedGames.isEmpty()) { if (detectedGames.isEmpty()) {
debug("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str); printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team\n", md5str);
const KyraGameList *g1 = kyra_list; const KyraGameList *g1 = kyra_list;
while (g1->gameid) { while (g1->gameid) {
@ -209,8 +209,33 @@ REGISTER_PLUGIN(KYRA, "Legend of Kyrandia Engine")
namespace Kyra { namespace Kyra {
// never use this!
KyraEngine *gKyraEngine = 0;
void debug(int level, int level2, const char *s, ...) {
if (!(gKyraEngine->debugLevels() & level2))
return;
char buf[120];
va_list va;
va_start(va, s);
vsnprintf(buf, 120, s, va);
va_end(va);
::debug(level, buf);
}
KyraEngine::KyraEngine(GameDetector *detector, OSystem *system) KyraEngine::KyraEngine(GameDetector *detector, OSystem *system)
: Engine(system) { : Engine(system) {
gKyraEngine = this;
// if we have an debug level enable all by default for now
if (gDebugLevel != -1) {
_debugLevelsEnabled = kDebugLevelScriptFuncs | kDebugLevelScript | kDebugLevelSprites |
kDebugLevelScreen | kDebugLevelSound | kDebugLevelAnimator |
kDebugLevelMain | kDebugLevelGUI | kDebugLevelSequence |
kDebugLevelMovie;
} else {
_debugLevelsEnabled = 0;
}
_seq_Forest = _seq_KallakWriting = _seq_KyrandiaLogo = _seq_KallakMalcolm = _seq_Forest = _seq_KallakWriting = _seq_KyrandiaLogo = _seq_KallakMalcolm =
_seq_MalcolmTree = _seq_WestwoodLogo = _seq_Demo1 = _seq_Demo2 = _seq_Demo3 = _seq_MalcolmTree = _seq_WestwoodLogo = _seq_Demo1 = _seq_Demo2 = _seq_Demo3 =
_seq_Demo4 = 0; _seq_Demo4 = 0;
@ -282,7 +307,7 @@ KyraEngine::KyraEngine(GameDetector *detector, OSystem *system)
} }
if (!found) { if (!found) {
debug("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team", md5str); printf("Unknown MD5 (%s)! Please report the details (language, platform, etc.) of this game to the ScummVM team", md5str);
_features = 0; _features = 0;
_game = GI_KYRA1; _game = GI_KYRA1;
Common::File test; Common::File test;
@ -555,7 +580,7 @@ int KyraEngine::go() {
} }
void KyraEngine::startup() { void KyraEngine::startup() {
debug(9, "KyraEngine::startup()"); debug( 9, kDebugLevelMain, "KyraEngine::startup()");
static const uint8 colorMap[] = { 0, 0, 0, 0, 12, 12, 12, 0, 0, 0, 0, 0 }; static const uint8 colorMap[] = { 0, 0, 0, 0, 12, 12, 12, 0, 0, 0, 0, 0 };
_screen->setTextColorMap(colorMap); _screen->setTextColorMap(colorMap);
// _screen->setFont(Screen::FID_6_FNT); // _screen->setFont(Screen::FID_6_FNT);
@ -635,7 +660,7 @@ void KyraEngine::startup() {
} }
void KyraEngine::mainLoop() { void KyraEngine::mainLoop() {
debug(9, "KyraEngine::mainLoop()"); debug( 9, kDebugLevelMain, "KyraEngine::mainLoop()");
while (!_quitFlag) { while (!_quitFlag) {
int32 frameTime = (int32)_system->getMillis(); int32 frameTime = (int32)_system->getMillis();
@ -820,7 +845,7 @@ void KyraEngine::delayWithTicks(int ticks) {
#pragma mark - #pragma mark -
void KyraEngine::setupShapes123(const Shape *shapeTable, int endShape, int flags) { void KyraEngine::setupShapes123(const Shape *shapeTable, int endShape, int flags) {
debug(9, "KyraEngine::setupShapes123(0x%X, startShape, flags)", shapeTable, endShape, flags); debug( 9, kDebugLevelMain, "KyraEngine::setupShapes123(0x%X, startShape, flags)", shapeTable, endShape, flags);
for (int i = 123; i <= 172; ++i) { for (int i = 123; i <= 172; ++i) {
_shapes[4+i] = NULL; _shapes[4+i] = NULL;
} }
@ -848,7 +873,7 @@ void KyraEngine::setupShapes123(const Shape *shapeTable, int endShape, int flags
} }
void KyraEngine::freeShapes123() { void KyraEngine::freeShapes123() {
debug(9, "KyraEngine::freeShapes123()"); debug( 9, kDebugLevelMain, "KyraEngine::freeShapes123()");
for (int i = 123; i <= 172; ++i) { for (int i = 123; i <= 172; ++i) {
free(_shapes[4+i]); free(_shapes[4+i]);
_shapes[4+i] = NULL; _shapes[4+i] = NULL;
@ -879,7 +904,7 @@ int KyraEngine::resetGameFlag(int flag) {
} }
void KyraEngine::setBrandonPoisonFlags(int reset) { void KyraEngine::setBrandonPoisonFlags(int reset) {
debug(9, "KyraEngine::setBrandonPoisonFlags(%d)", reset); debug( 9, kDebugLevelMain, "KyraEngine::setBrandonPoisonFlags(%d)", reset);
_brandonStatusBit |= 1; _brandonStatusBit |= 1;
if (reset) if (reset)
_poisonDeathCounter = 0; _poisonDeathCounter = 0;
@ -894,7 +919,7 @@ void KyraEngine::setBrandonPoisonFlags(int reset) {
} }
void KyraEngine::resetBrandonPoisonFlags() { void KyraEngine::resetBrandonPoisonFlags() {
debug(9, "KyraEngine::resetBrandonPoisonFlags()"); debug( 9, kDebugLevelMain, "KyraEngine::resetBrandonPoisonFlags()");
_brandonStatusBit = 0; _brandonStatusBit = 0;
for (int i = 0; i < 0x100; ++i) { for (int i = 0; i < 0x100; ++i) {
_brandonPoisonFlagsGFX[i] = i; _brandonPoisonFlagsGFX[i] = i;
@ -906,7 +931,7 @@ void KyraEngine::resetBrandonPoisonFlags() {
#pragma mark - #pragma mark -
void KyraEngine::processInput(int xpos, int ypos) { void KyraEngine::processInput(int xpos, int ypos) {
debug(9, "KyraEngine::processInput(%d, %d)", xpos, ypos); debug( 9, kDebugLevelMain, "KyraEngine::processInput(%d, %d)", xpos, ypos);
_abortWalkFlag2 = false; _abortWalkFlag2 = false;
if (processInputHelper(xpos, ypos)) { if (processInputHelper(xpos, ypos)) {
@ -966,7 +991,7 @@ void KyraEngine::processInput(int xpos, int ypos) {
} }
int KyraEngine::processInputHelper(int xpos, int ypos) { int KyraEngine::processInputHelper(int xpos, int ypos) {
debug(9, "KyraEngine::processInputHelper(%d, %d)", xpos, ypos); debug( 9, kDebugLevelMain, "KyraEngine::processInputHelper(%d, %d)", xpos, ypos);
uint8 item = findItemAtPos(xpos, ypos); uint8 item = findItemAtPos(xpos, ypos);
if (item != 0xFF) { if (item != 0xFF) {
if (_itemInHand == -1) { if (_itemInHand == -1) {
@ -993,7 +1018,7 @@ int KyraEngine::processInputHelper(int xpos, int ypos) {
} }
int KyraEngine::clickEventHandler(int xpos, int ypos) { int KyraEngine::clickEventHandler(int xpos, int ypos) {
debug(9, "KyraEngine::clickEventHandler(%d, %d)", xpos, ypos); debug( 9, kDebugLevelMain, "KyraEngine::clickEventHandler(%d, %d)", xpos, ypos);
_scriptInterpreter->initScript(_scriptClick, _scriptClickData); _scriptInterpreter->initScript(_scriptClick, _scriptClickData);
_scriptClick->variables[1] = xpos; _scriptClick->variables[1] = xpos;
_scriptClick->variables[2] = ypos; _scriptClick->variables[2] = ypos;
@ -1121,7 +1146,7 @@ void KyraEngine::updateMousePointer(bool forceUpdate) {
} }
bool KyraEngine::hasClickedOnExit(int xpos, int ypos) { bool KyraEngine::hasClickedOnExit(int xpos, int ypos) {
debug(9, "KyraEngine::hasClickedOnExit(%d, %d)", xpos, ypos); debug( 9, kDebugLevelMain, "KyraEngine::hasClickedOnExit(%d, %d)", xpos, ypos);
if (xpos < 16 || xpos >= 304) { if (xpos < 16 || xpos >= 304) {
return true; return true;
} }
@ -1134,7 +1159,7 @@ bool KyraEngine::hasClickedOnExit(int xpos, int ypos) {
} }
void KyraEngine::clickEventHandler2() { void KyraEngine::clickEventHandler2() {
debug(9, "KyraEngine::clickEventHandler2()"); debug( 9, kDebugLevelMain, "KyraEngine::clickEventHandler2()");
_scriptInterpreter->initScript(_scriptClick, _scriptClickData); _scriptInterpreter->initScript(_scriptClick, _scriptClickData);
_scriptClick->variables[0] = _currentCharacter->sceneId; _scriptClick->variables[0] = _currentCharacter->sceneId;
_scriptClick->variables[1] = _mouseX; _scriptClick->variables[1] = _mouseX;
@ -1148,7 +1173,7 @@ void KyraEngine::clickEventHandler2() {
} }
int KyraEngine::checkForNPCScriptRun(int xpos, int ypos) { int KyraEngine::checkForNPCScriptRun(int xpos, int ypos) {
debug(9, "KyraEngine::checkForNPCScriptRun(%d, %d)", xpos, ypos); debug( 9, kDebugLevelMain, "KyraEngine::checkForNPCScriptRun(%d, %d)", xpos, ypos);
int returnValue = -1; int returnValue = -1;
const Character *currentChar = _currentCharacter; const Character *currentChar = _currentCharacter;
int charLeft = 0, charRight = 0, charTop = 0, charBottom = 0; int charLeft = 0, charRight = 0, charTop = 0, charBottom = 0;
@ -1202,7 +1227,7 @@ int KyraEngine::checkForNPCScriptRun(int xpos, int ypos) {
} }
void KyraEngine::runNpcScript(int func) { void KyraEngine::runNpcScript(int func) {
debug(9, "KyraEngine::runNpcScript(%d)", func); debug( 9, kDebugLevelMain, "KyraEngine::runNpcScript(%d)", func);
_scriptInterpreter->initScript(_npcScript, _npcScriptData); _scriptInterpreter->initScript(_npcScript, _npcScriptData);
_scriptInterpreter->startScript(_npcScript, func); _scriptInterpreter->startScript(_npcScript, func);
_npcScript->variables[0] = _currentCharacter->sceneId; _npcScript->variables[0] = _currentCharacter->sceneId;

View file

@ -65,6 +65,24 @@ enum {
GI_KYRA1 = 0 GI_KYRA1 = 0
}; };
// TODO: this is just the start of makeing the debug output of the kyra engine a bit more useable
// in the future we maybe merge some flags and/or create new ones
enum kDebugLevels {
kDebugLevelScriptFuncs = 1 << 0, // prints debug output of cmd_* functions
kDebugLevelScript = 1 << 1, // prints debug output of "ScriptHelper" functions
kDebugLevelSprites = 1 << 2, // prints debug output of "Sprites" functions
kDebugLevelScreen = 1 << 3, // prints debug output of "Screen" functions
kDebugLevelSound = 1 << 4, // prints debug output of "Sound" functions
kDebugLevelAnimator = 1 << 5, // prints debug output of "ScreenAnimator" functions
kDebugLevelMain = 1 << 6, // prints debug output of common "KyraEngine*" functions && "TextDisplayer" functions
kDebugLevelGUI = 1 << 7, // prints debug output of "KyraEngine*" gui functions
kDebugLevelSequence = 1 << 8, // prints debug output of "SeqPlayer" functions
kDebugLevelMovie = 1 << 9 // prints debug output of movie specific funtions
};
// our intern debug function
void debug(int level, int level2, const char *s, ...);
struct Character { struct Character {
uint16 sceneId; uint16 sceneId;
uint8 height; uint8 height;
@ -246,6 +264,10 @@ public:
uint8 game() const { return _game; } uint8 game() const { return _game; }
uint32 features() const { return _features; } uint32 features() const { return _features; }
void enableDebugLevel(int level) { _debugLevelsEnabled |= level; }
void disableDebugLevel(int level) { _debugLevelsEnabled &= ~level; }
int debugLevels() const { return _debugLevelsEnabled; }
uint8 **shapes() { return _shapes; } uint8 **shapes() { return _shapes; }
Character *currentCharacter() { return _currentCharacter; } Character *currentCharacter() { return _currentCharacter; }
@ -669,6 +691,8 @@ protected:
void gui_redrawTextfield(); void gui_redrawTextfield();
void gui_fadePalette(); void gui_fadePalette();
void gui_restorePalette(); void gui_restorePalette();
int _debugLevelsEnabled; // the enabled debug levels
uint8 _game; uint8 _game;
bool _quitFlag; bool _quitFlag;

View file

@ -93,7 +93,7 @@ Resource::Resource(KyraEngine *engine) {
_pakfiles.push_back(newPak); _pakfiles.push_back(newPak);
else { else {
delete file; delete file;
debug(3, "couldn't load file '%s' correctly", usedFilelist[tmp]); ::debug(3, "couldn't load file '%s' correctly", usedFilelist[tmp]);
} }
} }
} }
@ -211,7 +211,7 @@ PAKFile::PAKFile(const Common::String& file) {
_open = false; _open = false;
if (!pakfile.open(file.c_str())) { if (!pakfile.open(file.c_str())) {
debug(3, "couldn't open pakfile '%s'\n", file.c_str()); ::debug(3, "couldn't open pakfile '%s'\n", file.c_str());
return; return;
} }
@ -283,7 +283,7 @@ uint8 *PAKFile::getFile(const char *file) {
if (!scumm_stricmp((*start)->_name, file)) { if (!scumm_stricmp((*start)->_name, file)) {
Common::File pakfile; Common::File pakfile;
if (!pakfile.open(_filename)) { if (!pakfile.open(_filename)) {
debug(3, "couldn't open pakfile '%s'\n", _filename); ::debug(3, "couldn't open pakfile '%s'\n", _filename);
return 0; return 0;
} }
pakfile.seek((*start)->_start); pakfile.seek((*start)->_start);
@ -302,7 +302,7 @@ bool PAKFile::getFileHandle(const char *file, Common::File &filehandle) {
for (PAKFile_Iterate) { for (PAKFile_Iterate) {
if (!scumm_stricmp((*start)->_name, file)) { if (!scumm_stricmp((*start)->_name, file)) {
if (!filehandle.open(_filename)) { if (!filehandle.open(_filename)) {
debug(3, "couldn't open pakfile '%s'\n", _filename); ::debug(3, "couldn't open pakfile '%s'\n", _filename);
return 0; return 0;
} }
filehandle.seek((*start)->_start); filehandle.seek((*start)->_start);
@ -321,26 +321,26 @@ uint32 PAKFile::getFileSize(const char* file) {
} }
void KyraEngine::loadPalette(const char *filename, uint8 *palData) { void KyraEngine::loadPalette(const char *filename, uint8 *palData) {
debug(9, "KyraEngine::loadPalette('%s' 0x%X)", filename, palData); debug( 9, kDebugLevelMain, "KyraEngine::loadPalette('%s' 0x%X)", filename, palData);
uint32 fileSize = 0; uint32 fileSize = 0;
uint8 *srcData = _res->fileData(filename, &fileSize); uint8 *srcData = _res->fileData(filename, &fileSize);
if (palData && fileSize) { if (palData && fileSize) {
debug(9, "Loading a palette of size %i from '%s'", fileSize, filename); debug( 9, kDebugLevelMain,"Loading a palette of size %i from '%s'", fileSize, filename);
memcpy(palData, srcData, fileSize); memcpy(palData, srcData, fileSize);
} }
delete [] srcData; delete [] srcData;
} }
void KyraEngine::loadBitmap(const char *filename, int tempPage, int dstPage, uint8 *palData) { void KyraEngine::loadBitmap(const char *filename, int tempPage, int dstPage, uint8 *palData) {
debug(9, "KyraEngine::copyBitmap('%s', %d, %d, 0x%X)", filename, tempPage, dstPage, palData); debug( 9, kDebugLevelMain,"KyraEngine::copyBitmap('%s', %d, %d, 0x%X)", filename, tempPage, dstPage, palData);
uint32 fileSize; uint32 fileSize;
uint8 *srcData = _res->fileData(filename, &fileSize); uint8 *srcData = _res->fileData(filename, &fileSize);
uint8 compType = srcData[2]; uint8 compType = srcData[2];
uint32 imgSize = READ_LE_UINT32(srcData + 4); uint32 imgSize = READ_LE_UINT32(srcData + 4);
uint16 palSize = READ_LE_UINT16(srcData + 8); uint16 palSize = READ_LE_UINT16(srcData + 8);
if (palData && palSize) { if (palData && palSize) {
debug(9, "Loading a palette of size %i from %s", palSize, filename); debug( 9, kDebugLevelMain,"Loading a palette of size %i from %s", palSize, filename);
memcpy(palData, srcData + 10, palSize); memcpy(palData, srcData + 10, palSize);
} }
uint8 *srcPtr = srcData + 10 + palSize; uint8 *srcPtr = srcData + 10 + palSize;

View file

@ -32,7 +32,7 @@
namespace Kyra { namespace Kyra {
void KyraEngine::loadGame(const char *fileName) { void KyraEngine::loadGame(const char *fileName) {
debug(9, "loadGame('%s')", fileName); debug(9, kDebugLevelMain, "loadGame('%s')", fileName);
Common::InSaveFile *in; Common::InSaveFile *in;
if (!(in = _saveFileMan->openForLoading(fileName))) { if (!(in = _saveFileMan->openForLoading(fileName))) {
@ -218,13 +218,13 @@ void KyraEngine::loadGame(const char *fileName) {
if (in->ioFailed()) if (in->ioFailed())
error("Load failed."); error("Load failed.");
else else
debug(1, "Loaded savegame '%s.'", saveName); debug(1, kDebugLevelMain, "Loaded savegame '%s.'", saveName);
delete in; delete in;
} }
void KyraEngine::saveGame(const char *fileName, const char *saveName) { void KyraEngine::saveGame(const char *fileName, const char *saveName) {
debug(9, "saveGame('%s', '%s')", fileName, saveName); debug(9, kDebugLevelMain, "saveGame('%s', '%s')", fileName, saveName);
Common::OutSaveFile *out; Common::OutSaveFile *out;
if (!(out = _saveFileMan->openForSaving(fileName))) { if (!(out = _saveFileMan->openForSaving(fileName))) {
@ -312,7 +312,7 @@ void KyraEngine::saveGame(const char *fileName, const char *saveName) {
if (out->ioFailed()) if (out->ioFailed())
warning("Can't write file '%s'. (Disk full?)", fileName); warning("Can't write file '%s'. (Disk full?)", fileName);
else else
debug(1, "Saved game '%s.'", saveName); debug(1, kDebugLevelMain, "Saved game '%s.'", saveName);
delete out; delete out;
} }

View file

@ -37,7 +37,7 @@
namespace Kyra { namespace Kyra {
void KyraEngine::enterNewScene(int sceneId, int facing, int unk1, int unk2, int brandonAlive) { void KyraEngine::enterNewScene(int sceneId, int facing, int unk1, int unk2, int brandonAlive) {
debug(9, "KyraEngine::enterNewScene(%d, %d, %d, %d, %d)", sceneId, facing, unk1, unk2, brandonAlive); debug(9, kDebugLevelMain, "KyraEngine::enterNewScene(%d, %d, %d, %d, %d)", sceneId, facing, unk1, unk2, brandonAlive);
int unkVar1 = 1; int unkVar1 = 1;
_screen->hideMouse(); _screen->hideMouse();
_handleInput = false; _handleInput = false;
@ -206,7 +206,7 @@ void KyraEngine::enterNewScene(int sceneId, int facing, int unk1, int unk2, int
} }
void KyraEngine::transcendScenes(int roomIndex, int roomName) { void KyraEngine::transcendScenes(int roomIndex, int roomName) {
debug(9, "KyraEngine::transcendScenes(%d, %d)", roomIndex, roomName); debug(9, kDebugLevelMain, "KyraEngine::transcendScenes(%d, %d)", roomIndex, roomName);
assert(roomIndex < _roomTableSize); assert(roomIndex < _roomTableSize);
if (_features & GF_TALKIE) { if (_features & GF_TALKIE) {
char file[32]; char file[32];
@ -230,13 +230,13 @@ void KyraEngine::transcendScenes(int roomIndex, int roomName) {
} }
void KyraEngine::setSceneFile(int roomIndex, int roomName) { void KyraEngine::setSceneFile(int roomIndex, int roomName) {
debug(9, "KyraEngine::setSceneFile(%d, %d)", roomIndex, roomName); debug(9, kDebugLevelMain, "KyraEngine::setSceneFile(%d, %d)", roomIndex, roomName);
assert(roomIndex < _roomTableSize); assert(roomIndex < _roomTableSize);
_roomTable[roomIndex].nameIndex = roomName; _roomTable[roomIndex].nameIndex = roomName;
} }
void KyraEngine::moveCharacterToPos(int character, int facing, int xpos, int ypos) { void KyraEngine::moveCharacterToPos(int character, int facing, int xpos, int ypos) {
debug(9, "KyraEngine::moveCharacterToPos(%d, %d, %d, %d)", character, facing, xpos, ypos); debug(9, kDebugLevelMain, "KyraEngine::moveCharacterToPos(%d, %d, %d, %d)", character, facing, xpos, ypos);
Character *ch = &_characterList[character]; Character *ch = &_characterList[character];
ch->facing = facing; ch->facing = facing;
_screen->hideMouse(); _screen->hideMouse();
@ -289,7 +289,7 @@ void KyraEngine::moveCharacterToPos(int character, int facing, int xpos, int ypo
} }
void KyraEngine::setCharacterPositionWithUpdate(int character) { void KyraEngine::setCharacterPositionWithUpdate(int character) {
debug(9, "KyraEngine::setCharacterPositionWithUpdate(%d)", character); debug(9, kDebugLevelMain, "KyraEngine::setCharacterPositionWithUpdate(%d)", character);
setCharacterPosition(character, 0); setCharacterPosition(character, 0);
_sprites->updateSceneAnims(); _sprites->updateSceneAnims();
updateGameTimers(); updateGameTimers();
@ -302,7 +302,7 @@ void KyraEngine::setCharacterPositionWithUpdate(int character) {
} }
int KyraEngine::setCharacterPosition(int character, int *facingTable) { int KyraEngine::setCharacterPosition(int character, int *facingTable) {
debug(9, "KyraEngine::setCharacterPosition(%d, 0x%X)", character, facingTable); debug(9, kDebugLevelMain, "KyraEngine::setCharacterPosition(%d, 0x%X)", character, facingTable);
if (character == 0) { if (character == 0) {
_currentCharacter->x1 += _charXPosTable[_currentCharacter->facing]; _currentCharacter->x1 += _charXPosTable[_currentCharacter->facing];
_currentCharacter->y1 += _charYPosTable[_currentCharacter->facing]; _currentCharacter->y1 += _charYPosTable[_currentCharacter->facing];
@ -319,7 +319,7 @@ int KyraEngine::setCharacterPosition(int character, int *facingTable) {
} }
void KyraEngine::setCharacterPositionHelper(int character, int *facingTable) { void KyraEngine::setCharacterPositionHelper(int character, int *facingTable) {
debug(9, "KyraEngine::setCharacterPositionHelper(%d, 0x%X)", character, facingTable); debug(9, kDebugLevelMain, "KyraEngine::setCharacterPositionHelper(%d, 0x%X)", character, facingTable);
Character *ch = &_characterList[character]; Character *ch = &_characterList[character];
++ch->currentAnimFrame; ++ch->currentAnimFrame;
int facing = ch->facing; int facing = ch->facing;
@ -415,7 +415,7 @@ void KyraEngine::setCharacterPositionHelper(int character, int *facingTable) {
} }
int KyraEngine::getOppositeFacingDirection(int dir) { int KyraEngine::getOppositeFacingDirection(int dir) {
debug(9, "KyraEngine::getOppositeFacingDirection(%d)", dir); debug(9, kDebugLevelMain, "KyraEngine::getOppositeFacingDirection(%d)", dir);
switch (dir) { switch (dir) {
case 0: case 0:
return 2; return 2;
@ -463,7 +463,7 @@ void KyraEngine::loadSceneMSC() {
} }
void KyraEngine::startSceneScript(int brandonAlive) { void KyraEngine::startSceneScript(int brandonAlive) {
debug(9, "KyraEngine::startSceneScript(%d)", brandonAlive); debug(9, kDebugLevelMain, "KyraEngine::startSceneScript(%d)", brandonAlive);
assert(_currentCharacter->sceneId < _roomTableSize); assert(_currentCharacter->sceneId < _roomTableSize);
int tableId = _roomTable[_currentCharacter->sceneId].nameIndex; int tableId = _roomTable[_currentCharacter->sceneId].nameIndex;
assert(tableId < _roomFilenameTableSize); assert(tableId < _roomFilenameTableSize);
@ -497,7 +497,7 @@ void KyraEngine::startSceneScript(int brandonAlive) {
} }
void KyraEngine::initSceneData(int facing, int unk1, int brandonAlive) { void KyraEngine::initSceneData(int facing, int unk1, int brandonAlive) {
debug(9, "KyraEngine::initSceneData(%d, %d, %d)", facing, unk1, brandonAlive); debug(9, kDebugLevelMain, "KyraEngine::initSceneData(%d, %d, %d)", facing, unk1, brandonAlive);
int16 xpos2 = 0; int16 xpos2 = 0;
int setFacing = 1; int setFacing = 1;
@ -675,7 +675,7 @@ void KyraEngine::initSceneData(int facing, int unk1, int brandonAlive) {
} }
void KyraEngine::initSceneObjectList(int brandonAlive) { void KyraEngine::initSceneObjectList(int brandonAlive) {
debug(9, "KyraEngine::initSceneObjectList(%d)", brandonAlive); debug(9, kDebugLevelMain, "KyraEngine::initSceneObjectList(%d)", brandonAlive);
for (int i = 0; i < 28; ++i) { for (int i = 0; i < 28; ++i) {
_animator->actors()[i].active = 0; _animator->actors()[i].active = 0;
} }
@ -878,7 +878,7 @@ void KyraEngine::initSceneScreen(int brandonAlive) {
} }
int KyraEngine::handleSceneChange(int xpos, int ypos, int unk1, int frameReset) { int KyraEngine::handleSceneChange(int xpos, int ypos, int unk1, int frameReset) {
debug(9, "KyraEngine::handleSceneChange(%d, %d, %d, %d)", xpos, ypos, unk1, frameReset); debug(9, kDebugLevelMain, "KyraEngine::handleSceneChange(%d, %d, %d, %d)", xpos, ypos, unk1, frameReset);
if (queryGameFlag(0xEF)) { if (queryGameFlag(0xEF)) {
unk1 = 0; unk1 = 0;
} }
@ -936,7 +936,7 @@ int KyraEngine::handleSceneChange(int xpos, int ypos, int unk1, int frameReset)
} }
int KyraEngine::processSceneChange(int *table, int unk1, int frameReset) { int KyraEngine::processSceneChange(int *table, int unk1, int frameReset) {
debug(9, "KyraEngine::processSceneChange(0x%X, %d, %d)", table, unk1, frameReset); debug(9, kDebugLevelMain, "KyraEngine::processSceneChange(0x%X, %d, %d)", table, unk1, frameReset);
if (queryGameFlag(0xEF)) { if (queryGameFlag(0xEF)) {
unk1 = 0; unk1 = 0;
} }
@ -1033,7 +1033,7 @@ int KyraEngine::processSceneChange(int *table, int unk1, int frameReset) {
} }
int KyraEngine::changeScene(int facing) { int KyraEngine::changeScene(int facing) {
debug(9, "KyraEngine::changeScene(%d)", facing); debug(9, kDebugLevelMain, "KyraEngine::changeScene(%d)", facing);
if (queryGameFlag(0xEF)) { if (queryGameFlag(0xEF)) {
if (_currentCharacter->sceneId == 5) { if (_currentCharacter->sceneId == 5) {
return 0; return 0;
@ -1191,7 +1191,7 @@ void KyraEngine::setCharactersPositions(int character) {
#pragma mark - #pragma mark -
int KyraEngine::findWay(int x, int y, int toX, int toY, int *moveTable, int moveTableSize) { int KyraEngine::findWay(int x, int y, int toX, int toY, int *moveTable, int moveTableSize) {
debug(9, "KyraEngine::findWay(%d, %d, %d, %d, 0x%X, %d)", x, y, toX, toY, moveTable, moveTableSize); debug(9, kDebugLevelMain, "KyraEngine::findWay(%d, %d, %d, %d, 0x%X, %d)", x, y, toX, toY, moveTable, moveTableSize);
x &= 0xFFFC; toX &= 0xFFFC; x &= 0xFFFC; toX &= 0xFFFC;
y &= 0xFFFE; toY &= 0xFFFE; y &= 0xFFFE; toY &= 0xFFFE;
x = (int16)x; y = (int16)y; toX = (int16)toX; toY = (int16)toY; x = (int16)x; y = (int16)y; toX = (int16)toX; toY = (int16)toY;
@ -1307,7 +1307,7 @@ int KyraEngine::findWay(int x, int y, int toX, int toY, int *moveTable, int move
} }
int KyraEngine::findSubPath(int x, int y, int toX, int toY, int *moveTable, int start, int end) { int KyraEngine::findSubPath(int x, int y, int toX, int toY, int *moveTable, int start, int end) {
debug(9, "KyraEngine::findSubPath(%d, %d, %d, %d, 0x%X, %d, %d)", x, y, toX, toY, moveTable, start, end); debug(9, kDebugLevelMain, "KyraEngine::findSubPath(%d, %d, %d, %d, 0x%X, %d, %d)", x, y, toX, toY, moveTable, start, end);
// only used for debug specific code // only used for debug specific code
//static uint16 unkTable[] = { 8, 5 }; //static uint16 unkTable[] = { 8, 5 };
static const int8 facingTable1[] = { 7, 0, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7, 0 }; static const int8 facingTable1[] = { 7, 0, 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6, 7, 0 };
@ -1376,7 +1376,7 @@ int KyraEngine::findSubPath(int x, int y, int toX, int toY, int *moveTable, int
} }
int KyraEngine::getFacingFromPointToPoint(int x, int y, int toX, int toY) { int KyraEngine::getFacingFromPointToPoint(int x, int y, int toX, int toY) {
debug(9, "KyraEngine::getFacingFromPointToPoint(%d, %d, %d, %d)", x, y, toX, toY); debug(9, kDebugLevelMain, "KyraEngine::getFacingFromPointToPoint(%d, %d, %d, %d)", x, y, toX, toY);
static const int facingTable[] = { static const int facingTable[] = {
1, 0, 1, 2, 3, 4, 3, 2, 7, 0, 7, 6, 5, 4, 5, 6 1, 0, 1, 2, 3, 4, 3, 2, 7, 0, 7, 6, 5, 4, 5, 6
}; };
@ -1418,13 +1418,13 @@ int KyraEngine::getFacingFromPointToPoint(int x, int y, int toX, int toY) {
} }
void KyraEngine::changePosTowardsFacing(int &x, int &y, int facing) { void KyraEngine::changePosTowardsFacing(int &x, int &y, int facing) {
debug(9, "KyraEngine::changePosTowardsFacing(%d, %d, %d)", x, y, facing); debug(9, kDebugLevelMain, "KyraEngine::changePosTowardsFacing(%d, %d, %d)", x, y, facing);
x += _addXPosTable[facing]; x += _addXPosTable[facing];
y += _addYPosTable[facing]; y += _addYPosTable[facing];
} }
bool KyraEngine::lineIsPassable(int x, int y) { bool KyraEngine::lineIsPassable(int x, int y) {
debug(9, "KyraEngine::lineIsPassable(%d, %d)", x, y); debug(9, kDebugLevelMain, "KyraEngine::lineIsPassable(%d, %d)", x, y);
if (queryGameFlag(0xEF)) { if (queryGameFlag(0xEF)) {
if (_currentCharacter->sceneId == 5) if (_currentCharacter->sceneId == 5)
return true; return true;
@ -1483,7 +1483,7 @@ bool KyraEngine::lineIsPassable(int x, int y) {
} }
int KyraEngine::getMoveTableSize(int *moveTable) { int KyraEngine::getMoveTableSize(int *moveTable) {
debug(9, "KyraEngine::getMoveTableSize(0x%X)", moveTable); debug(9, kDebugLevelMain, "KyraEngine::getMoveTableSize(0x%X)", moveTable);
int retValue = 0; int retValue = 0;
if (moveTable[0] == 8) if (moveTable[0] == 8)
return 0; return 0;

View file

@ -106,7 +106,7 @@ Screen::~Screen() {
} }
void Screen::updateScreen() { void Screen::updateScreen() {
debug(9, "Screen::updateScreen()"); debug( 9, kDebugLevelScreen, "Screen::updateScreen()");
_system->copyRectToScreen(getPagePtr(0), SCREEN_W, 0, 0, SCREEN_W, SCREEN_H); _system->copyRectToScreen(getPagePtr(0), SCREEN_W, 0, 0, SCREEN_W, SCREEN_H);
//for debug reasons (needs 640x200 screen) //for debug reasons (needs 640x200 screen)
//_system->copyRectToScreen(getPagePtr(2), SCREEN_W, 320, 0, SCREEN_W, SCREEN_H); //_system->copyRectToScreen(getPagePtr(2), SCREEN_W, 320, 0, SCREEN_W, SCREEN_H);
@ -114,19 +114,19 @@ void Screen::updateScreen() {
} }
uint8 *Screen::getPagePtr(int pageNum) { uint8 *Screen::getPagePtr(int pageNum) {
debug(9, "Screen::getPagePtr(%d)", pageNum); debug( 9, kDebugLevelScreen, "Screen::getPagePtr(%d)", pageNum);
assert(pageNum < SCREEN_PAGE_NUM); assert(pageNum < SCREEN_PAGE_NUM);
return _pagePtrs[pageNum]; return _pagePtrs[pageNum];
} }
void Screen::clearPage(int pageNum) { void Screen::clearPage(int pageNum) {
debug(9, "Screen::clearPage(%d)", pageNum); debug( 9, kDebugLevelScreen, "Screen::clearPage(%d)", pageNum);
assert(pageNum < SCREEN_PAGE_NUM); assert(pageNum < SCREEN_PAGE_NUM);
memset(getPagePtr(pageNum), 0, SCREEN_PAGE_SIZE); memset(getPagePtr(pageNum), 0, SCREEN_PAGE_SIZE);
} }
int Screen::setCurPage(int pageNum) { int Screen::setCurPage(int pageNum) {
debug(9, "Screen::setCurPage(%d)", pageNum); debug( 9, kDebugLevelScreen, "Screen::setCurPage(%d)", pageNum);
assert(pageNum < SCREEN_PAGE_NUM); assert(pageNum < SCREEN_PAGE_NUM);
int previousPage = _curPage; int previousPage = _curPage;
_curPage = pageNum; _curPage = pageNum;
@ -134,38 +134,38 @@ int Screen::setCurPage(int pageNum) {
} }
void Screen::clearCurPage() { void Screen::clearCurPage() {
debug(9, "Screen::clearCurPage()"); debug( 9, kDebugLevelScreen, "Screen::clearCurPage()");
memset(getPagePtr(_curPage), 0, SCREEN_PAGE_SIZE); memset(getPagePtr(_curPage), 0, SCREEN_PAGE_SIZE);
} }
uint8 Screen::getPagePixel(int pageNum, int x, int y) { uint8 Screen::getPagePixel(int pageNum, int x, int y) {
debug(9, "Screen::getPagePixel(%d, %d, %d)", pageNum, x, y); debug( 9, kDebugLevelScreen, "Screen::getPagePixel(%d, %d, %d)", pageNum, x, y);
assert(pageNum < SCREEN_PAGE_NUM); assert(pageNum < SCREEN_PAGE_NUM);
assert(x >= 0 && x < SCREEN_W && y >= 0 && y < SCREEN_H); assert(x >= 0 && x < SCREEN_W && y >= 0 && y < SCREEN_H);
return _pagePtrs[pageNum][y * SCREEN_W + x]; return _pagePtrs[pageNum][y * SCREEN_W + x];
} }
void Screen::setPagePixel(int pageNum, int x, int y, uint8 color) { void Screen::setPagePixel(int pageNum, int x, int y, uint8 color) {
debug(9, "Screen::setPagePixel(%d, %d, %d, %d)", pageNum, x, y, color); debug( 9, kDebugLevelScreen, "Screen::setPagePixel(%d, %d, %d, %d)", pageNum, x, y, color);
assert(pageNum < SCREEN_PAGE_NUM); assert(pageNum < SCREEN_PAGE_NUM);
assert(x >= 0 && x < SCREEN_W && y >= 0 && y < SCREEN_H); assert(x >= 0 && x < SCREEN_W && y >= 0 && y < SCREEN_H);
_pagePtrs[pageNum][y * SCREEN_W + x] = color; _pagePtrs[pageNum][y * SCREEN_W + x] = color;
} }
void Screen::fadeFromBlack() { void Screen::fadeFromBlack() {
debug(9, "Screen::fadeFromBlack()"); debug( 9, kDebugLevelScreen, "Screen::fadeFromBlack()");
fadePalette(_currentPalette, 0x54); fadePalette(_currentPalette, 0x54);
} }
void Screen::fadeToBlack() { void Screen::fadeToBlack() {
debug(9, "Screen::fadeToBlack()"); debug( 9, kDebugLevelScreen, "Screen::fadeToBlack()");
uint8 blackPal[768]; uint8 blackPal[768];
memset(blackPal, 0, 768); memset(blackPal, 0, 768);
fadePalette(blackPal, 0x54); fadePalette(blackPal, 0x54);
} }
void Screen::fadeSpecialPalette(int palIndex, int startIndex, int size, int fadeTime) { void Screen::fadeSpecialPalette(int palIndex, int startIndex, int size, int fadeTime) {
debug(9, "fadeSpecialPalette(%d, %d, %d, %d)", palIndex, startIndex, size, fadeTime); debug( 9, kDebugLevelScreen, "fadeSpecialPalette(%d, %d, %d, %d)", palIndex, startIndex, size, fadeTime);
assert(_vm->palTable1()[palIndex]); assert(_vm->palTable1()[palIndex]);
assert(_currentPalette); assert(_currentPalette);
uint8 tempPal[768]; uint8 tempPal[768];
@ -178,7 +178,7 @@ void Screen::fadeSpecialPalette(int palIndex, int startIndex, int size, int fade
} }
void Screen::fadePalette(const uint8 *palData, int delay) { void Screen::fadePalette(const uint8 *palData, int delay) {
debug(9, "Screen::fadePalette(0x%X, %d)", palData, delay); debug( 9, kDebugLevelScreen, "Screen::fadePalette(0x%X, %d)", palData, delay);
uint8 fadePal[768]; uint8 fadePal[768];
memcpy(fadePal, _screenPalette, 768); memcpy(fadePal, _screenPalette, 768);
uint8 diff, maxDiff = 0; uint8 diff, maxDiff = 0;
@ -235,7 +235,7 @@ void Screen::fadePalette(const uint8 *palData, int delay) {
} }
void Screen::setScreenPalette(const uint8 *palData) { void Screen::setScreenPalette(const uint8 *palData) {
debug(9, "Screen::setScreenPalette(0x%X)", palData); debug( 9, kDebugLevelScreen, "Screen::setScreenPalette(0x%X)", palData);
memcpy(_screenPalette, palData, 768); memcpy(_screenPalette, palData, 768);
uint8 screenPal[256 * 4]; uint8 screenPal[256 * 4];
for (int i = 0; i < 256; ++i) { for (int i = 0; i < 256; ++i) {
@ -249,7 +249,7 @@ void Screen::setScreenPalette(const uint8 *palData) {
} }
void Screen::copyToPage0(int y, int h, uint8 page, uint8 *seqBuf) { void Screen::copyToPage0(int y, int h, uint8 page, uint8 *seqBuf) {
debug(9, "Screen::copyToPage0(%d, %d, %d, 0x%X)", y, h, page, seqBuf); debug( 9, kDebugLevelScreen, "Screen::copyToPage0(%d, %d, %d, 0x%X)", y, h, page, seqBuf);
assert(y + h <= SCREEN_H); assert(y + h <= SCREEN_H);
const uint8 *src = getPagePtr(page) + y * SCREEN_W; const uint8 *src = getPagePtr(page) + y * SCREEN_W;
uint8 *dstPage = getPagePtr(0) + y * SCREEN_W; uint8 *dstPage = getPagePtr(0) + y * SCREEN_W;
@ -267,7 +267,7 @@ void Screen::copyToPage0(int y, int h, uint8 page, uint8 *seqBuf) {
} }
void Screen::copyRegion(int x1, int y1, int x2, int y2, int w, int h, int srcPage, int dstPage, int flags) { void Screen::copyRegion(int x1, int y1, int x2, int y2, int w, int h, int srcPage, int dstPage, int flags) {
debug(9, "Screen::copyRegion(%d, %d, %d, %d, %d, %d, %d, %d, %d)", x1, y1, x2, y2, w, h, srcPage, dstPage, flags); debug( 9, kDebugLevelScreen, "Screen::copyRegion(%d, %d, %d, %d, %d, %d, %d, %d, %d)", x1, y1, x2, y2, w, h, srcPage, dstPage, flags);
if (flags & CR_CLIPPED) { if (flags & CR_CLIPPED) {
if (x2 < 0) { if (x2 < 0) {
@ -324,7 +324,7 @@ void Screen::copyRegion(int x1, int y1, int x2, int y2, int w, int h, int srcPag
} }
void Screen::copyRegionToBuffer(int pageNum, int x, int y, int w, int h, uint8 *dest) { void Screen::copyRegionToBuffer(int pageNum, int x, int y, int w, int h, uint8 *dest) {
debug(9, "Screen::copyRegionToBuffer(%d, %d, %d, %d, %d)", pageNum, x, y, w, h); debug( 9, kDebugLevelScreen, "Screen::copyRegionToBuffer(%d, %d, %d, %d, %d)", pageNum, x, y, w, h);
assert(x >= 0 && x < Screen::SCREEN_W && y >= 0 && y < Screen::SCREEN_H && dest); assert(x >= 0 && x < Screen::SCREEN_W && y >= 0 && y < Screen::SCREEN_H && dest);
uint8 *pagePtr = getPagePtr(pageNum); uint8 *pagePtr = getPagePtr(pageNum);
for (int i = y; i < y + h; i++) { for (int i = y; i < y + h; i++) {
@ -333,7 +333,7 @@ void Screen::copyRegionToBuffer(int pageNum, int x, int y, int w, int h, uint8 *
} }
void Screen::copyBlockToPage(int pageNum, int x, int y, int w, int h, const uint8 *src) { void Screen::copyBlockToPage(int pageNum, int x, int y, int w, int h, const uint8 *src) {
debug(9, "Screen::copyBlockToPage(%d, %d, %d, %d, %d, 0x%X)", pageNum, x, y, w, h, src); debug( 9, kDebugLevelScreen, "Screen::copyBlockToPage(%d, %d, %d, %d, %d, 0x%X)", pageNum, x, y, w, h, src);
assert(x >= 0 && x < Screen::SCREEN_W && y >= 0 && y < Screen::SCREEN_H); assert(x >= 0 && x < Screen::SCREEN_W && y >= 0 && y < Screen::SCREEN_H);
uint8 *dst = getPagePtr(pageNum) + y * SCREEN_W + x; uint8 *dst = getPagePtr(pageNum) + y * SCREEN_W + x;
while (h--) { while (h--) {
@ -344,7 +344,7 @@ void Screen::copyBlockToPage(int pageNum, int x, int y, int w, int h, const uint
} }
void Screen::copyFromCurPageBlock(int x, int y, int w, int h, const uint8 *src) { void Screen::copyFromCurPageBlock(int x, int y, int w, int h, const uint8 *src) {
debug(9, "Screen::copyFromCurPageBlock(%d, %d, %d, %d, 0x%X)", x, y, w, h, src); debug( 9, kDebugLevelScreen, "Screen::copyFromCurPageBlock(%d, %d, %d, %d, 0x%X)", x, y, w, h, src);
if (x < 0) { if (x < 0) {
x = 0; x = 0;
} else if (x >= 40) { } else if (x >= 40) {
@ -370,7 +370,7 @@ void Screen::copyFromCurPageBlock(int x, int y, int w, int h, const uint8 *src)
} }
void Screen::copyCurPageBlock(int x, int y, int w, int h, uint8 *dst) { void Screen::copyCurPageBlock(int x, int y, int w, int h, uint8 *dst) {
debug(9, "Screen::copyCurPageBlock(%d, %d, %d, %d, 0x%X)", x, y, w, h, dst); debug( 9, kDebugLevelScreen, "Screen::copyCurPageBlock(%d, %d, %d, %d, 0x%X)", x, y, w, h, dst);
assert(dst); assert(dst);
if (x < 0) { if (x < 0) {
x = 0; x = 0;
@ -397,7 +397,7 @@ void Screen::copyCurPageBlock(int x, int y, int w, int h, uint8 *dst) {
} }
void Screen::shuffleScreen(int sx, int sy, int w, int h, int srcPage, int dstPage, int ticks, bool transparent) { void Screen::shuffleScreen(int sx, int sy, int w, int h, int srcPage, int dstPage, int ticks, bool transparent) {
debug(9, "Screen::shuffleScreen(%d, %d, %d, %d, %d, %d, %d, %d)", sx, sy, w, h, srcPage, dstPage, ticks, transparent); debug( 9, kDebugLevelScreen, "Screen::shuffleScreen(%d, %d, %d, %d, %d, %d, %d, %d)", sx, sy, w, h, srcPage, dstPage, ticks, transparent);
assert(sx >= 0 && w <= SCREEN_W); assert(sx >= 0 && w <= SCREEN_W);
int x; int x;
uint16 x_offs[SCREEN_W]; uint16 x_offs[SCREEN_W];
@ -447,7 +447,7 @@ void Screen::shuffleScreen(int sx, int sy, int w, int h, int srcPage, int dstPag
} }
void Screen::fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum) { void Screen::fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum) {
debug(9, "Screen::fillRect(%d, %d, %d, %d, %d, %d)", x1, y1, x2, y2, color, pageNum); debug( 9, kDebugLevelScreen, "Screen::fillRect(%d, %d, %d, %d, %d, %d)", x1, y1, x2, y2, color, pageNum);
assert(x2 < SCREEN_W && y2 < SCREEN_H); assert(x2 < SCREEN_W && y2 < SCREEN_H);
if (pageNum == -1) { if (pageNum == -1) {
pageNum = _curPage; pageNum = _curPage;
@ -460,7 +460,7 @@ void Screen::fillRect(int x1, int y1, int x2, int y2, uint8 color, int pageNum)
} }
void Screen::drawBox(int x1, int y1, int x2, int y2, int color) { void Screen::drawBox(int x1, int y1, int x2, int y2, int color) {
debug(9, "Screen::drawBox(%i, %i, %i, %i, %i)", x1, y1, x2, y2, color); debug( 9, kDebugLevelScreen, "Screen::drawBox(%i, %i, %i, %i, %i)", x1, y1, x2, y2, color);
drawClippedLine(x1, y1, x2, y1, color); drawClippedLine(x1, y1, x2, y1, color);
drawClippedLine(x1, y1, x1, y2, color); drawClippedLine(x1, y1, x1, y2, color);
@ -469,7 +469,7 @@ void Screen::drawBox(int x1, int y1, int x2, int y2, int color) {
} }
void Screen::drawShadedBox(int x1, int y1, int x2, int y2, int color1, int color2) { void Screen::drawShadedBox(int x1, int y1, int x2, int y2, int color1, int color2) {
debug(9, "Screen::drawShadedBox(%i, %i, %i, %i, %i, %i)", x1, y1, x2, y2, color1, color2); debug( 9, kDebugLevelScreen, "Screen::drawShadedBox(%i, %i, %i, %i, %i, %i)", x1, y1, x2, y2, color1, color2);
assert(x1 > 0 && y1 > 0); assert(x1 > 0 && y1 > 0);
hideMouse(); hideMouse();
@ -485,7 +485,7 @@ void Screen::drawShadedBox(int x1, int y1, int x2, int y2, int color1, int color
} }
void Screen::drawClippedLine(int x1, int y1, int x2, int y2, int color) { void Screen::drawClippedLine(int x1, int y1, int x2, int y2, int color) {
debug(9, "Screen::drawClippedLine(%i, %i, %i, %i, %i)", x1, y1, x2, y2, color); debug( 9, kDebugLevelScreen, "Screen::drawClippedLine(%i, %i, %i, %i, %i)", x1, y1, x2, y2, color);
if (x1 < 0) if (x1 < 0)
x1 = 0; x1 = 0;
@ -520,7 +520,7 @@ void Screen::drawClippedLine(int x1, int y1, int x2, int y2, int color) {
} }
void Screen::drawLine(bool horizontal, int x, int y, int length, int color) { void Screen::drawLine(bool horizontal, int x, int y, int length, int color) {
debug(9, "Screen::drawLine(%i, %i, %i, %i, %i)", horizontal, x, y, length, color); debug( 9, kDebugLevelScreen, "Screen::drawLine(%i, %i, %i, %i, %i)", horizontal, x, y, length, color);
uint8 *ptr = getPagePtr(_curPage) + y * SCREEN_W + x; uint8 *ptr = getPagePtr(_curPage) + y * SCREEN_W + x;
@ -539,7 +539,7 @@ void Screen::drawLine(bool horizontal, int x, int y, int length, int color) {
} }
void Screen::setAnimBlockPtr(int size) { void Screen::setAnimBlockPtr(int size) {
debug(9, "Screen::setAnimBlockPtr(%d)", size); debug( 9, kDebugLevelScreen, "Screen::setAnimBlockPtr(%d)", size);
free(_animBlockPtr); free(_animBlockPtr);
_animBlockPtr = (uint8 *)malloc(size); _animBlockPtr = (uint8 *)malloc(size);
assert(_animBlockPtr); assert(_animBlockPtr);
@ -548,19 +548,19 @@ void Screen::setAnimBlockPtr(int size) {
} }
void Screen::setTextColorMap(const uint8 *cmap) { void Screen::setTextColorMap(const uint8 *cmap) {
debug(9, "Screen::setTextColorMap(0x%X)", cmap); debug( 9, kDebugLevelScreen, "Screen::setTextColorMap(0x%X)", cmap);
setTextColor(cmap, 0, 11); setTextColor(cmap, 0, 11);
} }
void Screen::setTextColor(const uint8 *cmap, int a, int b) { void Screen::setTextColor(const uint8 *cmap, int a, int b) {
debug(9, "Screen::setTextColor(0x%X, %d, %d)", cmap, a, b); debug( 9, kDebugLevelScreen, "Screen::setTextColor(0x%X, %d, %d)", cmap, a, b);
for (int i = a; i <= b; ++i) { for (int i = a; i <= b; ++i) {
_textColorsMap[i] = *cmap++; _textColorsMap[i] = *cmap++;
} }
} }
void Screen::loadFont(FontId fontId, uint8 *fontData) { void Screen::loadFont(FontId fontId, uint8 *fontData) {
debug(9, "Screen::loadFont(%d, 0x%X)", fontId, fontData); debug( 9, kDebugLevelScreen, "Screen::loadFont(%d, 0x%X)", fontId, fontData);
Font *fnt = &_fonts[fontId]; Font *fnt = &_fonts[fontId];
assert(fontData && !fnt->fontData); assert(fontData && !fnt->fontData);
fnt->fontData = fontData; fnt->fontData = fontData;
@ -576,19 +576,19 @@ void Screen::loadFont(FontId fontId, uint8 *fontData) {
} }
Screen::FontId Screen::setFont(FontId fontId) { Screen::FontId Screen::setFont(FontId fontId) {
debug(9, "Screen::setFont(%d)", fontId); debug( 9, kDebugLevelScreen, "Screen::setFont(%d)", fontId);
FontId prev = _currentFont; FontId prev = _currentFont;
_currentFont = fontId; _currentFont = fontId;
return prev; return prev;
} }
int Screen::getCharWidth(uint8 c) const { int Screen::getCharWidth(uint8 c) const {
debug(9, "Screen::getCharWidth('%c')", c); debug( 9, kDebugLevelScreen, "Screen::getCharWidth('%c')", c);
return (int)_fonts[_currentFont].charWidthTable[c] + _charWidth; return (int)_fonts[_currentFont].charWidthTable[c] + _charWidth;
} }
int Screen::getTextWidth(const char *str) const { int Screen::getTextWidth(const char *str) const {
debug(9, "Screen::getTextWidth('%s')", str); debug( 9, kDebugLevelScreen, "Screen::getTextWidth('%s')", str);
int curLineLen = 0; int curLineLen = 0;
int maxLineLen = 0; int maxLineLen = 0;
while (1) { while (1) {
@ -609,7 +609,7 @@ int Screen::getTextWidth(const char *str) const {
} }
void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2) { void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2) {
debug(9, "Screen::printText('%s', %d, %d, 0x%X, 0x%X)", str, x, y, color1, color2); debug( 9, kDebugLevelScreen, "Screen::printText('%s', %d, %d, 0x%X, 0x%X)", str, x, y, color1, color2);
uint8 cmap[2]; uint8 cmap[2];
cmap[0] = color2; cmap[0] = color2;
cmap[1] = color1; cmap[1] = color1;
@ -653,7 +653,7 @@ void Screen::printText(const char *str, int x, int y, uint8 color1, uint8 color2
} }
void Screen::drawChar(uint8 c, int x, int y) { void Screen::drawChar(uint8 c, int x, int y) {
debug(9, "Screen::drawChar('%c', %d, %d)", c, x, y); debug( 9, kDebugLevelScreen, "Screen::drawChar('%c', %d, %d)", c, x, y);
Font *fnt = &_fonts[_currentFont]; Font *fnt = &_fonts[_currentFont];
uint8 *dst = getPagePtr(_curPage) + y * SCREEN_W + x; uint8 *dst = getPagePtr(_curPage) + y * SCREEN_W + x;
uint16 bitmapOffset = READ_LE_UINT16(fnt->fontData + fnt->charBitmapOffset + c * 2); uint16 bitmapOffset = READ_LE_UINT16(fnt->fontData + fnt->charBitmapOffset + c * 2);
@ -717,14 +717,14 @@ void Screen::drawChar(uint8 c, int x, int y) {
} }
void Screen::setScreenDim(int dim) { void Screen::setScreenDim(int dim) {
debug(9, "setScreenDim(%d)", dim); debug( 9, kDebugLevelScreen, "setScreenDim(%d)", dim);
assert(dim < _screenDimTableCount); assert(dim < _screenDimTableCount);
_curDim = &_screenDimTable[dim]; _curDim = &_screenDimTable[dim];
// XXX // XXX
} }
void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int sd, int flags, ...) { void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int sd, int flags, ...) {
debug(9, "Screen::drawShape(%d, 0x%X, %d, %d, %d, 0x%.04X, ...)", pageNum, shapeData, x, y, sd, flags); debug( 9, kDebugLevelScreen, "Screen::drawShape(%d, 0x%X, %d, %d, %d, 0x%.04X, ...)", pageNum, shapeData, x, y, sd, flags);
if (!shapeData) if (!shapeData)
return; return;
va_list args; va_list args;
@ -1225,7 +1225,7 @@ void Screen::drawShape(uint8 pageNum, const uint8 *shapeData, int x, int y, int
} }
void Screen::decodeFrame3(const uint8 *src, uint8 *dst, uint32 size) { void Screen::decodeFrame3(const uint8 *src, uint8 *dst, uint32 size) {
debug(9, "Screen::decodeFrame3(0x%X, 0x%X, %d)", src, dst, size); debug( 9, kDebugLevelScreen, "Screen::decodeFrame3(0x%X, 0x%X, %d)", src, dst, size);
const uint8 *dstEnd = dst + size; const uint8 *dstEnd = dst + size;
while (dst < dstEnd) { while (dst < dstEnd) {
int8 code = *src++; int8 code = *src++;
@ -1246,7 +1246,7 @@ void Screen::decodeFrame3(const uint8 *src, uint8 *dst, uint32 size) {
} }
void Screen::decodeFrame4(const uint8 *src, uint8 *dst, uint32 dstSize) { void Screen::decodeFrame4(const uint8 *src, uint8 *dst, uint32 dstSize) {
debug(9, "Screen::decodeFrame4(0x%X, 0x%X, %d)", src, dst, dstSize); debug( 9, kDebugLevelScreen, "Screen::decodeFrame4(0x%X, 0x%X, %d)", src, dst, dstSize);
uint8 *dstOrig = dst; uint8 *dstOrig = dst;
uint8 *dstEnd = dst + dstSize; uint8 *dstEnd = dst + dstSize;
while (1) { while (1) {
@ -1295,7 +1295,7 @@ void Screen::decodeFrame4(const uint8 *src, uint8 *dst, uint32 dstSize) {
} }
void Screen::decodeFrameDelta(uint8 *dst, const uint8 *src) { void Screen::decodeFrameDelta(uint8 *dst, const uint8 *src) {
debug(9, "Screen::decodeFrameDelta(0x%X, 0x%X)", dst, src); debug( 9, kDebugLevelScreen, "Screen::decodeFrameDelta(0x%X, 0x%X)", dst, src);
while (1) { while (1) {
uint8 code = *src++; uint8 code = *src++;
if (code == 0) { if (code == 0) {
@ -1338,7 +1338,7 @@ void Screen::decodeFrameDelta(uint8 *dst, const uint8 *src) {
} }
void Screen::decodeFrameDeltaPage(uint8 *dst, const uint8 *src, int pitch, int noXor) { void Screen::decodeFrameDeltaPage(uint8 *dst, const uint8 *src, int pitch, int noXor) {
debug(9, "Screen::decodeFrameDeltaPage(0x%X, 0x%X, %d, %d)", dst, src, pitch, noXor); debug( 9, kDebugLevelScreen, "Screen::decodeFrameDeltaPage(0x%X, 0x%X, %d, %d)", dst, src, pitch, noXor);
int count = 0; int count = 0;
uint8 *dstNext = dst; uint8 *dstNext = dst;
while (1) { while (1) {
@ -1434,7 +1434,7 @@ void Screen::decodeFrameDeltaPage(uint8 *dst, const uint8 *src, int pitch, int n
} }
uint8 *Screen::encodeShape(int x, int y, int w, int h, int flags) { uint8 *Screen::encodeShape(int x, int y, int w, int h, int flags) {
debug(9, "Screen::encodeShape(%d, %d, %d, %d, %d)", x, y, w, h, flags); debug( 9, kDebugLevelScreen, "Screen::encodeShape(%d, %d, %d, %d, %d)", x, y, w, h, flags);
uint8 *srcPtr = &_pagePtrs[_curPage][y * SCREEN_W + x]; uint8 *srcPtr = &_pagePtrs[_curPage][y * SCREEN_W + x];
int16 shapeSize = 0; int16 shapeSize = 0;
uint8 *tmp = srcPtr; uint8 *tmp = srcPtr;
@ -1619,7 +1619,7 @@ uint8 *Screen::encodeShape(int x, int y, int w, int h, int flags) {
} }
int16 Screen::encodeShapeAndCalculateSize(uint8 *from, uint8 *to, int size_to) { int16 Screen::encodeShapeAndCalculateSize(uint8 *from, uint8 *to, int size_to) {
debug(9, "Screen::encodeShapeAndCalculateSize(0x%X, 0x%X, %d)", from, to, size_to); debug( 9, kDebugLevelScreen, "Screen::encodeShapeAndCalculateSize(0x%X, 0x%X, %d)", from, to, size_to);
byte *fromPtrEnd = from + size_to; byte *fromPtrEnd = from + size_to;
bool skipPixel = true; bool skipPixel = true;
byte *tempPtr = 0; byte *tempPtr = 0;
@ -1767,13 +1767,13 @@ int Screen::getRectSize(int x, int y) {
} }
void Screen::hideMouse() { void Screen::hideMouse() {
debug(9, "Screen::hideMouse()"); debug( 9, kDebugLevelScreen, "Screen::hideMouse()");
++_mouseLockCount; ++_mouseLockCount;
_system->showMouse(false); _system->showMouse(false);
} }
void Screen::showMouse() { void Screen::showMouse() {
debug(9, "Screen::showMouse()"); debug( 9, kDebugLevelScreen, "Screen::showMouse()");
if (_mouseLockCount == 1) if (_mouseLockCount == 1)
_system->showMouse(true); _system->showMouse(true);
@ -1784,13 +1784,13 @@ void Screen::showMouse() {
} }
void Screen::setShapePages(int page1, int page2) { void Screen::setShapePages(int page1, int page2) {
debug(9, "Screen::setShapePages(%d, %d)", page1, page2); debug( 9, kDebugLevelScreen, "Screen::setShapePages(%d, %d)", page1, page2);
_shapePages[0] = _pagePtrs[page1]; _shapePages[0] = _pagePtrs[page1];
_shapePages[1] = _pagePtrs[page2]; _shapePages[1] = _pagePtrs[page2];
} }
void Screen::setMouseCursor(int x, int y, byte *shape) { void Screen::setMouseCursor(int x, int y, byte *shape) {
debug(9, "Screen::setMouseCursor(%d, %d, 0x%X)", x, y, shape); debug( 9, kDebugLevelScreen, "Screen::setMouseCursor(%d, %d, 0x%X)", x, y, shape);
if (!shape) if (!shape)
return; return;
// if mouseDisabled // if mouseDisabled
@ -1820,7 +1820,7 @@ void Screen::setMouseCursor(int x, int y, byte *shape) {
} }
void Screen::copyScreenFromRect(int x, int y, int w, int h, uint8 *ptr) { void Screen::copyScreenFromRect(int x, int y, int w, int h, uint8 *ptr) {
debug(9, "Screen::copyScreenFromRect(%d, %d, %d, %d, 0x%X)", x, y, w, h, ptr); debug( 9, kDebugLevelScreen, "Screen::copyScreenFromRect(%d, %d, %d, %d, 0x%X)", x, y, w, h, ptr);
x <<= 3; w <<= 3; x <<= 3; w <<= 3;
uint8 *src = ptr; uint8 *src = ptr;
uint8 *dst = &_pagePtrs[0][y * SCREEN_W + x]; uint8 *dst = &_pagePtrs[0][y * SCREEN_W + x];
@ -1832,7 +1832,7 @@ void Screen::copyScreenFromRect(int x, int y, int w, int h, uint8 *ptr) {
} }
void Screen::copyScreenToRect(int x, int y, int w, int h, uint8 *ptr) { void Screen::copyScreenToRect(int x, int y, int w, int h, uint8 *ptr) {
debug(9, "Screen::copyScreenToRect(%d, %d, %d, %d, 0x%X)", x, y, w, h, ptr); debug( 9, kDebugLevelScreen, "Screen::copyScreenToRect(%d, %d, %d, %d, 0x%X)", x, y, w, h, ptr);
x <<= 3; w <<= 3; x <<= 3; w <<= 3;
uint8 *src = &_pagePtrs[0][y * SCREEN_W + x]; uint8 *src = &_pagePtrs[0][y * SCREEN_W + x];
uint8 *dst = ptr; uint8 *dst = ptr;
@ -1844,7 +1844,7 @@ void Screen::copyScreenToRect(int x, int y, int w, int h, uint8 *ptr) {
} }
uint8 *Screen::getPalette(int num) { uint8 *Screen::getPalette(int num) {
debug(9, "Screen::getPalette(%d)", num); debug( 9, kDebugLevelScreen, "Screen::getPalette(%d)", num);
assert(num >= 0 && num < 4); assert(num >= 0 && num < 4);
if (num == 0) { if (num == 0) {
return _screenPalette; return _screenPalette;
@ -1854,7 +1854,7 @@ uint8 *Screen::getPalette(int num) {
} }
byte Screen::getShapeFlag1(int x, int y) { byte Screen::getShapeFlag1(int x, int y) {
debug(9, "Screen::getShapeFlag1(%d, %d)", x, y); debug( 9, kDebugLevelScreen, "Screen::getShapeFlag1(%d, %d)", x, y);
uint8 color = _shapePages[0][y * SCREEN_W + x]; uint8 color = _shapePages[0][y * SCREEN_W + x];
color &= 0x80; color &= 0x80;
color ^= 0x80; color ^= 0x80;
@ -1866,7 +1866,7 @@ byte Screen::getShapeFlag1(int x, int y) {
} }
byte Screen::getShapeFlag2(int x, int y) { byte Screen::getShapeFlag2(int x, int y) {
debug(9, "Screen::getShapeFlag2(%d, %d)", x, y); debug( 9, kDebugLevelScreen, "Screen::getShapeFlag2(%d, %d)", x, y);
uint8 color = _shapePages[0][y * SCREEN_W + x]; uint8 color = _shapePages[0][y * SCREEN_W + x];
color &= 0x7F; color &= 0x7F;
color &= 0x87; color &= 0x87;
@ -1874,7 +1874,7 @@ byte Screen::getShapeFlag2(int x, int y) {
} }
int Screen::setNewShapeHeight(uint8 *shape, int height) { int Screen::setNewShapeHeight(uint8 *shape, int height) {
debug(9, "Screen::setNewShapeHeight(0x%X, %d)", shape, height); debug( 9, kDebugLevelScreen, "Screen::setNewShapeHeight(0x%X, %d)", shape, height);
if (_vm->features() & GF_TALKIE) if (_vm->features() & GF_TALKIE)
shape += 2; shape += 2;
int oldHeight = shape[2]; int oldHeight = shape[2];
@ -1883,7 +1883,7 @@ int Screen::setNewShapeHeight(uint8 *shape, int height) {
} }
int Screen::resetShapeHeight(uint8 *shape) { int Screen::resetShapeHeight(uint8 *shape) {
debug(9, "Screen::setNewShapeHeight(0x%X)", shape); debug( 9, kDebugLevelScreen, "Screen::setNewShapeHeight(0x%X)", shape);
if (_vm->features() & GF_TALKIE) if (_vm->features() & GF_TALKIE)
shape += 2; shape += 2;
int oldHeight = shape[2]; int oldHeight = shape[2];
@ -1892,7 +1892,7 @@ int Screen::resetShapeHeight(uint8 *shape) {
} }
void Screen::addBitBlitRect(int x, int y, int w, int h) { void Screen::addBitBlitRect(int x, int y, int w, int h) {
debug(9, "Screen::addBitBlitRects(%d, %d, %d, %d)", x, y, w, h); debug( 9, kDebugLevelScreen, "Screen::addBitBlitRects(%d, %d, %d, %d)", x, y, w, h);
if (_bitBlitNum >= BITBLIT_RECTS) { if (_bitBlitNum >= BITBLIT_RECTS) {
error("too many bit blit rects"); error("too many bit blit rects");
} }
@ -1904,7 +1904,7 @@ void Screen::addBitBlitRect(int x, int y, int w, int h) {
} }
void Screen::bitBlitRects() { void Screen::bitBlitRects() {
debug(9, "Screen::bitBlitRects()"); debug( 9, kDebugLevelScreen, "Screen::bitBlitRects()");
Rect *cur = _bitBlitRects; Rect *cur = _bitBlitRects;
while (_bitBlitNum) { while (_bitBlitNum) {
_bitBlitNum--; _bitBlitNum--;
@ -1914,7 +1914,7 @@ void Screen::bitBlitRects() {
} }
void Screen::savePageToDisk(const char *file, int page) { void Screen::savePageToDisk(const char *file, int page) {
debug(9, "Screen::savePageToDisk('%s', %d)", file, page); debug( 9, kDebugLevelScreen, "Screen::savePageToDisk('%s', %d)", file, page);
if (!_saveLoadPage[page/2]) { if (!_saveLoadPage[page/2]) {
_saveLoadPage[page/2] = new uint8[SCREEN_W * SCREEN_H]; _saveLoadPage[page/2] = new uint8[SCREEN_W * SCREEN_H];
assert(_saveLoadPage[page/2]); assert(_saveLoadPage[page/2]);
@ -1923,20 +1923,20 @@ void Screen::savePageToDisk(const char *file, int page) {
} }
void Screen::loadPageFromDisk(const char *file, int page) { void Screen::loadPageFromDisk(const char *file, int page) {
debug(9, "Screen::loadPageFromDisk('%s', %d)", file, page); debug( 9, kDebugLevelScreen, "Screen::loadPageFromDisk('%s', %d)", file, page);
copyBlockToPage(page, 0, 0, SCREEN_W, SCREEN_H, _saveLoadPage[page/2]); copyBlockToPage(page, 0, 0, SCREEN_W, SCREEN_H, _saveLoadPage[page/2]);
delete [] _saveLoadPage[page/2]; delete [] _saveLoadPage[page/2];
_saveLoadPage[page/2] = 0; _saveLoadPage[page/2] = 0;
} }
void Screen::deletePageFromDisk(int page) { void Screen::deletePageFromDisk(int page) {
debug(9, "Screen::deletePageFromDisk(%d)", page); debug( 9, kDebugLevelScreen, "Screen::deletePageFromDisk(%d)", page);
delete [] _saveLoadPage[page/2]; delete [] _saveLoadPage[page/2];
_saveLoadPage[page/2] = 0; _saveLoadPage[page/2] = 0;
} }
void Screen::blockInRegion(int x, int y, int width, int height) { void Screen::blockInRegion(int x, int y, int width, int height) {
debug(9, "Screen::blockInRegion(%d, %d, %d, %d)", x, y, width, height); debug( 9, kDebugLevelScreen, "Screen::blockInRegion(%d, %d, %d, %d)", x, y, width, height);
assert(_shapePages[0]); assert(_shapePages[0]);
byte *toPtr = _shapePages[0] + (y * 320 + x); byte *toPtr = _shapePages[0] + (y * 320 + x);
for (int i = 0; i < height; ++i) { for (int i = 0; i < height; ++i) {
@ -1949,7 +1949,7 @@ void Screen::blockInRegion(int x, int y, int width, int height) {
} }
void Screen::blockOutRegion(int x, int y, int width, int height) { void Screen::blockOutRegion(int x, int y, int width, int height) {
debug(9, "Screen::blockOutRegion(%d, %d, %d, %d)", x, y, width, height); debug( 9, kDebugLevelScreen, "Screen::blockOutRegion(%d, %d, %d, %d)", x, y, width, height);
assert(_shapePages[0]); assert(_shapePages[0]);
byte *toPtr = _shapePages[0] + (y * 320 + x); byte *toPtr = _shapePages[0] + (y * 320 + x);
for (int i = 0; i < height; ++i) { for (int i = 0; i < height; ++i) {
@ -1975,31 +1975,31 @@ void Screen::rectClip(int &x, int &y, int w, int h) {
} }
void Screen::backUpRect0(int xpos, int ypos) { void Screen::backUpRect0(int xpos, int ypos) {
debug(9, "Screen::backUpRect0(%d, %d)", xpos, ypos); debug( 9, kDebugLevelScreen, "Screen::backUpRect0(%d, %d)", xpos, ypos);
rectClip(xpos, ypos, 3<<3, 24); rectClip(xpos, ypos, 3<<3, 24);
copyRegionToBuffer(_curPage, xpos, ypos, 3<<3, 24, _vm->shapes()[0]); copyRegionToBuffer(_curPage, xpos, ypos, 3<<3, 24, _vm->shapes()[0]);
} }
void Screen::restoreRect0(int xpos, int ypos) { void Screen::restoreRect0(int xpos, int ypos) {
debug(9, "Screen::restoreRect0(%d, %d)", xpos, ypos); debug( 9, kDebugLevelScreen, "Screen::restoreRect0(%d, %d)", xpos, ypos);
rectClip(xpos, ypos, 3<<3, 24); rectClip(xpos, ypos, 3<<3, 24);
copyBlockToPage(_curPage, xpos, ypos, 3<<3, 24, _vm->shapes()[0]); copyBlockToPage(_curPage, xpos, ypos, 3<<3, 24, _vm->shapes()[0]);
} }
void Screen::backUpRect1(int xpos, int ypos) { void Screen::backUpRect1(int xpos, int ypos) {
debug(9, "Screen::backUpRect1(%d, %d)", xpos, ypos); debug( 9, kDebugLevelScreen, "Screen::backUpRect1(%d, %d)", xpos, ypos);
rectClip(xpos, ypos, 4<<3, 32); rectClip(xpos, ypos, 4<<3, 32);
copyRegionToBuffer(_curPage, xpos, ypos, 4<<3, 32, _vm->shapes()[1]); copyRegionToBuffer(_curPage, xpos, ypos, 4<<3, 32, _vm->shapes()[1]);
} }
void Screen::restoreRect1(int xpos, int ypos) { void Screen::restoreRect1(int xpos, int ypos) {
debug(9, "Screen::restoreRect1(%d, %d)", xpos, ypos); debug( 9, kDebugLevelScreen, "Screen::restoreRect1(%d, %d)", xpos, ypos);
rectClip(xpos, ypos, 4<<3, 32); rectClip(xpos, ypos, 4<<3, 32);
copyBlockToPage(_curPage, xpos, ypos, 4<<3, 32, _vm->shapes()[1]); copyBlockToPage(_curPage, xpos, ypos, 4<<3, 32, _vm->shapes()[1]);
} }
int Screen::getDrawLayer(int x, int y) { int Screen::getDrawLayer(int x, int y) {
debug(9, "Screen::getDrawLayer(%d, %d)", x, y); debug( 9, kDebugLevelScreen, "Screen::getDrawLayer(%d, %d)", x, y);
int xpos = x - 8; int xpos = x - 8;
int ypos = y - 1; int ypos = y - 1;
int layer = 1; int layer = 1;
@ -2016,7 +2016,7 @@ int Screen::getDrawLayer(int x, int y) {
} }
int Screen::getDrawLayer2(int x, int y, int height) { int Screen::getDrawLayer2(int x, int y, int height) {
debug(9, "Screen::getDrawLayer2(%d, %d, %d)", x, y, height); debug( 9, kDebugLevelScreen, "Screen::getDrawLayer2(%d, %d, %d)", x, y, height);
int xpos = x - 8; int xpos = x - 8;
int ypos = y - 1; int ypos = y - 1;
int layer = 1; int layer = 1;
@ -2037,7 +2037,7 @@ int Screen::getDrawLayer2(int x, int y, int height) {
} }
void Screen::copyBackgroundBlock(int x, int page, int flag) { void Screen::copyBackgroundBlock(int x, int page, int flag) {
debug(9, "Screen::copyBackgroundBlock(%d, %d, %d)", x, page, flag); debug( 9, kDebugLevelScreen, "Screen::copyBackgroundBlock(%d, %d, %d)", x, page, flag);
if (x < 1) if (x < 1)
return; return;

View file

@ -217,7 +217,7 @@ bool ScriptHelper::runScript(ScriptState *script) {
if (opcode > 18) { if (opcode > 18) {
error("Script unknown command: %d", opcode); error("Script unknown command: %d", opcode);
} else { } else {
debug(5, "%s(%d)", _commands[opcode].desc, _parameter); debug(5, kDebugLevelScript, "%s([%d/%u])", _commands[opcode].desc, _parameter, (uint)_parameter);
(this->*(_commands[opcode].proc))(script); (this->*(_commands[opcode].proc))(script);
} }
@ -387,7 +387,7 @@ void ScriptHelper::c1_subSP(ScriptState* script) {
void ScriptHelper::c1_execOpcode(ScriptState* script) { void ScriptHelper::c1_execOpcode(ScriptState* script) {
assert((uint8)_parameter < script->dataPtr->opcodeSize); assert((uint8)_parameter < script->dataPtr->opcodeSize);
if (script->dataPtr->opcodes[(uint8)_parameter] == &KyraEngine::cmd_dummy) if (script->dataPtr->opcodes[(uint8)_parameter] == &KyraEngine::cmd_dummy)
debug("calling unimplemented opcode(0x%.02X)", (uint8)_parameter); warning("calling unimplemented opcode(0x%.02X)", (uint8)_parameter);
int val = (_vm->*script->dataPtr->opcodes[(uint8)_parameter])(script); int val = (_vm->*script->dataPtr->opcodes[(uint8)_parameter])(script);
assert(script); assert(script);
script->retValue = val; script->retValue = val;

File diff suppressed because it is too large Load diff

View file

@ -64,7 +64,7 @@ SeqPlayer::~SeqPlayer() {
} }
uint8 *SeqPlayer::setPanPages(int pageNum, int shape) { uint8 *SeqPlayer::setPanPages(int pageNum, int shape) {
debug(9, "SeqPlayer::setPanPages(%d, %d)", pageNum, shape); debug( 9, kDebugLevelSequence, "SeqPlayer::setPanPages(%d, %d)", pageNum, shape);
uint8 *panPage = 0; uint8 *panPage = 0;
const uint8 *data = _screen->getPagePtr(pageNum); const uint8 *data = _screen->getPagePtr(pageNum);
uint16 numShapes = READ_LE_UINT16(data); uint16 numShapes = READ_LE_UINT16(data);
@ -88,7 +88,7 @@ uint8 *SeqPlayer::setPanPages(int pageNum, int shape) {
} }
void SeqPlayer::makeHandShapes() { void SeqPlayer::makeHandShapes() {
debug(9, "SeqPlayer::makeHandShapes()"); debug( 9, kDebugLevelSequence, "SeqPlayer::makeHandShapes()");
_vm->loadBitmap("WRITING.CPS", 3, 3, 0); _vm->loadBitmap("WRITING.CPS", 3, 3, 0);
for (int i = 0; i < ARRAYSIZE(_handShapes); ++i) { for (int i = 0; i < ARRAYSIZE(_handShapes); ++i) {
if (_handShapes[i]) if (_handShapes[i])
@ -98,7 +98,7 @@ void SeqPlayer::makeHandShapes() {
} }
void SeqPlayer::freeHandShapes() { void SeqPlayer::freeHandShapes() {
debug(9, "SeqPlayer::freeHandShapes()"); debug( 9, kDebugLevelSequence, "SeqPlayer::freeHandShapes()");
for (int i = 0; i < ARRAYSIZE(_handShapes); ++i) { for (int i = 0; i < ARRAYSIZE(_handShapes); ++i) {
free(_handShapes[i]); free(_handShapes[i]);
_handShapes[i] = 0; _handShapes[i] = 0;
@ -461,7 +461,7 @@ void SeqPlayer::s1_prefetchVocFile() {
} }
bool SeqPlayer::playSequence(const uint8 *seqData, bool skipSeq) { bool SeqPlayer::playSequence(const uint8 *seqData, bool skipSeq) {
debug(9, "SeqPlayer::seq_playSequence(0x%X, %d)", seqData, skipSeq); debug( 9, kDebugLevelSequence, "SeqPlayer::seq_playSequence(0x%X, %d)", seqData, skipSeq);
assert(seqData); assert(seqData);
static SeqEntry floppySeqProcs[] = { static SeqEntry floppySeqProcs[] = {
@ -623,7 +623,7 @@ bool SeqPlayer::playSequence(const uint8 *seqData, bool skipSeq) {
uint8 seqCode = *_seqData++; uint8 seqCode = *_seqData++;
if (seqCode < numCommands) { if (seqCode < numCommands) {
SeqProc currentProc = commands[seqCode].proc; SeqProc currentProc = commands[seqCode].proc;
debug(5, "seqCode = %d (%s)", seqCode, commands[seqCode].desc); debug( 5, kDebugLevelSequence, "seqCode = %d (%s)", seqCode, commands[seqCode].desc);
(this->*currentProc)(); (this->*currentProc)();
} else { } else {
error("Invalid sequence opcode %d", seqCode); error("Invalid sequence opcode %d", seqCode);

View file

@ -36,7 +36,7 @@
namespace Kyra { namespace Kyra {
void KyraEngine::seq_demo() { void KyraEngine::seq_demo() {
debug(9, "KyraEngine::seq_demo()"); debug(9, kDebugLevelMain, "KyraEngine::seq_demo()");
snd_playTheme(MUSIC_INTRO, 2); snd_playTheme(MUSIC_INTRO, 2);
@ -86,7 +86,7 @@ void KyraEngine::seq_demo() {
} }
void KyraEngine::seq_intro() { void KyraEngine::seq_intro() {
debug(9, "KyraEngine::seq_intro()"); debug(9, kDebugLevelMain, "KyraEngine::seq_intro()");
if (_features & GF_TALKIE) { if (_features & GF_TALKIE) {
_res->loadPakFile("INTRO.VRM"); _res->loadPakFile("INTRO.VRM");
@ -126,7 +126,7 @@ void KyraEngine::seq_intro() {
} }
void KyraEngine::seq_introLogos() { void KyraEngine::seq_introLogos() {
debug(9, "KyraEngine::seq_introLogos()"); debug(9, kDebugLevelMain, "KyraEngine::seq_introLogos()");
_screen->clearPage(0); _screen->clearPage(0);
loadBitmap("TOP.CPS", 7, 7, NULL); loadBitmap("TOP.CPS", 7, 7, NULL);
loadBitmap("BOTTOM.CPS", 5, 5, _screen->_currentPalette); loadBitmap("BOTTOM.CPS", 5, 5, _screen->_currentPalette);
@ -181,7 +181,7 @@ void KyraEngine::seq_introLogos() {
} }
void KyraEngine::seq_introStory() { void KyraEngine::seq_introStory() {
debug(9, "KyraEngine::seq_introStory()"); debug(9, kDebugLevelMain, "KyraEngine::seq_introStory()");
_screen->clearPage(3); _screen->clearPage(3);
_screen->clearPage(0); _screen->clearPage(0);
if (_features & GF_TALKIE) { if (_features & GF_TALKIE) {
@ -199,19 +199,19 @@ void KyraEngine::seq_introStory() {
} }
_screen->copyRegion(0, 0, 0, 0, 320, 200, 3, 0); _screen->copyRegion(0, 0, 0, 0, 320, 200, 3, 0);
_screen->updateScreen(); _screen->updateScreen();
debug("skipFlag %i, %i", _skipFlag, _tickLength); //debug(0, kDebugLevelMain, "skipFlag %i, %i", _skipFlag, _tickLength);
delay(360 * _tickLength); delay(360 * _tickLength);
} }
void KyraEngine::seq_introMalcolmTree() { void KyraEngine::seq_introMalcolmTree() {
debug(9, "KyraEngine::seq_introMalcolmTree()"); debug(9, kDebugLevelMain, "KyraEngine::seq_introMalcolmTree()");
_screen->_curPage = 0; _screen->_curPage = 0;
_screen->clearPage(3); _screen->clearPage(3);
_seq->playSequence(_seq_MalcolmTree, true); _seq->playSequence(_seq_MalcolmTree, true);
} }
void KyraEngine::seq_introKallakWriting() { void KyraEngine::seq_introKallakWriting() {
debug(9, "KyraEngine::seq_introKallakWriting()"); debug(9, kDebugLevelMain, "KyraEngine::seq_introKallakWriting()");
_seq->makeHandShapes(); _seq->makeHandShapes();
_screen->setAnimBlockPtr(5060); _screen->setAnimBlockPtr(5060);
_screen->_charWidth = -2; _screen->_charWidth = -2;
@ -220,13 +220,13 @@ void KyraEngine::seq_introKallakWriting() {
} }
void KyraEngine::seq_introKallakMalcolm() { void KyraEngine::seq_introKallakMalcolm() {
debug(9, "KyraEngine::seq_introKallakMalcolm()"); debug(9, kDebugLevelMain, "KyraEngine::seq_introKallakMalcolm()");
_screen->clearPage(3); _screen->clearPage(3);
_seq->playSequence(_seq_KallakMalcolm, true); _seq->playSequence(_seq_KallakMalcolm, true);
} }
void KyraEngine::seq_createAmuletJewel(int jewel, int page, int noSound, int drawOnly) { void KyraEngine::seq_createAmuletJewel(int jewel, int page, int noSound, int drawOnly) {
debug(9, "seq_createAmuletJewel(%d, %d, %d, %d)", jewel, page, noSound, drawOnly); debug(9, kDebugLevelMain, "seq_createAmuletJewel(%d, %d, %d, %d)", jewel, page, noSound, drawOnly);
static const uint16 specialJewelTable[] = { static const uint16 specialJewelTable[] = {
0x167, 0x162, 0x15D, 0x158, 0x153, 0xFFFF 0x167, 0x162, 0x15D, 0x158, 0x153, 0xFFFF
}; };
@ -286,7 +286,7 @@ void KyraEngine::seq_createAmuletJewel(int jewel, int page, int noSound, int dra
} }
void KyraEngine::seq_brandonHealing() { void KyraEngine::seq_brandonHealing() {
debug(9, "seq_brandonHealing()"); debug(9, kDebugLevelMain, "seq_brandonHealing()");
if (!(_deathHandler & 8)) if (!(_deathHandler & 8))
return; return;
if (_currentCharacter->sceneId == 210) { if (_currentCharacter->sceneId == 210) {
@ -317,7 +317,7 @@ void KyraEngine::seq_brandonHealing() {
} }
void KyraEngine::seq_brandonHealing2() { void KyraEngine::seq_brandonHealing2() {
debug(9, "seq_brandonHealing2()"); debug(9, kDebugLevelMain, "seq_brandonHealing2()");
_screen->hideMouse(); _screen->hideMouse();
checkAmuletAnimFlags(); checkAmuletAnimFlags();
assert(_healingShape2Table); assert(_healingShape2Table);
@ -349,7 +349,7 @@ void KyraEngine::seq_brandonHealing2() {
} }
void KyraEngine::seq_poisonDeathNow(int now) { void KyraEngine::seq_poisonDeathNow(int now) {
debug(9, "seq_poisonDeathNow(%d)", now); debug(9, kDebugLevelMain, "seq_poisonDeathNow(%d)", now);
if (!(_brandonStatusBit & 1)) if (!(_brandonStatusBit & 1))
return; return;
++_poisonDeathCounter; ++_poisonDeathCounter;
@ -386,7 +386,7 @@ void KyraEngine::seq_poisonDeathNow(int now) {
} }
void KyraEngine::seq_poisonDeathNowAnim() { void KyraEngine::seq_poisonDeathNowAnim() {
debug(9, "seq_poisonDeathNowAnim()"); debug(9, kDebugLevelMain, "seq_poisonDeathNowAnim()");
_screen->hideMouse(); _screen->hideMouse();
checkAmuletAnimFlags(); checkAmuletAnimFlags();
assert(_posionDeathShapeTable); assert(_posionDeathShapeTable);
@ -427,7 +427,7 @@ void KyraEngine::seq_poisonDeathNowAnim() {
} }
void KyraEngine::seq_playFluteAnimation() { void KyraEngine::seq_playFluteAnimation() {
debug(9, "seq_playFluteAnimation()"); debug(9, kDebugLevelMain, "seq_playFluteAnimation()");
_screen->hideMouse(); _screen->hideMouse();
checkAmuletAnimFlags(); checkAmuletAnimFlags();
setupShapes123(_fluteAnimShapeTable, 36, 0); setupShapes123(_fluteAnimShapeTable, 36, 0);
@ -489,7 +489,7 @@ void KyraEngine::seq_playFluteAnimation() {
} }
void KyraEngine::seq_winterScroll1() { void KyraEngine::seq_winterScroll1() {
debug(9, "seq_winterScroll1()"); debug(9, kDebugLevelMain, "seq_winterScroll1()");
_screen->hideMouse(); _screen->hideMouse();
checkAmuletAnimFlags(); checkAmuletAnimFlags();
assert(_winterScrollTable); assert(_winterScrollTable);
@ -570,7 +570,7 @@ void KyraEngine::seq_winterScroll1() {
} }
void KyraEngine::seq_winterScroll2() { void KyraEngine::seq_winterScroll2() {
debug(9, "seq_winterScroll2()"); debug(9, kDebugLevelMain, "seq_winterScroll2()");
_screen->hideMouse(); _screen->hideMouse();
checkAmuletAnimFlags(); checkAmuletAnimFlags();
assert(_winterScrollTable); assert(_winterScrollTable);
@ -599,7 +599,7 @@ void KyraEngine::seq_winterScroll2() {
} }
void KyraEngine::seq_makeBrandonInv() { void KyraEngine::seq_makeBrandonInv() {
debug(9, "seq_makeBrandonInv()"); debug(9, kDebugLevelMain, "seq_makeBrandonInv()");
if (_deathHandler == 8) if (_deathHandler == 8)
return; return;
@ -625,7 +625,7 @@ void KyraEngine::seq_makeBrandonInv() {
} }
void KyraEngine::seq_makeBrandonNormal() { void KyraEngine::seq_makeBrandonNormal() {
debug(9, "seq_makeBrandonNormal()"); debug(9, kDebugLevelMain, "seq_makeBrandonNormal()");
_screen->hideMouse(); _screen->hideMouse();
_brandonStatusBit |= 0x40; _brandonStatusBit |= 0x40;
snd_playSoundEffect(0x77); snd_playSoundEffect(0x77);
@ -641,7 +641,7 @@ void KyraEngine::seq_makeBrandonNormal() {
} }
void KyraEngine::seq_makeBrandonNormal2() { void KyraEngine::seq_makeBrandonNormal2() {
debug(9, "seq_makeBrandonNormal2()"); debug(9, kDebugLevelMain, "seq_makeBrandonNormal2()");
_screen->hideMouse(); _screen->hideMouse();
assert(_brandonToWispTable); assert(_brandonToWispTable);
setupShapes123(_brandonToWispTable, 26, 0); setupShapes123(_brandonToWispTable, 26, 0);
@ -666,7 +666,7 @@ void KyraEngine::seq_makeBrandonNormal2() {
} }
void KyraEngine::seq_makeBrandonWisp() { void KyraEngine::seq_makeBrandonWisp() {
debug(9, "seq_makeBrandonWisp()"); debug(9, kDebugLevelMain, "seq_makeBrandonWisp()");
if (_deathHandler == 8) if (_deathHandler == 8)
return; return;
@ -706,7 +706,7 @@ void KyraEngine::seq_makeBrandonWisp() {
} }
void KyraEngine::seq_dispelMagicAnimation() { void KyraEngine::seq_dispelMagicAnimation() {
debug(9, "seq_dispelMagicAnimation()"); debug(9, kDebugLevelMain, "seq_dispelMagicAnimation()");
if (_deathHandler == 8) if (_deathHandler == 8)
return; return;
if (_currentCharacter->sceneId == 210) { if (_currentCharacter->sceneId == 210) {
@ -748,7 +748,7 @@ void KyraEngine::seq_dispelMagicAnimation() {
} }
void KyraEngine::seq_fillFlaskWithWater(int item, int type) { void KyraEngine::seq_fillFlaskWithWater(int item, int type) {
debug(9, "seq_fillFlaskWithWater(%d, %d)", item, type); debug(9, kDebugLevelMain, "seq_fillFlaskWithWater(%d, %d)", item, type);
int newItem = -1; int newItem = -1;
static const uint8 flaskTable1[] = { 0x46, 0x48, 0x4A, 0x4C }; static const uint8 flaskTable1[] = { 0x46, 0x48, 0x4A, 0x4C };
static const uint8 flaskTable2[] = { 0x47, 0x49, 0x4B, 0x4D }; static const uint8 flaskTable2[] = { 0x47, 0x49, 0x4B, 0x4D };
@ -789,7 +789,7 @@ void KyraEngine::seq_fillFlaskWithWater(int item, int type) {
} }
void KyraEngine::seq_playDrinkPotionAnim(int unk1, int unk2, int flags) { void KyraEngine::seq_playDrinkPotionAnim(int unk1, int unk2, int flags) {
debug(9, "KyraEngine::seq_playDrinkPotionAnim(%d, %d, %d)", unk1, unk2, flags); debug(9, kDebugLevelMain, "KyraEngine::seq_playDrinkPotionAnim(%d, %d, %d)", unk1, unk2, flags);
// XXX // XXX
_screen->hideMouse(); _screen->hideMouse();
checkAmuletAnimFlags(); checkAmuletAnimFlags();
@ -832,7 +832,7 @@ void KyraEngine::seq_playDrinkPotionAnim(int unk1, int unk2, int flags) {
} }
int KyraEngine::seq_playEnd() { int KyraEngine::seq_playEnd() {
debug(9, "KyraEngine::seq_playEnd()"); debug(9, kDebugLevelMain, "KyraEngine::seq_playEnd()");
if (_endSequenceSkipFlag) { if (_endSequenceSkipFlag) {
return 0; return 0;
} }
@ -917,7 +917,7 @@ int KyraEngine::seq_playEnd() {
} }
void KyraEngine::seq_brandonToStone() { void KyraEngine::seq_brandonToStone() {
debug(9, "KyraEngine::seq_brandonToStone()"); debug(9, kDebugLevelMain, "KyraEngine::seq_brandonToStone()");
_screen->hideMouse(); _screen->hideMouse();
assert(_brandonStoneTable); assert(_brandonStoneTable);
setupShapes123(_brandonStoneTable, 14, 0); setupShapes123(_brandonStoneTable, 14, 0);
@ -933,7 +933,7 @@ void KyraEngine::seq_brandonToStone() {
} }
void KyraEngine::seq_playEnding() { void KyraEngine::seq_playEnding() {
debug(9, "KyraEngine::seq_playEnding()"); debug(9, kDebugLevelMain, "KyraEngine::seq_playEnding()");
_screen->hideMouse(); _screen->hideMouse();
res_unloadResources(RES_INGAME); res_unloadResources(RES_INGAME);
res_loadResources(RES_OUTRO); res_loadResources(RES_OUTRO);
@ -952,7 +952,7 @@ void KyraEngine::seq_playEnding() {
} }
void KyraEngine::seq_playCredits() { void KyraEngine::seq_playCredits() {
debug(9, "KyraEngine::seq_playCredits()"); debug(9, kDebugLevelMain, "KyraEngine::seq_playCredits()");
static const uint8 colorMap[] = { 0, 0, 0xC, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static const uint8 colorMap[] = { 0, 0, 0xC, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
_screen->hideMouse(); _screen->hideMouse();
uint32 sz = 0; uint32 sz = 0;
@ -978,12 +978,12 @@ void KyraEngine::seq_playCredits() {
} }
bool KyraEngine::seq_skipSequence() const { bool KyraEngine::seq_skipSequence() const {
debug(9, "KyraEngine::seq_skipSequence()"); debug(9, kDebugLevelMain, "KyraEngine::seq_skipSequence()");
return _quitFlag || _abortIntroFlag; return _quitFlag || _abortIntroFlag;
} }
int KyraEngine::handleMalcolmFlag() { int KyraEngine::handleMalcolmFlag() {
debug(9, "KyraEngine::handleMalcolmFlag()"); debug(9, kDebugLevelMain, "KyraEngine::handleMalcolmFlag()");
static uint16 frame = 0; static uint16 frame = 0;
static uint32 timer1 = 0; static uint32 timer1 = 0;
static uint32 timer2 = 0; static uint32 timer2 = 0;
@ -1150,7 +1150,7 @@ int KyraEngine::handleMalcolmFlag() {
} }
int KyraEngine::handleBeadState() { int KyraEngine::handleBeadState() {
debug(9, "KyraEngine::handleBeadState()"); debug(9, kDebugLevelMain, "KyraEngine::handleBeadState()");
static uint32 timer1 = 0; static uint32 timer1 = 0;
static uint32 timer2 = 0; static uint32 timer2 = 0;
static BeadState beadState1 = { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; static BeadState beadState1 = { -1, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
@ -1366,7 +1366,7 @@ int KyraEngine::handleBeadState() {
} }
void KyraEngine::initBeadState(int x, int y, int x2, int y2, int unk, BeadState *ptr) { void KyraEngine::initBeadState(int x, int y, int x2, int y2, int unk, BeadState *ptr) {
debug(9, "KyraEngine::initBeadState(%d, %d, %d, %d, %d, 0x%X)", x, y, x2, y2, unk, ptr); debug(9, kDebugLevelMain, "KyraEngine::initBeadState(%d, %d, %d, %d, %d, 0x%X)", x, y, x2, y2, unk, ptr);
ptr->unk9 = unk; ptr->unk9 = unk;
int xDiff = x2 - x; int xDiff = x2 - x;
int yDiff = y2 - y; int yDiff = y2 - y;
@ -1401,7 +1401,7 @@ void KyraEngine::initBeadState(int x, int y, int x2, int y2, int unk, BeadState
} }
int KyraEngine::processBead(int x, int y, int &x2, int &y2, BeadState *ptr) { int KyraEngine::processBead(int x, int y, int &x2, int &y2, BeadState *ptr) {
debug(9, "KyraEngine::processBead(%d, %d, 0x%X, 0x%X, 0x%X)", x, y, &x2, &y2, ptr); debug(9, kDebugLevelMain, "KyraEngine::processBead(%d, %d, 0x%X, 0x%X, 0x%X)", x, y, &x2, &y2, ptr);
if (x == ptr->dstX && y == ptr->dstY) { if (x == ptr->dstX && y == ptr->dstY) {
return 1; return 1;
} }
@ -1441,7 +1441,7 @@ int KyraEngine::processBead(int x, int y, int &x2, int &y2, BeadState *ptr) {
} }
void KyraEngine::setupPanPages() { void KyraEngine::setupPanPages() {
debug(9, "KyraEngine::setupPanPages()"); debug(9, kDebugLevelMain, "KyraEngine::setupPanPages()");
loadBitmap("bead.cps", 3, 3, 0); loadBitmap("bead.cps", 3, 3, 0);
for (int i = 0; i <= 19; ++i) { for (int i = 0; i <= 19; ++i) {
_panPagesTable[i] = _seq->setPanPages(3, i); _panPagesTable[i] = _seq->setPanPages(3, i);
@ -1449,7 +1449,7 @@ void KyraEngine::setupPanPages() {
} }
void KyraEngine::freePanPages() { void KyraEngine::freePanPages() {
debug(9, "KyraEngine::freePanPages()"); debug(9, kDebugLevelMain, "KyraEngine::freePanPages()");
delete _endSequenceBackUpRect; delete _endSequenceBackUpRect;
_endSequenceBackUpRect = 0; _endSequenceBackUpRect = 0;
for (int i = 0; i <= 19; ++i) { for (int i = 0; i <= 19; ++i) {
@ -1459,7 +1459,7 @@ void KyraEngine::freePanPages() {
} }
void KyraEngine::closeFinalWsa() { void KyraEngine::closeFinalWsa() {
debug(9, "KyraEngine::closeFinalWsa()"); debug(9, kDebugLevelMain, "KyraEngine::closeFinalWsa()");
delete _finalA; delete _finalA;
_finalA = 0; _finalA = 0;
delete _finalB; delete _finalB;
@ -1541,7 +1541,7 @@ void KyraEngine::updateKyragemFading() {
} }
void KyraEngine::drawJewelPress(int jewel, int drawSpecial) { void KyraEngine::drawJewelPress(int jewel, int drawSpecial) {
debug(9, "KyraEngine::drawJewelPress(%d, %d)", jewel, drawSpecial); debug(9, kDebugLevelMain, "KyraEngine::drawJewelPress(%d, %d)", jewel, drawSpecial);
_screen->hideMouse(); _screen->hideMouse();
int shape = 0; int shape = 0;
if (drawSpecial) { if (drawSpecial) {
@ -1564,7 +1564,7 @@ void KyraEngine::drawJewelPress(int jewel, int drawSpecial) {
} }
void KyraEngine::drawJewelsFadeOutStart() { void KyraEngine::drawJewelsFadeOutStart() {
debug(9, "KyraEngine::drawJewelsFadeOutStart()"); debug(9, kDebugLevelMain, "KyraEngine::drawJewelsFadeOutStart()");
static const uint16 jewelTable1[] = { 0x164, 0x15F, 0x15A, 0x155, 0x150, 0xFFFF }; static const uint16 jewelTable1[] = { 0x164, 0x15F, 0x15A, 0x155, 0x150, 0xFFFF };
static const uint16 jewelTable2[] = { 0x163, 0x15E, 0x159, 0x154, 0x14F, 0xFFFF }; static const uint16 jewelTable2[] = { 0x163, 0x15E, 0x159, 0x154, 0x14F, 0xFFFF };
static const uint16 jewelTable3[] = { 0x166, 0x160, 0x15C, 0x157, 0x152, 0xFFFF }; static const uint16 jewelTable3[] = { 0x166, 0x160, 0x15C, 0x157, 0x152, 0xFFFF };
@ -1588,7 +1588,7 @@ void KyraEngine::drawJewelsFadeOutStart() {
} }
void KyraEngine::drawJewelsFadeOutEnd(int jewel) { void KyraEngine::drawJewelsFadeOutEnd(int jewel) {
debug(9, "KyraEngine::drawJewelsFadeOutEnd(%d)", jewel); debug(9, kDebugLevelMain, "KyraEngine::drawJewelsFadeOutEnd(%d)", jewel);
static const uint16 jewelTable[] = { 0x153, 0x158, 0x15D, 0x162, 0x148, 0xFFFF }; static const uint16 jewelTable[] = { 0x153, 0x158, 0x15D, 0x162, 0x148, 0xFFFF };
int newDelay = 0; int newDelay = 0;
switch (jewel-1) { switch (jewel-1) {

View file

@ -376,7 +376,7 @@ bool SoundPC::voiceIsPlaying() {
} }
void KyraEngine::snd_playTheme(int file, int track) { void KyraEngine::snd_playTheme(int file, int track) {
debug(9, "KyraEngine::snd_playTheme(%d)", file); debug(9, kDebugLevelMain, "KyraEngine::snd_playTheme(%d)", file);
assert(file < _xmidiFilesCount); assert(file < _xmidiFilesCount);
_curMusicTheme = _newMusicTheme = file; _curMusicTheme = _newMusicTheme = file;
_sound->playMusic(_xmidiFiles[file]); _sound->playMusic(_xmidiFiles[file]);
@ -384,13 +384,13 @@ void KyraEngine::snd_playTheme(int file, int track) {
} }
void KyraEngine::snd_setSoundEffectFile(int file) { void KyraEngine::snd_setSoundEffectFile(int file) {
debug(9, "KyraEngine::snd_setSoundEffectFile(%d)", file); debug(9, kDebugLevelMain, "KyraEngine::snd_setSoundEffectFile(%d)", file);
assert(file < _xmidiFilesCount); assert(file < _xmidiFilesCount);
_sound->loadSoundEffectFile(_xmidiFiles[file]); _sound->loadSoundEffectFile(_xmidiFiles[file]);
} }
void KyraEngine::snd_playSoundEffect(int track) { void KyraEngine::snd_playSoundEffect(int track) {
debug(9, "KyraEngine::snd_playSoundEffect(%d)", track); debug(9, kDebugLevelMain, "KyraEngine::snd_playSoundEffect(%d)", track);
if (track == 49) { if (track == 49) {
snd_playWanderScoreViaMap(56, 1); snd_playWanderScoreViaMap(56, 1);
} else { } else {
@ -399,7 +399,7 @@ void KyraEngine::snd_playSoundEffect(int track) {
} }
void KyraEngine::snd_playWanderScoreViaMap(int command, int restart) { void KyraEngine::snd_playWanderScoreViaMap(int command, int restart) {
debug(9, "KyraEngine::snd_playWanderScoreViaMap(%d, %d)", command, restart); debug(9, kDebugLevelMain, "KyraEngine::snd_playWanderScoreViaMap(%d, %d)", command, restart);
static const int8 soundTable[] = { static const int8 soundTable[] = {
-1, 0, -1, 1, 0, 3, 0, 2, -1, 0, -1, 1, 0, 3, 0, 2,
0, 4, 1, 2, 1, 3, 1, 4, 0, 4, 1, 2, 1, 3, 1, 4,
@ -441,7 +441,7 @@ void KyraEngine::snd_playWanderScoreViaMap(int command, int restart) {
} }
void KyraEngine::snd_playVoiceFile(int id) { void KyraEngine::snd_playVoiceFile(int id) {
debug(9, "KyraEngine::snd_playVoiceFile(%d)", id); debug(9, kDebugLevelMain, "KyraEngine::snd_playVoiceFile(%d)", id);
char vocFile[9]; char vocFile[9];
assert(id >= 0 && id < 9999); assert(id >= 0 && id < 9999);
sprintf(vocFile, "%03d", id); sprintf(vocFile, "%03d", id);
@ -449,7 +449,7 @@ void KyraEngine::snd_playVoiceFile(int id) {
} }
void KyraEngine::snd_voiceWaitForFinish(bool ingame) { void KyraEngine::snd_voiceWaitForFinish(bool ingame) {
debug(9, "KyraEngine::snd_voiceWaitForFinish(%d)", ingame); debug(9, kDebugLevelMain, "KyraEngine::snd_voiceWaitForFinish(%d)", ingame);
while (_sound->voiceIsPlaying() && !_skipFlag) { while (_sound->voiceIsPlaying() && !_skipFlag) {
if (ingame) { if (ingame) {
delay(10, true); delay(10, true);

View file

@ -56,7 +56,7 @@ Sprites::~Sprites() {
} }
void Sprites::setupSceneAnims() { void Sprites::setupSceneAnims() {
debug(9, "Sprites::setupSceneAnims()"); debug(9, kDebugLevelSprites, "Sprites::setupSceneAnims()");
uint8 *data; uint8 *data;
for (int i = 0; i < MAX_NUM_ANIMS; i++) { for (int i = 0; i < MAX_NUM_ANIMS; i++) {
@ -126,7 +126,7 @@ void Sprites::setupSceneAnims() {
} }
void Sprites::updateSceneAnims() { void Sprites::updateSceneAnims() {
debug(9, "Sprites::updateSceneAnims()"); debug(9, kDebugLevelSprites, "Sprites::updateSceneAnims()");
uint32 currTime = _system->getMillis(); uint32 currTime = _system->getMillis();
uint8 *data; uint8 *data;
bool endLoop; bool endLoop;
@ -153,16 +153,16 @@ void Sprites::updateSceneAnims() {
switch (READ_LE_UINT16(data)) { switch (READ_LE_UINT16(data)) {
case 0xFF88: case 0xFF88:
data += 2; data += 2;
debug(6, "func: Set sprite image."); debug(6, kDebugLevelSprites, "func: Set sprite image.");
debug(6, "Sprite index %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Sprite index %i", READ_LE_UINT16(data));
_anims[i].sprite = READ_LE_UINT16(data); _anims[i].sprite = READ_LE_UINT16(data);
data += 2; data += 2;
//debug(6, "Unused %i", READ_LE_UINT16(data)); //debug(6, kDebugLevelSprites, "Unused %i", READ_LE_UINT16(data));
data += 2; data += 2;
debug(6, "X %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "X %i", READ_LE_UINT16(data));
_anims[i].x = READ_LE_UINT16(data); _anims[i].x = READ_LE_UINT16(data);
data += 2; data += 2;
debug(6, "Y %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Y %i", READ_LE_UINT16(data));
_anims[i].y = READ_LE_UINT16(data); _anims[i].y = READ_LE_UINT16(data);
data += 2; data += 2;
_anims[i].flipX = false; _anims[i].flipX = false;
@ -170,16 +170,16 @@ void Sprites::updateSceneAnims() {
break; break;
case 0xFF8D: case 0xFF8D:
data += 2; data += 2;
debug(6, "func: Set sprite image, flipped."); debug(6, kDebugLevelSprites, "func: Set sprite image, flipped.");
debug(6, "Sprite index %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Sprite index %i", READ_LE_UINT16(data));
_anims[i].sprite = READ_LE_UINT16(data); _anims[i].sprite = READ_LE_UINT16(data);
data += 2; data += 2;
//debug(9, "Unused %i", READ_LE_UINT16(data)); //debug(9, kDebugLevelSprites, "Unused %i", READ_LE_UINT16(data));
data += 2; data += 2;
debug(6, "X %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "X %i", READ_LE_UINT16(data));
_anims[i].x = READ_LE_UINT16(data); _anims[i].x = READ_LE_UINT16(data);
data += 2; data += 2;
debug(6, "Y %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Y %i", READ_LE_UINT16(data));
_anims[i].y = READ_LE_UINT16(data); _anims[i].y = READ_LE_UINT16(data);
data += 2; data += 2;
_anims[i].flipX = true; _anims[i].flipX = true;
@ -187,69 +187,69 @@ void Sprites::updateSceneAnims() {
break; break;
case 0xFF8A: case 0xFF8A:
data += 2; data += 2;
debug(6, "func: Set time to wait"); debug(6, kDebugLevelSprites, "func: Set time to wait");
debug(6, "Time %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Time %i", READ_LE_UINT16(data));
_anims[i].nextRun = _system->getMillis() + READ_LE_UINT16(data) * _animDelay; _anims[i].nextRun = _system->getMillis() + READ_LE_UINT16(data) * _animDelay;
data += 2; data += 2;
break; break;
case 0xFFB3: case 0xFFB3:
data += 2; data += 2;
debug(6, "func: Set time to wait to random value"); debug(6, kDebugLevelSprites, "func: Set time to wait to random value");
rndNr = READ_LE_UINT16(data) + _rnd.getRandomNumber( READ_LE_UINT16(data) + 2); rndNr = READ_LE_UINT16(data) + _rnd.getRandomNumber( READ_LE_UINT16(data) + 2);
debug(6, "Minimum time %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Minimum time %i", READ_LE_UINT16(data));
data += 2; data += 2;
debug(6, "Maximum time %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Maximum time %i", READ_LE_UINT16(data));
data += 2; data += 2;
_anims[i].nextRun = _system->getMillis() + rndNr * _animDelay; _anims[i].nextRun = _system->getMillis() + rndNr * _animDelay;
break; break;
case 0xFF8C: case 0xFF8C:
data += 2; data += 2;
debug(6, "func: Wait until wait time has elapsed"); debug(6, kDebugLevelSprites, "func: Wait until wait time has elapsed");
_anims[i].reentry = data; _anims[i].reentry = data;
endLoop = true; endLoop = true;
//assert( _anims[i].nextRun > _system->getMillis()); //assert( _anims[i].nextRun > _system->getMillis());
break; break;
case 0xFF99: case 0xFF99:
data += 2; data += 2;
debug(1, "func: Set value of unknown animation property to 1"); debug(1, kDebugLevelSprites, "func: Set value of unknown animation property to 1");
_anims[i].unk1 = 1; _anims[i].unk1 = 1;
break; break;
case 0xFF9A: case 0xFF9A:
data += 2; data += 2;
debug(1, "func: Set value of unknown animation property to 0"); debug(1, kDebugLevelSprites, "func: Set value of unknown animation property to 0");
_anims[i].unk1 = 0; _anims[i].unk1 = 0;
break; break;
case 0xFF97: case 0xFF97:
data += 2; data += 2;
debug(6, "func: Set default X coordinate of sprite"); debug(6, kDebugLevelSprites, "func: Set default X coordinate of sprite");
debug(6, "X %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "X %i", READ_LE_UINT16(data));
_anims[i].x = READ_LE_UINT16(data); _anims[i].x = READ_LE_UINT16(data);
data += 2; data += 2;
break; break;
case 0xFF98: case 0xFF98:
data += 2; data += 2;
debug(6, "func: Set default Y coordinate of sprite"); debug(6, kDebugLevelSprites, "func: Set default Y coordinate of sprite");
debug(6, "Y %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Y %i", READ_LE_UINT16(data));
_anims[i].y = READ_LE_UINT16(data); _anims[i].y = READ_LE_UINT16(data);
data += 2; data += 2;
break; break;
case 0xFF8B: case 0xFF8B:
debug(6, "func: Jump to start of script section"); debug(6, kDebugLevelSprites, "func: Jump to start of script section");
//data = scriptStart; //data = scriptStart;
_anims[i].nextRun = _system->getMillis(); _anims[i].nextRun = _system->getMillis();
endLoop = true; endLoop = true;
break; break;
case 0xFF8E: case 0xFF8E:
data += 2; data += 2;
debug(6, "func: Begin for () loop"); debug(6, kDebugLevelSprites, "func: Begin for () loop");
debug(6, "Iterations: %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Iterations: %i", READ_LE_UINT16(data));
_anims[i].loopsLeft = READ_LE_UINT16(data); _anims[i].loopsLeft = READ_LE_UINT16(data);
data += 2; data += 2;
_anims[i].loopStart = data; _anims[i].loopStart = data;
break; break;
case 0xFF8F: case 0xFF8F:
data += 2; data += 2;
debug(6, "func: End for () loop"); debug(6, kDebugLevelSprites, "func: End for () loop");
if (_anims[i].loopsLeft > 0) { if (_anims[i].loopsLeft > 0) {
_anims[i].loopsLeft--; _anims[i].loopsLeft--;
data = _anims[i].loopStart; data = _anims[i].loopStart;
@ -257,8 +257,8 @@ void Sprites::updateSceneAnims() {
break; break;
case 0xFF90: case 0xFF90:
data += 2; data += 2;
debug(6, "func: Set sprite image using default X and Y"); debug(6, kDebugLevelSprites, "func: Set sprite image using default X and Y");
debug(6, "Sprite index %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Sprite index %i", READ_LE_UINT16(data));
_anims[i].sprite = READ_LE_UINT16(data); _anims[i].sprite = READ_LE_UINT16(data);
_anims[i].flipX = false; _anims[i].flipX = false;
data += 2; data += 2;
@ -266,8 +266,8 @@ void Sprites::updateSceneAnims() {
break; break;
case 0xFF91: case 0xFF91:
data += 2; data += 2;
debug(6, "func: Set sprite image using default X and Y, flipped."); debug(6, kDebugLevelSprites, "func: Set sprite image using default X and Y, flipped.");
debug(6, "Sprite index %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Sprite index %i", READ_LE_UINT16(data));
_anims[i].sprite = READ_LE_UINT16(data); _anims[i].sprite = READ_LE_UINT16(data);
_anims[i].flipX = true; _anims[i].flipX = true;
data += 2; data += 2;
@ -275,36 +275,36 @@ void Sprites::updateSceneAnims() {
break; break;
case 0xFF92: case 0xFF92:
data += 2; data += 2;
debug(6, "func: Increase value of default X-coordinate"); debug(6, kDebugLevelSprites, "func: Increase value of default X-coordinate");
debug(6, "Increment %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Increment %i", READ_LE_UINT16(data));
_anims[i].x += READ_LE_UINT16(data); _anims[i].x += READ_LE_UINT16(data);
data += 2; data += 2;
break; break;
case 0xFF93: case 0xFF93:
data += 2; data += 2;
debug(6, "func: Increase value of default Y-coordinate"); debug(6, kDebugLevelSprites, "func: Increase value of default Y-coordinate");
debug(6, "Increment %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Increment %i", READ_LE_UINT16(data));
_anims[i].y += READ_LE_UINT16(data); _anims[i].y += READ_LE_UINT16(data);
data += 2; data += 2;
break; break;
case 0xFF94: case 0xFF94:
data += 2; data += 2;
debug(6, "func: Decrease value of default X-coordinate"); debug(6, kDebugLevelSprites, "func: Decrease value of default X-coordinate");
debug(6, "Decrement %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Decrement %i", READ_LE_UINT16(data));
_anims[i].x -= READ_LE_UINT16(data); _anims[i].x -= READ_LE_UINT16(data);
data += 2; data += 2;
break; break;
case 0xFF95: case 0xFF95:
data += 2; data += 2;
debug(6, "func: Decrease value of default Y-coordinate"); debug(6, kDebugLevelSprites, "func: Decrease value of default Y-coordinate");
debug(6, "Decrement %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Decrement %i", READ_LE_UINT16(data));
_anims[i].y -= READ_LE_UINT16(data); _anims[i].y -= READ_LE_UINT16(data);
data += 2; data += 2;
break; break;
case 0xFF96: case 0xFF96:
data += 2; data += 2;
debug(9, "func: Stop animation"); debug(9, kDebugLevelSprites, "func: Stop animation");
debug(9, "Animation index %i", READ_LE_UINT16(data)); debug(9, kDebugLevelSprites, "Animation index %i", READ_LE_UINT16(data));
anim = READ_LE_UINT16(data); anim = READ_LE_UINT16(data);
data += 2; data += 2;
_anims[anim].play = false; _anims[anim].play = false;
@ -312,44 +312,44 @@ void Sprites::updateSceneAnims() {
break; break;
/* case 0xFF97: /* case 0xFF97:
data += 2; data += 2;
debug(1, "func: Set value of animation property 34h to 0"); debug(1, kDebugLevelSprites, "func: Set value of animation property 34h to 0");
break;*/ break;*/
case 0xFFAD: case 0xFFAD:
data += 2; data += 2;
debug(6, "func: Set Brandon's X coordinate"); debug(6, kDebugLevelSprites, "func: Set Brandon's X coordinate");
debug(6, "X %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "X %i", READ_LE_UINT16(data));
_engine->currentCharacter()->x1 = READ_LE_UINT16(data); _engine->currentCharacter()->x1 = READ_LE_UINT16(data);
data += 2; data += 2;
break; break;
case 0xFFAE: case 0xFFAE:
data += 2; data += 2;
debug(6, "func: Set Brandon's Y coordinate"); debug(6, kDebugLevelSprites, "func: Set Brandon's Y coordinate");
debug(6, "Y %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Y %i", READ_LE_UINT16(data));
_engine->currentCharacter()->y1 = READ_LE_UINT16(data); _engine->currentCharacter()->y1 = READ_LE_UINT16(data);
data += 2; data += 2;
break; break;
case 0xFFAF: case 0xFFAF:
data += 2; data += 2;
debug(6, "func: Set Brandon's sprite"); debug(6, kDebugLevelSprites, "func: Set Brandon's sprite");
debug(6, "Sprite %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Sprite %i", READ_LE_UINT16(data));
_engine->currentCharacter()->currentAnimFrame = READ_LE_UINT16(data); _engine->currentCharacter()->currentAnimFrame = READ_LE_UINT16(data);
data += 2; data += 2;
break; break;
case 0xFFAA: case 0xFFAA:
data += 2; data += 2;
debug(1, "TODO func: Reset Brandon's sprite"); debug(1, kDebugLevelSprites, "TODO func: Reset Brandon's sprite");
break; break;
case 0xFFAB: case 0xFFAB:
data += 2; data += 2;
debug(6, "func: Update Brandon's sprite"); debug(6, kDebugLevelSprites, "func: Update Brandon's sprite");
_engine->animator()->animRefreshNPC(0); _engine->animator()->animRefreshNPC(0);
_engine->animator()->flagAllObjectsForRefresh(); _engine->animator()->flagAllObjectsForRefresh();
_engine->animator()->updateAllObjectShapes(); _engine->animator()->updateAllObjectShapes();
break; break;
case 0xFFB0: case 0xFFB0:
data += 2; data += 2;
debug(6, "func: Play sound"); debug(6, kDebugLevelSprites, "func: Play sound");
debug(6, "Sound index %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Sound index %i", READ_LE_UINT16(data));
_engine->snd_playSoundEffect(READ_LE_UINT16(data)); _engine->snd_playSoundEffect(READ_LE_UINT16(data));
data += 2; data += 2;
break; break;
@ -363,11 +363,11 @@ void Sprites::updateSceneAnims() {
break; break;
case 0xFFB4: case 0xFFB4:
data += 2; data += 2;
debug(6, "func: Play (at random) a certain sound at a certain percentage of time"); debug(6, kDebugLevelSprites, "func: Play (at random) a certain sound at a certain percentage of time");
debug(6, "Sound index %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Sound index %i", READ_LE_UINT16(data));
sound = READ_LE_UINT16(data); sound = READ_LE_UINT16(data);
data += 2; data += 2;
debug(6, "Percentage %i", READ_LE_UINT16(data)); debug(6, kDebugLevelSprites, "Percentage %i", READ_LE_UINT16(data));
rndNr = _rnd.getRandomNumber(100); rndNr = _rnd.getRandomNumber(100);
if (rndNr <= READ_LE_UINT16(data)) if (rndNr <= READ_LE_UINT16(data))
_engine->snd_playSoundEffect(sound); _engine->snd_playSoundEffect(sound);
@ -379,7 +379,7 @@ void Sprites::updateSceneAnims() {
data += 2; data += 2;
break; break;
default: default:
debug(1, "Unsupported anim command %X in script %i", READ_LE_UINT16(data), i); debug(1, kDebugLevelSprites, "Unsupported anim command %X in script %i", READ_LE_UINT16(data), i);
//endLoop = true; //endLoop = true;
data += 1; data += 1;
break; break;
@ -392,7 +392,7 @@ void Sprites::updateSceneAnims() {
} }
void Sprites::loadDAT(const char *filename, SceneExits &exits) { void Sprites::loadDAT(const char *filename, SceneExits &exits) {
debug(9, "Sprites::loadDat('%s')", filename); debug(9, kDebugLevelSprites, "Sprites::loadDat('%s')", filename);
uint32 fileSize; uint32 fileSize;
delete[] _dat; delete[] _dat;
@ -426,7 +426,7 @@ void Sprites::loadDAT(const char *filename, SceneExits &exits) {
break; break;
if (READ_LE_UINT16(data) == 0xFF83) { if (READ_LE_UINT16(data) == 0xFF83) {
//debug(1, "Body section end."); //debug(1, kDebugLevelSprites, "Body section end.");
data += 2; data += 2;
break; break;
} }
@ -434,11 +434,11 @@ void Sprites::loadDAT(const char *filename, SceneExits &exits) {
switch (READ_LE_UINT16(data)) { switch (READ_LE_UINT16(data)) {
case 0xFF81: case 0xFF81:
data += 2; data += 2;
//debug(1, "Body section start"); //debug(1, kDebugLevelSprites, "Body section start");
break; break;
case 0xFF82: case 0xFF82:
data += 2; data += 2;
//debug(1, "Unknown 0xFF82 section"); //debug(1, kDebugLevelSprites, "Unknown 0xFF82 section");
break; break;
case 0xFF84: case 0xFF84:
data += 2; data += 2;
@ -460,12 +460,12 @@ void Sprites::loadDAT(const char *filename, SceneExits &exits) {
data += 2; data += 2;
} }
_anims[nextAnim].length = data - animstart; _anims[nextAnim].length = data - animstart;
//debug(1, "Found an anim script of length %i!", _anims[nextAnim].length); //debug(1, kDebugLevelSprites, "Found an anim script of length %i!", _anims[nextAnim].length);
nextAnim++; nextAnim++;
data += 2; data += 2;
break; break;
default: default:
debug(1, "Unknown code in DAT file: %x", READ_LE_UINT16(data)); debug(1, kDebugLevelSprites, "Unknown code in DAT file: %x", READ_LE_UINT16(data));
data += 2; data += 2;
break; break;
} }
@ -487,7 +487,7 @@ void Sprites::loadDAT(const char *filename, SceneExits &exits) {
} }
void Sprites::freeSceneShapes() { void Sprites::freeSceneShapes() {
debug(9, "Sprites::freeSceneShapes()"); debug(9, kDebugLevelSprites, "Sprites::freeSceneShapes()");
for (int i = 0; i < ARRAYSIZE(_sceneShapes); i++ ) { for (int i = 0; i < ARRAYSIZE(_sceneShapes); i++ ) {
free(_sceneShapes[i]); free(_sceneShapes[i]);
_sceneShapes[i] = 0; _sceneShapes[i] = 0;
@ -495,7 +495,7 @@ void Sprites::freeSceneShapes() {
} }
void Sprites::loadSceneShapes() { void Sprites::loadSceneShapes() {
debug(9, "Sprites::loadSceneShapes()"); debug(9, kDebugLevelSprites, "Sprites::loadSceneShapes()");
uint8 *data = _spriteDefStart; uint8 *data = _spriteDefStart;
int spriteNum, x, y, width, height; int spriteNum, x, y, width, height;
@ -521,13 +521,13 @@ void Sprites::loadSceneShapes() {
height = READ_LE_UINT16(data); height = READ_LE_UINT16(data);
data += 2; data += 2;
_sceneShapes[spriteNum] = _screen->encodeShape(x, y, width, height, 2); _sceneShapes[spriteNum] = _screen->encodeShape(x, y, width, height, 2);
debug(9, "Sprite %i is at (%i, %i), width %i, height %i", spriteNum, x, y, width, height); debug(9, kDebugLevelSprites, "Sprite %i is at (%i, %i), width %i, height %i", spriteNum, x, y, width, height);
} }
_screen->_curPage = bakPage; _screen->_curPage = bakPage;
} }
void Sprites::refreshSceneAnimObject(uint8 animNum, uint8 shapeNum, uint16 x, uint16 y, bool flipX, bool unkFlag) { void Sprites::refreshSceneAnimObject(uint8 animNum, uint8 shapeNum, uint16 x, uint16 y, bool flipX, bool unkFlag) {
debug(9, "Sprites::refreshSceneAnimObject(%i, %i, %i, %i, %i, %i", animNum, shapeNum, x, y, flipX, unkFlag); debug(9, kDebugLevelSprites, "Sprites::refreshSceneAnimObject(%i, %i, %i, %i, %i, %i", animNum, shapeNum, x, y, flipX, unkFlag);
AnimObject &anim = _engine->animator()->sprites()[animNum]; AnimObject &anim = _engine->animator()->sprites()[animNum];
anim.refreshFlag = 1; anim.refreshFlag = 1;
anim.bkgdChangeFlag = 1; anim.bkgdChangeFlag = 1;
@ -549,7 +549,7 @@ void Sprites::refreshSceneAnimObject(uint8 animNum, uint8 shapeNum, uint16 x, ui
} }
int Sprites::getDrawLayer(int y) { int Sprites::getDrawLayer(int y) {
debug(9, "getDrawLayer(%d)", y); debug(9, kDebugLevelSprites, "getDrawLayer(%d)", y);
uint8 returnValue = 0; uint8 returnValue = 0;
for (int i = 0; i < ARRAYSIZE(_drawLayerTable); ++i) { for (int i = 0; i < ARRAYSIZE(_drawLayerTable); ++i) {
uint8 temp = _drawLayerTable[i]; uint8 temp = _drawLayerTable[i];

View file

@ -54,7 +54,7 @@ static LanguageTypes languages[] = {
}; };
void KyraEngine::res_loadResources(int type) { void KyraEngine::res_loadResources(int type) {
debug(9, "res_loadResources(%d)", type); debug(9, kDebugLevelMain, "KyraEngine::res_loadResources(%d)", type);
PAKFile resFile("KYRA.DAT"); PAKFile resFile("KYRA.DAT");
if (!resFile.isValid() || !resFile.isOpen()) { if (!resFile.isValid() || !resFile.isOpen()) {
error("couldn't open Kyrandia resource file ('KYRA.DAT') make sure you got one file for your version"); error("couldn't open Kyrandia resource file ('KYRA.DAT') make sure you got one file for your version");
@ -257,7 +257,7 @@ void KyraEngine::res_loadResources(int type) {
} }
void KyraEngine::res_unloadResources(int type) { void KyraEngine::res_unloadResources(int type) {
debug(9, "res_unloadResources(%d)", type); debug(9, kDebugLevelMain, "KyraEngine::res_unloadResources(%d)", type);
if ((type & RES_INTRO) || (type & RES_OUTRO) || type & RES_ALL) { if ((type & RES_INTRO) || (type & RES_OUTRO) || type & RES_ALL) {
res_freeLangTable(&_seq_WSATable, &_seq_WSATable_Size); res_freeLangTable(&_seq_WSATable, &_seq_WSATable_Size);
res_freeLangTable(&_seq_CPSTable, &_seq_CPSTable_Size); res_freeLangTable(&_seq_CPSTable, &_seq_CPSTable_Size);

View file

@ -33,7 +33,7 @@
namespace Kyra { namespace Kyra {
void KyraEngine::waitForChatToFinish(int16 chatDuration, char *chatStr, uint8 charNum) { void KyraEngine::waitForChatToFinish(int16 chatDuration, char *chatStr, uint8 charNum) {
debug(9, "KyraEngine::waitForChatToFinish(%i, %s, %i)", chatDuration, chatStr, charNum); debug(9, kDebugLevelMain, "KyraEngine::waitForChatToFinish(%i, %s, %i)", chatDuration, chatStr, charNum);
bool hasUpdatedNPCs = false; bool hasUpdatedNPCs = false;
bool runLoop = true; bool runLoop = true;
uint8 currPage; uint8 currPage;
@ -230,7 +230,7 @@ int KyraEngine::initCharacterChat(int8 charNum) {
} }
void KyraEngine::characterSays(char *chatStr, int8 charNum, int8 chatDuration) { void KyraEngine::characterSays(char *chatStr, int8 charNum, int8 chatDuration) {
debug(9, "KyraEngine::characterSays('%s', %i, %d)", chatStr, charNum, chatDuration); debug(9, kDebugLevelMain, "KyraEngine::characterSays('%s', %i, %d)", chatStr, charNum, chatDuration);
uint8 startAnimFrames[] = { 0x10, 0x32, 0x56, 0x0, 0x0, 0x0 }; uint8 startAnimFrames[] = { 0x10, 0x32, 0x56, 0x0, 0x0, 0x0 };
uint16 chatTicks; uint16 chatTicks;
@ -303,7 +303,7 @@ void KyraEngine::characterSays(char *chatStr, int8 charNum, int8 chatDuration) {
} }
void KyraEngine::drawSentenceCommand(char *sentence, int color) { void KyraEngine::drawSentenceCommand(char *sentence, int color) {
debug(9, "KyraEngine::drawSentenceCommand('%s', %i)", sentence, color); debug(9, kDebugLevelMain, "KyraEngine::drawSentenceCommand('%s', %i)", sentence, color);
_screen->hideMouse(); _screen->hideMouse();
_screen->fillRect(8, 143, 311, 152, 12); _screen->fillRect(8, 143, 311, 152, 12);
@ -323,7 +323,7 @@ void KyraEngine::drawSentenceCommand(char *sentence, int color) {
} }
void KyraEngine::updateSentenceCommand(char *str1, char *str2, int color) { void KyraEngine::updateSentenceCommand(char *str1, char *str2, int color) {
debug(9, "KyraEngine::updateSentenceCommand('%s', '%s', %i)", str1, str2, color); debug(9, kDebugLevelMain, "KyraEngine::updateSentenceCommand('%s', '%s', %i)", str1, str2, color);
char sentenceCommand[500]; char sentenceCommand[500];
strncpy(sentenceCommand, str1, 500); strncpy(sentenceCommand, str1, 500);
if (str2) if (str2)
@ -334,7 +334,7 @@ void KyraEngine::updateSentenceCommand(char *str1, char *str2, int color) {
} }
void KyraEngine::updateTextFade() { void KyraEngine::updateTextFade() {
debug(9, "KyraEngine::updateTextFade()"); debug(9, kDebugLevelMain, "KyraEngine::updateTextFade()");
if (!_fadeText) if (!_fadeText)
return; return;
@ -371,12 +371,12 @@ TextDisplayer::TextDisplayer(Screen *screen) {
} }
void TextDisplayer::setTalkCoords(uint16 y) { void TextDisplayer::setTalkCoords(uint16 y) {
debug(9, "TextDisplayer::setTalkCoords(%d)", y); debug(9, kDebugLevelMain, "TextDisplayer::setTalkCoords(%d)", y);
_talkCoords.y = y; _talkCoords.y = y;
} }
int TextDisplayer::getCenterStringX(const char *str, int x1, int x2) { int TextDisplayer::getCenterStringX(const char *str, int x1, int x2) {
debug(9, "TextDisplayer::getCenterStringX('%s', %d, %d)", str, x1, x2); debug(9, kDebugLevelMain, "TextDisplayer::getCenterStringX('%s', %d, %d)", str, x1, x2);
_screen->_charWidth = -2; _screen->_charWidth = -2;
Screen::FontId curFont = _screen->setFont(Screen::FID_8_FNT); Screen::FontId curFont = _screen->setFont(Screen::FID_8_FNT);
int strWidth = _screen->getTextWidth(str); int strWidth = _screen->getTextWidth(str);
@ -387,7 +387,7 @@ int TextDisplayer::getCenterStringX(const char *str, int x1, int x2) {
} }
int TextDisplayer::getCharLength(const char *str, int len) { int TextDisplayer::getCharLength(const char *str, int len) {
debug(9, "TextDisplayer::getCharLength('%s', %d)", str, len); debug(9, kDebugLevelMain, "TextDisplayer::getCharLength('%s', %d)", str, len);
int charsCount = 0; int charsCount = 0;
if (*str) { if (*str) {
_screen->_charWidth = -2; _screen->_charWidth = -2;
@ -404,7 +404,7 @@ int TextDisplayer::getCharLength(const char *str, int len) {
} }
int TextDisplayer::dropCRIntoString(char *str, int offs) { int TextDisplayer::dropCRIntoString(char *str, int offs) {
debug(9, "TextDisplayer::dropCRIntoString('%s', %d)", str, offs); debug(9, kDebugLevelMain, "TextDisplayer::dropCRIntoString('%s', %d)", str, offs);
int pos = 0; int pos = 0;
str += offs; str += offs;
while (*str) { while (*str) {
@ -419,7 +419,7 @@ int TextDisplayer::dropCRIntoString(char *str, int offs) {
} }
char *TextDisplayer::preprocessString(const char *str) { char *TextDisplayer::preprocessString(const char *str) {
debug(9, "TextDisplayer::preprocessString('%s')", str); debug(9, kDebugLevelMain, "TextDisplayer::preprocessString('%s')", str);
assert(strlen(str) < sizeof(_talkBuffer) - 1); assert(strlen(str) < sizeof(_talkBuffer) - 1);
strcpy(_talkBuffer, str); strcpy(_talkBuffer, str);
char *p = _talkBuffer; char *p = _talkBuffer;
@ -454,7 +454,7 @@ char *TextDisplayer::preprocessString(const char *str) {
} }
int TextDisplayer::buildMessageSubstrings(const char *str) { int TextDisplayer::buildMessageSubstrings(const char *str) {
debug(9, "TextDisplayer::buildMessageSubstrings('%s')", str); debug(9, kDebugLevelMain, "TextDisplayer::buildMessageSubstrings('%s')", str);
int currentLine = 0; int currentLine = 0;
int pos = 0; int pos = 0;
while (*str) { while (*str) {
@ -477,7 +477,7 @@ int TextDisplayer::buildMessageSubstrings(const char *str) {
} }
int TextDisplayer::getWidestLineWidth(int linesCount) { int TextDisplayer::getWidestLineWidth(int linesCount) {
debug(9, "TextDisplayer::getWidestLineWidth(%d)", linesCount); debug(9, kDebugLevelMain, "TextDisplayer::getWidestLineWidth(%d)", linesCount);
int maxWidth = 0; int maxWidth = 0;
Screen::FontId curFont = _screen->setFont(Screen::FID_8_FNT); Screen::FontId curFont = _screen->setFont(Screen::FID_8_FNT);
_screen->_charWidth = -2; _screen->_charWidth = -2;
@ -493,7 +493,7 @@ int TextDisplayer::getWidestLineWidth(int linesCount) {
} }
void TextDisplayer::calcWidestLineBounds(int &x1, int &x2, int w, int cx) { void TextDisplayer::calcWidestLineBounds(int &x1, int &x2, int w, int cx) {
debug(9, "TextDisplayer::calcWidestLineBounds(%d, %d)", w, cx); debug(9, kDebugLevelMain, "TextDisplayer::calcWidestLineBounds(%d, %d)", w, cx);
x1 = cx - w / 2; x1 = cx - w / 2;
if (x1 + w >= Screen::SCREEN_W - 12) { if (x1 + w >= Screen::SCREEN_W - 12) {
x1 = Screen::SCREEN_W - 12 - w - 1; x1 = Screen::SCREEN_W - 12 - w - 1;
@ -504,7 +504,7 @@ void TextDisplayer::calcWidestLineBounds(int &x1, int &x2, int w, int cx) {
} }
void TextDisplayer::restoreTalkTextMessageBkgd(int srcPage, int dstPage) { void TextDisplayer::restoreTalkTextMessageBkgd(int srcPage, int dstPage) {
debug(9, "TextDisplayer::restoreTalkTextMessageBkgd(%d, %d)", srcPage, dstPage); debug(9, kDebugLevelMain, "TextDisplayer::restoreTalkTextMessageBkgd(%d, %d)", srcPage, dstPage);
if (_talkMessagePrinted) { if (_talkMessagePrinted) {
_talkMessagePrinted = false; _talkMessagePrinted = false;
_screen->copyRegion(_talkCoords.x, _talkCoords.y, _talkCoords.x, _talkMessageY, _talkCoords.w, _talkMessageH, srcPage, dstPage); _screen->copyRegion(_talkCoords.x, _talkCoords.y, _talkCoords.x, _talkMessageY, _talkCoords.w, _talkMessageH, srcPage, dstPage);
@ -512,7 +512,7 @@ void TextDisplayer::restoreTalkTextMessageBkgd(int srcPage, int dstPage) {
} }
void TextDisplayer::printTalkTextMessage(const char *text, int x, int y, uint8 color, int srcPage, int dstPage) { void TextDisplayer::printTalkTextMessage(const char *text, int x, int y, uint8 color, int srcPage, int dstPage) {
debug(9, "TextDisplayer::printTalkTextMessage('%s', %d, %d, %d, %d, %d)", text, x, y, color, srcPage, dstPage); debug(9, kDebugLevelMain, "TextDisplayer::printTalkTextMessage('%s', %d, %d, %d, %d, %d)", text, x, y, color, srcPage, dstPage);
char *str = preprocessString(text); char *str = preprocessString(text);
int lineCount = buildMessageSubstrings(str); int lineCount = buildMessageSubstrings(str);
int top = y - lineCount * 10; int top = y - lineCount * 10;
@ -540,7 +540,7 @@ void TextDisplayer::printTalkTextMessage(const char *text, int x, int y, uint8 c
} }
void TextDisplayer::printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2) { void TextDisplayer::printText(const char *str, int x, int y, uint8 c0, uint8 c1, uint8 c2) {
debug(9, "TextDisplayer::printText('%s', %d, %d, %d, %d, %d)", str, x, y, c0, c1, c2); debug(9, kDebugLevelMain, "TextDisplayer::printText('%s', %d, %d, %d, %d, %d)", str, x, y, c0, c1, c2);
uint8 colorMap[] = { 0, 15, 12, 12 }; uint8 colorMap[] = { 0, 15, 12, 12 };
colorMap[3] = c1; colorMap[3] = c1;
_screen->setTextColor(colorMap, 0, 3); _screen->setTextColor(colorMap, 0, 3);
@ -552,7 +552,7 @@ void TextDisplayer::printText(const char *str, int x, int y, uint8 c0, uint8 c1,
} }
void TextDisplayer::printCharacterText(char *text, int8 charNum, int charX) { void TextDisplayer::printCharacterText(char *text, int8 charNum, int charX) {
debug(9, "TextDisplayer::printCharacterText('%s', %d, %d)", text, charNum, charX); debug(9, kDebugLevelMain, "TextDisplayer::printCharacterText('%s', %d, %d)", text, charNum, charX);
uint8 colorTable[] = {0x0F, 0x9, 0x0C9, 0x80, 0x5, 0x81, 0x0E, 0xD8, 0x55, 0x3A, 0x3a}; uint8 colorTable[] = {0x0F, 0x9, 0x0C9, 0x80, 0x5, 0x81, 0x0E, 0xD8, 0x55, 0x3A, 0x3a};
int top, left, x1, x2, w, x; int top, left, x1, x2, w, x;
char *msg; char *msg;

View file

@ -28,7 +28,7 @@
namespace Kyra { namespace Kyra {
void KyraEngine::setupTimers() { void KyraEngine::setupTimers() {
debug(9, "setupTimers()"); debug(9, kDebugLevelMain, "KyraEngine::setupTimers()");
memset(_timers, 0, sizeof(_timers)); memset(_timers, 0, sizeof(_timers));
for (int i = 0; i < 34; i++) for (int i = 0; i < 34; i++)
@ -82,7 +82,7 @@ void KyraEngine::setupTimers() {
} }
void KyraEngine::updateGameTimers() { void KyraEngine::updateGameTimers() {
debug(9, "updateGameTimers()"); debug(9, kDebugLevelMain, "KyraEngine::updateGameTimers()");
if (_system->getMillis() < _timerNextRun) if (_system->getMillis() < _timerNextRun)
return; return;
@ -104,22 +104,22 @@ void KyraEngine::updateGameTimers() {
} }
void KyraEngine::clearNextEventTickCount() { void KyraEngine::clearNextEventTickCount() {
debug(9, "clearNextEventTickCount()"); debug(9, kDebugLevelMain, "KyraEngine::clearNextEventTickCount()");
_timerNextRun = 0; _timerNextRun = 0;
} }
void KyraEngine::setTimerDelay(uint8 timer, int32 countdown) { void KyraEngine::setTimerDelay(uint8 timer, int32 countdown) {
debug(9, "setTimerDelay(%i, %d)", timer, countdown); debug(9, kDebugLevelMain, "KyraEngine::setTimerDelay(%i, %d)", timer, countdown);
_timers[timer].countdown = countdown; _timers[timer].countdown = countdown;
} }
int16 KyraEngine::getTimerDelay(uint8 timer) { int16 KyraEngine::getTimerDelay(uint8 timer) {
debug(9, "getTimerDelay(%i)", timer); debug(9, kDebugLevelMain, "KyraEngine::getTimerDelay(%i)", timer);
return _timers[timer].countdown; return _timers[timer].countdown;
} }
void KyraEngine::setTimerCountdown(uint8 timer, int32 countdown) { void KyraEngine::setTimerCountdown(uint8 timer, int32 countdown) {
debug(9, "setTimerCountdown(%i, %i)", timer, countdown); debug(9, kDebugLevelMain, "KyraEngine::setTimerCountdown(%i, %i)", timer, countdown);
_timers[timer].countdown = countdown; _timers[timer].countdown = countdown;
_timers[timer].nextRun = _system->getMillis() + countdown * _tickLength; _timers[timer].nextRun = _system->getMillis() + countdown * _tickLength;
@ -129,17 +129,17 @@ void KyraEngine::setTimerCountdown(uint8 timer, int32 countdown) {
} }
void KyraEngine::enableTimer(uint8 timer) { void KyraEngine::enableTimer(uint8 timer) {
debug(9, "enableTimer(%i)", timer); debug(9, kDebugLevelMain, "KyraEngine::enableTimer(%i)", timer);
_timers[timer].active = 1; _timers[timer].active = 1;
} }
void KyraEngine::disableTimer(uint8 timer) { void KyraEngine::disableTimer(uint8 timer) {
debug(9, "disableTimer(%i)", timer); debug(9, kDebugLevelMain, "KyraEngine::disableTimer(%i)", timer);
_timers[timer].active = 0; _timers[timer].active = 0;
} }
void KyraEngine::timerUpdateHeadAnims(int timerNum) { void KyraEngine::timerUpdateHeadAnims(int timerNum) {
debug(9, "timerUpdateHeadAnims(%i)", timerNum); debug(9, kDebugLevelMain, "KyraEngine::timerUpdateHeadAnims(%i)", timerNum);
static int8 currentFrame = 0; static int8 currentFrame = 0;
static const int8 frameTable[] = {4, 5, 4, 5, 4, 5, 0, 1, 4, 5, static const int8 frameTable[] = {4, 5, 4, 5, 4, 5, 0, 1, 4, 5,
4, 4, 6, 4, 8, 1, 9, 4, -1}; 4, 4, 6, 4, 8, 1, 9, 4, -1};
@ -158,7 +158,7 @@ void KyraEngine::timerUpdateHeadAnims(int timerNum) {
} }
void KyraEngine::timerSetFlags1(int timerNum) { void KyraEngine::timerSetFlags1(int timerNum) {
debug(9, "timerSetFlags(%i)", timerNum); debug(9, kDebugLevelMain, "KyraEngine::timerSetFlags(%i)", timerNum);
if (_currentCharacter->sceneId == 0x1C) if (_currentCharacter->sceneId == 0x1C)
return; return;
@ -177,26 +177,26 @@ void KyraEngine::timerSetFlags1(int timerNum) {
} }
void KyraEngine::timerFadeText(int timerNum) { void KyraEngine::timerFadeText(int timerNum) {
debug(9, "timerFadeText(%i)", timerNum); debug(9, kDebugLevelMain, "KyraEngine::timerFadeText(%i)", timerNum);
_fadeText = true; _fadeText = true;
} }
void KyraEngine::updateAnimFlag1(int timerNum) { void KyraEngine::updateAnimFlag1(int timerNum) {
debug(9, "updateAnimFlag1(%d)", timerNum); debug(9, kDebugLevelMain, "KyraEngine::updateAnimFlag1(%d)", timerNum);
if (_brandonStatusBit & 2) { if (_brandonStatusBit & 2) {
_brandonStatusBit0x02Flag = 1; _brandonStatusBit0x02Flag = 1;
} }
} }
void KyraEngine::updateAnimFlag2(int timerNum) { void KyraEngine::updateAnimFlag2(int timerNum) {
debug(9, "updateAnimFlag2(%d)", timerNum); debug(9, kDebugLevelMain, "KyraEngine::updateAnimFlag2(%d)", timerNum);
if (_brandonStatusBit & 0x20) { if (_brandonStatusBit & 0x20) {
_brandonStatusBit0x20Flag = 1; _brandonStatusBit0x20Flag = 1;
} }
} }
void KyraEngine::setTextFadeTimerCountdown(int16 countdown) { void KyraEngine::setTextFadeTimerCountdown(int16 countdown) {
debug(9, "setTextFadeTimerCountdown(%i)", countdown); debug(9, kDebugLevelMain, "KyraEngine::setTextFadeTimerCountdown(%i)", countdown);
//if (countdown == -1) //if (countdown == -1)
//countdown = 32000; //countdown = 32000;
@ -204,13 +204,13 @@ void KyraEngine::setTextFadeTimerCountdown(int16 countdown) {
} }
void KyraEngine::timerSetFlags2(int timerNum) { void KyraEngine::timerSetFlags2(int timerNum) {
debug(9, "timerSetFlags2(%i)", timerNum); debug(9, kDebugLevelMain, "KyraEngine::timerSetFlags2(%i)", timerNum);
if (!((uint32*)(_flagsTable+0x2D))[timerNum]) if (!((uint32*)(_flagsTable+0x2D))[timerNum])
((uint32*)(_flagsTable+0x2D))[timerNum] = 1; ((uint32*)(_flagsTable+0x2D))[timerNum] = 1;
} }
void KyraEngine::timerCheckAnimFlag1(int timerNum) { void KyraEngine::timerCheckAnimFlag1(int timerNum) {
debug(9, "timerCheckAnimFlag1(%i)", timerNum); debug(9, kDebugLevelMain, "KyraEngine::timerCheckAnimFlag1(%i)", timerNum);
if (_brandonStatusBit & 0x20) { if (_brandonStatusBit & 0x20) {
checkAmuletAnimFlags(); checkAmuletAnimFlags();
setTimerCountdown(18, -1); setTimerCountdown(18, -1);
@ -218,7 +218,7 @@ void KyraEngine::timerCheckAnimFlag1(int timerNum) {
} }
void KyraEngine::timerCheckAnimFlag2(int timerNum) { void KyraEngine::timerCheckAnimFlag2(int timerNum) {
debug(9, "timerCheckAnimFlag1(%i)", timerNum); debug(9, kDebugLevelMain, "KyraEngine::timerCheckAnimFlag1(%i)", timerNum);
if (_brandonStatusBit & 0x2) { if (_brandonStatusBit & 0x2) {
checkAmuletAnimFlags(); checkAmuletAnimFlags();
setTimerCountdown(14, -1); setTimerCountdown(14, -1);
@ -226,7 +226,7 @@ void KyraEngine::timerCheckAnimFlag2(int timerNum) {
} }
void KyraEngine::checkAmuletAnimFlags() { void KyraEngine::checkAmuletAnimFlags() {
debug(9, "checkSpecialAnimFlags()"); debug(9, kDebugLevelMain, "KyraEngine::checkSpecialAnimFlags()");
if (_brandonStatusBit & 2) { if (_brandonStatusBit & 2) {
seq_makeBrandonNormal2(); seq_makeBrandonNormal2();
setTimerCountdown(19, 300); setTimerCountdown(19, 300);
@ -239,7 +239,7 @@ void KyraEngine::checkAmuletAnimFlags() {
} }
void KyraEngine::timerRedrawAmulet(int timerNum) { void KyraEngine::timerRedrawAmulet(int timerNum) {
debug(9, "timerRedrawAmulet(%i)", timerNum); debug(9, kDebugLevelMain, "KyraEngine::timerRedrawAmulet(%i)", timerNum);
if (queryGameFlag(0xF1)) { if (queryGameFlag(0xF1)) {
drawAmulet(); drawAmulet();
setTimerCountdown(19, -1); setTimerCountdown(19, -1);
@ -247,7 +247,7 @@ void KyraEngine::timerRedrawAmulet(int timerNum) {
} }
void KyraEngine::drawAmulet() { void KyraEngine::drawAmulet() {
debug(9, "drawAmulet()"); debug(9, kDebugLevelMain, "KyraEngine::drawAmulet()");
static const int16 amuletTable1[] = {0x167, 0x162, 0x15D, 0x158, 0x153, 0x150, 0x155, 0x15A, 0x15F, 0x164, 0x145, -1}; static const int16 amuletTable1[] = {0x167, 0x162, 0x15D, 0x158, 0x153, 0x150, 0x155, 0x15A, 0x15F, 0x164, 0x145, -1};
static const int16 amuletTable3[] = {0x167, 0x162, 0x15D, 0x158, 0x153, 0x14F, 0x154, 0x159, 0x15E, 0x163, 0x144, -1}; static const int16 amuletTable3[] = {0x167, 0x162, 0x15D, 0x158, 0x153, 0x14F, 0x154, 0x159, 0x15E, 0x163, 0x144, -1};
static const int16 amuletTable2[] = {0x167, 0x162, 0x15D, 0x158, 0x153, 0x152, 0x157, 0x15C, 0x161, 0x166, 0x147, -1}; static const int16 amuletTable2[] = {0x167, 0x162, 0x15D, 0x158, 0x153, 0x152, 0x157, 0x15C, 0x161, 0x166, 0x147, -1};

View file

@ -31,7 +31,7 @@ WSAMovieV1::WSAMovieV1(KyraEngine *vm) : Movie(vm) {}
WSAMovieV1::~WSAMovieV1() { close(); } WSAMovieV1::~WSAMovieV1() { close(); }
void WSAMovieV1::open(const char *filename, int offscreenDecode, uint8 *palBuf) { void WSAMovieV1::open(const char *filename, int offscreenDecode, uint8 *palBuf) {
debug(9, "WSAMovieV1::open('%s', %d, 0x%X)", filename, offscreenDecode, palBuf); debug(9, kDebugLevelMovie, "WSAMovieV1::open('%s', %d, 0x%X)", filename, offscreenDecode, palBuf);
close(); close();
uint32 flags = 0; uint32 flags = 0;
@ -110,7 +110,7 @@ void WSAMovieV1::open(const char *filename, int offscreenDecode, uint8 *palBuf)
} }
void WSAMovieV1::close() { void WSAMovieV1::close() {
debug(9, "WSAMovieV1::close()"); debug(9, kDebugLevelMovie, "WSAMovieV1::close()");
if (_opened) { if (_opened) {
delete [] _deltaBuffer; delete [] _deltaBuffer;
delete [] _offscreenBuffer; delete [] _offscreenBuffer;
@ -121,7 +121,7 @@ void WSAMovieV1::close() {
} }
void WSAMovieV1::displayFrame(int frameNum) { void WSAMovieV1::displayFrame(int frameNum) {
debug(9, "WSAMovieV1::displayFrame(%d)", frameNum); debug(9, kDebugLevelMovie, "WSAMovieV1::displayFrame(%d)", frameNum);
if (frameNum >= _numFrames || !_opened) if (frameNum >= _numFrames || !_opened)
return; return;
@ -191,7 +191,7 @@ void WSAMovieV1::displayFrame(int frameNum) {
} }
void WSAMovieV1::processFrame(int frameNum, uint8 *dst) { void WSAMovieV1::processFrame(int frameNum, uint8 *dst) {
debug(9, "WSAMovieV1::processFrame(%d, 0x%X)", frameNum, dst); debug(9, kDebugLevelMovie, "WSAMovieV1::processFrame(%d, 0x%X)", frameNum, dst);
if (!_opened) if (!_opened)
return; return;
assert(frameNum <= _numFrames); assert(frameNum <= _numFrames);