From fbae5fb16adead5e8af8799da4cfff9e0064afd9 Mon Sep 17 00:00:00 2001 From: jacksonmj Date: Thu, 10 Mar 2011 23:34:22 +0000 Subject: [PATCH] Flashing BRAY fix We should just be thankful that negative life will not save correctly... --- src/graphics.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/graphics.c b/src/graphics.c index cea2ba72a..bbfb32f8f 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1893,10 +1893,16 @@ void draw_parts(pixel *vid) } if (cr>255) cr=255; + if (cr<0) + cr=0; if (cg>255) cg=255; + if (cg<0) + cg=0; if (cb>255) cb=255; + if (cb<0) + cb=0; blendpixel(vid, nx, ny, cr, cg, cb, 255); } else if (t==PT_WIFI) @@ -2143,6 +2149,7 @@ void draw_parts(pixel *vid) else if (t==PT_BRAY && parts[i].tmp==0) { int trans = parts[i].life * 7; + if (trans>255) trans = 255; if (parts[i].ctype) { cg = 0; cb = 0; @@ -2167,6 +2174,7 @@ void draw_parts(pixel *vid) else if (t==PT_BRAY && parts[i].tmp==1) { int trans = parts[i].life/4; + if (trans>255) trans = 255; if (parts[i].ctype) { cg = 0; cb = 0; @@ -2191,6 +2199,7 @@ void draw_parts(pixel *vid) else if (t==PT_BRAY && parts[i].tmp==2) { int trans = parts[i].life*100; + if (trans>255) trans = 255; blendpixel(vid, nx, ny, 255, 150, 50, trans); } else if (t==PT_PHOT)