blood: Precache fonts

This commit is contained in:
nukeykt 2020-01-02 18:45:31 +09:00 committed by Christoph Oelckers
parent afb8c11683
commit 7af92bb327
3 changed files with 15 additions and 5 deletions

View file

@ -305,6 +305,14 @@ void PreloadTiles(void)
{
int skyTile = -1;
memset(gotpic,0,sizeof(gotpic));
// Fonts
for (int i = 0; i < kFontNum; i++)
{
for (int j = 0; j < 96; j++)
{
tilePrecacheTile(gFont[i].tile + j, 0);
}
}
for (int i = 0; i < numsectors; i++)
{
tilePrecacheTile(sector[i].floorpicnum, 0);

View file

@ -184,11 +184,11 @@ void RotateXY(int *pX, int *pY, int *pZ, int ang)
*pY = dmulscale30r(oX,angSin,oY,angCos);
}
FONT gFont[5];
FONT gFont[kFontNum];
void FontSet(int id, int tile, int space)
{
if (id < 0 || id >= 5 || tile < 0 || tile >= kMaxTiles)
if (id < 0 || id >= kFontNum || tile < 0 || tile >= kMaxTiles)
return;
FONT *pFont = &gFont[id];
@ -209,7 +209,7 @@ void FontSet(int id, int tile, int space)
void viewGetFontInfo(int id, const char *unk1, int *pXSize, int *pYSize)
{
if (id < 0 || id >= 5)
if (id < 0 || id >= kFontNum)
return;
FONT *pFont = &gFont[id];
if (!unk1)
@ -985,7 +985,7 @@ void RestoreInterpolations(void)
void viewDrawText(int nFont, const char *pString, int x, int y, int nShade, int nPalette, int position, char shadow, unsigned int nStat, uint8_t alpha)
{
if (nFont < 0 || nFont >= 5 || !pString) return;
if (nFont < 0 || nFont >= kFontNum || !pString) return;
FONT *pFont = &gFont[nFont];
int nFlags = TEXT_INTERNALSPACE;
switch (position)

View file

@ -74,12 +74,14 @@ enum INTERPOLATE_TYPE {
#define kLoadScreenWideRight 9218
#define kLoadScreenWideMiddle 9219
#define kFontNum 5
struct FONT {
int tile, xSize, ySize, space;
};
extern int gZoom;
extern FONT gFont[5];
extern FONT gFont[kFontNum];
extern int gViewMode;
extern VIEWPOS gViewPos;
extern int gViewIndex;