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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Sun Feb 4 09:12:34 CET 2007


Revision: 25376
          http://scummvm.svn.sourceforge.net/scummvm/?rev=25376&view=rev
Author:   peres001
Date:     2007-02-04 00:12:33 -0800 (Sun, 04 Feb 2007)

Log Message:
-----------
changed handling of zone labels to match original engine

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/animation.cpp
    scummvm/trunk/engines/parallaction/commands.cpp
    scummvm/trunk/engines/parallaction/defs.h
    scummvm/trunk/engines/parallaction/graphics.cpp
    scummvm/trunk/engines/parallaction/inventory.cpp
    scummvm/trunk/engines/parallaction/parallaction.cpp
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/zone.cpp
    scummvm/trunk/engines/parallaction/zone.h

Modified: scummvm/trunk/engines/parallaction/animation.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/animation.cpp	2007-02-04 08:10:00 UTC (rev 25375)
+++ scummvm/trunk/engines/parallaction/animation.cpp	2007-02-04 08:12:33 UTC (rev 25376)
@@ -67,7 +67,7 @@
 	Animation *v4 = (Animation*)_animations._next;
 
 	while (v4) {
-		if (!scumm_stricmp(name, v4->_zone._name)) return v4;
+		if (!scumm_stricmp(name, v4->_zone._label._text)) return v4;
 		v4 = (Animation*)v4->_zone._node._next;
 	}
 
@@ -81,8 +81,8 @@
 	Animation *vD0 = (Animation*)memAlloc(sizeof(Animation));
 	memset(vD0, 0, sizeof(Animation));
 
-	vD0->_zone._name = (char*)memAlloc(strlen(name)+1);
-	strcpy(vD0->_zone._name, name);
+	vD0->_zone._label._text = (char*)memAlloc(strlen(name)+1);
+	strcpy(vD0->_zone._label._text, name);
 
 	addNode(list, &vD0->_zone._node);
 
