From: chaoskagami Date: Fri, 1 Jul 2016 13:19:40 +0000 (-0400) Subject: Shouldn't have done that. Also cleaning. X-Git-Tag: v0.2.0~46 X-Git-Url: https://chaos.moe/g/?a=commitdiff_plain;h=3c1c7f70a4fa736f0345e8f3f1418f4f8bc83880;p=corbenik%2Fcorbenik.git Shouldn't have done that. Also cleaning. --- diff --git a/source/std/draw.c b/source/std/draw.c index 6fd764a..461a37b 100644 --- a/source/std/draw.c +++ b/source/std/draw.c @@ -169,10 +169,9 @@ void load_bg_top(char* fname_top) { } // See load_bg_bottom for an explanation on the magic value. - dim_factor_top = (max - 178); - - if (dim_factor_top < 0) - dim_factor_top = 0; + dim_factor_top = 0; + if (max > 178) + dim_factor_top = max - 178; } void load_bg_bottom(char* fname_bottom) { @@ -196,10 +195,9 @@ void load_bg_bottom(char* fname_bottom) { // The minimum transparency with pure black overlay (I find) is 70% to be readable. // 70% of 255 is approximately 178, and 255 - 178 is 77. That's therefore the maximum we want to subtract. // Thus this is the value for 70% transparency. - dim_factor_bottom = (max - 178); - - if (dim_factor_bottom < 0) - dim_factor_bottom = 0; + dim_factor_bottom = 0; + if (max > 178) + dim_factor_bottom = max - 178; } void set_font(const char* filename) { @@ -334,9 +332,9 @@ draw_character(uint8_t *screen, const uint32_t character, int ch_x, int ch_y, co unsigned char char_dat = ((char*)FCRAM_FONT_LOC)[(character - ' ') * (c_font_w * font_h) + yy]; for(unsigned int i=0; i < font_w + font_kern; i++) { if (color_bg == 0) { - screen[pos] = buffer_bg[pos]; - screen[pos + 1] = buffer_bg[pos + 1]; - screen[pos + 2] = buffer_bg[pos + 2]; + screen[pos] = 0; + screen[pos + 1] = 0; + screen[pos + 2] = 0; if (buffer_bg[pos] >= dim_factor) screen[pos] = buffer_bg[pos] - dim_factor; if (buffer_bg[pos + 1] >= dim_factor) @@ -351,9 +349,9 @@ draw_character(uint8_t *screen, const uint32_t character, int ch_x, int ch_y, co if (char_dat & 0x80) { if (color_fg == 0) { - screen[pos] = buffer_bg[pos]; - screen[pos + 1] = buffer_bg[pos + 1]; - screen[pos + 2] = buffer_bg[pos + 2]; + screen[pos] = 0; + screen[pos + 1] = 0; + screen[pos + 2] = 0; if (buffer_bg[pos] >= dim_factor) screen[pos] = buffer_bg[pos] - dim_factor; if (buffer_bg[pos + 1] >= dim_factor)