diff --git a/includes/defines.h b/includes/defines.h index f22a3c8e8..43b259846 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 25 +#define NGOL 26 #define CIRCLE_BRUSH 0 #define SQUARE_BRUSH 1 diff --git a/includes/element.h b/includes/element.h index ec32df266..be0388df7 100644 --- a/includes/element.h +++ b/includes/element.h @@ -4,5 +4,6 @@ #include "powder.h" #include "misc.h" +#include "math.h" #endif diff --git a/includes/powder.h b/includes/powder.h index f402b6507..91d8f1fa2 100644 --- a/includes/powder.h +++ b/includes/powder.h @@ -191,9 +191,9 @@ #define PT_REPL 139 #define PT_MYST 140 #define PT_BOYL 141 -#define PT_TEST 142 -#define PT_TEST2 143 -#define PT_TEST3 144 +#define PT_LOTE 142 +#define PT_FRG2 143 +#define PT_STAR 144 #define PT_FROG 145 #define PT_BRAN 146 #define PT_NUM 147 @@ -511,11 +511,11 @@ 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", 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}, - {"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_SOLID, 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_SOLID, 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_SOLID, 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_SOLID, 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_SOLID, 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", 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", 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", 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", 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 }; @@ -710,9 +710,9 @@ static int grule[NGOL][10] = {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},//TEST3 + {0,0,0,3,1,1,0,2,1,4},//LOTE + {0,1,1,2,1,0,0,0,0,3},//FRG2 + {0,0,2,1,1,1,1,2,2,6},//STAR {0,1,1,2,2,0,0,0,0,3},//FROG {0,0,2,0,2,0,3,0,0,3},//BRAN }; @@ -737,9 +737,9 @@ static int goltype[NGOL] = PT_GNAR, PT_REPL, PT_MYST, - PT_TEST, - PT_TEST2, - PT_TEST3, + PT_LOTE, + PT_FRG2, + PT_STAR, PT_FROG, PT_BRAN, }; @@ -836,9 +836,9 @@ extern inline int is_wire_off(int x, int y); void set_emap(int x, int y); #if defined(WIN32) && !defined(__GNUC__) -_inline int parts_avg(int ci, int ni, int t); +extern _inline int parts_avg(int ci, int ni, int t); #else -int parts_avg(int ci, int ni, int t); +extern int parts_avg(int ci, int ni, int t); #endif int nearest_part(int ci, int t); diff --git a/src/elements/misc.c b/src/elements/elementmisc.c similarity index 100% rename from src/elements/misc.c rename to src/elements/elementmisc.c diff --git a/src/elements/firw.c b/src/elements/firw.c index ae1f56de1..c41400e9c 100644 --- a/src/elements/firw.c +++ b/src/elements/firw.c @@ -35,12 +35,13 @@ int update_FIRW(UPDATE_FUNC_ARGS) { } else if (parts[i].tmp==2) { int col = rand()%200+4; + int tmul; for (rx=-2; rx<3; rx++) for (ry=-2; ry<3; ry++) if (x+rx>=0 && y+ry>0 && x+rx>8)>=NPART || !r) diff --git a/src/elements/legacy.c b/src/elements/legacy.c index 1a345ddda..0fd3d6b66 100644 --- a/src/elements/legacy.c +++ b/src/elements/legacy.c @@ -2,9 +2,9 @@ // Interactions which only occur when legacy_enable is on int update_legacy_all(UPDATE_FUNC_ARGS) { - if (!legacy_enable) return 0; int r, rx, ry, rt; int t = parts[i].type; + if (!legacy_enable) return 0; if (t==PT_WTRV) { for (rx=-2; rx<3; rx++) for (ry=-2; ry<3; ry++) diff --git a/src/elements/phot.c b/src/elements/phot.c index 7b7afc6d8..11585f9fb 100644 --- a/src/elements/phot.c +++ b/src/elements/phot.c @@ -1,9 +1,9 @@ #include int update_PHOT(UPDATE_FUNC_ARGS) { - if (1>rand()%10) update_PYRO(UPDATE_FUNC_SUBCALL_ARGS); int r, rt, rx, ry; float rr, rrr; + if (1>rand()%10) update_PYRO(UPDATE_FUNC_SUBCALL_ARGS); for (rx=-1; rx<2; rx++) for (ry=-1; ry<2; ry++) if (x+rx>=0 && y+ry>0 && x+rx int update_SPRK(UPDATE_FUNC_ARGS) { - update_PYRO(UPDATE_FUNC_SUBCALL_ARGS); int r, rx, ry, rt, conduct_sprk, nearp, pavg, ct = parts[i].ctype; + update_PYRO(UPDATE_FUNC_SUBCALL_ARGS); + if (parts[i].life<=0) { if (ct==PT_WATR||ct==PT_SLTW||ct==PT_PSCN||ct==PT_NSCN||ct==PT_ETRD||ct==PT_INWR) diff --git a/src/graphics.c b/src/graphics.c index 06cd6fbbc..b18a65929 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1714,6 +1714,49 @@ void draw_parts(pixel *vid) 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) { diff --git a/src/powder.c b/src/powder.c index a0653291f..b2932d151 100644 --- a/src/powder.c +++ b/src/powder.c @@ -664,6 +664,12 @@ inline int create_part(int p, int x, int y, int t) parts[i].life = 50; parts[i].tmp = 50; } + 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;//using kill_part makes it not work + } } } for (nx=CELL; nx>8)>=NPART) continue; for ( golnum = 1; golnum>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; for ( z = 1; z