diff --git a/Data/Images/Textures/3000.sfl b/Data/Images/Textures/3000.sfl index aba1af26..b8965735 100644 --- a/Data/Images/Textures/3000.sfl +++ b/Data/Images/Textures/3000.sfl @@ -1,7 +1,7 @@ -font +font (partial windows-1252) 32 57 3000.tga -95 +100 32 1 41 0 0 0 57 13 33 2 4 10 38 2 20 13 34 13 4 15 12 1 20 17 @@ -97,4 +97,9 @@ font 124 311 191 8 45 2 20 12 125 320 191 19 45 -1 20 17 126 340 208 24 11 2 37 27 +145 401 191 13 14 1 20 13 +146 415 191 14 14 -1 20 13 +147 430 191 24 14 1 20 24 +148 455 191 24 14 -1 20 24 +169 365 191 35 38 0 20 34 0 diff --git a/Data/Images/Textures/3000.tga b/Data/Images/Textures/3000.tga index ef3e7c7d..780dfebb 100644 Binary files a/Data/Images/Textures/3000.tga and b/Data/Images/Textures/3000.tga differ diff --git a/src/QD3D/TextMesh.c b/src/QD3D/TextMesh.c index 709222ff..71709032 100644 --- a/src/QD3D/TextMesh.c +++ b/src/QD3D/TextMesh.c @@ -5,6 +5,8 @@ #include "game.h" #include +#define MAX_CODEPOINTS 256 + typedef struct { float x; @@ -17,9 +19,8 @@ typedef struct } AtlasGlyph; static GLuint gFontTexture = 0; -static int gNumGlyphs = 0; static float gLineHeight = 0; -static AtlasGlyph* gAtlasGlyphs = NULL; +static AtlasGlyph gAtlasGlyphs[MAX_CODEPOINTS]; static const TextMeshDef gDefaultTextMeshDef = { @@ -56,7 +57,7 @@ TQ3TriMeshData* TextMesh_SetMesh(const TextMeshDef* def, const char* text, TQ3Tr spacing = def->letterSpacing; } - GAME_ASSERT(gAtlasGlyphs); +// GAME_ASSERT(gAtlasGlyphs); GAME_ASSERT(gFontTexture); // Compute number of quads and line width @@ -67,9 +68,7 @@ TQ3TriMeshData* TextMesh_SetMesh(const TextMeshDef* def, const char* text, TQ3Tr if (*c == '\n') // TODO: line widths for strings containing line breaks aren't supported yet continue; - GAME_ASSERT(*c >= ' '); - GAME_ASSERT(*c <= '~'); - const AtlasGlyph g = gAtlasGlyphs[*c - ' ']; + const AtlasGlyph g = gAtlasGlyphs[(uint8_t) *c]; lineWidth += g.xadv + spacing; if (*c != ' ') numQuads++; @@ -116,9 +115,7 @@ TQ3TriMeshData* TextMesh_SetMesh(const TextMeshDef* def, const char* text, TQ3Tr continue; } - GAME_ASSERT(*c >= ' '); - GAME_ASSERT(*c <= '~'); - const AtlasGlyph g = gAtlasGlyphs[*c - ' ']; + const AtlasGlyph g = gAtlasGlyphs[(uint8_t) *c]; if (*c == ' ') { @@ -177,36 +174,52 @@ static void ParseSFL(const char* data) { int nArgs = 0; int junk = 0; + int numGlyphs = 0; - SkipLine(&data); // Skip font name + // Skip font name + SkipLine(&data); + // Get line height (first int is font size) nArgs = sscanf(data, "%d %f", &junk, &gLineHeight); GAME_ASSERT(nArgs == 2); SkipLine(&data); - SkipLine(&data); // Skip image filename + // Skip image filename + SkipLine(&data); - nArgs = sscanf(data, "%d", &gNumGlyphs); + // Get glyph count + nArgs = sscanf(data, "%d", &numGlyphs); GAME_ASSERT(nArgs == 1); + GAME_ASSERT(numGlyphs <= MAX_CODEPOINTS); SkipLine(&data); +#if 0 GAME_ASSERT_MESSAGE(!gAtlasGlyphs, "atlas glyphs were already loaded"); - gAtlasGlyphs = (AtlasGlyph*) NewPtrClear(gNumGlyphs * sizeof(AtlasGlyph)); + gAtlasGlyphs = (AtlasGlyph*) NewPtrClear(numGlyphs * sizeof(AtlasGlyph)); +#endif - for (int i = 0; i < gNumGlyphs; i++) + for (int i = 0; i < numGlyphs; i++) { + int codepoint = 0; + AtlasGlyph g = {0}; + nArgs = sscanf( data, "%d %f %f %f %f %f %f %f", - &junk, - &gAtlasGlyphs[i].x, - &gAtlasGlyphs[i].y, - &gAtlasGlyphs[i].w, - &gAtlasGlyphs[i].h, - &gAtlasGlyphs[i].xoff, - &gAtlasGlyphs[i].yoff, - &gAtlasGlyphs[i].xadv); + &codepoint, + &g.x, + &g.y, + &g.w, + &g.h, + &g.xoff, + &g.yoff, + &g.xadv); + GAME_ASSERT(nArgs == 8); + GAME_ASSERT(codepoint >= 0); + GAME_ASSERT(codepoint < MAX_CODEPOINTS); + + gAtlasGlyphs[codepoint] = g; SkipLine(&data); } @@ -239,11 +252,13 @@ void TextMesh_Init(void) void TextMesh_Shutdown(void) { +#if 0 if (gAtlasGlyphs) { DisposePtr((Ptr) gAtlasGlyphs); gAtlasGlyphs = NULL; } +#endif if (gFontTexture) { diff --git a/src/Screens/BonusScreen.c b/src/Screens/BonusScreen.c index cff6065f..04de5edb 100644 --- a/src/Screens/BonusScreen.c +++ b/src/Screens/BonusScreen.c @@ -670,7 +670,7 @@ int mouseY = 0; tmd.coord = (TQ3Point3D) {50,-100,0}; tmd.color = TQ3ColorRGBA_FromInt(0xe54c19ff); - TextMesh_Create(&tmd, "Don't save yet"); + TextMesh_Create(&tmd, "Don\222t save yet"); captionsCreatedYet = true; } diff --git a/src/Screens/FileSelect.c b/src/Screens/FileSelect.c index 040b62f6..5b532f95 100644 --- a/src/Screens/FileSelect.c +++ b/src/Screens/FileSelect.c @@ -321,7 +321,7 @@ static void MakeFileObjects(const int fileNumber, bool createPickables) snprintf(textBuffer, sizeof(textBuffer), "Level %d: %s", 1 + saveData.realLevel, kLevelNames[saveData.realLevel]); tmd.coord.y = y+70*gs; - tmd.scale = .25f * gs; + tmd.scale = .2f * gs; TextMesh_Create(&tmd, textBuffer); time_t timestamp = saveData.timestamp; @@ -379,8 +379,6 @@ static void SetupFileScreen(void) } else { - //TextMesh_Create(&tmd, "Save where?"); - snprintf(textBuffer, sizeof(textBuffer), "Entering level %d. Save where?", gRealLevel+2); tmd.scale = .33f; tmd.color = gTitleTextColor; @@ -391,7 +389,7 @@ static void SetupFileScreen(void) tmd.scale = .33f; tmd.color = gDeleteColor; tmd.align = TEXTMESH_ALIGN_RIGHT; - TextMesh_Create(&tmd, "Don't save"); + TextMesh_Create(&tmd, "Don\222t save"); // Make floppy gNewObjectDefinition.group = MODEL_GROUP_BONUS; diff --git a/src/Screens/SettingsScreen.c b/src/Screens/SettingsScreen.c index 59248806..f3906d06 100644 --- a/src/Screens/SettingsScreen.c +++ b/src/Screens/SettingsScreen.c @@ -221,7 +221,7 @@ static const char* GenerateKiddieModeSubtitle(void) static const char* GenerateDetailSubtitle(void) { - return gGamePrefs.lowDetail ? "The \"ATI Rage II\" look" : NULL; + return gGamePrefs.lowDetail ? "The \223ATI Rage II\224 look" : NULL; } #if !(__APPLE__)