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

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Tue Jan 8 21:32:30 CET 2008


Revision: 30343
          http://scummvm.svn.sourceforge.net/scummvm/?rev=30343&view=rev
Author:   peres001
Date:     2008-01-08 12:32:29 -0800 (Tue, 08 Jan 2008)

Log Message:
-----------
Added a proper _name member to Zone, instead of using the label text.

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

Modified: scummvm/trunk/engines/parallaction/debug.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/debug.cpp	2008-01-08 10:04:05 UTC (rev 30342)
+++ scummvm/trunk/engines/parallaction/debug.cpp	2008-01-08 20:32:29 UTC (rev 30343)
@@ -183,7 +183,7 @@
 				"+--------------------+---+---+---+---+--------+--------+\n");
 	for ( ; b != e; b++) {
 		Zone *z = *b;
-		DebugPrintf("|%-20s|%3i|%3i|%3i|%3i|%8x|%8x|\n", z->_label._text, z->_left, z->_top, z->_right, z->_bottom, z->_type, z->_flags );
+		DebugPrintf("|%-20s|%3i|%3i|%3i|%3i|%8x|%8x|\n", z->_name, z->_left, z->_top, z->_right, z->_bottom, z->_type, z->_flags );
 	}
 	DebugPrintf("+--------------------+---+---+---+---+--------+--------+\n");
 
@@ -201,7 +201,7 @@
 				"+--------------------+---+---+---+---+--------+--------+\n");
 	for ( ; b != e; b++) {
 		Animation *a = *b;
-		DebugPrintf("|%-20s|%3i|%3i|%3i|%3i|%8x|%8x|\n", a->_label._text, a->_left, a->_top, a->_z, a->_frame, a->_type, a->_flags );
+		DebugPrintf("|%-20s|%3i|%3i|%3i|%3i|%8x|%8x|\n", a->_name, a->_left, a->_top, a->_z, a->_frame, a->_type, a->_flags );
 	}
 	DebugPrintf("+--------------------+---+---+---+---+--------+--------+\n");
 

Modified: scummvm/trunk/engines/parallaction/exec_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-01-08 10:04:05 UTC (rev 30342)
+++ scummvm/trunk/engines/parallaction/exec_ns.cpp	2008-01-08 20:32:29 UTC (rev 30343)
@@ -346,7 +346,7 @@
 			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->_label._text, v18->_left, v18->_top, _si, v14.w, v14.h,
+			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);
 
