- 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.


SVN r351 (trunk)
This commit is contained in:
Christoph Oelckers 2006-10-06 21:07:58 +00:00
parent 6fe9c98b47
commit 3dabd38359
6 changed files with 74 additions and 48 deletions

View File

@ -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

View File

@ -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)
{

View File

@ -321,6 +321,10 @@ void FTextureManager::AddHiresTextures ()
{
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);

View File

@ -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'-first<count && Chars['N' - first].Pic)
{
SpaceWidth = (Chars['N' - first].Pic->GetWidth() + 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'-first<count && Chars['N' - first].Pic)
{
SpaceWidth = (Chars['N' - first].Pic->GetWidth() + 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);
}

View File

@ -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 *);

View File

@ -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);
}