diff options
Diffstat (limited to 'engines/parallaction')
-rw-r--r-- | engines/parallaction/gfxbase.cpp | 21 | ||||
-rw-r--r-- | engines/parallaction/objects.cpp | 6 | ||||
-rw-r--r-- | engines/parallaction/parallaction.cpp | 25 | ||||
-rw-r--r-- | engines/parallaction/parser_ns.cpp | 15 |
4 files changed, 39 insertions, 28 deletions
diff --git a/engines/parallaction/gfxbase.cpp b/engines/parallaction/gfxbase.cpp index 48d84ed101..c351551e36 100644 --- a/engines/parallaction/gfxbase.cpp +++ b/engines/parallaction/gfxbase.cpp @@ -55,17 +55,14 @@ const char *GfxObj::getName() const { return _name; } - uint GfxObj::getNum() { return _frames->getNum(); } - void GfxObj::getRect(uint f, Common::Rect &r) { _frames->getRect(f, r); } - byte *GfxObj::getData(uint f) { return _frames->getData(f); } @@ -77,7 +74,6 @@ uint GfxObj::getSize(uint f) { return _frames->getSize(f); } - void GfxObj::setFlags(uint32 flags) { _flags |= flags; } @@ -108,6 +104,7 @@ void Gfx::resetSceneDrawList() { } GfxObj* Gfx::loadAnim(const char *name) { + debugC(1, kDebugGraphics, "Gfx::loadAnim(\"%s\")", name); Frames* frames = _disk->loadFrames(name); assert(frames); @@ -146,7 +143,6 @@ GfxObj* Gfx::loadDoor(const char *name) { return obj; } - void Gfx::freeLocationObjects() { freeDialogueObjects(); freeLabels(); @@ -157,6 +153,7 @@ void Gfx::freeCharacterObjects() { } void BackgroundInfo::loadGfxObjMask(const char *name, GfxObj *obj) { + debugC(1, kDebugGraphics, "BackgroundInfo::loadGfxObjMask(\"%s\")", name); Common::Rect rect; obj->getRect(0, rect); @@ -180,6 +177,7 @@ void Gfx::showGfxObj(GfxObj* obj, bool visible) { if (!obj) { return; } + debugC(1, kDebugGraphics, "Gfx::showGfxObj(\"%s\", visible:%d)", obj->getName(), visible ? 1 : 0); if (visible) { obj->setFlags(kGfxObjVisible); @@ -188,27 +186,27 @@ void Gfx::showGfxObj(GfxObj* obj, bool visible) { } if (obj->_hasMask) { + debugC(1, kDebugGraphics, "\tHas Mask"); _backgroundInfo->toggleMaskPatch(obj->_maskId, obj->x, obj->y, visible); } if (obj->_hasPath) { + debugC(1, kDebugGraphics, "\tHas Path"); _backgroundInfo->togglePathPatch(obj->_pathId, obj->x, obj->y, visible); } } - - bool compareZ(const GfxObj* a1, const GfxObj* a2) { return (a1->z == a2->z) ? (a1->_prog < a2->_prog) : (a1->z < a2->z); } void Gfx::sortScene() { + debugC(3, kDebugGraphics, "Gfx::sortScene()"); GfxObjArray::iterator first = _sceneObjects.begin(); GfxObjArray::iterator last = _sceneObjects.end(); Common::sort(first, last, compareZ); } - void Gfx::drawGfxObject(GfxObj *obj, Graphics::Surface &surf) { if (!obj->isVisible()) { return; @@ -236,16 +234,13 @@ void Gfx::drawGfxObject(GfxObj *obj, Graphics::Surface &surf) { } - void Gfx::drawText(Font *font, Graphics::Surface* surf, uint16 x, uint16 y, const char *text, byte color) { byte *dst = (byte*)surf->getBasePtr(x, y); font->setColor(color); font->drawString(dst, surf->w, text); } - void Gfx::unpackBlt(const Common::Rect& r, byte *data, uint size, Graphics::Surface *surf, uint16 z, uint scale, byte transparentColor) { - byte *d = _unpackedBitmap; uint pixelsLeftInLine = r.width(); @@ -273,7 +268,6 @@ void Gfx::unpackBlt(const Common::Rect& r, byte *data, uint size, Graphics::Surf blt(r, _unpackedBitmap, surf, z, scale, transparentColor); } - void Gfx::bltMaskScale(const Common::Rect& r, byte *data, Graphics::Surface *surf, uint16 z, uint scale, byte transparentColor) { if (scale == 100) { // use optimized path @@ -301,7 +295,6 @@ void Gfx::bltMaskScale(const Common::Rect& r, byte *data, Graphics::Surface *sur dstRect.clip(clipper); if (!dstRect.isValidRect()) return; - // clipped source rectangle Common::Rect srcRect; srcRect.left = (dstRect.left - scaledLeft) * 100 / scale; @@ -448,10 +441,8 @@ void Gfx::bltNoMaskNoScale(const Common::Rect& r, byte *data, Graphics::Surface } } - void Gfx::blt(const Common::Rect& r, byte *data, Graphics::Surface *surf, uint16 z, uint scale, byte transparentColor) { bltMaskScale(r, data, surf, z, scale, transparentColor); } - } // namespace Parallaction diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp index 22406013a1..fe21732f03 100644 --- a/engines/parallaction/objects.cpp +++ b/engines/parallaction/objects.cpp @@ -220,7 +220,11 @@ bool Zone::hitRect(int x, int y) const { if (_right < _left || _bottom < _top) { return false; } - return Common::Rect(_left, _top, _right, _bottom).contains(x, y); + + Common::Rect r(_left, _top, _right + 1, _bottom + 1); + r.grow(-1); + + return r.contains(x, y); } Dialogue::Dialogue() { diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index a37c4439a1..2fffc9071c 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -899,22 +899,23 @@ void CharacterName::bind(const char *name) { _dummy = IS_DUMMY_CHARACTER(name); if (!_dummy) { - if (!strstr(name, "donna")) { + if (!strcmp(name, "donna")) { _engineFlags &= ~kEngineTransformedDonna; - } else - if (_engineFlags & kEngineTransformedDonna) { - _suffix = _suffixTras; } else { - const char *s = strstr(name, "tras"); - if (s) { - _engineFlags |= kEngineTransformedDonna; + if (_engineFlags & kEngineTransformedDonna) { _suffix = _suffixTras; - end = s; + } else { + const char *s = strstr(name, "tras"); + if (s) { + _engineFlags |= kEngineTransformedDonna; + _suffix = _suffixTras; + end = s; + } + } + if (IS_MINI_CHARACTER(name)) { + _prefix = _prefixMini; + begin = name + 4; } - } - if (IS_MINI_CHARACTER(name)) { - _prefix = _prefixMini; - begin = name+4; } } diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp index 100b608172..a73f1558e8 100644 --- a/engines/parallaction/parser_ns.cpp +++ b/engines/parallaction/parser_ns.cpp @@ -1334,6 +1334,21 @@ void LocationParser_ns::parseGetData(ZonePtr z) { obj->x = z->getX(); obj->y = z->getY(); obj->_prog = _zoneProg; + + // WORKAROUND for script bug #2969913 + // The katana object has the same default z index (kGfxObjGetZ or -100) + // as the cripta object (the safe) - a script bug. + // Game scripts do not set an explicit z for the katana (as it isn't an + // animation), but rather rely on the draw order to draw it over the + // safe. In this particular case, the safe is added to the scene after + // the katana, thus it is drawn over the katana. We explicitly set the + // z index of the katana to be higher than the safe, so that the katana + // is drawn correctly over it. + // This is a regression from the graphics rewrite (commits be2c5d3, + // 3c2c16c and 44906f5). + if (!scumm_stricmp(obj->getName(), "katana")) + obj->z = 0; + bool visible = (z->_flags & kFlagsRemove) == 0; _vm->_gfx->showGfxObj(obj, visible); data->_gfxobj = obj; |