Skip to content

Commit

Permalink
LILLIPUT: Implement some more opcodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke authored and sev- committed Mar 28, 2018
1 parent 6eccd8e commit 8023057
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 12 deletions.
2 changes: 2 additions & 0 deletions engines/lilliput/lilliput.cpp
Expand Up @@ -126,6 +126,8 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_skipDisplayFlag1 = 1;
_skipDisplayFlag2 = 0;
_displayMap = 0;
_debugFlag = 0;
_byte14837 = 0;

_scriptHandler = new LilliputScript(this);
_soundHandler = new LilliputSound(this);
Expand Down
2 changes: 2 additions & 0 deletions engines/lilliput/lilliput.h
Expand Up @@ -106,6 +106,8 @@ class LilliputEngine : public Engine {
byte _byte12FE3;
byte _byte16F08;
byte _byte15EAD;
byte _debugFlag; // Mostly useless, as the associated functions are empty
byte _byte14837; // Unused byte, set by an opcode

byte _array147D1[3];
byte _buffer1[45056];
Expand Down
67 changes: 56 additions & 11 deletions engines/lilliput/script.cpp
Expand Up @@ -467,7 +467,7 @@ void LilliputScript::handleOpcodeType2(int curWord) {
OC_sub18387();
break;
case 0x4B:
OC_setByte14835();
OC_setDebugFlag();
break;
case 0x4C:
OC_setByte14837();
Expand Down Expand Up @@ -2342,11 +2342,20 @@ void LilliputScript::OC_sub1801D() {
void LilliputScript::OC_sub1805D() {
warning("OC_sub1805D");
}

void LilliputScript::OC_sub18074() {
warning("OC_sub18074");
debugC(1, kDebugScript, "OC_sub18074()");

int var2 = _currScript->readUint16LE();
byte var1 = (_currScript->readUint16LE() & 0xFF);

_vm->_rulesBuffer2_16[(_vm->_rulesBuffer2PrevIndx * 32) + var2] = var1;
}

void LilliputScript::OC_sub1808B() {
warning("OC_sub1808B");
debugC(1, kDebugScript, "OC_sub1808B()");

_vm->_rulesBuffer2_9[_vm->_rulesBuffer2PrevIndx] = (_currScript->readUint16LE() & 0xFF);
}

void LilliputScript::OC_sub18099() {
Expand Down Expand Up @@ -2451,13 +2460,30 @@ void LilliputScript::OC_sub18213() {
}

void LilliputScript::OC_sub18252() {
warning("OC_sub18252");
debugC(1, kDebugScript, "OC_sub18252()");

int index = getValue1();
assert(index < 40);

_vm->_array12299[index] = 4;
}

void LilliputScript::OC_sub18260() {
warning("OC_sub18260");
}

void LilliputScript::OC_sub182EC() {
warning("OC_sub182EC");
debugC(1, kDebugScript, "OC_sub182EC()");

byte *tmpArr = getBuffer215Ptr();

byte var1 = (_currScript->readUint16LE() & 0xFF);
byte var2 = (_currScript->readUint16LE() & 0xFF);

if (var2 == 0)
tmpArr[0] = (0xFF ^ var1);
else
tmpArr[0] |= var1;
}

void LilliputScript::OC_PaletteFadeOut() {
Expand Down Expand Up @@ -2487,7 +2513,6 @@ void LilliputScript::OC_loadAndDisplayCUBESx_GFX() {
_vm->_bufferCubegfx = _vm->loadVGA(fileName, false);
_vm->displayFunction9();
_vm->displayFunction15();

}

void LilliputScript::OC_sub1834C() {
Expand All @@ -2505,8 +2530,15 @@ void LilliputScript::OC_sub18359() {
int var1 = _currScript->readUint16LE();
_array122C1[_vm->_rulesBuffer2PrevIndx] = var1;
}

void LilliputScript::OC_sub18367() {
warning("OC_sub18367");
debugC(1, kDebugScript, "OC_sub18367()");

_characterScriptEnabled[_vm->_rulesBuffer2PrevIndx] = 1;
_vm->_ptr_rulesBuffer2_15[0] = _array122C1[_vm->_rulesBuffer2PrevIndx];
_vm->_ptr_rulesBuffer2_15[1] = 0;
_vm->_ptr_rulesBuffer2_15[2] = 0;
_vm->_ptr_rulesBuffer2_15[3] = 0;
}

void LilliputScript::OC_sub17D04() {
Expand All @@ -2519,14 +2551,27 @@ void LilliputScript::OC_sub17D04() {
}

void LilliputScript::OC_sub18387() {
warning("OC_sub18387");
debugC(1, kDebugScript, "OC_sub18387()");

int index = getValue1();
byte var1 = _currScript->readUint16LE() & 0xFF;

assert(index < 40);
_vm->_rulesBuffer2_10[index] = var1;
}
void LilliputScript::OC_setByte14835() {
warning("OC_setByte14835");

void LilliputScript::OC_setDebugFlag() {
debugC(1, kDebugScript, "OC_setDebugFlag()");

_vm->_debugFlag = 1;
}

void LilliputScript::OC_setByte14837() {
warning("OC_setByte14837");
debugC(1, kDebugScript, "OC_setByte14837()");

_vm->_byte14837 = 1;
}

void LilliputScript::OC_sub183A2() {
warning("OC_sub183A2");
}
Expand Down
2 changes: 1 addition & 1 deletion engines/lilliput/script.h
Expand Up @@ -251,7 +251,7 @@ class LilliputScript {
void OC_sub18367();
void OC_sub17D04();
void OC_sub18387();
void OC_setByte14835();
void OC_setDebugFlag();
void OC_setByte14837();
void OC_sub183A2();
void OC_sub183C6();
Expand Down

0 comments on commit 8023057

Please sign in to comment.