From 18b48c74a9de417254badf23744d5c5f73c2966c Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Wed, 9 Jul 2008 10:52:46 +0000 Subject: Fixed regression introduced with GfxObj: the character sprite was sometimes removed from the rendering list. svn-id: r32974 --- engines/parallaction/gfxbase.cpp | 25 ++++++++++++++----------- engines/parallaction/graphics.h | 9 ++++++--- engines/parallaction/parallaction.cpp | 12 +++++++++--- engines/parallaction/parallaction_br.cpp | 2 +- engines/parallaction/parallaction_ns.cpp | 3 +++ 5 files changed, 33 insertions(+), 18 deletions(-) (limited to 'engines') diff --git a/engines/parallaction/gfxbase.cpp b/engines/parallaction/gfxbase.cpp index 3e9bd79e5d..9e7eb12ed8 100644 --- a/engines/parallaction/gfxbase.cpp +++ b/engines/parallaction/gfxbase.cpp @@ -32,7 +32,7 @@ namespace Parallaction { -GfxObj::GfxObj(uint objType, Frames *frames, const char* name) : type(objType), _frames(frames), x(0), y(0), z(0), frame(0), layer(3), _flags(0), _keep(true) { +GfxObj::GfxObj(uint objType, Frames *frames, const char* name) : type(objType), _frames(frames), x(0), y(0), z(0), frame(0), layer(3), _flags(kGfxObjNormal), _keep(true) { if (name) { _name = strdup(name); } else { @@ -124,15 +124,22 @@ GfxObj* Gfx::loadDoor(const char *name) { return obj; } -void Gfx::clearGfxObjects() { - _gfxobjList.clear(); +void Gfx::clearGfxObjects(uint filter) { + + GfxObjList::iterator b = _gfxobjList.begin(); + GfxObjList::iterator e = _gfxobjList.end(); + + for ( ; b != e; ) { + if (((*b)->_flags & filter) != 0) { + b = _gfxobjList.erase(b); + } else { + b++; + } + } + } void Gfx::showGfxObj(GfxObj* obj, bool visible) { -// if (!obj || obj->isVisible() == visible) { -// return; -// } - if (!obj) { return; } @@ -141,9 +148,7 @@ void Gfx::showGfxObj(GfxObj* obj, bool visible) { obj->setFlags(kGfxObjVisible); } else { obj->clearFlags(kGfxObjVisible); -// _gfxobjList.remove(obj); } - } @@ -187,8 +192,6 @@ void Gfx::drawGfxObjects(Graphics::Surface &surf) { sortAnimations(); // TODO: some zones don't appear because of wrong masking (3 or 0?) - // TODO: Dr.Ki is not visible inside the club - GfxObjList::iterator b = _gfxobjList.begin(); GfxObjList::iterator e = _gfxobjList.end(); diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h index 00718d8c26..09f4b2f244 100644 --- a/engines/parallaction/graphics.h +++ b/engines/parallaction/graphics.h @@ -340,12 +340,15 @@ class Disk; enum { kGfxObjVisible = 1, + kGfxObjNormal = 2, + kGfxObjCharacter = 4, kGfxObjTypeDoor = 0, kGfxObjTypeGet = 1, kGfxObjTypeAnim = 2, kGfxObjTypeLabel = 3, - kGfxObjTypeBalloon = 4 + kGfxObjTypeBalloon = 4, + kGfxObjTypeCharacter = 8 }; enum { @@ -356,7 +359,6 @@ enum { class GfxObj { char *_name; Frames *_frames; - uint32 _flags; bool _keep; @@ -365,6 +367,7 @@ public: int32 z; + uint32 _flags; uint type; uint frame; @@ -478,7 +481,7 @@ public: GfxObj* loadDoor(const char *name); void drawGfxObjects(Graphics::Surface &surf); void showGfxObj(GfxObj* obj, bool visible); - void clearGfxObjects(); + void clearGfxObjects(uint filter); void sortAnimations(); diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 3a52b28e06..ca99d2a789 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -91,6 +91,8 @@ Parallaction::~Parallaction() { delete _globalTable; delete _callableNames; + _gfx->clearGfxObjects(kGfxObjCharacter | kGfxObjNormal); + hideDialogueStuff(); freeLocation(); freeCharacter(); @@ -166,6 +168,8 @@ void Parallaction::freeCharacter() { delete _objectsNames; _objectsNames = 0; + _gfx->clearGfxObjects(kGfxObjCharacter); + _char.free(); return; @@ -248,7 +252,7 @@ void Parallaction::freeLocation() { _location._walkNodes.clear(); - _gfx->clearGfxObjects(); + _gfx->clearGfxObjects(kGfxObjNormal); freeBackground(); _location._programs.clear(); @@ -569,10 +573,14 @@ void Character::setName(const char *name) { const char *end = begin + strlen(name); _prefix = _empty; + _suffix = _empty; _dummy = IS_DUMMY_CHARACTER(name); if (!_dummy) { + if (!strstr(name, "donna")) { + _engineFlags &= ~kEngineTransformedDonna; + } else if (_engineFlags & kEngineTransformedDonna) { _suffix = _suffixTras; } else { @@ -581,8 +589,6 @@ void Character::setName(const char *name) { _engineFlags |= kEngineTransformedDonna; _suffix = _suffixTras; end = s; - } else { - _suffix = _empty; } } if (IS_MINI_CHARACTER(name)) { diff --git a/engines/parallaction/parallaction_br.cpp b/engines/parallaction/parallaction_br.cpp index e7f08d0339..c382f6a7f6 100644 --- a/engines/parallaction/parallaction_br.cpp +++ b/engines/parallaction/parallaction_br.cpp @@ -224,7 +224,7 @@ void Parallaction_br::changeLocation(char *location) { // free open location stuff clearSubtitles(); freeBackground(); - _gfx->clearGfxObjects(); + _gfx->clearGfxObjects(kGfxObjNormal | kGfxObjCharacter); _location._programs.clear(); freeZones(); freeAnimations(); diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp index af848aa6af..a2217e4a73 100644 --- a/engines/parallaction/parallaction_ns.cpp +++ b/engines/parallaction/parallaction_ns.cpp @@ -306,6 +306,7 @@ void Parallaction_ns::changeLocation(char *location) { setArrowCursor(); } + _gfx->showGfxObj(_char._ani->gfxobj, false); _location._animations.remove(_char._ani); freeLocation(); @@ -327,6 +328,7 @@ void Parallaction_ns::changeLocation(char *location) { } _location._animations.push_front(_char._ani); + _gfx->showGfxObj(_char._ani->gfxobj, true); strcpy(_saveData1, locname.location()); parseLocation(_saveData1); @@ -411,6 +413,7 @@ void Parallaction_ns::changeCharacter(const char *name) { Common::String oldArchive = _disk->selectArchive((getFeatures() & GF_DEMO) ? "disk0" : "disk1"); _char._ani->gfxobj = _gfx->loadAnim(_char.getFullName()); + _char._ani->gfxobj->setFlags(kGfxObjCharacter); if (!_char.dummy()) { if (getPlatform() == Common::kPlatformAmiga) { -- cgit v1.2.3