aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStrangerke2012-04-15 23:20:30 +0200
committerEugene Sandulenko2018-03-28 17:36:57 +0200
commit31d4f0750560585418441d659fa1828cfa35b6f2 (patch)
tree47b1a4036ef806b7488785609817a0d80a0c0e4b
parenta08b34fea866bff239c06105c32293598327ae9c (diff)
downloadscummvm-rg350-31d4f0750560585418441d659fa1828cfa35b6f2.tar.gz
scummvm-rg350-31d4f0750560585418441d659fa1828cfa35b6f2.tar.bz2
scummvm-rg350-31d4f0750560585418441d659fa1828cfa35b6f2.zip
LILLIPUT: start implementing display functions
-rw-r--r--engines/lilliput/lilliput.cpp96
-rw-r--r--engines/lilliput/lilliput.h13
-rw-r--r--engines/lilliput/script.cpp2
3 files changed, 108 insertions, 3 deletions
diff --git a/engines/lilliput/lilliput.cpp b/engines/lilliput/lilliput.cpp
index 8799c473d7..3b48d8a7ab 100644
--- a/engines/lilliput/lilliput.cpp
+++ b/engines/lilliput/lilliput.cpp
@@ -114,8 +114,14 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_rnd = 0;
_mouseX = 0;
_mouseY = 0;
+ _oldMouseX = 0;
+ _oldMouseY = 0;
+ _mouseDisplayX = 0;
+ _mouseDisplayY = 0;
_mouseButton = 0;
_savedMousePosDivided = 0xFFFF;
+ _skipDisplayFlag1 = 1;
+ _skipDisplayFlag2 = 0;
_scriptHandler = new LilliputScript(this);
@@ -129,6 +135,8 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_word17081_nextIndex = 0;
_word16EFE = 0xFFFF;
_word1817B = 0;
+ _word15BC8 = 0;
+ _word15BCA = 0;
_saveFlag = false;
_byte16F07_menuId = 0;
@@ -139,6 +147,9 @@ LilliputEngine::LilliputEngine(OSystem *syst, const LilliputGameDescription *gd)
_array11D49[i] = 0xFFFF;
}
+ for (int i = 0; i < 256; i++)
+ _array15AC8[i] = 0;
+
_ptr_rulesBuffer2_15 = NULL;
}
@@ -169,6 +180,73 @@ Common::Platform LilliputEngine::getPlatform() const {
return _platform;
}
+void LilliputEngine::displayFunction1(byte *buf, int var1, int var2, int var4) {
+ debugC(2, kDebugEngine, "displayFunction1a(buf, %d, %d, %d)", var1, var2, var4);
+
+ int index1 = ((var1 & 0xFF) << 8) + (var1 >> 8);
+ byte *newBuf = &buf[index1];
+
+ int tmpVal = ((var4 & 0xFF) << 8) + (var4 >> 8);
+ int index2 = var2 + tmpVal + (tmpVal >> 2);
+
+ for (int i = 0; i < 16; i++) {
+ if (newBuf[0] != 0)
+ ((byte *)_mainSurface->getPixels())[index2] = newBuf[0];
+ if (newBuf[1] != 0)
+ ((byte *)_mainSurface->getPixels())[index2 + 1] = newBuf[1];
+ if (newBuf[2] != 0)
+ ((byte *)_mainSurface->getPixels())[index2 + 2] = newBuf[2];
+ if (newBuf[3] != 0)
+ ((byte *)_mainSurface->getPixels())[index2 + 3] = newBuf[3];
+ if (newBuf[4] != 0)
+ ((byte *)_mainSurface->getPixels())[index2 + 4] = newBuf[4];
+ if (newBuf[5] != 0)
+ ((byte *)_mainSurface->getPixels())[index2 + 5] = newBuf[5];
+ if (newBuf[6] != 0)
+ ((byte *)_mainSurface->getPixels())[index2 + 6] = newBuf[6];
+ if (newBuf[7] != 0)
+ ((byte *)_mainSurface->getPixels())[index2 + 7] = newBuf[7];
+ if (newBuf[8] != 0)
+ ((byte *)_mainSurface->getPixels())[index2 + 8] = newBuf[8];
+ if (newBuf[9] != 0)
+ ((byte *)_mainSurface->getPixels())[index2 + 9] = newBuf[9];
+ if (newBuf[10] != 0)
+ ((byte *)_mainSurface->getPixels())[index2 + 10] = newBuf[10];
+ if (newBuf[11] != 0)
+ ((byte *)_mainSurface->getPixels())[index2 + 11] = newBuf[11];
+ if (newBuf[12] != 0)
+ ((byte *)_mainSurface->getPixels())[index2 + 12] = newBuf[12];
+ if (newBuf[13] != 0)
+ ((byte *)_mainSurface->getPixels())[index2 + 13] = newBuf[13];
+ if (newBuf[14] != 0)
+ ((byte *)_mainSurface->getPixels())[index2 + 14] = newBuf[14];
+ if (newBuf[15] != 0)
+ ((byte *)_mainSurface->getPixels())[index2 + 15] = newBuf[15];
+
+ index2 += 304;
+ newBuf = &newBuf[16];
+ }
+ _system->copyRectToScreen((byte *)_mainSurface->getPixels(), 320, 0, 0, 320, 200);
+ _system->updateScreen();
+}
+
+void LilliputEngine::displayFunction1a(byte *buf, int var2, int var4) {
+ debugC(2, kDebugEngine, "displayFunction1a(buf, %d, %d)", var2, var4);
+
+ displayFunction1(buf, 0, var2, var4);
+}
+
+void LilliputEngine::displayFunction5() {
+ debugC(2, kDebugEngine, "displayFunction5()");
+
+ if ((_skipDisplayFlag1 != 0) && (_skipDisplayFlag2 != 1)) {
+ _skipDisplayFlag2 = 1;
+ displayFunction1a(_array15AC8, _word15BC8, _word15BCA);
+ _skipDisplayFlag1 = 0;
+ _skipDisplayFlag2 = 0;
+ }
+}
+
void LilliputEngine::pollEvent() {
debugC(2, kDebugEngine, "pollEvent()");
@@ -176,8 +254,8 @@ void LilliputEngine::pollEvent() {
while (_system->getEventManager()->pollEvent(event)) {
switch (event.type) {
case Common::EVENT_MOUSEMOVE:
- _mouseX = event.mouse.x;
- _mouseY = event.mouse.y;
+ _mouseX = CLIP<int>(event.mouse.x, 0, 304) + 5;
+ _mouseY = CLIP<int>(event.mouse.y, 0, 184) + 1;
break;
case Common::EVENT_LBUTTONUP:
_mouseButton |= 1;
@@ -193,6 +271,20 @@ void LilliputEngine::pollEvent() {
break;
}
}
+
+ if ((_mouseX != _oldMouseX) || (_mouseY != _oldMouseY)) {
+ _oldMouseX = _mouseX;
+ _oldMouseY = _mouseY;
+ if (_skipDisplayFlag1 != 0) {
+ warning("Display function 5");
+ _mouseDisplayX = _mouseX;
+ _mouseDisplayY = _mouseY;
+ warning("Display function 4");
+ } else {
+ _mouseDisplayX = _mouseX;
+ _mouseDisplayY = _mouseY;
+ }
+ }
}
byte *LilliputEngine::loadVGA(Common::String filename, bool loadPal) {
diff --git a/engines/lilliput/lilliput.h b/engines/lilliput/lilliput.h
index b59b98a445..ba865429ea 100644
--- a/engines/lilliput/lilliput.h
+++ b/engines/lilliput/lilliput.h
@@ -109,6 +109,8 @@ public:
int _word17081_nextIndex;
int _word16EFE;
int _word1817B;
+ int _word15BC8;
+ int _word15BCA;
int _array11D49[40];
@@ -157,11 +159,16 @@ public:
byte _rulesBuffer13_4[20];
byte _byte10999[40];
byte _byte109C1[40];
+ byte _array15AC8[256];
const LilliputGameDescription *_gameDescription;
uint32 getFeatures() const;
const char *getGameId() const;
+ void displayFunction1(byte *buf, int var1, int var2, int var4);
+ void displayFunction1a(byte *buf, int var2, int var4);
+ void displayFunction5();
+
void initGame(const LilliputGameDescription *gd);
byte *loadVGA(Common::String filename, bool loadPal);
byte *loadRaw(Common::String filename);
@@ -182,8 +189,14 @@ public:
int _mouseX;
int _mouseY;
+ int _oldMouseX;
+ int _oldMouseY;
+ int _mouseDisplayX;
+ int _mouseDisplayY;
int _mouseButton;
int _savedMousePosDivided;
+ int _skipDisplayFlag1;
+ int _skipDisplayFlag2;
byte _byte16F07_menuId;
byte _byte12FCE;
diff --git a/engines/lilliput/script.cpp b/engines/lilliput/script.cpp
index 47ec8a888c..77a9f7acd7 100644
--- a/engines/lilliput/script.cpp
+++ b/engines/lilliput/script.cpp
@@ -652,7 +652,7 @@ void LilliputScript::computeOperation(byte *bufPtr, int oper, int var2) {
default: {
warning("computeOperation : oper %d", oper);
if (var2 != 0) {
- byte tmpVal = bufPtr[0] / var2;
+ int tmpVal = bufPtr[0] / var2;
if (tmpVal < 0)
bufPtr[0] = 0xFF;
else