mirror of
https://github.com/The-Powder-Toy/The-Powder-Toy.git
synced 2025-04-24 16:52:50 +02:00
LOL GOL WORKS
This commit is contained in:
parent
443a861eaf
commit
4ed5b47bff
@ -104,6 +104,9 @@ struct stamp
|
||||
typedef struct stamp stamp;
|
||||
|
||||
int MSIGN;
|
||||
int NGOL;
|
||||
int CGOL;
|
||||
int gol[XRES][YRES];
|
||||
extern sign signs[MAXSIGNS];
|
||||
extern stamp stamps[STAMP_MAX];
|
||||
extern int stamp_count;
|
||||
|
@ -116,7 +116,8 @@
|
||||
#define PT_HSWC 75
|
||||
#define PT_IRON 76
|
||||
#define PT_MORT 77
|
||||
#define PT_NUM 78
|
||||
#define PT_GOL 78
|
||||
#define PT_NUM 79
|
||||
|
||||
#define R_TEMP 22
|
||||
#define MAX_TEMP 9999
|
||||
@ -284,6 +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, R_TEMP+0.0f +273.15f, 0, "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
|
||||
};
|
||||
|
||||
|
@ -1244,6 +1244,7 @@ void draw_parts(pixel *vid)
|
||||
int cr, cg, cb;
|
||||
float fr, fg, fb;
|
||||
float pt = R_TEMP;
|
||||
int gol[XRES][YRES];
|
||||
for(i = 0; i<NPART; i++) {
|
||||
#ifdef OpenGL
|
||||
if(cmode == 6) //If fire mode
|
||||
@ -2213,7 +2214,6 @@ void render_signs(pixel *vid_buf)
|
||||
sprintf(buff, "Pressure: %3.2f", pv[signs[i].y/CELL][signs[i].x/CELL]); //...pressure
|
||||
drawtext(vid_buf, x+3, y+3, buff, 255, 255, 255, 255);
|
||||
}
|
||||
|
||||
if(strcmp(signs[i].text, "{t}")==0)
|
||||
{
|
||||
if((pmap[signs[i].y][signs[i].x]>>8)>0 && (pmap[signs[i].y][signs[i].x]>>8)<NPART)
|
||||
|
@ -102,6 +102,8 @@ int death = 0, framerender = 0;
|
||||
int amd = 1;
|
||||
int FPSB = 0;
|
||||
int MSIGN =-1;
|
||||
int NGOL = 0;
|
||||
int CGOL = 0;
|
||||
|
||||
sign signs[MAXSIGNS];
|
||||
|
||||
|
62
src/powder.c
62
src/powder.c
@ -822,6 +822,63 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
float c_heat = 0.0f;
|
||||
int h_count = 0;
|
||||
int starti = (start*-1);
|
||||
if(sys_pause&&!framerender)
|
||||
return;
|
||||
if(CGOL>=8)
|
||||
{
|
||||
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;
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
else if(gol[nx][ny]==3){
|
||||
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;
|
||||
}
|
||||
gol[nx][ny]=0;
|
||||
|
||||
}
|
||||
}
|
||||
CGOL++;
|
||||
for(i=start; i<(NPART-starti); i+=inc)
|
||||
if(parts[i].type)
|
||||
{
|
||||
@ -831,10 +888,7 @@ void update_particles_i(pixel *vid, int start, int inc)
|
||||
ly = parts[i].y;
|
||||
t = parts[i].type;
|
||||
|
||||
if(sys_pause&&!framerender)
|
||||
return;
|
||||
|
||||
if(parts[i].life && t!=PT_ACID && t!=PT_COAL && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM && t!=PT_FUSE && t!=PT_FSEP && t!=PT_BCOL)
|
||||
if(parts[i].life && t!=PT_ACID && t!=PT_COAL && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM && t!=PT_FUSE && t!=PT_FSEP && t!=PT_BCOL && t!=PT_GOL)
|
||||
{
|
||||
if(!(parts[i].life==10&&(parts[i].type==PT_LCRY||parts[i].type==PT_PCLN||parts[i].type==PT_HSWC)))
|
||||
parts[i].life--;
|
||||
|
Loading…
x
Reference in New Issue
Block a user