IT WOOOOOORKS :D (fixed WIRE logic.)
This commit is contained in:
parent
50c4bfd86d
commit
8f92829aab
@ -2,7 +2,6 @@
|
||||
|
||||
int update_WIRE(UPDATE_FUNC_ARGS) {
|
||||
int s,r,rx,ry,count;
|
||||
printf("FUCK");
|
||||
s=pmap[y][x];
|
||||
/*
|
||||
0: wire
|
||||
@ -11,22 +10,23 @@ int update_WIRE(UPDATE_FUNC_ARGS) {
|
||||
|
||||
tmp is previous state, ctype is current state
|
||||
*/
|
||||
parts[s>>8].tmp=parts[s>>8].ctype;
|
||||
if(parts[s>>8].tmp==1){parts[s>>8].ctype=2;}
|
||||
if(parts[s>>8].tmp==2){parts[s>>8].ctype=0;}
|
||||
//parts[s>>8].tmp=parts[s>>8].ctype;
|
||||
parts[s>>8].ctype=0;
|
||||
if(parts[s>>8].tmp==1){parts[s>>8].ctype=2; return 0;}
|
||||
if(parts[s>>8].tmp==2){parts[s>>8].ctype=0; return 0;}
|
||||
|
||||
count=0;
|
||||
for(rx=-1; rx<2; rx++)
|
||||
for(ry=-1; ry<2; ry++)
|
||||
{
|
||||
count=0;
|
||||
if(x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && pmap[y+ry][x+rx] && rx==0 && ry==0 && (pmap[y+ry][x+rx]&0xFF)!=0xFF)
|
||||
if(x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && pmap[y+ry][x+rx] && (rx!=0 || ry!=0) && (pmap[y+ry][x+rx]&0xFF)!=0xFF)
|
||||
{
|
||||
r = pmap[y+ry][x+rx];
|
||||
if((r&0xFF)==PT_SPRK){parts[s>>8].ctype=1;}
|
||||
if((r&0xFF)==PT_SPRK){parts[s>>8].ctype=1; return 0;}
|
||||
if((r&0xFF)==PT_WIRE && parts[r>>8].tmp==1){count++;}
|
||||
}
|
||||
if(count==1 || count==2)
|
||||
parts[s>>8].ctype=1;
|
||||
}
|
||||
if(count==1 || count==2)
|
||||
parts[s>>8].ctype=1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -1732,6 +1732,8 @@ void draw_parts(pixel *vid)
|
||||
blendpixel(vid, nx, ny, 0, 0, 255, 255);
|
||||
else
|
||||
blendpixel(vid, nx, ny, 255, 255, 255, 255);
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cmode!=CM_HEAT)
|
||||
|
14
src/powder.c
14
src/powder.c
@ -709,6 +709,11 @@ inline int create_part(int p, int x, int y, int tv)//the function for creating a
|
||||
|
||||
if (t==PT_SPRK)
|
||||
{
|
||||
if((pmap[y][x]>>8)==PT_WIRE)
|
||||
{
|
||||
parts[pmap[y][x]>>8].ctype=1;
|
||||
return -1;
|
||||
}
|
||||
if ((pmap[y][x]>>8)>=NPART || !((pmap[y][x]&0xFF)==PT_INST||(ptypes[pmap[y][x]&0xFF].properties&PROP_CONDUCTS)))
|
||||
return -1;
|
||||
if (parts[pmap[y][x]>>8].life!=0)
|
||||
@ -1466,6 +1471,15 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
}
|
||||
}
|
||||
}
|
||||
//wire!
|
||||
for (nx=0; nx<XRES; nx++)
|
||||
for (ny=0; ny<YRES; ny++)
|
||||
{
|
||||
r = pmap[ny][nx];
|
||||
if ((r>>8)>=NPART || !r)
|
||||
continue;
|
||||
parts[r>>8].tmp=parts[r>>8].ctype;
|
||||
}
|
||||
//game of life!
|
||||
if (ISGOL==1&&++CGOL>=GSPEED)//GSPEED is frames per generation
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user