summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilip <philip@philip-linuxlaptop.(none)>2010-11-05 02:12:51 (GMT)
committer Philip <philip@philip-linuxlaptop.(none)>2010-11-05 02:12:51 (GMT)
commit4ed5b47bfffd20c887e422a3997a756cc0066866 (patch)
treef9e5b765aa4dd8b2630f2fc35b94b5d2c1094db0 /src
parent443a861eaf59819fef9ba17033106057b17ea4df (diff)
downloadpowder-4ed5b47bfffd20c887e422a3997a756cc0066866.zip
powder-4ed5b47bfffd20c887e422a3997a756cc0066866.tar.gz
LOL GOL WORKS
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c2
-rw-r--r--src/main.c2
-rw-r--r--src/powder.c62
3 files changed, 61 insertions, 5 deletions
diff --git a/src/graphics.c b/src/graphics.c
index b403fe3..e108e99 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -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)
diff --git a/src/main.c b/src/main.c
index 85a9868..8926716 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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];
diff --git a/src/powder.c b/src/powder.c
index 74ac89f..911dbf9 100644
--- a/src/powder.c
+++ b/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--;