Custom Icon support for unlockable_t

This commit is contained in:
toaster 2022-12-03 12:18:59 +00:00
parent 6671e181b0
commit 017871eaad
3 changed files with 26 additions and 0 deletions

View file

@ -156,6 +156,9 @@ void clear_unlockables(void)
{
Z_Free(unlockables[i].stringVar);
unlockables[i].stringVar = NULL;
Z_Free(unlockables[i].icon);
unlockables[i].icon = NULL;
}
memset(&unlockables, 0, sizeof(unlockables));
@ -2379,6 +2382,11 @@ void readunlockable(MYFILE *f, INT32 num)
unlockables[num].stringVar = Z_StrDup(word2);
unlockables[num].variable = (INT16)i;
}
else if (fastcmp(word, "ICON"))
{
Z_Free(unlockables[num].icon);
unlockables[num].icon = Z_StrDup(word2);
}
else
deh_warning("Unlockable %d: unknown word '%s'", num+1, word);
}

View file

@ -4517,6 +4517,23 @@ void M_DrawChallenges(void)
goto drawborder;
}
if (ref->icon != NULL)
{
patch_t *pat = W_CachePatchName(ref->icon, PU_CACHE);
fixed_t siz = (SHORT(pat->width) << FRACBITS);
siz = FixedDiv(((ref->majorunlock) ? 32 : 16) << FRACBITS, siz);
V_DrawFixedPatch(
x*FRACUNIT, y*FRACUNIT,
siz,
0, pat,
NULL
);
goto drawborder;
}
switch (ref->type)
{
case SECRET_SKIN:

View file

@ -93,6 +93,7 @@ typedef struct
{
char name[64];
char objective[64];
char *icon;
UINT8 conditionset;
INT16 type;
INT16 variable;