diff --git a/docs/rh-log.txt b/docs/rh-log.txt index d37cf5165..4bed63763 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,3 +1,11 @@ +October 6, 2006 (Changes by Graf Zahl) +- Fixed: Hires texture replacements must call AddPatch if the texture + isn't defined yet in order to replace lumps that are not in the + list of preinitialized graphics. +- Changed font initialization to occur after textures have been completely + initialized. This is necessary so that the font characters can be + replaced with hires versions. + October 5, 2006 (Changes by Graf Zahl) - Fixed: Hires texture replacements and auto-scaled flats require the bWorldPanning flag. Also added some NULL pointer checks to the diff --git a/src/g_level.cpp b/src/g_level.cpp index 98754626e..d1ea932f0 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -2134,10 +2134,7 @@ void G_FinishTravel () pawndup->Destroy (); pawn->LinkToWorld (); pawn->AddToHash (); - if (pawn->InStateSequence(pawn->state, pawn->PainState)) - { - pawn->SetState(pawn->SeeState); - } + pawn->SetState(pawn->SpawnState); for (inv = pawn->Inventory; inv != NULL; inv = inv->Inventory) { diff --git a/src/r_data.cpp b/src/r_data.cpp index 1400f47b1..d6134f8cc 100644 --- a/src/r_data.cpp +++ b/src/r_data.cpp @@ -320,7 +320,11 @@ void FTextureManager::AddHiresTextures () if (newtex != NULL) { int oldtexno = CheckForTexture(name, FTexture::TEX_Wall, TEXMAN_Overridable|TEXMAN_TryAny); - + + if (oldtexno<0) + { + oldtexno = AddPatch(name); + } newtex->bWorldPanning = true; if (oldtexno<0) { @@ -380,6 +384,11 @@ void FTextureManager::LoadHiresTex() int tex = TexMan.CheckForTexture(sc_String, type, mode); + if (tex<0) + { + tex= AddPatch(sc_String); + } + SC_MustGetString(); int lumpnum = Wads.CheckNumForFullName(sc_String); if (lumpnum < 0) lumpnum = Wads.CheckNumForName(sc_String, ns_graphics); @@ -717,6 +726,7 @@ void R_InitData () TexMan.AddHiresTextures (); TexMan.LoadHiresTex (); TexMan.DefaultTexture = TexMan.CheckForTexture ("-NOFLAT-", FTexture::TEX_Override, 0); + V_InitFonts(); R_InitColormaps (); C_InitConsole (SCREENWIDTH, SCREENHEIGHT, true); diff --git a/src/v_font.cpp b/src/v_font.cpp index ec8686d33..784252e78 100644 --- a/src/v_font.cpp +++ b/src/v_font.cpp @@ -51,6 +51,7 @@ #include "gi.h" #include "cmdlib.h" #include "sc_man.h" +#include "hu_stuff.h" // MACROS ------------------------------------------------------------------ @@ -278,8 +279,8 @@ FFont::FFont (const char *name, const char *nametemplate, int first, int count, if (lump >= 0) { FTexture *pic = TexMan[TexMan.AddPatch (buffer)]; - int height = pic->GetHeight(); - int yoffs = pic->TopOffset; + int height = pic->GetScaledHeight(); + int yoffs = pic->GetScaledTopOffset(); if (yoffs > maxyoffs) { @@ -310,7 +311,7 @@ FFont::FFont (const char *name, const char *nametemplate, int first, int count, if ('N'-first>=0 && 'N'-firstGetWidth() + 1) / 2; + SpaceWidth = (Chars['N' - first].Pic->GetScaledWidth() + 1) / 2; } else { @@ -635,7 +636,7 @@ FTexture *FFont::GetChar (int code, int *const width) const } code -= FirstChar; - *width = Chars[code].Pic->GetWidth(); + *width = Chars[code].Pic->GetScaledWidth(); return Chars[code].Pic; } @@ -667,7 +668,7 @@ int FFont::GetCharWidth (int code) const } } - return Chars[code - FirstChar].Pic->GetWidth(); + return Chars[code - FirstChar].Pic->GetScaledWidth(); } @@ -1362,8 +1363,8 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, int *lumplis { Wads.GetLumpName(buffer, lump); FTexture *pic = TexMan[TexMan.AddPatch (buffer)]; - int height = pic->GetHeight(); - int yoffs = pic->TopOffset; + int height = pic->GetScaledHeight(); + int yoffs = pic->GetScaledTopOffset(); if (yoffs > maxyoffs) { @@ -1418,7 +1419,7 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, int *lumplis // Special fonts normally don't have all characters so be careful here! if ('N'-first>=0 && 'N'-firstGetWidth() + 1) / 2; + SpaceWidth = (Chars['N' - first].Pic->GetScaledWidth() + 1) / 2; } else { @@ -1816,3 +1817,47 @@ EColorRange V_FindFontColor (FName name) } return CR_UNTRANSLATED; } + +//========================================================================== +// +// V_InitFonts +// +//========================================================================== + +void V_InitFonts() +{ + V_InitFontColors (); + + // load the heads-up font + if (Wads.CheckNumForName ("FONTA_S") >= 0) + { + SmallFont = new FFont ("SmallFont", "FONTA%02u", HU_FONTSTART, HU_FONTSIZE, 1); + } + else + { + SmallFont = new FFont ("SmallFont", "STCFN%.3d", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART); + } + if (Wads.CheckNumForName ("STBFN033", ns_graphics) >= 0) + { + SmallFont2 = new FFont ("SmallFont2", "STBFN%.3d", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART); + } + else + { + SmallFont2 = SmallFont; + } + if (gameinfo.gametype == GAME_Doom) + { + BigFont = new FSingleLumpFont ("BigFont", Wads.GetNumForName ("DBIGFONT")); + } + else if (gameinfo.gametype == GAME_Strife) + { + BigFont = new FSingleLumpFont ("BigFont", Wads.GetNumForName ("SBIGFONT")); + } + else + { + BigFont = new FFont ("BigFont", "FONTB%02u", HU_FONTSTART, HU_FONTSIZE, 1); + } + ConFont = new FSingleLumpFont ("ConsoleFont", Wads.GetNumForName ("CONFONT")); + V_InitCustomFonts (); + screen->SetFont(SmallFont); +} diff --git a/src/v_font.h b/src/v_font.h index b23ce45e5..a85c4f629 100644 --- a/src/v_font.h +++ b/src/v_font.h @@ -150,8 +150,7 @@ void RecordTextureColors (FTexture *pic, BYTE *colorsused); extern FFont *SmallFont, *SmallFont2, *BigFont, *ConFont; -void V_InitCustomFonts (); -void V_InitFontColors (); +void V_InitFonts(); EColorRange V_FindFontColor (FName name); FFont * V_GetFont(const char *); diff --git a/src/v_video.cpp b/src/v_video.cpp index 27e69dc12..29c494217 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -924,39 +924,6 @@ void V_Init (void) Printf ("Resolution: %d x %d\n", SCREENWIDTH, SCREENHEIGHT); FBaseCVar::ResetColors (); - V_InitFontColors (); - - // load the heads-up font - if (Wads.CheckNumForName ("FONTA_S") >= 0) - { - SmallFont = new FFont ("SmallFont", "FONTA%02u", HU_FONTSTART, HU_FONTSIZE, 1); - } - else - { - SmallFont = new FFont ("SmallFont", "STCFN%.3d", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART); - } - if (Wads.CheckNumForName ("STBFN033", ns_graphics) >= 0) - { - SmallFont2 = new FFont ("SmallFont2", "STBFN%.3d", HU_FONTSTART, HU_FONTSIZE, HU_FONTSTART); - } - else - { - SmallFont2 = SmallFont; - } - if (gameinfo.gametype == GAME_Doom) - { - BigFont = new FSingleLumpFont ("BigFont", Wads.GetNumForName ("DBIGFONT")); - } - else if (gameinfo.gametype == GAME_Strife) - { - BigFont = new FSingleLumpFont ("BigFont", Wads.GetNumForName ("SBIGFONT")); - } - else - { - BigFont = new FFont ("BigFont", "FONTB%02u", HU_FONTSTART, HU_FONTSIZE, 1); - } - ConFont = new FSingleLumpFont ("ConsoleFont", Wads.GetNumForName ("CONFONT")); - V_InitCustomFonts (); BuildTransTable (GPalette.BaseColors); }