diff options
| author | Cracker64 <cracker642@gmail.com> | 2010-12-05 04:29:41 (GMT) |
|---|---|---|
| committer | Cracker64 <cracker642@gmail.com> | 2010-12-05 04:29:41 (GMT) |
| commit | 2cf25c8a6aad84b2f86060e791948a0aed307192 (patch) | |
| tree | 223a496850225a5acfd8c66c7cf47dad8aaf950c /src/graphics.c | |
| parent | d56684312dd9429da8be8666206ad1656d3185a9 (diff) | |
| download | powder-2cf25c8a6aad84b2f86060e791948a0aed307192.zip powder-2cf25c8a6aad84b2f86060e791948a0aed307192.tar.gz | |
FILT, a photon color filter, not really a filter right now, but it changes the color. Other small changes
Diffstat (limited to 'src/graphics.c')
| -rw-r--r-- | src/graphics.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/graphics.c b/src/graphics.c index 1af3f9b..5476bf7 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1765,6 +1765,30 @@ void draw_parts(pixel *vid) } } } + else if(t==PT_FILT) + { + int temp_bin = (int)((parts[i].temp-273.0f)*0.025f); + if(temp_bin < 0) temp_bin = 0; + if(temp_bin > 25) temp_bin = 25; + parts[i].ctype = 0x1F << temp_bin; + 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, 127); + } else if(t==PT_PHOT) { if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY) |
