aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicola Mettifogo2008-01-28 12:20:53 +0000
committerNicola Mettifogo2008-01-28 12:20:53 +0000
commitbe2c5d3c8772963fe2c1a00c1a50546438e3e7a5 (patch)
treef30cec285aa712523432bc8f6cc119a4ac37f22d
parente32e1b732cb99e760d4bdb4b72b0dd8a3d96bb7b (diff)
downloadscummvm-rg350-be2c5d3c8772963fe2c1a00c1a50546438e3e7a5.tar.gz
scummvm-rg350-be2c5d3c8772963fe2c1a00c1a50546438e3e7a5.tar.bz2
scummvm-rg350-be2c5d3c8772963fe2c1a00c1a50546438e3e7a5.zip
All interactive objects are now drawn in the framebuffer instead of using the old kBitBack/kBitFront buffers. Animation are not sorted yet, so they can overlap in an inconsistent fashion for the time being.
svn-id: r30673
-rw-r--r--engines/parallaction/debug.cpp25
-rw-r--r--engines/parallaction/debug.h1
-rw-r--r--engines/parallaction/exec_ns.cpp123
-rw-r--r--engines/parallaction/gfxbase.cpp124
-rw-r--r--engines/parallaction/graphics.cpp62
-rw-r--r--engines/parallaction/graphics.h54
-rw-r--r--engines/parallaction/objects.cpp23
-rw-r--r--engines/parallaction/objects.h12
-rw-r--r--engines/parallaction/parallaction.cpp5
-rw-r--r--engines/parallaction/parallaction.h7
-rw-r--r--engines/parallaction/parallaction_ns.cpp2
-rw-r--r--engines/parallaction/parser_br.cpp4
-rw-r--r--engines/parallaction/parser_ns.cpp36
13 files changed, 285 insertions, 193 deletions
diff --git a/engines/parallaction/debug.cpp b/engines/parallaction/debug.cpp
index ba7db28e35..819a51f877 100644
--- a/engines/parallaction/debug.cpp
+++ b/engines/parallaction/debug.cpp
@@ -69,6 +69,7 @@ Debugger::Debugger(Parallaction *vm)
DCmd_Register("animations", WRAP_METHOD(Debugger, Cmd_Animations));
DCmd_Register("localflags", WRAP_METHOD(Debugger, Cmd_LocalFlags));
DCmd_Register("locations", WRAP_METHOD(Debugger, Cmd_Locations));
+ DCmd_Register("gfxobjects", WRAP_METHOD(Debugger, Cmd_GfxObjects));
}
@@ -209,4 +210,28 @@ bool Debugger::Cmd_Animations(int argc, const char **argv) {
return true;
}
+bool Debugger::Cmd_GfxObjects(int argc, const char **argv) {
+
+ const char *objType[] = { "DOOR", "GET", "ANIM" };
+
+ DebugPrintf("+--------------------+-----+-----+-----+-----+--------+--------+\n"
+ "| name | x | y | z | f | type | flag |\n"
+ "+--------------------+-----+-----+-----+-----+--------+--------+\n");
+
+ for (uint i = 0; i < 3; i++) {
+ GfxObjList::iterator b = _vm->_gfx->_gfxobjList[i].begin();
+ GfxObjList::iterator e = _vm->_gfx->_gfxobjList[i].end();
+
+ for ( ; b != e; b++) {
+ GfxObj *obj = *b;
+ DebugPrintf("|%-20s|%5i|%5i|%5i|%5i|%8s|%8x|\n", obj->getName(), obj->x, obj->y, obj->z, obj->frame, objType[obj->type], 6 );
+ }
+ }
+
+ DebugPrintf("+--------------------+-----+-----+-----+-----+--------+--------+\n");
+
+ return true;
+}
+
+
} // namespace Parallaction
diff --git a/engines/parallaction/debug.h b/engines/parallaction/debug.h
index 59ac24b27d..6f648d131f 100644
--- a/engines/parallaction/debug.h
+++ b/engines/parallaction/debug.h
@@ -27,6 +27,7 @@ protected:
bool Cmd_Animations(int argc, const char **argv);
bool Cmd_LocalFlags(int argc, const char **argv);
bool Cmd_Locations(int argc, const char **argv);
+ bool Cmd_GfxObjects(int argc, const char **argv);
};
} // End of namespace Parallaction
diff --git a/engines/parallaction/exec_ns.cpp b/engines/parallaction/exec_ns.cpp
index c7f6464696..ddaa10d81b 100644
--- a/engines/parallaction/exec_ns.cpp
+++ b/engines/parallaction/exec_ns.cpp
@@ -246,32 +246,33 @@ DECLARE_COMMAND_OPCODE(location) {
DECLARE_COMMAND_OPCODE(open) {
_cmdRunCtxt.cmd->u._zone->_flags &= ~kFlagsClosed;
- if (_cmdRunCtxt.cmd->u._zone->u.door->_cnv) {
- addJob(kJobToggleDoor, (void*)_cmdRunCtxt.cmd->u._zone, kPriority18 );
+ if (_cmdRunCtxt.cmd->u._zone->u.door->gfxobj) {
+ updateDoor(_cmdRunCtxt.cmd->u._zone);
}
}
DECLARE_COMMAND_OPCODE(close) {
_cmdRunCtxt.cmd->u._zone->_flags |= kFlagsClosed;
- if (_cmdRunCtxt.cmd->u._zone->u.door->_cnv) {
- addJob(kJobToggleDoor, (void*)_cmdRunCtxt.cmd->u._zone, kPriority18 );
+ if (_cmdRunCtxt.cmd->u._zone->u.door->gfxobj) {
+ updateDoor(_cmdRunCtxt.cmd->u._zone);
}
}
DECLARE_COMMAND_OPCODE(on) {
+ Zone *z = _cmdRunCtxt.cmd->u._zone;
// WORKAROUND: the original DOS-based engine didn't check u->_zone before dereferencing
// the pointer to get structure members, thus leading to crashes in systems with memory
// protection.
// As a side note, the overwritten address is the 5th entry in the DOS interrupt table
// (print screen handler): this suggests that a system would hang when the print screen
// key is pressed after playing Nippon Safes, provided that this code path is taken.
- if (_cmdRunCtxt.cmd->u._zone != NULL) {
- _cmdRunCtxt.cmd->u._zone->_flags &= ~kFlagsRemove;
- _cmdRunCtxt.cmd->u._zone->_flags |= kFlagsActive;
- if ((_cmdRunCtxt.cmd->u._zone->_type & 0xFFFF) == kZoneGet) {
- addJob(kJobDisplayDroppedItem, _cmdRunCtxt.cmd->u._zone, kPriority17 );
+ if (z != NULL) {
+ z->_flags &= ~kFlagsRemove;
+ z->_flags |= kFlagsActive;
+ if ((z->_type & 0xFFFF) == kZoneGet) {
+ _gfx->showGfxObj(z->u.get->gfxobj, true);
}
}
}
@@ -319,36 +320,36 @@ DECLARE_COMMAND_OPCODE(stop) {
void Parallaction_ns::drawAnimations() {
- Graphics::Surface v14;
-
uint16 _si = 0;
for (AnimationList::iterator it = _animations.begin(); it != _animations.end(); it++) {
Animation *v18 = *it;
+ GfxObj *obj = v18->gfxobj;
if ((v18->_flags & kFlagsActive) && ((v18->_flags & kFlagsRemove) == 0)) {
- v14.w = v18->width();
- v14.h = v18->height();
int16 frame = CLIP((int)v18->_frame, 0, v18->getFrameNum()-1);
-
- v14.pixels = v18->getFrameData(frame);
-
if (v18->_flags & kFlagsNoMasked)
_si = 3;
else
_si = _gfx->queryMask(v18->_top + v18->height());
- debugC(9, kDebugExec, "jobDisplayAnimations(%s, x:%i, y:%i, z:%i, w:%i, h:%i, f:%i/%i, %p)", v18->_name, v18->_left, v18->_top, _si, v14.w, v14.h,
- frame, v18->getFrameNum(), v14.pixels);
- _gfx->blitCnv(&v14, v18->_left, v18->_top, _si, Gfx::kBitBack);
+ _gfx->showGfxObj(obj, true);
+ obj->frame = frame;
+// obj->setFrame(frame);
+ obj->x = v18->_left;
+ obj->y = v18->_top;
+// obj->setPos(v18->_top, v18->_left);
+// obj->setZ(_si);
+ obj->z = _si;
}
if (((v18->_flags & kFlagsActive) == 0) && (v18->_flags & kFlagsRemove)) {
v18->_flags &= ~kFlagsRemove;
v18->_oldPos.x = -1000;
+ _gfx->showGfxObj(obj, false);
}
if ((v18->_flags & kFlagsActive) && (v18->_flags & kFlagsRemove)) {
@@ -530,8 +531,7 @@ uint16 Parallaction::runZone(Zone *z) {
case kZoneDoor:
if (z->_flags & kFlagsLocked) break;
z->_flags ^= kFlagsClosed;
- if (z->u.door->_cnv == NULL) break;
- addJob(kJobToggleDoor, z, kPriority18 );
+ updateDoor(z);
break;
case kZoneHear:
@@ -554,29 +554,12 @@ uint16 Parallaction::runZone(Zone *z) {
//
// ZONE TYPE: DOOR
//
-void Parallaction_ns::jobToggleDoor(void *parm, Job *j) {
-
- static byte count = 0;
-
- Zone *z = (Zone*)parm;
-
- if (z->u.door->_cnv) {
- Common::Rect r;
- z->u.door->_cnv->getRect(0, r);
- r.moveTo(z->_left, z->_top);
-
- uint16 _ax = (z->_flags & kFlagsClosed ? 1 : 0);
- _gfx->restoreDoorBackground(r, z->u.door->_cnv->getData(_ax), z->u.door->_background);
-
- _ax = (z->_flags & kFlagsClosed ? 0 : 1);
- _gfx->flatBlitCnv(z->u.door->_cnv, _ax, z->_left, z->_top, Gfx::kBitBack);
- _gfx->flatBlitCnv(z->u.door->_cnv, _ax, z->_left, z->_top, Gfx::kBit2);
- }
+void Parallaction::updateDoor(Zone *z) {
- count++;
- if (count == 2) {
- j->_finished = 1;
- count = 0;
+ if (z->u.door->gfxobj) {
+ uint frame = (z->_flags & kFlagsClosed ? 0 : 1);
+// z->u.door->gfxobj->setFrame(frame);
+ z->u.door->gfxobj->frame = frame;
}
return;
@@ -590,63 +573,15 @@ void Parallaction_ns::jobToggleDoor(void *parm, Job *j) {
int16 Parallaction::pickupItem(Zone *z) {
int r = addInventoryItem(z->u.get->_icon);
- if (r != -1)
- addJob(kJobRemovePickedItem, z, kPriority17 );
-
- return (r == -1);
-}
-
-void Parallaction_ns::jobRemovePickedItem(void *parm, Job *j) {
-
- Zone *z = (Zone*)parm;
-
- static uint16 count = 0;
-
- if (z->u.get->_cnv) {
- Common::Rect r;
- z->u.get->_cnv->getRect(0, r);
- r.moveTo(z->_left, z->_top);
-
- _gfx->restoreGetBackground(r, z->u.get->_backup);
- }
-
- count++;
- if (count == 2) {
- count = 0;
- j->_finished = 1;
- }
-
- return;
-}
-
-void Parallaction_ns::jobDisplayDroppedItem(void *parm, Job *j) {
-// printf("jobDisplayDroppedItem...");
-
- Zone *z = (Zone*)parm;
-
- if (z->u.get->_cnv) {
- if (j->_count == 0) {
- _gfx->backupGetBackground(z->u.get, z->_left, z->_top);
- }
-
- _gfx->flatBlitCnv(z->u.get->_cnv, 0, z->_left, z->_top, Gfx::kBitBack);
- _gfx->flatBlitCnv(z->u.get->_cnv, 0, z->_left, z->_top, Gfx::kBit2);
- }
-
- j->_count++;
- if (j->_count == 2) {
- j->_count = 0;
- j->_finished = 1;
+ if (r != -1) {
+ _gfx->showGfxObj(z->u.get->gfxobj, false);
}
-// printf("done");
-
- return;
+ return (r == -1);
}
-
Zone *Parallaction::hitZone(uint32 type, uint16 x, uint16 y) {
// printf("hitZone(%i, %i, %i)", type, x, y);
diff --git a/engines/parallaction/gfxbase.cpp b/engines/parallaction/gfxbase.cpp
new file mode 100644
index 0000000000..02d7e09492
--- /dev/null
+++ b/engines/parallaction/gfxbase.cpp
@@ -0,0 +1,124 @@
+#include "graphics.h"
+#include "disk.h"
+
+namespace Parallaction {
+
+GfxObj::GfxObj(uint objType, Frames *frames, const char* name) : type(objType), _frames(frames), x(0), y(0), z(3), frame(0), _flags(0), _keep(true) {
+ if (name) {
+ _name = strdup(name);
+ } else {
+ _name = 0;
+ }
+}
+
+GfxObj::~GfxObj() {
+ delete _frames;
+ free(_name);
+}
+
+void GfxObj::release() {
+// _keep = false;
+ delete this;
+}
+
+const char *GfxObj::getName() const {
+ return _name;
+}
+
+
+uint GfxObj::getNum() {
+ return _frames->getNum();
+}
+
+
+void GfxObj::getRect(uint frame, Common::Rect &r) {
+ _frames->getRect(frame, r);
+}
+
+
+byte *GfxObj::getData(uint frame) {
+ return _frames->getData(frame);
+}
+
+
+void GfxObj::setFlags(uint flags) {
+ _flags |= flags;
+}
+
+void GfxObj::clearFlags(uint flags) {
+ _flags &= ~flags;
+}
+
+GfxObj* Gfx::loadAnim(const char *name) {
+ Frames *frames = _disk->loadFrames(name);
+ GfxObj *obj = new GfxObj(kGfxObjTypeAnim, frames, name);
+ assert(obj);
+
+ return obj;
+}
+
+
+GfxObj* Gfx::loadGet(const char *name) {
+ Frames *frames = _disk->loadStatic(name);
+ GfxObj *obj = new GfxObj(kGfxObjTypeGet, frames, name);
+ assert(obj);
+
+ return obj;
+}
+
+GfxObj* Gfx::loadDoor(const char *name) {
+ Frames *frames = _disk->loadFrames(name);
+ GfxObj *obj = new GfxObj(kGfxObjTypeDoor, frames, name);
+ assert(obj);
+
+ return obj;
+}
+
+void Gfx::clearGfxObjects() {
+ _gfxobjList[0].clear();
+ _gfxobjList[1].clear();
+ _gfxobjList[2].clear();
+}
+
+void Gfx::showGfxObj(GfxObj* obj, bool visible) {
+ if (!obj || obj->isVisible() == visible) {
+ return;
+ }
+
+ if (visible) {
+ obj->setFlags(kGfxObjVisible);
+ _gfxobjList[obj->type].push_back(obj);
+ } else {
+ obj->clearFlags(kGfxObjVisible);
+ _gfxobjList[obj->type].remove(obj);
+ }
+
+}
+
+void Gfx::drawGfxObjects(Graphics::Surface &surf) {
+
+ Common::Rect rect;
+ byte *data;
+
+ // TODO: sort animations before drawing
+ // TODO: some zones don't appear because of wrong masking (3 or 0?)
+ // TODO: Dr.Ki is not visible inside the club
+
+ for (uint i = 0; i < 3; i++) {
+
+ GfxObjList::iterator b = _gfxobjList[i].begin();
+ GfxObjList::iterator e = _gfxobjList[i].end();
+
+ for (; b != e; b++) {
+ GfxObj *obj = *b;
+ if (obj->isVisible()) {
+ obj->getRect(obj->frame, rect);
+ rect.moveTo(obj->x, obj->y);
+ data = obj->getData(obj->frame);
+ blt(rect, data, &surf, obj->z, 0);
+ }
+ }
+ }
+}
+
+} // namespace Parallaction
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index 15f08df37a..ec5cc904f0 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -360,6 +360,10 @@ void Gfx::updateScreen() {
g_system->copyRectToScreen((const byte*)_buffers[kBitFront]->pixels, _buffers[kBitFront]->pitch, _screenX, _screenY, _vm->_screenWidth, _vm->_screenHeight);
}
+ Graphics::Surface *surf = g_system->lockScreen();
+ drawGfxObjects(*surf);
+ g_system->unlockScreen();
+
drawInventory();
drawItems();
@@ -719,37 +723,10 @@ void Gfx::blitCnv(Graphics::Surface *cnv, int16 x, int16 y, uint16 z, Gfx::Buffe
}
void Gfx::backupDoorBackground(DoorData *data, int16 x, int16 y) {
- byte *s = (byte*)_buffers[kBit2]->getBasePtr(x, y);
- Common::Rect r;
- data->_cnv->getRect(0, r);
- copyRect(r.width(), r.height(), data->_background, r.width(), s,_backgroundWidth);
- return;
}
void Gfx::backupGetBackground(GetData *data, int16 x, int16 y) {
- byte *t = (byte*)data->_cnv->getData(0);
- byte *s = (byte*)_buffers[kBitBack]->getBasePtr(x, y);
- byte *d = data->_backup;
-
- Common::Rect r;
- data->_cnv->getRect(0, r);
-
- uint pitch = _backgroundWidth - r.width();
-
- for (uint16 i = 0; i < r.height(); i++) {
- for (uint16 j = 0; j < r.width(); j++) {
- *d = (*t) ? *s : 0;
-
- d++;
- t++;
- s++;
- }
-
- s += pitch;
- }
-
- return;
}
//
@@ -757,32 +734,6 @@ void Gfx::backupGetBackground(GetData *data, int16 x, int16 y) {
//
void Gfx::restoreDoorBackground(const Common::Rect& r, byte *data, byte* background) {
- byte *t = data;
- byte *s = background;
- byte *d0 = (byte*)_buffers[kBitBack]->getBasePtr(r.left, r.top);
- byte *d1 = (byte*)_buffers[kBit2]->getBasePtr(r.left, r.top);
-
- uint pitch = _backgroundWidth - r.width();
-
- for (uint16 i = 0; i < r.height() ; i++) {
- for (uint16 j = 0; j < r.width() ; j++) {
- if (*t) {
- *d0 = *s;
- *d1 = *s;
- }
-
- d0++;
- d1++;
- t++;
- s++;
- }
-
- d0 += pitch;
- d1 += pitch;
- }
-
-
- return;
}
@@ -790,8 +741,7 @@ void Gfx::restoreDoorBackground(const Common::Rect& r, byte *data, byte* backgro
// copies a rectangular bitmap on the background
//
void Gfx::restoreGetBackground(const Common::Rect& r, byte *data) {
- blt(r, data, _buffers[kBitBack], BUFFER_FOREGROUND, 0);
- blt(r, data, _buffers[kBit2], BUFFER_FOREGROUND, 0);
+
}
@@ -917,7 +867,7 @@ int16 Gfx::queryMask(int16 v) {
}
Gfx::Gfx(Parallaction* vm) :
- _vm(vm) {
+ _vm(vm), _disk(vm->_disk) {
g_system->beginGFXTransaction();
g_system->initSize(_vm->_screenWidth, _vm->_screenHeight);
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index 2e0930a49e..afd9b808e0 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -247,7 +247,50 @@ class Parallaction;
struct DoorData;
struct GetData;
struct Label;
+class Disk;
+enum {
+ kGfxObjVisible = 1,
+
+
+ kGfxObjTypeDoor = 0,
+ kGfxObjTypeGet = 1,
+ kGfxObjTypeAnim = 2,
+};
+
+class GfxObj {
+ char *_name;
+ Frames *_frames;
+ uint32 _flags;
+
+ bool _keep;
+
+public:
+ int16 x, y;
+ uint16 z;
+ uint type;
+ uint frame;
+
+ GfxObj(uint type, Frames *frames, const char *name = NULL);
+ virtual ~GfxObj();
+
+ const char *getName() const;
+
+ uint getNum();
+ void getRect(uint frame, Common::Rect &r);
+ byte *getData(uint frame);
+
+ void setFlags(uint32 flags);
+ void clearFlags(uint32 flags);
+ bool isVisible() {
+ return (_flags & kGfxObjVisible) == kGfxObjVisible;
+ }
+
+ void release();
+};
+
+
+typedef Common::List<GfxObj*> GfxObjList;
class Gfx {
@@ -259,6 +302,17 @@ public:
kBit2
};
+ Disk *_disk;
+
+ GfxObj* loadAnim(const char *name);
+ GfxObj* loadGet(const char *name);
+ GfxObj* loadDoor(const char *name);
+ void clearGfxObjects();
+
+ void showGfxObj(GfxObj* obj, bool visible);
+ GfxObjList _gfxobjList[3];
+ void drawGfxObjects(Graphics::Surface &surf);
+
public:
// balloons and text
diff --git a/engines/parallaction/objects.cpp b/engines/parallaction/objects.cpp
index 5e8760042d..19b3196167 100644
--- a/engines/parallaction/objects.cpp
+++ b/engines/parallaction/objects.cpp
@@ -43,7 +43,7 @@ Command::~Command() {
Animation::Animation() {
- _cnv = NULL;
+ gfxobj = NULL;
_program = NULL;
_scriptName = 0;
_frame = 0;
@@ -53,31 +53,30 @@ Animation::Animation() {
Animation::~Animation() {
delete _program;
free(_scriptName);
- delete _cnv;
}
uint16 Animation::width() const {
- if (!_cnv) return 0;
+ if (!gfxobj) return 0;
Common::Rect r;
- _cnv->getRect(0, r);
+ gfxobj->getRect(0, r);
return r.width();
}
uint16 Animation::height() const {
- if (!_cnv) return 0;
+ if (!gfxobj) return 0;
Common::Rect r;
- _cnv->getRect(0, r);
+ gfxobj->getRect(0, r);
return r.height();
}
uint16 Animation::getFrameNum() const {
- if (!_cnv) return 0;
- return _cnv->getNum();
+ if (!gfxobj) return 0;
+ return gfxobj->getNum();
}
byte* Animation::getFrameData(uint32 index) const {
- if (!_cnv) return NULL;
- return _cnv->getData(index);
+ if (!gfxobj) return NULL;
+ return gfxobj->getData(index);
}
@@ -142,7 +141,7 @@ Zone::~Zone() {
case kZoneDoor:
free(u.door->_location);
free(u.door->_background);
- delete u.door->_cnv;
+ u.door->gfxobj->release();
delete u.door;
break;
@@ -153,7 +152,7 @@ Zone::~Zone() {
case kZoneGet:
free(u.get->_backup);
- delete u.get->_cnv;
+ u.get->gfxobj->release();
delete u.get;
break;
diff --git a/engines/parallaction/objects.h b/engines/parallaction/objects.h
index 7384878f64..f841e4be1e 100644
--- a/engines/parallaction/objects.h
+++ b/engines/parallaction/objects.h
@@ -170,7 +170,7 @@ struct Dialogue {
struct GetData { // size = 24
uint32 _icon;
- Frames *_cnv;
+ GfxObj *gfxobj;
byte *_backup;
uint16 field_14; // unused
uint16 field_16; // unused
@@ -178,7 +178,7 @@ struct GetData { // size = 24
GetData() {
_icon = 0;
_backup = NULL;
- _cnv = NULL;
+ gfxobj = NULL;
}
};
struct SpeakData { // size = 36
@@ -206,7 +206,7 @@ struct ExamineData { // size = 28
};
struct DoorData { // size = 28
char* _location;
- Frames *_cnv;
+ GfxObj *gfxobj;
byte* _background;
Common::Point _startPos;
uint16 _startFrame;
@@ -215,7 +215,7 @@ struct DoorData { // size = 28
_location = NULL;
_background = NULL;
_startFrame = 0;
- _cnv = NULL;
+ gfxobj = NULL;
}
};
struct HearData { // size = 20
@@ -387,8 +387,8 @@ struct Program {
struct Animation : public Zone {
Common::Point _oldPos;
- Program *_program;
- Frames *_cnv;
+ Program *_program;
+ GfxObj *gfxobj;
char *_scriptName;
int16 _frame;
uint16 field_50; // unused
diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp
index 33789b399c..d8e87226d6 100644
--- a/engines/parallaction/parallaction.cpp
+++ b/engines/parallaction/parallaction.cpp
@@ -795,6 +795,8 @@ void Parallaction::freeLocation() {
_location._walkNodes.clear();
+ _gfx->clearGfxObjects();
+
freeZones();
freeAnimations();
@@ -977,12 +979,11 @@ void Character::scheduleWalk(int16 x, int16 y) {
void Character::free() {
- delete _ani._cnv;
delete _talk;
delete _head;
delete _objs;
- _ani._cnv = NULL;
+ _ani.gfxobj = NULL;
_talk = NULL;
_head = NULL;
_objs = NULL;
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 9c5565915e..1523b8b4a5 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -579,6 +579,7 @@ public:
virtual void jobDisplayDroppedItem(void*, Job *j) = 0;
virtual void jobRemovePickedItem(void*, Job *j) = 0;
virtual void jobToggleDoor(void*, Job *j) = 0;
+ void updateDoor(Zone *z);
virtual void runScripts() = 0;
virtual void walk() = 0;
@@ -751,9 +752,9 @@ private:
const Callable *_callables;
protected:
- void jobDisplayDroppedItem(void*, Job *j);
- void jobRemovePickedItem(void*, Job *j);
- void jobToggleDoor(void*, Job *j);
+ void jobDisplayDroppedItem(void*, Job *j) { }
+ void jobRemovePickedItem(void*, Job *j) { }
+ void jobToggleDoor(void*, Job *j) { }
void runScripts();
void walk();
diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp
index 609235bb68..4d1ee8dd9e 100644
--- a/engines/parallaction/parallaction_ns.cpp
+++ b/engines/parallaction/parallaction_ns.cpp
@@ -389,7 +389,7 @@ void Parallaction_ns::changeCharacter(const char *name) {
freeCharacter();
Common::String oldArchive = _disk->selectArchive((getFeatures() & GF_DEMO) ? "disk0" : "disk1");
- _char._ani._cnv = _disk->loadFrames(_char.getFullName());
+ _char._ani.gfxobj = _gfx->loadAnim(_char.getFullName());
if (!_char.dummy()) {
if (getPlatform() == Common::kPlatformAmiga) {
diff --git a/engines/parallaction/parser_br.cpp b/engines/parallaction/parser_br.cpp
index 1f83c346bd..9b42b043af 100644
--- a/engines/parallaction/parser_br.cpp
+++ b/engines/parallaction/parser_br.cpp
@@ -583,7 +583,7 @@ DECLARE_ZONE_PARSER(type) {
DECLARE_ANIM_PARSER(file) {
debugC(7, kDebugParser, "ANIM_PARSER(file) ");
- _locParseCtxt.a->_cnv = _disk->loadFrames(_tokens[1]);
+ _locParseCtxt.a->gfxobj = _gfx->loadAnim(_tokens[1]);
}
@@ -610,7 +610,7 @@ DECLARE_ANIM_PARSER(endanimation) {
debugC(7, kDebugParser, "ANIM_PARSER(endanimation) ");
- if (_locParseCtxt.a->_cnv) {
+ if (_locParseCtxt.a->gfxobj) {
_locParseCtxt.a->_right = _locParseCtxt.a->width();
_locParseCtxt.a->_bottom = _locParseCtxt.a->height();
}
diff --git a/engines/parallaction/parser_ns.cpp b/engines/parallaction/parser_ns.cpp
index 6cd298ea0c..5761938735 100644
--- a/engines/parallaction/parser_ns.cpp
+++ b/engines/parallaction/parser_ns.cpp
@@ -146,7 +146,7 @@ DECLARE_ANIM_PARSER(file) {
strcat(vC8, "tras");
}
}
- _locParseCtxt.a->_cnv = _disk->loadFrames(vC8);
+ _locParseCtxt.a->gfxobj = _gfx->loadAnim(vC8);
}
@@ -1284,17 +1284,18 @@ void Parallaction_ns::parseGetData(Script &script, Zone *z) {
do {
if (!scumm_stricmp(_tokens[0], "file")) {
- data->_cnv = _disk->loadStatic(_tokens[1]);
- Common::Rect r;
- data->_cnv->getRect(0, r);
+ bool visible = (z->_flags & kFlagsRemove) == 0;
- data->_backup = (byte*)malloc(r.width() * r.height());
+ GfxObj *obj = _gfx->loadGet(_tokens[1]);
+// obj->setFrame(0);
+// obj->setPos(z->_left, z->_top);
+ obj->frame = 0;
+ obj->x = z->_left;
+ obj->y = z->_top;
+ _gfx->showGfxObj(obj, visible);
- if ((z->_flags & kFlagsRemove) == 0) {
- _gfx->backupGetBackground(data, z->_left, z->_top);
- _gfx->flatBlitCnv(data->_cnv, 0, z->_left, z->_top, Gfx::kBitBack);
- }
+ data->gfxobj = obj;
}
if (!scumm_stricmp(_tokens[0], "icon")) {
@@ -1349,16 +1350,17 @@ void Parallaction_ns::parseDoorData(Script &script, Zone *z) {
if (!scumm_stricmp(_tokens[0], "file")) {
// printf("file: '%s'", _tokens[0]);
- data->_cnv = _disk->loadFrames(_tokens[1]);
- uint16 _ax = (z->_flags & kFlagsClosed ? 0 : 1);
-
- Common::Rect r;
- data->_cnv->getRect(0, r);
+ uint16 frame = (z->_flags & kFlagsClosed ? 0 : 1);
- data->_background = (byte*)malloc(r.width() * r.height());
- _gfx->backupDoorBackground(data, z->_left, z->_top);
+ GfxObj *obj = _gfx->loadDoor(_tokens[1]);
+// obj->setFrame(frame);
+// obj->setPos(z->_left, z->_top);
+ obj->frame = frame;
+ obj->x = z->_left;
+ obj->y = z->_top;
+ _gfx->showGfxObj(obj, true);
- _gfx->flatBlitCnv(data->_cnv, _ax, z->_left, z->_top, Gfx::kBitBack);
+ data->gfxobj = obj;
}
if (!scumm_stricmp(_tokens[0], "startpos")) {