LILLIPUT: Split palette functions, implement some core functions
This commit is contained in:
parent
dd81316528
commit
974c223a43
4 changed files with 117 additions and 40 deletions
|
@ -125,6 +125,7 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
|
||||||
_savedMousePosDivided = 0xFFFF;
|
_savedMousePosDivided = 0xFFFF;
|
||||||
_skipDisplayFlag1 = 1;
|
_skipDisplayFlag1 = 1;
|
||||||
_skipDisplayFlag2 = 0;
|
_skipDisplayFlag2 = 0;
|
||||||
|
_displayMap = 0;
|
||||||
|
|
||||||
_scriptHandler = new LilliputScript(this);
|
_scriptHandler = new LilliputScript(this);
|
||||||
_soundHandler = new LilliputSound(this);
|
_soundHandler = new LilliputSound(this);
|
||||||
|
@ -450,7 +451,7 @@ void LilliputEngine::displayFunction7() {
|
||||||
void LilliputEngine::displayFunction8() {
|
void LilliputEngine::displayFunction8() {
|
||||||
debugC(2, kDebugEngine, "displayFunction8()");
|
debugC(2, kDebugEngine, "displayFunction8()");
|
||||||
|
|
||||||
if (_scriptHandler->displayMap == 1)
|
if (_displayMap == 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
displayFunction5();
|
displayFunction5();
|
||||||
|
@ -617,7 +618,7 @@ void LilliputEngine::displayFunction13(byte *buf, int var1, int var2, int var3)
|
||||||
void LilliputEngine::displayFunction14() {
|
void LilliputEngine::displayFunction14() {
|
||||||
debugC(2, kDebugEngine, "displayFunction14()");
|
debugC(2, kDebugEngine, "displayFunction14()");
|
||||||
|
|
||||||
if (_scriptHandler->displayMap == 1)
|
if (_displayMap == 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_mouseDisplayX > 48)
|
if (_mouseDisplayX > 48)
|
||||||
|
@ -778,8 +779,12 @@ void LilliputEngine::displayFunction15() {
|
||||||
void LilliputEngine::displayFunction16() {
|
void LilliputEngine::displayFunction16() {
|
||||||
debugC(2, kDebugEngine, "displayFunction16()");
|
debugC(2, kDebugEngine, "displayFunction16()");
|
||||||
|
|
||||||
if (_scriptHandler->displayMap == 1) {
|
if (_displayMap == 1) {
|
||||||
warning("sub_15F31");
|
bool forceReturnFl = false;
|
||||||
|
sub15F31(forceReturnFl);
|
||||||
|
if (forceReturnFl)
|
||||||
|
return;
|
||||||
|
|
||||||
restoreMapPoints();
|
restoreMapPoints();
|
||||||
sub16626();
|
sub16626();
|
||||||
sub12F37();
|
sub12F37();
|
||||||
|
@ -803,8 +808,46 @@ void LilliputEngine::displayFunction16() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int LilliputEngine::sub16DD5(int x1, int y1, int x2, int y2)
|
void LilliputEngine::sub1863B() {
|
||||||
{
|
_arr18560[0]._field0 = 0;
|
||||||
|
_arr18560[1]._field0 = 0;
|
||||||
|
_arr18560[2]._field0 = 0;
|
||||||
|
_arr18560[3]._field0 = 0;
|
||||||
|
_scriptHandler->_word1855E = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LilliputEngine::paletteFadeOut() {
|
||||||
|
debugC(2, kDebugEngine, "paletteFadeOut()");
|
||||||
|
|
||||||
|
sub1863B();
|
||||||
|
byte palette[768];
|
||||||
|
for (int fade = 256; fade >= 0; fade -= 8) {
|
||||||
|
for (int i = 0; i < 768; i++) {
|
||||||
|
palette[i] = (_curPalette[i] * fade) >> 8;
|
||||||
|
}
|
||||||
|
_system->getPaletteManager()->setPalette(palette, 0, 256);
|
||||||
|
_system->updateScreen();
|
||||||
|
_system->delayMillis(20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LilliputEngine::paletteFadeIn() {
|
||||||
|
debugC(2, kDebugEngine, "paletteFadeIn()");
|
||||||
|
|
||||||
|
byte palette[768];
|
||||||
|
for (int fade = 8; fade <= 256; fade += 8) {
|
||||||
|
for (int i = 0; i < 768; i++) {
|
||||||
|
palette[i] = (_curPalette[i] * fade) >> 8;
|
||||||
|
}
|
||||||
|
_system->getPaletteManager()->setPalette(palette, 0, 256);
|
||||||
|
_system->updateScreen();
|
||||||
|
_system->delayMillis(20);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int LilliputEngine::sub16DD5(int x1, int y1, int x2, int y2) {
|
||||||
|
debugC(2, kDebugEngine, "sub16DD5(%d, %d, %d, %d)", x1, y1, x2, y2);
|
||||||
|
|
||||||
byte *isoMap = _bufferIsoMap + (x1 << 8) + (y1 << 2) + 1;
|
byte *isoMap = _bufferIsoMap + (x1 << 8) + (y1 << 2) + 1;
|
||||||
|
|
||||||
int dx = x2 - x1;
|
int dx = x2 - x1;
|
||||||
|
@ -868,6 +911,57 @@ int LilliputEngine::sub16DD5(int x1, int y1, int x2, int y2)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LilliputEngine::sub15F75() {
|
||||||
|
debugC(2, kDebugEngine, "sub15F75()");
|
||||||
|
|
||||||
|
_byte129A0 = 0xFF;
|
||||||
|
_savedMousePosDivided = 0xFFFF;
|
||||||
|
byte newX = _mouseX >> 2;
|
||||||
|
byte newY = _mouseY / 3;
|
||||||
|
|
||||||
|
if ((newX >= 64) || (newY >= 64))
|
||||||
|
return;
|
||||||
|
|
||||||
|
_savedMousePosDivided = (newX << 8) + newY;
|
||||||
|
_byte16F07_menuId = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LilliputEngine::sub130B6() {
|
||||||
|
debugC(2, kDebugEngine, "sub130B6()");
|
||||||
|
|
||||||
|
for (int index = 0; index < _word12F68_ERULES; index++) {
|
||||||
|
if (_scriptHandler->_array122E9[index] == 3)
|
||||||
|
_scriptHandler->_array122E9[index] = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void LilliputEngine::sub15F31(bool &forceReturnFl) {
|
||||||
|
debugC(2, kDebugEngine, "sub15F31()");
|
||||||
|
|
||||||
|
forceReturnFl = false;
|
||||||
|
if (_displayMap != 1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pollEvent();
|
||||||
|
warning("sub15F31- TODO: Check keyboard");
|
||||||
|
|
||||||
|
if ((_mouseButton & 1) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
_mouseButton = 0;
|
||||||
|
sub15F75();
|
||||||
|
|
||||||
|
_displayMap = 0;
|
||||||
|
paletteFadeOut();
|
||||||
|
_word15AC2 = 0;
|
||||||
|
sub130B6();
|
||||||
|
displayFunction12();
|
||||||
|
_scriptHandler->_heroismLevel = 0;
|
||||||
|
sub16217();
|
||||||
|
paletteFadeIn();
|
||||||
|
forceReturnFl = true;
|
||||||
|
}
|
||||||
|
|
||||||
void LilliputEngine::sub16CA0() {
|
void LilliputEngine::sub16CA0() {
|
||||||
debugC(2, kDebugEngine, "sub16CA0()");
|
debugC(2, kDebugEngine, "sub16CA0()");
|
||||||
|
|
||||||
|
|
|
@ -123,6 +123,7 @@ public:
|
||||||
|
|
||||||
bool _saveFlag;
|
bool _saveFlag;
|
||||||
bool _int8installed;
|
bool _int8installed;
|
||||||
|
byte _displayMap;
|
||||||
|
|
||||||
int _word10800_ERULES;
|
int _word10800_ERULES;
|
||||||
int _numCharacters;
|
int _numCharacters;
|
||||||
|
@ -232,6 +233,11 @@ public:
|
||||||
void displayFunction18(int index, int x, int y, int flags);
|
void displayFunction18(int index, int x, int y, int flags);
|
||||||
void displayString(byte *buf, int var2, int var4);
|
void displayString(byte *buf, int var2, int var4);
|
||||||
void displayChar(int index, int var1);
|
void displayChar(int index, int var1);
|
||||||
|
void sub130B6();
|
||||||
|
void sub15F75();
|
||||||
|
void sub1863B();
|
||||||
|
void paletteFadeOut();
|
||||||
|
void paletteFadeIn();
|
||||||
|
|
||||||
void sortCharacters();
|
void sortCharacters();
|
||||||
void scrollToViewportCharacterTarget();
|
void scrollToViewportCharacterTarget();
|
||||||
|
@ -265,6 +271,7 @@ public:
|
||||||
void sub1546F(byte displayX, byte displayY);
|
void sub1546F(byte displayX, byte displayY);
|
||||||
void sub15498(byte x, byte y, int var2);
|
void sub15498(byte x, byte y, int var2);
|
||||||
void sub15A4C(int &vgaIndex, byte *srcBuf, int &bufIndex);
|
void sub15A4C(int &vgaIndex, byte *srcBuf, int &bufIndex);
|
||||||
|
void sub15F31(bool &forceReturnFl);
|
||||||
|
|
||||||
void initGame(const LilliputGameDescription *gd);
|
void initGame(const LilliputGameDescription *gd);
|
||||||
byte *loadVGA(Common::String filename, bool loadPal);
|
byte *loadVGA(Common::String filename, bool loadPal);
|
||||||
|
|
|
@ -30,7 +30,6 @@ namespace Lilliput {
|
||||||
|
|
||||||
LilliputScript::LilliputScript(LilliputEngine *vm) : _vm(vm), _currScript(NULL) {
|
LilliputScript::LilliputScript(LilliputEngine *vm) : _vm(vm), _currScript(NULL) {
|
||||||
_byte129A0 = 0xFF;
|
_byte129A0 = 0xFF;
|
||||||
displayMap = 0;
|
|
||||||
_byte1855D = 0;
|
_byte1855D = 0;
|
||||||
_byte12A04 = 0;
|
_byte12A04 = 0;
|
||||||
_byte10806 = 0;
|
_byte10806 = 0;
|
||||||
|
@ -764,14 +763,6 @@ void LilliputScript::runMenuScript(ScriptStream script) {
|
||||||
_vm->update();
|
_vm->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LilliputScript::sub1863B() {
|
|
||||||
_vm->_arr18560[0]._field0 = 0;
|
|
||||||
_vm->_arr18560[1]._field0 = 0;
|
|
||||||
_vm->_arr18560[2]._field0 = 0;
|
|
||||||
_vm->_arr18560[3]._field0 = 0;
|
|
||||||
_word1855E = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void LilliputScript::sub185ED(byte index, byte subIndex) {
|
void LilliputScript::sub185ED(byte index, byte subIndex) {
|
||||||
debugC(2, kDebugScript, "sub185ED");
|
debugC(2, kDebugScript, "sub185ED");
|
||||||
if (_vm->_arr18560[index]._field0 != 1)
|
if (_vm->_arr18560[index]._field0 != 1)
|
||||||
|
@ -929,7 +920,7 @@ void LilliputScript::sub17D40(bool &forceReturnFl) {
|
||||||
debugC(1, kDebugScript, "sub17D40()");
|
debugC(1, kDebugScript, "sub17D40()");
|
||||||
|
|
||||||
forceReturnFl = false;
|
forceReturnFl = false;
|
||||||
if ((displayMap != 1) && (_vm->_characterRelativePositionX[_vm->_rulesBuffer2PrevIndx] != 0xFF))
|
if ((_vm->_displayMap != 1) && (_vm->_characterRelativePositionX[_vm->_rulesBuffer2PrevIndx] != 0xFF))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
forceReturnFl = true;
|
forceReturnFl = true;
|
||||||
|
@ -2472,30 +2463,17 @@ void LilliputScript::OC_sub182EC() {
|
||||||
void LilliputScript::OC_PaletteFadeOut() {
|
void LilliputScript::OC_PaletteFadeOut() {
|
||||||
debugC(1, kDebugScript, "OC_PaletteFadeOut()");
|
debugC(1, kDebugScript, "OC_PaletteFadeOut()");
|
||||||
|
|
||||||
sub1863B();
|
_byte12A09 = 1;
|
||||||
byte palette[768];
|
_vm->paletteFadeOut();
|
||||||
for (int fade = 256; fade >= 0; fade -= 8) {
|
_byte12A09 = 0;
|
||||||
for (int i = 0; i < 768; i++) {
|
|
||||||
palette[i] = (_vm->_curPalette[i] * fade) >> 8;
|
|
||||||
}
|
|
||||||
_vm->_system->getPaletteManager()->setPalette(palette, 0, 256);
|
|
||||||
_vm->_system->updateScreen();
|
|
||||||
_vm->_system->delayMillis(20);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LilliputScript::OC_PaletteFadeIn() {
|
void LilliputScript::OC_PaletteFadeIn() {
|
||||||
debugC(1, kDebugScript, "OC_PaletteFadeIn()");
|
debugC(1, kDebugScript, "OC_PaletteFadeIn()");
|
||||||
|
|
||||||
byte palette[768];
|
_byte12A09 = 1;
|
||||||
for (int fade = 8; fade <= 256; fade += 8) {
|
_vm->paletteFadeIn();
|
||||||
for (int i = 0; i < 768; i++) {
|
_byte12A09 = 0;
|
||||||
palette[i] = (_vm->_curPalette[i] * fade) >> 8;
|
|
||||||
}
|
|
||||||
_vm->_system->getPaletteManager()->setPalette(palette, 0, 256);
|
|
||||||
_vm->_system->updateScreen();
|
|
||||||
_vm->_system->delayMillis(20);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LilliputScript::OC_loadAndDisplayCUBESx_GFX() {
|
void LilliputScript::OC_loadAndDisplayCUBESx_GFX() {
|
||||||
|
@ -2594,7 +2572,7 @@ void LilliputScript::OC_sub1847F() {
|
||||||
int var2 = _currScript->readUint16LE();
|
int var2 = _currScript->readUint16LE();
|
||||||
int var4 = _currScript->readUint16LE();
|
int var4 = _currScript->readUint16LE();
|
||||||
|
|
||||||
if (displayMap != 1) {
|
if (_vm->_displayMap != 1) {
|
||||||
_vm->displayFunction5();
|
_vm->displayFunction5();
|
||||||
sub18BE6(var1 & 0xFF, var2, var4);
|
sub18BE6(var1 & 0xFF, var2, var4);
|
||||||
_vm->displayFunction4();
|
_vm->displayFunction4();
|
||||||
|
@ -2667,7 +2645,7 @@ void LilliputScript::OC_sub1853B() {
|
||||||
debugC(1, kDebugScript, "OC_sub1853B()");
|
debugC(1, kDebugScript, "OC_sub1853B()");
|
||||||
|
|
||||||
OC_PaletteFadeOut();
|
OC_PaletteFadeOut();
|
||||||
displayMap = 0;
|
_vm->_displayMap = 0;
|
||||||
_heroismLevel = 0;
|
_heroismLevel = 0;
|
||||||
sub130B6();
|
sub130B6();
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,6 @@ class LilliputEngine;
|
||||||
|
|
||||||
class LilliputScript {
|
class LilliputScript {
|
||||||
public:
|
public:
|
||||||
byte displayMap;
|
|
||||||
byte _byte12A04;
|
byte _byte12A04;
|
||||||
byte _heroismLevel;
|
byte _heroismLevel;
|
||||||
|
|
||||||
|
@ -57,6 +56,7 @@ public:
|
||||||
int _word1881B;
|
int _word1881B;
|
||||||
int _heroismBarX;
|
int _heroismBarX;
|
||||||
int _heroismBarBottomY;
|
int _heroismBarBottomY;
|
||||||
|
int _word1855E;
|
||||||
|
|
||||||
short _array12311[640];
|
short _array12311[640];
|
||||||
byte _array128EF[40];
|
byte _array128EF[40];
|
||||||
|
@ -92,14 +92,12 @@ private:
|
||||||
|
|
||||||
int _word16F00;
|
int _word16F00;
|
||||||
int _word10804;
|
int _word10804;
|
||||||
int _word1855E;
|
|
||||||
int _word18776;
|
int _word18776;
|
||||||
|
|
||||||
int handleOpcode(ScriptStream *script);
|
int handleOpcode(ScriptStream *script);
|
||||||
byte handleOpcodeType1(int curWord);
|
byte handleOpcodeType1(int curWord);
|
||||||
void handleOpcodeType2(int curWord);
|
void handleOpcodeType2(int curWord);
|
||||||
|
|
||||||
void sub1863B();
|
|
||||||
void sub185ED(byte index, byte subIndex);
|
void sub185ED(byte index, byte subIndex);
|
||||||
void sub185B4_display();
|
void sub185B4_display();
|
||||||
void sub1823E(byte var1, byte var2, byte *curBufPtr);
|
void sub1823E(byte var1, byte var2, byte *curBufPtr);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue