updated with BOMB
This commit is contained in:
parent
41d9dca73f
commit
65a60b3812
@ -176,7 +176,8 @@
|
|||||||
#define PT_ARAY 126
|
#define PT_ARAY 126
|
||||||
#define PT_BRAY 127
|
#define PT_BRAY 127
|
||||||
#define PT_STKM2 128
|
#define PT_STKM2 128
|
||||||
#define PT_NUM 129
|
#define PT_BOMB 129
|
||||||
|
#define PT_NUM 130
|
||||||
|
|
||||||
#define R_TEMP 22
|
#define R_TEMP 22
|
||||||
#define MAX_TEMP 9999
|
#define MAX_TEMP 9999
|
||||||
@ -202,6 +203,7 @@
|
|||||||
#define PROP_NEUTABSORB 0x0100 //256 Absorbs neutrons, reflect is default
|
#define PROP_NEUTABSORB 0x0100 //256 Absorbs neutrons, reflect is default
|
||||||
#define PROP_NEUTPASS 0x0200 //512 Neutrons pass through, such as with glass
|
#define PROP_NEUTPASS 0x0200 //512 Neutrons pass through, such as with glass
|
||||||
#define PROP_DEADLY 0x0400 //1024 Is deadly for stickman.
|
#define PROP_DEADLY 0x0400 //1024 Is deadly for stickman.
|
||||||
|
#define PROP_HOT_GLOW 0x0800 //2048 Hot Metal Glow
|
||||||
#define FLAG_STAGNANT 1
|
#define FLAG_STAGNANT 1
|
||||||
|
|
||||||
struct particle
|
struct particle
|
||||||
@ -397,8 +399,8 @@ static const part_type ptypes[PT_NUM] =
|
|||||||
{"ARAY", PIXPACK(0xFFBB00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Emmitter. Rays create points when they collide", TYPE_SOLID, NULL},
|
{"ARAY", PIXPACK(0xFFBB00), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 1, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Emmitter. Rays create points when they collide", TYPE_SOLID, NULL},
|
||||||
{"BRAY", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 0, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Point. Rays create points when they collide", TYPE_SOLID, NULL},
|
{"BRAY", PIXPACK(0xFFFFFF), 0.0f, 0.00f * CFDS, 0.90f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 1, 1, 0, 100, SC_ELEC, R_TEMP+0.0f +273.15f, 251, "Ray Point. Rays create points when they collide", TYPE_SOLID, NULL},
|
||||||
{"STK2", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!", 0, NULL},
|
{"STK2", PIXPACK(0x000000), 0.5f, 0.00f * CFDS, 0.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.00f * CFDS, 0, 0, 0, 0, 0, 1, 50, SC_SPECIAL, R_TEMP+14.6f+273.15f, 0, "Stickman. Don't kill him!", 0, NULL},
|
||||||
|
{"BOMB", PIXPACK(0xFFF288), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 20, 1, 30, SC_EXPLOSIVE, R_TEMP-2.0f +273.15f, 29, "Bomb.", TYPE_PART, 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
|
||||||
};
|
};
|
||||||
|
|
||||||
static part_state pstates[PT_NUM] =
|
static part_state pstates[PT_NUM] =
|
||||||
@ -533,6 +535,7 @@ static part_state pstates[PT_NUM] =
|
|||||||
/* ARAY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
/* ARAY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
||||||
/* BRAY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
/* BRAY */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
|
||||||
/* STKM2*/ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 620.0f},
|
/* STKM2*/ {ST_NONE, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_FIRE, 620.0f},
|
||||||
|
/* BOMB */ {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][9] =
|
||||||
|
@ -2425,6 +2425,76 @@ void draw_parts(pixel *vid)
|
|||||||
blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32);
|
blendpixel(vid, nx-1, ny-1, cr, cg, cb, 32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(t==PT_BOMB){
|
||||||
|
if(parts[i].tmp==0){
|
||||||
|
cr = PIXR(ptypes[t].pcolors);
|
||||||
|
cg = PIXG(ptypes[t].pcolors);
|
||||||
|
cb = PIXB(ptypes[t].pcolors);
|
||||||
|
if(cmode != CM_NOTHING && cmode != CM_CRACK){
|
||||||
|
int newx = 0;
|
||||||
|
float gradv = 100;
|
||||||
|
blendpixel(vid, nx+1, ny, cr, cg, cb, 223);
|
||||||
|
blendpixel(vid, nx-1, ny, cr, cg, cb, 223);
|
||||||
|
blendpixel(vid, nx, ny+1, cr, cg, cb, 223);
|
||||||
|
blendpixel(vid, nx, ny-1, cr, cg, cb, 223);
|
||||||
|
|
||||||
|
blendpixel(vid, nx+1, ny-1, cr, cg, cb, 112);
|
||||||
|
blendpixel(vid, nx-1, ny-1, cr, cg, cb, 112);
|
||||||
|
blendpixel(vid, nx+1, ny+1, cr, cg, cb, 112);
|
||||||
|
blendpixel(vid, nx-1, ny+1, cr, cg, cb, 112);
|
||||||
|
for(newx = 0; gradv>0.5; newx++){
|
||||||
|
addpixel(vid, nx+newx, ny, cr, cg, cb, gradv);
|
||||||
|
addpixel(vid, nx-newx, ny, cr, cg, cb, gradv);
|
||||||
|
|
||||||
|
addpixel(vid, nx, ny+newx, cr, cg, cb, gradv);
|
||||||
|
addpixel(vid, nx, ny-newx, cr, cg, cb, gradv);
|
||||||
|
gradv = gradv/1.1f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(parts[i].tmp==1){
|
||||||
|
cr = PIXR(ptypes[t].pcolors);
|
||||||
|
cg = PIXG(ptypes[t].pcolors);
|
||||||
|
cb = PIXB(ptypes[t].pcolors);
|
||||||
|
if(cmode != CM_NOTHING && cmode != CM_CRACK){
|
||||||
|
int newx = 0;
|
||||||
|
float gradv = 4*parts[i].life;
|
||||||
|
for(newx = 0; gradv>0.5; newx++){
|
||||||
|
addpixel(vid, nx+newx, ny, cr, cg, cb, gradv);
|
||||||
|
addpixel(vid, nx-newx, ny, cr, cg, cb, gradv);
|
||||||
|
|
||||||
|
addpixel(vid, nx, ny+newx, cr, cg, cb, gradv);
|
||||||
|
addpixel(vid, nx, ny-newx, cr, cg, cb, gradv);
|
||||||
|
gradv = gradv/1.5f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
blendpixel(vid, nx, ny, 255, 255, 255, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if(ptypes[t].properties&PROP_HOT_GLOW && parts[i].temp>473.0f)
|
||||||
|
{
|
||||||
|
float frequency = 0.00146;
|
||||||
|
int q = (parts[i].temp>1370)?1370-473:parts[i].temp-473;
|
||||||
|
cr = sin(frequency*q) * 226 + PIXR(ptypes[t].pcolors);
|
||||||
|
cg = sin(frequency*q*4.55 +3.14) * 34 + PIXG(ptypes[t].pcolors);
|
||||||
|
cb = sin(frequency*q*2.22 +3.14) * 64 + PIXB(ptypes[t].pcolors);
|
||||||
|
if(cr>=255)
|
||||||
|
cr = 255;
|
||||||
|
if(cg>=255)
|
||||||
|
cg = 255;
|
||||||
|
if(cb>=255)
|
||||||
|
cb = 255;
|
||||||
|
if(cr<=0)
|
||||||
|
cr = 0;
|
||||||
|
if(cg<=0)
|
||||||
|
cg = 0;
|
||||||
|
if(cb<=0)
|
||||||
|
cb = 0;
|
||||||
|
blendpixel(vid, nx, ny, cr, cg, cb, 255);
|
||||||
|
}
|
||||||
else if(t==PT_FIRE && parts[i].life)
|
else if(t==PT_FIRE && parts[i].life)
|
||||||
{
|
{
|
||||||
float ttemp = (float)((int)(parts[i].life/2));
|
float ttemp = (float)((int)(parts[i].life/2));
|
||||||
|
64
src/powder.c
64
src/powder.c
@ -133,6 +133,10 @@ int try_move(int i, int x, int y, int nx, int ny)
|
|||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
e = eval_move(parts[i].type, nx, ny, &r);
|
e = eval_move(parts[i].type, nx, ny, &r);
|
||||||
|
|
||||||
|
if((pmap[ny][nx]&0xFF)==PT_BOMB && parts[i].type==PT_BOMB && parts[i].tmp == 1)
|
||||||
|
e = 2;
|
||||||
|
|
||||||
if((pmap[ny][nx]&0xFF)==PT_INVIS && (pv[ny/CELL][nx/CELL]>4.0f ||pv[ny/CELL][nx/CELL]<-4.0f))
|
if((pmap[ny][nx]&0xFF)==PT_INVIS && (pv[ny/CELL][nx/CELL]>4.0f ||pv[ny/CELL][nx/CELL]<-4.0f))
|
||||||
return 1;
|
return 1;
|
||||||
/* half-silvered mirror */
|
/* half-silvered mirror */
|
||||||
@ -2788,6 +2792,66 @@ void update_particles_i(pixel *vid, int start, int inc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if(t==PT_BOMB)
|
||||||
|
{
|
||||||
|
if(parts[i].tmp==1){
|
||||||
|
for(nx=-2; nx<3; nx++)
|
||||||
|
for(ny=-2; ny<3; ny++)
|
||||||
|
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES && (nx || ny))
|
||||||
|
{
|
||||||
|
r = pmap[y+ny][x+nx];
|
||||||
|
if((r>>8)>=NPART || !r)
|
||||||
|
continue;
|
||||||
|
if(parts[r>>8].type!=PT_NONE && parts[r>>8].type!=PT_BOMB){
|
||||||
|
parts[i].type = PT_NONE;
|
||||||
|
goto killed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if(parts[i].tmp==0){
|
||||||
|
for(nx=-2; nx<3; nx++)
|
||||||
|
for(ny=-2; ny<3; ny++)
|
||||||
|
if(x+nx>=0 && y+ny>0 && x+nx<XRES && y+ny<YRES)
|
||||||
|
{
|
||||||
|
r = pmap[y+ny][x+nx];
|
||||||
|
if((r>>8)>=NPART || !r)
|
||||||
|
continue;
|
||||||
|
if(parts[r>>8].type!=PT_NONE && parts[r>>8].type!=PT_BOMB){
|
||||||
|
int rad = 8;
|
||||||
|
int nxi;
|
||||||
|
int nxj;
|
||||||
|
pmap[y][x] = 0;
|
||||||
|
for(nxj=-(rad+1); nxj<=(rad+1); nxj++)
|
||||||
|
for(nxi=-(rad+1); nxi<=(rad+1); nxi++)
|
||||||
|
if((pow(nxi,2))/(pow((rad+1),2))+(pow(nxj,2))/(pow((rad+1),2))<=1){
|
||||||
|
int nb = create_part(-1, x+nxi, y+nxj, PT_BOMB);
|
||||||
|
if(nb!=-1){
|
||||||
|
parts[nb].tmp = 1;
|
||||||
|
parts[nb].life = 50;
|
||||||
|
parts[nb].temp = MAX_TEMP;
|
||||||
|
parts[nb].vx = rand()%20-10;
|
||||||
|
parts[nb].vy = rand()%20-10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(nxj=-rad; nxj<=rad; nxj++)
|
||||||
|
for(nxi=-rad; nxi<=rad; nxi++)
|
||||||
|
if((pow(nxi,2))/(pow(rad,2))+(pow(nxj,2))/(pow(rad,2))<=1){
|
||||||
|
delete_part(x+nxi, y+nxj);
|
||||||
|
pv[(y+nxj)/CELL][(x+nxi)/CELL] += 0.1f;
|
||||||
|
int nb = create_part(-1, x+nxi, y+nxj, PT_BOMB);
|
||||||
|
if(nb!=-1){
|
||||||
|
parts[nb].tmp = 2;
|
||||||
|
parts[nb].life = 2;
|
||||||
|
parts[nb].temp = MAX_TEMP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//create_parts(x, y, 9, 9, PT_BOMB);
|
||||||
|
//create_parts(x, y, 8, 8, PT_NONE);
|
||||||
|
parts[i].type = PT_NONE;
|
||||||
|
goto killed;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if(t==PT_FWRK)
|
else if(t==PT_FWRK)
|
||||||
{
|
{
|
||||||
if((parts[i].temp>400&&(9+parts[i].temp/40)>rand()%100000&&parts[i].life==0&&!pmap[y-1][x])||parts[i].ctype==PT_DUST)
|
if((parts[i].temp>400&&(9+parts[i].temp/40)>rand()%100000&&parts[i].life==0&&!pmap[y-1][x])||parts[i].ctype==PT_DUST)
|
||||||
|
Reference in New Issue
Block a user