aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2012-04-06 08:15:22 +0200
committerEugene Sandulenko2018-03-28 17:36:57 +0200
commit17320cadb759c996446b34813eeff13a50b6ab56 (patch)
tree454ce11536cdae96470f708ebbff693ec465df11
parent4dd99da6dcebbe2e2ffc479da707a53f9fdaa64e (diff)
downloadscummvm-rg350-17320cadb759c996446b34813eeff13a50b6ab56.tar.gz
scummvm-rg350-17320cadb759c996446b34813eeff13a50b6ab56.tar.bz2
scummvm-rg350-17320cadb759c996446b34813eeff13a50b6ab56.zip
LILLIPUT: Implement OC_sub184F5, modify struct18560
-rw-r--r--engines/lilliput/lilliput.cpp16
-rw-r--r--engines/lilliput/lilliput.h22
-rw-r--r--engines/lilliput/script.cpp44
3 files changed, 58 insertions, 24 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index 12399ba406..e62e4c8535 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -204,22 +204,18 @@ void LilliputEngine::loadRules() {
}
// Chunk 3 & 4
- warning("Chunk 3 & 4 Pos: %d", f.pos());
_rulesChunk3_size = f.readSint16LE();
curWord = f.readSint16LE();
- warning("Pos %d - size chunk3: %d", f.pos(), _rulesChunk3_size);
_rulesChunk3 = (int *)malloc(sizeof(int) * _rulesChunk3_size);
for (int i = 0; i < _rulesChunk3_size; ++i)
_rulesChunk3[i] = f.readUint16LE();
- warning("Pos %d - size chunk4: %d", f.pos(), curWord);
_rulesChunk4 = (byte *)malloc(sizeof(byte) * curWord);
for (int i = 0; i < curWord; ++i)
_rulesChunk4[i] = f.readByte();
// Chunk 5: Scripts
- warning("Chunk 5 Pos: %d", f.pos());
// Use byte instead of int, therefore multiply by two the size.
// This is for changing that into a memory read stream
_rulesScript_size = f.readUint16LE() * 2;
@@ -343,6 +339,14 @@ void LilliputEngine::initialize() {
_rnd = new Common::RandomSource("robin");
_rnd->setSeed(42); // Kick random number generator
+
+ for (int i = 0; i < 4; i++) {
+ _arr18560[i]._field0 = 0;
+ _arr18560[i]._field1 = 0;
+ _arr18560[i]._field3 = 0;
+ for (int j = 0; j < 8; j ++)
+ _arr18560[i]._field5[j] = 0;
+ }
}
void LilliputEngine::syncSoundSettings() {
@@ -355,6 +359,8 @@ Common::String LilliputEngine::getSavegameFilename(int slot) {
return _targetName + Common::String::format("-%02d.SAV", slot);
}
-
+byte LilliputEngine::_keyboard_getch() {
+ return ' ';
+}
} // End of namespace Lilliput
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
index d423c4cd95..389a20da2d 100644
--- a/engines/lilliput/lilliput.h
+++ b/engines/lilliput/lilliput.h
@@ -70,14 +70,7 @@ struct struct18560 {
byte _field0;
int16 _field1;
int16 _field3;
- int16 _field5;
- int16 _field7;
- int16 _field9;
- int16 _fieldB;
- int16 _fieldD;
- int16 _fieldF;
- int16 _field11;
- int16 _field13;
+ int16 _field5[8];
};
class LilliputEngine : public Engine {
@@ -94,6 +87,11 @@ public:
struct18560 _arr18560[4];
byte _vm_byte1714E;
+ byte _byte184F4;
+ byte _sound_byte16F06;
+ byte _byte16F09;
+ byte _keyboard_nextIndex;
+ byte _keyboard_oldIndex;
byte _buffer1[45056];
byte _buffer2[45056];
@@ -109,6 +107,9 @@ public:
int _word10800_ERULES;
int _word10807_ERULES;
+ int _vm_word12D3D;
+ int _vm_word12D3F;
+
byte *_rulesChunk1;
int _rulesBuffer2_1[40];
int _rulesBuffer2_2[40];
@@ -170,6 +171,11 @@ public:
Common::String getSavegameFilename(int slot);
void syncSoundSettings();
+ // Temporary stubs
+ byte _mouse_byte1299A;
+
+ byte _keyboard_getch();
+
protected:
// Engine APIs
diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp
index de05692fdd..461fb9b95c 100644
--- a/engines/lilliput/script.cpp
+++ b/engines/lilliput/script.cpp
@@ -32,7 +32,6 @@ LilliputScript::~LilliputScript() {
}
byte LilliputScript::handleOpcodeType1(int curWord) {
- warning("handleOpcodeType1: %d", curWord);
switch (curWord) {
case 0x0:
return OC_sub173DF();
@@ -191,7 +190,6 @@ byte LilliputScript::handleOpcodeType1(int curWord) {
}
void LilliputScript::handleOpcodeType2(int curWord) {
- warning("handleOpcodeType1: %d", curWord);
switch (curWord) {
case 0x0:
OC_setWord18821();
@@ -1004,7 +1002,7 @@ void LilliputScript::OC_displayVGAFile() {
int index = _vm->_rulesChunk3[curWord];
Common::String fileName = Common::String((const char *)&_vm->_rulesChunk4[index]);
_vm_word1881B = -1;
- warning("TODO: guess_displayFunction_VGAFile");
+ warning("TODO: guess_displayFunction_VGAFile(%s)", fileName.c_str());
warning("TODO: unkPaletteFunction_2");
}
void LilliputScript::OC_sub184D7() {
@@ -1012,6 +1010,36 @@ void LilliputScript::OC_sub184D7() {
}
void LilliputScript::OC_sub184F5() {
warning("OC_sub184F5");
+ _vm->_byte184F4 = (_currScript->readUint16LE() & 0xFF);
+ _vm->_sound_byte16F06 = _vm->_byte184F4;
+ // TODO: use a separated function when properly identified
+ _vm->_vm_word12D3D = 0;
+ _vm->_vm_word12D3F = 0;
+ //
+ _vm->_mouse_byte1299A = 0;
+ _vm->_byte16F09 = 0;
+
+ // TODO: Remove when the sound is hooked
+ _vm->_sound_byte16F06 = 0;
+ //
+
+ for (;;) {
+ warning("TODO: display function sub_185B4();");
+
+ if (_vm->_keyboard_nextIndex != _vm->_keyboard_oldIndex) {
+ _vm->_byte16F09 = _vm->_keyboard_getch();
+ _vm->_keyboard_getch();
+ break;
+ }
+
+ if (_vm->_mouse_byte1299A == 1)
+ break;
+
+ if ((_vm->_byte184F4 != 0) && (_vm->_sound_byte16F06 == 0))
+ break;
+ }
+
+ _vm->_mouse_byte1299A = 0;
}
void LilliputScript::OC_sub1853B() {
warning("OC_sub1853B");
@@ -1026,14 +1054,8 @@ void LilliputScript::OC_initArr18560() {
_vm->_arr18560[curWord]._field0 = 1;
_vm->_arr18560[curWord]._field1 = _currScript->readUint16LE();
_vm->_arr18560[curWord]._field3 = _currScript->readUint16LE();
- _vm->_arr18560[curWord]._field5 = _currScript->readUint16LE();
- _vm->_arr18560[curWord]._field7 = _currScript->readUint16LE();
- _vm->_arr18560[curWord]._field9 = _currScript->readUint16LE();
- _vm->_arr18560[curWord]._fieldB = _currScript->readUint16LE();
- _vm->_arr18560[curWord]._fieldD = _currScript->readUint16LE();
- _vm->_arr18560[curWord]._fieldF = _currScript->readUint16LE();
- _vm->_arr18560[curWord]._field11 = _currScript->readUint16LE();
- _vm->_arr18560[curWord]._field13 = _currScript->readUint16LE();
+ for (int i = 0; i < 8; i++)
+ _vm->_arr18560[curWord]._field5[i] = _currScript->readUint16LE();
}
void LilliputScript::OC_sub18678() {
warning("OC_sub18678");