From 4dd99da6dcebbe2e2ffc479da707a53f9fdaa64e Mon Sep 17 00:00:00 2001 From: Strangerke Date: Thu, 5 Apr 2012 00:00:59 +0200 Subject: LILLIPUT: Start implementing some functions --- engines/lilliput/lilliput.cpp | 4 ++-- engines/lilliput/lilliput.h | 15 +++++++++++++++ engines/lilliput/script.cpp | 40 +++++++++++++++++++++++++++++++++------- engines/lilliput/script.h | 9 +++++++-- 4 files changed, 57 insertions(+), 11 deletions(-) (limited to 'engines') diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp index 285f03c3a0..12399ba406 100644 --- a/engines/lilliput/lilliput.cpp +++ b/engines/lilliput/lilliput.cpp @@ -208,12 +208,12 @@ void LilliputEngine::loadRules() { _rulesChunk3_size = f.readSint16LE(); curWord = f.readSint16LE(); - warning("Pos %d", f.pos()); + 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", f.pos()); + 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(); diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h index 7080868215..d423c4cd95 100644 --- a/engines/lilliput/lilliput.h +++ b/engines/lilliput/lilliput.h @@ -66,6 +66,20 @@ enum LilliputDebugChannels { struct LilliputGameDescription; +struct struct18560 { + byte _field0; + int16 _field1; + int16 _field3; + int16 _field5; + int16 _field7; + int16 _field9; + int16 _fieldB; + int16 _fieldD; + int16 _fieldF; + int16 _field11; + int16 _field13; +}; + class LilliputEngine : public Engine { public: LilliputEngine(OSystem *syst, const LilliputGameDescription *gd); @@ -78,6 +92,7 @@ public: Common::RandomSource *_rnd; LilliputScript *_scriptHandler; + struct18560 _arr18560[4]; byte _vm_byte1714E; byte _buffer1[45056]; diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp index b8f1cc97ff..de05692fdd 100644 --- a/engines/lilliput/script.cpp +++ b/engines/lilliput/script.cpp @@ -25,7 +25,7 @@ namespace Lilliput { -LilliputScript::LilliputScript(LilliputEngine *vm) : _vm(vm) { +LilliputScript::LilliputScript(LilliputEngine *vm) : _vm(vm), _currScript(NULL) { } LilliputScript::~LilliputScript() { @@ -443,7 +443,7 @@ void LilliputScript::handleOpcodeType2(int curWord) { OC_sub1847F(); break; case 0x53: - OC_sub184AA(); + OC_displayVGAFile(); break; case 0x54: OC_sub184D7(); @@ -458,7 +458,7 @@ void LilliputScript::handleOpcodeType2(int curWord) { OC_sub1864D(); break; case 0x58: - OC_sub18608(); + OC_initArr18560(); break; case 0x59: OC_sub18678(); @@ -506,6 +506,7 @@ void LilliputScript::handleOpcodeType2(int curWord) { } int LilliputScript::handleOpcode(Common::MemoryReadStream script) { + _currScript = &script; uint16 curWord = script.readUint16LE(); if (curWord == 0xFFF6) return -1; @@ -994,8 +995,17 @@ void LilliputScript::OC_sub1844A() { void LilliputScript::OC_sub1847F() { warning("OC_sub1847F"); } -void LilliputScript::OC_sub184AA() { - warning("OC_sub184AA"); +void LilliputScript::OC_displayVGAFile() { + warning("OC_displayVGAFile"); + + _vm_byte12A09 = 1; + warning("TODO: unkPaletteFunction_1"); + int curWord = _currScript->readUint16LE(); + 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: unkPaletteFunction_2"); } void LilliputScript::OC_sub184D7() { warning("OC_sub184D7"); @@ -1009,8 +1019,21 @@ void LilliputScript::OC_sub1853B() { void LilliputScript::OC_sub1864D() { warning("OC_sub1864D"); } -void LilliputScript::OC_sub18608() { - warning("OC_sub18608"); +void LilliputScript::OC_initArr18560() { + warning("OC_initArr18560"); + int curWord = _currScript->readUint16LE(); + assert (curWord < 4); + _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(); } void LilliputScript::OC_sub18678() { warning("OC_sub18678"); @@ -1041,6 +1064,9 @@ void LilliputScript::OC_sub1873F_snd() { } void LilliputScript::OC_sub18746_snd() { warning("OC_sub18746_snd"); + int curWord = _currScript->readUint16LE(); + curWord = (2 << 8) + (curWord & 0xFF); + warning("TODO: ovlContentOVL Function 2, init DX and BX"); } void LilliputScript::OC_sub1875D_snd() { warning("OC_sub1875D_snd"); diff --git a/engines/lilliput/script.h b/engines/lilliput/script.h index 4ad9919e59..b90f61e826 100644 --- a/engines/lilliput/script.h +++ b/engines/lilliput/script.h @@ -37,7 +37,12 @@ public: private: LilliputEngine *_vm; + Common::MemoryReadStream *_currScript; + byte _byte16F05_ScriptHandler; + byte _vm_byte12A09; + + int16 _vm_word1881B; int handleOpcode(Common::MemoryReadStream script); byte handleOpcodeType1(int curWord); @@ -179,12 +184,12 @@ private: void OC_sub17E22(); void OC_sub1844A(); void OC_sub1847F(); - void OC_sub184AA(); + void OC_displayVGAFile(); void OC_sub184D7(); void OC_sub184F5(); void OC_sub1853B(); void OC_sub1864D(); - void OC_sub18608(); + void OC_initArr18560(); void OC_sub18678(); void OC_sub18690(); void OC_setWord10802(); -- cgit v1.2.3