LILLIPUT: Implement OC_sub184F5, modify struct18560
This commit is contained in:
parent
4dd99da6dc
commit
17320cadb7
3 changed files with 58 additions and 24 deletions
|
@ -204,22 +204,18 @@ void LilliputEngine::loadRules() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Chunk 3 & 4
|
// Chunk 3 & 4
|
||||||
warning("Chunk 3 & 4 Pos: %d", f.pos());
|
|
||||||
_rulesChunk3_size = f.readSint16LE();
|
_rulesChunk3_size = f.readSint16LE();
|
||||||
curWord = f.readSint16LE();
|
curWord = f.readSint16LE();
|
||||||
|
|
||||||
warning("Pos %d - size chunk3: %d", f.pos(), _rulesChunk3_size);
|
|
||||||
_rulesChunk3 = (int *)malloc(sizeof(int) * _rulesChunk3_size);
|
_rulesChunk3 = (int *)malloc(sizeof(int) * _rulesChunk3_size);
|
||||||
for (int i = 0; i < _rulesChunk3_size; ++i)
|
for (int i = 0; i < _rulesChunk3_size; ++i)
|
||||||
_rulesChunk3[i] = f.readUint16LE();
|
_rulesChunk3[i] = f.readUint16LE();
|
||||||
|
|
||||||
warning("Pos %d - size chunk4: %d", f.pos(), curWord);
|
|
||||||
_rulesChunk4 = (byte *)malloc(sizeof(byte) * curWord);
|
_rulesChunk4 = (byte *)malloc(sizeof(byte) * curWord);
|
||||||
for (int i = 0; i < curWord; ++i)
|
for (int i = 0; i < curWord; ++i)
|
||||||
_rulesChunk4[i] = f.readByte();
|
_rulesChunk4[i] = f.readByte();
|
||||||
|
|
||||||
// Chunk 5: Scripts
|
// Chunk 5: Scripts
|
||||||
warning("Chunk 5 Pos: %d", f.pos());
|
|
||||||
// Use byte instead of int, therefore multiply by two the size.
|
// Use byte instead of int, therefore multiply by two the size.
|
||||||
// This is for changing that into a memory read stream
|
// This is for changing that into a memory read stream
|
||||||
_rulesScript_size = f.readUint16LE() * 2;
|
_rulesScript_size = f.readUint16LE() * 2;
|
||||||
|
@ -343,6 +339,14 @@ void LilliputEngine::initialize() {
|
||||||
|
|
||||||
_rnd = new Common::RandomSource("robin");
|
_rnd = new Common::RandomSource("robin");
|
||||||
_rnd->setSeed(42); // Kick random number generator
|
_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() {
|
void LilliputEngine::syncSoundSettings() {
|
||||||
|
@ -355,6 +359,8 @@ Common::String LilliputEngine::getSavegameFilename(int slot) {
|
||||||
return _targetName + Common::String::format("-%02d.SAV", slot);
|
return _targetName + Common::String::format("-%02d.SAV", slot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
byte LilliputEngine::_keyboard_getch() {
|
||||||
|
return ' ';
|
||||||
|
}
|
||||||
|
|
||||||
} // End of namespace Lilliput
|
} // End of namespace Lilliput
|
||||||
|
|
|
@ -70,14 +70,7 @@ struct struct18560 {
|
||||||
byte _field0;
|
byte _field0;
|
||||||
int16 _field1;
|
int16 _field1;
|
||||||
int16 _field3;
|
int16 _field3;
|
||||||
int16 _field5;
|
int16 _field5[8];
|
||||||
int16 _field7;
|
|
||||||
int16 _field9;
|
|
||||||
int16 _fieldB;
|
|
||||||
int16 _fieldD;
|
|
||||||
int16 _fieldF;
|
|
||||||
int16 _field11;
|
|
||||||
int16 _field13;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class LilliputEngine : public Engine {
|
class LilliputEngine : public Engine {
|
||||||
|
@ -94,6 +87,11 @@ public:
|
||||||
|
|
||||||
struct18560 _arr18560[4];
|
struct18560 _arr18560[4];
|
||||||
byte _vm_byte1714E;
|
byte _vm_byte1714E;
|
||||||
|
byte _byte184F4;
|
||||||
|
byte _sound_byte16F06;
|
||||||
|
byte _byte16F09;
|
||||||
|
byte _keyboard_nextIndex;
|
||||||
|
byte _keyboard_oldIndex;
|
||||||
|
|
||||||
byte _buffer1[45056];
|
byte _buffer1[45056];
|
||||||
byte _buffer2[45056];
|
byte _buffer2[45056];
|
||||||
|
@ -109,6 +107,9 @@ public:
|
||||||
|
|
||||||
int _word10800_ERULES;
|
int _word10800_ERULES;
|
||||||
int _word10807_ERULES;
|
int _word10807_ERULES;
|
||||||
|
int _vm_word12D3D;
|
||||||
|
int _vm_word12D3F;
|
||||||
|
|
||||||
byte *_rulesChunk1;
|
byte *_rulesChunk1;
|
||||||
int _rulesBuffer2_1[40];
|
int _rulesBuffer2_1[40];
|
||||||
int _rulesBuffer2_2[40];
|
int _rulesBuffer2_2[40];
|
||||||
|
@ -170,6 +171,11 @@ public:
|
||||||
Common::String getSavegameFilename(int slot);
|
Common::String getSavegameFilename(int slot);
|
||||||
void syncSoundSettings();
|
void syncSoundSettings();
|
||||||
|
|
||||||
|
// Temporary stubs
|
||||||
|
byte _mouse_byte1299A;
|
||||||
|
|
||||||
|
byte _keyboard_getch();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
// Engine APIs
|
// Engine APIs
|
||||||
|
|
|
@ -32,7 +32,6 @@ LilliputScript::~LilliputScript() {
|
||||||
}
|
}
|
||||||
|
|
||||||
byte LilliputScript::handleOpcodeType1(int curWord) {
|
byte LilliputScript::handleOpcodeType1(int curWord) {
|
||||||
warning("handleOpcodeType1: %d", curWord);
|
|
||||||
switch (curWord) {
|
switch (curWord) {
|
||||||
case 0x0:
|
case 0x0:
|
||||||
return OC_sub173DF();
|
return OC_sub173DF();
|
||||||
|
@ -191,7 +190,6 @@ byte LilliputScript::handleOpcodeType1(int curWord) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LilliputScript::handleOpcodeType2(int curWord) {
|
void LilliputScript::handleOpcodeType2(int curWord) {
|
||||||
warning("handleOpcodeType1: %d", curWord);
|
|
||||||
switch (curWord) {
|
switch (curWord) {
|
||||||
case 0x0:
|
case 0x0:
|
||||||
OC_setWord18821();
|
OC_setWord18821();
|
||||||
|
@ -1004,7 +1002,7 @@ void LilliputScript::OC_displayVGAFile() {
|
||||||
int index = _vm->_rulesChunk3[curWord];
|
int index = _vm->_rulesChunk3[curWord];
|
||||||
Common::String fileName = Common::String((const char *)&_vm->_rulesChunk4[index]);
|
Common::String fileName = Common::String((const char *)&_vm->_rulesChunk4[index]);
|
||||||
_vm_word1881B = -1;
|
_vm_word1881B = -1;
|
||||||
warning("TODO: guess_displayFunction_VGAFile");
|
warning("TODO: guess_displayFunction_VGAFile(%s)", fileName.c_str());
|
||||||
warning("TODO: unkPaletteFunction_2");
|
warning("TODO: unkPaletteFunction_2");
|
||||||
}
|
}
|
||||||
void LilliputScript::OC_sub184D7() {
|
void LilliputScript::OC_sub184D7() {
|
||||||
|
@ -1012,6 +1010,36 @@ void LilliputScript::OC_sub184D7() {
|
||||||
}
|
}
|
||||||
void LilliputScript::OC_sub184F5() {
|
void LilliputScript::OC_sub184F5() {
|
||||||
warning("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() {
|
void LilliputScript::OC_sub1853B() {
|
||||||
warning("OC_sub1853B");
|
warning("OC_sub1853B");
|
||||||
|
@ -1026,14 +1054,8 @@ void LilliputScript::OC_initArr18560() {
|
||||||
_vm->_arr18560[curWord]._field0 = 1;
|
_vm->_arr18560[curWord]._field0 = 1;
|
||||||
_vm->_arr18560[curWord]._field1 = _currScript->readUint16LE();
|
_vm->_arr18560[curWord]._field1 = _currScript->readUint16LE();
|
||||||
_vm->_arr18560[curWord]._field3 = _currScript->readUint16LE();
|
_vm->_arr18560[curWord]._field3 = _currScript->readUint16LE();
|
||||||
_vm->_arr18560[curWord]._field5 = _currScript->readUint16LE();
|
for (int i = 0; i < 8; i++)
|
||||||
_vm->_arr18560[curWord]._field7 = _currScript->readUint16LE();
|
_vm->_arr18560[curWord]._field5[i] = _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() {
|
void LilliputScript::OC_sub18678() {
|
||||||
warning("OC_sub18678");
|
warning("OC_sub18678");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue