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
This commit is contained in:
jacksonmj 2011-01-29 10:45:27 +00:00
commit 9938378c0d
10 changed files with 95 additions and 31 deletions

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

@ -4,5 +4,6 @@
#include "powder.h" #include "powder.h"
#include "misc.h" #include "misc.h"
#include "math.h"
#endif #endif

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
@ -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}, {"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}, {"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", 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_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_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_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_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_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_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_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_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
}; };
@ -710,9 +710,9 @@ static int grule[NGOL][10] =
{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
}; };
@ -737,9 +737,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,
}; };
@ -836,9 +836,9 @@ extern inline int is_wire_off(int x, int y);
void set_emap(int x, int y); void set_emap(int x, int y);
#if defined(WIN32) && !defined(__GNUC__) #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 #else
int parts_avg(int ci, int ni, int t); extern int parts_avg(int ci, int ni, int t);
#endif #endif
int nearest_part(int ci, int t); int nearest_part(int ci, int t);

View File

@ -35,12 +35,13 @@ int update_FIRW(UPDATE_FUNC_ARGS) {
} }
else if (parts[i].tmp==2) { else if (parts[i].tmp==2) {
int col = rand()%200+4; int col = rand()%200+4;
int tmul;
for (rx=-2; rx<3; rx++) for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++) for (ry=-2; ry<3; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry))
{ {
r = pmap[y+ry][x+rx]; r = pmap[y+ry][x+rx];
int tmul = rand()%7; tmul = rand()%7;
create_part(-1, x+rx, y+ry, PT_FIRW); create_part(-1, x+rx, y+ry, PT_FIRW);
r = pmap[y+ry][x+rx]; r = pmap[y+ry][x+rx];
if ((r>>8)>=NPART || !r) if ((r>>8)>=NPART || !r)

View File

@ -2,9 +2,9 @@
// Interactions which only occur when legacy_enable is on // Interactions which only occur when legacy_enable is on
int update_legacy_all(UPDATE_FUNC_ARGS) { int update_legacy_all(UPDATE_FUNC_ARGS) {
if (!legacy_enable) return 0;
int r, rx, ry, rt; int r, rx, ry, rt;
int t = parts[i].type; int t = parts[i].type;
if (!legacy_enable) return 0;
if (t==PT_WTRV) { if (t==PT_WTRV) {
for (rx=-2; rx<3; rx++) for (rx=-2; rx<3; rx++)
for (ry=-2; ry<3; ry++) for (ry=-2; ry<3; ry++)

View File

@ -1,9 +1,9 @@
#include <element.h> #include <element.h>
int update_PHOT(UPDATE_FUNC_ARGS) { int update_PHOT(UPDATE_FUNC_ARGS) {
if (1>rand()%10) update_PYRO(UPDATE_FUNC_SUBCALL_ARGS);
int r, rt, rx, ry; int r, rt, rx, ry;
float rr, rrr; float rr, rrr;
if (1>rand()%10) update_PYRO(UPDATE_FUNC_SUBCALL_ARGS);
for (rx=-1; rx<2; rx++) for (rx=-1; rx<2; rx++)
for (ry=-1; ry<2; ry++) for (ry=-1; ry<2; ry++)
if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) { if (x+rx>=0 && y+ry>0 && x+rx<XRES && y+ry<YRES && (rx || ry)) {

View File

@ -1,8 +1,9 @@
#include <element.h> #include <element.h>
int update_SPRK(UPDATE_FUNC_ARGS) { 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; 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 (parts[i].life<=0)
{ {
if (ct==PT_WATR||ct==PT_SLTW||ct==PT_PSCN||ct==PT_NSCN||ct==PT_ETRD||ct==PT_INWR) if (ct==PT_WATR||ct==PT_SLTW||ct==PT_PSCN||ct==PT_NSCN||ct==PT_ETRD||ct==PT_INWR)

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

@ -664,6 +664,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)
@ -1297,9 +1303,10 @@ 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])
{ {
if(parts[r>>8].tmp == grule[golnum][9]-1) {
gol[nx][ny] = golnum; gol[nx][ny] = golnum;
for ( nnx=-1; nnx<2; nnx++) 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 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
@ -1307,13 +1314,19 @@ void update_particles_i(pixel *vid, int start, int inc)
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][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][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++)
{ {
r = pmap[ny][nx];
neighbors = gol2[nx][ny][0]; neighbors = gol2[nx][ny][0];
if (neighbors==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++)
@ -1324,7 +1337,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++)