"Monitor" parameter for cups

- Defaults to 1, AKA Sonic 1/2 monitor
- Set to 2 for Sonic 3k monitor
- Supports a range of 1-9 and A-Z
- Permits fine-grained rapid-prototype stretch goal Chaotix monitor stuff later in development
This commit is contained in:
toaster 2023-03-13 16:18:07 +00:00
parent 07f7be03a1
commit 1d3b5adfdf
4 changed files with 28 additions and 7 deletions

View file

@ -3432,7 +3432,16 @@ void readcupheader(MYFILE *f, cupheader_t *cup)
i = atoi(word2); // used for numerical settings
strupr(word2);
if (fastcmp(word, "ICON"))
if (fastcmp(word, "MONITOR"))
{
if (i > 0 && i < 10)
cup->monitor = i;
else if (!word2[0] || word2[1] != '\0' || word2[0] == '0')
deh_warning("%s Cup: Invalid monitor type \"%s\" (should be 1-9 or A-Z)\n", cup->name, word2);
else
cup->monitor = (word2[0] - 'A') + 10;
}
else if (fastcmp(word, "ICON"))
{
deh_strlcpy(cup->icon, word2,
sizeof(cup->icon), va("%s Cup: icon", cup->name));

View file

@ -486,6 +486,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile)
{
cup = Z_Calloc(sizeof (cupheader_t), PU_STATIC, NULL);
cup->id = numkartcupheaders;
cup->monitor = 1;
deh_strlcpy(cup->name, word2,
sizeof(cup->name), va("Cup header %s: name", word2));
if (prev != NULL)

View file

@ -375,6 +375,7 @@ struct customoption_t
struct cupheader_t
{
UINT16 id; ///< Cup ID
UINT8 monitor; ///< Monitor graphic 1-9 or A-Z
char name[15]; ///< Cup title (14 chars)
char icon[9]; ///< Name of the icon patch
char *levellist[CUPCACHE_MAX]; ///< List of levels that belong to this cup

View file

@ -2134,7 +2134,7 @@ void M_DrawCupSelect(void)
INT16 x, y;
INT16 icony = 7;
char status = 'A';
UINT8 monitor = 1;
char monitor;
INT32 rankx = 0;
if (!cupgrid.builtgrid[id])
@ -2176,14 +2176,24 @@ void M_DrawCupSelect(void)
colormap = NULL;
}
if (templevelsearch.cup->emeraldnum > 7)
{
monitor = 2;
icony = 5;
rankx = 2;
if (templevelsearch.cup->monitor < 10)
{
monitor = '0' + templevelsearch.cup->monitor;
if (templevelsearch.cup->monitor == '2')
{
icony = 5;
rankx = 2;
}
}
else
{
monitor = 'A' + (templevelsearch.cup->monitor - 10);
}
}
patch = W_CachePatchName(va("CUPMON%d%c", monitor, status), PU_CACHE);
patch = W_CachePatchName(va("CUPMON%c%c", monitor, status), PU_CACHE);
x = 14 + (i*42);
y = 20 + (j*44) - (30*menutransition.tics);