summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon <simon@hardwired.org.uk>2010-12-27 23:21:26 (GMT)
committer Simon <simon@hardwired.org.uk>2010-12-27 23:21:26 (GMT)
commit713034ed619378aa0abc6b38b69604e1aba8821c (patch)
tree8ee79915fd21a9eed3c3776b3fbfaa93a41fb21c /src
parent16f7cdaef61dd7ff57a20e96984db91f04ec30b2 (diff)
parent761ea03882fd779cc77ac7cb49ff59bbfe94b51e (diff)
downloadpowder-713034ed619378aa0abc6b38b69604e1aba8821c.zip
powder-713034ed619378aa0abc6b38b69604e1aba8821c.tar.gz
Cracker Merge
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c76
-rw-r--r--src/main.c2
-rw-r--r--src/powder.c53
3 files changed, 67 insertions, 64 deletions
diff --git a/src/graphics.c b/src/graphics.c
index b74646e..c68835a 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -1459,49 +1459,24 @@ void draw_parts(pixel *vid)
}
else if(cmode==CM_GRAD)//forgot to put else, broke nothing view
{
- if((t==PT_METL||t==PT_BRMT||t==PT_BMTL)&&parts[i].temp>473&&parts[i].temp<1370)
- {
- float frequency = 0.00146;
- int q = parts[i].temp-473;
- cr = sin(frequency*q) * 226 + PIXR(ptypes[t].pcolors);
- cg = sin(frequency*q*4.55 +3.14) * 34 + PIXG(ptypes[t].pcolors);
- cb = sin(frequency*q*2.22 +3.14) * 64 + PIXB(ptypes[t].pcolors);
- if(cr>=255)
- cr = 255;
- if(cg>=255)
- cg = 255;
- if(cb>=255)
- cb = 255;
- if(cr<=0)
- cr = 0;
- if(cg<=0)
- cg = 0;
- if(cb<=0)
- cb = 0;
- blendpixel(vid, nx, ny, cr, cg, cb, 255);
- }
- else
- {
- float frequency = 0.05;
- int q = parts[i].temp-40;
- cr = sin(frequency*q) * 16 + PIXR(ptypes[t].pcolors);
- cg = sin(frequency*q) * 16 + PIXG(ptypes[t].pcolors);
- cb = sin(frequency*q) * 16 + PIXB(ptypes[t].pcolors);
- if(cr>=255)
- cr = 255;
- if(cg>=255)
- cg = 255;
- if(cb>=255)
- cb = 255;
- if(cr<=0)
- cr = 0;
- if(cg<=0)
- cg = 0;
- if(cb<=0)
- cb = 0;
- blendpixel(vid, nx, ny, cr, cg, cb, 255);
- }
-
+ float frequency = 0.05;
+ int q = parts[i].temp-40;
+ cr = sin(frequency*q) * 16 + PIXR(ptypes[t].pcolors);
+ cg = sin(frequency*q) * 16 + PIXG(ptypes[t].pcolors);
+ cb = sin(frequency*q) * 16 + PIXB(ptypes[t].pcolors);
+ if(cr>=255)
+ cr = 255;
+ if(cg>=255)
+ cg = 255;
+ if(cb>=255)
+ cb = 255;
+ if(cr<=0)
+ cr = 0;
+ if(cg<=0)
+ cg = 0;
+ if(cb<=0)
+ cb = 0;
+ blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
else if(t==PT_MWAX&&cmode == CM_FANCY)
{
@@ -2425,12 +2400,13 @@ void draw_parts(pixel *vid)
blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32);
}
}
- else if(t==PT_BOMB){
+ else if(t==PT_BOMB)
+ {
if(parts[i].tmp==0){
cr = PIXR(ptypes[t].pcolors);
cg = PIXG(ptypes[t].pcolors);
cb = PIXB(ptypes[t].pcolors);
- if(cmode != CM_NOTHING && cmode != CM_CRACK){
+ if(cmode != CM_CRACK){
int newx = 0;
float gradv = 100;
blendpixel(vid, nx+1, ny, cr, cg, cb, 223);
@@ -2450,13 +2426,15 @@ void draw_parts(pixel *vid)
addpixel(vid, nx, ny-newx, cr, cg, cb, gradv);
gradv = gradv/1.1f;
}
+ } else {
+ blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
}
else if(parts[i].tmp==1){
cr = PIXR(ptypes[t].pcolors);
cg = PIXG(ptypes[t].pcolors);
cb = PIXB(ptypes[t].pcolors);
- if(cmode != CM_NOTHING && cmode != CM_CRACK){
+ if(cmode != CM_CRACK){
int newx = 0;
float gradv = 4*parts[i].life;
for(newx = 0; gradv>0.5; newx++){
@@ -2467,6 +2445,8 @@ void draw_parts(pixel *vid)
addpixel(vid, nx, ny-newx, cr, cg, cb, gradv);
gradv = gradv/1.5f;
}
+ } else {
+ blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
}
else {
@@ -2476,8 +2456,8 @@ void draw_parts(pixel *vid)
}
else if(ptypes[t].properties&PROP_HOT_GLOW && parts[i].temp>473.0f)
{
- float frequency = 0.00146;
- int q = (parts[i].temp>1370)?1370-473:parts[i].temp-473;
+ float frequency = 3.1415/(2*pstates[t].ltemp-473.0);
+ int q = (parts[i].temp>pstates[t].ltemp)?pstates[t].ltemp-473:parts[i].temp-473;
cr = sin(frequency*q) * 226 + PIXR(ptypes[t].pcolors);
cg = sin(frequency*q*4.55 +3.14) * 34 + PIXG(ptypes[t].pcolors);
cb = sin(frequency*q*2.22 +3.14) * 64 + PIXB(ptypes[t].pcolors);
diff --git a/src/main.c b/src/main.c
index e6d191e..8a0a1be 100644
--- a/src/main.c
+++ b/src/main.c
@@ -729,7 +729,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
if(new_format) {
ttv = (d[p++])<<8;
ttv |= (d[p++]);
- parts[i-1].temp = ttv;
+ parts[i-1].temp = ttv + 0.15;
} else {
parts[i-1].temp = (d[p++]*((MAX_TEMP+(-MIN_TEMP))/255))+MIN_TEMP;
}
diff --git a/src/powder.c b/src/powder.c
index b6e843f..8b76216 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -2792,8 +2792,30 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
}
- else if(t==PT_BOMB)
+ else if(t==PT_C5)
+ {
+ for(nx=-2; nx<3; nx++)
+ for(ny=-2; ny<3; ny++)
+ if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
+ {
+ r = pmap[y+ny][x+nx];
+ if((r>>8)>=NPART || !r)
+ continue;
+ if((parts[r>>8].temp<100 && parts[r>>8].type!=PT_C5)||parts[r>>8].type==PT_HFLM)
+ {
+ if(1>rand()%6)
+ {
+ t = parts[i].type = PT_HFLM;
+ parts[r>>8].temp = parts[i].temp = 0;
+ parts[i].life = rand()%150+50;
+ pv[y/CELL][x/CELL] += 1.5;
+ }
+ }
+ }
+ }
+ else if(t==PT_BOMB)
{
+ int nb;
if(parts[i].tmp==1){
for(nx=-2; nx<3; nx++)
for(ny=-2; ny<3; ny++)
@@ -2815,7 +2837,7 @@ void update_particles_i(pixel *vid, int start, int inc)
r = pmap[y+ny][x+nx];
if((r>>8)>=NPART || !r)
continue;
- if(parts[r>>8].type!=PT_NONE && parts[r>>8].type!=PT_BOMB){
+ if(parts[r>>8].type!=PT_NONE && parts[r>>8].type!=PT_BOMB && parts[r>>8].type!=PT_DMND && parts[r>>8].type!=PT_CLNE && parts[r>>8].type!=PT_PCLN && parts[r>>8].type!=PT_BCLN){
int rad = 8;
int nxi;
int nxj;
@@ -2823,7 +2845,7 @@ void update_particles_i(pixel *vid, int start, int inc)
for(nxj=-(rad+1); nxj<=(rad+1); nxj++)
for(nxi=-(rad+1); nxi<=(rad+1); nxi++)
if((pow(nxi,2))/(pow((rad+1),2))+(pow(nxj,2))/(pow((rad+1),2))<=1){
- int nb = create_part(-1, x+nxi, y+nxj, PT_BOMB);
+ nb = create_part(-1, x+nxi, y+nxj, PT_BOMB);
if(nb!=-1){
parts[nb].tmp = 1;
parts[nb].life = 50;
@@ -2834,16 +2856,17 @@ void update_particles_i(pixel *vid, int start, int inc)
}
for(nxj=-rad; nxj<=rad; nxj++)
for(nxi=-rad; nxi<=rad; nxi++)
- if((pow(nxi,2))/(pow(rad,2))+(pow(nxj,2))/(pow(rad,2))<=1){
- delete_part(x+nxi, y+nxj);
- pv[(y+nxj)/CELL][(x+nxi)/CELL] += 0.1f;
- int nb = create_part(-1, x+nxi, y+nxj, PT_BOMB);
- if(nb!=-1){
- parts[nb].tmp = 2;
- parts[nb].life = 2;
- parts[nb].temp = MAX_TEMP;
+ if((pow(nxi,2))/(pow(rad,2))+(pow(nxj,2))/(pow(rad,2))<=1)
+ if((pmap[y+nxj][x+nxi]&0xFF)!=PT_DMND && (pmap[y+nxj][x+nxi]&0xFF)!=PT_CLNE && (pmap[y+nxj][x+nxi]&0xFF)!=PT_PCLN && (pmap[y+nxj][x+nxi]&0xFF)!=PT_BCLN){
+ delete_part(x+nxi, y+nxj);
+ pv[(y+nxj)/CELL][(x+nxi)/CELL] += 0.1f;
+ nb = create_part(-1, x+nxi, y+nxj, PT_BOMB);
+ if(nb!=-1){
+ parts[nb].tmp = 2;
+ parts[nb].life = 2;
+ parts[nb].temp = MAX_TEMP;
+ }
}
- }
//create_parts(x, y, 9, 9, PT_BOMB);
//create_parts(x, y, 8, 8, PT_NONE);
parts[i].type = PT_NONE;
@@ -3118,10 +3141,10 @@ void update_particles_i(pixel *vid, int start, int inc)
r = pmap[y+ny][x+nx];
if((r>>8)>=NPART || !r)
continue;
- else if(parts[r>>8].type==PT_SPRK&&(parts[r>>8].ctype==PT_PSCN)&&(parts[r>>8].life>=3)&&parts[i].life%4==0&&parts_avg(i,r>>8,PT_INSL)!=PT_INSL)
+ else if(parts[r>>8].type==PT_SPRK&&(parts[r>>8].ctype==PT_PSCN)&&(parts[r>>8].life>=3)&&parts[i].life==0&&parts_avg(i,r>>8,PT_INSL)!=PT_INSL)
{
- flood_parts(x,y,PT_SPRK,PT_INST,-1);//add life
- parts[r>>8].type==parts[r>>8].ctype;
+ flood_parts(x,y,PT_SPRK,PT_INST,-1);//spark the wire
+ //parts[r>>8].type=parts[r>>8].ctype;
}
}
}