GOL works 100% now. todo: make some way to set GSPEED from ingame, and is the number of frames per generation.

This commit is contained in:
Philip 2010-11-05 21:25:02 -04:00
parent 068076a4ae
commit a23d46a9f6
5 changed files with 47 additions and 25 deletions

View File

@ -108,6 +108,7 @@ int NGOL;
int CGOL;
int GSPEED;
int gol[XRES][YRES];
int gol2[XRES][YRES];
extern sign signs[MAXSIGNS];
extern stamp stamps[STAMP_MAX];
extern int stamp_count;

View File

@ -285,7 +285,7 @@ static const part_type ptypes[PT_NUM] =
{"HSWC", PIXPACK(0x3B1010), 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, "Heat switch. Conducts Heat only when activated", TYPE_SOLID},
{"IRON", PIXPACK(0x707070), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 50, 0, 100, SC_SOLIDS, R_TEMP+0.0f +273.15f, 251, "Rusts with salt, can be used for electrlosis of WATR", TYPE_SOLID},
{"MORT", PIXPACK(0xE0E0E0), 0.0f, 0.00f * CFDS, 1.00f, 1.00f, -0.99f, 0.0f, 0.01f, 0.002f * CFDS, 0, 0, 0, 0, 0, 0, -1, SC_NUCLEAR, R_TEMP+4.0f +273.15f, 60, "Steam Train.", TYPE_PART},
{"GOL", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, 9000.0f, 0, "Game Of Life!", TYPE_SOLID},
{"GOL", PIXPACK(0x0CAC00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, 9000.0f, 40, "Game Of Life!", TYPE_SOLID},
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins(real world, by triclops200) Description
};

View File

@ -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

View File

@ -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;

View File

@ -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)
{