diff --git a/src/deh_soc.c b/src/deh_soc.c index fed01aa6d..276700a9f 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -3496,6 +3496,11 @@ void readcupheader(MYFILE *f, cupheader_t *cup) else cup->monitor = (word2[0] - 'A') + 10; } + else if (fastcmp(word, "REALNAME")) + { + deh_strlcpy(cup->realname, word2, + sizeof(cup->realname), va("%s Cup: realname", cup->name)); + } else if (fastcmp(word, "ICON")) { deh_strlcpy(cup->icon, word2, diff --git a/src/dehacked.c b/src/dehacked.c index f6ac70fe1..c63ab376b 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -495,6 +495,15 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile) sizeof(cup->name), va("Cup header %s: name", word2)); cup->namehash = hash; + char *start = strchr(word2, '_'); + if (start) + start++; + else + start = word2; + + deh_strlcpy(cup->realname, start, + sizeof(cup->realname), va("%s Cup: realname (default)", cup->name)); + // Check to see if we have any custom cup record data that we could substitute in. unloaded_cupheader_t *unloadedcup, *unloadedprev = NULL; for (unloadedcup = unloadedcupheaders; unloadedcup; unloadedprev = unloadedcup, unloadedcup = unloadedcup->next) diff --git a/src/doomstat.h b/src/doomstat.h index e6e1bc190..f962aa8af 100644 --- a/src/doomstat.h +++ b/src/doomstat.h @@ -396,6 +396,8 @@ struct cupheader_t char name[MAXCUPNAME]; ///< Cup title UINT32 namehash; ///< Cup title hash + char realname[MAXCUPNAME]; ///< Cup nomme de gurre + char icon[9]; ///< Name of the icon patch char *levellist[CUPCACHE_MAX]; ///< List of levels that belong to this cup INT16 cachedlevels[CUPCACHE_MAX]; ///< IDs in levellist, bonusgame, and specialstage diff --git a/src/g_game.c b/src/g_game.c index 16f0935f8..873ac0cf6 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -4742,7 +4742,7 @@ void G_LoadGameSettings(void) } #define GD_VERSIONCHECK 0xBA5ED123 // Change every major version, as usual -#define GD_VERSIONMINOR 4 // Change every format update +#define GD_VERSIONMINOR 5 // Change every format update typedef enum { @@ -5127,7 +5127,19 @@ void G_LoadGameData(void) cupwindata_t dummywindata[4]; // Find the relevant cup. - READSTRINGL(save.p, cupname, sizeof(cupname)); + if (versionMinor < 5) + { + // Before this version cups were called things like RING. + // Now that example cup would be called RR_RING instead. + cupname[0] = cupname[1] = 'R'; + cupname[2] = '_'; + READSTRINGL(save.p, (cupname + 3), sizeof(cupname) - 3); + } + else + { + READSTRINGL(save.p, cupname, sizeof(cupname)); + } + UINT32 hash = quickncasehash(cupname, MAXCUPNAME); for (cup = kartcupheaders; cup; cup = cup->next) { diff --git a/src/k_menudraw.c b/src/k_menudraw.c index 937588540..268db5e5b 100644 --- a/src/k_menudraw.c +++ b/src/k_menudraw.c @@ -2397,7 +2397,7 @@ static void M_DrawCupTitle(INT16 y, levelsearch_t *levelsearch) boolean unlocked = (M_GetFirstLevelInList(&temp, levelsearch) != NEXTMAP_INVALID); UINT8 *colormap = R_GetTranslationColormap(TC_RAINBOW, SKINCOLOR_GREY, GTC_MENUCACHE); patch_t *icon = W_CachePatchName(levelsearch->cup->icon, PU_CACHE); - const char *str = (unlocked ? va("%s Cup", levelsearch->cup->name) : "???"); + const char *str = (unlocked ? va("%s Cup", levelsearch->cup->realname) : "???"); INT16 offset = V_LSTitleLowStringWidth(str, 0) / 2; V_DrawLSTitleLowString(BASEVIDWIDTH/2 - offset, y+6, 0, str); @@ -6165,7 +6165,7 @@ static void M_DrawStatsMaps(void) const char *str; if (mapheaderinfo[mnum]->cup) - str = va("%s CUP", mapheaderinfo[mnum]->cup->name); + str = va("%s CUP", mapheaderinfo[mnum]->cup->realname); else str = "LOST AND FOUND"; @@ -6435,7 +6435,7 @@ static void M_DrawStatsGP(void) V_DrawScaledPatch(24-1, y, 0, W_CachePatchName(cup->icon, PU_CACHE)); V_DrawScaledPatch(24-1, y, 0, W_CachePatchName("CUPBOX", PU_CACHE)); - V_DrawThinString(24+21+2, y + 7, 0, cup->name); + V_DrawThinString(24+21+2, y + 7, 0, cup->realname); x = 7 + BASEVIDWIDTH - 20 - width; for (j = endj; j >= KARTSPEED_EASY; j--) diff --git a/src/m_cond.c b/src/m_cond.c index 828845823..22c9e7db9 100644 --- a/src/m_cond.c +++ b/src/m_cond.c @@ -1432,7 +1432,7 @@ static const char *M_GetConditionString(condition_t *cn) continue; return va("%s%s %s CUP", completetype, orbetter, - (M_CupLocked(cup) ? "???" : cup->name) + (M_CupLocked(cup) ? "???" : cup->realname) ); } return va("INVALID CUP CONDITION \"%d:%d\"", cn->type, cn->requirement);