diff --git a/includes/defines.h b/includes/defines.h index af414718a..3d6b54981 100644 --- a/includes/defines.h +++ b/includes/defines.h @@ -61,7 +61,7 @@ extern unsigned char ZSIZE; #define STAMP_Y 4 #define STAMP_MAX 120 -#define NGOL 20 +#define NGOL 23 #define CIRCLE_BRUSH 0 #define SQUARE_BRUSH 1 diff --git a/includes/powder.h b/includes/powder.h index 068edb22c..1fdc3baeb 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -190,7 +190,10 @@ #define PT_REPL 139 #define PT_MYST 140 #define PT_BOYL 141 -#define PT_NUM 142 +#define PT_TEST 142 +#define PT_TEST2 143 +#define PT_TEST3 144 +#define PT_NUM 145 #define R_TEMP 22 #define MAX_TEMP 9999 @@ -427,7 +430,10 @@ static const part_type ptypes[PT_NUM] = {"REPL", PIXPACK(0x259588), 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, "B1357/S1357", 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", 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.", TYPE_GAS, NULL}, - //Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins Description + {"TEST", 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_SPECIAL, 9000.0f, 40, "S3458/B37/4", TYPE_SOLID|PROP_LIFE, NULL}, + {"TES2", 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_SPECIAL, 9000.0f, 40, "S124/B3/3", TYPE_SOLID|PROP_LIFE, NULL}, + {"TES4", 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_SPECIAL, 9000.0f, 40, "S3456/B278/6", 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 }; static part_state pstates[PT_NUM] = @@ -575,31 +581,37 @@ static part_state pstates[PT_NUM] = /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, /* BOYL */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 50.0f, PT_NONE, 0.0f}, + /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, + /* GOL */ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f}, }; -static int grule[NGOL][9] = +static int grule[NGOL][10] = { -// 0,1,2,3,4,5,6,7,8 live=1 spawn=2 spawn&live=3 - {0,0,0,0,0,0,0,0,0},//blank - {0,0,1,3,0,0,0,0,0},//GOL - {0,0,1,3,0,0,2,0,0},//HLIF - {0,0,0,2,3,3,1,1,0},//ASIM - {0,1,1,2,0,1,2,0,0},//2x2 - {0,0,0,3,1,0,3,3,3},//DANI - {0,1,0,3,0,3,0,2,1},//AMOE - {0,0,1,2,1,1,2,0,2},//MOVE - {0,0,1,3,0,2,0,2,1},//PGOL - {0,0,0,2,0,3,3,3,3},//DMOE - {0,0,0,3,3,0,0,0,0},//34 - {0,0,0,2,2,3,0,0,0},//LLIF - {0,0,1,3,0,1,3,3,3},//STAN - {0,0,2,0,0,0,0,0,0},//SEED - {0,1,1,3,1,1,0,0,0},//MAZE - {0,0,1,3,0,1,1,3,3},//COAG - {0,0,1,1,3,3,2,2,2},//WALL - {0,3,0,0,0,0,0,0,0},//GNAR - {0,3,0,3,0,3,0,3,0},//REPL - {1,0,0,2,2,3,1,1,3},//MYST +// 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,1,3,0,0,0,0,0,2},//GOL + {0,0,1,3,0,0,2,0,0,2},//HLIF + {0,0,0,2,3,3,1,1,0,2},//ASIM + {0,1,1,2,0,1,2,0,0,2},//2x2 + {0,0,0,3,1,0,3,3,3,2},//DANI + {0,1,0,3,0,3,0,2,1,2},//AMOE + {0,0,1,2,1,1,2,0,2,2},//MOVE + {0,0,1,3,0,2,0,2,1,2},//PGOL + {0,0,0,2,0,3,3,3,3,2},//DMOE + {0,0,0,3,3,0,0,0,0,2},//34 + {0,0,0,2,2,3,0,0,0,2},//LLIF + {0,0,1,3,0,1,3,3,3,2},//STAN + {0,0,2,0,0,0,0,0,0,2},//SEED + {0,1,1,3,1,1,0,0,0,2},//MAZE + {0,0,1,3,0,1,1,3,3,2},//COAG + {0,0,1,1,3,3,2,2,2,2},//WALL + {0,3,0,0,0,0,0,0,0,2},//GNAR + {0,3,0,3,0,3,0,3,0,2},//REPL + {1,0,0,2,2,3,1,1,3,2},//MYST + {0,0,0,3,1,1,0,2,1,4},//TEST + {0,1,1,2,1,0,0,0,0,3},//TEST2 + {0,0,2,1,1,1,1,2,2,6},//TEST2 }; static int goltype[NGOL] = { @@ -622,6 +634,9 @@ static int goltype[NGOL] = PT_GNAR, PT_REPL, PT_MYST, + PT_TEST, + PT_TEST2, + PT_TEST3, }; static int loverule[9][9] = { diff --git a/src/graphics.c b/src/graphics.c index be84b61d0..824cee8aa 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1713,6 +1713,35 @@ void draw_parts(pixel *vid) cb = 20; blendpixel(vid, nx, ny, cr, cg, cb, 255); + } + else if(t==PT_TEST) + { + 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_TEST2) + { + 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_TEST3) + { + 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_DEUT) { diff --git a/src/powder.c b/src/powder.c index 6b25eb4c5..6aa4e411e 100644 --- a/src/powder.c +++ b/src/powder.c @@ -658,6 +658,12 @@ inline int create_part(int p, int x, int y, int t) parts[i].tmp = (rand()%11); if(t==PT_PQRT) parts[i].tmp = (rand()%11); + if(ptypes[t].properties&PROP_LIFE) { + int r; + for(r = 0;r>8].type==goltype[golnum-1]) { - gol[nx][ny] = golnum; - 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] ++; + if(parts[r>>8].tmp == grule[golnum][9]-1) { + gol[nx][ny] = golnum; + 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] ++; + } + } else { + parts[r>>8].tmp --; + if(parts[r>>8].tmp<=0) + parts[r>>8].type = PT_NONE; } } } for(nx=CELL;nx>8].type = PT_NONE; + else if(neighbors-1==goldelete&&gol[nx][ny]==golnum&&(grule[golnum][goldelete]==0||grule[golnum][goldelete]==2)) {//subtract 1 because it counted itself + 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; } gol2[nx][ny][0] = 0; for( z = 1;z