oops, silly copy file, and fixed the new GoL from simon's fail merging.

This commit is contained in:
Cracker64 2011-01-28 19:58:54 -05:00
parent bcea95c5ca
commit 880ed33fc7
7 changed files with 116 additions and 6317 deletions

36
Makefile Executable file → Normal file
View File

@ -1,21 +1,26 @@
SOURCES := src/*.c SOURCES := src/*.c src/elements/*.c
CFLAGS := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -Iincludes/ CFLAGS := -w -std=c99 -D_POSIX_C_SOURCE=200112L -Iincludes/
OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations OFLAGS := -O3 -ffast-math -ftree-vectorize -funsafe-math-optimizations
LFLAGS := -lSDL -lm -lbz2 LFLAGS := -lSDL -lm -lbz2
LFLAGS_X := -lm -lbz2 -lSDLmain
MFLAGS_SSE3 := -march=native -DX86 -DX86_SSE3 -msse3 MFLAGS_SSE3 := -march=native -DX86 -DX86_SSE3 -msse3
MFLAGS_SSE2 := -march=native-DX86 -DX86_SSE2 -msse2 MFLAGS_SSE2 := -march=native -DX86 -DX86_SSE2 -msse2
MFLAGS_SSE := -march=native -DX86 -DX86_SSE MFLAGS_SSE := -march=native -DX86 -DX86_SSE
FLAGS_DBUG := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -pg -DX86 -DX86_SSE3 -msse3 -lSDL -lm -lbz2 FLAGS_DBUG := -Wall -std=c99 -D_POSIX_C_SOURCE=200112L -pg -DX86 -DX86_SSE3 -msse3 -lSDL -lm -lbz2 -g
COMPILER := gcc COMPILER := gcc
LINUX_TARG := powder-64-sse2 powder-sse powder-sse2 LINUX_TARG := powder-64-sse2 powder-sse powder-sse2
WIN32_TARG := powder-sse.exe powder-sse2.exe WIN32_TARG := powder-sse.exe powder-sse2.exe
powder: $(SOURCES) powder: $(SOURCES)
$(COMPILER) -DINTERNAL -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 $(COMPILER) -DINTERNAL -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64
mv $@ build
powder-debug-64: $(SOURCES)
$(COMPILER) -m64 -o$@ $(FLAGS_DBUG) -DLIN64 $(SOURCES) -Iincludes/
mv $@ build
powder-debug: $(SOURCES) powder-debug: $(SOURCES)
$(COMPILER) -m64 -o$@ $(FLAGS_DBUG) -DLIN64 $(SOURCES) -Iincludes/ -DLIN64 $(COMPILER) -m32 -o$@ $(FLAGS_DBUG) -DLIN32 $(SOURCES) -Iincludes/
mv $@ build
powder-sse3: $(SOURCES) powder-sse3: $(SOURCES)
$(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN32 $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN32
strip $@ strip $@
@ -23,19 +28,26 @@ powder-sse3: $(SOURCES)
powder-sse2: $(SOURCES) powder-sse2: $(SOURCES)
$(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN32 $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN32
strip $@ strip $@
mv $@ build
powder-sse: $(SOURCES) powder-sse: $(SOURCES)
$(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE) $(SOURCES) -DLIN32 $(COMPILER) -m32 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE) $(SOURCES) -DLIN32
strip $@ strip $@
mv $@ build
powder-64-sse3-opengl: $(SOURCES) powder-64-sse3-opengl: $(SOURCES)
$(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 -lGL -lGLU -DOpenGL $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 -lGL -lGLU -DOpenGL
strip $@ strip $@
mv $@ build
powder-64-sse3: $(SOURCES) powder-64-sse3: $(SOURCES)
$(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64 -j3 $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE3) $(SOURCES) -DLIN64
strip $@ strip $@
mv $@ build mv $@ build
powder-64-sse2: $(SOURCES) powder-64-sse2: $(SOURCES)
$(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN64 $(COMPILER) -m64 -o$@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS_SSE2) $(SOURCES) -DLIN64
strip $@ strip $@
mv $@ build
powder-icc: $(SOURCES)
/opt/intel/Compiler/11.1/073/bin/intel64/icc -m64 -o$@ -Iincludes/ -O2 -march=core2 -msse3 -mfpmath=sse -lSDL -lbz2 -lm -xW $(SOURCES) -std=c99 -D_POSIX_C_SOURCE=200112L
powder-res.o: powder-res.rc powder.ico powder-res.o: powder-res.rc powder.ico
i586-mingw32msvc-windres powder-res.rc powder-res.o i586-mingw32msvc-windres powder-res.rc powder-res.o
@ -44,18 +56,22 @@ powder-sse3.exe: $(SOURCES) powder-res.o
i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE3) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32
strip $@ strip $@
chmod 0644 $@ chmod 0644 $@
mv $@ build
powder-sse2.exe: $(SOURCES) powder-res.o powder-sse2.exe: $(SOURCES) powder-res.o
i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE2) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32
strip $@ strip $@
chmod 0644 $@ chmod 0644 $@
mv $@ build
powder-sse.exe: $(SOURCES) powder-res.o powder-sse.exe: $(SOURCES) powder-res.o
i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32 i586-mingw32msvc-gcc -o$@ $(CFLAGS) $(OFLAGS) $(MFLAGS_SSE) $(SOURCES) powder-res.o -lmingw32 -lws2_32 -lSDLmain $(LFLAGS) -mwindows -DWIN32
strip $@ strip $@
chmod 0644 $@ chmod 0644 $@
mv $@ build
powder-x: $(SOURCES) powder-x: $(SOURCES)
gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS) $(SOURCES) -lSDLmain -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa -ggdb gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS_X) $(MFLAGS) $(SOURCES) -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa -framework SDL
strip $@ strip $@
mv $@ build
powder-x-ogl: $(SOURCES) powder-x-ogl: $(SOURCES)
gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS) $(MFLAGS) $(SOURCES) -lSDLmain -DOpenGL -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa -framework OpenGL -ggdb gcc -o $@ $(CFLAGS) $(OFLAGS) $(LFLAGS_X) $(MFLAGS) $(SOURCES) -DOpenGL -DMACOSX -DPIX32BGRA -arch x86_64 -framework Cocoa -framework SDL -framework OpenGL
strip $@ strip $@
mv $@ build

View File

@ -61,7 +61,7 @@ extern unsigned char ZSIZE;
#define STAMP_Y 4 #define STAMP_Y 4
#define STAMP_MAX 120 #define STAMP_MAX 120
#define NGOL 25 #define NGOL 26
#define CIRCLE_BRUSH 0 #define CIRCLE_BRUSH 0
#define SQUARE_BRUSH 1 #define SQUARE_BRUSH 1

View File

@ -191,9 +191,9 @@
#define PT_REPL 139 #define PT_REPL 139
#define PT_MYST 140 #define PT_MYST 140
#define PT_BOYL 141 #define PT_BOYL 141
#define PT_TEST 142 #define PT_LOTE 142
#define PT_TEST2 143 #define PT_FRG2 143
#define PT_TEST3 144 #define PT_STAR 144
#define PT_FROG 145 #define PT_FROG 145
#define PT_BRAN 146 #define PT_BRAN 146
#define PT_NUM 147 #define PT_NUM 147
@ -512,11 +512,11 @@ static const part_type ptypes[PT_NUM] =
{"MYST", PIXPACK(0x0C3C00), 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, "B3458/S05678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL}, {"MYST", PIXPACK(0x0C3C00), 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, "B3458/S05678", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"BOYL", PIXPACK(0x0A3200), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.18f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Boyle, variable pressure gas. Expands when heated.", ST_GAS, TYPE_GAS, &update_BOYL}, {"BOYL", PIXPACK(0x0A3200), 1.0f, 0.01f * CFDS, 0.99f, 0.30f, -0.1f, 0.0f, 0.18f, 0.000f * CFDS, 0, 0, 0, 0, 1, 1, 1, SC_GAS, R_TEMP+2.0f +273.15f, 42, "Boyle, variable pressure gas. Expands when heated.", ST_GAS, TYPE_GAS, &update_BOYL},
{"LOTE", 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_LIFE2, 9000.0f, 40, "Behaves kinda like Living on the Edge S3458/B37/4", TYPE_SOLID|PROP_LIFE, NULL}, {"LOTE", 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_LIFE2, 9000.0f, 40, "Behaves kinda like Living on the Edge S3458/B37/4", ST_NONE,TYPE_SOLID|PROP_LIFE, NULL},
{"FRG2", PIXPACK(0x00FF00), 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_LIFE2, 9000.0f, 40, "Like Frogs rule S124/B3/3", TYPE_SOLID|PROP_LIFE, NULL}, {"FRG2", PIXPACK(0x00FF00), 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_LIFE2, 9000.0f, 40, "Like Frogs rule S124/B3/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"STAR", 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_LIFE2, 9000.0f, 40, "Like Star Wars rule S3456/B278/6", TYPE_SOLID|PROP_LIFE, NULL}, {"STAR", 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_LIFE2, 9000.0f, 40, "Like Star Wars rule S3456/B278/6", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"FROG", PIXPACK(0x00AA00), 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_LIFE2, 9000.0f, 40, "Frogs S12/B34/3", TYPE_SOLID|PROP_LIFE, NULL}, {"FROG", PIXPACK(0x00AA00), 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_LIFE2, 9000.0f, 40, "Frogs S12/B34/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
{"BRAN", PIXPACK(0xCCCC00), 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_LIFE2, 9000.0f, 40, "Brian 6 S6/B246/3", TYPE_SOLID|PROP_LIFE, NULL}, {"BRAN", PIXPACK(0xCCCC00), 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_LIFE2, 9000.0f, 40, "Brian 6 S6/B246/3", ST_NONE, TYPE_SOLID|PROP_LIFE, NULL},
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description
}; };
@ -688,7 +688,7 @@ static part_transition ptransitions[PT_NUM] =
#undef ST #undef ST
static int grule[NGOL][9] = static int grule[NGOL][10] =
{ {
// 0,1,2,3,4,5,6,7,8,STATES live=1 spawn=2 spawn&live=3 States are kind of how long until it dies, normal ones use two states(living,dead) for others the intermediate states live but do nothing // 0,1,2,3,4,5,6,7,8,STATES live=1 spawn=2 spawn&live=3 States are kind of how long until it dies, normal ones use two states(living,dead) for others the intermediate states live but do nothing
{0,0,0,0,0,0,0,0,0,2},//blank {0,0,0,0,0,0,0,0,0,2},//blank
@ -711,9 +711,9 @@ static int grule[NGOL][9] =
{0,3,0,0,0,0,0,0,0,2},//GNAR {0,3,0,0,0,0,0,0,0,2},//GNAR
{0,3,0,3,0,3,0,3,0,2},//REPL {0,3,0,3,0,3,0,3,0,2},//REPL
{1,0,0,2,2,3,1,1,3,2},//MYST {1,0,0,2,2,3,1,1,3,2},//MYST
{0,0,0,3,1,1,0,2,1,4},//TEST {0,0,0,3,1,1,0,2,1,4},//LOTE
{0,1,1,2,1,0,0,0,0,3},//TEST2 {0,1,1,2,1,0,0,0,0,3},//FRG2
{0,0,2,1,1,1,1,2,2,6},//TEST3 {0,0,2,1,1,1,1,2,2,6},//STAR
{0,1,1,2,2,0,0,0,0,3},//FROG {0,1,1,2,2,0,0,0,0,3},//FROG
{0,0,2,0,2,0,3,0,0,3},//BRAN {0,0,2,0,2,0,3,0,0,3},//BRAN
}; };
@ -738,9 +738,9 @@ static int goltype[NGOL] =
PT_GNAR, PT_GNAR,
PT_REPL, PT_REPL,
PT_MYST, PT_MYST,
PT_TEST, PT_LOTE,
PT_TEST2, PT_FRG2,
PT_TEST3, PT_STAR,
PT_FROG, PT_FROG,
PT_BRAN, PT_BRAN,
}; };

View File

@ -1714,6 +1714,49 @@ void draw_parts(pixel *vid)
blendpixel(vid, nx, ny, cr, cg, cb, 255); blendpixel(vid, nx, ny, cr, cg, cb, 255);
} }
else if(t==PT_LOTE)
{
if(parts[i].tmp==2)
blendpixel(vid, nx, ny, 255, 128, 0, 255);
else if(parts[i].tmp==1)
blendpixel(vid, nx, ny, 255, 255, 0, 255);
else
blendpixel(vid, nx, ny, 255, 0, 0, 255);
}
else if(t==PT_FRG2)
{
if(parts[i].tmp==2)
blendpixel(vid, nx, ny, 0, 100, 50, 255);
else
blendpixel(vid, nx, ny, 0, 255, 90, 255);
}
else if(t==PT_STAR)
{
if(parts[i].tmp==4)
blendpixel(vid, nx, ny, 0, 0, 128, 255);
else if(parts[i].tmp==3)
blendpixel(vid, nx, ny, 0, 0, 150, 255);
else if(parts[i].tmp==2)
blendpixel(vid, nx, ny, 0, 0, 190, 255);
else if(parts[i].tmp==1)
blendpixel(vid, nx, ny, 0, 0, 230, 255);
else
blendpixel(vid, nx, ny, 0, 0, 70, 255);
}
else if(t==PT_FROG)
{
if(parts[i].tmp==2)
blendpixel(vid, nx, ny, 0, 100, 0, 255);
else
blendpixel(vid, nx, ny, 0, 255, 0, 255);
}
else if(t==PT_BRAN)
{
if(parts[i].tmp==1)
blendpixel(vid, nx, ny, 150, 150, 0, 255);
else
blendpixel(vid, nx, ny, 255, 255, 0, 255);
}
else if (t==PT_DEUT) else if (t==PT_DEUT)
{ {

View File

@ -1725,7 +1725,7 @@ int main(int argc, char *argv[])
int tctype = parts[cr>>8].ctype; int tctype = parts[cr>>8].ctype;
if (tctype>=PT_NUM) if (tctype>=PT_NUM)
tctype = 0; tctype = 0;
sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d, Tmp: %d", ptypes[cr&0xFF].name, ptypes[tctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life ,parts[cr>>8].tmp);
//sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[parts[cr>>8].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life); //sprintf(heattext, "%s (%s), Pressure: %3.2f, Temp: %4.2f C, Life: %d", ptypes[cr&0xFF].name, ptypes[parts[cr>>8].ctype].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f, parts[cr>>8].life);
} else { } else {
sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f); sprintf(heattext, "%s, Pressure: %3.2f, Temp: %4.2f C", ptypes[cr&0xFF].name, pv[(y/sdl_scale)/CELL][(x/sdl_scale)/CELL], parts[cr>>8].temp-273.15f);

File diff suppressed because it is too large Load Diff

View File

@ -667,6 +667,12 @@ inline int create_part(int p, int x, int y, int t)
parts[i].life = 50; parts[i].life = 50;
parts[i].tmp = 50; parts[i].tmp = 50;
} }
if(ptypes[t].properties&PROP_LIFE) {
int r;
for(r = 0;r<NGOL;r++)
if(t==goltype[r])
parts[i].tmp = grule[r+1][9] - 1;
}
if (t==PT_DEUT) if (t==PT_DEUT)
parts[i].life = 10; parts[i].life = 10;
if (t==PT_BRAY) if (t==PT_BRAY)
@ -1124,7 +1130,7 @@ int nearest_part(int ci, int t)
void update_particles_i(pixel *vid, int start, int inc) void update_particles_i(pixel *vid, int start, int inc)
{ {
int i, j, x, y, t, nx, ny, r, surround_space, s, lt, rt, nt, nnx, nny, q, golnum, goldelete, z; int i, j, x, y, t, nx, ny, r, surround_space, s, lt, rt, nt, nnx, nny, q, golnum, goldelete, z, neighbors;
float mv, dx, dy, ix, iy, lx, ly, nrx, nry, dp; float mv, dx, dy, ix, iy, lx, ly, nrx, nry, dp;
int fin_x, fin_y, clear_x, clear_y; int fin_x, fin_y, clear_x, clear_y;
float fin_xf, fin_yf, clear_xf, clear_yf; float fin_xf, fin_yf, clear_xf, clear_yf;
@ -1301,23 +1307,30 @@ void update_particles_i(pixel *vid, int start, int inc)
continue; continue;
} }
else else
for ( golnum=1; golnum<NGOL; golnum++) for ( golnum=1; golnum<=NGOL; golnum++)
if (parts[r>>8].type==goltype[golnum-1]) if (parts[r>>8].type==goltype[golnum-1])
{ {
gol[nx][ny] = golnum; if(parts[r>>8].tmp == grule[golnum][9]-1) {
for ( nnx=-1; nnx<2; nnx++) gol[nx][ny] = golnum;
for ( nny=-1; nny<2; nny++)//it will count itself as its own neighbor, which is needed, but will have 1 extra for delete check for ( nnx=-1; nnx<2; nnx++)
{ for ( nny=-1; nny<2; nny++)//it will count itself as its own neighbor, which is needed, but will have 1 extra for delete check
gol2[((nx+nnx+XRES-3*CELL)%(XRES-2*CELL))+CELL][((ny+nny+YRES-3*CELL)%(YRES-2*CELL))+CELL][golnum] ++; {
gol2[((nx+nnx+XRES-3*CELL)%(XRES-2*CELL))+CELL][((ny+nny+YRES-3*CELL)%(YRES-2*CELL))+CELL][0] ++; gol2[((nx+nnx+XRES-3*CELL)%(XRES-2*CELL))+CELL][((ny+nny+YRES-3*CELL)%(YRES-2*CELL))+CELL][golnum] ++;
} gol2[((nx+nnx+XRES-3*CELL)%(XRES-2*CELL))+CELL][((ny+nny+YRES-3*CELL)%(YRES-2*CELL))+CELL][0] ++;
}
} else {
parts[r>>8].tmp --;
if(parts[r>>8].tmp<=0)
parts[r>>8].type = PT_NONE;//using kill_part makes it not work
}
} }
} }
for (nx=CELL; nx<XRES-CELL; nx++) for (nx=CELL; nx<XRES-CELL; nx++)
for (ny=CELL; ny<YRES-CELL; ny++) for (ny=CELL; ny<YRES-CELL; ny++)
{ {
int neighbors = gol2[nx][ny][0]; r = pmap[ny][nx];
if (neighbors==0) neighbors = gol2[nx][ny][0];
if(neighbors==0 || !(ptypes[r&0xFF].properties&PROP_LIFE || !r&0xFF) || (r>>8)>=NPART)
continue; continue;
for ( golnum = 1; golnum<NGOL; golnum++) for ( golnum = 1; golnum<NGOL; golnum++)
for ( goldelete = 0; goldelete<9; goldelete++) for ( goldelete = 0; goldelete<9; goldelete++)
@ -1328,7 +1341,12 @@ void update_particles_i(pixel *vid, int start, int inc)
createdsomething = 1; createdsomething = 1;
} }
else if (neighbors-1==goldelete&&gol[nx][ny]==golnum&&(grule[golnum][goldelete]==0||grule[golnum][goldelete]==2))//subtract 1 because it counted itself else if (neighbors-1==goldelete&&gol[nx][ny]==golnum&&(grule[golnum][goldelete]==0||grule[golnum][goldelete]==2))//subtract 1 because it counted itself
kill_part(pmap[ny][nx]>>8); {
if(parts[r>>8].tmp==grule[golnum][9]-1)
parts[r>>8].tmp --;
}
if(parts[r>>8].tmp<=0)
parts[r>>8].type = PT_NONE;//using kill_part makes it not work
} }
gol2[nx][ny][0] = 0; gol2[nx][ny][0] = 0;
for ( z = 1; z<NGOL; z++) for ( z = 1; z<NGOL; z++)