diff --git a/includes/powder.h b/includes/powder.h index dc748d4df..02805c49e 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -177,7 +177,8 @@ #define PT_BRAY 127 #define PT_STKM2 128 #define PT_BOMB 129 -#define PT_NUM 130 +#define PT_C5 130 +#define PT_NUM 131 #define R_TEMP 22 #define MAX_TEMP 9999 @@ -399,8 +400,9 @@ static const part_type ptypes[PT_NUM] = {"FILT", PIXPACK(0x000056), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Filter for photons, changes the color.", TYPE_SOLID, NULL}, {"ARAY", PIXPACK(0xFFBB00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Emmitter. Rays create points when they collide", TYPE_SOLID, NULL}, {"BRAY", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 0, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Point. Rays create points when they collide", TYPE_SOLID, NULL}, - {"STK2", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!", 0, NULL}, - {"BOMB", PIXPACK(0xFFF288), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 20, 1, 30, SC_EXPLOSIVE, R_TEMP-2.0f +273.15f, 29, "Bomb.", TYPE_PART, NULL}, + {"STK2", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!", 0, NULL}, + {"BOMB", PIXPACK(0xFFF288), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 20, 1, 30, SC_EXPLOSIVE, R_TEMP-2.0f +273.15f, 29, "Bomb.", TYPE_PART, NULL}, + {"C-5", PIXPACK(0x2050E0), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_EXPLOSIVE, R_TEMP+0.0f +273.15f, 88, "Cold explosive", TYPE_SOLID | PROP_NEUTPENETRATE, NULL}, //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description }; @@ -536,8 +538,8 @@ static part_state pstates[PT_NUM] = /* ARAY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BRAY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* STKM2*/ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 620.0f}, - /* BOMB */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - + /* BOMB */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* C-5 */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; static int grule[NGOL][9] = { diff --git a/src/graphics.c b/src/graphics.c index b74646e29..c68835aac 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 e6d191e52..8a0a1be2b 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 b6e843fb6..8b762162d 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>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; } } }