summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2010-12-08 17:14:02 (GMT)
committer Cracker64 <cracker642@gmail.com>2010-12-08 17:14:02 (GMT)
commitcbf41389a2ac611c4829e08ede525ee4076d92d7 (patch)
treee7e7487fec95953e46ebde3e8c77931f076e61df /src
parentfff7ecedf811e487efdb0a65012a3502915d3cb2 (diff)
downloadpowder-cbf41389a2ac611c4829e08ede525ee4076d92d7.zip
powder-cbf41389a2ac611c4829e08ede525ee4076d92d7.tar.gz
Bugfix for wifi, would cause a double spark if timed just right. updated to
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c83
-rw-r--r--src/interface.c23
-rw-r--r--src/main.c90
-rw-r--r--src/powder.c156
4 files changed, 279 insertions, 73 deletions
diff --git a/src/graphics.c b/src/graphics.c
index dffcc7c..9b89f79 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -1402,12 +1402,35 @@ void draw_parts(pixel *vid)
isplayer = 1; //It's a secret. Tssss...
}
- if(cmode==CM_NOTHING && t!=PT_PIPE && t!=PT_SWCH && t!=PT_LCRY && t!=PT_PUMP)//nothing display but show needed color changes
+ if(cmode==CM_NOTHING && t!=PT_PIPE && t!=PT_SWCH && t!=PT_LCRY && t!=PT_PUMP && t!=PT_FILT)//nothing display but show needed color changes
{
+ if(t==PT_PHOT)
+ {
+ cg = 0;
+ cb = 0;
+ cr = 0;
+ for(x=0; x<12; x++) {
+ cr += (parts[i].ctype >> (x+18)) & 1;
+ cb += (parts[i].ctype >> x) & 1;
+ }
+ for(x=0; x<14; x++)
+ cg += (parts[i].ctype >> (x+9)) & 1;
+ x = 624/(cr+cg+cb+1);
+ cr *= x;
+ cg *= x;
+ cb *= x;
+ cr = cr>255?255:cr;
+ cg = cg>255?255:cg;
+ cb = cb>255?255:cb;
+ blendpixel(vid, nx, ny, cr, cg, cb, 255);
+ }
+ else
+ {
cr = PIXR(ptypes[t].pcolors);
cg = PIXG(ptypes[t].pcolors);
cb = PIXB(ptypes[t].pcolors);
blendpixel(vid, nx, ny, cr, cg, cb, 255);
+ }
}
else if(cmode==CM_GRAD)//forgot to put else, broke nothing view
{
@@ -1789,6 +1812,21 @@ void draw_parts(pixel *vid)
cb = cb>255?255:cb;
blendpixel(vid, nx, ny, cr, cg, cb, 127);
}
+ else if(t==PT_BRAY && parts[i].tmp==0)
+ {
+ int trans = parts[i].life * 7;
+ blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans);
+ }
+ else if(t==PT_BRAY && parts[i].tmp==1)
+ {
+ int trans = parts[i].life/4;
+ blendpixel(vid, nx, ny, PIXR(ptypes[t].pcolors), PIXG(ptypes[t].pcolors), PIXB(ptypes[t].pcolors), trans);
+ }
+ else if(t==PT_BRAY && parts[i].tmp==2)
+ {
+ int trans = parts[i].life*100;
+ blendpixel(vid, nx, ny, 255, 150, 50, trans);
+ }
else if(t==PT_PHOT)
{
if(cmode == CM_FIRE||cmode==CM_BLOB || cmode==CM_FANCY)
@@ -2805,6 +2843,47 @@ pixel *prerender_save(void *save, int size, int *width, int *height)
else
fb[(ry+j)*w+(rx+i)] = PIXPACK(0x808080);
break;
+ case WL_WALL:
+ for(j=0; j<CELL; j++)
+ for(i=0; i<CELL; i++)
+ fb[(ry+j)*w+(rx+i)] = PIXPACK(0x808080);
+ break;
+ case WL_DESTROYALL:
+ for(j=0; j<CELL; j+=2)
+ for(i=(j>>1)&1; i<CELL; i+=2)
+ fb[(ry+j)*w+(rx+i)] = PIXPACK(0x808080);
+ break;
+ case WL_ALLOWLIQUID:
+ for(j=0; j<CELL; j++)
+ for(i=0; i<CELL; i++)
+ if(!(j%2) && !(i%2))
+ fb[(ry+j)*w+(rx+i)] = PIXPACK(0xC0C0C0);
+ break;
+ case WL_STREAM:
+ for(j=0; j<CELL; j+=2)
+ for(i=(j>>1)&1; i<CELL; i+=2)
+ fb[(ry+j)*w+(rx+i)] = PIXPACK(0x8080FF);
+ k++;
+ break;
+ case WL_DETECT:
+ for(j=0; j<CELL; j+=2)
+ for(i=(j>>1)&1; i<CELL; i+=2)
+ fb[(ry+j)*w+(rx+i)] = PIXPACK(0xFF8080);
+ break;
+ case WL_EWALL:
+ for(j=0; j<CELL; j++)
+ for(i=0; i<CELL; i++)
+ if(!(i&j&1))
+ fb[(ry+j)*w+(rx+i)] = PIXPACK(0x808080);
+ break;
+ case WL_WALLELEC:
+ for(j=0; j<CELL; j++)
+ for(i=0; i<CELL; i++)
+ if(!(j%2) && !(i%2))
+ fb[(ry+j)*w+(rx+i)] = PIXPACK(0xC0C0C0);
+ else
+ fb[(ry+j)*w+(rx+i)] = PIXPACK(0x808080);
+ break;
}
p++;
}
@@ -2820,7 +2899,7 @@ pixel *prerender_save(void *save, int size, int *width, int *height)
j=d[p++];
if(j<PT_NUM && j>0)
{
- if(j==PT_STKM) //Stickman should be drawed another way
+ if(j==PT_STKM)
{
//Stickman drawing
for(k=-2; k<=1; k++)
diff --git a/src/interface.c b/src/interface.c
index 044b65c..af679d8 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -1500,7 +1500,7 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
{
if(n!=SPC_AIR&&n!=SPC_HEAT&&n!=SPC_COOL&&n!=SPC_VACUUM)
{
- if(x-18<=20)
+ if(x-18<=2)
{
x = XRES-BARSIZE-18;
y += 19;
@@ -1537,7 +1537,7 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
{
if(n==SPC_AIR||n==SPC_HEAT||n==SPC_COOL||n==SPC_VACUUM)
{
- if(x-18<=20)
+ if(x-18<=0)
{
x = XRES-BARSIZE-18;
y += 19;
@@ -1571,7 +1571,7 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
{
if(ptypes[n].menusection==i&&ptypes[n].menu==1)
{
- if(x-18<=20)
+ if(x-18<=0)
{
x = XRES-BARSIZE-18;
y += 19;
@@ -1608,7 +1608,7 @@ void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int b, int bq, int mx,
{
if(ptypes[n].menusection==i&&ptypes[n].menu==1)
{
- if(x-18<=20)
+ if(x-18<=0)
{
x = XRES-BARSIZE-18;
y += 19;
@@ -2190,7 +2190,7 @@ int search_ui(pixel *vid_buf)
drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 160, 160, 192, 255);
else
drawrect(vid_buf, gx-2, gy-2, XRES/GRID_S+3, YRES/GRID_S+3, 128, 128, 128, 255);
- if(own)
+ if(own && search_fav!=1)
{
if(dp == pos)
drawtext(vid_buf, gx+XRES/GRID_S-4, gy-6, "\x86", 255, 48, 32, 255);
@@ -2321,7 +2321,7 @@ int search_ui(pixel *vid_buf)
lasttime = TIMEOUT;
}
- if(b && !bq && dp!=-1)
+ if(b && !bq && dp!=-1 && search_fav!=0)
if(confirm_ui(vid_buf, "Do you want to delete?", search_names[dp], "Delete"))
{
execute_delete(vid_buf, search_ids[dp]);
@@ -2720,9 +2720,14 @@ int open_ui(pixel *vid_buf, char *save_id, char *save_date)
if(status == 200)
{
pixel *full_save = prerender_save(data, data_size, &imgw, &imgh);
- save_pic = rescale_img(full_save, imgw, imgh, &thumb_w, &thumb_h, 2);
- data_ready = 1;
- free(full_save);
+ if(full_save!=NULL){
+ save_pic = rescale_img(full_save, imgw, imgh, &thumb_w, &thumb_h, 2);
+ data_ready = 1;
+ free(full_save);
+ } else {
+ error_ui(vid_buf, 0, "Save may be from a newer version");
+ break;
+ }
}
active = 0;
free(http);
diff --git a/src/main.c b/src/main.c
index 94dc55c..ccc87a2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -233,7 +233,7 @@ void *build_thumb(int *size, int bzip2)
void *build_save(int *size, int x0, int y0, int w, int h)
{
- unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*8+MAXSIGNS*262), *c;
+ unsigned char *d=calloc(1,3*(XRES/CELL)*(YRES/CELL)+(XRES*YRES)*11+MAXSIGNS*262), *c;
int i,j,x,y,p=0,*m=calloc(XRES*YRES, sizeof(int));
int bx0=x0/CELL, by0=y0/CELL, bw=(w+CELL-1)/CELL, bh=(h+CELL-1)/CELL;
@@ -249,7 +249,7 @@ void *build_save(int *size, int x0, int y0, int w, int h)
d[p++] = bmap[y][x];
for(y=by0; y<by0+bh; y++)
for(x=bx0; x<bx0+bw; x++)
- if(bmap[y][x]==WL_FAN)
+ if(bmap[y][x]==WL_FAN||bmap[y][x]==4)
{
i = (int)(fvx[y][x]*64.0f+127.5f);
if(i<0) i=0;
@@ -258,7 +258,7 @@ void *build_save(int *size, int x0, int y0, int w, int h)
}
for(y=by0; y<by0+bh; y++)
for(x=bx0; x<bx0+bw; x++)
- if(bmap[y][x]==WL_FAN)
+ if(bmap[y][x]==WL_FAN||bmap[y][x]==4)
{
i = (int)(fvy[y][x]*64.0f+127.5f);
if(i<0) i=0;
@@ -315,6 +315,17 @@ void *build_save(int *size, int x0, int y0, int w, int h)
d[p++] = (ttlife&0x00FF);
}
}
+ for(j=0; j<w*h; j++)
+ {
+ i = m[j];
+ if(i){
+ //Now saving tmp!
+ //d[p++] = (parts[i-1].life+3)/4;
+ int tttmp = (int)parts[i-1].tmp;
+ d[p++] = ((tttmp&0xFF00)>>8);
+ d[p++] = (tttmp&0x00FF);
+ }
+ }
for(j=0; j<w*h; j++)
{
i = m[j];
@@ -329,7 +340,7 @@ void *build_save(int *size, int x0, int y0, int w, int h)
for(j=0; j<w*h; j++)
{
i = m[j];
- if(i && (parts[i-1].type==PT_CLNE || parts[i-1].type==PT_PCLN || parts[i-1].type ==PT_BCLN || parts[i-1].type==PT_SPRK || parts[i-1].type==PT_LAVA || parts[i-1].type==PT_PIPE))
+ if(i && (parts[i-1].type==PT_CLNE || parts[i-1].type==PT_PCLN || parts[i-1].type==PT_BCLN || parts[i-1].type==PT_SPRK || parts[i-1].type==PT_LAVA || parts[i-1].type==PT_PIPE))
d[p++] = parts[i-1].ctype;
}
@@ -365,7 +376,7 @@ void *build_save(int *size, int x0, int y0, int w, int h)
c[0] = 0x50; //0x66;
c[1] = 0x53; //0x75;
c[2] = 0x76; //0x43;
- c[3] = legacy_enable;
+ c[3] = legacy_enable|((sys_pause<<1)&0x02);
c[4] = SAVE_VERSION;
c[5] = CELL;
c[6] = bw;
@@ -416,10 +427,18 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
}
else
{
- if(c[3]==1||c[3]==0)
- legacy_enable = c[3];
- else
- legacy_beta = 1;
+ if(ver>=44){
+ legacy_enable = c[3]&0x01;
+ if(!sys_pause){
+ sys_pause = (c[3]>>1)&0x01;
+ }
+ } else {
+ if(c[3]==1||c[3]==0){
+ legacy_enable = c[3];
+ } else {
+ legacy_beta = 1;
+ }
+ }
}
bw = c[6];
@@ -519,7 +538,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
}
for(y=by0; y<by0+bh; y++)
for(x=bx0; x<bx0+bw; x++)
- if(d[(y-by0)*bw+(x-bx0)]==4)
+ if(d[(y-by0)*bw+(x-bx0)]==4||d[(y-by0)*bw+(x-bx0)]==WL_FAN)
{
if(p >= size)
goto corrupt;
@@ -527,7 +546,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
}
for(y=by0; y<by0+bh; y++)
for(x=bx0; x<bx0+bw; x++)
- if(d[(y-by0)*bw+(x-bx0)]==4)
+ if(d[(y-by0)*bw+(x-bx0)]==4||d[(y-by0)*bw+(x-bx0)]==WL_FAN)
{
if(p >= size)
goto corrupt;
@@ -648,6 +667,25 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
}
}
}
+ if(ver>=44){
+ for(j=0; j<w*h; j++)
+ {
+ i = m[j];
+ if(i)
+ {
+ if(p >= size) {
+ goto corrupt;
+ }
+ if(i <= NPART) {
+ ttv = (d[p++])<<8;
+ ttv |= (d[p++]);
+ parts[i-1].tmp = ttv;
+ } else {
+ p+=2;
+ }
+ }
+ }
+ }
for(j=0; j<w*h; j++)
{
i = m[j];
@@ -692,7 +730,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
{
i = m[j];
ty = d[pty+j];
- 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(i && (ty==PT_CLNE || (ty==PT_PCLN && ver>=43) || (ty==PT_BCLN && ver>=44) || (ty==PT_SPRK && ver>=21) || (ty==PT_LAVA && ver>=34) || (ty==PT_PIPE && ver>=43)))
{
if(p >= size)
goto corrupt;
@@ -1027,8 +1065,8 @@ int main(int argc, char *argv[])
#ifdef BETA
int is_beta = 0;
#endif
- char uitext[48] = "";
- char heattext[64] = "";
+ char uitext[255] = "";
+ char heattext[128] = "";
int currentTime = 0;
int FPS = 0;
int pastFPS = 0;
@@ -1187,6 +1225,17 @@ int main(int argc, char *argv[])
memset(vid_buf, 0, (XRES+BARSIZE)*YRES*PIXELSIZE);
}
#endif
+
+ //Can't be too sure...
+ if(bsx>1180)
+ bsx = 1180;
+ if(bsx<0)
+ bsx = 0;
+ if(bsy>1180)
+ bsy = 1180;
+ if(bsy<0)
+ bsy = 0;
+
update_particles(vid_buf);
draw_parts(vid_buf);
@@ -1412,6 +1461,8 @@ int main(int argc, char *argv[])
bsy = 0;
}
}
+ if((sdl_mod & (KMOD_RCTRL) )&&( sdl_mod & (KMOD_RALT)))
+ active_menu = 11;
if(sdl_key==SDLK_INSERT)
REPLACE_MODE = !REPLACE_MODE;
if(sdl_key=='g')
@@ -1901,8 +1952,11 @@ int main(int argc, char *argv[])
memset(fire_g, 0, sizeof(fire_g));
memset(fire_b, 0, sizeof(fire_b));
}
- if(x>=19 && x<=35 && svf_last && svf_open && !bq)
- parse_save(svf_last, svf_lsize, 1, 0, 0);
+ if(x>=19 && x<=35 && svf_last && svf_open && !bq){
+ //int tpval = sys_pause;
+ parse_save(svf_last, svf_lsize, 1, 0, 0);
+ //sys_pause = tpval;
+ }
if(x>=(XRES+BARSIZE-(510-476)) && x<=(XRES+BARSIZE-(510-491)) && !bq)
{
if(b & SDL_BUTTON_LMASK)
@@ -2195,12 +2249,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 f2d308f..424c4a7 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -504,8 +504,12 @@ inline int create_part(int p, int x, int y, int t)
parts[i].life = 50;
parts[i].tmp = 50;
}
- if(t==PT_PUMP)
- parts[i].life= 10;
+ if(t==PT_DEUT)
+ parts[i].life = 20;
+ if(t==PT_BRAY)
+ parts[i].life = 30;
+ if(t==PT_PUMP)
+ parts[i].life= 10;
if(t==PT_FSEP)
parts[i].life = 50;
if(t==PT_COAL) {
@@ -863,7 +867,7 @@ int nearest_part(int ci, int t)
void update_particles_i(pixel *vid, int start, int inc)
{
- int i, j, x, y, t, nx, ny, r, a, s, lt, rt, fe, nt, lpv, nearp, pavg;
+ int i, j, x, y, t, nx, ny, r, a, s, lt, rt, fe, nt, lpv, nearp, pavg, nnx, nny, q, golnum, goldelete, z, ctype, temp, trade;
float mv, dx, dy, ix, iy, lx, ly, d, pp, nrx, nry, dp;
float nn, ct1, ct2;
float pt = R_TEMP;
@@ -882,7 +886,7 @@ void update_particles_i(pixel *vid, int start, int inc)
GRAV_R2 = 30;
GRAV_G2 = 30;
GRAV_B2 = 0;
- for(int q = 0;q <= GRAV;q++)
+ for( q = 0;q <= GRAV;q++)
{
if(GRAV_R >0 && GRAV_G==0)
{
@@ -945,8 +949,8 @@ void update_particles_i(pixel *vid, int start, int inc)
{
if(love[nx/9][ny/9]==1)
{
- for(int nnx=0;nnx<9;nnx++)
- for(int nny=0;nny<9;nny++)
+ for( nnx=0;nnx<9;nnx++)
+ for( nny=0;nny<9;nny++)
{
if(ny+nny>0&&ny+nny<YRES&&nx+nnx>=0&&nx+nnx<XRES)
{
@@ -996,8 +1000,8 @@ void update_particles_i(pixel *vid, int start, int inc)
{
if(lolz[nx/9][ny/9]==1)
{
- for(int nnx=0;nnx<9;nnx++)
- for(int nny=0;nny<9;nny++)
+ for( nnx=0;nnx<9;nnx++)
+ for( nny=0;nny<9;nny++)
{
if(ny+nny>0&&ny+nny<YRES&&nx+nnx>=0&&nx+nnx<XRES)
{
@@ -1034,12 +1038,12 @@ void update_particles_i(pixel *vid, int start, int inc)
continue;
}
else
- for(int golnum=1;golnum<NGOL;golnum++)
+ for( golnum=1;golnum<NGOL;golnum++)
if(parts[r>>8].type==golnum+77)
{
gol[nx][ny] = golnum;
- for(int nnx=-1;nnx<2;nnx++)
- for(int nny=-1;nny<2;nny++)//it will count itself as its own neighbor, which is needed, but will have 1 extra for delete check
+ for( nnx=-1;nnx<2;nnx++)
+ for( nny=-1;nny<2;nny++)//it will count itself as its own neighbor, which is needed, but will have 1 extra for delete check
{
if(ny+nny<4&&nx+nnx<4){//any way to make wrapping code smaller?
gol2[XRES-5][YRES-5][golnum] ++;
@@ -1086,8 +1090,8 @@ void update_particles_i(pixel *vid, int start, int inc)
int neighbors = gol2[nx][ny][0];
if(neighbors==0)
continue;
- for(int golnum = 1;golnum<NGOL;golnum++)
- for(int goldelete = 0;goldelete<9;goldelete++)
+ for( golnum = 1;golnum<NGOL;golnum++)
+ for( goldelete = 0;goldelete<9;goldelete++)
{
if(neighbors==goldelete&&gol[nx][ny]==0&&grule[golnum][goldelete]>=2&&gol2[nx][ny][golnum]>=(goldelete%2)+goldelete/2)
{
@@ -1097,19 +1101,24 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[pmap[ny][nx]>>8].type = PT_NONE;
}
gol2[nx][ny][0] = 0;
- for(int z = 1;z<NGOL;z++)
+ for( z = 1;z<NGOL;z++)
gol2[nx][ny][z] = 0;
}
}
+ //if(ISWIRE==1)
+ //{
+ // CGOL = 0;
+ // ISWIRE = 0;
+ //}
if(ISWIRE==1)
{
- CGOL = 0;
- ISWIRE = 0;
- }
- if(CGOL==1)
- {
- for(int q = 0;q<25;q++)
- wireless[q] = 0;
+ for( q = 0;q<25;q++)
+ if(!wireless[q][1])
+ {
+ wireless[q][0] = 0;
+ }
+ else
+ wireless[q][1] = 0;
}
for(i=start; i<(NPART-starti); i+=inc)
if(parts[i].type)
@@ -1124,7 +1133,7 @@ void update_particles_i(pixel *vid, int start, int inc)
{
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)
+ if(parts[i].life<=0 && t!=PT_METL && t!=PT_ARAY && 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)
{
kill_part(i);
continue;
@@ -1803,6 +1812,60 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
}
+ else if(t==PT_ARAY && parts[i].life==0){
+ for(nx=-1; nx<2; nx++){
+ for(ny=-1; ny<2; 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((r&0xFF)==PT_SPRK){
+ int destroy = (parts[r>>8].ctype==PT_PSCN)?1:0;
+ for (int docontinue = 1, nxx = 0, nyy = 0, nxi = nx*-1, nyi = ny*-1; docontinue; nyy+=nyi, nxx+=nxi) {
+ if(!(x+nxi+nxx<XRES && y+nyi+nyy<YRES && x+nxi+nxx >= 0 && y+nyi+nyy >= 0)){
+ break;
+ }
+ r = pmap[y+nyi+nyy][x+nxi+nxx];
+ if(!((r>>8)>=NPART)) {
+ if(!r){
+ int nr = create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_BRAY);
+ if(nr!=-1&&destroy){
+ parts[nr].tmp = 2;
+ parts[nr].life = 2;
+ }
+ } else if(!destroy) {
+ if(parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==0){
+ if(nyy!=0 || nxx!=0){
+ parts[r>>8].type = PT_BRAY;
+ parts[r>>8].life = 1020;
+ parts[r>>8].tmp = 1;
+ }
+ docontinue = 0;
+ } else if(parts[r>>8].type==PT_BRAY&&parts[r>>8].tmp==1){
+ parts[r>>8].life = 1020;
+ //docontinue = 1;
+ } else {
+ if(nyy!=0 || nxx!=0){
+ create_part(-1, x+nxi+nxx, y+nyi+nyy, PT_SPRK);
+ }
+ docontinue = 0;
+ }
+ } else if(destroy) {
+ if(parts[r>>8].type==PT_BRAY){
+ parts[r>>8].life = 1;
+ docontinue = 1;
+ } else {
+ docontinue = 0;
+ }
+ }
+ }
+ }
+ }
+ //parts[i].life = 4;
+ }
+ }
+ }
+ }
else if(t==PT_FUSE)
{
if(parts[i].life<=0) {
@@ -2334,7 +2397,7 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[i].life--;
}
}
- for(int trade = 0; trade<9;trade ++)
+ for( trade = 0; trade<9;trade ++)
{
nx = rand()%5-2;
ny = rand()%5-2;
@@ -2480,9 +2543,10 @@ void update_particles_i(pixel *vid, int start, int inc)
create_part(-1,x+nx,y+ny,PT_DEUT);
parts[i].life--;
parts[pmap[y+ny][x+nx]>>8].temp = parts[i].temp;
+ parts[pmap[y+ny][x+nx]>>8].life = 0;
}
}
- for(int trade = 0; trade<4;trade ++)
+ for( trade = 0; trade<4;trade ++)
{
nx = rand()%5-2;
ny = rand()%5-2;
@@ -2510,7 +2574,7 @@ void update_particles_i(pixel *vid, int start, int inc)
}
else if(t==PT_WARP)
{
- for(int trade = 0; trade<5;trade ++)
+ for( trade = 0; trade<5;trade ++)
{
nx = rand()%3-1;
ny = rand()%3-1;
@@ -2679,8 +2743,8 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
if(parts[i].ctype>1)
- for(int o = 0;o<3;o++)
- for(int ctype = 2;ctype<5;ctype++)
+ for( q = 0;q<3;q++)
+ for( ctype = 2;ctype<5;ctype++)
{
if(parts[i].ctype==ctype)
{
@@ -2813,10 +2877,11 @@ void update_particles_i(pixel *vid, int start, int inc)
if((r>>8)>=NPART || !r)
continue;
if(parts[r>>8].type==PT_SPRK || (parts[r>>8].type!=PT_PRTI && parts[r>>8].type!=PT_PRTO && (ptypes[parts[r>>8].type].falldown!= 0 || pstates[parts[r>>8].type].state == ST_GAS)))
- for(int nnx=0;nnx<8;nnx++)
+ for( nnx=0;nnx<8;nnx++)
if(!portal[count-1][nnx])
{
portal[count-1][nnx] = parts[r>>8].type;
+ portaltemp[count-1][nnx] = parts[r>>8].temp;
if(parts[r>>8].type==PT_SPRK)
parts[r>>8].type = parts[r>>8].ctype;
else
@@ -2839,7 +2904,7 @@ void update_particles_i(pixel *vid, int start, int inc)
continue;
if(!r)
{
- for(int nnx =0 ;nnx<8;nnx++)
+ for( nnx =0 ;nnx<8;nnx++)
{
int randomness = count + rand()%3-1;
if(randomness<1)
@@ -2857,12 +2922,15 @@ void update_particles_i(pixel *vid, int start, int inc)
create_part(-1,x-1,y,portal[randomness-1][nnx]);
create_part(-1,x-1,y-1,portal[randomness-1][nnx]);
portal[randomness-1][nnx] = 0;
+ portaltemp[randomness-1][nnx] = 0;
break;
}
else if(portal[randomness-1][nnx])
{
create_part(-1,x+nx,y+ny,portal[randomness-1][nnx]);
+ parts[pmap[y+ny][x+nx]>>8].temp = portaltemp[randomness-1][nnx];
portal[randomness-1][nnx] = 0;
+ portaltemp[randomness-1][nnx] = 0;
break;
}
}
@@ -2871,9 +2939,8 @@ void update_particles_i(pixel *vid, int start, int inc)
}
else if(t==PT_WIFI)
{
- CGOL = 1;
int temprange = 100;
- for(int temp = 0; temp < 2500; temp += temprange)
+ for( temp = 0; temp < 2500; temp += temprange)
if(parts[i].temp-273.15>temp&&parts[i].temp-273.15<temp+temprange)
parts[i].tmp = temp/100;
for(ny=-1; ny<2; ny++)
@@ -2884,16 +2951,17 @@ 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_NSCN&&parts[r>>8].life==0 && wireless[parts[i].tmp])
+ if(parts[r>>8].type==PT_NSCN&&parts[r>>8].life==0 && wireless[parts[i].tmp][0])
{
parts[r>>8].type = PT_SPRK;
parts[r>>8].ctype = PT_NSCN;
parts[r>>8].life = 4;
}
- else if(parts[r>>8].type==PT_SPRK && parts[r>>8].ctype!=PT_NSCN && parts[r>>8].life>=3 && !wireless[parts[i].tmp])
+ else if(parts[r>>8].type==PT_SPRK && parts[r>>8].ctype!=PT_NSCN && parts[r>>8].life>=3 && !wireless[parts[i].tmp][0])
{
parts[r>>8].type = parts[r>>8].ctype;
- wireless[parts[i].tmp] = 1;
+ wireless[parts[i].tmp][0] = 1;
+ wireless[parts[i].tmp][1] = 1;
ISWIRE = 1;
}
}
@@ -3014,8 +3082,8 @@ void update_particles_i(pixel *vid, int start, int inc)
if((r>>8)>=NPART || !r)
continue;
else if(parts[r>>8].type==PT_SPRK&&parts[i].life==0)
- for(int nnx=-1;nnx<2;nnx++)
- for(int nny=-1;nny<2;nny++)
+ for( nnx=-1;nnx<2;nnx++)
+ for( nny=-1;nny<2;nny++)
{
if(7>rand()%200&&parts[i].life==0)
{
@@ -3050,8 +3118,8 @@ void update_particles_i(pixel *vid, int start, int inc)
if(!r)
continue;
else if(parts[r>>8].type==PT_SPRK&&parts[i].life==0)
- for(int nnx=-1;nnx<2;nnx++)
- for(int nny=-1;nny<2;nny++)
+ for( nnx=-1;nnx<2;nnx++)
+ for( nny=-1;nny<2;nny++)
{
if(3>rand()%200&&parts[i].life==0)
{
@@ -3099,8 +3167,8 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[r>>8].life=7;
}
else if(parts[r>>8].type==PT_SPRK&&parts[i].life==0)
- for(int nnx=-1;nnx<2;nnx++)
- for(int nny=-1;nny<2;nny++)
+ for( nnx=-1;nnx<2;nnx++)
+ for( nny=-1;nny<2;nny++)
{
if(2>rand()%3000&&parts[i].life==0)
{
@@ -3143,8 +3211,8 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[r>>8].life = 7;
}
else if(parts[r>>8].type==PT_SPRK&&parts[i].life==0)
- for(int nnx=-1;nnx<2;nnx++)
- for(int nny=-1;nny<2;nny++)
+ for( nnx=-1;nnx<2;nnx++)
+ for( nny=-1;nny<2;nny++)
{
if(!pmap[y+ny+nny][x+nx+nnx])
{
@@ -4934,10 +5002,10 @@ int flood_parts(int x, int y, int c, int cm, int bm)
int create_parts(int x, int y, int rx, int ry, int c)
{
- int i, j, f = 0, u, v, oy, ox, b = 0, dw = 0, stemp = 0;//n;
+ int i, j, r, f = 0, u, v, oy, ox, b = 0, dw = 0, stemp = 0;//n;
int wall = c - 100;
- for(int r=UI_ACTUALSTART;r<=UI_ACTUALSTART+UI_WALLCOUNT;r++)
+ for(r=UI_ACTUALSTART;r<=UI_ACTUALSTART+UI_WALLCOUNT;r++)
{
if(wall==r)
{