Skip to content

Commit

Permalink
LILLIPUT: Fix bug in viewportScrollTo(), some renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Strangerke authored and sev- committed Mar 28, 2018
1 parent 5498523 commit 4d36343
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
8 changes: 4 additions & 4 deletions engines/lilliput/lilliput.cpp
Expand Up @@ -1246,20 +1246,20 @@ void LilliputEngine::scrollToViewportCharacterTarget() {
}

void LilliputEngine::viewportScrollTo(Common::Point goalPos) {
debugC(2, kDebugEngineTBC, "viewportScrollTo(%d, %d)", goalPos.x, goalPos.y);
debugC(2, kDebugEngine, "viewportScrollTo(%d, %d)", goalPos.x, goalPos.y);

if (goalPos == _scriptHandler->_viewportPos)
return;

int dx = 0;
int16 dx = 0;
if (goalPos.x != _scriptHandler->_viewportPos.x) {
if (goalPos.x < _scriptHandler->_viewportPos.x)
--dx;
else
++dx;
}

int dy = 0;
int16 dy = 0;
if (goalPos.y != _scriptHandler->_viewportPos.y) {
if (goalPos.y < _scriptHandler->_viewportPos.y)
--dy;
Expand All @@ -1280,7 +1280,7 @@ void LilliputEngine::viewportScrollTo(Common::Point goalPos) {

if (goalPos.y == _scriptHandler->_viewportPos.y)
dy = 0;
} while ((dx != 0) && (dy != 0));
} while ((dx != 0) || (dy != 0));

_soundHandler->contentFct5();
}
Expand Down
11 changes: 6 additions & 5 deletions engines/lilliput/script.cpp
Expand Up @@ -1376,16 +1376,17 @@ byte LilliputScript::OC_checkCharacterGoalPos() {
}

byte LilliputScript::OC_comparePos() {
debugC(2, kDebugScriptTBC, "OC_comparePos()");
debugC(2, kDebugScript, "OC_comparePos()");

int index = getValue1();
byte d1 = _array16123PosX[index];
byte d2 = _array1614BPosY[index];
int8 d1 = _array16123PosX[index];
int8 d2 = _array1614BPosY[index];
Common::Point var1 = getPosFromScript();

if (var1 == Common::Point(d1, d2))
return 1;

warning("OC_comparePos - debug: %d-%d %d-%d", var1.x, var1.y, d1, d2);
return 0;
}

Expand Down Expand Up @@ -2459,7 +2460,7 @@ void LilliputScript::OC_setCurrentCharacter() {
_vm->setCurrentCharacter(var1);
}

void LilliputScript::sub171AF(int16 var1, int16 var2, int16 var4) {
void LilliputScript::sub171AF(int16 var1, uint16 var2, int16 var4) {
debugC(2, kDebugScript, "sub171AF()");

int index = 0;
Expand All @@ -2475,7 +2476,7 @@ void LilliputScript::sub171AF(int16 var1, int16 var2, int16 var4) {
}

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

int16 type = 2 << 8;
int16 var4 = _currScript->readSint16LE();
Expand Down
12 changes: 6 additions & 6 deletions engines/lilliput/script.h
Expand Up @@ -61,14 +61,14 @@ class LilliputScript {

byte _characterScriptEnabled[40];
int8 _interfaceHotspotStatus[20];
char _array16123PosX[40];
char _array1614BPosY[40];
char _array12811[40];
char _array10AB1[40];
int8 _array16123PosX[40];
int8 _array1614BPosY[40];
int8 _array12811[40];
int8 _array10AB1[40];
byte _array122FD[20];
byte _array122C1[40];
byte _array10A39[40];
short _array10B51[40 * 40];
int16 _array10B51[40 * 40];

byte *_savedBuffer215Ptr;

Expand Down Expand Up @@ -127,7 +127,7 @@ class LilliputScript {
void displayNumber(byte var1, Common::Point pos);
byte *getMapPtr(Common::Point val);
byte *getCurrentCharacterVarFromScript();
void sub171AF(int16 var1, int16 var2, int16 var4);
void sub171AF(int16 var1, uint16 var2, int16 var4);
void sub18B7C(int var1, int var3);
void sub189B8();
void formatSpeechString();
Expand Down

0 comments on commit 4d36343

Please sign in to comment.