aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/lilliput/lilliput.cpp34
-rw-r--r--engines/lilliput/lilliput.h4
-rw-r--r--engines/lilliput/script.cpp87
-rw-r--r--engines/lilliput/script.h3
4 files changed, 63 insertions, 65 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index c67eb6b0af..3d06b43099 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -141,11 +141,11 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_byte12A06 = 2;
_byte12A07 = 0;
_byte12A08 = 0;
- _byte12A09 = 0;
+ _refreshScreenFlag = false;
_byte16552 = 0;
_lastInterfaceHotspotIndex = -1;
_lastInterfaceHotspotButton = 0;
- _byte16F08 = 0;
+ _byte16F08 = 0;
_byte16C9F = 0;
_lastAnimationTick = 0;
@@ -258,10 +258,9 @@ void LilliputEngine::newInt8() {
}
--_byte12A06;
// TODO: check 'out 20h, 20h'
-
- // hack for the title stars because _int8installed is not set at the good place for the moment
- //if (!_int8installed)
- // return;
+
+ if (!_int8installed)
+ return;
// if (_soundEnabled)
_soundHandler->contentFct1();
@@ -276,8 +275,8 @@ void LilliputEngine::newInt8() {
--_sound_byte16F06;
_animationTick ^= 1;
- if (_byte12A09 != 1 && _int8installed) // hack for the title stars because _int8installed is not set at the good place for the moment
- displayFunction16();
+ if (!_refreshScreenFlag)
+ displayRefreshScreen();
}
_byte12A08 = 0;
}
@@ -328,7 +327,7 @@ void LilliputEngine::displayCharacter(int index, Common::Point pos, int flags) {
// Sprite mirror
for (int y = 0; y < 16; y++) {
for (int x = 0; x < 16; x++) {
- // May need a hack of 1 pixel
+ // May need a hack of 1 pixel
if (src[15 - x] != 0)
buf[x] = src[15 - x];
}
@@ -737,7 +736,7 @@ void LilliputEngine::moveCharacters() {
_characterDisplayY[i] = (20 + tmpVal2 + tmpVal3 - tmpVal4) & 0xFF;
_charactersToDisplay[_numCharactersToDisplay] = i;
++_numCharactersToDisplay;
- }
+ }
}
sortCharacters();
@@ -790,8 +789,8 @@ void LilliputEngine::prepareGameArea() {
}
}
-void LilliputEngine::displayFunction16() {
- debugC(2, kDebugEngineTBC, "displayFunction16()");
+void LilliputEngine::displayRefreshScreen() {
+ debugC(2, kDebugEngineTBC, "displayRefreshScreen()");
if (_displayMap == 1) {
bool forceReturnFl = false;
@@ -848,7 +847,7 @@ void LilliputEngine::displaySmallAnims() {
return;
_lastAnimationTick = _animationTick;
-
+
assert(_smallAnimsFrameIndex < 8);
int subIndex = _smallAnimsFrameIndex;
displaySmallIndexedAnim(0, subIndex);
@@ -2316,7 +2315,7 @@ void LilliputEngine::pollEvent() {
case Common::EVENT_QUIT:
_shouldQuit = true;
break;
- // TODO: handle keyboard
+ // TODO: handle keyboard
default:
break;
}
@@ -2735,17 +2734,12 @@ Common::Error LilliputEngine::run() {
_bufferIsoMap = loadRaw("ISOMAP.DTA");
loadRules();
- // Hack: int8 should be installed at this point, but it's crashing during the
- // rendering when the title screens are displayed
- //_int8installed = true;
+ _int8installed = true;
_lastTime = _system->getMillis();
_scriptHandler->runScript(ScriptStream(_initScript, _initScriptSize));
- // Hack, see above
- _int8installed = true;
-
while (!_shouldQuit) {
handleMenu();
handleGameScripts();
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
index 39326301cc..32604d756a 100644
--- a/engines/lilliput/lilliput.h
+++ b/engines/lilliput/lilliput.h
@@ -111,7 +111,7 @@ public:
byte _byte12A06;
byte _byte12A07;
byte _byte12A08;
- byte _byte12A09;
+ bool _refreshScreenFlag;
byte _byte16552;
int8 _lastInterfaceHotspotIndex;
byte _lastInterfaceHotspotButton; // Unused: set by 2 functions, but never used elsewhere
@@ -239,7 +239,7 @@ public:
void displayIsometricBlock(byte *buf, int var1, int var2, int var3);
void displayGameArea();
void prepareGameArea();
- void displayFunction16();
+ void displayRefreshScreen();
void restoreSurfaceSpeech();
void displayFunction18(int var1, int var2, int var3, int var4);
void displayCharacter(int index, Common::Point pos, int flags);
diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp
index 6cee72db44..f0970597e2 100644
--- a/engines/lilliput/script.cpp
+++ b/engines/lilliput/script.cpp
@@ -2423,9 +2423,9 @@ void LilliputScript::OC_sub17C0E() {
mapPtr[3] = _vm->_currentCharacterVariables[8];
if (var2 == 0) {
- _byte12A09 = 1;
+ _vm->_refreshScreenFlag = true;
_vm->displayLandscape();
- _byte12A09 = 0;
+ _vm->_refreshScreenFlag = false;
}
}
@@ -2680,9 +2680,9 @@ void LilliputScript::OC_sub17F68() {
if (newPosY > 56)
newPosY = 56;
- _byte12A09 = 1;
+ _vm->_refreshScreenFlag = true;
_vm->viewportScrollTo(Common::Point(newPosX, newPosY));
- _byte12A09 = 0;
+ _vm->_refreshScreenFlag = false;
}
@@ -2811,9 +2811,9 @@ void LilliputScript::OC_sub180C3() {
if (y > 56)
y = 56;
- _byte12A09 = 1;
+ _vm->_refreshScreenFlag = true;
_vm->viewportScrollTo(Common::Point(x, y));
- _byte12A09 = 0;
+ _vm->_refreshScreenFlag = false;
}
void LilliputScript::OC_setViewPortPos() {
@@ -2833,19 +2833,20 @@ void LilliputScript::OC_setCurrentCharacterAltitude() {
}
void LilliputScript::OC_sub1817F() {
- debugC(1, kDebugScriptTBC, "OC_sub1817F()");
+ debugC(1, kDebugScript, "OC_sub1817F()");
- int var1 = _currScript->readUint16LE();
- int var2 = _currScript->readUint16LE();
+ int16 var1 = _currScript->readUint16LE();
+ int16 var2 = _currScript->readUint16LE();
- int b1 = var1 & 0xFF;
- int b2 = var2 & 0xFF;
- sub1818B(Common::Point(b1, b2));
+ int16 x = var1 & 0xFF;
+ int16 y = var2 & 0xFF;
+ sub1818B(Common::Point(x, y));
}
-//TODO checkme: parameter order is maybe wrong
-void LilliputScript::sub1818B(Common::Point pos) {
- debugC(2, kDebugScriptTBC, "sub1818B(%d - %d)", pos.x, pos.y);
+void LilliputScript::sub1818B(Common::Point point) {
+ debugC(2, kDebugScriptTBC, "sub1818B(%d - %d)", point.x, point.y);
+
+ Common::Point pos = point;
for (int i = 0; i < _vm->_word1817B; i++) {
if (_array1813BPos[i].x == pos.x) {
pos.y += _array1813BPos[i].y;
@@ -2861,34 +2862,38 @@ void LilliputScript::sub1818B(Common::Point pos) {
++_vm->_word1817B;
}
-//TODO checkme: case 0x2D is dubious
void LilliputScript::OC_sub181BB() {
debugC(1, kDebugScriptTBC, "OC_sub181BB()");
- int b = _currScript->readUint16LE();
- int d = _currScript->readUint16LE() & 0xFF;
- int s = _currScript->readUint16LE();
- int c = _vm->_currentCharacterVariables[s];
- int c2 = 0;
+ int16 x = _currScript->readUint16LE() & 0xFF;
+ int8 oper = _currScript->readUint16LE() & 0xFF;
+ int16 index = _currScript->readSint16LE();
+ int16 c = _vm->_currentCharacterVariables[index];
- if (d == 0x2D) {
+ switch (oper) {
+ case '-':
c = - 1 - c;
- } else if (d == 0x3E) {
- c = c - 0x80;
+ break;
+ case '>':
+ c -= 128;
if (c < 0)
c = 0;
- c = c * 2;
- } else if (d == 0x3C) {
- c = -1 - c;
- c = c - 0x80;
+ c *= 2;
+ break;
+ case '<':
+ c = -1 - c - 128;
if (c < 0)
c = 0;
- c = c * 2;
+ c *= 2;
+ break;
+ default:
+ warning("OC_sub181BB: skipped oper 0x%x", oper);
+ break;
}
-
- int a = (_currScript->readUint16LE() * c) + (c & 0xFF);
- b = (b & 0xFF00) + a;
- sub1818B(Common::Point(b >> 8, b & 0xFF));
+ c &= 0xFF;
+ int y = (_currScript->readSint16LE() * c) + c;
+ y >>= 8;
+ sub1818B(Common::Point(x, y));
}
void LilliputScript::OC_sub18213() {
@@ -2938,17 +2943,17 @@ void LilliputScript::OC_CharacterVariableAddOrRemoveFlag() {
void LilliputScript::OC_PaletteFadeOut() {
debugC(1, kDebugScript, "OC_PaletteFadeOut()");
- _byte12A09 = 1;
+ _vm->_refreshScreenFlag = true;
_vm->paletteFadeOut();
- _byte12A09 = 0;
+ _vm->_refreshScreenFlag = false;
}
void LilliputScript::OC_PaletteFadeIn() {
debugC(1, kDebugScript, "OC_PaletteFadeIn()");
- _byte12A09 = 1;
+ _vm->_refreshScreenFlag = true;
_vm->paletteFadeIn();
- _byte12A09 = 0;
+ _vm->_refreshScreenFlag = false;
}
void LilliputScript::OC_loadAndDisplayCUBESx_GFX() {
@@ -3041,7 +3046,7 @@ void LilliputScript::OC_loadFile_AERIAL_GFX() {
int var1 = _currScript->readUint16LE() & 0xff;
_vm->_byte15EAD = var1;
- _byte12A09 = 1;
+ _vm->_refreshScreenFlag = true;
_talkingCharacter = -1;
OC_PaletteFadeOut();
_vm->_word15AC2 = 1;
@@ -3053,7 +3058,7 @@ void LilliputScript::OC_loadFile_AERIAL_GFX() {
_vm->_keyboard_oldIndex = 0;
_vm->_keyboard_nextIndex = 0;
- _vm->_byte12A09 = 0;
+ _vm->_refreshScreenFlag = false;
}
void LilliputScript::OC_sub17E22_speech1IfSoundOff() {
@@ -3108,7 +3113,7 @@ void LilliputScript::displayNumber(byte var1, Common::Point pos) {
void LilliputScript::OC_displayVGAFile() {
debugC(1, kDebugScript, "OC_displayVGAFile()");
- _byte12A09 = 1;
+ _vm->_refreshScreenFlag = true;
_vm->paletteFadeOut();
int curWord = _currScript->readUint16LE();
int index = _vm->_packedStringIndex[curWord];
@@ -3165,7 +3170,7 @@ void LilliputScript::OC_initGameAreaDisplay() {
_vm->initGameAreaDisplay();
OC_PaletteFadeIn();
- _byte12A09 = 0;
+ _vm->_refreshScreenFlag = false;
_vm->_soundHandler->contentFct5();
}
diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h
index fd4c239a2b..b65751d6ca 100644
--- a/engines/lilliput/script.h
+++ b/engines/lilliput/script.h
@@ -98,7 +98,6 @@ private:
Common::Stack<ScriptStream *> _scriptStack;
byte _byte16F05_ScriptHandler;
- byte _byte12A09;
byte _byte129A0;
byte _byte10806;
byte _lastRandomValue;
@@ -257,7 +256,7 @@ private:
void OC_setViewPortPos();
void OC_setCurrentCharacterAltitude();
void OC_sub1817F();
- void sub1818B(Common::Point pos);
+ void sub1818B(Common::Point point);
void OC_sub181BB();
void OC_sub18213();
void OC_sub18252();