summaryrefslogtreecommitdiff
path: root/src/graphics.c
diff options
context:
space:
mode:
authorPhilip <philip@philip-linuxlaptop.(none)>2010-11-17 00:47:18 (GMT)
committer Philip <philip@philip-linuxlaptop.(none)>2010-11-17 00:47:18 (GMT)
commit9383c1ca4c0b7b1232762fa7511a4179c98caa24 (patch)
tree9a9b83d1cb2746b17a47a72ac0f5936415231d3e /src/graphics.c
parent245628a7fd00422671cc931e258888ddddd7a4c5 (diff)
downloadpowder-9383c1ca4c0b7b1232762fa7511a4179c98caa24.zip
powder-9383c1ca4c0b7b1232762fa7511a4179c98caa24.tar.gz
Added a different velocity/pressure display. Added old fireworks i made.
Diffstat (limited to 'src/graphics.c')
-rw-r--r--src/graphics.c62
1 files changed, 60 insertions, 2 deletions
diff --git a/src/graphics.c b/src/graphics.c
index 9990409..797ca74 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -1113,17 +1113,50 @@ void draw_air(pixel *vid)
for(y=0; y<YRES/CELL; y++)
for(x=0; x<XRES/CELL; x++)
{
- if(cmode)
+ if(cmode == CM_PRESS)
{
if(pv[y][x] > 0.0f)
c = PIXRGB(clamp_flt(pv[y][x], 0.0f, 8.0f), 0, 0);
else
c = PIXRGB(0, 0, clamp_flt(-pv[y][x], 0.0f, 8.0f));
}
- else
+ else if(cmode == CM_VEL)
+ {
c = PIXRGB(clamp_flt(fabsf(vx[y][x]), 0.0f, 8.0f),
clamp_flt(pv[y][x], 0.0f, 8.0f),
clamp_flt(fabsf(vy[y][x]), 0.0f, 8.0f));
+ }
+ else if(cmode == CM_CRACK)
+ {
+ int r;
+ int g;
+ int b;
+ r = clamp_flt(fabsf(vx[y][x]), 0.0f, 24.0f) + clamp_flt(fabsf(vy[y][x]), 0.0f, 20.0f);
+ g = clamp_flt(fabsf(vx[y][x]), 0.0f, 20.0f) + clamp_flt(fabsf(vy[y][x]), 0.0f, 24.0f);
+ b = clamp_flt(fabsf(vx[y][x]), 0.0f, 24.0f) + clamp_flt(fabsf(vy[y][x]), 0.0f, 20.0f);
+ if(pv[y][x] > 0.0f)
+ {
+ r += clamp_flt(pv[y][x], 0.0f, 16.0f);
+ if(r>255)
+ r=255;
+ if(g>255)
+ g=255;
+ if(b>255)
+ b=255;
+ c = PIXRGB(r, g, b);
+ }
+ else
+ {
+ b += clamp_flt(-pv[y][x], 0.0f, 16.0f);
+ if(r>255)
+ r=255;
+ if(g>255)
+ g=255;
+ if(b>255)
+ b=255;
+ c = PIXRGB(r, g, b);
+ }
+ }
for(j=0; j<CELL; j++)
for(i=0; i<CELL; i++)
vid[(x*CELL+i) + (y*CELL+j)*(XRES+BARSIZE)] = c;
@@ -1428,6 +1461,31 @@ void draw_parts(pixel *vid)
}
}
+ else if(t==PT_DUST && parts[i].life >= 1)
+ {
+ x = nx;
+ y = ny;
+ if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
+ {
+ vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(parts[i].tmp,parts[i].ctype,parts[i].flags);
+ cg = parts[i].tmp/4;
+ cb = parts[i].ctype/4;
+ cr = parts[i].flags/4;
+ x = nx/CELL;
+ y = ny/CELL;
+ cg += fire_g[y][x];
+ if(cg > 255) cg = 255;
+ fire_g[y][x] = cg;
+ cb += fire_b[y][x];
+ if(cb > 255) cb = 255;
+ fire_b[y][x] = cb;
+ cr += fire_r[y][x];
+ if(cr > 255) cr = 255;
+ fire_r[y][x] = cr;
+ }
+ else
+ blendpixel(vid,x,y,parts[i].tmp,parts[i].ctype,parts[i].flags,255);
+ }
else if(t==PT_ACID)
{
if(parts[i].life>255) parts[i].life = 255;