@@ -410,7 +410,7 @@
 		InstructionList::iterator inst = a->_program->_ip;
 		while (((*inst)->_index != INST_SHOW) && (a->_flags & kFlagsActing)) {
 
-			debugC(9, kDebugExec, "Animation: %s, instruction: %s", a->_label._text, _instructionNamesRes[(*inst)->_index - 1]);
+			debugC(9, kDebugExec, "Animation: %s, instruction: %s", a->_name, _instructionNamesRes[(*inst)->_index - 1]);
 
 			_instRunCtxt.inst = inst;
 			_instRunCtxt.a = a;
@@ -514,7 +514,7 @@
 
 
 uint16 Parallaction::runZone(Zone *z) {
-	debugC(3, kDebugExec, "runZone (%s)", z->_label._text);
+	debugC(3, kDebugExec, "runZone (%s)", z->_name);
 
 	uint16 subtype = z->_type & 0xFFFF;
 

Modified: scummvm/trunk/engines/parallaction/graphics.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/graphics.cpp	2008-01-08 10:04:05 UTC (rev 30342)
+++ scummvm/trunk/engines/parallaction/graphics.cpp	2008-01-08 20:32:29 UTC (rev 30343)
@@ -514,7 +514,7 @@
 }
 
 void Gfx::drawLabel() {
-	if (!_label || !_label->_text) {
+	if (!_label) {
 		return;
 	}
 

Modified: scummvm/trunk/engines/parallaction/objects.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/objects.cpp	2008-01-08 10:04:05 UTC (rev 30342)
+++ scummvm/trunk/engines/parallaction/objects.cpp	2008-01-08 20:32:29 UTC (rev 30343)
@@ -122,10 +122,12 @@
 
 	_type = 0;
 	_flags = 0;
+
+	memset(_name, 0, ZONENAME_LENGTH);
 }
 
 Zone::~Zone() {
-//	printf("~Zone(%s)\n", _label._text);
+//	printf("~Zone(%s)\n", _name);
 
 	switch (_type & 0xFFFF) {
 	case kZoneExamine:

Modified: scummvm/trunk/engines/parallaction/objects.h
===================================================================
--- scummvm/trunk/engines/parallaction/objects.h	2008-01-08 10:04:05 UTC (rev 30342)
+++ scummvm/trunk/engines/parallaction/objects.h	2008-01-08 20:32:29 UTC (rev 30343)
@@ -271,7 +271,11 @@
 	void getRect(Common::Rect &r);
 };
 
+#define ZONENAME_LENGTH 32
+
 struct Zone {
+	char			_name[ZONENAME_LENGTH];
+
 	int16 			_left;
 	int16			_top;
 	int16			_right;

Modified: scummvm/trunk/engines/parallaction/parallaction.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.cpp	2008-01-08 10:04:05 UTC (rev 30342)
+++ scummvm/trunk/engines/parallaction/parallaction.cpp	2008-01-08 20:32:29 UTC (rev 30343)
@@ -729,7 +729,7 @@
 Animation *Parallaction::findAnimation(const char *name) {
 
 	for (AnimationList::iterator it = _animations.begin(); it != _animations.end(); it++)
-		if (!scumm_stricmp((*it)->_label._text, name)) return *it;
+		if (!scumm_stricmp((*it)->_name, name)) return *it;
 
 	return NULL;
 }
@@ -900,7 +900,7 @@
 Zone *Parallaction::findZone(const char *name) {
 
 	for (ZoneList::iterator it = _zones.begin(); it != _zones.end(); it++) {
-		if (!scumm_stricmp((*it)->_label._text, name)) return *it;
+		if (!scumm_stricmp((*it)->_name, name)) return *it;
 	}
 
 	return findAnimation(name);
@@ -918,7 +918,7 @@
 		// to retain special - needed - zones that were lost across location switches.
 		Zone* z = *it;
 		if (((z->_top == -1) || (z->_left == -2)) && ((_engineFlags & kEngineQuit) == 0)) {
-			debugC(2, kDebugExec, "freeZones preserving zone '%s'", z->_label._text);
+			debugC(2, kDebugExec, "freeZones preserving zone '%s'", z->_name);
 			it++;
 		} else {
 			it = _zones.erase(it);
@@ -950,7 +950,7 @@
 	_ani._flags = kFlagsActive | kFlagsNoName;
 	_ani._type = kZoneYou;
 	_ani._label._cnv.pixels = NULL;
-	_ani._label._text = strdup("yourself");
+	strncpy(_ani._name, "yourself", ZONENAME_LENGTH);
 }
 
 void Character::getFoot(Common::Point &foot) {

Modified: scummvm/trunk/engines/parallaction/parser_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parser_ns.cpp	2008-01-08 10:04:05 UTC (rev 30342)
+++ scummvm/trunk/engines/parallaction/parser_ns.cpp	2008-01-08 20:32:29 UTC (rev 30343)
@@ -184,7 +184,7 @@
 
 	Animation *a = new Animation;
 
-	a->_label._text = strdup(name);
+	strncpy(a->_name, name, ZONENAME_LENGTH);
 
 	list.push_front(a);
 
@@ -222,7 +222,7 @@
 }
 
 void Parallaction_ns::loadProgram(Animation *a, const char *filename) {
-	debugC(1, kDebugParser, "loadProgram(Animation: %s, script: %s)", a->_label._text, filename);
+	debugC(1, kDebugParser, "loadProgram(Animation: %s, script: %s)", a->_name, filename);
 
 	Script *script = _disk->loadScript(filename);
 
@@ -249,7 +249,7 @@
 DECLARE_INSTRUCTION_PARSER(animation)  {
 	debugC(7, kDebugParser, "INSTRUCTION_PARSER(animation) ");
 
-	if (!scumm_stricmp(_tokens[1], _instParseCtxt.a->_label._text)) {
+	if (!scumm_stricmp(_tokens[1], _instParseCtxt.a->_name)) {
 		_instParseCtxt.inst->_a = _instParseCtxt.a;
 	} else {
 		_instParseCtxt.inst->_a = findAnimation(_tokens[1]);
@@ -336,7 +336,7 @@
 DECLARE_INSTRUCTION_PARSER(put)  {
 	debugC(7, kDebugParser, "INSTRUCTION_PARSER(put) ");
 
-	if (!scumm_stricmp(_tokens[1], _instParseCtxt.a->_label._text)) {
+	if (!scumm_stricmp(_tokens[1], _instParseCtxt.a->_name)) {
 		_instParseCtxt.inst->_a = _instParseCtxt.a;
 	} else {
 		_instParseCtxt.inst->_a = findAnimation(_tokens[1]);
@@ -1263,7 +1263,7 @@
 
 	Zone *z = new Zone;
 
-	z->_label._text = strdup(name);
+	strncpy(z->_name, name, ZONENAME_LENGTH);
 
 	_locParseCtxt.z = z;
 	_locParseCtxt.script = &script;
@@ -1442,7 +1442,7 @@
 
 
 void Parallaction_ns::parseZoneTypeBlock(Script &script, Zone *z) {
-	debugC(7, kDebugParser, "parseZoneTypeBlock(name: %s, type: %x)", z->_label._text, z->_type);
+	debugC(7, kDebugParser, "parseZoneTypeBlock(name: %s, type: %x)", z->_name, z->_type);
 
 	switch (z->_type & 0xFFFF) {
 	case kZoneExamine:	// examine Zone alloc


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