LILLIPUT: Some renaming. Start using Common::Point
This commit is contained in:
parent
0eea1447d3
commit
e2de970a1a
4 changed files with 108 additions and 122 deletions
|
@ -115,12 +115,9 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
|
||||||
_console = new LilliputConsole(this);
|
_console = new LilliputConsole(this);
|
||||||
_rnd = 0;
|
_rnd = 0;
|
||||||
_int8installed = false;
|
_int8installed = false;
|
||||||
_mouseX = 0;
|
_mousePos = Common::Point(0, 0);
|
||||||
_mouseY = 0;
|
_oldMousePos = Common::Point(0, 0);
|
||||||
_oldMouseX = 0;
|
_mouseDisplayPos = Common::Point(0, 0);
|
||||||
_oldMouseY = 0;
|
|
||||||
_mouseDisplayX = 0;
|
|
||||||
_mouseDisplayY = 0;
|
|
||||||
_mouseButton = 0;
|
_mouseButton = 0;
|
||||||
_savedMousePosDivided = 0xFFFF;
|
_savedMousePosDivided = 0xFFFF;
|
||||||
_skipDisplayFlag1 = 1;
|
_skipDisplayFlag1 = 1;
|
||||||
|
@ -158,11 +155,8 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
|
||||||
_word17081_nextIndex = 0;
|
_word17081_nextIndex = 0;
|
||||||
_word16EFE = 0xFFFF;
|
_word16EFE = 0xFFFF;
|
||||||
_word1817B = 0;
|
_word1817B = 0;
|
||||||
_word15BC8 = 0;
|
_word15BC8Pos = Common::Point(0, 0);
|
||||||
_word15BCA = 0;
|
|
||||||
_word15AC2 = 0;
|
_word15AC2 = 0;
|
||||||
_word16213 = 0;
|
|
||||||
_word16215 = 0;
|
|
||||||
_word15AC2 = 0;
|
_word15AC2 = 0;
|
||||||
_displayStringIndex = 0;
|
_displayStringIndex = 0;
|
||||||
_word1289D = 0;
|
_word1289D = 0;
|
||||||
|
@ -345,14 +339,14 @@ void LilliputEngine::displayCharacter(int index, int x, int y, int flags) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// display mouse cursor, if any
|
// display mouse cursor, if any
|
||||||
void LilliputEngine::displayFunction1(byte *buf, int var1, int var2, int var4) {
|
void LilliputEngine::displayFunction1(byte *buf, int var1, Common::Point pos) {
|
||||||
debugC(2, kDebugEngine, "displayFunction1(buf, %d, %d, %d)", var1, var2, var4);
|
debugC(2, kDebugEngine, "displayFunction1(buf, %d, %d, %d)", var1, pos.x, pos.y);
|
||||||
|
|
||||||
int index1 = ((var1 & 0xFF) << 8) + (var1 >> 8);
|
int index1 = ((var1 & 0xFF) << 8) + (var1 >> 8);
|
||||||
byte *newBuf = &buf[index1];
|
byte *newBuf = &buf[index1];
|
||||||
|
|
||||||
int tmpVal = ((var4 & 0xFF) << 8) + (var4 >> 8);
|
int tmpVal = ((pos.y & 0xFF) << 8) + (pos.y >> 8);
|
||||||
int index2 = var2 + tmpVal + (tmpVal >> 2);
|
int index2 = pos.x + tmpVal + (tmpVal >> 2);
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
for (int j = 0; j < 16; j++) {
|
for (int j = 0; j < 16; j++) {
|
||||||
|
@ -366,18 +360,18 @@ void LilliputEngine::displayFunction1(byte *buf, int var1, int var2, int var4) {
|
||||||
_system->updateScreen();
|
_system->updateScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LilliputEngine::displayFunction1a(byte *buf, int var2, int var4) {
|
void LilliputEngine::displayFunction1a(byte *buf, Common::Point pos) {
|
||||||
debugC(2, kDebugEngine, "displayFunction1a(buf, %d, %d)", var2, var4);
|
debugC(2, kDebugEngine, "displayFunction1a(buf, %d, %d)", pos.x, pos.y);
|
||||||
|
|
||||||
displayFunction1(buf, 0, var2, var4);
|
displayFunction1(buf, 0, pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
// save area under mouse cursor
|
// save area under mouse cursor
|
||||||
void LilliputEngine::displayFunction2(byte *buf, int var2, int var4) {
|
void LilliputEngine::displayFunction2(byte *buf, Common::Point pos) {
|
||||||
debugC(2, kDebugEngine, "displayFunction2(buf, %d, %d)", var2, var4);
|
debugC(2, kDebugEngine, "displayFunction2(buf, %d, %d)", pos.x, pos.y);
|
||||||
|
|
||||||
int tmpVal = ((var4 & 0xFF) << 8) + (var4 >> 8);
|
int tmpVal = ((pos.y & 0xFF) << 8) + (pos.y >> 8);
|
||||||
int index2 = var2 + tmpVal + (tmpVal >> 2);
|
int index2 = pos.x + tmpVal + (tmpVal >> 2);
|
||||||
|
|
||||||
for (int i = 0; i < 16; i++) {
|
for (int i = 0; i < 16; i++) {
|
||||||
for (int j = 0; j < 16; j++) {
|
for (int j = 0; j < 16; j++) {
|
||||||
|
@ -409,12 +403,9 @@ void LilliputEngine::displayFunction4() {
|
||||||
if ((_skipDisplayFlag1 != 1) && (_skipDisplayFlag2 != 1)) {
|
if ((_skipDisplayFlag1 != 1) && (_skipDisplayFlag2 != 1)) {
|
||||||
_skipDisplayFlag2 = 1;
|
_skipDisplayFlag2 = 1;
|
||||||
|
|
||||||
_word15BC8 = _mouseDisplayX;
|
_word15BC8Pos = _mouseDisplayPos;
|
||||||
_word15BCA = _mouseDisplayY;
|
displayFunction2(_array15AC8, _mouseDisplayPos);
|
||||||
|
displayFunction1(_bufferIdeogram, _word15AC2 + 80, _mouseDisplayPos);
|
||||||
displayFunction2(_array15AC8, _mouseDisplayX, _mouseDisplayY);
|
|
||||||
|
|
||||||
displayFunction1(_bufferIdeogram, _word15AC2 + 80, _mouseDisplayX, _mouseDisplayY);
|
|
||||||
|
|
||||||
_skipDisplayFlag1 = 1;
|
_skipDisplayFlag1 = 1;
|
||||||
_skipDisplayFlag2 = 0;
|
_skipDisplayFlag2 = 0;
|
||||||
|
@ -426,7 +417,7 @@ void LilliputEngine::displayFunction5() {
|
||||||
|
|
||||||
if ((_skipDisplayFlag1 != 0) && (_skipDisplayFlag2 != 1)) {
|
if ((_skipDisplayFlag1 != 0) && (_skipDisplayFlag2 != 1)) {
|
||||||
_skipDisplayFlag2 = 1;
|
_skipDisplayFlag2 = 1;
|
||||||
displayFunction1a(_array15AC8, _word15BC8, _word15BCA);
|
displayFunction1a(_array15AC8, _word15BC8Pos);
|
||||||
_skipDisplayFlag1 = 0;
|
_skipDisplayFlag1 = 0;
|
||||||
_skipDisplayFlag2 = 0;
|
_skipDisplayFlag2 = 0;
|
||||||
}
|
}
|
||||||
|
@ -464,8 +455,8 @@ void LilliputEngine::displayFunction7() {
|
||||||
displayFunction4();
|
displayFunction4();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LilliputEngine::displayFunction8() {
|
void LilliputEngine::displayInterfaceHotspots() {
|
||||||
debugC(2, kDebugEngine, "displayFunction8()");
|
debugC(2, kDebugEngine, "displayInterfaceHotspots()");
|
||||||
|
|
||||||
if (_displayMap == 1)
|
if (_displayMap == 1)
|
||||||
return;
|
return;
|
||||||
|
@ -476,7 +467,7 @@ void LilliputEngine::displayFunction8() {
|
||||||
int tmpVal;
|
int tmpVal;
|
||||||
for (index = 0; index < _word12F68_ERULES; index++) {
|
for (index = 0; index < _word12F68_ERULES; index++) {
|
||||||
tmpVal = ((_scriptHandler->_array122E9[index] << 2) + (_scriptHandler->_array122E9[index] << 4)) & 0xFF;
|
tmpVal = ((_scriptHandler->_array122E9[index] << 2) + (_scriptHandler->_array122E9[index] << 4)) & 0xFF;
|
||||||
displayFunction1(_bufferIdeogram, tmpVal + index, _rulesBuffer13_2[index], _rulesBuffer13_3[index]);
|
displayFunction1(_bufferIdeogram, tmpVal + index, Common::Point(_interfaceHotspotsX[index], _interfaceHotspotsY[index]));
|
||||||
}
|
}
|
||||||
|
|
||||||
displayFunction4();
|
displayFunction4();
|
||||||
|
@ -487,7 +478,7 @@ void LilliputEngine::displayFunction9() {
|
||||||
|
|
||||||
memcpy(_buffer2_45k, _buffer3_45k, 45056);
|
memcpy(_buffer2_45k, _buffer3_45k, 45056);
|
||||||
|
|
||||||
int var1 = (_scriptHandler->_viewportY >> 8) + ((_scriptHandler->_viewportY & 0xFF) << 8) + (_scriptHandler->_viewportX << 2);
|
int var1 = (_scriptHandler->_viewportPos.y >> 8) + ((_scriptHandler->_viewportPos.y & 0xFF) << 8) + (_scriptHandler->_viewportPos.x << 2);
|
||||||
int var2;
|
int var2;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
|
@ -604,7 +595,7 @@ void LilliputEngine::displayFunction12() {
|
||||||
|
|
||||||
displayFunction6();
|
displayFunction6();
|
||||||
displayFunction7();
|
displayFunction7();
|
||||||
displayFunction8();
|
displayInterfaceHotspots();
|
||||||
displayFunction9();
|
displayFunction9();
|
||||||
displayFunction15();
|
displayFunction15();
|
||||||
displayFunction14();
|
displayFunction14();
|
||||||
|
@ -638,7 +629,7 @@ void LilliputEngine::displayFunction14() {
|
||||||
if (_displayMap == 1)
|
if (_displayMap == 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_mouseDisplayX > 48)
|
if (_mouseDisplayPos.x > 48)
|
||||||
displayFunction5();
|
displayFunction5();
|
||||||
|
|
||||||
int index = (16 * 320) + 64;
|
int index = (16 * 320) + 64;
|
||||||
|
@ -692,8 +683,7 @@ void LilliputEngine::sub16217() {
|
||||||
|
|
||||||
_numCharactersToDisplay = 0;
|
_numCharactersToDisplay = 0;
|
||||||
int index = _numCharacters - 1;
|
int index = _numCharacters - 1;
|
||||||
_word16213 = _scriptHandler->_viewportX << 3;
|
Common::Point _pos16213 = Common::Point(_scriptHandler->_viewportPos.x << 3, _scriptHandler->_viewportPos.y << 3);
|
||||||
_word16215 = _scriptHandler->_viewportY << 3;
|
|
||||||
|
|
||||||
for (int i = index; i >= 0; i--) {
|
for (int i = index; i >= 0; i--) {
|
||||||
if (_rulesBuffer2_5[i] != 0xFF) {
|
if (_rulesBuffer2_5[i] != 0xFF) {
|
||||||
|
@ -730,13 +720,13 @@ void LilliputEngine::sub16217() {
|
||||||
_characterDisplayX[i] = 0xFF;
|
_characterDisplayX[i] = 0xFF;
|
||||||
_characterDisplayY[i] = 0xFF;
|
_characterDisplayY[i] = 0xFF;
|
||||||
|
|
||||||
int tmpVal2 = (_characterPositionX[i] >> 3) - _scriptHandler->_viewportX;
|
int tmpVal2 = (_characterPositionX[i] >> 3) - _scriptHandler->_viewportPos.x;
|
||||||
int tmpVal3 = (_characterPositionY[i] >> 3) - _scriptHandler->_viewportY;
|
int tmpVal3 = (_characterPositionY[i] >> 3) - _scriptHandler->_viewportPos.y;
|
||||||
if ((tmpVal2 >= 0) && (tmpVal2 <= 7) && (tmpVal3 >= 0) && (tmpVal3 <= 7)) {
|
if ((tmpVal2 >= 0) && (tmpVal2 <= 7) && (tmpVal3 >= 0) && (tmpVal3 <= 7)) {
|
||||||
_characterRelativePositionX[i] = tmpVal2;
|
_characterRelativePositionX[i] = tmpVal2;
|
||||||
_characterRelativePositionY[i] = tmpVal3;
|
_characterRelativePositionY[i] = tmpVal3;
|
||||||
tmpVal2 = _characterPositionX[i] - _word16213;
|
tmpVal2 = _characterPositionX[i] - _pos16213.x;
|
||||||
tmpVal3 = _characterPositionY[i] - _word16215;
|
tmpVal3 = _characterPositionY[i] - _pos16213.y;
|
||||||
int tmpVal4 = _characterPositionAltitude[i];
|
int tmpVal4 = _characterPositionAltitude[i];
|
||||||
_characterDisplayX[i] = ((60 + tmpVal2 - tmpVal3) * 2) & 0xFF;
|
_characterDisplayX[i] = ((60 + tmpVal2 - tmpVal3) * 2) & 0xFF;
|
||||||
_characterDisplayY[i] = (20 + tmpVal2 + tmpVal3 - tmpVal4) & 0xFF;
|
_characterDisplayY[i] = (20 + tmpVal2 + tmpVal3 - tmpVal4) & 0xFF;
|
||||||
|
@ -771,7 +761,7 @@ void LilliputEngine::displayFunction15() {
|
||||||
|
|
||||||
memcpy(_buffer1_45k, _buffer2_45k, 45056);
|
memcpy(_buffer1_45k, _buffer2_45k, 45056);
|
||||||
|
|
||||||
int index1 = (_scriptHandler->_viewportY >> 8) + ((_scriptHandler->_viewportY & 0xFF) << 8) + (_scriptHandler->_viewportX << 2);
|
int index1 = (_scriptHandler->_viewportPos.y >> 8) + ((_scriptHandler->_viewportPos.y & 0xFF) << 8) + (_scriptHandler->_viewportPos.x << 2);
|
||||||
byte *map = &_bufferIsoMap[index1];
|
byte *map = &_bufferIsoMap[index1];
|
||||||
|
|
||||||
for (int i = 0; i < 8; i++) {
|
for (int i = 0; i < 8; i++) {
|
||||||
|
@ -937,8 +927,8 @@ void LilliputEngine::sub15F75() {
|
||||||
|
|
||||||
_byte129A0 = 0xFF;
|
_byte129A0 = 0xFF;
|
||||||
_savedMousePosDivided = 0xFFFF;
|
_savedMousePosDivided = 0xFFFF;
|
||||||
byte newX = _mouseX >> 2;
|
byte newX = _mousePos.x >> 2;
|
||||||
byte newY = _mouseY / 3;
|
byte newY = _mousePos.y / 3;
|
||||||
|
|
||||||
if ((newX >= 64) || (newY >= 64))
|
if ((newX >= 64) || (newY >= 64))
|
||||||
return;
|
return;
|
||||||
|
@ -1198,9 +1188,9 @@ void LilliputEngine::scrollToViewportCharacterTarget() {
|
||||||
if (_scriptHandler->_viewportCharacterTarget == 0xFFFF)
|
if (_scriptHandler->_viewportCharacterTarget == 0xFFFF)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int var2 = (_characterPositionX[_scriptHandler->_viewportCharacterTarget] >> 3) - _scriptHandler->_viewportX;
|
int var2 = (_characterPositionX[_scriptHandler->_viewportCharacterTarget] >> 3) - _scriptHandler->_viewportPos.x;
|
||||||
int var4 = (_characterPositionY[_scriptHandler->_viewportCharacterTarget] >> 3) - _scriptHandler->_viewportY;
|
int var4 = (_characterPositionY[_scriptHandler->_viewportCharacterTarget] >> 3) - _scriptHandler->_viewportPos.y;
|
||||||
int var1 = _scriptHandler->_viewportX;
|
int var1 = _scriptHandler->_viewportPos.x;
|
||||||
|
|
||||||
if (var2 >= 1) {
|
if (var2 >= 1) {
|
||||||
if (var2 >= 6) {
|
if (var2 >= 6) {
|
||||||
|
@ -1214,7 +1204,7 @@ void LilliputEngine::scrollToViewportCharacterTarget() {
|
||||||
var1 = 0;
|
var1 = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int var3 = _scriptHandler->_viewportY;
|
int var3 = _scriptHandler->_viewportPos.y;
|
||||||
if (var4 >= 1) {
|
if (var4 >= 1) {
|
||||||
if (var4 > 6) {
|
if (var4 > 6) {
|
||||||
var3 += 4;
|
var3 += 4;
|
||||||
|
@ -1233,37 +1223,37 @@ void LilliputEngine::scrollToViewportCharacterTarget() {
|
||||||
void LilliputEngine::viewportScrollTo(int goalX, int goalY) {
|
void LilliputEngine::viewportScrollTo(int goalX, int goalY) {
|
||||||
debugC(2, kDebugEngine, "viewportScrollTo(%d, %d)", goalX, goalY);
|
debugC(2, kDebugEngine, "viewportScrollTo(%d, %d)", goalX, goalY);
|
||||||
|
|
||||||
if ((goalX == _scriptHandler->_viewportX) && (goalY == _scriptHandler->_viewportY))
|
if ((goalX == _scriptHandler->_viewportPos.x) && (goalY == _scriptHandler->_viewportPos.y))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int dx = 0;
|
int dx = 0;
|
||||||
if (goalX != _scriptHandler->_viewportX) {
|
if (goalX != _scriptHandler->_viewportPos.x) {
|
||||||
if (goalX < _scriptHandler->_viewportX)
|
if (goalX < _scriptHandler->_viewportPos.x)
|
||||||
--dx;
|
--dx;
|
||||||
else
|
else
|
||||||
++dx;
|
++dx;
|
||||||
}
|
}
|
||||||
|
|
||||||
int dy = 0;
|
int dy = 0;
|
||||||
if (goalY!= _scriptHandler->_viewportY) {
|
if (goalY!= _scriptHandler->_viewportPos.y) {
|
||||||
if (goalY < _scriptHandler->_viewportY)
|
if (goalY < _scriptHandler->_viewportPos.y)
|
||||||
--dy;
|
--dy;
|
||||||
else
|
else
|
||||||
++dy;
|
++dy;
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
_scriptHandler->_viewportX += dx;
|
_scriptHandler->_viewportPos.x += dx;
|
||||||
_scriptHandler->_viewportY += dy;
|
_scriptHandler->_viewportPos.y += dy;
|
||||||
|
|
||||||
displayFunction9();
|
displayFunction9();
|
||||||
displayFunction15();
|
displayFunction15();
|
||||||
displayFunction14();
|
displayFunction14();
|
||||||
|
|
||||||
if (goalX == _scriptHandler->_viewportX)
|
if (goalX == _scriptHandler->_viewportPos.x)
|
||||||
dx = 0;
|
dx = 0;
|
||||||
|
|
||||||
if (goalY == _scriptHandler->_viewportY)
|
if (goalY == _scriptHandler->_viewportPos.y)
|
||||||
dy = 0;
|
dy = 0;
|
||||||
} while ((dx != 0) && (dy != 0));
|
} while ((dx != 0) && (dy != 0));
|
||||||
|
|
||||||
|
@ -1777,7 +1767,7 @@ byte LilliputEngine::sub16729(int index) {
|
||||||
|
|
||||||
int arg1 = index | 0xFF00;
|
int arg1 = index | 0xFF00;
|
||||||
int pos1 = (_scriptHandler->_array16123[index] << 8) | (_scriptHandler->_array1614B[index] & 0xFF);
|
int pos1 = (_scriptHandler->_array16123[index] << 8) | (_scriptHandler->_array1614B[index] & 0xFF);
|
||||||
int pos2 = (_scriptHandler->_viewportX << 8) | (_scriptHandler->_viewportY & 0xFF);
|
int pos2 = (_scriptHandler->_viewportPos.x << 8) | (_scriptHandler->_viewportPos.y & 0xFF);
|
||||||
_soundHandler->contentFct2(); // TODO: add arg pos1 and pos2
|
_soundHandler->contentFct2(); // TODO: add arg pos1 and pos2
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
@ -1848,8 +1838,8 @@ void LilliputEngine::sub12F37() {
|
||||||
void LilliputEngine::sub130EE() {
|
void LilliputEngine::sub130EE() {
|
||||||
debugC(2, kDebugEngine, "sub130EE()");
|
debugC(2, kDebugEngine, "sub130EE()");
|
||||||
|
|
||||||
warning("sub147D7");
|
// warning("sub147D7");
|
||||||
warning("sub13156");
|
// warning("sub13156");
|
||||||
|
|
||||||
if (_mouseButton == 0)
|
if (_mouseButton == 0)
|
||||||
// TODO: check _mouse_byte1299F
|
// TODO: check _mouse_byte1299F
|
||||||
|
@ -1865,12 +1855,12 @@ void LilliputEngine::sub130EE() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool forceReturnFl = false;
|
bool forceReturnFl = false;
|
||||||
sub13184(forceReturnFl);
|
checkInterfaceHotspots(forceReturnFl);
|
||||||
if (forceReturnFl)
|
if (forceReturnFl)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int posX = _mouseX - 64;
|
int posX = _mousePos.x - 64;
|
||||||
int posY = _mouseY - 16;
|
int posY = _mousePos.y - 16;
|
||||||
|
|
||||||
if ((posX < 0) || (posX > 255))
|
if ((posX < 0) || (posX > 255))
|
||||||
return;
|
return;
|
||||||
|
@ -1899,8 +1889,8 @@ void LilliputEngine::sub131FC(int var2, int var4) {
|
||||||
y = y - diff;
|
y = y - diff;
|
||||||
|
|
||||||
if ((y >= 0) && (diff >= 0) && (y < 8) && (diff < 8)) {
|
if ((y >= 0) && (diff >= 0) && (y < 8) && (diff < 8)) {
|
||||||
y += _scriptHandler->_viewportX;
|
y += _scriptHandler->_viewportPos.x;
|
||||||
diff += _scriptHandler->_viewportY;
|
diff += _scriptHandler->_viewportPos.y;
|
||||||
_savedMousePosDivided = (y << 8) + diff;
|
_savedMousePosDivided = (y << 8) + diff;
|
||||||
_byte16F07_menuId = 5;
|
_byte16F07_menuId = 5;
|
||||||
}
|
}
|
||||||
|
@ -1925,12 +1915,12 @@ void LilliputEngine::sub131B2(int var2, int var4, bool &forceReturnFl) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LilliputEngine::sub13184(bool &forceReturnFl) {
|
void LilliputEngine::checkInterfaceHotspots(bool &forceReturnFl) {
|
||||||
debugC(2, kDebugEngine, "sub13184()");
|
debugC(2, kDebugEngine, "checkInterfaceHotspots()");
|
||||||
|
|
||||||
forceReturnFl = false;
|
forceReturnFl = false;
|
||||||
for (int index = _word12F68_ERULES - 1; index >= 0; index--) {
|
for (int index = _word12F68_ERULES - 1; index >= 0; index--) {
|
||||||
if (sub13240(_mouseX, _mouseY, _rulesBuffer13_2[index], _rulesBuffer13_3[index]) == 0) {
|
if (sub13240(_mousePos, _interfaceHotspotsX[index], _interfaceHotspotsY[index]) == 0) {
|
||||||
sub1305C(index, 1);
|
sub1305C(index, 1);
|
||||||
forceReturnFl = true;
|
forceReturnFl = true;
|
||||||
return;
|
return;
|
||||||
|
@ -1938,16 +1928,16 @@ void LilliputEngine::sub13184(bool &forceReturnFl) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int LilliputEngine::sub13240(int posX, int posY, int var3, int var4) {
|
int LilliputEngine::sub13240(Common::Point mousePos, int var3, int var4) {
|
||||||
debugC(2, kDebugEngine, "sub13240(%d, %d, %d, %d)", posX, posY, var3, var4);
|
debugC(2, kDebugEngine, "sub13240(%d, %d, %d, %d)", mousePos.x, mousePos.y, var3, var4);
|
||||||
|
|
||||||
if ((posX < var3) || (posY < var4))
|
if ((mousePos.x < var3) || (mousePos.y < var4))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
var3 += 16;
|
var3 += 16;
|
||||||
var4 += 16;
|
var4 += 16;
|
||||||
|
|
||||||
if ((posX > var3) || (posY > var4))
|
if ((mousePos.x > var3) || (mousePos.y > var4))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1966,7 +1956,7 @@ void LilliputEngine::sub1305C(byte index, byte button) {
|
||||||
if (_byte12FCE != 1) {
|
if (_byte12FCE != 1) {
|
||||||
_scriptHandler->_array122E9[index] = 2;
|
_scriptHandler->_array122E9[index] = 2;
|
||||||
_byte16F07_menuId = 2;
|
_byte16F07_menuId = 2;
|
||||||
displayFunction8();
|
displayInterfaceHotspots();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1985,7 +1975,7 @@ void LilliputEngine::sub1305C(byte index, byte button) {
|
||||||
_byte16F07_menuId = 1;
|
_byte16F07_menuId = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
displayFunction8();
|
displayInterfaceHotspots();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LilliputEngine::sub16685(int idx, int var1) {
|
void LilliputEngine::sub16685(int idx, int var1) {
|
||||||
|
@ -2236,7 +2226,7 @@ void LilliputEngine::sub12FE5() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count !=0)
|
if (count !=0)
|
||||||
displayFunction8();
|
displayInterfaceHotspots();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LilliputEngine::displayHeroismIndicator() {
|
void LilliputEngine::displayHeroismIndicator() {
|
||||||
|
@ -2295,8 +2285,8 @@ void LilliputEngine::pollEvent() {
|
||||||
while (_system->getEventManager()->pollEvent(event)) {
|
while (_system->getEventManager()->pollEvent(event)) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case Common::EVENT_MOUSEMOVE:
|
case Common::EVENT_MOUSEMOVE:
|
||||||
_mouseX = CLIP<int>(event.mouse.x, 0, 304) + 5;
|
_mousePos.x = CLIP<int>(event.mouse.x, 0, 304) + 5;
|
||||||
_mouseY = CLIP<int>(event.mouse.y, 0, 184) + 1;
|
_mousePos.y = CLIP<int>(event.mouse.y, 0, 184) + 1;
|
||||||
break;
|
break;
|
||||||
case Common::EVENT_LBUTTONUP:
|
case Common::EVENT_LBUTTONUP:
|
||||||
_mouseButton |= 1;
|
_mouseButton |= 1;
|
||||||
|
@ -2313,17 +2303,14 @@ void LilliputEngine::pollEvent() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((_mouseX != _oldMouseX) || (_mouseY != _oldMouseY)) {
|
if (_mousePos != _oldMousePos) {
|
||||||
_oldMouseX = _mouseX;
|
_oldMousePos = _mousePos;
|
||||||
_oldMouseY = _mouseY;
|
|
||||||
if (_skipDisplayFlag1 != 0) {
|
if (_skipDisplayFlag1 != 0) {
|
||||||
displayFunction5();
|
displayFunction5();
|
||||||
_mouseDisplayX = _mouseX;
|
_mouseDisplayPos = _mousePos;
|
||||||
_mouseDisplayY = _mouseY;
|
|
||||||
displayFunction4();
|
displayFunction4();
|
||||||
} else {
|
} else {
|
||||||
_mouseDisplayX = _mouseX;
|
_mouseDisplayPos = _mousePos;
|
||||||
_mouseDisplayY = _mouseY;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2533,10 +2520,10 @@ void LilliputEngine::loadRules() {
|
||||||
_rulesBuffer13_1[i] = f.readByte();
|
_rulesBuffer13_1[i] = f.readByte();
|
||||||
|
|
||||||
for (int i = 0 ; i < 20; i++)
|
for (int i = 0 ; i < 20; i++)
|
||||||
_rulesBuffer13_2[i] = f.readUint16LE();
|
_interfaceHotspotsX[i] = f.readUint16LE();
|
||||||
|
|
||||||
for (int i = 0 ; i < 20; i++)
|
for (int i = 0 ; i < 20; i++)
|
||||||
_rulesBuffer13_3[i] = f.readUint16LE();
|
_interfaceHotspotsY[i] = f.readUint16LE();
|
||||||
|
|
||||||
for (int i = 0; i < 20; i++) {
|
for (int i = 0; i < 20; i++) {
|
||||||
byte curByte = f.readByte();
|
byte curByte = f.readByte();
|
||||||
|
@ -2625,7 +2612,9 @@ void LilliputEngine::handleMenu() {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
sub170EE(_word10804);
|
sub170EE(_word10804);
|
||||||
|
debugC(1, kDebugScript, "========================== Menu Script ==============================");
|
||||||
_scriptHandler->runMenuScript(ScriptStream(_menuScript, _menuScript_size));
|
_scriptHandler->runMenuScript(ScriptStream(_menuScript, _menuScript_size));
|
||||||
|
debugC(1, kDebugScript, "========================== End of Menu Script==============================");
|
||||||
_savedMousePosDivided = 0xFFFF;
|
_savedMousePosDivided = 0xFFFF;
|
||||||
_byte129A0 = 0xFF;
|
_byte129A0 = 0xFF;
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
#include "lilliput/stream.h"
|
#include "lilliput/stream.h"
|
||||||
|
|
||||||
#include "common/file.h"
|
#include "common/file.h"
|
||||||
|
#include "common/rect.h"
|
||||||
|
|
||||||
#include "engines/engine.h"
|
#include "engines/engine.h"
|
||||||
#include "graphics/palette.h"
|
#include "graphics/palette.h"
|
||||||
#include "graphics/surface.h"
|
#include "graphics/surface.h"
|
||||||
|
@ -135,8 +137,7 @@ public:
|
||||||
int _word17081_nextIndex;
|
int _word17081_nextIndex;
|
||||||
int _word16EFE;
|
int _word16EFE;
|
||||||
int _word1817B;
|
int _word1817B;
|
||||||
int _word15BC8;
|
Common::Point _word15BC8Pos;
|
||||||
int _word15BCA;
|
|
||||||
int _word15AC2;
|
int _word15AC2;
|
||||||
int _currentDisplayCharacter;
|
int _currentDisplayCharacter;
|
||||||
int _displayStringIndex;
|
int _displayStringIndex;
|
||||||
|
@ -189,8 +190,8 @@ public:
|
||||||
int _rulesBuffer12_4[40];
|
int _rulesBuffer12_4[40];
|
||||||
int _word12F68_ERULES;
|
int _word12F68_ERULES;
|
||||||
byte _rulesBuffer13_1[20];
|
byte _rulesBuffer13_1[20];
|
||||||
int _rulesBuffer13_2[20];
|
int _interfaceHotspotsX[20];
|
||||||
int _rulesBuffer13_3[20];
|
int _interfaceHotspotsY[20];
|
||||||
byte _rulesBuffer13_4[20];
|
byte _rulesBuffer13_4[20];
|
||||||
byte _array10999[40];
|
byte _array10999[40];
|
||||||
byte _array109C1[40];
|
byte _array109C1[40];
|
||||||
|
@ -218,15 +219,15 @@ public:
|
||||||
void newInt8();
|
void newInt8();
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
void displayFunction1(byte *buf, int var1, int var2, int var4);
|
void displayFunction1(byte *buf, int var1, Common::Point pos);
|
||||||
void displayFunction1a(byte *buf, int var2, int var4);
|
void displayFunction1a(byte *buf, Common::Point pos);
|
||||||
void displayFunction2(byte *buf, int var2, int var4);
|
void displayFunction2(byte *buf, Common::Point pos);
|
||||||
void displayFunction3(int var1, int var2, int var4);
|
void displayFunction3(int var1, int var2, int var4);
|
||||||
void displayFunction4();
|
void displayFunction4();
|
||||||
void displayFunction5();
|
void displayFunction5();
|
||||||
void displayFunction6();
|
void displayFunction6();
|
||||||
void displayFunction7();
|
void displayFunction7();
|
||||||
void displayFunction8();
|
void displayInterfaceHotspots();
|
||||||
void displayFunction9();
|
void displayFunction9();
|
||||||
void displayFunction10();
|
void displayFunction10();
|
||||||
void displayFunction11(byte *buf);
|
void displayFunction11(byte *buf);
|
||||||
|
@ -282,8 +283,8 @@ public:
|
||||||
void displayHeroismIndicator();
|
void displayHeroismIndicator();
|
||||||
void sub130EE();
|
void sub130EE();
|
||||||
void sub1305C(byte index, byte var2);
|
void sub1305C(byte index, byte var2);
|
||||||
void sub13184(bool &forceReturnFl);
|
void checkInterfaceHotspots(bool &forceReturnFl);
|
||||||
int sub13240(int posX, int posY, int var3, int var4);
|
int sub13240(Common::Point mousePos, int var3, int var4);
|
||||||
void sub131B2(int var2, int var4, bool &forceReturnFl);
|
void sub131B2(int var2, int var4, bool &forceReturnFl);
|
||||||
void sub131FC(int var2, int var4);
|
void sub131FC(int var2, int var4);
|
||||||
void sub1546F(byte displayX, byte displayY);
|
void sub1546F(byte displayX, byte displayY);
|
||||||
|
@ -325,12 +326,9 @@ public:
|
||||||
Common::String getSavegameFilename(int slot);
|
Common::String getSavegameFilename(int slot);
|
||||||
void syncSoundSettings();
|
void syncSoundSettings();
|
||||||
|
|
||||||
int _mouseX;
|
Common::Point _mousePos;
|
||||||
int _mouseY;
|
Common::Point _oldMousePos;
|
||||||
int _oldMouseX;
|
Common::Point _mouseDisplayPos;
|
||||||
int _oldMouseY;
|
|
||||||
int _mouseDisplayX;
|
|
||||||
int _mouseDisplayY;
|
|
||||||
int _mouseButton;
|
int _mouseButton;
|
||||||
int _savedMousePosDivided;
|
int _savedMousePosDivided;
|
||||||
int _skipDisplayFlag1;
|
int _skipDisplayFlag1;
|
||||||
|
@ -342,8 +340,6 @@ public:
|
||||||
byte _numCharactersToDisplay;
|
byte _numCharactersToDisplay;
|
||||||
byte _byte16C9F;
|
byte _byte16C9F;
|
||||||
int _word10804;
|
int _word10804;
|
||||||
int _word16213;
|
|
||||||
int _word16215;
|
|
||||||
|
|
||||||
void pollEvent();
|
void pollEvent();
|
||||||
void sub170EE(int index);
|
void sub170EE(int index);
|
||||||
|
|
|
@ -45,8 +45,8 @@ LilliputScript::LilliputScript(LilliputEngine *vm) : _vm(vm), _currScript(NULL)
|
||||||
_viewportCharacterTarget = -1;
|
_viewportCharacterTarget = -1;
|
||||||
_heroismBarX = 0;
|
_heroismBarX = 0;
|
||||||
_heroismBarBottomY = 0;
|
_heroismBarBottomY = 0;
|
||||||
_viewportX = 0;
|
_viewportPos.x = 0;
|
||||||
_viewportY = 0;
|
_viewportPos.y = 0;
|
||||||
_word18776 = 0;
|
_word18776 = 0;
|
||||||
|
|
||||||
_savedBuffer215Ptr = NULL;
|
_savedBuffer215Ptr = NULL;
|
||||||
|
@ -949,7 +949,6 @@ void LilliputScript::runScript(ScriptStream script) {
|
||||||
void LilliputScript::runMenuScript(ScriptStream script) {
|
void LilliputScript::runMenuScript(ScriptStream script) {
|
||||||
debugC(1, kDebugScript, "runMenuScript");
|
debugC(1, kDebugScript, "runMenuScript");
|
||||||
|
|
||||||
warning("========================== Menu Script ==============================");
|
|
||||||
_byte16F05_ScriptHandler = 0;
|
_byte16F05_ScriptHandler = 0;
|
||||||
|
|
||||||
while (handleOpcode(&script) == 0)
|
while (handleOpcode(&script) == 0)
|
||||||
|
@ -962,7 +961,7 @@ void LilliputScript::sub185ED(byte index, byte subIndex) {
|
||||||
if (_vm->_arr18560[index]._field0 != 1)
|
if (_vm->_arr18560[index]._field0 != 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
_vm->displayFunction1(_vm->_bufferIdeogram, _vm->_arr18560[index]._field5[subIndex], _vm->_arr18560[index]._field1, _vm->_arr18560[index]._field3);
|
_vm->displayFunction1(_vm->_bufferIdeogram, _vm->_arr18560[index]._field5[subIndex], Common::Point(_vm->_arr18560[index]._field1, _vm->_arr18560[index]._field3));
|
||||||
}
|
}
|
||||||
|
|
||||||
byte LilliputScript::compareValues(byte var1, int oper, int var2) {
|
byte LilliputScript::compareValues(byte var1, int oper, int var2) {
|
||||||
|
@ -1875,8 +1874,8 @@ byte LilliputScript::OC_sub17886() {
|
||||||
int x = var1 >> 8;
|
int x = var1 >> 8;
|
||||||
int y = var1 & 0xFF;
|
int y = var1 & 0xFF;
|
||||||
|
|
||||||
int dx = x - _viewportX;
|
int dx = x - _viewportPos.x;
|
||||||
int dy = y - _viewportY;
|
int dy = y - _viewportPos.y;
|
||||||
|
|
||||||
if ( dx >= 0 && dx < 8 && dy >= 0 && dy < 8)
|
if ( dx >= 0 && dx < 8 && dy >= 0 && dy < 8)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -2338,7 +2337,9 @@ void LilliputScript::OC_callScript() {
|
||||||
|
|
||||||
if (_byte16F05_ScriptHandler == 0) {
|
if (_byte16F05_ScriptHandler == 0) {
|
||||||
_vm->_byte1714E = 0;
|
_vm->_byte1714E = 0;
|
||||||
|
debugC(1, kDebugScript, "========================== Menu Script %d==============================", scriptIndex);
|
||||||
runMenuScript(ScriptStream(&_vm->_arrayGameScripts[scriptIndex], _vm->_arrayGameScriptIndex[index + 1] - _vm->_arrayGameScriptIndex[index]));
|
runMenuScript(ScriptStream(&_vm->_arrayGameScripts[scriptIndex], _vm->_arrayGameScriptIndex[index + 1] - _vm->_arrayGameScriptIndex[index]));
|
||||||
|
debugC(1, kDebugScript, "========================== End of Menu Script==============================");
|
||||||
} else {
|
} else {
|
||||||
runScript(ScriptStream(&_vm->_arrayGameScripts[scriptIndex], _vm->_arrayGameScriptIndex[index + 1] - _vm->_arrayGameScriptIndex[index]));
|
runScript(ScriptStream(&_vm->_arrayGameScripts[scriptIndex], _vm->_arrayGameScriptIndex[index + 1] - _vm->_arrayGameScriptIndex[index]));
|
||||||
}
|
}
|
||||||
|
@ -2751,7 +2752,7 @@ void LilliputScript::OC_sub18099() {
|
||||||
_array122E9[index] = (curWord & 0xFF);
|
_array122E9[index] = (curWord & 0xFF);
|
||||||
_array122FD[index] = (curWord >> 8);
|
_array122FD[index] = (curWord >> 8);
|
||||||
|
|
||||||
_vm->displayFunction8();
|
_vm->displayInterfaceHotspots();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LilliputScript::OC_sub180C3() {
|
void LilliputScript::OC_sub180C3() {
|
||||||
|
@ -2763,8 +2764,8 @@ void LilliputScript::OC_sub180C3() {
|
||||||
static const char _byte180B3[] = { 6, 0, 0, -6 };
|
static const char _byte180B3[] = { 6, 0, 0, -6 };
|
||||||
static const char _byte180BB[] = { 0, -6, 6, 0 };
|
static const char _byte180BB[] = { 0, -6, 6, 0 };
|
||||||
|
|
||||||
int x = _viewportX + _byte180B3[var1];
|
int x = _viewportPos.x + _byte180B3[var1];
|
||||||
int y = _viewportY + _byte180BB[var1];
|
int y = _viewportPos.y + _byte180BB[var1];
|
||||||
|
|
||||||
if ( x < 0 )
|
if ( x < 0 )
|
||||||
x = 0;
|
x = 0;
|
||||||
|
@ -2789,8 +2790,8 @@ void LilliputScript::OC_sub1810A() {
|
||||||
_viewportCharacterTarget = 0xFFFF;
|
_viewportCharacterTarget = 0xFFFF;
|
||||||
int var1 = getValue2();
|
int var1 = getValue2();
|
||||||
|
|
||||||
_viewportX = var1 >> 8;
|
_viewportPos.x = var1 >> 8;
|
||||||
_viewportY = var1 & 0xFF;
|
_viewportPos.y = var1 & 0xFF;
|
||||||
|
|
||||||
_vm->displayFunction9();
|
_vm->displayFunction9();
|
||||||
_vm->displayFunction15();
|
_vm->displayFunction15();
|
||||||
|
@ -2892,8 +2893,8 @@ void LilliputScript::OC_sub18260() {
|
||||||
int var1 = getValue1();
|
int var1 = getValue1();
|
||||||
int var2 = getValue2();
|
int var2 = getValue2();
|
||||||
|
|
||||||
int x = var1 + _viewportX;
|
int x = var1 + _viewportPos.x;
|
||||||
int y = var2 + _viewportY;
|
int y = var2 + _viewportPos.y;
|
||||||
|
|
||||||
byte* mapPtr = getMapPtr((x << 8) + (y & 0xff));
|
byte* mapPtr = getMapPtr((x << 8) + (y & 0xff));
|
||||||
|
|
||||||
|
@ -3191,8 +3192,8 @@ void LilliputScript::OC_sub186E5_snd() {
|
||||||
byte var4l = (index & 0xFF);
|
byte var4l = (index & 0xFF);
|
||||||
byte var3h = _array16123[index];
|
byte var3h = _array16123[index];
|
||||||
byte var3l = _array1614B[index];
|
byte var3l = _array1614B[index];
|
||||||
byte var2h = (_viewportX & 0xFF);
|
byte var2h = (_viewportPos.x & 0xFF);
|
||||||
byte var2l = (_viewportY & 0xFF);
|
byte var2l = (_viewportPos.y & 0xFF);
|
||||||
int var1 = _currScript->readUint16LE();
|
int var1 = _currScript->readUint16LE();
|
||||||
|
|
||||||
_vm->_soundHandler->contentFct2();
|
_vm->_soundHandler->contentFct2();
|
||||||
|
@ -3203,7 +3204,7 @@ void LilliputScript::OC_sub1870A_snd() {
|
||||||
|
|
||||||
int var3 = getValue2();
|
int var3 = getValue2();
|
||||||
int var4 = var3;
|
int var4 = var3;
|
||||||
int var2 = (_viewportX << 8) + _viewportY;
|
int var2 = (_viewportPos.x << 8) + _viewportPos.y;
|
||||||
int var1 = (_currScript->readUint16LE() & 0xFF);
|
int var1 = (_currScript->readUint16LE() & 0xFF);
|
||||||
|
|
||||||
_vm->_soundHandler->contentFct2();
|
_vm->_soundHandler->contentFct2();
|
||||||
|
@ -3235,7 +3236,7 @@ void LilliputScript::OC_sub18746_snd() {
|
||||||
debugC(1, kDebugScript, "OC_sub18746_snd()");
|
debugC(1, kDebugScript, "OC_sub18746_snd()");
|
||||||
|
|
||||||
int var4 = -1;
|
int var4 = -1;
|
||||||
int var2 = (_viewportX << 8) + _viewportY;
|
int var2 = (_viewportPos.x << 8) + _viewportPos.y;
|
||||||
int var1 = _currScript->readUint16LE() & 0xFF;
|
int var1 = _currScript->readUint16LE() & 0xFF;
|
||||||
|
|
||||||
_vm->_soundHandler->contentFct2();
|
_vm->_soundHandler->contentFct2();
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "common/memstream.h"
|
#include "common/memstream.h"
|
||||||
#include "common/stack.h"
|
#include "common/stack.h"
|
||||||
#include "common/random.h"
|
#include "common/random.h"
|
||||||
|
#include "common/rect.h"
|
||||||
|
|
||||||
#include "lilliput/stream.h"
|
#include "lilliput/stream.h"
|
||||||
|
|
||||||
|
@ -71,8 +72,7 @@ public:
|
||||||
|
|
||||||
byte *_savedBuffer215Ptr;
|
byte *_savedBuffer215Ptr;
|
||||||
|
|
||||||
int _viewportX;
|
Common::Point _viewportPos;
|
||||||
int _viewportY;
|
|
||||||
int _viewportCharacterTarget;
|
int _viewportCharacterTarget;
|
||||||
int _word1881B;
|
int _word1881B;
|
||||||
int _heroismBarX;
|
int _heroismBarX;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue