diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index d95e08720..b7dd92b85 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -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); diff --git a/source/blood/src/view.cpp b/source/blood/src/view.cpp index 18f1b0a72..c9149d650 100644 --- a/source/blood/src/view.cpp +++ b/source/blood/src/view.cpp @@ -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) diff --git a/source/blood/src/view.h b/source/blood/src/view.h index df6be4bc7..04e73baf6 100644 --- a/source/blood/src/view.h +++ b/source/blood/src/view.h @@ -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;