@@ -109,7 +109,7 @@
 			}
 		}
 		if (!scumm_stricmp(_tokens[0], "label")) {
-			_vm->_graphics->makeCnvFromString(&vD0->_zone._label, _tokens[1]);
+			_vm->_graphics->makeCnvFromString(&vD0->_zone._label._cnv, _tokens[1]);
 		}
 		if (!scumm_stricmp(_tokens[0], "flags")) {
 			uint16 _si = 1;
@@ -226,7 +226,7 @@
 
 
 void jobEraseAnimations(void *arg_0, Job *j) {
-//	printf("jobEraseAnimations()...\n");
+	debugC(1, kDebugLocation, "jobEraseAnimations");
 
 	Animation *a = (Animation*)_animations._next;
 
@@ -358,7 +358,7 @@
 	case INST_ON:	// on
 	case INST_OFF:	// off
 	case INST_START:	// start
-		if (!scumm_stricmp(_tokens[1], a->_zone._name)) {
+		if (!scumm_stricmp(_tokens[1], a->_zone._label._text)) {
 			inst->_opBase._a = a;
 		} else {
 			inst->_opBase._a = findAnimation(_tokens[1]);
@@ -426,7 +426,7 @@
 		break;
 
 	case INST_PUT:	// put
-		if (!scumm_stricmp(_tokens[1], a->_zone._name)) {
+		if (!scumm_stricmp(_tokens[1], a->_zone._label._text)) {
 			inst->_opBase._a = a;
 		} else {
 			inst->_opBase._a = findAnimation(_tokens[1]);
@@ -521,7 +521,7 @@
 
 
 void jobRunScripts(void *parm, Job *j) {
-//	printf("jobRunScripts()\n");
+    debugC(1, kDebugLocation, "jobRunScripts");
 
 	static uint16 modCounter = 0;
 
@@ -607,7 +607,7 @@
 
 			case INST_MOVE: // move
 				v4 = buildWalkPath(*inst->_opA._pvalue, *inst->_opB._pvalue);
-				addJob(jobWalk, v4, JOBPRIORITY_WALK );
+				addJob(jobWalk, v4, kPriority19 );
 				_engineFlags |= kEngineWalking;
 				break;
 

Modified: scummvm/trunk/engines/parallaction/commands.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/commands.cpp	2007-02-04 08:10:00 UTC (rev 25375)
+++ scummvm/trunk/engines/parallaction/commands.cpp	2007-02-04 08:12:33 UTC (rev 25376)
@@ -286,7 +286,7 @@
 		case CMD_OPEN:	// open
 			u->_zone->_flags &= ~kFlagsClosed;
 			if (u->_zone->u.door->_cnv._count != 0) {
-				addJob(&jobToggleDoor, (void*)u->_zone, JOBPRIORITY_TOGGLEDOOR );
+				addJob(&jobToggleDoor, (void*)u->_zone, kPriority18 );
 			}
 			break;
 
@@ -298,7 +298,7 @@
 			u->_zone->_flags &= ~kFlagsRemove;
 			u->_zone->_flags |= kFlagsActive;
 			if ((u->_zone->_type & 0xFFFF) == kZoneGet) {
-				addJob(&jobDisplayDroppedItem, u->_zone, JOBPRIORITY_ADDREMOVEITEMS );
+				addJob(&jobDisplayDroppedItem, u->_zone, kPriority17 );
 			}
 			break;
 
@@ -326,7 +326,7 @@
 
 			WalkNode *vC = buildWalkPath(u->_move._x, u->_move._y);
 
-			addJob(&jobWalk, vC, JOBPRIORITY_WALK );
+			addJob(&jobWalk, vC, kPriority19 );
 			_engineFlags |= kEngineWalking;
 			}
 			break;

Modified: scummvm/trunk/engines/parallaction/defs.h
===================================================================
--- scummvm/trunk/engines/parallaction/defs.h	2007-02-04 08:10:00 UTC (rev 25375)
+++ scummvm/trunk/engines/parallaction/defs.h	2007-02-04 08:12:33 UTC (rev 25376)
@@ -83,6 +83,7 @@
 struct ArchivedFile;
 struct Animation;
 struct Zone;
+struct ZoneLabel;
 
 struct Command;
 

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2007-02-04 08:10:00 UTC (rev 25375)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2007-02-04 08:12:33 UTC (rev 25376)
@@ -27,6 +27,7 @@
 #include "parallaction/parallaction.h"
 #include "parallaction/inventory.h"
 #include "parallaction/disk.h"
+#include "parallaction/zone.h"
 
 
 extern OSystem *g_system;
@@ -456,35 +457,39 @@
 
 void jobDisplayLabel(void *parm, Job *j) {
 
-	StaticCnv *cnv = (StaticCnv*)parm;
+	ZoneLabel *label = (ZoneLabel*)parm;
 
-	if (cnv->_data0 == NULL) return;
-	_vm->_graphics->flatBlitCnv(cnv, Graphics::_labelPosition[0]._x, Graphics::_labelPosition[0]._y, Graphics::kBitBack, cnv->_data1);
+   debugC(1, kDebugLocation, "jobDisplayLabel (%x)", (uint32) label);
 
+	if (label->_cnv._width == 0) return;
+	_vm->_graphics->flatBlitCnv(&label->_cnv, Graphics::_labelPosition[0]._x, Graphics::_labelPosition[0]._y, Graphics::kBitBack, label->_cnv._data1);
+
 	return;
 }
 
 void jobEraseLabel(void *parm, Job *j) {
-	StaticCnv *cnv = (StaticCnv*)parm;
+	ZoneLabel *label = (ZoneLabel*)parm;
 
+    debugC(1, kDebugLocation, "jobEraseLabel (%x)", (uint32) label);
+
 	int16 _si, _di;
 
 	if (_vm->_activeItem._id != 0) {
-		_si = _mousePos._x + 16 - cnv->_width/2;
+		_si = _mousePos._x + 16 - label->_cnv._width/2;
 		_di = _mousePos._y + 34;
 	} else {
-		_si = _mousePos._x + 8 - cnv->_width/2;
-		_di = _mousePos._y + 33;
+		_si = _mousePos._x + 8 - label->_cnv._width/2;
+		_di = _mousePos._y + 21;
 	}
 
 	if (_si < 0) _si = 0;
 	if (_di > 190) _di = 190;
 
-	if (cnv->_width > SCREEN_WIDTH)
+	if (label->_cnv._width + _si > SCREEN_WIDTH)
 		_si = SCREEN_WIDTH - _si;
 
 
-	_vm->_graphics->restoreBackground(Graphics::_labelPosition[1]._x, Graphics::_labelPosition[1]._y, cnv->_width, cnv->_height);
+	_vm->_graphics->restoreBackground(Graphics::_labelPosition[1]._x, Graphics::_labelPosition[1]._y, label->_cnv._width, label->_cnv._height);
 
 	Graphics::_labelPosition[1]._x = Graphics::_labelPosition[0]._x;
 	Graphics::_labelPosition[1]._y = Graphics::_labelPosition[0]._y;

Modified: scummvm/trunk/engines/parallaction/inventory.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/inventory.cpp	2007-02-04 08:10:00 UTC (rev 25375)
+++ scummvm/trunk/engines/parallaction/inventory.cpp	2007-02-04 08:12:33 UTC (rev 25376)
@@ -124,7 +124,7 @@
 	_inventory[_si]._id = (z->u.get->_icon << 16) & 0xFFFF0000;
 	_inventory[_si]._index = z->u.get->_icon;
 
-	addJob(jobRemovePickedItem, z, JOBPRIORITY_ADDREMOVEITEMS);
+	addJob(jobRemovePickedItem, z, kPriority17 );
 
 	if (_inventory[_si]._id == 0) return 0;
 

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2007-02-04 08:10:00 UTC (rev 25375)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2007-02-04 08:12:33 UTC (rev 25376)
@@ -140,7 +140,7 @@
 static Job	   *_jDrawInventory = NULL;
 static Job	   *_jDrawLabel = NULL;
 static Job	   *_jEraseLabel = NULL;
-static Zone    *_hoverZone = NULL;
+Zone    *_hoverZone = NULL;
 static Job	   *_jRunScripts = NULL;
 
 static Cnv		_miniCharacterFrames;
@@ -257,8 +257,8 @@
 	_yourself._zone._flags = kFlagsActive | kFlagsNoName;
 	_yourself._zone._type = kZoneYou;
 
-	_yourself._zone._label._data0 = NULL;
-	_yourself._zone._name = strdup("yourself");
+	_yourself._zone._label._cnv._data0 = NULL;
+	_yourself._zone._label._text = strdup("yourself");
 
 	addNode(&_animations, &_yourself._zone._node);
 	_graphics = new Graphics(this);
@@ -395,9 +395,9 @@
 void Parallaction::runGame() {
 //	printf("runGame()\n");
 
-	addJob(jobEraseAnimations, (void*)1, JOBPRIORITY_ERASEANIMATIONS);
-	_jRunScripts = addJob(jobRunScripts, 0, JOBPRIORITY_RUNSTUFF);
-	addJob(jobDisplayAnimations, 0, JOBPRIORITY_DRAWANIMATIONS);
+	addJob(jobEraseAnimations, (void*)1, kPriority20);
+	_jRunScripts = addJob(jobRunScripts, 0, kPriority15);
+	addJob(jobDisplayAnimations, 0, kPriority3);
 
 	_graphics->copyScreen(Graphics::kBitBack, Graphics::kBit2);
 
@@ -422,6 +422,8 @@
 		_keyDown = updateInput();
 
 		if ((_mouseHidden == 0) && ((_engineFlags & kEngineMouse) == 0) && ((_engineFlags & kEngineWalking) == 0)) {
+			debugC(1, kDebugLocation, "runGame: checking input");
+
 			InputData *v8 = translateInput();
 			if (v8) processInput(v8);
 		}
@@ -469,21 +471,24 @@
 
 	switch (data->_event) {
 	case kEvEnterZone:
+        debugC(1, kDebugLocation, "processInput: kEvEnterZone");
 		_graphics->_labelPosition[1]._x = -1000;
 		_graphics->_labelPosition[1]._y = -1000;
 		_graphics->_labelPosition[0]._x = -1000;
 		_graphics->_labelPosition[0]._y = -1000;
-		_jDrawLabel = addJob(&jobDisplayLabel, (void*)data->_cnv, JOBPRIORITY_DRAWLABEL);
-		_jEraseLabel = addJob(&jobEraseLabel, (void*)data->_cnv, JOBPRIORITY_HIDEINVENTORY);
+		_jDrawLabel = addJob(&jobDisplayLabel, (void*)data->_label, kPriority0);
+		_jEraseLabel = addJob(&jobEraseLabel, (void*)data->_label, kPriority20);
 		break;
 
 	case kEvExitZone:
+        debugC(1, kDebugLocation, "processInput: kEvExitZone");
 		removeJob(_jDrawLabel);
-		addJob(&jobWaitRemoveJob, _jEraseLabel, JOBPRIORITY_RUNSTUFF);
+		addJob(&jobWaitRemoveJob, _jEraseLabel, kPriority15);
 		_jDrawLabel = NULL;
 		break;
 
 	case kEvAction:
+        debugC(1, kDebugLocation, "processInput: kEvAction");
 		_procCurrentHoverItem = -1;
 		_hoverZone = NULL;
 		pauseJobs();
@@ -496,16 +501,16 @@
 
 	case kEvOpenInventory:
 		_procCurrentHoverItem = -1;
-		_hoverZone = 0;
+		_hoverZone = NULL;
 		if (_jDrawLabel != 0) {
 			removeJob(_jDrawLabel);
 			_jDrawLabel = NULL;
-			addJob(&jobWaitRemoveJob, _jEraseLabel, JOBPRIORITY_SHOWINVENTORY);
+			addJob(&jobWaitRemoveJob, _jEraseLabel, kPriority2);
 		}
 		if (hitZone(kZoneYou, _mousePos._x, _mousePos._y) == 0)
 		changeCursor(kCursorArrow);
 		removeJob(_jRunScripts);
-		_jDrawInventory = addJob(&jobShowInventory, 0, JOBPRIORITY_SHOWINVENTORY);
+		_jDrawInventory = addJob(&jobShowInventory, 0, kPriority2);
 		openInventory();
 		break;
 
@@ -515,8 +520,8 @@
 			// activates item
 			changeCursor(data->_inventoryIndex);
 		}
-		_jRunScripts = addJob(&jobRunScripts, 0, JOBPRIORITY_RUNSTUFF);
-		addJob(&jobHideInventory, 0, JOBPRIORITY_HIDEINVENTORY);
+		_jRunScripts = addJob(&jobRunScripts, 0, kPriority15);
+		addJob(&jobHideInventory, 0, kPriority20);
 		removeJob(_jDrawInventory);
 		break;
 
@@ -527,12 +532,13 @@
 		break;
 
 	case kEvWalk:
-		_hoverZone = 0;
+        debugC(1, kDebugLocation, "processInput: kEvWalk");
+		_hoverZone = NULL;
 		changeCursor(kCursorArrow);
 		if (_yourself._zone._flags & kFlagsRemove) break;
 		if ((_yourself._zone._flags & kFlagsActive) == 0) break;
 		v4 = buildWalkPath(data->_mousePos._x, data->_mousePos._y);
-		addJob(jobWalk, v4, JOBPRIORITY_WALK);
+		addJob(jobWalk, v4, kPriority19);
 		_engineFlags |= kEngineWalking; 								   // inhibits processing of input until walking is over
 		break;
 
@@ -639,7 +645,7 @@
 
 			_hoverZone = z;
 			_input._event = kEvEnterZone;
-			_input._cnv = &z->_label;
+			_input._label = &z->_label;
 			return &_input;
 		}
 
@@ -751,9 +757,11 @@
 
 	if (index == kCursorArrow) {		// standard mouse pointer
 
+        debugC(1, kDebugLocation, "changeCursor(%i), label: %p", index, (const void*)_jDrawLabel);
+
 		if (_jDrawLabel != NULL) {
 			removeJob(_jDrawLabel);
-			addJob(&jobWaitRemoveJob, _jEraseLabel, JOBPRIORITY_RUNSTUFF);
+			addJob(&jobWaitRemoveJob, _jEraseLabel, kPriority15 );
 			_jDrawLabel = NULL;
 		}
 

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2007-02-04 08:10:00 UTC (rev 25375)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2007-02-04 08:12:33 UTC (rev 25376)
@@ -32,17 +32,30 @@
 
 // high values mean high priority
 
-#define JOBPRIORITY_DRAWLABEL			0
-#define JOBPRIORITY_DRAWMOUSE			1
-#define JOBPRIORITY_SHOWINVENTORY		2
-#define JOBPRIORITY_DRAWANIMATIONS		3
-#define JOBPRIORITY_RUNSTUFF			15
-#define JOBPRIORITY_ADDREMOVEITEMS		17
-#define JOBPRIORITY_TOGGLEDOOR			18
-#define JOBPRIORITY_WALK				19
-#define JOBPRIORITY_ERASEANIMATIONS		20
-#define JOBPRIORITY_HIDEINVENTORY		20
-#define JOBPRIORITY_ERASEMOUSE			21
+enum {
+    kPriority0 = 0,
+    kPriority1 = 1,
+    kPriority2 = 2,
+    kPriority3 = 3,
+    kPriority4 = 4,
+    kPriority5 = 5,
+    kPriority6 = 6,
+    kPriority7 = 7,
+    kPriority8 = 8,
+    kPriority9 = 9,
+    kPriority10 = 10,
+    kPriority11 = 11,
+    kPriority12 = 12,
+    kPriority13 = 13,
+    kPriority14 = 14,
+    kPriority15 = 15,
+    kPriority16 = 16,
+    kPriority17 = 17,
+    kPriority18 = 18,
+    kPriority19 = 19,
+    kPriority20 = 20,
+    kPriority21 = 21
+};
 
 enum {
 	kMouseNone			= 0,
@@ -250,7 +263,7 @@
 
 		int16       _inventoryIndex;
 		Zone*       _zone;
-        StaticCnv*  _cnv;
+        ZoneLabel*  _label;
 	};
 
 	bool		_skipMenu;

Modified: scummvm/trunk/engines/parallaction/zone.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/zone.cpp	2007-02-04 08:10:00 UTC (rev 25375)
+++ scummvm/trunk/engines/parallaction/zone.cpp	2007-02-04 08:12:33 UTC (rev 25376)
@@ -41,7 +41,7 @@
 	Zone *v4 = (Zone*)_zones._next;
 
 	while (v4) {
-		if (!scumm_stricmp(name, v4->_name)) return v4;
+		if (!scumm_stricmp(name, v4->_label._text)) return v4;
 		v4 = (Zone*)v4->_node._next;
 	}
 
@@ -65,8 +65,8 @@
 	Zone *z = (Zone*)memAlloc(sizeof(Zone));
 	memset(z, 0, sizeof(Zone));
 
-	z->_name = (char*)memAlloc(strlen(name)+1);
-	strcpy(z->_name, name);
+	z->_label._text = (char*)memAlloc(strlen(name)+1);
+	strcpy(z->_label._text, name);
 
 	addNode(list, &z->_node);
 
@@ -100,7 +100,7 @@
 		}
 		if (!scumm_stricmp(_tokens[0], "label")) {
 //			printf("label: %s", _tokens[1]);
-			_vm->_graphics->makeCnvFromString(&z->_label, _tokens[1]);
+			_vm->_graphics->makeCnvFromString(&z->_label._cnv, _tokens[1]);
 		}
 		if (!scumm_stricmp(_tokens[0], "flags")) {
 			uint16 _si = 1;
@@ -119,6 +119,7 @@
 }
 
 void freeZones(Node *list) {
+    debugC(1, kDebugLocation, "freeZones: kEngineQuit = %i", _engineFlags & kEngineQuit);
 
 	Zone *z = (Zone*)list;
 	Zone *v8 = NULL;
@@ -129,8 +130,10 @@
 
 		// TODO: understand and simplify this monster
 		if (((z->_limits._top == -1) || ((z->_limits._left == -2) && ((isItemInInventory(z->u.merge->_obj1) != 0) || (isItemInInventory(z->u.merge->_obj2) != 0)))) &&
-			(_engineFlags & kEngineQuit) == 0) {
+			((_engineFlags & kEngineQuit) == 0)) {
 
+            debugC(1, kDebugLocation, "freeZones preserving zone '%s'", z->_label._text);
+
 			v8 = (Zone*)z->_node._next;
 			removeNode(&z->_node);
 			addNode(&nullNode, &z->_node);
@@ -176,8 +179,9 @@
 			break;
 		}
 
-		memFree(z->_name);
-		_vm->_graphics->freeStaticCnv(&z->_label);
+		memFree(z->_label._text);
+		z->_label._text = NULL;
+		_vm->_graphics->freeStaticCnv(&z->_label._cnv);
 		freeCommands(z->_commands);
 
 	}
@@ -460,7 +464,7 @@
 
 
 uint16 runZone(Zone *z) {
-    debugC(1, kDebugLocation, "runZone (%s)", z->_name);
+    debugC(1, kDebugLocation, "runZone (%s)", z->_label._text);
 
 	uint16 subtype = z->_type & 0xFFFF;
 
@@ -487,7 +491,7 @@
 		if (z->_flags & kFlagsLocked) break;
 		z->_flags ^= kFlagsClosed;
 		if (z->u.door->_cnv._count == 0) break;
-		addJob(jobToggleDoor, z, JOBPRIORITY_TOGGLEDOOR);
+		addJob(jobToggleDoor, z, kPriority18 );
 		break;
 
 	case kZoneHear:

Modified: scummvm/trunk/engines/parallaction/zone.h
===================================================================
--- scummvm/trunk/engines/parallaction/zone.h	2007-02-04 08:10:00 UTC (rev 25375)
+++ scummvm/trunk/engines/parallaction/zone.h	2007-02-04 08:12:33 UTC (rev 25376)
@@ -117,9 +117,11 @@
 	MergeData	*merge;
 };
 
+struct ZoneLabel {
+	char*			_text;
+	StaticCnv		_cnv;
+};
 
-
-
 struct Zone {
 	Node			_node;
 	union {
@@ -131,8 +133,9 @@
 	};
 	uint32			_type;
 	uint32			_flags;
-	char*			_name;
-	StaticCnv		_label;
+//	char*			_labeltext;
+//	StaticCnv		_labelcnv;
+	ZoneLabel       _label;
 	uint16			field_2C;		// unused
 	uint16			field_2E;		// unused
 	ZoneTypeData	u;


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