TINSEL: ActorTag & PolyTag abused a SCNHANDLE and some global enums to keep a trinary state -- fixed that by introducing a new enum HotSpotTag
svn-id: r33276
This commit is contained in:
parent
52a3dd7581
commit
3d6badc476
1 changed files with 19 additions and 16 deletions
|
@ -70,8 +70,11 @@ extern int BackgroundHeight(void);
|
||||||
|
|
||||||
#define POSY 0 // Y-co-ord of these position displays
|
#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 --------------------
|
//----------------- LOCAL GLOBAL DATA --------------------
|
||||||
|
|
||||||
|
@ -337,7 +340,7 @@ static bool InHotSpot(int ano, int aniX, int aniY, int *pxtext, int *pytext) {
|
||||||
* the tag or, if tag already displayed, maintain the tag's position on
|
* the tag or, if tag already displayed, maintain the tag's position on
|
||||||
* the screen.
|
* 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
|
static int Loffset = 0, Toffset = 0; // Values when tag was displayed
|
||||||
int nLoff, nToff; // new values, to keep tag in place
|
int nLoff, nToff; // new values, to keep tag in place
|
||||||
int ano;
|
int ano;
|
||||||
|
@ -349,7 +352,7 @@ static bool ActorTag(int curX, int curY, SCNHANDLE *pTag, OBJECT **ppText) {
|
||||||
while ((ano = NextTaggedActor()) != 0) {
|
while ((ano = NextTaggedActor()) != 0) {
|
||||||
if (InHotSpot(ano, curX, curY, &xtext, &ytext)) {
|
if (InHotSpot(ano, curX, curY, &xtext, &ytext)) {
|
||||||
// Put up or maintain actor tag
|
// Put up or maintain actor tag
|
||||||
if (*pTag != ACTOR_TAG)
|
if (*pTag != ACTOR_HOTSPOT_TAG)
|
||||||
newActor = true;
|
newActor = true;
|
||||||
else if (ano != GetTaggedActor())
|
else if (ano != GetTaggedActor())
|
||||||
newActor = true; // Different actor
|
newActor = true; // Different actor
|
||||||
|
@ -362,7 +365,7 @@ static bool ActorTag(int curX, int curY, SCNHANDLE *pTag, OBJECT **ppText) {
|
||||||
if (*ppText)
|
if (*ppText)
|
||||||
MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), *ppText);
|
MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), *ppText);
|
||||||
|
|
||||||
*pTag = ACTOR_TAG;
|
*pTag = ACTOR_HOTSPOT_TAG;
|
||||||
SaveTaggedActor(ano); // This actor tagged
|
SaveTaggedActor(ano); // This actor tagged
|
||||||
SaveTaggedPoly(NOPOLY); // No tagged polygon
|
SaveTaggedPoly(NOPOLY); // No tagged polygon
|
||||||
|
|
||||||
|
@ -387,8 +390,8 @@ static bool ActorTag(int curX, int curY, SCNHANDLE *pTag, OBJECT **ppText) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// No tagged actor
|
// No tagged actor
|
||||||
if (*pTag == ACTOR_TAG) {
|
if (*pTag == ACTOR_HOTSPOT_TAG) {
|
||||||
*pTag = 0;
|
*pTag = NO_HOTSPOT_TAG;
|
||||||
SaveTaggedActor(0);
|
SaveTaggedActor(0);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -401,7 +404,7 @@ static bool ActorTag(int curX, int curY, SCNHANDLE *pTag, OBJECT **ppText) {
|
||||||
* EXIT polygon, its pointState flag is set to POINTING. If its Glitter
|
* 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.
|
* 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
|
static int Loffset = 0, Toffset = 0; // Values when tag was displayed
|
||||||
int nLoff, nToff; // new values, to keep tag in place
|
int nLoff, nToff; // new values, to keep tag in place
|
||||||
HPOLYGON hp;
|
HPOLYGON hp;
|
||||||
|
@ -423,14 +426,14 @@ static bool PolyTag(SCNHANDLE *pTag, OBJECT **ppText) {
|
||||||
MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), *ppText);
|
MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), *ppText);
|
||||||
*ppText = NULL;
|
*ppText = NULL;
|
||||||
}
|
}
|
||||||
*pTag = POLY_TAG;
|
*pTag = POLY_HOTSPOT_TAG;
|
||||||
SaveTaggedActor(0); // No tagged actor
|
SaveTaggedActor(0); // No tagged actor
|
||||||
SaveTaggedPoly(hp); // This polygon tagged
|
SaveTaggedPoly(hp); // This polygon tagged
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} else if (hp != NOPOLY && PolyTagState(hp) == TAG_ON) {
|
} else if (hp != NOPOLY && PolyTagState(hp) == TAG_ON) {
|
||||||
// Put up or maintain polygon tag
|
// Put up or maintain polygon tag
|
||||||
if (*pTag != POLY_TAG)
|
if (*pTag != POLY_HOTSPOT_TAG)
|
||||||
newPoly = true; // A new polygon (no current)
|
newPoly = true; // A new polygon (no current)
|
||||||
else if (hp != GetTaggedPoly())
|
else if (hp != GetTaggedPoly())
|
||||||
newPoly = true; // Different polygon
|
newPoly = true; // Different polygon
|
||||||
|
@ -441,7 +444,7 @@ static bool PolyTag(SCNHANDLE *pTag, OBJECT **ppText) {
|
||||||
if (*ppText)
|
if (*ppText)
|
||||||
MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), *ppText);
|
MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), *ppText);
|
||||||
|
|
||||||
*pTag = POLY_TAG;
|
*pTag = POLY_HOTSPOT_TAG;
|
||||||
SaveTaggedActor(0); // No tagged actor
|
SaveTaggedActor(0); // No tagged actor
|
||||||
SaveTaggedPoly(hp); // This polygon tagged
|
SaveTaggedPoly(hp); // This polygon tagged
|
||||||
|
|
||||||
|
@ -492,8 +495,8 @@ static bool PolyTag(SCNHANDLE *pTag, OBJECT **ppText) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// No tagged polygon
|
// No tagged polygon
|
||||||
if (*pTag == POLY_TAG) {
|
if (*pTag == POLY_HOTSPOT_TAG) {
|
||||||
*pTag = 0;
|
*pTag = NO_HOTSPOT_TAG;
|
||||||
SaveTaggedPoly(NOPOLY);
|
SaveTaggedPoly(NOPOLY);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -507,13 +510,13 @@ void TagProcess(CORO_PARAM, const void *) {
|
||||||
// COROUTINE
|
// COROUTINE
|
||||||
CORO_BEGIN_CONTEXT;
|
CORO_BEGIN_CONTEXT;
|
||||||
OBJECT *pText; // text object pointer
|
OBJECT *pText; // text object pointer
|
||||||
SCNHANDLE Tag;
|
HotSpotTag Tag;
|
||||||
CORO_END_CONTEXT(_ctx);
|
CORO_END_CONTEXT(_ctx);
|
||||||
|
|
||||||
CORO_BEGIN_CODE(_ctx);
|
CORO_BEGIN_CODE(_ctx);
|
||||||
|
|
||||||
_ctx->pText = NULL;
|
_ctx->pText = NULL;
|
||||||
_ctx->Tag = 0;
|
_ctx->Tag = NO_HOTSPOT_TAG;
|
||||||
|
|
||||||
SaveTaggedActor(0); // No tagged actor yet
|
SaveTaggedActor(0); // No tagged actor yet
|
||||||
SaveTaggedPoly(NOPOLY); // No tagged polygon yet
|
SaveTaggedPoly(NOPOLY); // No tagged polygon yet
|
||||||
|
@ -541,7 +544,7 @@ void TagProcess(CORO_PARAM, const void *) {
|
||||||
// kill current text objects
|
// kill current text objects
|
||||||
MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), _ctx->pText);
|
MultiDeleteObject(GetPlayfieldList(FIELD_STATUS), _ctx->pText);
|
||||||
_ctx->pText = NULL;
|
_ctx->pText = NULL;
|
||||||
_ctx->Tag = 0;
|
_ctx->Tag = NO_HOTSPOT_TAG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue