summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilip <philip@philip-linuxlaptop.(none)>2010-11-06 01:25:02 (GMT)
committer Philip <philip@philip-linuxlaptop.(none)>2010-11-06 01:25:02 (GMT)
commita23d46a9f6e612a51f9dfa5e0f6a578953da6757 (patch)
tree26a1a1fd85367803b800a7f3703d1a9fc8159beb /src
parent068076a4aeaa444e72b44f716172e4e583953e2d (diff)
downloadpowder-a23d46a9f6e612a51f9dfa5e0f6a578953da6757.zip
powder-a23d46a9f6e612a51f9dfa5e0f6a578953da6757.tar.gz
GOL works 100% now. todo: make some way to set GSPEED from ingame, and is the number of frames per generation.
Diffstat (limited to 'src')
-rw-r--r--src/interface.c2
-rw-r--r--src/main.c4
-rw-r--r--src/powder.c63
3 files changed, 45 insertions, 24 deletions
diff --git a/src/interface.c b/src/interface.c
index e561868..07edca9 100644
--- a/src/interface.c
+++ b/src/interface.c
@@ -3614,7 +3614,7 @@ int execute_vote(pixel *vid_buf, char *id, char *action)
}
void open_link(char *uri){
#ifdef WIN32
- ShellExecute(0, "OPEN", uri, NULL, NULL, 0)
+ ShellExecute(0, "OPEN", uri, NULL, NULL, 0);
#elif MACOSX
//LSOpenCFURLRef(CFURLCreateWithString(NULL, CFStringCreateWithCString(NULL, uri, 0) ,NULL), NULL); //TODO: Get this crap working
#elif LIN32
diff --git a/src/main.c b/src/main.c
index 36efa88..75e1912 100644
--- a/src/main.c
+++ b/src/main.c
@@ -104,7 +104,7 @@ int FPSB = 0;
int MSIGN =-1;
int NGOL = 0;
int CGOL = 0;
-int GSPEED = 1;
+int GSPEED = 0;
sign signs[MAXSIGNS];
@@ -521,6 +521,8 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
{
k = pmap[y][x]>>8;
parts[k].type = j;
+ if(j ==PT_GOL)
+ gol[x][y] = 1;
if(j == PT_PHOT)
parts[k].ctype = 0x3fffffff;
parts[k].x = (float)x;
diff --git a/src/powder.c b/src/powder.c
index b4aeebb..1d55a18 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -824,38 +824,57 @@ void update_particles_i(pixel *vid, int start, int inc)
int starti = (start*-1);
if(sys_pause&&!framerender)
return;
+ gol2[0][0] = 3;
+ for(nx=0;nx<XRES;nx++)
+ for(ny=0;ny<YRES;ny++)
+ {
+ r = pmap[ny][nx];
+ if((r>>8)>=NPART || !r)
+ {
+ gol[nx][ny] = 0;
+ continue;
+ }
+ if(parts[r>>8].type==PT_GOL)
+ gol[nx][ny] = 1;
+ }
+ for(nx=0;nx<XRES;nx++)
+ for(ny=0;ny<YRES;ny++)
+ {
+ if(gol[nx][ny]==1)
+ for(int nnx=-1;nnx<2;nnx++)
+ for(int nny=-1;nny<2;nny++)
+ if(nx+nnx>=0 && ny+nny>0 && nx+nnx<XRES && ny+nny<YRES)
+ gol2[nx+nnx][ny+nny] ++;
+ }
+ for(nx=0;nx<XRES;nx++)
+ for(ny=0;ny<YRES;ny++)
+ {
+ r = pmap[ny][nx];
+ if(gol2[nx][ny]==3&&gol[nx][ny]==0)
+ create_part(-1,nx,ny,PT_GOL);
+ else if(gol2[nx][ny]>=5&&gol[nx][ny]==1)
+ parts[r>>8].type = PT_NONE;
+ else if(gol2[nx][ny]<=2&&gol[nx][ny]==1)
+ parts[r>>8].type = PT_NONE;
+ gol2[nx][ny] = 0;
+ }
+ /*gol[0][0] = 3; other gol code, still has glitch
if(CGOL>=GSPEED)
{
CGOL = 0;
- create_part(-1,0,0,PT_GOL);
for(nx=0;nx<XRES;nx++)
{
for(ny=0;ny<YRES;ny++)
{
r = pmap[ny][nx];
if((r>>8)>=NPART || !r)
- continue;
+ continue;
if(parts[r>>8].type==PT_GOL)
- for(int nnx=1; nnx>-2; nnx--)
- for(int nny=1; nny>-2; nny--)
+ for(int nnx=-1; nnx<2; nnx++)
+ for(int nny=-1; nny<2; nny++)
if(nx+nnx>=0 && ny+nny>0 && nx+nnx<XRES && ny+nny<YRES)
{
- r=pmap[ny+nny][nx+nnx];
- if(gol[nx+nnx][ny+nny]>=4){
- gol[nx+nnx][ny+nny] =5;
- }
- else if(gol[nx+nnx][ny+nny]==3){
- gol[nx+nnx][ny+nny] =4;
- }
- else if(gol[nx+nnx][ny+nny]==2){
- gol[nx+nnx][ny+nny] =3;
- }
- else if(gol[nx+nnx][ny+nny]==1){
- gol[nx+nnx][ny+nny] =2;
- }
- else if(gol[nx+nnx][ny+nny]==0){
- gol[nx+nnx][ny+nny] =1;
- }
+ gol[nx+nnx][ny+nny] ++;
}
}
}
@@ -865,7 +884,7 @@ void update_particles_i(pixel *vid, int start, int inc)
if(gol[nx][ny]>=5&&(parts[r>>8].type==PT_NONE||parts[r>>8].type==PT_GOL)){
parts[r>>8].type=PT_NONE;
}
- else if(gol[nx][ny]==3){
+ else if(gol[nx][ny]==3&&parts[r>>8].type==PT_NONE){
create_part(-1,nx,ny,PT_GOL);
}
else if(gol[nx][ny]==2&&parts[r>>8].type==PT_GOL){
@@ -878,7 +897,7 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
- CGOL++;
+ CGOL++;*/
for(i=start; i<(NPART-starti); i+=inc)
if(parts[i].type)
{