Fixed regression introduced with GfxObj: the character sprite was sometimes removed from the rendering list.
svn-id: r32974
This commit is contained in:
parent
d24e770605
commit
18b48c74a9
5 changed files with 33 additions and 18 deletions
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
||||
|
|
|
@ -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)) {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue