diff --git a/src/deh_soc.c b/src/deh_soc.c index 394e2d12d..c436cb87c 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -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; diff --git a/src/doomstat.h b/src/doomstat.h index edf5fe334..4c3b77e3f 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -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]; diff --git a/src/g_game.c b/src/g_game.c index cff9b0e2a..c59f9c635 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -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, + "", + "", }, }; diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 365b190d7..ed8678f1c 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -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) { diff --git a/src/k_tally.cpp b/src/k_tally.cpp index 23347631f..244f7a238 100644 --- a/src/k_tally.cpp +++ b/src/k_tally.cpp @@ -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 diff --git a/src/lua_baselib.c b/src/lua_baselib.c index 69f0aed21..d19e2b0c9 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -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 diff --git a/src/st_stuff.c b/src/st_stuff.c index 0b23e09a0..c02ad0c8e 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -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) { diff --git a/src/y_inter.c b/src/y_inter.c index 70e95449f..460cd3ae2 100644 --- a/src/y_inter.c +++ b/src/y_inter.c @@ -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) diff --git a/src/y_inter.h b/src/y_inter.h index c23909cf6..a85017409 100644 --- a/src/y_inter.h +++ b/src/y_inter.h @@ -16,6 +16,8 @@ extern "C" { #endif +#define INTERMISSIONROUND_BONUS UINT8_MAX + typedef struct { boolean rankingsmode; // rankings mode