summaryrefslogtreecommitdiff
path: root/src
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
parent245628a7fd00422671cc931e258888ddddd7a4c5 (diff)
downloadpowder-9383c1ca4c0b7b1232762fa7511a4179c98caa24.zip
powder-9383c1ca4c0b7b1232762fa7511a4179c98caa24.tar.gz
Added a different velocity/pressure display. Added old fireworks i made.
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c62
-rw-r--r--src/interface.c6
-rw-r--r--src/main.c8
-rw-r--r--src/powder.c57
4 files changed, 128 insertions, 5 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;
diff --git a/src/interface.c b/src/interface.c
index 8f0a559..e22a9c4 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -552,6 +552,8 @@ void draw_svf_ui(pixel *vid_buf)
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\xC4", 100, 150, 255, 255);
case CM_NOTHING:
drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x00", 100, 150, 255, 255);
+ case CM_CRACK:
+ drawtext(vid_buf, XRES-29+BARSIZE/*481*/, YRES+(MENUSIZE-13), "\x00", 100, 150, 255, 255);
break;
}
drawrect(vid_buf, XRES-32+BARSIZE/*478*/, YRES+(MENUSIZE-16), 14, 14, 255, 255, 255, 255);
@@ -1774,7 +1776,9 @@ void set_cmode(int cm)
else if(cmode==CM_PRESS)
strcpy(itc_msg, "Pressure Display");
else if(cmode==CM_NOTHING)
- strcpy(itc_msg, "Cracker Display");
+ strcpy(itc_msg, "Nothing Display");
+ else if(cmode==CM_CRACK)
+ strcpy(itc_msg, "Alternate Velocity Display");
else
strcpy(itc_msg, "Velocity Display");
}
diff --git a/src/main.c b/src/main.c
index 4aff502..506e976 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1125,7 +1125,7 @@ int main(int argc, char *argv[])
#ifdef OpenGL
ClearScreen();
#else
- if(cmode==CM_VEL || cmode==CM_PRESS)
+ if(cmode==CM_VEL || cmode==CM_PRESS || cmode==CM_CRACK)
{
draw_air(vid_buf);
}
@@ -1268,10 +1268,14 @@ int main(int argc, char *argv[])
{
set_cmode(CM_FANCY);
}
- if(sdl_key=='8')
+ if(sdl_key=='8')
{
set_cmode(CM_NOTHING);
}
+ if(sdl_key=='9')
+ {
+ set_cmode(CM_CRACK);
+ }
if(sdl_key==SDLK_LEFTBRACKET) {
if(sdl_zoom_trig==1)
{
diff --git a/src/powder.c b/src/powder.c
index fb564d3..7cdba8c 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -1940,6 +1940,10 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[r>>8].type = PT_GAS;
if((r&0xFF)==PT_COAL && 5>(rand()%100))
parts[r>>8].type = PT_WOOD;
+ if((r&0xFF)==PT_DUST && 5>(rand()%100))
+ parts[r>>8].type = PT_FWRK;
+ if((r&0xFF)==PT_FWRK && 5>(rand()%100))
+ parts[r>>8].ctype = PT_DUST;
/*if(parts[r>>8].type>1 && parts[r>>8].type!=PT_NEUT && parts[r>>8].type-1!=PT_NEUT && parts[r>>8].type-1!=PT_STKM &&
(ptypes[parts[r>>8].type-1].menusection==SC_LIQUID||
ptypes[parts[r>>8].type-1].menusection==SC_EXPLOSIVE||
@@ -2213,6 +2217,59 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
}
+ if(t==PT_FWRK)
+ {
+ if((parts[i].temp>400&&(9+parts[i].temp/40)>rand()%100000&&parts[i].life==0&&!pmap[y-1][x])||parts[i].ctype==PT_DUST)
+ {
+
+ create_part(-1, x , y-1 , PT_FWRK);
+ r = pmap[y-1][x];
+ if(parts[r>>8].type==PT_FWRK)
+ {
+ parts[r>>8].vy = rand()%8-22;
+ parts[r>>8].vx = rand()%20-rand()%20;
+ parts[r>>8].life=rand()%15+25;
+ parts[i].type=PT_NONE;
+ }
+ }
+ if(parts[i].life>1)
+ {
+ if(parts[i].life>=45&&parts[i].type==PT_FWRK)
+ parts[i].life=0;
+ }
+ if((parts[i].life<3&&parts[i].life>0)||parts[i].vy>6&&parts[i].life>0)
+ {
+ int q = (rand()%255+1);
+ int w = (rand()%255+1);
+ int e = (rand()%255+1);
+ for(nx=-1; nx<2; nx++)
+ for(ny=-2; ny<3; ny++)
+ if(x+nx>=0 && y+ny>0 &&
+ x+nx<XRES && y+ny<YRES)
+ {
+ if(5>=rand()%8)
+ {
+ if(!pmap[y+ny][x+nx])
+ {
+ create_part(-1, x+nx, y+ny , PT_DUST);
+ pv[y/CELL][x/CELL] += 2.00f*CFDS;
+ a= pmap[y+ny][x+nx];
+ if(parts[a>>8].type==PT_DUST)
+ {
+ parts[a>>8].vy = -(rand()%10-1);
+ parts[a>>8].vx = ((rand()%2)*2-1)*rand()%(5+5)+(parts[i].vx)*2 ;
+ parts[a>>8].life= rand()%37+18;
+ parts[a>>8].tmp=q;
+ parts[a>>8].flags=w;
+ parts[a>>8].ctype=e;
+ parts[a>>8].temp= rand()%20+6000;
+ }
+ }
+ }
+ }
+ parts[i].type=PT_NONE;
+ }
+ }
else if(t==PT_LCRY)
{
for(nx=-1; nx<2; nx++)