From d2d637f431c19931168860701b922f7e8454e8dc Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Fri, 22 Feb 2019 18:19:26 +0100 Subject: [PATCH] - fixed the usedcolor array's base type. The usedcolors array which counts the number of pixels in a given color in a font used bytes as storage, so any color that just happened to have a count that is a multiple of 256 the color was considered not present. # Conflicts: # src/gamedata/fonts/font.cpp # src/gamedata/fonts/fontinternals.h # src/gamedata/fonts/specialfont.cpp # src/gamedata/fonts/v_font.cpp # src/v_font.h --- src/v_font.cpp | 14 +++++++------- src/v_font.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/v_font.cpp b/src/v_font.cpp index 72079855e..993f04d2b 100644 --- a/src/v_font.cpp +++ b/src/v_font.cpp @@ -103,7 +103,7 @@ The FON2 header is followed by variable length data: #define DEFAULT_LOG_COLOR PalEntry(223,223,223) // TYPES ------------------------------------------------------------------- -void RecordTextureColors (FTexture *pic, uint8_t *colorsused); +void RecordTextureColors (FTexture *pic, uint32_t *colorsused); // This structure is used by BuildTranslations() to hold color information. struct TranslationParm @@ -536,7 +536,7 @@ FFont *FFont::FindFont (FName name) // //========================================================================== -void RecordTextureColors (FTexture *pic, uint8_t *usedcolors) +void RecordTextureColors (FTexture *pic, uint32_t *usedcolors) { int x; @@ -600,7 +600,7 @@ static int compare (const void *arg1, const void *arg2) // //========================================================================== -int FFont::SimpleTranslation (uint8_t *colorsused, uint8_t *translation, uint8_t *reverse, double **luminosity) +int FFont::SimpleTranslation (uint32_t *colorsused, uint8_t *translation, uint8_t *reverse, double **luminosity) { double min, max, diver; int i, j; @@ -919,10 +919,10 @@ int FFont::StringWidth(const uint8_t *string) const void FFont::LoadTranslations() { unsigned int count = LastChar - FirstChar + 1; - uint8_t usedcolors[256], identity[256]; + uint32_t usedcolors[256] = {}; + uint8_t identity[256]; double *luminosity; - memset (usedcolors, 0, 256); for (unsigned int i = 0; i < count; i++) { FFontChar1 *pic = static_cast(Chars[i].Pic); @@ -2052,12 +2052,12 @@ FSpecialFont::FSpecialFont (const char *name, int first, int count, FTexture **l void FSpecialFont::LoadTranslations() { int count = LastChar - FirstChar + 1; - uint8_t usedcolors[256], identity[256]; + uint32_t usedcolors[256] = {}; + uint8_t identity[256]; double *luminosity; int TotalColors; int i, j; - memset (usedcolors, 0, 256); for (i = 0; i < count; i++) { FFontChar1 *pic = static_cast(Chars[i].Pic); diff --git a/src/v_font.h b/src/v_font.h index 334f9f59c..ce4c3b324 100644 --- a/src/v_font.h +++ b/src/v_font.h @@ -113,7 +113,7 @@ protected: const void *ranges, int total_colors, const PalEntry *palette); void FixXMoves(); - static int SimpleTranslation (uint8_t *colorsused, uint8_t *translation, + static int SimpleTranslation (uint32_t *colorsused, uint8_t *translation, uint8_t *identity, double **luminosity); int FirstChar, LastChar;