From fff7ecedf811e487efdb0a65012a3502915d3cb2 Mon Sep 17 00:00:00 2001 From: Cracker64 Date: Mon, 6 Dec 2010 18:54:09 -0500 Subject: [PATCH] removed battery from INST wire, some other small fixes --- includes/powder.h | 24 +++++-------- src/graphics.c | 2 +- src/main.c | 8 ++--- src/powder.c | 85 ++++++++++++----------------------------------- 4 files changed, 35 insertions(+), 84 deletions(-) diff --git a/includes/powder.h b/includes/powder.h index 1e987c99e..e0112a46c 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -164,17 +164,15 @@ #define PT_VINE 114 #define PT_INVIS 115 #define PT_EQUALVEL 116//all particles equal their velocities -#define PT_INST2 117 -#define PT_INST3 118 -#define PT_SHLD1 119 -#define PT_SHLD2 120 -#define PT_SHLD3 121 -#define PT_SHLD4 122 -#define PT_LOLZ 123 -#define PT_WIFI 124 -#define PT_FILT 125 -#define PT_XEON 126//radioactive gas -#define PT_NUM 127 +#define PT_SHLD1 117 +#define PT_SHLD2 118 +#define PT_SHLD3 119 +#define PT_SHLD4 120 +#define PT_LOLZ 121 +#define PT_WIFI 122 +#define PT_FILT 123 +#define PT_XEON 124//radioactive gas +#define PT_NUM 125 #define R_TEMP 22 #define MAX_TEMP 9999 @@ -382,8 +380,6 @@ static const part_type ptypes[PT_NUM] = {"VINE", PIXPACK(0x079A00), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 20, 0, 0, 10, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 65, "Vine, grows", TYPE_SOLID}, {"INVS", PIXPACK(0x00CCCC), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 15, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 164, "Invisible to everything while under pressure.", TYPE_SOLID}, {"EQVE", PIXPACK(0xFFE0A0), 0.7f, 0.02f * CFDS, 0.96f, 0.80f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 30, 1, 85, SC_CRACKER, R_TEMP+0.0f +273.15f, 70, "Shared velocity test", TYPE_PART}, - {"INST", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "helper for INST", 0}, - {"INST", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_SPECIAL, R_TEMP+0.0f +273.15f, 251, "helper for INST", 0}, {"SHLD", PIXPACK(0xAAAAAA), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 0, "Shield, spark it to grow", 0}, {"SHD2", PIXPACK(0x777777), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_CRACKER, R_TEMP+0.0f +273.15f, 0, "Shield lvl 2", 0}, {"SHD3", PIXPACK(0x444444), 0.0f, 0.00f * CFDS, 1.00f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 1, 0, 100, SC_CRACKER, R_TEMP+0.0f +273.15f, 0, "Shield lvl 3", 0}, @@ -516,8 +512,6 @@ static part_state pstates[PT_NUM] = /* VINE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 573.0f}, /* INVS */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* EQVE */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* INST2*/ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, - /* INST3*/ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SHLD1*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SHLD2*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* SHLD3*/ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, diff --git a/src/graphics.c b/src/graphics.c index bba3890d3..dffcc7c71 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1409,7 +1409,7 @@ void draw_parts(pixel *vid) cb = PIXB(ptypes[t].pcolors); blendpixel(vid, nx, ny, cr, cg, cb, 255); } - else if(cmode==CM_GRAD) + else if(cmode==CM_GRAD)//forgot to put else, broke nothing view { float frequency = 0.05; int q = parts[i].temp; diff --git a/src/main.c b/src/main.c index d191fad3a..94dc55c29 100644 --- a/src/main.c +++ b/src/main.c @@ -329,7 +329,7 @@ void *build_save(int *size, int x0, int y0, int w, int h) for(j=0; j=43) || (ty==PT_SPRK && ver>=21) || (ty==PT_LAVA && ver>=34) || (ty==PT_PIPE && ver>=43))) + if(i && (ty==PT_CLNE || (ty==PT_PCLN && ver>=43) || (ty==PT_SPRK && ver>=21) || (ty==PT_LAVA && ver>=34) || (ty==PT_PIPE && ver>=43) || (ty==PT_BCLN && ver>=43))) { if(p >= size) goto corrupt; @@ -2195,12 +2195,12 @@ int main(int argc, char *argv[]) #else sprintf(uitext, "Version %d.%d FPS:%d", SAVE_VERSION, MINOR_VERSION, FPSB); #endif + if(GRID_MODE) + sprintf(uitext, "%s [GRID: %d]", uitext, GRID_MODE); if(REPLACE_MODE) strappend(uitext, " [REPLACE MODE]"); if(sdl_mod&(KMOD_CAPS)) strappend(uitext, " [CAP LOCKS]"); - if(GRID_MODE) - sprintf(uitext, "%s [GRID: %d]", uitext, GRID_MODE); if(sdl_zoom_trig||zoom_en) { diff --git a/src/powder.c b/src/powder.c index f6cc143fd..f2d308fd7 100644 --- a/src/powder.c +++ b/src/powder.c @@ -405,25 +405,6 @@ inline int create_part(int p, int x, int y, int t) return -1; } } - if(t==PT_INST2) - if((pmap[y][x]&0xFF)==PT_INST) - { - parts[pmap[y][x]>>8].type = PT_INST2; - parts[pmap[y][x]>>8].life += 5; - pmap[y][x] = (pmap[y][x]&~0xFF) | PT_INST2; - return pmap[y][x]>>8; - } - if(t==PT_INST3) - if((pmap[y][x]&0xFF)==PT_INST||(pmap[y][x]&0xFF)==PT_INST2) - { - parts[pmap[y][x]>>8].type = PT_INST3; - if(parts[pmap[y][x]>>8].life%4==0) - parts[pmap[y][x]>>8].life -=0; - else - parts[pmap[y][x]>>8].life -= 2; - pmap[y][x] = (pmap[y][x]&~0xFF) | PT_INST3; - return pmap[y][x]>>8; - } if(t==SPC_AIR) { pv[y/CELL][x/CELL] += 0.03f; @@ -467,6 +448,7 @@ inline int create_part(int p, int x, int y, int t) (pmap[y][x]&0xFF)!=PT_BRMT && (pmap[y][x]&0xFF)!=PT_NBLE && (pmap[y][x]&0xFF)!=PT_IRON && + (pmap[y][x]&0xFF)!=PT_INST && (pmap[y][x]&0xFF)!=PT_INWR) return -1; if(parts[pmap[y][x]>>8].life!=0) @@ -1140,7 +1122,7 @@ void update_particles_i(pixel *vid, int start, int inc) if(parts[i].life && t!=PT_ACID && t!=PT_COAL && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM && t!=PT_FUSE && t!=PT_FSEP && t!=PT_BCOL && t!=PT_GOL && t!=PT_CRAC && t!=PT_DEUT) { - if(!(parts[i].life==10&&(parts[i].type==PT_LCRY||parts[i].type==PT_PCLN||parts[i].type==PT_HSWC||parts[i].type==PT_PUMP)) && !(parts[i].life%4==0 && parts[i].type==PT_INST)) + if(!(parts[i].life==10&&(parts[i].type==PT_LCRY||parts[i].type==PT_PCLN||parts[i].type==PT_HSWC||parts[i].type==PT_PUMP))) parts[i].life--; if(parts[i].life<=0 && t!=PT_METL && t!=PT_IRON && t!=PT_FIRW && t!=PT_PCLN && t!=PT_HSWC && t!=PT_PUMP && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_NTCT && t!=PT_PTCT && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY && t!=PT_INWR && t!=PT_GLOW && t!= PT_FOG && t!=PT_PIPE && t!=PT_FRZW &&(t!=PT_ICEI&&parts[i].ctype!=PT_FRZW)&&t!=PT_INST && t!=PT_SHLD1&& t!=PT_SHLD2&& t!=PT_SHLD3&& t!=PT_SHLD4) { @@ -2813,33 +2795,11 @@ void update_particles_i(pixel *vid, int start, int inc) 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) { - flood_parts(x,y,PT_INST2,PT_INST,-1);//add life + flood_parts(x,y,PT_SPRK,PT_INST,-1);//add life parts[r>>8].type==parts[r>>8].ctype; } - else if(parts[r>>8].type==PT_NSCN&&parts[r>>8].life==0&&(parts[i].life>=4)&&parts[i].life%4<=1) - { - create_part(-1,x+nx,y+ny,PT_SPRK); - flood_parts(x,y,PT_INST3,PT_INST,-1);//sub life - } - else if(parts[r>>8].type==PT_SWCH&&parts[r>>8].life==10&&(parts[i].life>=4)&&parts[i].life%4<=1) - { - parts[r>>8].type=PT_SPRK; - parts[r>>8].ctype=PT_SWCH; - parts[r>>8].life=4; - flood_parts(x,y,PT_INST3,PT_INST,-1);//sub life - } } } - else if(t==PT_INST2) - { - if(parts[i].life%4<=1) - t = parts[pmap[y][x]>>8].type=PT_INST; - } - else if(t==PT_INST3) - { - if(parts[i].life%4<=1) - t = parts[pmap[y][x]>>8].type=PT_INST; - } else if(t==PT_PRTI) { int count =0; @@ -3941,6 +3901,8 @@ killed: x+nx> 8; if(!parts[lt].ctype) parts[lt].ctype = PT_PHOT; @@ -4857,8 +4820,8 @@ int flood_parts(int x, int y, int c, int cm, int bm) { int x1, x2, dy = (c=UI_WALLSTART&&c<=UI_WALLSTART+UI_WALLCOUNT) { @@ -4900,9 +4863,6 @@ int flood_parts(int x, int y, int c, int cm, int bm) { if((pmap[y][x1-1]&0xFF)!=cm || bmap[y/CELL][(x1-1)/CELL]!=bm) { - if(cm!=PT_INST) - break; - else if((pmap[y][x1-1]&0xFF)!=PT_INST2&&(pmap[y][x1-1]&0xFF)!=PT_INST3) break; } x1--; @@ -4911,9 +4871,6 @@ int flood_parts(int x, int y, int c, int cm, int bm) { if((pmap[y][x2+1]&0xFF)!=cm || bmap[y/CELL][(x2+1)/CELL]!=bm) { - if(cm!=PT_INST) - break; - else if((pmap[y][x1+1]&0xFF)!=PT_INST2&&(pmap[y][x1+1]&0xFF)!=PT_INST3) break; } x2++; @@ -4926,36 +4883,36 @@ int flood_parts(int x, int y, int c, int cm, int bm) return 0; } // fill children - if(cm==PT_INST&&(co==PT_INST2||co==PT_INST3))//crossings for inst wire, same as walls + if(cm==PT_INST&&co==PT_SPRK)//wire crossing for INST { if(y>=CELL+dy && x1==x2 && - ((pmap[y-1][x1-1]&0xFF)==PT_INST||((pmap[y-1][x1-1]&0xFF)==PT_INST3||(pmap[y-1][x1-1]&0xFF)==PT_INST2)) && ((pmap[y-1][x1]&0xFF)==PT_INST||((pmap[y-1][x1]&0xFF)==PT_INST3||(pmap[y-1][x1]&0xFF)==PT_INST2)) && ((pmap[y-1][x1+1]&0xFF)==PT_INST || ((pmap[y-1][x1+1]&0xFF)==PT_INST3||(pmap[y-1][x1+1]&0xFF)==PT_INST2)) && - (pmap[y-2][x1-1]&0xFF)!=PT_INST && ((pmap[y-2][x1]&0xFF)==PT_INST ||((pmap[y-2][x1]&0xFF)==PT_INST3||(pmap[y-2][x1]&0xFF)==PT_INST2)) && (pmap[y-2][x1+1]&0xFF)!=PT_INST) + ((pmap[y-1][x1-1]&0xFF)==PT_INST||(pmap[y-1][x1-1]&0xFF)==PT_SPRK) && ((pmap[y-1][x1]&0xFF)==PT_INST||(pmap[y-1][x1]&0xFF)==PT_SPRK) && ((pmap[y-1][x1+1]&0xFF)==PT_INST || (pmap[y-1][x1+1]&0xFF)==PT_SPRK) && + (pmap[y-2][x1-1]&0xFF)!=PT_INST && ((pmap[y-2][x1]&0xFF)==PT_INST ||(pmap[y-2][x1]&0xFF)==PT_SPRK) && (pmap[y-2][x1+1]&0xFF)!=PT_INST) flood_parts(x1, y-2, co, cm, bm); else if(y>=CELL+dy) for(x=x1; x<=x2; x++) - if((pmap[y-1][x]&0xFF)!=co) + if((pmap[y-1][x]&0xFF)!=PT_SPRK) { if(x==x1 || x==x2 || y>=YRES-CELL-1 || (pmap[y-1][x-1]&0xFF)==PT_INST || (pmap[y-1][x+1]&0xFF)==PT_INST || - (pmap[y+1][x-1]&0xFF)==PT_INST || ((pmap[y+1][x]&0xFF)!=PT_INST&&(pmap[y+1][x]&0xFF)!=co) || (pmap[y+1][x+1]&0xFF)==PT_INST) + (pmap[y+1][x-1]&0xFF)==PT_INST || ((pmap[y+1][x]&0xFF)!=PT_INST&&(pmap[y+1][x]&0xFF)!=PT_SPRK) || (pmap[y+1][x+1]&0xFF)==PT_INST) flood_parts(x, y-dy, co, cm, bm); - + } if(y