diff --git a/src/deh_lua.c b/src/deh_lua.c index 543998584..6e892d5e2 100644 --- a/src/deh_lua.c +++ b/src/deh_lua.c @@ -436,16 +436,6 @@ static inline int lib_getenum(lua_State *L) } return luaL_error(L, "karthud '%s' could not be found.\n", word); } - else if (fastncmp("HUD_",word,4)) { - p = word+4; - for (i = 0; i < NUMHUDITEMS; i++) - if (fastcmp(p, HUDITEMS_LIST[i])) { - lua_pushinteger(L, i); - return 1; - } - if (mathlib) return luaL_error(L, "huditem '%s' could not be found.\n", word); - return 0; - } else if (fastncmp("SKINCOLOR_",word,10)) { p = word+10; for (i = 0; i < NUMCOLORFREESLOTS; i++) { diff --git a/src/deh_soc.c b/src/deh_soc.c index e2dec10d7..aa55ca638 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -2407,66 +2407,6 @@ void readmenu(MYFILE *f, INT32 num) Z_Free(s); } -void readhuditem(MYFILE *f, INT32 num) -{ - char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); - char *word = s; - char *word2; - char *tmp; - INT32 i; - - do - { - if (myfgets(s, MAXLINELEN, f)) - { - if (s[0] == '\n') - break; - - // First remove trailing newline, if there is one - tmp = strchr(s, '\n'); - if (tmp) - *tmp = '\0'; - - tmp = strchr(s, '#'); - if (tmp) - *tmp = '\0'; - if (s == tmp) - continue; // Skip comment lines, but don't break. - - // Get the part before the " = " - tmp = strchr(s, '='); - if (tmp) - *(tmp-1) = '\0'; - else - break; - strupr(word); - - // Now get the part after - word2 = tmp += 2; - strupr(word2); - - i = atoi(word2); // used for numerical settings - - if (fastcmp(word, "X")) - { - hudinfo[num].x = i; - } - else if (fastcmp(word, "Y")) - { - hudinfo[num].y = i; - } - else if (fastcmp(word, "F")) - { - hudinfo[num].f = i; - } - else - deh_warning("Level header %d: unknown word '%s'", num, word); - } - } while (!myfeof(f)); // finish when the line is empty - - Z_Free(s); -} - void readframe(MYFILE *f, INT32 num) { char *s = Z_Malloc(MAXLINELEN, PU_STATIC, NULL); @@ -4204,20 +4144,6 @@ sfxenum_t get_sfx(const char *word) return sfx_None; } -hudnum_t get_huditem(const char *word) -{ // Returns the value of HUD_ enumerations - hudnum_t i; - if (*word >= '0' && *word <= '9') - return atoi(word); - if (fastncmp("HUD_",word,4)) - word += 4; // take off the HUD_ - for (i = 0; i < NUMHUDITEMS; i++) - if (fastcmp(word, HUDITEMS_LIST[i])) - return i; - deh_warning("Couldn't find huditem named 'HUD_%s'",word); - return HUD_LIVES; -} - menutype_t get_menutype(const char *word) { // Returns the value of MN_ enumerations menutype_t i; @@ -4461,11 +4387,6 @@ static fixed_t find_const(const char **rword) free(word); return 0; } - else if (fastncmp("HUD_",word,4)) { - r = get_huditem(word); - free(word); - return r; - } else if (fastncmp("GRADE_",word,6)) { char *p = word+6; diff --git a/src/deh_soc.h b/src/deh_soc.h index 0025eb1c4..e2319ab14 100644 --- a/src/deh_soc.h +++ b/src/deh_soc.h @@ -52,7 +52,6 @@ statenum_t get_state(const char *word); spritenum_t get_sprite(const char *word); playersprite_t get_sprite2(const char *word); sfxenum_t get_sfx(const char *word); -hudnum_t get_huditem(const char *word); menutype_t get_menutype(const char *word); //INT16 get_gametype(const char *word); //powertype_t get_power(const char *word); diff --git a/src/dehacked.c b/src/dehacked.c index f86047fed..5f0743a7e 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -495,18 +495,6 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile) ignorelines(f); } } - else if (fastcmp(word, "HUDITEM")) - { - if (i == 0 && word2[0] != '0') // If word2 isn't a number - i = get_huditem(word2); // find a huditem by name - if (i >= 0 && i < NUMHUDITEMS) - readhuditem(f, i); - else - { - deh_warning("HUD item number %d out of range (0 - %d)", i, NUMHUDITEMS-1); - ignorelines(f); - } - } else if (fastcmp(word, "MENU")) { if (i == 0 && word2[0] != '0') // If word2 isn't a number diff --git a/src/font.c b/src/font.c index aeaabd018..39f879ea0 100644 --- a/src/font.c +++ b/src/font.c @@ -27,7 +27,8 @@ FontCache (font_t *fnt) c = fnt->start; for (i = 0; i < fnt->size; ++i, ++c) { - fnt->font[i] = HU_CachePatch( + HU_UpdateOrBlankPatch(&fnt->font[i], + false, "%s%.*d", fnt->prefix, fnt->digits, @@ -57,7 +58,7 @@ Font_DumbRegister (const font_t *sfnt) memcpy(fnt, sfnt, sizeof (font_t)); - if (!( fnt->font = ZZ_Alloc(sfnt->size * sizeof (patch_t *)) )) + if (!( fnt->font = ZZ_Calloc(sfnt->size * sizeof (patch_t *)) )) return -1; return fontc++; diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 659c4edaa..c859df55f 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -75,8 +75,6 @@ patch_t *pinggfx[5]; // small ping graphic patch_t *mping[5]; // smaller ping graphic -patch_t *tc_font[2][LT_FONTSIZE]; // Special font stuff for titlecard - patch_t *framecounter; patch_t *frameslash; // framerate stuff. Used in screen.c @@ -89,24 +87,12 @@ static boolean headsupactive = false; boolean hu_showscores; // draw rankings static char hu_tick; -patch_t *rflagico; -patch_t *bflagico; -patch_t *rmatcico; -patch_t *bmatcico; -patch_t *tagico; -patch_t *tallminus; -patch_t *tallinfin; - -//------------------------------------------- -// coop hud -//------------------------------------------- - -static patch_t *emblemicon; - //------------------------------------------- // misc vars //------------------------------------------- +patch_t *missingpat; + // song credits static patch_t *songcreditbg; @@ -184,51 +170,25 @@ static void Got_Saycmd(UINT8 **p, INT32 playernum); void HU_LoadGraphics(void) { - char buffer[9]; - INT32 i, j; + INT32 i; if (dedicated) return; Font_Load(); - // minus for negative tallnums - tallminus = HU_CachePatch("STTMINUS"); - - emblemicon = HU_CachePatch("EMBLICON"); - songcreditbg = HU_CachePatch("K_SONGCR"); - - // Cache titlecard font - j = LT_FONTSTART; - for (i = 0; i < LT_FONTSIZE; i++, j++) - { - // cache the titlecard font - - // Bottom layer - sprintf(buffer, "GTOL%.3d", j); - if (W_CheckNumForName(buffer) == LUMPERROR) - tc_font[0][i] = NULL; - else - tc_font[0][i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX); - - // Top layer - sprintf(buffer, "GTFN%.3d", j); - if (W_CheckNumForName(buffer) == LUMPERROR) - tc_font[1][i] = NULL; - else - tc_font[1][i] = (patch_t *)W_CachePatchName(buffer, PU_HUDGFX); - } + HU_UpdatePatch(&songcreditbg, "K_SONGCR"); // cache ping gfx: for (i = 0; i < 5; i++) { - pinggfx[i] = HU_CachePatch("PINGGFX%d", i+1); - mping[i] = HU_CachePatch("MPING%d", i+1); + HU_UpdatePatch(&pinggfx[i], "PINGGFX%d", i+1); + HU_UpdatePatch(&mping[i], "MPING%d", i+1); } // fps stuff - framecounter = HU_CachePatch("FRAMER"); - frameslash = HU_CachePatch("FRAMESL");; + HU_UpdatePatch(&framecounter, "FRAMER"); + HU_UpdatePatch(&frameslash, "FRAMESL"); } // Initialise Heads up @@ -246,6 +206,16 @@ void HU_Init(void) RegisterNetXCmd(XD_SAY, Got_Saycmd); #endif + // only allocate if not present, to save us a lot of headache + if (missingpat == NULL) + { + lumpnum_t missingnum = W_GetNumForName("MISSING"); + if (missingnum == LUMPERROR) + I_Error("HU_LoadGraphics: \"MISSING\" patch not present in resource files."); + + missingpat = W_CachePatchNum(missingnum, PU_STATIC); + } + // set shift translation table shiftxform = english_shiftxform; @@ -283,6 +253,16 @@ void HU_Init(void) PR ("CRFNT"); REG; + DIG (3); + + ADIM (LT); + + PR ("GTOL"); + REG; + + PR ("GTFN"); + REG; + DIG (1); DIM (0, 10); @@ -306,19 +286,52 @@ void HU_Init(void) HU_LoadGraphics(); } -patch_t *HU_CachePatch(const char *format, ...) +patch_t *HU_UpdateOrBlankPatch(patch_t **user, boolean required, const char *format, ...) { va_list ap; char buffer[9]; + lumpnum_t lump; + patch_t *patch; + va_start (ap, format); - vsprintf(buffer, format, ap); + vsnprintf(buffer, sizeof buffer, format, ap); va_end (ap); - if (W_CheckNumForName(buffer) == LUMPERROR) - return NULL; + if (user && p_adding_file != INT16_MAX) + { + lump = W_CheckNumForNamePwad(buffer, p_adding_file, 0); + + /* no update in this wad */ + if (lump == INT16_MAX) + return *user; + + lump |= (p_adding_file << 16); + } else - return (patch_t *)W_CachePatchName(buffer, PU_HUDGFX); + { + lump = W_CheckNumForName(buffer); + + if (lump == LUMPERROR) + { + if (required == true) + *user = missingpat; + + return *user; + } + } + + patch = W_CachePatchNum(lump, PU_HUDGFX); + + if (user) + { + if (*user) + Patch_Free(*user); + + *user = patch; + } + + return patch; } static inline void HU_Stop(void) @@ -2137,10 +2150,10 @@ void HU_Drawer(void) if (modeattacking && pausedelay > 0 && !pausebreakkey) { INT32 strength = ((pausedelay - 1 - NEWTICRATE/2)*10)/(NEWTICRATE/3); - INT32 y = hudinfo[HUD_LIVES].y - 13; + INT32 x = BASEVIDWIDTH/2, y = BASEVIDHEIGHT/2; // obviously incorrect values while we scrap hudinfo - V_DrawThinString(hudinfo[HUD_LIVES].x-2, y, - hudinfo[HUD_LIVES].f|((leveltime & 4) ? V_SKYMAP : V_BLUEMAP), + V_DrawThinString(x, y, + ((leveltime & 4) ? V_SKYMAP : V_BLUEMAP), "HOLD TO RETRY..."); if (strength > 9) diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 4d686516e..d81dba2a6 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -39,11 +39,6 @@ #define LT_FONTEND 'z' // the last font characters #define LT_FONTSIZE (LT_FONTEND - LT_FONTSTART + 1) -// Under regular circumstances, we'd use the built in font stuff, however this font is a bit messy because of how we're gonna draw shit. -// tc_font[0][n] is used for the "bottom" layer -// tc_font[1][n] is used for the "top" layer -extern patch_t *tc_font[2][LT_FONTSIZE]; - #define CRED_FONTSTART '!' // the first font character #define CRED_FONTEND 'Z' // the last font character #define CRED_FONTSIZE (CRED_FONTEND - CRED_FONTSTART + 1) @@ -59,6 +54,9 @@ enum X (LT), X (CRED), + X (GTOL), + X (GTFN), + X (TALLNUM), X (NIGHTSNUM), X (PINGNUM), @@ -106,14 +104,6 @@ extern patch_t *pinggfx[5]; extern patch_t *framecounter; extern patch_t *frameslash; -extern patch_t *rflagico; -extern patch_t *bflagico; -extern patch_t *rmatcico; -extern patch_t *bmatcico; -extern patch_t *tagico; -extern patch_t *tallminus; -extern patch_t *tallinfin; - // set true whenever the tab rankings are being shown for any reason extern boolean hu_showscores; @@ -122,8 +112,10 @@ void HU_Init(void); void HU_LoadGraphics(void); -// Load a HUDGFX patch or NULL. -patch_t *HU_CachePatch(const char *format, ...); +// Load a HUDGFX patch or NULL/missingpat (dependent on required boolean). +patch_t *HU_UpdateOrBlankPatch(patch_t **user, boolean required, const char *format, ...); +//#define HU_CachePatch(...) HU_UpdateOrBlankPatch(NULL, false, __VA_ARGS__) -- not sure how to default the missingpat here plus not currently used +#define HU_UpdatePatch(user, ...) HU_UpdateOrBlankPatch(user, true, __VA_ARGS__) // reset heads up when consoleplayer respawns. void HU_Start(void); diff --git a/src/k_brightmap.c b/src/k_brightmap.c index f481938f2..c62d645e6 100644 --- a/src/k_brightmap.c +++ b/src/k_brightmap.c @@ -37,7 +37,7 @@ static size_t maxBrightmapStorage = 0; static brightmapStorage_t *K_NewBrightmap(void) { maxBrightmapStorage++; - brightmapStorage = (brightmapStorage_t *)Z_Realloc(brightmapStorage, sizeof(brightmapStorage_t) * (maxBrightmapStorage + 1), PU_STATIC, NULL); + brightmapStorage = (brightmapStorage_t *)Z_Realloc(brightmapStorage, sizeof(brightmapStorage_t) * (maxBrightmapStorage + 1), PU_STATIC, &brightmapStorage); return &brightmapStorage[ maxBrightmapStorage - 1 ]; } @@ -63,6 +63,7 @@ static brightmapStorage_t *K_GetBrightmapStorageByIndex(size_t checkIndex) --------------------------------------------------*/ static brightmapStorage_t *K_GetBrightmapStorageByTextureName(const char *checkName) { + UINT32 checkHash = quickncasehash(checkName, 8); size_t i; if (maxBrightmapStorage == 0) @@ -74,7 +75,7 @@ static brightmapStorage_t *K_GetBrightmapStorageByTextureName(const char *checkN { brightmapStorage_t *bms = &brightmapStorage[i]; - if (stricmp(checkName, bms->textureName) == 0) + if (checkHash == bms->textureHash) { // Name matches. return bms; @@ -119,6 +120,7 @@ static boolean K_BRIGHTLumpParser(UINT8 *data, size_t size) { bms = K_NewBrightmap(); strncpy(bms->textureName, tkn, 9); + bms->textureHash = quickncasehash(bms->textureName, 8); } Z_Free(tkn); @@ -128,6 +130,7 @@ static boolean K_BRIGHTLumpParser(UINT8 *data, size_t size) if (tkn && pos < size) { strncpy(bms->brightmapName, tkn, 9); + bms->brightmapHash = quickncasehash(bms->brightmapName, 8); } else { @@ -163,57 +166,45 @@ static boolean K_BRIGHTLumpParser(UINT8 *data, size_t size) } /*-------------------------------------------------- - void K_InitBrightmaps(void) + void K_InitBrightmapsPwad(INT32 wadNum) See header file for description. --------------------------------------------------*/ -void K_InitBrightmaps(void) +void K_InitBrightmapsPwad(INT32 wadNum) { - INT32 wadNum; + UINT16 lumpNum; size_t i; I_Assert(brightmapStorage == NULL); - maxBrightmapStorage = 0; - for (wadNum = 0; wadNum < numwadfiles; wadNum++) + // Find BRIGHT lump in the WAD + lumpNum = W_CheckNumForNamePwad("BRIGHT", wadNum, 0); + + while (lumpNum != INT16_MAX) { - UINT16 lumpNum; + UINT8 *data = (UINT8 *)W_CacheLumpNumPwad(wadNum, lumpNum, PU_CACHE); - // Find BRIGHT lump in the WAD - lumpNum = W_CheckNumForNamePwad("BRIGHT", wadNum, 0); - - while (lumpNum != INT16_MAX) + if (data != NULL) { - UINT8 *data; - data = (UINT8 *)W_CacheLumpNumPwad(wadNum, lumpNum, PU_STATIC); + lumpinfo_t *lump_p = &wadfiles[wadNum]->lumpinfo[lumpNum]; + size_t size = W_LumpLengthPwad(wadNum, lumpNum); - // If that didn't exist, we have nothing to do here. - if (data == NULL) - { - lumpNum = W_CheckNumForNamePwad("BRIGHT", (UINT16)wadNum, lumpNum + 1); - continue; - } - else - { - lumpinfo_t *lump_p = &wadfiles[wadNum]->lumpinfo[lumpNum]; - size_t size = W_LumpLengthPwad(wadNum, lumpNum); + size_t nameLength = strlen(wadfiles[wadNum]->filename) + 1 + strlen(lump_p->fullname); // length of file name, '|', and lump name + char *name = malloc(nameLength + 1); - size_t nameLength = strlen(wadfiles[wadNum]->filename) + 1 + strlen(lump_p->fullname); // length of file name, '|', and lump name - char *name = malloc(nameLength + 1); + sprintf(name, "%s|%s", wadfiles[wadNum]->filename, lump_p->fullname); + name[nameLength] = '\0'; - sprintf(name, "%s|%s", wadfiles[wadNum]->filename, lump_p->fullname); - name[nameLength] = '\0'; + size = W_LumpLengthPwad(wadNum, lumpNum); - size = W_LumpLengthPwad(wadNum, lumpNum); + CONS_Printf(M_GetText("Loading BRIGHT from %s\n"), name); + K_BRIGHTLumpParser(data, size); - CONS_Printf(M_GetText("Loading BRIGHT from %s\n"), name); - K_BRIGHTLumpParser(data, size); - - free(name); - } - - lumpNum = W_CheckNumForNamePwad("BRIGHT", (UINT16)wadNum, lumpNum + 1); + free(name); + Z_Free(data); } + + lumpNum = W_CheckNumForNamePwad("BRIGHT", (UINT16)wadNum, lumpNum + 1); } if (maxBrightmapStorage == 0) @@ -237,14 +228,7 @@ void K_InitBrightmaps(void) if (texNum != -1) { bmNum = R_CheckTextureNumForName(bms->brightmapName); - if (bmNum == -1) - { - texturebrightmaps[texNum] = 0; - } - else - { - texturebrightmaps[texNum] = bmNum; - } + R_UpdateTextureBrightmap(texNum, (bmNum == -1 ? 0 : bmNum)); } } @@ -253,4 +237,20 @@ void K_InitBrightmaps(void) // Clear brightmapStorage now that we're done with it. Z_Free(brightmapStorage); brightmapStorage = NULL; + maxBrightmapStorage = 0; +} + +/*-------------------------------------------------- + void K_InitBrightmaps(void) + + See header file for description. +--------------------------------------------------*/ +void K_InitBrightmaps(void) +{ + INT32 wadNum; + + for (wadNum = 0; wadNum < numwadfiles; wadNum++) + { + K_InitBrightmapsPwad(wadNum); + } } diff --git a/src/k_brightmap.h b/src/k_brightmap.h index 8d33ae5cb..72bc7e9df 100644 --- a/src/k_brightmap.h +++ b/src/k_brightmap.h @@ -24,9 +24,20 @@ typedef struct brightmapStorage_s // before putting them into texturebrightmaps. char textureName[9]; // The texture's name. + UINT32 textureHash; // The texture name's hash. + char brightmapName[9]; // The brightmap's name. + UINT32 brightmapHash; // The brightmap name's hash. } brightmapStorage_t; +/*-------------------------------------------------- + void K_InitBrightmapsPwad(INT32 wadNum); + + Finds all BRIGHT lumps for one WAD/PK3 and processes them. +--------------------------------------------------*/ + +void K_InitBrightmapsPwad(INT32 wadNum); + /*-------------------------------------------------- void K_InitBrightmaps(void); diff --git a/src/k_hud.c b/src/k_hud.c index 206da4e04..b7bf9c38d 100644 --- a/src/k_hud.c +++ b/src/k_hud.c @@ -179,24 +179,24 @@ void K_LoadKartHUDGraphics(void) char buffer[9]; // Null Stuff - kp_nodraw = W_CachePatchName("K_TRNULL", PU_HUDGFX); + HU_UpdatePatch(&kp_nodraw, "K_TRNULL"); // Stickers - kp_timesticker = W_CachePatchName("K_STTIME", PU_HUDGFX); - kp_timestickerwide = W_CachePatchName("K_STTIMW", PU_HUDGFX); - kp_lapsticker = W_CachePatchName("K_STLAPS", PU_HUDGFX); - kp_lapstickerwide = W_CachePatchName("K_STLAPW", PU_HUDGFX); - kp_lapstickernarrow = W_CachePatchName("K_STLAPN", PU_HUDGFX); - kp_splitlapflag = W_CachePatchName("K_SPTLAP", PU_HUDGFX); - kp_bumpersticker = W_CachePatchName("K_STBALN", PU_HUDGFX); - kp_bumperstickerwide = W_CachePatchName("K_STBALW", PU_HUDGFX); - kp_capsulesticker = W_CachePatchName("K_STCAPN", PU_HUDGFX); - kp_capsulestickerwide = W_CachePatchName("K_STCAPW", PU_HUDGFX); - kp_karmasticker = W_CachePatchName("K_STKARM", PU_HUDGFX); - kp_spheresticker = W_CachePatchName("K_STBSMT", PU_HUDGFX); - kp_splitspheresticker = W_CachePatchName("K_SPBSMT", PU_HUDGFX); - kp_splitkarmabomb = W_CachePatchName("K_SPTKRM", PU_HUDGFX); - kp_timeoutsticker = W_CachePatchName("K_STTOUT", PU_HUDGFX); + HU_UpdatePatch(&kp_timesticker, "K_STTIME"); + HU_UpdatePatch(&kp_timestickerwide, "K_STTIMW"); + HU_UpdatePatch(&kp_lapsticker, "K_STLAPS"); + HU_UpdatePatch(&kp_lapstickerwide, "K_STLAPW"); + HU_UpdatePatch(&kp_lapstickernarrow, "K_STLAPN"); + HU_UpdatePatch(&kp_splitlapflag, "K_SPTLAP"); + HU_UpdatePatch(&kp_bumpersticker, "K_STBALN"); + HU_UpdatePatch(&kp_bumperstickerwide, "K_STBALW"); + HU_UpdatePatch(&kp_capsulesticker, "K_STCAPN"); + HU_UpdatePatch(&kp_capsulestickerwide, "K_STCAPW"); + HU_UpdatePatch(&kp_karmasticker, "K_STKARM"); + HU_UpdatePatch(&kp_spheresticker, "K_STBSMT"); + HU_UpdatePatch(&kp_splitspheresticker, "K_SPBSMT"); + HU_UpdatePatch(&kp_splitkarmabomb, "K_SPTKRM"); + HU_UpdatePatch(&kp_timeoutsticker, "K_STTOUT"); // Pre-start countdown bulbs sprintf(buffer, "K_BULBxx"); @@ -204,7 +204,7 @@ void K_LoadKartHUDGraphics(void) { buffer[6] = '0'+((i+1)/10); buffer[7] = '0'+((i+1)%10); - kp_prestartbulb[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_prestartbulb[i], "%s", buffer); } sprintf(buffer, "K_SBLBxx"); @@ -212,68 +212,68 @@ void K_LoadKartHUDGraphics(void) { buffer[6] = '0'+((i+1)/10); buffer[7] = '0'+((i+1)%10); - kp_prestartbulb_split[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_prestartbulb_split[i], "%s", buffer); } // Pre-start position letters - kp_prestartletters[0] = W_CachePatchName("K_PL_P", PU_HUDGFX); - kp_prestartletters[1] = W_CachePatchName("K_PL_O", PU_HUDGFX); - kp_prestartletters[2] = W_CachePatchName("K_PL_S", PU_HUDGFX); - kp_prestartletters[3] = W_CachePatchName("K_PL_I", PU_HUDGFX); - kp_prestartletters[4] = W_CachePatchName("K_PL_T", PU_HUDGFX); - kp_prestartletters[5] = W_CachePatchName("K_PL_N", PU_HUDGFX); - kp_prestartletters[6] = W_CachePatchName("K_PL_EX", PU_HUDGFX); + HU_UpdatePatch(&kp_prestartletters[0], "K_PL_P"); + HU_UpdatePatch(&kp_prestartletters[1], "K_PL_O"); + HU_UpdatePatch(&kp_prestartletters[2], "K_PL_S"); + HU_UpdatePatch(&kp_prestartletters[3], "K_PL_I"); + HU_UpdatePatch(&kp_prestartletters[4], "K_PL_T"); + HU_UpdatePatch(&kp_prestartletters[5], "K_PL_N"); + HU_UpdatePatch(&kp_prestartletters[6], "K_PL_EX"); - kp_prestartletters_split[0] = W_CachePatchName("K_SPL_P", PU_HUDGFX); - kp_prestartletters_split[1] = W_CachePatchName("K_SPL_O", PU_HUDGFX); - kp_prestartletters_split[2] = W_CachePatchName("K_SPL_S", PU_HUDGFX); - kp_prestartletters_split[3] = W_CachePatchName("K_SPL_I", PU_HUDGFX); - kp_prestartletters_split[4] = W_CachePatchName("K_SPL_T", PU_HUDGFX); - kp_prestartletters_split[5] = W_CachePatchName("K_SPL_N", PU_HUDGFX); - kp_prestartletters_split[6] = W_CachePatchName("K_SPL_EX", PU_HUDGFX); + HU_UpdatePatch(&kp_prestartletters_split[0], "K_SPL_P"); + HU_UpdatePatch(&kp_prestartletters_split[1], "K_SPL_O"); + HU_UpdatePatch(&kp_prestartletters_split[2], "K_SPL_S"); + HU_UpdatePatch(&kp_prestartletters_split[3], "K_SPL_I"); + HU_UpdatePatch(&kp_prestartletters_split[4], "K_SPL_T"); + HU_UpdatePatch(&kp_prestartletters_split[5], "K_SPL_N"); + HU_UpdatePatch(&kp_prestartletters_split[6], "K_SPL_EX"); // Starting countdown - kp_startcountdown[0] = W_CachePatchName("K_CNT3A", PU_HUDGFX); - kp_startcountdown[1] = W_CachePatchName("K_CNT2A", PU_HUDGFX); - kp_startcountdown[2] = W_CachePatchName("K_CNT1A", PU_HUDGFX); - kp_startcountdown[3] = W_CachePatchName("K_CNTGOA", PU_HUDGFX); - kp_startcountdown[4] = W_CachePatchName("K_DUEL1", PU_HUDGFX); - kp_startcountdown[5] = W_CachePatchName("K_CNT3B", PU_HUDGFX); - kp_startcountdown[6] = W_CachePatchName("K_CNT2B", PU_HUDGFX); - kp_startcountdown[7] = W_CachePatchName("K_CNT1B", PU_HUDGFX); - kp_startcountdown[8] = W_CachePatchName("K_CNTGOB", PU_HUDGFX); - kp_startcountdown[9] = W_CachePatchName("K_DUEL2", PU_HUDGFX); + HU_UpdatePatch(&kp_startcountdown[0], "K_CNT3A"); + HU_UpdatePatch(&kp_startcountdown[1], "K_CNT2A"); + HU_UpdatePatch(&kp_startcountdown[2], "K_CNT1A"); + HU_UpdatePatch(&kp_startcountdown[3], "K_CNTGOA"); + HU_UpdatePatch(&kp_startcountdown[4], "K_DUEL1"); + HU_UpdatePatch(&kp_startcountdown[5], "K_CNT3B"); + HU_UpdatePatch(&kp_startcountdown[6], "K_CNT2B"); + HU_UpdatePatch(&kp_startcountdown[7], "K_CNT1B"); + HU_UpdatePatch(&kp_startcountdown[8], "K_CNTGOB"); + HU_UpdatePatch(&kp_startcountdown[9], "K_DUEL2"); // Splitscreen - kp_startcountdown[10] = W_CachePatchName("K_SMC3A", PU_HUDGFX); - kp_startcountdown[11] = W_CachePatchName("K_SMC2A", PU_HUDGFX); - kp_startcountdown[12] = W_CachePatchName("K_SMC1A", PU_HUDGFX); - kp_startcountdown[13] = W_CachePatchName("K_SMCGOA", PU_HUDGFX); - kp_startcountdown[14] = W_CachePatchName("K_SDUEL1", PU_HUDGFX); - kp_startcountdown[15] = W_CachePatchName("K_SMC3B", PU_HUDGFX); - kp_startcountdown[16] = W_CachePatchName("K_SMC2B", PU_HUDGFX); - kp_startcountdown[17] = W_CachePatchName("K_SMC1B", PU_HUDGFX); - kp_startcountdown[18] = W_CachePatchName("K_SMCGOB", PU_HUDGFX); - kp_startcountdown[19] = W_CachePatchName("K_SDUEL2", PU_HUDGFX); + HU_UpdatePatch(&kp_startcountdown[10], "K_SMC3A"); + HU_UpdatePatch(&kp_startcountdown[11], "K_SMC2A"); + HU_UpdatePatch(&kp_startcountdown[12], "K_SMC1A"); + HU_UpdatePatch(&kp_startcountdown[13], "K_SMCGOA"); + HU_UpdatePatch(&kp_startcountdown[14], "K_SDUEL1"); + HU_UpdatePatch(&kp_startcountdown[15], "K_SMC3B"); + HU_UpdatePatch(&kp_startcountdown[16], "K_SMC2B"); + HU_UpdatePatch(&kp_startcountdown[17], "K_SMC1B"); + HU_UpdatePatch(&kp_startcountdown[18], "K_SMCGOB"); + HU_UpdatePatch(&kp_startcountdown[19], "K_SDUEL2"); // Fault - kp_racefault[0] = W_CachePatchName("K_FAULTA", PU_HUDGFX); - kp_racefault[1] = W_CachePatchName("K_FAULTB", PU_HUDGFX); + HU_UpdatePatch(&kp_racefault[0], "K_FAULTA"); + HU_UpdatePatch(&kp_racefault[1], "K_FAULTB"); // Splitscreen - kp_racefault[2] = W_CachePatchName("K_SMFLTA", PU_HUDGFX); - kp_racefault[3] = W_CachePatchName("K_SMFLTB", PU_HUDGFX); + HU_UpdatePatch(&kp_racefault[2], "K_SMFLTA"); + HU_UpdatePatch(&kp_racefault[3], "K_SMFLTB"); // 2P splitscreen - kp_racefault[4] = W_CachePatchName("K_2PFLTA", PU_HUDGFX); - kp_racefault[5] = W_CachePatchName("K_2PFLTB", PU_HUDGFX); + HU_UpdatePatch(&kp_racefault[4], "K_2PFLTA"); + HU_UpdatePatch(&kp_racefault[5], "K_2PFLTB"); // Finish - kp_racefinish[0] = W_CachePatchName("K_FINA", PU_HUDGFX); - kp_racefinish[1] = W_CachePatchName("K_FINB", PU_HUDGFX); + HU_UpdatePatch(&kp_racefinish[0], "K_FINA"); + HU_UpdatePatch(&kp_racefinish[1], "K_FINB"); // Splitscreen - kp_racefinish[2] = W_CachePatchName("K_SMFINA", PU_HUDGFX); - kp_racefinish[3] = W_CachePatchName("K_SMFINB", PU_HUDGFX); + HU_UpdatePatch(&kp_racefinish[2], "K_SMFINA"); + HU_UpdatePatch(&kp_racefinish[3], "K_SMFINB"); // 2P splitscreen - kp_racefinish[4] = W_CachePatchName("K_2PFINA", PU_HUDGFX); - kp_racefinish[5] = W_CachePatchName("K_2PFINB", PU_HUDGFX); + HU_UpdatePatch(&kp_racefinish[4], "K_2PFINA"); + HU_UpdatePatch(&kp_racefinish[5], "K_2PFINB"); // Position numbers sprintf(buffer, "K_POSNxx"); @@ -284,7 +284,7 @@ void K_LoadKartHUDGraphics(void) { //sprintf(buffer, "K_POSN%d%d", i, j); buffer[7] = '0'+j; - kp_positionnum[i][j] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_positionnum[i][j], "%s", buffer); } } @@ -292,7 +292,7 @@ void K_LoadKartHUDGraphics(void) for (i = 0; i < NUMWINFRAMES; i++) { buffer[7] = '0'+i; - kp_winnernum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_winnernum[i], "%s", buffer); } sprintf(buffer, "OPPRNKxx"); @@ -300,129 +300,129 @@ void K_LoadKartHUDGraphics(void) { buffer[6] = '0'+(i/10); buffer[7] = '0'+(i%10); - kp_facenum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_facenum[i], "%s", buffer); } sprintf(buffer, "K_CHILIx"); for (i = 0; i < 8; i++) { buffer[7] = '0'+(i+1); - kp_facehighlight[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_facehighlight[i], "%s", buffer); } - kp_spbminimap = W_CachePatchName("SPBMMAP", PU_HUDGFX); + HU_UpdatePatch(&kp_spbminimap, "SPBMMAP"); // Rings & Lives - kp_ringsticker[0] = W_CachePatchName("RNGBACKA", PU_HUDGFX); - kp_ringsticker[1] = W_CachePatchName("RNGBACKB", PU_HUDGFX); + HU_UpdatePatch(&kp_ringsticker[0], "RNGBACKA"); + HU_UpdatePatch(&kp_ringsticker[1], "RNGBACKB"); sprintf(buffer, "K_RINGx"); for (i = 0; i < 6; i++) { buffer[6] = '0'+(i+1); - kp_ring[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_ring[i], "%s", buffer); } - kp_ringdebtminus = W_CachePatchName("RDEBTMIN", PU_HUDGFX); + HU_UpdatePatch(&kp_ringdebtminus, "RDEBTMIN"); sprintf(buffer, "SPBRNGxx"); for (i = 0; i < 16; i++) { buffer[6] = '0'+((i+1) / 10); buffer[7] = '0'+((i+1) % 10); - kp_ringspblock[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_ringspblock[i], "%s", buffer); } - kp_ringstickersplit[0] = W_CachePatchName("SMRNGBGA", PU_HUDGFX); - kp_ringstickersplit[1] = W_CachePatchName("SMRNGBGB", PU_HUDGFX); + HU_UpdatePatch(&kp_ringstickersplit[0], "SMRNGBGA"); + HU_UpdatePatch(&kp_ringstickersplit[1], "SMRNGBGB"); sprintf(buffer, "K_SRINGx"); for (i = 0; i < 6; i++) { buffer[7] = '0'+(i+1); - kp_smallring[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_smallring[i], "%s", buffer); } - kp_ringdebtminussmall = W_CachePatchName("SRDEBTMN", PU_HUDGFX); + HU_UpdatePatch(&kp_ringdebtminussmall, "SRDEBTMN"); sprintf(buffer, "SPBRGSxx"); for (i = 0; i < 16; i++) { buffer[6] = '0'+((i+1) / 10); buffer[7] = '0'+((i+1) % 10); - kp_ringspblocksmall[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_ringspblocksmall[i], "%s", buffer); } // Speedometer - kp_speedometersticker = W_CachePatchName("K_SPDMBG", PU_HUDGFX); + HU_UpdatePatch(&kp_speedometersticker, "K_SPDMBG"); sprintf(buffer, "K_SPDMLx"); for (i = 0; i < 4; i++) { buffer[7] = '0'+(i+1); - kp_speedometerlabel[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_speedometerlabel[i], "%s", buffer); } // Extra ranking icons - kp_rankbumper = W_CachePatchName("K_BLNICO", PU_HUDGFX); - kp_tinybumper[0] = W_CachePatchName("K_BLNA", PU_HUDGFX); - kp_tinybumper[1] = W_CachePatchName("K_BLNB", PU_HUDGFX); - kp_ranknobumpers = W_CachePatchName("K_NOBLNS", PU_HUDGFX); - kp_rankcapsule = W_CachePatchName("K_CAPICO", PU_HUDGFX); - kp_rankemerald = W_CachePatchName("K_EMERC", PU_HUDGFX); - kp_rankemeraldflash = W_CachePatchName("K_EMERW", PU_HUDGFX); - kp_rankemeraldback = W_CachePatchName("K_EMERBK", PU_HUDGFX); + HU_UpdatePatch(&kp_rankbumper, "K_BLNICO"); + HU_UpdatePatch(&kp_tinybumper[0], "K_BLNA"); + HU_UpdatePatch(&kp_tinybumper[1], "K_BLNB"); + HU_UpdatePatch(&kp_ranknobumpers, "K_NOBLNS"); + HU_UpdatePatch(&kp_rankcapsule, "K_CAPICO"); + HU_UpdatePatch(&kp_rankemerald, "K_EMERC"); + HU_UpdatePatch(&kp_rankemeraldflash, "K_EMERW"); + HU_UpdatePatch(&kp_rankemeraldback, "K_EMERBK"); // Battle graphics - kp_battlewin = W_CachePatchName("K_BWIN", PU_HUDGFX); - kp_battlecool = W_CachePatchName("K_BCOOL", PU_HUDGFX); - kp_battlelose = W_CachePatchName("K_BLOSE", PU_HUDGFX); - kp_battlewait = W_CachePatchName("K_BWAIT", PU_HUDGFX); - kp_battleinfo = W_CachePatchName("K_BINFO", PU_HUDGFX); - kp_wanted = W_CachePatchName("K_WANTED", PU_HUDGFX); - kp_wantedsplit = W_CachePatchName("4PWANTED", PU_HUDGFX); - kp_wantedreticle = W_CachePatchName("MMAPWANT", PU_HUDGFX); + HU_UpdatePatch(&kp_battlewin, "K_BWIN"); + HU_UpdatePatch(&kp_battlecool, "K_BCOOL"); + HU_UpdatePatch(&kp_battlelose, "K_BLOSE"); + HU_UpdatePatch(&kp_battlewait, "K_BWAIT"); + HU_UpdatePatch(&kp_battleinfo, "K_BINFO"); + HU_UpdatePatch(&kp_wanted, "K_WANTED"); + HU_UpdatePatch(&kp_wantedsplit, "4PWANTED"); + HU_UpdatePatch(&kp_wantedreticle, "MMAPWANT"); // Kart Item Windows - kp_itembg[0] = W_CachePatchName("K_ITBG", PU_HUDGFX); - kp_itembg[1] = W_CachePatchName("K_ITBGD", PU_HUDGFX); - kp_itemtimer[0] = W_CachePatchName("K_ITIMER", PU_HUDGFX); - kp_itemmulsticker[0] = W_CachePatchName("K_ITMUL", PU_HUDGFX); - kp_itemx = W_CachePatchName("K_ITX", PU_HUDGFX); + HU_UpdatePatch(&kp_itembg[0], "K_ITBG"); + HU_UpdatePatch(&kp_itembg[1], "K_ITBGD"); + HU_UpdatePatch(&kp_itemtimer[0], "K_ITIMER"); + HU_UpdatePatch(&kp_itemmulsticker[0], "K_ITMUL"); + HU_UpdatePatch(&kp_itemx, "K_ITX"); - kp_superring[0] = W_CachePatchName("K_ITRING", PU_HUDGFX); - kp_sneaker[0] = W_CachePatchName("K_ITSHOE", PU_HUDGFX); - kp_rocketsneaker[0] = W_CachePatchName("K_ITRSHE", PU_HUDGFX); + HU_UpdatePatch(&kp_superring[0], "K_ITRING"); + HU_UpdatePatch(&kp_sneaker[0], "K_ITSHOE"); + HU_UpdatePatch(&kp_rocketsneaker[0], "K_ITRSHE"); sprintf(buffer, "K_ITINVx"); for (i = 0; i < 7; i++) { buffer[7] = '1'+i; - kp_invincibility[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_invincibility[i], "%s", buffer); } - kp_banana[0] = W_CachePatchName("K_ITBANA", PU_HUDGFX); - kp_eggman[0] = W_CachePatchName("K_ITEGGM", PU_HUDGFX); + HU_UpdatePatch(&kp_banana[0], "K_ITBANA"); + HU_UpdatePatch(&kp_eggman[0], "K_ITEGGM"); sprintf(buffer, "K_ITORBx"); for (i = 0; i < 4; i++) { buffer[7] = '1'+i; - kp_orbinaut[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_orbinaut[i], "%s", buffer); } - kp_jawz[0] = W_CachePatchName("K_ITJAWZ", PU_HUDGFX); - kp_mine[0] = W_CachePatchName("K_ITMINE", PU_HUDGFX); - kp_landmine[0] = W_CachePatchName("K_ITLNDM", PU_HUDGFX); - kp_droptarget[0] = W_CachePatchName("K_ITDTRG", PU_HUDGFX); - kp_ballhog[0] = W_CachePatchName("K_ITBHOG", PU_HUDGFX); - kp_selfpropelledbomb[0] = W_CachePatchName("K_ITSPB", PU_HUDGFX); - kp_grow[0] = W_CachePatchName("K_ITGROW", PU_HUDGFX); - kp_shrink[0] = W_CachePatchName("K_ITSHRK", PU_HUDGFX); - kp_thundershield[0] = W_CachePatchName("K_ITTHNS", PU_HUDGFX); - kp_bubbleshield[0] = W_CachePatchName("K_ITBUBS", PU_HUDGFX); - kp_flameshield[0] = W_CachePatchName("K_ITFLMS", PU_HUDGFX); - kp_hyudoro[0] = W_CachePatchName("K_ITHYUD", PU_HUDGFX); - kp_pogospring[0] = W_CachePatchName("K_ITPOGO", PU_HUDGFX); - kp_kitchensink[0] = W_CachePatchName("K_ITSINK", PU_HUDGFX); - kp_sadface[0] = W_CachePatchName("K_ITSAD", PU_HUDGFX); + HU_UpdatePatch(&kp_jawz[0], "K_ITJAWZ"); + HU_UpdatePatch(&kp_mine[0], "K_ITMINE"); + HU_UpdatePatch(&kp_landmine[0], "K_ITLNDM"); + HU_UpdatePatch(&kp_droptarget[0], "K_ITDTRG"); + HU_UpdatePatch(&kp_ballhog[0], "K_ITBHOG"); + HU_UpdatePatch(&kp_selfpropelledbomb[0], "K_ITSPB"); + HU_UpdatePatch(&kp_grow[0], "K_ITGROW"); + HU_UpdatePatch(&kp_shrink[0], "K_ITSHRK"); + HU_UpdatePatch(&kp_thundershield[0], "K_ITTHNS"); + HU_UpdatePatch(&kp_bubbleshield[0], "K_ITBUBS"); + HU_UpdatePatch(&kp_flameshield[0], "K_ITFLMS"); + HU_UpdatePatch(&kp_hyudoro[0], "K_ITHYUD"); + HU_UpdatePatch(&kp_pogospring[0], "K_ITPOGO"); + HU_UpdatePatch(&kp_kitchensink[0], "K_ITSINK"); + HU_UpdatePatch(&kp_sadface[0], "K_ITSAD"); sprintf(buffer, "FSMFGxxx"); for (i = 0; i < 104; i++) @@ -430,7 +430,7 @@ void K_LoadKartHUDGraphics(void) buffer[5] = '0'+((i+1)/100); buffer[6] = '0'+(((i+1)/10)%10); buffer[7] = '0'+((i+1)%10); - kp_flameshieldmeter[i][0] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_flameshieldmeter[i][0], "%s", buffer); } sprintf(buffer, "FSMBG0xx"); @@ -438,42 +438,42 @@ void K_LoadKartHUDGraphics(void) { buffer[6] = '0'+((i+1)/10); buffer[7] = '0'+((i+1)%10); - kp_flameshieldmeter_bg[i][0] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_flameshieldmeter_bg[i][0], "%s", buffer); } // Splitscreen - kp_itembg[2] = W_CachePatchName("K_ISBG", PU_HUDGFX); - kp_itembg[3] = W_CachePatchName("K_ISBGD", PU_HUDGFX); - kp_itemtimer[1] = W_CachePatchName("K_ISIMER", PU_HUDGFX); - kp_itemmulsticker[1] = W_CachePatchName("K_ISMUL", PU_HUDGFX); + HU_UpdatePatch(&kp_itembg[2], "K_ISBG"); + HU_UpdatePatch(&kp_itembg[3], "K_ISBGD"); + HU_UpdatePatch(&kp_itemtimer[1], "K_ISIMER"); + HU_UpdatePatch(&kp_itemmulsticker[1], "K_ISMUL"); - kp_superring[1] = W_CachePatchName("K_ISRING", PU_HUDGFX); - kp_sneaker[1] = W_CachePatchName("K_ISSHOE", PU_HUDGFX); - kp_rocketsneaker[1] = W_CachePatchName("K_ISRSHE", PU_HUDGFX); + HU_UpdatePatch(&kp_superring[1], "K_ISRING"); + HU_UpdatePatch(&kp_sneaker[1], "K_ISSHOE"); + HU_UpdatePatch(&kp_rocketsneaker[1], "K_ISRSHE"); sprintf(buffer, "K_ISINVx"); for (i = 0; i < 6; i++) { buffer[7] = '1'+i; - kp_invincibility[i+7] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_invincibility[i+7], "%s", buffer); } - kp_banana[1] = W_CachePatchName("K_ISBANA", PU_HUDGFX); - kp_eggman[1] = W_CachePatchName("K_ISEGGM", PU_HUDGFX); - kp_orbinaut[4] = W_CachePatchName("K_ISORBN", PU_HUDGFX); - kp_jawz[1] = W_CachePatchName("K_ISJAWZ", PU_HUDGFX); - kp_mine[1] = W_CachePatchName("K_ISMINE", PU_HUDGFX); - kp_landmine[1] = W_CachePatchName("K_ISLNDM", PU_HUDGFX); - kp_droptarget[1] = W_CachePatchName("K_ISDTRG", PU_HUDGFX); - kp_ballhog[1] = W_CachePatchName("K_ISBHOG", PU_HUDGFX); - kp_selfpropelledbomb[1] = W_CachePatchName("K_ISSPB", PU_HUDGFX); - kp_grow[1] = W_CachePatchName("K_ISGROW", PU_HUDGFX); - kp_shrink[1] = W_CachePatchName("K_ISSHRK", PU_HUDGFX); - kp_thundershield[1] = W_CachePatchName("K_ISTHNS", PU_HUDGFX); - kp_bubbleshield[1] = W_CachePatchName("K_ISBUBS", PU_HUDGFX); - kp_flameshield[1] = W_CachePatchName("K_ISFLMS", PU_HUDGFX); - kp_hyudoro[1] = W_CachePatchName("K_ISHYUD", PU_HUDGFX); - kp_pogospring[1] = W_CachePatchName("K_ISPOGO", PU_HUDGFX); - kp_kitchensink[1] = W_CachePatchName("K_ISSINK", PU_HUDGFX); - kp_sadface[1] = W_CachePatchName("K_ISSAD", PU_HUDGFX); + HU_UpdatePatch(&kp_banana[1], "K_ISBANA"); + HU_UpdatePatch(&kp_eggman[1], "K_ISEGGM"); + HU_UpdatePatch(&kp_orbinaut[4], "K_ISORBN"); + HU_UpdatePatch(&kp_jawz[1], "K_ISJAWZ"); + HU_UpdatePatch(&kp_mine[1], "K_ISMINE"); + HU_UpdatePatch(&kp_landmine[1], "K_ISLNDM"); + HU_UpdatePatch(&kp_droptarget[1], "K_ISDTRG"); + HU_UpdatePatch(&kp_ballhog[1], "K_ISBHOG"); + HU_UpdatePatch(&kp_selfpropelledbomb[1], "K_ISSPB"); + HU_UpdatePatch(&kp_grow[1], "K_ISGROW"); + HU_UpdatePatch(&kp_shrink[1], "K_ISSHRK"); + HU_UpdatePatch(&kp_thundershield[1], "K_ISTHNS"); + HU_UpdatePatch(&kp_bubbleshield[1], "K_ISBUBS"); + HU_UpdatePatch(&kp_flameshield[1], "K_ISFLMS"); + HU_UpdatePatch(&kp_hyudoro[1], "K_ISHYUD"); + HU_UpdatePatch(&kp_pogospring[1], "K_ISPOGO"); + HU_UpdatePatch(&kp_kitchensink[1], "K_ISSINK"); + HU_UpdatePatch(&kp_sadface[1], "K_ISSAD"); sprintf(buffer, "FSMFSxxx"); for (i = 0; i < 104; i++) @@ -481,7 +481,7 @@ void K_LoadKartHUDGraphics(void) buffer[5] = '0'+((i+1)/100); buffer[6] = '0'+(((i+1)/10)%10); buffer[7] = '0'+((i+1)%10); - kp_flameshieldmeter[i][1] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_flameshieldmeter[i][1], "%s", buffer); } sprintf(buffer, "FSMBS0xx"); @@ -489,7 +489,7 @@ void K_LoadKartHUDGraphics(void) { buffer[6] = '0'+((i+1)/10); buffer[7] = '0'+((i+1)%10); - kp_flameshieldmeter_bg[i][1] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_flameshieldmeter_bg[i][1], "%s", buffer); } // CHECK indicators @@ -497,7 +497,7 @@ void K_LoadKartHUDGraphics(void) for (i = 0; i < 6; i++) { buffer[7] = '1'+i; - kp_check[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_check[i], "%s", buffer); } // Rival indicators @@ -505,7 +505,7 @@ void K_LoadKartHUDGraphics(void) for (i = 0; i < 2; i++) { buffer[7] = '1'+i; - kp_rival[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_rival[i], "%s", buffer); } // Rival indicators @@ -516,33 +516,33 @@ void K_LoadKartHUDGraphics(void) for (j = 0; j < 2; j++) { buffer[7] = '1'+j; - kp_localtag[i][j] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_localtag[i][j], "%s", buffer); } } // Typing indicator - kp_talk = W_CachePatchName("K_TALK", PU_HUDGFX); - kp_typdot = W_CachePatchName("K_TYPDOT", PU_HUDGFX); + HU_UpdatePatch(&kp_talk, "K_TALK"); + HU_UpdatePatch(&kp_typdot, "K_TYPDOT"); // Eggman warning numbers sprintf(buffer, "K_EGGNx"); for (i = 0; i < 4; i++) { buffer[6] = '0'+i; - kp_eggnum[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_eggnum[i], "%s", buffer); } // First person mode - kp_fpview[0] = W_CachePatchName("VIEWA0", PU_HUDGFX); - kp_fpview[1] = W_CachePatchName("VIEWB0D0", PU_HUDGFX); - kp_fpview[2] = W_CachePatchName("VIEWC0E0", PU_HUDGFX); + HU_UpdatePatch(&kp_fpview[0], "VIEWA0"); + HU_UpdatePatch(&kp_fpview[1], "VIEWB0D0"); + HU_UpdatePatch(&kp_fpview[2], "VIEWC0E0"); // Input UI Wheel sprintf(buffer, "K_WHEELx"); for (i = 0; i < 5; i++) { buffer[7] = '0'+i; - kp_inputwheel[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_inputwheel[i], "%s", buffer); } // HERE COMES A NEW CHALLENGER @@ -551,7 +551,7 @@ void K_LoadKartHUDGraphics(void) { buffer[6] = '0'+((i+1)/10); buffer[7] = '0'+((i+1)%10); - kp_challenger[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_challenger[i], "%s", buffer); } // Lap start animation @@ -559,7 +559,7 @@ void K_LoadKartHUDGraphics(void) for (i = 0; i < 7; i++) { buffer[6] = '0'+(i+1); - kp_lapanim_lap[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_lapanim_lap[i], "%s", buffer); } sprintf(buffer, "K_LAPFxx"); @@ -567,7 +567,7 @@ void K_LoadKartHUDGraphics(void) { buffer[6] = '0'+((i+1)/10); buffer[7] = '0'+((i+1)%10); - kp_lapanim_final[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_lapanim_final[i], "%s", buffer); } sprintf(buffer, "K_LAPNxx"); @@ -577,7 +577,7 @@ void K_LoadKartHUDGraphics(void) for (j = 0; j < 3; j++) { buffer[7] = '0'+(j+1); - kp_lapanim_number[i][j] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_lapanim_number[i][j], "%s", buffer); } } @@ -585,53 +585,53 @@ void K_LoadKartHUDGraphics(void) for (i = 0; i < 2; i++) { buffer[7] = '0'+(i+1); - kp_lapanim_emblem[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_lapanim_emblem[i], "%s", buffer); } sprintf(buffer, "K_LAPH0x"); for (i = 0; i < 3; i++) { buffer[7] = '0'+(i+1); - kp_lapanim_hand[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_lapanim_hand[i], "%s", buffer); } - kp_yougotem = (patch_t *) W_CachePatchName("YOUGOTEM", PU_HUDGFX); - kp_itemminimap = (patch_t *) W_CachePatchName("MMAPITEM", PU_HUDGFX); + HU_UpdatePatch(&kp_yougotem, "YOUGOTEM"); + HU_UpdatePatch(&kp_itemminimap, "MMAPITEM"); sprintf(buffer, "ALAGLESx"); for (i = 0; i < 10; ++i) { buffer[7] = '0'+i; - kp_alagles[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_alagles[i], "%s", buffer); } sprintf(buffer, "BLAGLESx"); for (i = 0; i < 6; ++i) { buffer[7] = '0'+i; - kp_blagles[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_blagles[i], "%s", buffer); } - kp_cpu = (patch_t *) W_CachePatchName("K_CPU", PU_HUDGFX); + HU_UpdatePatch(&kp_cpu, "K_CPU"); - kp_nametagstem = (patch_t *) W_CachePatchName("K_NAMEST", PU_HUDGFX); + HU_UpdatePatch(&kp_nametagstem, "K_NAMEST"); + + HU_UpdatePatch(&kp_trickcool[0], "K_COOL1"); + HU_UpdatePatch(&kp_trickcool[1], "K_COOL2"); sprintf(buffer, "K_BOSB0x"); for (i = 0; i < 8; i++) { buffer[7] = '0'+((i+1)%10); - kp_bossbar[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_bossbar[i], "%s", buffer); } sprintf(buffer, "K_BOSR0x"); for (i = 0; i < 4; i++) { buffer[7] = '0'+((i+1)%10); - kp_bossret[i] = (patch_t *) W_CachePatchName(buffer, PU_HUDGFX); + HU_UpdatePatch(&kp_bossret[i], "%s", buffer); } - - kp_trickcool[0] = W_CachePatchName("K_COOL1", PU_HUDGFX); - kp_trickcool[1] = W_CachePatchName("K_COOL2", PU_HUDGFX); } // For the item toggle menu diff --git a/src/lua_baselib.c b/src/lua_baselib.c index decf683f4..85ff45a4c 100644 --- a/src/lua_baselib.c +++ b/src/lua_baselib.c @@ -214,7 +214,6 @@ static const struct { {META_BBOX, "bbox"}, - {META_HUDINFO, "hudinfo_t"}, {META_PATCH, "patch_t"}, {META_COLORMAP, "colormap"}, {META_CAMERA, "camera_t"}, diff --git a/src/lua_hudlib.c b/src/lua_hudlib.c index 75a84ed18..b5e3d1acc 100644 --- a/src/lua_hudlib.c +++ b/src/lua_hudlib.c @@ -14,7 +14,7 @@ #include "fastcmp.h" #include "r_defs.h" #include "r_local.h" -#include "st_stuff.h" // hudinfo[] +#include "st_stuff.h" #include "g_game.h" #include "i_video.h" // rendermode #include "p_local.h" // camera_t @@ -63,18 +63,6 @@ static const char *const hud_disable_options[] = { "intermissionmessages", NULL}; -enum hudinfo { - hudinfo_x = 0, - hudinfo_y, - hudinfo_f -}; - -static const char *const hudinfo_opt[] = { - "x", - "y", - "f", - NULL}; - enum patch { patch_valid = 0, patch_width, @@ -182,73 +170,6 @@ static const char *const camera_opt[] = { "pnum", NULL}; -static int lib_getHudInfo(lua_State *L) -{ - UINT32 i; - lua_remove(L, 1); - - i = luaL_checkinteger(L, 1); - if (i >= NUMHUDITEMS) - return luaL_error(L, "hudinfo[] index %d out of range (0 - %d)", i, NUMHUDITEMS-1); - LUA_PushUserdata(L, &hudinfo[i], META_HUDINFO); - return 1; -} - -static int lib_hudinfolen(lua_State *L) -{ - lua_pushinteger(L, NUMHUDITEMS); - return 1; -} - -static int hudinfo_get(lua_State *L) -{ - hudinfo_t *info = *((hudinfo_t **)luaL_checkudata(L, 1, META_HUDINFO)); - enum hudinfo field = luaL_checkoption(L, 2, hudinfo_opt[0], hudinfo_opt); - I_Assert(info != NULL); // huditems are always valid - - switch(field) - { - case hudinfo_x: - lua_pushinteger(L, info->x); - break; - case hudinfo_y: - lua_pushinteger(L, info->y); - break; - case hudinfo_f: - lua_pushinteger(L, info->f); - break; - } - return 1; -} - -static int hudinfo_set(lua_State *L) -{ - hudinfo_t *info = *((hudinfo_t **)luaL_checkudata(L, 1, META_HUDINFO)); - enum hudinfo field = luaL_checkoption(L, 2, hudinfo_opt[0], hudinfo_opt); - I_Assert(info != NULL); - - switch(field) - { - case hudinfo_x: - info->x = (INT32)luaL_checkinteger(L, 3); - break; - case hudinfo_y: - info->y = (INT32)luaL_checkinteger(L, 3); - break; - case hudinfo_f: - info->f = (INT32)luaL_checkinteger(L, 3); - break; - } - return 0; -} - -static int hudinfo_num(lua_State *L) -{ - hudinfo_t *info = *((hudinfo_t **)luaL_checkudata(L, 1, META_HUDINFO)); - lua_pushinteger(L, info-hudinfo); - return 1; -} - static int colormap_get(lua_State *L) { const UINT8 *colormap = *((UINT8 **)luaL_checkudata(L, 1, META_COLORMAP)); @@ -1307,27 +1228,6 @@ int LUA_HudLib(lua_State *L) lua_rawseti(L, -2, 6); // HUD[6] = title card rendering functions array lua_setfield(L, LUA_REGISTRYINDEX, "HUD"); - luaL_newmetatable(L, META_HUDINFO); - lua_pushcfunction(L, hudinfo_get); - lua_setfield(L, -2, "__index"); - - lua_pushcfunction(L, hudinfo_set); - lua_setfield(L, -2, "__newindex"); - - lua_pushcfunction(L, hudinfo_num); - lua_setfield(L, -2, "__len"); - lua_pop(L,1); - - lua_newuserdata(L, 0); - lua_createtable(L, 0, 2); - lua_pushcfunction(L, lib_getHudInfo); - lua_setfield(L, -2, "__index"); - - lua_pushcfunction(L, lib_hudinfolen); - lua_setfield(L, -2, "__len"); - lua_setmetatable(L, -2); - lua_setglobal(L, "hudinfo"); - luaL_newmetatable(L, META_COLORMAP); lua_pushcfunction(L, colormap_get); lua_setfield(L, -2, "__index"); diff --git a/src/lua_libs.h b/src/lua_libs.h index c02964467..a6580622b 100644 --- a/src/lua_libs.h +++ b/src/lua_libs.h @@ -81,7 +81,6 @@ extern lua_State *gL; #define META_BBOX "BOUNDING_BOX" -#define META_HUDINFO "HUDINFO_T*" #define META_PATCH "PATCH_T*" #define META_COLORMAP "COLORMAP" #define META_CAMERA "CAMERA_T*" diff --git a/src/p_setup.c b/src/p_setup.c index 16220128f..98f2900c8 100644 --- a/src/p_setup.c +++ b/src/p_setup.c @@ -4606,6 +4606,8 @@ static lumpinfo_t* FindFolder(const char *folName, UINT16 *start, UINT16 *end, l return lumpinfo; } +UINT16 p_adding_file = INT16_MAX; + // // Add a wadfile to the active wad files, // replace sounds, musics, patches, textures, sprites and maps @@ -4643,6 +4645,8 @@ boolean P_AddWadFile(const char *wadfilename) else wadnum = (UINT16)(numwadfiles-1); + p_adding_file = wadnum; + switch(wadfiles[wadnum]->type) { case RET_PK3: @@ -4739,16 +4743,16 @@ boolean P_AddWadFile(const char *wadfilename) // Reload it all anyway, just in case they // added some textures but didn't insert a // TEXTURES/etc. list. - R_LoadTextures(); // numtexture changes + R_LoadTexturesPwad(wadnum); // numtexture changes // Reload ANIMDEFS P_InitPicAnims(); // Reload BRIGHT - K_InitBrightmaps(); + K_InitBrightmapsPwad(wadnum); // Flush and reload HUD graphics - ST_UnloadGraphics(); + //ST_UnloadGraphics(); HU_LoadGraphics(); ST_LoadGraphics(); @@ -4764,11 +4768,6 @@ boolean P_AddWadFile(const char *wadfilename) // S_LoadMusicDefs(wadnum); - // - // edit music defs - // - S_LoadMusicDefs(wadnum); - // // search for maps // @@ -4828,5 +4827,7 @@ boolean P_AddWadFile(const char *wadfilename) refreshdirmenu &= ~REFRESHDIR_GAMEDATA; // Under usual circumstances we'd wait for REFRESHDIR_GAMEDATA to disappear the next frame, but it's a bit too dangerous for that... + p_adding_file = INT16_MAX; + return true; } diff --git a/src/p_setup.h b/src/p_setup.h index dfa79da14..548d9e7c0 100644 --- a/src/p_setup.h +++ b/src/p_setup.h @@ -96,6 +96,8 @@ INT32 P_CheckLevelFlat(const char *flatname); extern size_t nummapthings; extern mapthing_t *mapthings; +extern UINT16 p_adding_file; + void P_SetupLevelSky(const char *skytexname, boolean global); #ifdef SCANTHINGS void P_ScanThings(INT16 mapnum, INT16 wadnum, INT16 lumpnum); diff --git a/src/p_spec.c b/src/p_spec.c index da318a8eb..cc1a0f8a9 100644 --- a/src/p_spec.c +++ b/src/p_spec.c @@ -164,6 +164,9 @@ void P_ParseAnimationDefintion(SINT8 istexture); * \sa P_FindAnimatedFlat, P_SetupLevelFlatAnims * \author Steven McGranahan (original), Shadow Hog (had to rewrite it to handle multiple WADs), JTE (had to rewrite it to handle multiple WADs _correctly_) */ + +static boolean animdeftempflats = false; // only until ANIMDEFS flats are removed + void P_InitPicAnims(void) { // Init animation @@ -183,6 +186,7 @@ void P_InitPicAnims(void) while (animdefsLumpNum != INT16_MAX) { + animdeftempflats = ((p_adding_file == INT16_MAX) || p_adding_file == w); P_ParseANIMDEFSLump(w, animdefsLumpNum); animdefsLumpNum = W_CheckNumForNamePwad("ANIMDEFS", (UINT16)w, animdefsLumpNum + 1); } @@ -204,7 +208,7 @@ void P_InitPicAnims(void) lastanim = anims; for (i = 0; animdefs[i].istexture != -1; i++) { - if (animdefs[i].istexture) + if (animdefs[i].istexture == 1) { if (R_CheckTextureNumForName(animdefs[i].startname) == -1) continue; @@ -213,6 +217,14 @@ void P_InitPicAnims(void) lastanim->basepic = R_TextureNumForName(animdefs[i].startname); } else + { + if (animdefs[i].istexture == 2) + { + CONS_Alert(CONS_WARNING, "ANIMDEFS flats are disabled; flat support in general will be removed soon! (%s, %s)\n", animdefs[i].startname, animdefs[i].endname); + } + continue; + } +#if 0 { if ((W_CheckNumForName(animdefs[i].startname)) == LUMPERROR) continue; @@ -220,6 +232,7 @@ void P_InitPicAnims(void) lastanim->picnum = R_GetFlatNumForName(animdefs[i].endname); lastanim->basepic = R_GetFlatNumForName(animdefs[i].startname); } +#endif lastanim->istexture = animdefs[i].istexture; lastanim->numpics = lastanim->picnum - lastanim->basepic + 1; @@ -367,7 +380,10 @@ void P_ParseAnimationDefintion(SINT8 istexture) Z_Free(animdefsToken); // set texture type - animdefs[i].istexture = istexture; + if (istexture) + animdefs[i].istexture = 1; + else + animdefs[i].istexture = (animdeftempflats ? 2 : 0); // "RANGE" animdefsToken = M_GetToken(NULL); diff --git a/src/r_defs.h b/src/r_defs.h index a466c856c..93353a775 100644 --- a/src/r_defs.h +++ b/src/r_defs.h @@ -691,6 +691,8 @@ typedef struct #endif } patch_t; +extern patch_t *missingpat; + #if defined(_MSC_VER) #pragma pack(1) #endif diff --git a/src/r_patch.c b/src/r_patch.c index 1a08d1892..544c15ae8 100644 --- a/src/r_patch.c +++ b/src/r_patch.c @@ -76,8 +76,7 @@ static void Patch_FreeData(patch_t *patch) for (i = 0; i < 4; i++) { - if (patch->flats[i]) - Z_Free(patch->flats[i]); + Z_Free(patch->flats[i]); } #ifdef ROTSPRITE @@ -96,14 +95,14 @@ static void Patch_FreeData(patch_t *patch) } #endif - if (patch->columnofs) - Z_Free(patch->columnofs); - if (patch->columns) - Z_Free(patch->columns); + Z_Free(patch->columnofs); + Z_Free(patch->columns); } void Patch_Free(patch_t *patch) { + if (patch == missingpat) + return; Patch_FreeData(patch); Z_Free(patch); } diff --git a/src/r_textures.c b/src/r_textures.c index 3b6e561b5..d04935b3e 100644 --- a/src/r_textures.c +++ b/src/r_textures.c @@ -944,28 +944,53 @@ Rloadtextures (INT32 i, INT32 w) return i; } -// -// R_LoadTextures -// Initializes the texture list with the textures from the world map. -// -void R_LoadTextures(void) +static INT32 +count_range +( const char * marker_start, + const char * marker_end, + const char * folder, + UINT16 wadnum) { - INT32 i, w; UINT16 j; - UINT16 texstart, texend, texturesLumpPos; + UINT16 texstart, texend; + INT32 count = 0; - // Free previous memory before numtextures change. - if (numtextures) + // Count flats + if (wadfiles[wadnum]->type == RET_PK3) { - for (i = 0; i < numtextures; i++) - { - Z_Free(textures[i]); - Z_Free(texturecache[i]); - } - Z_Free(texturebrightmaps); - Z_Free(texturetranslation); - Z_Free(textures); + texstart = W_CheckNumForFolderStartPK3(folder, wadnum, 0); + texend = W_CheckNumForFolderEndPK3(folder, wadnum, texstart); } + else + { + texstart = W_CheckNumForMarkerStartPwad(marker_start, wadnum, 0); + texend = W_CheckNumForNamePwad(marker_end, wadnum, texstart); + } + + if (texstart != INT16_MAX && texend != INT16_MAX) + { + // PK3s have subfolders, so we can't just make a simple sum + if (wadfiles[wadnum]->type == RET_PK3) + { + for (j = texstart; j < texend; j++) + { + if (!W_IsLumpFolder(wadnum, j)) // Check if lump is a folder; if not, then count it + count++; + } + } + else // Add all the textures between markers + { + count += (texend - texstart); + } + } + + return count; +} + +static INT32 R_CountTextures(UINT16 wadnum) +{ + UINT16 texturesLumpPos; + INT32 count = 0; // Load patches and textures. @@ -974,111 +999,99 @@ void R_LoadTextures(void) // the markers. // This system will allocate memory for all duplicate/patched textures even if it never uses them, // but the alternative is to spend a ton of time checking and re-checking all previous entries just to skip any potentially patched textures. - for (w = 0, numtextures = 0; w < numwadfiles; w++) - { + #ifdef WALLFLATS - // Count flats - if (wadfiles[w]->type == RET_PK3) - { - texstart = W_CheckNumForFolderStartPK3("flats/", (UINT16)w, 0); - texend = W_CheckNumForFolderEndPK3("flats/", (UINT16)w, texstart); - } - else - { - texstart = W_CheckNumForMarkerStartPwad("F_START", (UINT16)w, 0); - texend = W_CheckNumForNamePwad("F_END", (UINT16)w, texstart); - } + count += count_range("F_START", "F_END", "flats/", wadnum); +#endif - if (!( texstart == INT16_MAX || texend == INT16_MAX )) - { - // PK3s have subfolders, so we can't just make a simple sum - if (wadfiles[w]->type == RET_PK3) - { - for (j = texstart; j < texend; j++) - { - if (!W_IsLumpFolder((UINT16)w, j)) // Check if lump is a folder; if not, then count it - numtextures++; - } - } - else // Add all the textures between F_START and F_END - { - numtextures += (UINT32)(texend - texstart); - } - } -#endif/*WALLFLATS*/ + // Count the textures from TEXTURES lumps + texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", wadnum, 0); - // Count the textures from TEXTURES lumps - texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, 0); - while (texturesLumpPos != INT16_MAX) - { - numtextures += R_CountTexturesInTEXTURESLump((UINT16)w, (UINT16)texturesLumpPos); - texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", (UINT16)w, texturesLumpPos + 1); - } - - // Count single-patch textures - if (wadfiles[w]->type == RET_PK3) - { - texstart = W_CheckNumForFolderStartPK3("textures/", (UINT16)w, 0); - texend = W_CheckNumForFolderEndPK3("textures/", (UINT16)w, texstart); - } - else - { - texstart = W_CheckNumForMarkerStartPwad(TX_START, (UINT16)w, 0); - texend = W_CheckNumForNamePwad(TX_END, (UINT16)w, 0); - } - - if (texstart == INT16_MAX || texend == INT16_MAX) - continue; - - // PK3s have subfolders, so we can't just make a simple sum - if (wadfiles[w]->type == RET_PK3) - { - for (j = texstart; j < texend; j++) - { - if (!W_IsLumpFolder((UINT16)w, j)) // Check if lump is a folder; if not, then count it - numtextures++; - } - } - else // Add all the textures between TX_START and TX_END - { - numtextures += (UINT32)(texend - texstart); - } + while (texturesLumpPos != INT16_MAX) + { + count += R_CountTexturesInTEXTURESLump(wadnum, texturesLumpPos); + texturesLumpPos = W_CheckNumForNamePwad("TEXTURES", wadnum, texturesLumpPos + 1); } - // If no textures found by this point, bomb out - if (!numtextures) - I_Error("No textures detected in any WADs!\n"); + // Count single-patch textures + count += count_range(TX_START, TX_END, "textures/", wadnum); + + return count; +} + +static void +recallocuser +( void * user, + size_t old, + size_t new) +{ + char *p = Z_Realloc(*(void**)user, + new, PU_STATIC, user); + + if (new > old) + memset(&p[old], 0, (new - old)); +} + +static void R_AllocateTextures(INT32 add) +{ + const INT32 newtextures = (numtextures + add); + const size_t newsize = newtextures * sizeof (void*); + const size_t oldsize = numtextures * sizeof (void*); + + INT32 i; // Allocate memory and initialize to 0 for all the textures we are initialising. - // There are actually 5 buffers allocated in one for convenience. - textures = Z_Calloc((numtextures * sizeof(void *)) * 5, PU_STATIC, NULL); + recallocuser(&textures, oldsize, newsize); // Allocate texture column offset table. - texturecolumnofs = (void *)((UINT8 *)textures + (numtextures * sizeof(void *))); + recallocuser(&texturecolumnofs, oldsize, newsize); // Allocate texture referencing cache. - texturecache = (void *)((UINT8 *)textures + ((numtextures * sizeof(void *)) * 2)); + recallocuser(&texturecache, oldsize, newsize); // Allocate texture width table. - texturewidth = (void *)((UINT8 *)textures + ((numtextures * sizeof(void *)) * 3)); + recallocuser(&texturewidth, oldsize, newsize); // Allocate texture height table. - textureheight = (void *)((UINT8 *)textures + ((numtextures * sizeof(void *)) * 4)); + recallocuser(&textureheight, oldsize, newsize); // Create translation table for global animation. - texturetranslation = Z_Malloc((numtextures + 1) * sizeof(*texturetranslation), PU_STATIC, NULL); + Z_Realloc(texturetranslation, (newtextures + 1) * sizeof(*texturetranslation), PU_STATIC, &texturetranslation); // Create brightmap texture table. - texturebrightmaps = Z_Malloc((numtextures + 1) * sizeof(*texturebrightmaps), PU_STATIC, NULL); + Z_Realloc(texturebrightmaps, (newtextures + 1) * sizeof(*texturebrightmaps), PU_STATIC, &texturebrightmaps); - for (i = 0; i < numtextures; i++) + for (i = 0; i < numtextures; ++i) + { + // R_FlushTextureCache relies on the user for + // Z_Free, texturecache has been reallocated so the + // user is now garbage memory. + Z_SetUser(texturecache[i], + (void**)&texturecache[i]); + } + + while (i < newtextures) { texturetranslation[i] = i; texturebrightmaps[i] = 0; + i++; } +} - for (i = 0, w = 0; w < numwadfiles; w++) - { +void R_UpdateTextureBrightmap(INT32 tx, INT32 bm) +{ + I_Assert(tx > 0 && tx < numtextures); + I_Assert(bm >= 0 && bm < numtextures); + + texturebrightmaps[tx] = bm; +} + +static INT32 R_DefineTextures(INT32 i, UINT16 w) +{ #ifdef WALLFLATS - i = Rloadflats(i, w); + i = Rloadflats(i, w); #endif - i = Rloadtextures(i, w); - } + return Rloadtextures(i, w); +} + +static void R_FinishLoadingTextures(INT32 add) +{ + numtextures += add; #ifdef HWRENDER if (rendermode == render_opengl) @@ -1086,6 +1099,43 @@ void R_LoadTextures(void) #endif } +// +// R_LoadTextures +// Initializes the texture list with the textures from the world map. +// +void R_LoadTextures(void) +{ + INT32 i, w; + INT32 newtextures = 0; + + for (w = 0; w < numwadfiles; w++) + { + newtextures += R_CountTextures((UINT16)w); + } + + // If no textures found by this point, bomb out + if (!newtextures) + I_Error("No textures detected in any WADs!\n"); + + R_AllocateTextures(newtextures); + + for (i = 0, w = 0; w < numwadfiles; w++) + { + i = R_DefineTextures(i, w); + } + + R_FinishLoadingTextures(newtextures); +} + +void R_LoadTexturesPwad(UINT16 wadnum) +{ + INT32 newtextures = R_CountTextures(wadnum); + + R_AllocateTextures(newtextures); + R_DefineTextures(numtextures, wadnum); + R_FinishLoadingTextures(newtextures); +} + static texpatch_t *R_ParsePatch(boolean actuallyLoadPatch) { char *texturesToken; diff --git a/src/r_textures.h b/src/r_textures.h index a4e208eb3..007da38ac 100644 --- a/src/r_textures.h +++ b/src/r_textures.h @@ -77,6 +77,7 @@ extern UINT8 **texturecache; // graphics data for each generated full-size textu // Load TEXTURES definitions, create lookup tables void R_LoadTextures(void); +void R_LoadTexturesPwad(UINT16 wadnum); void R_FlushTextureCache(void); // Texture generation @@ -95,6 +96,8 @@ void *R_GetFlat(lumpnum_t flatnum); boolean R_CheckPowersOfTwo(void); void R_CheckFlatLength(size_t size); +void R_UpdateTextureBrightmap(INT32 tx, INT32 bm); + // Returns the texture number for the texture name. INT32 R_TextureNumForName(const char *name); INT32 R_CheckTextureNumForName(const char *name); diff --git a/src/r_things.c b/src/r_things.c index 9441804b1..3108a82fc 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -261,7 +261,9 @@ boolean R_AddSingleSpriteDef(const char *sprname, spritedef_t *spritedef, UINT16 for (l = startlump; l < endlump; l++) { - if (memcmp(lumpinfo[l].name,sprname,4)==0) + if (memcmp(lumpinfo[l].name,sprname,4)) + continue; + { INT32 width, height; INT16 topoffset, leftoffset; diff --git a/src/st_stuff.c b/src/st_stuff.c index f1af9465c..2c2bcec12 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -63,77 +63,6 @@ patch_t *faceprefix[MAXSKINS][NUMFACES]; // status bar overlay // ------------------------------------------ -// icons for overlay -patch_t *sboscore; // Score logo -patch_t *sbotime; // Time logo -patch_t *sbocolon; // Colon for time -patch_t *sboperiod; // Period for time centiseconds -patch_t *livesback; // Lives icon background -patch_t *stlivex; -static patch_t *nrec_timer; // Timer for NiGHTS records -static patch_t *sborings; -static patch_t *slidgame; -static patch_t *slidtime; -static patch_t *slidover; -static patch_t *sboredrings; -static patch_t *sboredtime; -static patch_t *getall; // Special Stage HUD -static patch_t *timeup; // Special Stage HUD -static patch_t *hunthoming[6]; -static patch_t *itemhoming[6]; -static patch_t *race1; -static patch_t *race2; -static patch_t *race3; -static patch_t *racego; -static patch_t *nightslink; -static patch_t *curweapon; -static patch_t *normring; -static patch_t *bouncering; -static patch_t *infinityring; -static patch_t *autoring; -static patch_t *explosionring; -static patch_t *scatterring; -static patch_t *grenadering; -static patch_t *railring; -static patch_t *jumpshield; -static patch_t *forceshield; -static patch_t *ringshield; -static patch_t *watershield; -static patch_t *bombshield; -static patch_t *pityshield; -static patch_t *pinkshield; -static patch_t *flameshield; -static patch_t *bubbleshield; -static patch_t *thundershield; -static patch_t *invincibility; -static patch_t *sneakers; -static patch_t *gravboots; -static patch_t *nonicon; -static patch_t *nonicon2; -static patch_t *bluestat; -static patch_t *byelstat; -static patch_t *orngstat; -static patch_t *redstat; -static patch_t *yelstat; -static patch_t *nbracket; -static patch_t *nring; -static patch_t *nhud[12]; -static patch_t *nsshud; -static patch_t *nbon[12]; -static patch_t *nssbon; -static patch_t *narrow[9]; -static patch_t *nredar[8]; // Red arrow -static patch_t *drillbar; -static patch_t *drillfill[3]; -static patch_t *capsulebar; -static patch_t *capsulefill; -patch_t *ngradeletters[7]; -static patch_t *minus5sec; -static patch_t *minicaps; -static patch_t *gotrflag; -static patch_t *gotbflag; -static patch_t *fnshico; - // Midnight Channel: static patch_t *hud_tv1; static patch_t *hud_tv2; @@ -143,38 +72,6 @@ static patch_t *hud_tv2; static patch_t *envelope; #endif -// SRB2kart - -hudinfo_t hudinfo[NUMHUDITEMS] = -{ - { 16, 176, V_SNAPTOLEFT|V_SNAPTOBOTTOM}, // HUD_LIVES - - { 16, 42, V_SNAPTOLEFT|V_SNAPTOTOP}, // HUD_RINGS - { 96, 42, V_SNAPTOLEFT|V_SNAPTOTOP}, // HUD_RINGSNUM - { 120, 42, V_SNAPTOLEFT|V_SNAPTOTOP}, // HUD_RINGSNUMTICS - - { 16, 10, V_SNAPTOLEFT|V_SNAPTOTOP}, // HUD_SCORE - { 120, 10, V_SNAPTOLEFT|V_SNAPTOTOP}, // HUD_SCORENUM - - { 16, 26, V_SNAPTOLEFT|V_SNAPTOTOP}, // HUD_TIME - { 72, 26, V_SNAPTOLEFT|V_SNAPTOTOP}, // HUD_MINUTES - { 72, 26, V_SNAPTOLEFT|V_SNAPTOTOP}, // HUD_TIMECOLON - { 96, 26, V_SNAPTOLEFT|V_SNAPTOTOP}, // HUD_SECONDS - { 96, 26, V_SNAPTOLEFT|V_SNAPTOTOP}, // HUD_TIMETICCOLON - { 120, 26, V_SNAPTOLEFT|V_SNAPTOTOP}, // HUD_TICS - - { 0, 56, V_SNAPTOLEFT|V_SNAPTOTOP}, // HUD_SS_TOTALRINGS - - { 110, 93, 0}, // HUD_GETRINGS - { 160, 93, 0}, // HUD_GETRINGSNUM - { 124, 160, 0}, // HUD_TIMELEFT - { 168, 176, 0}, // HUD_TIMELEFTNUM - { 130, 93, 0}, // HUD_TIMEUP - { 152, 168, 0}, // HUD_HUNTPICS - - { 288, 176, V_SNAPTORIGHT|V_SNAPTOBOTTOM}, // HUD_POWERUPS -}; - // // STATUS BAR CODE // @@ -249,8 +146,6 @@ void ST_UnloadGraphics(void) void ST_LoadGraphics(void) { - int i; - // SRB2 border patch // st_borderpatchnum = W_GetNumForName("GFZFLR01"); // scr_borderpatch = W_CacheLumpNum(st_borderpatchnum, PU_HUDGFX); @@ -260,116 +155,15 @@ void ST_LoadGraphics(void) // but load them in R_AddSkins, that gets called // first anyway // cache the status bar overlay icons (fullscreen mode) - - // Prefix "STT" is whitelisted (doesn't trigger ISGAMEMODIFIED), btw - sborings = W_CachePatchName("STTRINGS", PU_HUDGFX); - sboredrings = W_CachePatchName("STTRRING", PU_HUDGFX); - sboscore = W_CachePatchName("STTSCORE", PU_HUDGFX); - sbotime = W_CachePatchName("STTTIME", PU_HUDGFX); // Time logo - sboredtime = W_CachePatchName("STTRTIME", PU_HUDGFX); - sbocolon = W_CachePatchName("STTCOLON", PU_HUDGFX); // Colon for time - sboperiod = W_CachePatchName("STTPERIO", PU_HUDGFX); // Period for time centiseconds - - slidgame = W_CachePatchName("SLIDGAME", PU_HUDGFX); - slidtime = W_CachePatchName("SLIDTIME", PU_HUDGFX); - slidover = W_CachePatchName("SLIDOVER", PU_HUDGFX); - - stlivex = W_CachePatchName("STLIVEX", PU_HUDGFX); - livesback = W_CachePatchName("STLIVEBK", PU_HUDGFX); - nrec_timer = W_CachePatchName("NGRTIMER", PU_HUDGFX); // Timer for NiGHTS - getall = W_CachePatchName("GETALL", PU_HUDGFX); // Special Stage HUD - timeup = W_CachePatchName("TIMEUP", PU_HUDGFX); // Special Stage HUD - race1 = W_CachePatchName("RACE1", PU_HUDGFX); - race2 = W_CachePatchName("RACE2", PU_HUDGFX); - race3 = W_CachePatchName("RACE3", PU_HUDGFX); - racego = W_CachePatchName("RACEGO", PU_HUDGFX); - nightslink = W_CachePatchName("NGHTLINK", PU_HUDGFX); - - for (i = 0; i < 6; ++i) - { - hunthoming[i] = W_CachePatchName(va("HOMING%d", i+1), PU_HUDGFX); - itemhoming[i] = W_CachePatchName(va("HOMITM%d", i+1), PU_HUDGFX); - } - - curweapon = W_CachePatchName("CURWEAP", PU_HUDGFX); - normring = W_CachePatchName("RINGIND", PU_HUDGFX); - bouncering = W_CachePatchName("BNCEIND", PU_HUDGFX); - infinityring = W_CachePatchName("INFNIND", PU_HUDGFX); - autoring = W_CachePatchName("AUTOIND", PU_HUDGFX); - explosionring = W_CachePatchName("BOMBIND", PU_HUDGFX); - scatterring = W_CachePatchName("SCATIND", PU_HUDGFX); - grenadering = W_CachePatchName("GRENIND", PU_HUDGFX); - railring = W_CachePatchName("RAILIND", PU_HUDGFX); - jumpshield = W_CachePatchName("TVWWICON", PU_HUDGFX); - forceshield = W_CachePatchName("TVFOICON", PU_HUDGFX); - ringshield = W_CachePatchName("TVATICON", PU_HUDGFX); - watershield = W_CachePatchName("TVELICON", PU_HUDGFX); - bombshield = W_CachePatchName("TVARICON", PU_HUDGFX); - pityshield = W_CachePatchName("TVPIICON", PU_HUDGFX); - pinkshield = W_CachePatchName("TVPPICON", PU_HUDGFX); - flameshield = W_CachePatchName("TVFLICON", PU_HUDGFX); - bubbleshield = W_CachePatchName("TVBBICON", PU_HUDGFX); - thundershield = W_CachePatchName("TVZPICON", PU_HUDGFX); - invincibility = W_CachePatchName("TVIVICON", PU_HUDGFX); - sneakers = W_CachePatchName("TVSSICON", PU_HUDGFX); - gravboots = W_CachePatchName("TVGVICON", PU_HUDGFX); - - tagico = W_CachePatchName("TAGICO", PU_HUDGFX); - rflagico = W_CachePatchName("RFLAGICO", PU_HUDGFX); - bflagico = W_CachePatchName("BFLAGICO", PU_HUDGFX); - rmatcico = W_CachePatchName("RMATCICO", PU_HUDGFX); - bmatcico = W_CachePatchName("BMATCICO", PU_HUDGFX); - gotrflag = W_CachePatchName("GOTRFLAG", PU_HUDGFX); - gotbflag = W_CachePatchName("GOTBFLAG", PU_HUDGFX); - fnshico = W_CachePatchName("FNSHICO", PU_HUDGFX); - nonicon = W_CachePatchName("NONICON", PU_HUDGFX); - nonicon2 = W_CachePatchName("NONICON2", PU_HUDGFX); - - // NiGHTS HUD things - bluestat = W_CachePatchName("BLUESTAT", PU_HUDGFX); - byelstat = W_CachePatchName("BYELSTAT", PU_HUDGFX); - orngstat = W_CachePatchName("ORNGSTAT", PU_HUDGFX); - redstat = W_CachePatchName("REDSTAT", PU_HUDGFX); - yelstat = W_CachePatchName("YELSTAT", PU_HUDGFX); - nbracket = W_CachePatchName("NBRACKET", PU_HUDGFX); - nring = W_CachePatchName("NRNG1", PU_HUDGFX); - for (i = 0; i < 12; ++i) - { - nhud[i] = W_CachePatchName(va("NHUD%d", i+1), PU_HUDGFX); - nbon[i] = W_CachePatchName(va("NBON%d", i+1), PU_HUDGFX); - } - nsshud = W_CachePatchName("NSSHUD", PU_HUDGFX); - nssbon = W_CachePatchName("NSSBON", PU_HUDGFX); - minicaps = W_CachePatchName("MINICAPS", PU_HUDGFX); - - for (i = 0; i < 8; ++i) - { - narrow[i] = W_CachePatchName(va("NARROW%d", i+1), PU_HUDGFX); - nredar[i] = W_CachePatchName(va("NREDAR%d", i+1), PU_HUDGFX); - } - - // non-animated version - narrow[8] = W_CachePatchName("NARROW9", PU_HUDGFX); - - drillbar = W_CachePatchName("DRILLBAR", PU_HUDGFX); - for (i = 0; i < 3; ++i) - drillfill[i] = W_CachePatchName(va("DRILLFI%d", i+1), PU_HUDGFX); - capsulebar = W_CachePatchName("CAPSBAR", PU_HUDGFX); - capsulefill = W_CachePatchName("CAPSFILL", PU_HUDGFX); - minus5sec = W_CachePatchName("MINUS5", PU_HUDGFX); - - for (i = 0; i < 7; ++i) - ngradeletters[i] = W_CachePatchName(va("GRADE%d", i), PU_HUDGFX); - K_LoadKartHUDGraphics(); // Midnight Channel: - hud_tv1 = W_CachePatchName("HUD_TV1", PU_HUDGFX); - hud_tv2 = W_CachePatchName("HUD_TV2", PU_HUDGFX); + HU_UpdatePatch(&hud_tv1, "HUD_TV1"); + HU_UpdatePatch(&hud_tv2, "HUD_TV2"); #ifdef HAVE_DISCORDRPC // Discord Rich Presence - envelope = W_CachePatchName("K_REQUES", PU_HUDGFX); + HU_UpdatePatch(&envelope, "K_REQUES"); #endif } @@ -547,17 +341,6 @@ static INT32 SCR(INT32 r) // ========================================================================= // INTERNAL DRAWING // ========================================================================= -#define ST_DrawTopLeftOverlayPatch(x,y,p) V_DrawScaledPatch(SCX(hudinfo[h+!!r_splitscreen].x), SCY(hudinfo[h+!!r_splitscreen].y), V_SNAPTOTOP|V_SNAPTOLEFT|V_HUDTRANS, p) -#define ST_DrawOverlayNum(x,y,n) V_DrawTallNum(x, y, V_NOSCALESTART|V_HUDTRANS, n) -#define ST_DrawPaddedOverlayNum(x,y,n,d) V_DrawPaddedTallNum(x, y, V_NOSCALESTART|V_HUDTRANS, n, d) -#define ST_DrawOverlayPatch(x,y,p) V_DrawScaledPatch(x, y, V_NOSCALESTART|V_HUDTRANS, p) -#define ST_DrawMappedOverlayPatch(x,y,p,c) V_DrawMappedScaledPatch(x, y, V_NOSCALESTART|V_HUDTRANS, p, c) -#define ST_DrawNumFromHud(h,n) V_DrawTallNum(SCX(hudinfo[h].x), SCY(hudinfo[h].y), V_NOSCALESTART|V_HUDTRANS, n) -#define ST_DrawPadNumFromHud(h,n,q) V_DrawPaddedTallNum(SCX(hudinfo[h].x), SCY(hudinfo[h].y), V_NOSCALESTART|V_HUDTRANS, n, q) -#define ST_DrawPatchFromHud(h,p) V_DrawScaledPatch(SCX(hudinfo[h].x), SCY(hudinfo[h].y), V_NOSCALESTART|V_HUDTRANS, p) -#define ST_DrawNumFromHudWS(h,n) V_DrawTallNum(SCX(hudinfo[h+!!r_splitscreen].x), SCY(hudinfo[h+!!r_splitscreen].y), V_NOSCALESTART|V_HUDTRANS, n) -#define ST_DrawPadNumFromHudWS(h,n,q) V_DrawPaddedTallNum(SCX(hudinfo[h+!!r_splitscreen].x), SCY(hudinfo[h+!!r_splitscreen].y), V_NOSCALESTART|V_HUDTRANS, n, q) -#define ST_DrawPatchFromHudWS(h,p) V_DrawScaledPatch(SCX(hudinfo[h+!!r_splitscreen].x), SCY(hudinfo[h+!!r_splitscreen].y), V_NOSCALESTART|V_HUDTRANS, p) // Devmode information static void ST_drawDebugInfo(void) @@ -807,7 +590,7 @@ void ST_runTitleCard(void) char c = toupper(bossinfo.enemyname[bossinfo.titleshow]); bossinfo.titleshow++; c -= LT_FONTSTART; - if (c < 0 || c >= LT_FONTSIZE || !tc_font[1][(INT32)c] || !bossinfo.titlesound) + if (c < 0 || c >= LT_FONTSIZE || !fontv[GTFN_FONT].font[(INT32)c] || !bossinfo.titlesound) { ; } diff --git a/src/st_stuff.h b/src/st_stuff.h index a17f72c1f..e24343551 100644 --- a/src/st_stuff.h +++ b/src/st_stuff.h @@ -81,54 +81,7 @@ extern UINT32 st_translucency; extern lumpnum_t st_borderpatchnum; // patches, also used in intermission -extern patch_t *sboscore; -extern patch_t *sbotime; -extern patch_t *sbocolon; -extern patch_t *sboperiod; extern patch_t *faceprefix[MAXSKINS][NUMFACES]; -extern patch_t *livesback; -extern patch_t *stlivex; -extern patch_t *ngradeletters[7]; - -/** HUD location information (don't move this comment) - */ -typedef struct -{ - INT32 x, y, f; -} hudinfo_t; - -typedef enum -{ - HUD_LIVES, - - HUD_RINGS, - HUD_RINGSNUM, - HUD_RINGSNUMTICS, - - HUD_SCORE, - HUD_SCORENUM, - - HUD_TIME, - HUD_MINUTES, - HUD_TIMECOLON, - HUD_SECONDS, - HUD_TIMETICCOLON, - HUD_TICS, - - HUD_SS_TOTALRINGS, - - HUD_GETRINGS, - HUD_GETRINGSNUM, - HUD_TIMELEFT, - HUD_TIMELEFTNUM, - HUD_TIMEUP, - HUD_HUNTPICS, - HUD_POWERUPS, - - NUMHUDITEMS -} hudnum_t; - -extern hudinfo_t hudinfo[NUMHUDITEMS]; extern UINT16 objectsdrawn; diff --git a/src/v_video.c b/src/v_video.c index dab3ad6b2..7e01f3393 100644 --- a/src/v_video.c +++ b/src/v_video.c @@ -1703,13 +1703,13 @@ INT32 V_TitleCardStringWidth(const char *str) c -= LT_FONTSTART; // check if character exists, if not, it's a space. - if (c < 0 || c >= LT_FONTSIZE || !tc_font[0][(INT32)c]) + if (c < 0 || c >= LT_FONTSIZE || !fontv[GTOL_FONT].font[(INT32)c]) { xoffs += 10; continue; } - pp = tc_font[1][(INT32)c]; + pp = fontv[GTFN_FONT].font[(INT32)c]; xoffs += pp->width-5; } @@ -1770,14 +1770,14 @@ void V_DrawTitleCardString(INT32 x, INT32 y, const char *str, INT32 flags, boole c -= LT_FONTSTART; // check if character exists, if not, it's a space. - if (c < 0 || c >= LT_FONTSIZE || !tc_font[1][(INT32)c]) + if (c < 0 || c >= LT_FONTSIZE || !fontv[GTFN_FONT].font[(INT32)c]) { xoffs += 10; continue; } - ol = tc_font[0][(INT32)c]; - pp = tc_font[1][(INT32)c]; + ol = fontv[GTOL_FONT].font[(INT32)c]; + pp = fontv[GTFN_FONT].font[(INT32)c]; if (bossmode) { @@ -2310,8 +2310,8 @@ void V_DrawTallNum(INT32 x, INT32 y, INT32 flags, INT32 num) } while (num); // draw a minus sign if necessary - if (neg) - V_DrawScaledPatch(x - w, y, flags, tallminus); // Tails + //if (neg) + //V_DrawScaledPatch(x - w, y, flags, tallminus); // Tails } // Draws a number with a set number of digits. diff --git a/src/w_wad.c b/src/w_wad.c index e1cb6b1aa..879c75063 100644 --- a/src/w_wad.c +++ b/src/w_wad.c @@ -1796,7 +1796,7 @@ void *W_CachePatchName(const char *name, INT32 tag) num = W_CheckNumForName(name); if (num == LUMPERROR) - return W_CachePatchNum(W_GetNumForName("MISSING"), tag); + return missingpat; return W_CachePatchNum(num, tag); } @@ -1807,7 +1807,7 @@ void *W_CachePatchLongName(const char *name, INT32 tag) num = W_CheckNumForLongName(name); if (num == LUMPERROR) - return W_CachePatchNum(W_GetNumForLongName("MISSING"), tag); + return missingpat; return W_CachePatchNum(num, tag); }