More consistent handling of special event round icons

- Gametypes have "GPpic" and "GPpicMini" parameters
- These are shown in contexts where a Round Number would be shown in GP, but an eventmode is under way.
- Instead of having different rules to show up on the pause menu, titlecard, and tally/intermission...
    - Pause Menu Roundqueue, Tally, and Intermission have all been aligned to the same rules.
    - As long as the titlecard is standard, it will show the GP Pic per those rules. (GTR_SPECIALSTART and GTR_BOSS still have their unique behaviour here)
This commit is contained in:
toaster 2023-10-25 20:34:40 +01:00
parent c673bb3ea9
commit e060e9dadc
9 changed files with 101 additions and 57 deletions

View file

@ -785,9 +785,11 @@ void readgametype(MYFILE *f, char *gtname)
INT32 newgttimelimit = 0;
UINT8 newgtinttype = 0;
char gtconst[MAXLINELEN];
char gppic[9];
char gppicmini[9];
// Empty strings.
gtconst[0] = '\0';
gtconst[0] = gppic[0] = gppicmini[0] = '\0';
do
{
@ -827,7 +829,15 @@ void readgametype(MYFILE *f, char *gtname)
else if (fastcmp(word, "IDENTIFIER"))
{
// GT_
strncpy(gtconst, word2, MAXLINELEN);
strlcpy(gtconst, word2, MAXLINELEN);
}
else if (fastcmp(word, "GPPIC"))
{
strlcpy(gppic, word2, 9);
}
else if (fastcmp(word, "GPPICMINI"))
{
strlcpy(gppicmini, word2, 9);
}
// Point and time limits
else if (fastcmp(word, "DEFAULTPOINTLIMIT"))
@ -926,6 +936,8 @@ void readgametype(MYFILE *f, char *gtname)
newgametype->name = Z_StrDup((const char *)gtname);
newgametype->rules = newgtrules;
newgametype->constant = G_PrepareGametypeConstant((const char *)gtconst);
strlcpy(newgametype->gppic, gppic, 9);
strlcpy(newgametype->gppicmini, gppicmini, 9);
newgametype->tol = newgttol;
newgametype->intermission = newgtinttype;
newgametype->pointlimit = newgtpointlimit;

View file

@ -607,6 +607,8 @@ struct gametype_t
UINT8 intermission;
INT32 pointlimit;
INT32 timelimit;
char gppic[9];
char gppicmini[9];
};
extern gametype_t *gametypes[MAXGAMETYPES+1];

View file

@ -3030,6 +3030,8 @@ static gametype_t defaultgametypes[] =
int_time,
0,
0,
"",
"",
},
// GT_BATTLE
@ -3041,6 +3043,8 @@ static gametype_t defaultgametypes[] =
int_scoreortimeattack,
0,
3,
"TT_RNDB",
"TT_RNSB",
},
// GT_SPECIAL
@ -3052,6 +3056,8 @@ static gametype_t defaultgametypes[] =
int_time,
0,
0,
"TT_RNDSS",
"TT_RNSSS",
},
// GT_VERSUS
@ -3063,6 +3069,8 @@ static gametype_t defaultgametypes[] =
int_scoreortimeattack,
0,
0,
"",
"",
},
// GT_TUTORIAL
@ -3074,6 +3082,8 @@ static gametype_t defaultgametypes[] =
int_none,
0,
0,
"",
"",
},
};

View file

@ -4751,43 +4751,22 @@ void M_DrawPause(void)
if (grandprixinfo.gp == true && grandprixinfo.eventmode != GPEVENT_NONE)
{
const char *append = NULL;
switch (grandprixinfo.eventmode)
{
case GPEVENT_SPECIAL:
{
append = "SS";
break;
}
case GPEVENT_BONUS:
{
append = "B";
break;
}
default:
break;
}
if (append)
if (gametypes[gametype]->gppicmini[0])
smallroundpatch = W_CachePatchName(gametypes[gametype]->gppicmini, PU_PATCH);
else
smallroundpatch = W_CachePatchName("TT_RNSX", PU_PATCH);
}
else if (roundqueue.size > 0)
{
if (roundqueue.roundnum > 0 && roundqueue.roundnum <= 10)
{
smallroundpatch =
W_CachePatchName(
va("TT_RNS%s", append),
va("TT_RNS%d", roundqueue.roundnum),
PU_PATCH
);
}
}
else if (roundqueue.roundnum > 0 && roundqueue.roundnum <= 10)
{
smallroundpatch =
W_CachePatchName(
va("TT_RNS%d", roundqueue.roundnum),
PU_PATCH
);
}
if (smallroundpatch != NULL)
{

View file

@ -411,10 +411,16 @@ void level_tally_t::Init(player_t *player)
);
}
if (roundqueue.size > 0 && roundqueue.roundnum > 0
&& (grandprixinfo.gp == false || grandprixinfo.eventmode == GPEVENT_NONE))
if (roundqueue.size > 0 && roundqueue.roundnum > 0)
{
roundNum = roundqueue.roundnum;
if ((grandprixinfo.gp == true && grandprixinfo.eventmode != GPEVENT_NONE))
{
roundNum = INTERMISSIONROUND_BONUS;
}
else
{
roundNum = roundqueue.roundnum;
}
}
}
else

View file

@ -2559,6 +2559,8 @@ static int lib_gAddGametype(lua_State *L)
const char *gtname = NULL;
const char *gtconst = NULL;
const char *gppic = NULL;
const char *gppicmini = NULL;
UINT32 newgtrules = 0;
UINT32 newgttol = 0;
INT32 newgtpointlimit = 0;
@ -2621,6 +2623,14 @@ static int lib_gAddGametype(lua_State *L)
if (!lua_isnumber(L, 3))
TYPEERROR("defaulttimelimit", LUA_TNUMBER)
newgttimelimit = (INT32)lua_tointeger(L, 3);
} else if (i == 8 || (k && fasticmp(k, "gppic"))) {
if (!lua_isstring(L, 3))
TYPEERROR("gppic", LUA_TSTRING)
gppic = lua_tostring(L, 3);
} else if (i == 9 || (k && fasticmp(k, "gppicmini"))) {
if (!lua_isstring(L, 3))
TYPEERROR("gppicmini", LUA_TSTRING)
gppicmini = lua_tostring(L, 3);
}
lua_pop(L, 1);
}
@ -2662,6 +2672,18 @@ static int lib_gAddGametype(lua_State *L)
newgametype->pointlimit = newgtpointlimit;
newgametype->timelimit = newgttimelimit;
if (gppic != NULL)
{
// Calloc means only set if valid
strlcpy(newgametype->gppic, gppic, 9);
}
if (gppicmini != NULL)
{
// Calloc means only set if valid
strlcpy(newgametype->gppicmini, gppicmini, 9);
}
gametypes[numgametypes++] = newgametype;
// done

View file

@ -637,7 +637,7 @@ static void ST_cacheLevelTitle(void)
sprintf(buf, "TT_RND%d", i);
tcroundnum[i-1] = (patch_t *)W_CachePatchName(buf, PU_HUDGFX);
}
tcroundbonus = (patch_t *)W_CachePatchName("TT_RNDB", PU_HUDGFX);
tcroundbonus = (patch_t *)W_CachePatchName("TT_RNDX", PU_HUDGFX);
// Cache act #
for (i=0; i < 10; i++)
@ -1089,17 +1089,10 @@ void ST_drawTitleCard(void)
; // TODO: Ruby
else if (grandprixinfo.gp == true && grandprixinfo.eventmode != GPEVENT_NONE)
{
switch (grandprixinfo.eventmode)
{
case GPEVENT_BONUS:
roundico = tcroundbonus; // TODO don't show capsule if we have other bonus types
break;
/*case GPEVENT_SPECIAL:
; // TODO: Emerald/mount
break;*/
default:
break;
}
if (gametypes[gametype]->gppic[0])
roundico = W_CachePatchName(gametypes[gametype]->gppic, PU_PATCH);
else
roundico = tcroundbonus; // Generic star
}
else if (roundqueue.size > 0)
{

View file

@ -378,13 +378,16 @@ static void Y_CalculateMatchData(UINT8 rankingsmode, void (*comparison)(INT32))
skins[players[i].skin].realname);
}
if (roundqueue.size > 0
&& roundqueue.roundnum > 0
&& (grandprixinfo.gp == false
|| grandprixinfo.eventmode == GPEVENT_NONE)
)
if (roundqueue.size > 0 && roundqueue.roundnum > 0)
{
data.roundnum = roundqueue.roundnum;
if ((grandprixinfo.gp == true && grandprixinfo.eventmode != GPEVENT_NONE))
{
data.roundnum = INTERMISSIONROUND_BONUS;
}
else
{
data.roundnum = roundqueue.roundnum;
}
}
}
else
@ -1456,14 +1459,29 @@ void Y_DrawIntermissionHeader(fixed_t x, fixed_t y, boolean gotthrough, const ch
}
// Draw round numbers
if (roundnum > 0 && roundnum <= 10)
patch_t *roundpatch = NULL;
if (roundnum == INTERMISSIONROUND_BONUS)
{
patch_t *roundpatch =
W_CachePatchName(
va("TT_RN%s%d", (small ? "S" : "D"), roundnum),
const char *gppic = (small ? gametypes[gametype]->gppicmini : gametypes[gametype]->gppic);
if (gppic[0])
roundpatch = W_CachePatchName(gppic, PU_PATCH);
else
roundpatch = W_CachePatchName(
va("TT_RN%cX", (small ? 'S' : 'D')),
PU_PATCH
);
}
else if (roundnum > 0 && roundnum <= 10)
{
roundpatch = W_CachePatchName(
va("TT_RN%c%d", (small ? 'S' : 'D'), roundnum),
PU_PATCH
);
}
if (roundpatch)
{
fixed_t roundx = (v_width * 3 * FRACUNIT) / 4;
if (headerwidth != 0)

View file

@ -16,6 +16,8 @@
extern "C" {
#endif
#define INTERMISSIONROUND_BONUS UINT8_MAX
typedef struct
{
boolean rankingsmode; // rankings mode