summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil <cracker642@gmail.com>2010-09-08 04:39:22 (GMT)
committer Phil <cracker642@gmail.com>2010-09-08 04:39:22 (GMT)
commitd28edfa6a9932b479efa36cdb9448354081c09ab (patch)
treefc35bd882c8da8d1fe6eb1ecb98e8efe5ae3b17b
parenteb7206aa304ac46ee08d4d2466b48ffe217f7bcb (diff)
downloadpowder-d28edfa6a9932b479efa36cdb9448354081c09ab.zip
powder-d28edfa6a9932b479efa36cdb9448354081c09ab.tar.gz
Fireworks glow in fancy display, fixed some crash errors they could cause.
-rw-r--r--graphics.c42
-rw-r--r--powder.c21
-rw-r--r--powder.h2
3 files changed, 54 insertions, 11 deletions
diff --git a/graphics.c b/graphics.c
index c8eb964..1e5fd5d 100644
--- a/graphics.c
+++ b/graphics.c
@@ -1403,11 +1403,51 @@ void draw_parts(pixel *vid)
y = ny;
blendpixel(vid,x,y,17,217,24,255);
}
+ else if((t==PT_FWRK && parts[i].life >= 1)&&(cmode == 3||cmode==4 || cmode==6))
+ {
+ x = nx;
+ y = ny;
+ vid[ny*(XRES+BARSIZE)+nx] = ptypes[t].pcolors;
+ cg = 10;
+ cb = 10;
+ cr = 10;
+ 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 if(t==PT_DUST && parts[i].life >= 1)
{
x = nx;
y = ny;
- blendpixel(vid,x,y,parts[i].tmp,parts[i].ctype,parts[i].flags,255);
+ if(cmode == 3||cmode==4 || cmode==6)
+ {
+ vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(parts[i].tmp,parts[i].ctype,parts[i].flags);
+ cg = parts[i].tmp/5;
+ cb = parts[i].ctype/5;
+ cr = parts[i].flags/5;
+ 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_LNTG&&cmode == 6)
{
diff --git a/powder.c b/powder.c
index 7e25ce0..e7bc8f8 100644
--- a/powder.c
+++ b/powder.c
@@ -1911,8 +1911,8 @@ player[23] = 1;
create_part(-1, x , y-1 , PT_FWRK);
r = pmap[y-1][x];
- parts[r>>8].vy = rand()%10-25;
- parts[r>>8].vx = rand()%30-rand()%30;
+ parts[r>>8].vy = rand()%8-22;
+ parts[r>>8].vx = rand()%20-rand()%20;
parts[r>>8].life=rand()%30+50;
parts[i].type=PT_NONE;
}
@@ -1936,13 +1936,16 @@ player[23] = 1;
{
create_part(-1, x+nx, y+ny , PT_DUST);
a= pmap[y+ny][x+nx];
- parts[a>>8].vy = -(rand()%8+1);
- parts[a>>8].vx = rand()%8-rand()%8+(parts[i].vx)*2;
- parts[a>>8].life= rand()%75+175;
- parts[a>>8].tmp=q;
- parts[a>>8].flags=w;
- parts[a>>8].ctype=e;
- parts[a>>8].temp= rand()%20+600;
+ 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()%75+35;
+ parts[a>>8].tmp=q;
+ parts[a>>8].flags=w;
+ parts[a>>8].ctype=e;
+ parts[a>>8].temp= rand()%20+600;
+ }
}
}
diff --git a/powder.h b/powder.h
index dab31e0..27d72ca 100644
--- a/powder.h
+++ b/powder.h
@@ -253,7 +253,7 @@ static const part_type ptypes[PT_NUM] =
{"THRM", PIXPACK(0xA08090), 0.4f, 0.04f * CFDS, 0.94f, 0.95f, -0.1f, 0.3f, 0.00f, 0.000f * CFDS, 1, 0, 0, 2, 2, 1, SC_POWDERS, R_TEMP+0.0f +273.15f, 211, "Thermite."},
{"GLOW", PIXPACK(0x445544), 0.3f, 0.02f * CFDS, 0.95f, 0.80f, 0.0f, 0.15f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 2, 1, SC_LIQUID, R_TEMP+20.0f+273.15f, 44, "Glow."},
{"BRCK", PIXPACK(0x808080), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Brick, breakable building material."},
- {"FWRK", PIXPACK(0x666666), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_POWDERS, R_TEMP+0.0f+273.15f, 100, "Fireworks!! in progress"},
+ {"FWRK", PIXPACK(0x666666), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, SC_EXPLOSIVE, R_TEMP+0.0f+273.15f, 100, "Fireworks!! Glows in fancy"},
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Section H Ins(real world, by triclops200) Description
};