Added high life, assimilation, and 2x2 to life particles, and put it in its own menu section.

This commit is contained in:
Philip
2010-11-06 17:13:43 -04:00
parent 5c91fde92e
commit a2c8443c36
5 changed files with 121 additions and 64 deletions

View File

@@ -18,6 +18,8 @@
#define THUMB_CACHE_SIZE 256
#define NGOL 5
#define IMGCONNS 3
#define TIMEOUT 100
#define HTTP_TIMEOUT 10
@@ -104,11 +106,10 @@ struct stamp
typedef struct stamp stamp;
int MSIGN;
int NGOL;
int CGOL;
int GSPEED;
int gol[XRES][YRES];
int gol2[XRES][YRES];
int gol2[XRES][YRES][NGOL];
extern sign signs[MAXSIGNS];
extern stamp stamps[STAMP_MAX];
extern int stamp_count;

View File

@@ -50,7 +50,8 @@ static menu_wall mwalls[] =
#define SC_GAS 3
#define SC_LIQUID 4
#define SC_NUCLEAR 7
#define SC_TOTAL 9
#define SC_LIFE 9
#define SC_TOTAL 10
static menu_section msections[] =
{
@@ -63,6 +64,7 @@ static menu_section msections[] =
{"\xD1", "Solids", 0},
{"\xC6", "Radioactive", 0},
{"\xCC", "Special", 0},
{"\xC8", "Life", 0},
};
struct ui_edit

View File

