diff options
-rw-r--r-- | engines/toltecs/screen.cpp | 9 | ||||
-rw-r--r-- | engines/toltecs/script.cpp | 55 | ||||
-rw-r--r-- | engines/toltecs/script.h | 2 | ||||
-rw-r--r-- | engines/toltecs/toltecs.cpp | 3 |
4 files changed, 21 insertions, 48 deletions
diff --git a/engines/toltecs/screen.cpp b/engines/toltecs/screen.cpp index 9f77c0558f..1abb057d4f 100644 --- a/engines/toltecs/screen.cpp +++ b/engines/toltecs/screen.cpp @@ -399,7 +399,6 @@ void Screen::updateTalkText(int16 slotIndex, int16 slotOffset) { if (*textData == 0x1E) { textData++; addTalkTextRect(font, x, y, length, width, item); - // CHECKME? width = 0; length = 0; } else { @@ -415,10 +414,6 @@ void Screen::updateTalkText(int16 slotIndex, int16 slotOffset) { wordWidth += font.getCharWidth(ch) + font.getSpacing() - 1; } } - - debug(0, "## width = %d; wordWidth = %d; width + wordWidth = %d; maxWidth + font.getWidth() = %d", - width, wordWidth, width + wordWidth, maxWidth + font.getWidth()); - if (width + wordWidth > maxWidth + font.getWidth()) { addTalkTextRect(font, x, y, length, width, item); width = wordWidth; @@ -432,8 +427,6 @@ void Screen::updateTalkText(int16 slotIndex, int16 slotOffset) { addTalkTextRect(font, x, y, length, width, item); - debug(0, "## item->lineCount = %d", item->lineCount); - if (item->lineCount > 0) { int16 ysub = (font.getHeight() - 1) * item->lineCount; if (item->lines[0].y - 4 < ysub) @@ -531,7 +524,6 @@ void Screen::drawGuiTextMulti(byte *textData) { wrapState.sourceString = textData; do { - if (*wrapState.sourceString == 0x0A) { // Set text position y = wrapState.sourceString[1]; @@ -549,7 +541,6 @@ void Screen::drawGuiTextMulti(byte *textData) { wrapState.len2 = wrapGuiText(_fontResIndexArray[1], 640, wrapState); drawGuiText(x - wrapState.width / 2, y, _fontColor1, _fontColor2, _fontResIndexArray[1], wrapState); } - } while (*wrapState.sourceString != 0xFF); _guiRefresh = true; diff --git a/engines/toltecs/script.cpp b/engines/toltecs/script.cpp index 920c0d0180..4aaa626dd9 100644 --- a/engines/toltecs/script.cpp +++ b/engines/toltecs/script.cpp @@ -136,7 +136,7 @@ void ScriptInterpreter::setupScriptFunctions() { RegisterScriptFunction(sfRunOptionsScreen); RegisterScriptFunction(sfPrecacheSprites); RegisterScriptFunction(sfPrecacheSounds1); - RegisterScriptFunction(sfDeleteAllPbfFilesByExternalArray); + RegisterScriptFunction(sfDeletePrecachedFiles); RegisterScriptFunction(sfPrecacheSounds2); RegisterScriptFunction(sfRestoreStackPtr); RegisterScriptFunction(sfSaveStackPtr); @@ -600,7 +600,6 @@ int16 ScriptInterpreter::getGameVar(uint variable) { warning("Getting unimplemented game variable %s (%d)", getVarName(variable), variable); break; } - return value; @@ -678,7 +677,6 @@ void ScriptInterpreter::setGameVar(uint variable, int16 value) { break; } - } byte ScriptInterpreter::arg8(int16 offset) { @@ -700,27 +698,27 @@ int16 ScriptInterpreter::popInt16() { } void ScriptInterpreter::localWrite8(int16 offset, byte value) { - debug(1, "localWrite8(%d, %d)", offset, value); + //debug(1, "localWrite8(%d, %d)", offset, value); _localData[offset] = value; } byte ScriptInterpreter::localRead8(int16 offset) { - debug(1, "localRead8(%d) -> %d", offset, _localData[offset]); + //debug(1, "localRead8(%d) -> %d", offset, _localData[offset]); return _localData[offset]; } void ScriptInterpreter::localWrite16(int16 offset, int16 value) { - debug(1, "localWrite16(%d, %d)", offset, value); + //debug(1, "localWrite16(%d, %d)", offset, value); WRITE_LE_UINT16(&_localData[offset], value); } int16 ScriptInterpreter::localRead16(int16 offset) { - debug(1, "localRead16(%d) -> %d", offset, (int16)READ_LE_UINT16(&_localData[offset])); + //debug(1, "localRead16(%d) -> %d", offset, (int16)READ_LE_UINT16(&_localData[offset])); return (int16)READ_LE_UINT16(&_localData[offset]); } byte *ScriptInterpreter::localPtr(int16 offset) { - debug(1, "localPtr(%d)", offset); + //debug(1, "localPtr(%d)", offset); return &_localData[offset]; } @@ -1066,7 +1064,7 @@ void ScriptInterpreter::sfClearScreen() { } void ScriptInterpreter::sfHandleInput() { - // TODO: Recheck what this does, I don't remember + // TODO: Recheck what this does int16 varOfs = arg16(3); localWrite16(varOfs, 0); } @@ -1075,43 +1073,26 @@ void ScriptInterpreter::sfRunOptionsScreen() { // TODO } +/* NOTE: The opcodes sfPrecacheSprites, sfPrecacheSounds1, sfPrecacheSounds2 and + sfDeletePrecachedFiles were used by the original engine to handle precaching + of data so the game doesn't stall while playing (due to the slow speed of + CD-Drives back then). This is not needed in ScummVM since all supported + systems are fast enough to load data in-game. */ + void ScriptInterpreter::sfPrecacheSprites() { -#if 0 - // DEBUG - int16 *resArray = (int16*)localPtr(arg16(3)); - while (*resArray != -1) { - debug("ScriptInterpreter::sfPrecacheSprites() index = %d", *resArray); - _vm->_arc->dump(*resArray, "pc1"); - resArray++; - } -#endif + // See note above } void ScriptInterpreter::sfPrecacheSounds1() { -#if 0 - // DEBUG - int16 *resArray = (int16*)localPtr(arg16(3)); - while (*resArray != -1) { - debug("ScriptInterpreter::sfPrecacheSounds1() index = %d", *resArray); - _vm->_arc->dump(*resArray, "pc2"); - resArray++; - } -#endif + // See note above } -void ScriptInterpreter::sfDeleteAllPbfFilesByExternalArray() { +void ScriptInterpreter::sfDeletePrecachedFiles() { + // See note above } void ScriptInterpreter::sfPrecacheSounds2() { -#if 0 - // DEBUG - int16 *resArray = (int16*)localPtr(arg16(3)); - while (*resArray != -1) { - debug("ScriptInterpreter::sfPrecacheSounds2() index = %d", *resArray); - _vm->_arc->dump(*resArray, "pc3"); - resArray++; - } -#endif + // See note above } void ScriptInterpreter::sfRestoreStackPtr() { diff --git a/engines/toltecs/script.h b/engines/toltecs/script.h index 746a2fca6f..83ee628d25 100644 --- a/engines/toltecs/script.h +++ b/engines/toltecs/script.h @@ -184,7 +184,7 @@ protected: void sfRunOptionsScreen(); void sfPrecacheSprites(); void sfPrecacheSounds1(); - void sfDeleteAllPbfFilesByExternalArray(); + void sfDeletePrecachedFiles(); void sfPrecacheSounds2(); void sfRestoreStackPtr(); void sfSaveStackPtr(); diff --git a/engines/toltecs/toltecs.cpp b/engines/toltecs/toltecs.cpp index a984ca7676..214b71da03 100644 --- a/engines/toltecs/toltecs.cpp +++ b/engines/toltecs/toltecs.cpp @@ -22,6 +22,7 @@ */ #include "common/events.h" +#include "common/EventRecorder.h" #include "common/keyboard.h" #include "common/file.h" #include "common/savefile.h" @@ -67,7 +68,7 @@ ToltecsEngine::ToltecsEngine(OSystem *syst, const ToltecsGameDescription *gameDe _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume")); _rnd = new Common::RandomSource(); - syst->getEventManager()->registerRandomSource(*_rnd, "toltecs"); + g_eventRec.registerRandomSource(*_rnd, "toltecs"); int cd_num = ConfMan.getInt("cdrom"); if (cd_num >= 0) |