TOLTECS: Fix compilation.

This commit is contained in:
Benjamin Haisch 2009-07-25 20:24:53 +00:00 committed by Willem Jan Palenstijn
parent d6edbe97c9
commit 3c49d36d5f
4 changed files with 21 additions and 48 deletions

View file

@ -399,7 +399,6 @@ void Screen::updateTalkText(int16 slotIndex, int16 slotOffset) {
if (*textData == 0x1E) { if (*textData == 0x1E) {
textData++; textData++;
addTalkTextRect(font, x, y, length, width, item); addTalkTextRect(font, x, y, length, width, item);
// CHECKME?
width = 0; width = 0;
length = 0; length = 0;
} else { } else {
@ -415,10 +414,6 @@ void Screen::updateTalkText(int16 slotIndex, int16 slotOffset) {
wordWidth += font.getCharWidth(ch) + font.getSpacing() - 1; 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()) { if (width + wordWidth > maxWidth + font.getWidth()) {
addTalkTextRect(font, x, y, length, width, item); addTalkTextRect(font, x, y, length, width, item);
width = wordWidth; width = wordWidth;
@ -432,8 +427,6 @@ void Screen::updateTalkText(int16 slotIndex, int16 slotOffset) {
addTalkTextRect(font, x, y, length, width, item); addTalkTextRect(font, x, y, length, width, item);
debug(0, "## item->lineCount = %d", item->lineCount);
if (item->lineCount > 0) { if (item->lineCount > 0) {
int16 ysub = (font.getHeight() - 1) * item->lineCount; int16 ysub = (font.getHeight() - 1) * item->lineCount;
if (item->lines[0].y - 4 < ysub) if (item->lines[0].y - 4 < ysub)
@ -531,7 +524,6 @@ void Screen::drawGuiTextMulti(byte *textData) {
wrapState.sourceString = textData; wrapState.sourceString = textData;
do { do {
if (*wrapState.sourceString == 0x0A) { if (*wrapState.sourceString == 0x0A) {
// Set text position // Set text position
y = wrapState.sourceString[1]; y = wrapState.sourceString[1];
@ -549,7 +541,6 @@ void Screen::drawGuiTextMulti(byte *textData) {
wrapState.len2 = wrapGuiText(_fontResIndexArray[1], 640, wrapState); wrapState.len2 = wrapGuiText(_fontResIndexArray[1], 640, wrapState);
drawGuiText(x - wrapState.width / 2, y, _fontColor1, _fontColor2, _fontResIndexArray[1], wrapState); drawGuiText(x - wrapState.width / 2, y, _fontColor1, _fontColor2, _fontResIndexArray[1], wrapState);
} }
} while (*wrapState.sourceString != 0xFF); } while (*wrapState.sourceString != 0xFF);
_guiRefresh = true; _guiRefresh = true;

View file

@ -136,7 +136,7 @@ void ScriptInterpreter::setupScriptFunctions() {
RegisterScriptFunction(sfRunOptionsScreen); RegisterScriptFunction(sfRunOptionsScreen);
RegisterScriptFunction(sfPrecacheSprites); RegisterScriptFunction(sfPrecacheSprites);
RegisterScriptFunction(sfPrecacheSounds1); RegisterScriptFunction(sfPrecacheSounds1);
RegisterScriptFunction(sfDeleteAllPbfFilesByExternalArray); RegisterScriptFunction(sfDeletePrecachedFiles);
RegisterScriptFunction(sfPrecacheSounds2); RegisterScriptFunction(sfPrecacheSounds2);
RegisterScriptFunction(sfRestoreStackPtr); RegisterScriptFunction(sfRestoreStackPtr);
RegisterScriptFunction(sfSaveStackPtr); RegisterScriptFunction(sfSaveStackPtr);
@ -600,7 +600,6 @@ int16 ScriptInterpreter::getGameVar(uint variable) {
warning("Getting unimplemented game variable %s (%d)", getVarName(variable), variable); warning("Getting unimplemented game variable %s (%d)", getVarName(variable), variable);
break; break;
} }
return value; return value;
@ -678,7 +677,6 @@ void ScriptInterpreter::setGameVar(uint variable, int16 value) {
break; break;
} }
} }
byte ScriptInterpreter::arg8(int16 offset) { byte ScriptInterpreter::arg8(int16 offset) {
@ -700,27 +698,27 @@ int16 ScriptInterpreter::popInt16() {
} }
void ScriptInterpreter::localWrite8(int16 offset, byte value) { void ScriptInterpreter::localWrite8(int16 offset, byte value) {
debug(1, "localWrite8(%d, %d)", offset, value); //debug(1, "localWrite8(%d, %d)", offset, value);
_localData[offset] = value; _localData[offset] = value;
} }
byte ScriptInterpreter::localRead8(int16 offset) { byte ScriptInterpreter::localRead8(int16 offset) {
debug(1, "localRead8(%d) -> %d", offset, _localData[offset]); //debug(1, "localRead8(%d) -> %d", offset, _localData[offset]);
return _localData[offset]; return _localData[offset];
} }
void ScriptInterpreter::localWrite16(int16 offset, int16 value) { 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); WRITE_LE_UINT16(&_localData[offset], value);
} }
int16 ScriptInterpreter::localRead16(int16 offset) { 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]); return (int16)READ_LE_UINT16(&_localData[offset]);
} }
byte *ScriptInterpreter::localPtr(int16 offset) { byte *ScriptInterpreter::localPtr(int16 offset) {
debug(1, "localPtr(%d)", offset); //debug(1, "localPtr(%d)", offset);
return &_localData[offset]; return &_localData[offset];
} }
@ -1066,7 +1064,7 @@ void ScriptInterpreter::sfClearScreen() {
} }
void ScriptInterpreter::sfHandleInput() { void ScriptInterpreter::sfHandleInput() {
// TODO: Recheck what this does, I don't remember // TODO: Recheck what this does
int16 varOfs = arg16(3); int16 varOfs = arg16(3);
localWrite16(varOfs, 0); localWrite16(varOfs, 0);
} }
@ -1075,43 +1073,26 @@ void ScriptInterpreter::sfRunOptionsScreen() {
// TODO // 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() { void ScriptInterpreter::sfPrecacheSprites() {
#if 0 // See note above
// DEBUG
int16 *resArray = (int16*)localPtr(arg16(3));
while (*resArray != -1) {
debug("ScriptInterpreter::sfPrecacheSprites() index = %d", *resArray);
_vm->_arc->dump(*resArray, "pc1");
resArray++;
}
#endif
} }
void ScriptInterpreter::sfPrecacheSounds1() { void ScriptInterpreter::sfPrecacheSounds1() {
#if 0 // See note above
// DEBUG
int16 *resArray = (int16*)localPtr(arg16(3));
while (*resArray != -1) {
debug("ScriptInterpreter::sfPrecacheSounds1() index = %d", *resArray);
_vm->_arc->dump(*resArray, "pc2");
resArray++;
}
#endif
} }
void ScriptInterpreter::sfDeleteAllPbfFilesByExternalArray() { void ScriptInterpreter::sfDeletePrecachedFiles() {
// See note above
} }
void ScriptInterpreter::sfPrecacheSounds2() { void ScriptInterpreter::sfPrecacheSounds2() {
#if 0 // See note above
// DEBUG
int16 *resArray = (int16*)localPtr(arg16(3));
while (*resArray != -1) {
debug("ScriptInterpreter::sfPrecacheSounds2() index = %d", *resArray);
_vm->_arc->dump(*resArray, "pc3");
resArray++;
}
#endif
} }
void ScriptInterpreter::sfRestoreStackPtr() { void ScriptInterpreter::sfRestoreStackPtr() {

View file

@ -184,7 +184,7 @@ protected:
void sfRunOptionsScreen(); void sfRunOptionsScreen();
void sfPrecacheSprites(); void sfPrecacheSprites();
void sfPrecacheSounds1(); void sfPrecacheSounds1();
void sfDeleteAllPbfFilesByExternalArray(); void sfDeletePrecachedFiles();
void sfPrecacheSounds2(); void sfPrecacheSounds2();
void sfRestoreStackPtr(); void sfRestoreStackPtr();
void sfSaveStackPtr(); void sfSaveStackPtr();

View file

@ -22,6 +22,7 @@
*/ */
#include "common/events.h" #include "common/events.h"
#include "common/EventRecorder.h"
#include "common/keyboard.h" #include "common/keyboard.h"
#include "common/file.h" #include "common/file.h"
#include "common/savefile.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")); _mixer->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, ConfMan.getInt("music_volume"));
_rnd = new Common::RandomSource(); _rnd = new Common::RandomSource();
syst->getEventManager()->registerRandomSource(*_rnd, "toltecs"); g_eventRec.registerRandomSource(*_rnd, "toltecs");
int cd_num = ConfMan.getInt("cdrom"); int cd_num = ConfMan.getInt("cdrom");
if (cd_num >= 0) if (cd_num >= 0)