1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-11-09 09:52:59 +00:00

Restore previous behaviour for unknown colours

Unknown blit colours, such as " " will be translated to black for the
background or white for the foreground. This restores the behaviour from
before #412.
This commit is contained in:
SquidDev
2020-05-04 09:15:23 +01:00
parent 17b7727262
commit 550ada2f9e
2 changed files with 11 additions and 8 deletions

View File

@@ -55,10 +55,9 @@ public final class FixedWidthFontRenderer
return (float) ((rgb[0] + rgb[1] + rgb[2]) / 3);
}
private static int getColour( char c )
private static int getColour( char c, Colour def )
{
int i = "0123456789abcdef".indexOf( c );
return i < 0 ? 0 : 15 - i;
return 15 - Terminal.getColour( c, def );
}
private static void drawChar( BufferBuilder buffer, float x, float y, int index, float r, float g, float b )
@@ -92,7 +91,7 @@ public final class FixedWidthFontRenderer
private static void drawQuad( BufferBuilder buffer, float x, float y, float width, float height, Palette palette, boolean greyscale, char colourIndex )
{
double[] colour = palette.getColour( getColour( colourIndex ) );
double[] colour = palette.getColour( getColour( colourIndex, Colour.Black ) );
float r, g, b;
if( greyscale )
{
@@ -160,7 +159,7 @@ public final class FixedWidthFontRenderer
for( int i = 0; i < text.length(); i++ )
{
double[] colour = palette.getColour( getColour( textColour.charAt( i ) ) );
double[] colour = palette.getColour( getColour( textColour.charAt( i ), Colour.White ) );
float r, g, b;
if( greyscale )
{