[Scummvm-cvs-logs] SF.net SVN: scummvm:[33276] scummvm/trunk/engines/tinsel/pdisplay.cpp

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Jul 25 11:13:09 CEST 2008


Revision: 33276
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33276&view=rev
Author:   fingolfin
Date:     2008-07-25 09:13:08 +0000 (Fri, 25 Jul 2008)

Log Message:
-----------
TINSEL: ActorTag & PolyTag abused a SCNHANDLE and some global enums to keep a trinary state -- fixed that by introducing a new enum HotSpotTag

Modified Paths:
--------------
    scummvm/trunk/engines/tinsel/pdisplay.cpp

Modified: scummvm/trunk/engines/tinsel/pdisplay.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/pdisplay.cpp	2008-07-25 09:12:03 UTC (rev 33275)
+++ scummvm/trunk/engines/tinsel/pdisplay.cpp	2008-07-25 09:13:08 UTC (rev 33276)
@@ -70,9 +70,12 @@
 
 #define POSY	0		// Y-co-ord of these position displays
 
-#define ACTOR_TAG 0xffffffff
+enum HotSpotTag {
+	NO_HOTSPOT_TAG,
+	POLY_HOTSPOT_TAG,
+	ACTOR_HOTSPOT_TAG
+};
 
-
 //----------------- LOCAL GLOBAL DATA --------------------
 
 static bool DispPath = false;
@@ -337,7 +340,7 @@
  * the tag or, if tag already displayed, maintain the tag's position on
  * the screen.
  */
-static bool ActorTag(int curX, int curY, SCNHANDLE *pTag, OBJECT **ppText) {
+static bool ActorTag(int curX, int curY, HotSpotTag *pTag, OBJECT **ppText) {
 	static int Loffset = 0, Toffset = 0;	// Values when tag was displayed
 	int	nLoff, nToff;		// new values, to keep tag in place
 	int	ano;
@@ -349,7 +352,7 @@
 	while ((ano = NextTaggedActor()) != 0) {
 		if (InHotSpot(ano, curX, curY, &xtext, &ytext)) {
 			// Put up or maintain actor tag
-			if (*pTag != ACTOR_TAG)
+			if (*pTag != ACTOR_HOTSPOT_TAG)
 				newActor = true;
 			else if (ano != GetTaggedActor())
 				newActor = true;	// Different actor
@@ -362,7 +365,7 @@
 				if (*ppText)
 					MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), *ppText);
 
-				*pTag = ACTOR_TAG;
+				*pTag = ACTOR_HOTSPOT_TAG;
 				SaveTaggedActor(ano);	// This actor tagged
 				SaveTaggedPoly(NOPOLY);	// No tagged polygon
 
@@ -387,8 +390,8 @@
 	}
 
 	// No tagged actor
-	if (*pTag == ACTOR_TAG) {
-		*pTag = 0;
+	if (*pTag == ACTOR_HOTSPOT_TAG) {
+		*pTag = NO_HOTSPOT_TAG;
 		SaveTaggedActor(0);
 	}
 	return false;
@@ -401,7 +404,7 @@
  * EXIT polygon, its pointState flag is set to POINTING. If its Glitter
  * code contains a printtag() call, its tagState flag gets set to TAG_ON.
  */
-static bool PolyTag(SCNHANDLE *pTag, OBJECT **ppText) {
+static bool PolyTag(HotSpotTag *pTag, OBJECT **ppText) {
 	static int	Loffset = 0, Toffset = 0;	// Values when tag was displayed
 	int		nLoff, nToff;		// new values, to keep tag in place
 	HPOLYGON	hp;
@@ -423,14 +426,14 @@
 					MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), *ppText);
 					*ppText = NULL;
 				}
-				*pTag = POLY_TAG;
+				*pTag = POLY_HOTSPOT_TAG;
 				SaveTaggedActor(0);	// No tagged actor
 				SaveTaggedPoly(hp);	// This polygon tagged
 			}
 			return true;
 		} else if (hp != NOPOLY && PolyTagState(hp) == TAG_ON) {
 			// Put up or maintain polygon tag
-			if (*pTag != POLY_TAG)
+			if (*pTag != POLY_HOTSPOT_TAG)
 				newPoly = true;		// A new polygon (no current)
 			else if (hp != GetTaggedPoly())
 				newPoly = true;		// Different polygon
@@ -441,7 +444,7 @@
 				if (*ppText)
 					MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), *ppText);
 
-				*pTag = POLY_TAG;
+				*pTag = POLY_HOTSPOT_TAG;
 				SaveTaggedActor(0);	// No tagged actor
 				SaveTaggedPoly(hp);	// This polygon tagged
 
@@ -492,8 +495,8 @@
 	}
 
 	// No tagged polygon
-	if (*pTag == POLY_TAG) {
-		*pTag = 0;
+	if (*pTag == POLY_HOTSPOT_TAG) {
+		*pTag = NO_HOTSPOT_TAG;
 		SaveTaggedPoly(NOPOLY);
 	}
 	return false;
@@ -507,13 +510,13 @@
 	// COROUTINE
 	CORO_BEGIN_CONTEXT;
 		OBJECT	*pText;	// text object pointer
-		SCNHANDLE Tag;
+		HotSpotTag Tag;
 	CORO_END_CONTEXT(_ctx);
 
 	CORO_BEGIN_CODE(_ctx);
 	
 	_ctx->pText = NULL;
-	_ctx->Tag = 0;
+	_ctx->Tag = NO_HOTSPOT_TAG;
 
 	SaveTaggedActor(0);		// No tagged actor yet
 	SaveTaggedPoly(NOPOLY);		// No tagged polygon yet
@@ -541,7 +544,7 @@
 				// kill current text objects
 				MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), _ctx->pText);
 				_ctx->pText = NULL;
-				_ctx->Tag = 0;
+				_ctx->Tag = NO_HOTSPOT_TAG;
 			}
 		}
 


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