Beginnings of system for using Chao Keys on large tiles

- M_UpdateChallengeGridExtraData: Register whether major unlock tiles have had every surrounding Challenge cleared (CHE_ALLCLEAR)
- M_DrawChallengeTile: For locked tiles with CHE_ALLCLEAR, show a little dot (temporary drawer)
This commit is contained in:
toaster 2023-09-24 15:43:48 +01:00
parent f522cae573
commit b33597e225
3 changed files with 66 additions and 15 deletions

View file

@ -5224,6 +5224,12 @@ static void M_DrawChallengeTile(INT16 i, INT16 j, INT32 x, INT32 y, boolean hili
colormap colormap
); );
if (challengesmenu.extradata[id].flags & CHE_ALLCLEAR)
{
// Temporary drawer for "key should be usable"
V_DrawFill(x + 5, y + 5, 2, 2, 255);
}
pat = missingpat; pat = missingpat;
colormap = NULL; colormap = NULL;

View file

@ -417,7 +417,16 @@ void M_UpdateChallengeGridExtraData(challengegridextradata_t *extradata)
for (j = 0; j < CHALLENGEGRIDHEIGHT; j++) for (j = 0; j < CHALLENGEGRIDHEIGHT; j++)
{ {
id = (i * CHALLENGEGRIDHEIGHT) + j; id = (i * CHALLENGEGRIDHEIGHT) + j;
extradata[id].flags = CHE_NONE; num = gamedata->challengegrid[id];
if (num >= MAXUNLOCKABLES || unlockables[num].majorunlock == false)
{
extradata[id].flags = CHE_NONE;
continue;
}
// We only do this for large tiles, to reduce the complexity
// of most standard tile challenge comparisons
extradata[id].flags = CHE_ALLCLEAR;
} }
} }
@ -468,12 +477,22 @@ void M_UpdateChallengeGridExtraData(challengegridextradata_t *extradata)
if (extradata[id].flags == CHE_HINT) if (extradata[id].flags == CHE_HINT)
{ {
// CHE_ALLCLEAR has already been removed,
// and CHE_HINT has already been applied,
// so nothing more needs to be done here.
continue; continue;
} }
} }
else if (work < MAXUNLOCKABLES && gamedata->unlocked[work]) else if (work < MAXUNLOCKABLES)
{ {
extradata[id].flags = CHE_HINT; if (gamedata->unlocked[work] == true)
{
extradata[id].flags |= CHE_HINT;
}
else
{
extradata[id].flags &= ~CHE_ALLCLEAR;
}
} }
} }
@ -495,9 +514,13 @@ void M_UpdateChallengeGridExtraData(challengegridextradata_t *extradata)
{ {
//CONS_Printf(" %d - %d to left of %d is valid\n", work, tempid, id); //CONS_Printf(" %d - %d to left of %d is valid\n", work, tempid, id);
// If we haven't already updated our id, it's the one to our left. // If we haven't already updated our id, it's the one to our left.
if (extradata[id].flags == CHE_HINT) if (extradata[id].flags & CHE_HINT)
{ {
extradata[tempid].flags = CHE_HINT; extradata[tempid].flags |= CHE_HINT;
}
if (!(extradata[id].flags & CHE_ALLCLEAR))
{
extradata[tempid].flags &= ~CHE_ALLCLEAR;
} }
extradata[id].flags = CHE_CONNECTEDLEFT; extradata[id].flags = CHE_CONNECTEDLEFT;
id = tempid; id = tempid;
@ -505,16 +528,25 @@ void M_UpdateChallengeGridExtraData(challengegridextradata_t *extradata)
/*else /*else
CONS_Printf(" %d - %d to left of %d is invalid\n", work, tempid, id);*/ CONS_Printf(" %d - %d to left of %d is invalid\n", work, tempid, id);*/
} }
else if (work < MAXUNLOCKABLES && gamedata->unlocked[work]) else if (work < MAXUNLOCKABLES)
{ {
extradata[id].flags = CHE_HINT; if (gamedata->unlocked[work] == true)
continue; {
extradata[id].flags |= CHE_HINT;
}
else
{
extradata[id].flags &= ~CHE_ALLCLEAR;
}
} }
} }
// Since we're not modifying id past this point, the conditions become much simpler. // Since we're not modifying id past this point, the conditions become much simpler.
if ((extradata[id].flags & (CHE_HINT|CHE_DONTDRAW)) == CHE_HINT) if (extradata[id].flags == CHE_HINT)
{ {
// CHE_ALLCLEAR has already been removed,
// and CHE_HINT has already been applied,
// so nothing more needs to be done here.
continue; continue;
} }
@ -528,10 +560,16 @@ void M_UpdateChallengeGridExtraData(challengegridextradata_t *extradata)
{ {
; ;
} }
else if (work < MAXUNLOCKABLES && gamedata->unlocked[work]) else if (work < MAXUNLOCKABLES)
{ {
extradata[id].flags = CHE_HINT; if (gamedata->unlocked[work] == true)
continue; {
extradata[id].flags |= CHE_HINT;
}
else
{
extradata[id].flags &= ~CHE_ALLCLEAR;
}
} }
} }
@ -551,10 +589,16 @@ void M_UpdateChallengeGridExtraData(challengegridextradata_t *extradata)
{ {
; ;
} }
else if (work < MAXUNLOCKABLES && gamedata->unlocked[work]) else if (work < MAXUNLOCKABLES)
{ {
extradata[id].flags = CHE_HINT; if (gamedata->unlocked[work] == true)
continue; {
extradata[id].flags |= CHE_HINT;
}
else
{
extradata[id].flags &= ~CHE_ALLCLEAR;
}
} }
} }
} }

View file

@ -347,6 +347,7 @@ void M_UpdateChallengeGridExtraData(challengegridextradata_t *extradata);
#define CHE_CONNECTEDLEFT (1<<1) #define CHE_CONNECTEDLEFT (1<<1)
#define CHE_CONNECTEDUP (1<<2) #define CHE_CONNECTEDUP (1<<2)
#define CHE_DONTDRAW (CHE_CONNECTEDLEFT|CHE_CONNECTEDUP) #define CHE_DONTDRAW (CHE_CONNECTEDLEFT|CHE_CONNECTEDUP)
#define CHE_ALLCLEAR (1<<3)
char *M_BuildConditionSetString(UINT16 unlockid); char *M_BuildConditionSetString(UINT16 unlockid);
#define DESCRIPTIONWIDTH 170 #define DESCRIPTIONWIDTH 170