- 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
This commit is contained in:
Christoph Oelckers 2019-02-22 18:19:26 +01:00 committed by drfrag
parent ff0774c2f2
commit d2d637f431
2 changed files with 8 additions and 8 deletions

View file

@ -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<FFontChar1 *>(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<FFontChar1 *>(Chars[i].Pic);

View file

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