diff options
| author | Cracker64 <cracker642@gmail.com> | 2010-12-29 22:22:18 (GMT) |
|---|---|---|
| committer | Cracker64 <cracker642@gmail.com> | 2010-12-29 22:22:18 (GMT) |
| commit | 8df470662fc687cedeac97fac2c4d8afe4ccedd0 (patch) | |
| tree | 0d27ecea2b65430214c6e6e727437b2fb0907ac8 /src/graphics.c | |
| parent | 5766f9aa7ee0f78adea5799322dce67506d9247d (diff) | |
| download | powder-8df470662fc687cedeac97fac2c4d8afe4ccedd0.zip powder-8df470662fc687cedeac97fac2c4d8afe4ccedd0.tar.gz | |
ARAY gets colored by FILT, woo
Diffstat (limited to 'src/graphics.c')
| -rw-r--r-- | src/graphics.c | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/src/graphics.c b/src/graphics.c index a22cf58..adc0c18 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1915,12 +1915,50 @@ void draw_parts(pixel *vid) else if(t==PT_BRAY && parts[i].tmp==0) { int trans = parts[i].life * 7; - blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans); + if(parts[i].ctype){ + cg = 0; + cb = 0; + cr = 0; + for(x=0; x<12; x++) { + cr += (parts[i].ctype >> (x+18)) & 1; + cb += (parts[i].ctype >> x) & 1; + } + for(x=0; x<14; x++) + cg += (parts[i].ctype >> (x+9)) & 1; + x = 624/(cr+cg+cb+1); + cr *= x; + cg *= x; + cb *= x; + cr = cr>255?255:cr; + cg = cg>255?255:cg; + cb = cb>255?255:cb; + blendpixel(vid, nx, ny, cr, cg, cb, trans); + }else + blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans); } else if(t==PT_BRAY && parts[i].tmp==1) { int trans = parts[i].life/4; - blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans); + if(parts[i].ctype){ + cg = 0; + cb = 0; + cr = 0; + for(x=0; x<12; x++) { + cr += (parts[i].ctype >> (x+18)) & 1; + cb += (parts[i].ctype >> x) & 1; + } + for(x=0; x<14; x++) + cg += (parts[i].ctype >> (x+9)) & 1; + x = 624/(cr+cg+cb+1); + cr *= x; + cg *= x; + cb *= x; + cr = cr>255?255:cr; + cg = cg>255?255:cg; + cb = cb>255?255:cb; + blendpixel(vid, nx, ny, cr, cg, cb, trans); + }else + blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans); } else if(t==PT_BRAY && parts[i].tmp==2) { |
