From 4413754ad2b51fd07c97223f0790695c1f2d2235 Mon Sep 17 00:00:00 2001 From: Arnaud Boutonné Date: Tue, 18 Jan 2011 09:16:52 +0000 Subject: HUGO: Improve mouse support in H3 DOS version - Fix description of Penelope lying (when using mouse) - Use H3 Win logic in order to handle horizon - Add a workaround for a data bug in scenery1.dat, fixing the pathfinding bug in Crash screen svn-id: r55292 --- engines/hugo/hugo.cpp | 22 ++++++++++++++++++++++ engines/hugo/hugo.h | 3 ++- engines/hugo/object_v3d.cpp | 4 ++++ 3 files changed, 28 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp index 78ac233b8d..f3eb3aa46c 100644 --- a/engines/hugo/hugo.cpp +++ b/engines/hugo/hugo.cpp @@ -1054,6 +1054,10 @@ void HugoEngine::readScreenFiles(int screenNum) { _file->readOverlay(screenNum, _boundary, BOUNDARY); // Boundary file _file->readOverlay(screenNum, _overlay, OVERLAY); // Overlay file _file->readOverlay(screenNum, _ovlBase, OVLBASE); // Overlay base file + + if ((screenNum == 0) && (_gameVariant == 5)) // H3 Dos + clearScreenBoundary(50, 311, 152); + } /** @@ -1171,6 +1175,24 @@ void HugoEngine::clearBoundary(int x1, int x2, int y) { } } +/** +* Clear a horizontal line segment in the screen boundary file +* Used to fix some data issues +*/ +void HugoEngine::clearScreenBoundary(int x1, int x2, int y) { + debugC(5, kDebugEngine, "clearScreenBoundary(%d, %d, %d)", x1, x2, y); + + for (int i = x1 >> 3; i <= x2 >> 3; i++) { // For each byte in line + byte *b = &_boundary[y * XBYTES + i]; // get boundary byte + if (i == x2 >> 3) // Adjust right end + *b &= ~(0xff << ((i << 3) + 7 - x2)); + else if (i == x1 >> 3) // Adjust left end + *b &= ~(0xff >> (x1 - (i << 3))); + else + *b = 0; + } +} + /** * Search background command list for this screen for supplied object. * Return first associated verb (not "look") or 0 if none found. diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h index fe188106db..d41a23a037 100644 --- a/engines/hugo/hugo.h +++ b/engines/hugo/hugo.h @@ -36,7 +36,7 @@ #include "hugo/file.h" #define HUGO_DAT_VER_MAJ 0 // 1 byte -#define HUGO_DAT_VER_MIN 39 // 1 byte +#define HUGO_DAT_VER_MIN 40 // 1 byte #define DATAALIGNMENT 4 #define EDGE 10 // Closest object can get to edge of screen #define EDGE2 (EDGE * 2) // Push object further back on edge collision @@ -209,6 +209,7 @@ public: void initGamePart(const HugoGameDescription *gd); void boundaryCollision(object_t *obj); void clearBoundary(int x1, int x2, int y); + void clearScreenBoundary(int x1, int x2, int y); void endGame(); void initStatus(); void readScreenFiles(int screen); diff --git a/engines/hugo/object_v3d.cpp b/engines/hugo/object_v3d.cpp index 035bec33df..4ca5b6a19e 100644 --- a/engines/hugo/object_v3d.cpp +++ b/engines/hugo/object_v3d.cpp @@ -157,6 +157,7 @@ void ObjectHandler_v3d::moveObjects() { } if (obj->vx || obj->vy) obj->cycling = CYCLE_FORWARD; + break; default: ; // Really, nothing @@ -261,6 +262,9 @@ void ObjectHandler_v3d::swapImages(int objNumb1, int objNumb2) { restoreSeq(&_objects[objNumb1]); _objects[objNumb2].currImagePtr = _objects[objNumb2].seqList[0].seqPtr; _vm->_heroImage = (_vm->_heroImage == HERO) ? objNumb2 : HERO; + + // Make sure baseline stays constant + _objects[objNumb1].y += _objects[objNumb2].currImagePtr->y2 - _objects[objNumb1].currImagePtr->y2; } } // End of namespace Hugo -- cgit v1.2.3