@@ -117,7 +117,10 @@
#define PT_IRON 76
#define PT_MORT 77
#define PT_GOL 78
#define PT_NUM 79
#define PT_HLIF 79
#define PT_ASIM 80
#define PT_2x2 81
#define PT_NUM 82
#define R_TEMP 22
#define MAX_TEMP 9999
@@ -285,7 +288,10 @@ 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, 40, "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_LIFE, 9000.0f, 40, "Game Of Life!", TYPE_SOLID},
{"HLIF", PIXPACK(0xFF0000), 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_LIFE, 9000.0f, 40, "High Life! (like GOL)", TYPE_SOLID},
{"ASIM", PIXPACK(0x0000FF), 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_LIFE, 9000.0f, 40, "Assimilation! (like GOL)", TYPE_SOLID},
{"2x2", PIXPACK(0xFFFF00), 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_LIFE, 9000.0f, 40, "2x2! (like GOL)", 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

@@ -102,7 +102,6 @@ int death = 0, framerender = 0;
int amd = 1;
int FPSB = 0;
int MSIGN =-1;
int NGOL = 0;
int CGOL = 0;
int GSPEED = 0;
@@ -523,6 +522,12 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
parts[k].type = j;
if(j == PT_GOL)
gol[x][y] = 1;
if(j == PT_HLIF)
gol[x][y] = 2;
if(j == PT_ASIM)
gol[x][y] = 3;
if(j == PT_2x2)
gol[x][y] = 4;
if(j == PT_PHOT)
parts[k].ctype = 0x3fffffff;
parts[k].x = (float)x;

View File

@@ -835,34 +835,49 @@ void update_particles_i(pixel *vid, int start, int inc)
gol[nx][ny] = 0;
continue;
}
if(parts[r>>8].type==PT_GOL)
else if(parts[r>>8].type==PT_GOL)
{
gol[nx][ny] = 1;
}
else if(parts[r>>8].type==PT_HLIF)
{
gol[nx][ny] = 2;
}
else if(parts[r>>8].type==PT_ASIM)
{
gol[nx][ny] = 3;
}
else if(parts[r>>8].type==PT_2x2)
{
gol[nx][ny] = 4;
}
}
for(nx=4;nx<XRES-4;nx++)
for(ny=4;ny<YRES-4;ny++)
{
if(gol[nx][ny]==1)
int z = gol[nx][ny];
if(z>=1)
for(int nnx=-1;nnx<2;nnx++)
for(int nny=-1;nny<2;nny++)
{
if(ny+nny<4&&nx+nnx<4)
gol2[XRES-5][YRES-5] ++;
gol2[XRES-5][YRES-5][z] ++;
else if(ny+nny<4&&nx+nnx>=XRES-4)
gol2[4][YRES-5] ++;
gol2[4][YRES-5][z] ++;
else if(ny+nny>=YRES-4&&nx+nnx<4)
gol2[XRES-5][4] ++;
gol2[XRES-5][4][z] ++;
else if(nx+nnx<4)
gol2[XRES-5][ny+nny] ++;
gol2[XRES-5][ny+nny][z] ++;
else if(ny+nny<4)
gol2[nx+nnx][YRES-5] ++;
gol2[nx+nnx][YRES-5][z] ++;
else if(ny+nny>=YRES-4&&nx+nnx>=XRES-4)
gol2[4][4] ++;
gol2[4][4][z] ++;
else if(ny+nny>=YRES-4)
gol2[nx+nnx][4] ++;
gol2[nx+nnx][4][z] ++;
else if(nx+nnx>=XRES-4)
gol2[4][ny+nny] ++;
gol2[4][ny+nny][z] ++;
else
gol2[nx+nnx][ny+nny] ++;
gol2[nx+nnx][ny+nny][z] ++;
}
@@ -871,55 +886,83 @@ void update_particles_i(pixel *vid, int start, int inc)
for(ny=4;ny<YRES-4;ny++)
{
r = pmap[ny][nx];
if(gol2[nx][ny]==3&&gol[nx][ny]==0)
int v = 0;
for(int z = 1;z<NGOL;z++)
v += gol2[nx][ny][z];
if(v==3&&gol[nx][ny]==0&&gol2[nx][ny][1]>=2)
{
create_part(-1,nx,ny,PT_GOL);
else if(gol2[nx][ny]>=5&&gol[nx][ny]==1)
}
else if(v==3&&gol[nx][ny]==0&&gol2[nx][ny][2]>=2)
{
create_part(-1,nx,ny,PT_HLIF);
}
else if(v==3&&gol[nx][ny]==0&&gol2[nx][ny][3]>=2)
{
create_part(-1,nx,ny,PT_ASIM);
}
else if(v==3&&gol[nx][ny]==0&&gol2[nx][ny][4]>=2)
{
create_part(-1,nx,ny,PT_2x2);
}
else if(v==3&&gol[nx][ny]==0&&gol2[nx][ny][1]==1)
{
create_part(-1,nx,ny,PT_GOL);
}
else if(v==3&&gol[nx][ny]==0&&gol2[nx][ny][2]==1)
{
create_part(-1,nx,ny,PT_HLIF);
}
else if(v==4&&gol[nx][ny]==0&&gol2[nx][ny][3]>=2)
{
create_part(-1,nx,ny,PT_ASIM);
}
else if(v==5&&gol[nx][ny]==0&&gol2[nx][ny][3]>=3)
{
create_part(-1,nx,ny,PT_ASIM);
}
else if(v==6&&gol[nx][ny]==0&&gol2[nx][ny][2]>=3)
{
create_part(-1,nx,ny,PT_HLIF);
}
else if(v==6&&gol[nx][ny]==0&&gol2[nx][ny][4]>=3)
{
create_part(-1,nx,ny,PT_2x2);
}
else if(v>=5&&gol[nx][ny]==1)
parts[r>>8].type = PT_NONE;
else if(gol2[nx][ny]<=2&&gol[nx][ny]==1)
else if(v<=2&&gol[nx][ny]==1)
parts[r>>8].type = PT_NONE;
gol2[nx][ny] = 0;
else if(v>=5&&gol[nx][ny]==2)
parts[r>>8].type = PT_NONE;
else if(v<=2&&gol[nx][ny]==2)
parts[r>>8].type = PT_NONE;
else if(v<=4&&gol[nx][ny]==3)
parts[r>>8].type = PT_NONE;
else if(v>=9&&gol[nx][ny]==3)
parts[r>>8].type = PT_NONE;
else if(v>=7&&gol[nx][ny]==4)
parts[r>>8].type = PT_NONE;
else if(v==4&&gol[nx][ny]==4)
parts[r>>8].type = PT_NONE;
else if(v==5&&gol[nx][ny]==4)
parts[r>>8].type = PT_NONE;
else if(v<=1&&gol[nx][ny]==4)
parts[r>>8].type = PT_NONE;
gol2[nx][ny][1]=0;
gol2[nx][ny][2]=0;
gol2[nx][ny][3]=0;
gol2[nx][ny][4]=0;
}
CGOL++;
/*gol[0][0] = 3; other gol code
if(CGOL>=GSPEED)
{
CGOL = 0;
for(nx=0;nx<XRES;nx++)
{
for(ny=0;ny<YRES;ny++)
{
r = pmap[ny][nx];
if((r>>8)>=NPART || !r)
continue;
if(parts[r>>8].type==PT_GOL)
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)
{
gol[nx+nnx][ny+nny] ++;
}
}
}
for(nx=0;nx<XRES;nx++)
for(ny=0;ny<YRES;ny++){
r = pmap[ny][nx];
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&&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){
parts[r>>8].type=PT_NONE;
}
else if(gol[nx][ny]==1&&(parts[r>>8].type==PT_NONE||parts[r>>8].type==PT_GOL)){
parts[r>>8].type=PT_NONE;
}
gol[nx][ny]=0;
}
}
CGOL++;*/
for(i=start; i<(NPART-starti); i+=inc)
if(parts[i].type)
{
@@ -1884,7 +1927,7 @@ void update_particles_i(pixel *vid, int start, int inc)
else if(t==PT_MORT) {
create_part(-1, x, y-1, PT_SMKE);
}
else if(t==PT_GOL)
else if(t==PT_GOL||t==PT_HLIF||t==PT_ASIM||t==PT_2x2)
{
if(parts[i].temp>0)
parts[i].temp -= 50.0f;