summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacksonmj <jacksonmj@jacksonmj.none>2011-01-29 10:45:27 (GMT)
committer jacksonmj <jacksonmj@jacksonmj.none>2011-01-29 10:50:43 (GMT)
commit9938378c0d7eed11dc3cf2db67dfd32d0c31dfd7 (patch)
treed75a70b7ea481142563ac6d4d9799aee65c2e1e8
parentfe033ce859b1d5db91fa840e0353403ab19b0d3a (diff)
parent4b5337c03a0a64a12e1d66829c14af73f1ff0398 (diff)
downloadpowder-9938378c0d7eed11dc3cf2db67dfd32d0c31dfd7.zip
powder-9938378c0d7eed11dc3cf2db67dfd32d0c31dfd7.tar.gz
Merge remote branch 'cracker64' into dev
Conflicts: includes/element.h includes/powder.h src/elements/firw.c src/elements/legacy.c src/elements/phot.c src/elements/sprk.c src/graphics.c src/main.c src/powder.c
-rw-r--r--includes/defines.h2
-rw-r--r--includes/element.h1
-rw-r--r--includes/powder.h32
-rw-r--r--src/elements/elementmisc.c (renamed from src/elements/misc.c)0
-rw-r--r--src/elements/firw.c3
-rw-r--r--src/elements/legacy.c2
-rw-r--r--src/elements/phot.c2
-rw-r--r--src/elements/sprk.c3
-rw-r--r--src/graphics.c43
-rw-r--r--src/powder.c38
10 files changed, 95 insertions, 31 deletions
diff --git a/includes/defines.h b/includes/defines.h
index f22a3c8..43b2598 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 ec32df2..be0388d 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 f402b65..91d8f1f 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
index a284b3a..a284b3a 100644
--- a/src/elements/misc.c
+++ b/src/elements/elementmisc.c
diff --git a/src/elements/firw.c b/src/elements/firw.c
index ae1f56d..c41400e 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<XRES && y+ry<YRES && (rx || ry))
{
r = pmap[y+ry][x+rx];
- int tmul = rand()%7;
+ tmul = rand()%7;
create_part(-1, x+rx, y+ry, PT_FIRW);
r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r)
diff --git a/src/elements/legacy.c b/src/elements/legacy.c
index 1a345dd..0fd3d6b 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 7b7afc6..11585f9 100644
--- a/src/elements/phot.c
+++ b/src/elements/phot.c
@@ -1,9 +1,9 @@
#include <element.h>
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<XRES && y+ry<YRES && (rx || ry)) {
diff --git a/src/elements/sprk.c b/src/elements/sprk.c
index 58692ee..ddac968 100644
--- a/src/elements/sprk.c
+++ b/src/elements/sprk.c
@@ -1,8 +1,9 @@
#include <element.h>
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 06cd6fb..b18a659 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 a065329..b2932d1 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<NGOL; r++)
+ if(t==goltype[r])
+ parts[i].tmp = grule[r+1][9] - 1;
+ }
if (t==PT_DEUT)
parts[i].life = 10;
if (t==PT_BRAY)
@@ -1297,23 +1303,30 @@ void update_particles_i(pixel *vid, int start, int inc)
continue;
}
else
- for ( golnum=1; golnum<NGOL; golnum++)
+ for ( golnum=1; golnum<=NGOL; golnum++)
if (parts[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<XRES-CELL; nx++)
for (ny=CELL; ny<YRES-CELL; ny++)
{
+ r = pmap[ny][nx];
neighbors = gol2[nx][ny][0];
- if (neighbors==0)
+ if(neighbors==0 || !(ptypes[r&0xFF].properties&PROP_LIFE || !r&0xFF) || (r>>8)>=NPART)
continue;
for ( golnum = 1; golnum<NGOL; golnum++)
for ( goldelete = 0; goldelete<9; goldelete++)
@@ -1324,7 +1337,12 @@ void update_particles_i(pixel *vid, int start, int inc)
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
- 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;
for ( z = 1; z<NGOL; z++)