[Scummvm-cvs-logs] SF.net SVN: scummvm: [30673] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Mon Jan 28 13:20:54 CET 2008


Revision: 30673
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30673&view=rev
Author:   peres001
Date:     2008-01-28 04:20:53 -0800 (Mon, 28 Jan 2008)

Log Message:
-----------
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.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/debug.cpp
    scummvm/trunk/engines/parallaction/debug.h
    scummvm/trunk/engines/parallaction/exec_ns.cpp
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/graphics.h
    scummvm/trunk/engines/parallaction/objects.cpp
    scummvm/trunk/engines/parallaction/objects.h
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/parallaction_ns.cpp
    scummvm/trunk/engines/parallaction/parser_br.cpp
    scummvm/trunk/engines/parallaction/parser_ns.cpp

Added Paths:
-----------
    scummvm/trunk/engines/parallaction/gfxbase.cpp

Modified: scummvm/trunk/engines/parallaction/debug.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/debug.cpp	2008-01-28 11:28:49 UTC (rev 30672)
+++ scummvm/trunk/engines/parallaction/debug.cpp	2008-01-28 12:20:53 UTC (rev 30673)
@@ -69,6 +69,7 @@
 	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 @@
 	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

Modified: scummvm/trunk/engines/parallaction/debug.h
===================================================================
--- scummvm/trunk/engines/parallaction/debug.h	2008-01-28 11:28:49 UTC (rev 30672)
+++ scummvm/trunk/engines/parallaction/debug.h	2008-01-28 12:20:53 UTC (rev 30673)
@@ -27,6 +27,7 @@
 	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

Modified: scummvm/trunk/engines/parallaction/exec_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-01-28 11:28:49 UTC (rev 30672)
+++ scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-01-28 12:20:53 UTC (rev 30673)
@@ -246,32 +246,33 @@
 
 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 @@
 
 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 @@
 	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,31 +554,14 @@
 //
 //	ZONE TYPE: DOOR
 //
-void Parallaction_ns::jobToggleDoor(void *parm, Job *j) {
+void Parallaction::updateDoor(Zone *z) {
 
-	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);
+	if (z->u.door->gfxobj) {
+		uint frame = (z->_flags & kFlagsClosed ? 0 : 1);
+//		z->u.door->gfxobj->setFrame(frame);
+		z->u.door->gfxobj->frame = frame;
 	}
 
-	count++;
-	if (count == 2) {
-		j->_finished = 1;
-		count = 0;
-	}
-
 	return;
 }
 
@@ -590,63 +573,15 @@
 
 int16 Parallaction::pickupItem(Zone *z) {
 	int r = addInventoryItem(z->u.get->_icon);
-	if (r != -1)
-		addJob(kJobRemovePickedItem, z, kPriority17 );
+	if (r != -1) {
+		_gfx->showGfxObj(z->u.get->gfxobj, false);
+	}
 
 	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;
-	}
-
-//	printf("done");
-
-	return;
-}
-
-
-
-
 Zone *Parallaction::hitZone(uint32 type, uint16 x, uint16 y) {
 //	printf("hitZone(%i, %i, %i)", type, x, y);
 

Added: scummvm/trunk/engines/parallaction/gfxbase.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gfxbase.cpp	                        (rev 0)
+++ scummvm/trunk/engines/parallaction/gfxbase.cpp	2008-01-28 12:20:53 UTC (rev 30673)
@@ -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


Property changes on: scummvm/trunk/engines/parallaction/gfxbase.cpp
___________________________________________________________________
Name: svn:mime-type
   + text/plain
Name: svn:keywords
   + Date Rev Author URL Id
Name: svn:eol-style
   + native

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2008-01-28 11:28:49 UTC (rev 30672)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2008-01-28 12:20:53 UTC (rev 30673)
@@ -360,6 +360,10 @@
 		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::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::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 @@
 //	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 @@
 }
 
 Gfx::Gfx(Parallaction* vm) :
-	_vm(vm) {
+	_vm(vm), _disk(vm->_disk) {
 
 	g_system->beginGFXTransaction();
 	g_system->initSize(_vm->_screenWidth, _vm->_screenHeight);

Modified: scummvm/trunk/engines/parallaction/graphics.h
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.h	2008-01-28 11:28:49 UTC (rev 30672)
+++ scummvm/trunk/engines/parallaction/graphics.h	2008-01-28 12:20:53 UTC (rev 30673)
@@ -247,8 +247,51 @@
 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 {
 
 public:
@@ -259,6 +302,17 @@
 		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

Modified: scummvm/trunk/engines/parallaction/objects.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/objects.cpp	2008-01-28 11:28:49 UTC (rev 30672)
+++ scummvm/trunk/engines/parallaction/objects.cpp	2008-01-28 12:20:53 UTC (rev 30673)
@@ -43,7 +43,7 @@
 
 
 Animation::Animation() {
-	_cnv = NULL;
+	gfxobj = NULL;
 	_program = NULL;
 	_scriptName = 0;
 	_frame = 0;
@@ -53,31 +53,30 @@
 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 @@
 	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 @@
 
 	case kZoneGet:
 		free(u.get->_backup);
-		delete u.get->_cnv;
+		u.get->gfxobj->release();
 		delete u.get;
 		break;
 

Modified: scummvm/trunk/engines/parallaction/objects.h
===================================================================
--- scummvm/trunk/engines/parallaction/objects.h	2008-01-28 11:28:49 UTC (rev 30672)
+++ scummvm/trunk/engines/parallaction/objects.h	2008-01-28 12:20:53 UTC (rev 30673)
@@ -170,7 +170,7 @@
 
 struct GetData {	// size = 24
 	uint32			_icon;
-	Frames			*_cnv;
+	GfxObj			*gfxobj;
 	byte		   *_backup;
 	uint16			field_14;		// unused
 	uint16			field_16;		// unused
@@ -178,7 +178,7 @@
 	GetData() {
 		_icon = 0;
 		_backup = NULL;
-		_cnv = NULL;
+		gfxobj = NULL;
 	}
 };
 struct SpeakData {	// size = 36
@@ -206,7 +206,7 @@
 };
 struct DoorData {	// size = 28
 	char*	_location;
-	Frames	*_cnv;
+	GfxObj	*gfxobj;
 	byte*	_background;
 	Common::Point	_startPos;
 	uint16	_startFrame;
@@ -215,7 +215,7 @@
 		_location = NULL;
 		_background = NULL;
 		_startFrame = 0;
-		_cnv = NULL;
+		gfxobj = NULL;
 	}
 };
 struct HearData {	// size = 20
@@ -387,8 +387,8 @@
 struct Animation : public Zone {
 
 	Common::Point	_oldPos;
-	Program		*_program;
-	Frames		*_cnv;
+	Program 	*_program;
+	GfxObj		*gfxobj;
 	char		*_scriptName;
 	int16		_frame;
 	uint16		field_50;		// unused

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2008-01-28 11:28:49 UTC (rev 30672)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2008-01-28 12:20:53 UTC (rev 30673)
@@ -795,6 +795,8 @@
 
 	_location._walkNodes.clear();
 
+	_gfx->clearGfxObjects();
+
 	freeZones();
 	freeAnimations();
 
@@ -977,12 +979,11 @@
 
 void Character::free() {
 
-	delete _ani._cnv;
 	delete _talk;
 	delete _head;
 	delete _objs;
 
-	_ani._cnv = NULL;
+	_ani.gfxobj = NULL;
 	_talk = NULL;
 	_head = NULL;
 	_objs = NULL;

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2008-01-28 11:28:49 UTC (rev 30672)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2008-01-28 12:20:53 UTC (rev 30673)
@@ -579,6 +579,7 @@
 	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 @@
 	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();

Modified: scummvm/trunk/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2008-01-28 11:28:49 UTC (rev 30672)
+++ scummvm/trunk/engines/parallaction/parallaction_ns.cpp	2008-01-28 12:20:53 UTC (rev 30673)
@@ -389,7 +389,7 @@
 	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) {

Modified: scummvm/trunk/engines/parallaction/parser_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_br.cpp	2008-01-28 11:28:49 UTC (rev 30672)
+++ scummvm/trunk/engines/parallaction/parser_br.cpp	2008-01-28 12:20:53 UTC (rev 30673)
@@ -583,7 +583,7 @@
 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 @@
 	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();
 	}

Modified: scummvm/trunk/engines/parallaction/parser_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_ns.cpp	2008-01-28 11:28:49 UTC (rev 30672)
+++ scummvm/trunk/engines/parallaction/parser_ns.cpp	2008-01-28 12:20:53 UTC (rev 30673)
@@ -146,7 +146,7 @@
 			strcat(vC8, "tras");
 		}
 	}
-	_locParseCtxt.a->_cnv = _disk->loadFrames(vC8);
+	_locParseCtxt.a->gfxobj = _gfx->loadAnim(vC8);
 }
 
 
@@ -1284,17 +1284,18 @@
 	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 @@
 		if (!scumm_stricmp(_tokens[0], "file")) {
 //				printf("file: '%s'", _tokens[0]);
 
-			data->_cnv = _disk->loadFrames(_tokens[1]);
-			uint16 _ax = (z->_flags & kFlagsClosed ? 0 : 1);
+			uint16 frame = (z->_flags & kFlagsClosed ? 0 : 1);
 
-			Common::Rect r;
-			data->_cnv->getRect(0, r);
+			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);
 
-			data->_background = (byte*)malloc(r.width() * r.height());
-			_gfx->backupDoorBackground(data, z->_left, z->_top);
-
-			_gfx->flatBlitCnv(data->_cnv, _ax, z->_left, z->_top, Gfx::kBitBack);
+			data->gfxobj = obj;
 		}
 
 		if (!scumm_stricmp(_tokens[0],	"startpos")) {


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list