Added FRZZ FRZW GRAV. add square brush, hit tab to switch between the two. pipe ctype saves.

This commit is contained in:
Philip
2010-11-18 23:27:24 -05:00
parent 5e56850682
commit 435f71c781
5 changed files with 133 additions and 23 deletions

View File

@@ -58,6 +58,10 @@ extern unsigned char ZSIZE;
#define NGOL 13
#define CIRCLE_BRUSH 0
#define SQUARE_BRUSH 1
#define BRUSH_NUM 2
#ifdef PIX16
typedef unsigned short pixel;
#else
@@ -116,6 +120,7 @@ int gol2[XRES][YRES][NGOL];
int SEC;
int SEC2;
int REPLACE_MODE;
int CURRENT_BRUSH;
extern sign signs[MAXSIGNS];
extern stamp stamps[STAMP_MAX];
extern int stamp_count;

View File

@@ -140,7 +140,10 @@
#define PT_PUMP 97
#define PT_FWRK 98
#define PT_PIPE 99
#define PT_NUM 100
#define PT_FRZZ 100
#define PT_FRZW 101
#define PT_GRAV 102
#define PT_NUM 103
#define R_TEMP 22
#define MAX_TEMP 9999
@@ -331,6 +334,9 @@ static const part_type ptypes[PT_NUM] =
{"PUMP", PIXPACK(0x9EA3B6), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.1f * CFDS, 0, 7, 0, 0, 10, 1, 100, SC_SPECIAL, 273.15f, 0, "Changes pressure to its temp (use HEAT/COOL).", TYPE_SOLID},
{"FWRK", PIXPACK(0x666666), 0.4f, 0.01f * CFDS, 0.99f, 0.95f, 0.0f, 0.4f, 0.00f, 0.000f * CFDS, 1, 0, 0, 0, 0, 1, 97, SC_EXPLOSIVE, R_TEMP+0.0f+273.15f, 100, "First fireworks made, activated by heat/neutrons."},
{"PIPE", PIXPACK(0x444444), 0.0f, 0.00f * CFDS, 0.95f, 0.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 0, 0, 0, 0, 0, 1, 100, SC_SPECIAL, 273.15f, 0, "Moves elements around, read the post on how to use.", TYPE_SOLID},
{"FRZZ", PIXPACK(0xC0E0FF), 0.7f, 0.01f * CFDS, 0.96f, 0.90f, -0.1f, 0.05f, 0.01f, -0.00005f* CFDS,1, 0, 0, 0, 20, 1, 50, SC_POWDERS, 90.0f, 46, "FREEZE", TYPE_PART},
{"FRZW", PIXPACK(0x1020C0), 0.6f, 0.01f * CFDS, 0.98f, 0.95f, 0.0f, 0.1f, 0.00f, 0.000f * CFDS, 2, 0, 0, 0, 20, 1, 30, SC_LIQUID, 90.0f, 29, "FREEZE WATER", TYPE_LIQUID},
{"GRAV", PIXPACK(0xFFE0A0), 0.7f, 0.00f * CFDS, 1.00f, 1.00f, 0.0f, 0.0f, 0.00f, 0.000f * CFDS, 1, 10, 0, 0, 30, 1, 85, SC_POWDERS, R_TEMP+0.0f +273.15f, 70, "Very light dust. Flammable.", TYPE_PART},
//Name Colour Advec Airdrag Airloss Loss Collid Grav Diffus Hotair Fal Burn Exp Mel Hrd M Weights Section H Ins(real world, by triclops200) Description
};
@@ -434,8 +440,11 @@ static part_state pstates[PT_NUM] =
/* LOVE */ {ST_GAS, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* WTF */ {ST_LIQUID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* WARP */ {ST_GAS , PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PUMP */ {ST_GAS , PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FWRK */ {ST_GAS , PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* PUMP */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FWRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FWRK */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FRZZ */ {ST_SOLID, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
/* FRZW */ {ST_LIQUID, PT_ICEI, 53.0f, PT_NONE, 0.0f, PT_NONE, 0.0f, PT_NONE, 0.0f},
};
static int grule[NGOL][9] =
{

View File

@@ -1489,6 +1489,30 @@ void draw_parts(pixel *vid)
else
blendpixel(vid,x,y,parts[i].tmp,parts[i].ctype,parts[i].flags,255);
}
else if(t==PT_GRAV)
{
cr = 20;
cg = 20;
cb = 20;
if(parts[i].vx>0)
cr += (parts[i].vx)*60;
if(parts[i].vy>0)
cb += (parts[i].vy)*60;
if(parts[i].vx<0)
cg -= (parts[i].vx)*60;
if(parts[i].vy<0)
{
cr -= (parts[i].vy)*30;
cg -= (parts[i].vy)*30;
}
if(cr>255)
cr=255;
if(cg>255)
cg=255;
if(cb>255)
cb=255;
blendpixel(vid, nx, ny, cr, cg, cb, 255);
}
else if(t==PT_PIPE)
{
if(parts[i].ctype==2)
@@ -2821,7 +2845,15 @@ void render_cursor(pixel *vid, int x, int y, int t, int r)
{
if(r<=0)
xor_pixel(x, y, vid);
else
else if(CURRENT_BRUSH==SQUARE_BRUSH)
for(j=-r; j<=r; j++)
{
xor_pixel(x+r, y+j, vid);
xor_pixel(x-r, y+j, vid);
if(abs(j)<r) xor_pixel(x+j, y-r, vid);
if(abs(j)<r) xor_pixel(x+j, y+r, vid);
}
else if(CURRENT_BRUSH==CIRCLE_BRUSH)
for(j=0; j<=r; j++)
for(i=0; i<=r; i++)
if(i*i+j*j<=r*r && ((i+1)*(i+1)+j*j>r*r || i*i+(j+1)*(j+1)>r*r))

View File

@@ -325,7 +325,7 @@ void *build_save(int *size, int x0, int y0, int w, int h)
for(j=0; j<w*h; j++)
{
i = m[j];
if(i && (parts[i-1].type==PT_CLNE || parts[i-1].type==PT_PCLN || parts[i-1].type==PT_SPRK || parts[i-1].type==PT_LAVA))
if(i && (parts[i-1].type==PT_CLNE || parts[i-1].type==PT_PCLN || parts[i-1].type==PT_SPRK || parts[i-1].type==PT_LAVA || parts[i-1].type==PT_PIPE))
d[p++] = parts[i-1].ctype;
}
@@ -644,7 +644,7 @@ int parse_save(void *save, int size, int replace, int x0, int y0)
{
i = m[j];
ty = d[pty+j];
if(i && (ty==PT_CLNE || (ty==PT_PCLN && ver>=43) || (ty==PT_SPRK && ver>=21) || (ty==PT_LAVA && ver>=34)))
if(i && (ty==PT_CLNE || (ty==PT_PCLN && ver>=43) || (ty==PT_SPRK && ver>=21) || (ty==PT_LAVA && ver>=34) || (ty==PT_PIPE && ver>=43)))
{
if(p >= size)
goto corrupt;
@@ -1276,6 +1276,10 @@ int main(int argc, char *argv[])
{
set_cmode(CM_CRACK);
}
if(sdl_key==SDLK_TAB)
{
CURRENT_BRUSH =(CURRENT_BRUSH + 1)%BRUSH_NUM ;
}
if(sdl_key==SDLK_LEFTBRACKET) {
if(sdl_zoom_trig==1)
{

View File

@@ -498,6 +498,8 @@ inline int create_part(int p, int x, int y, int t)
parts[i].life = 110;
parts[i].tmp = 50;
}
if(t==PT_FRZW)
parts[i].life = 100;
if(t==PT_PIPE)
parts[i].life = 60;
if(t==PT_BCOL)
@@ -988,7 +990,7 @@ void update_particles_i(pixel *vid, int start, int inc)
{
if(!(parts[i].life==10&&(parts[i].type==PT_LCRY||parts[i].type==PT_PCLN||parts[i].type==PT_HSWC)))
parts[i].life--;
if(parts[i].life<=0 && t!=PT_METL && t!=PT_IRON && t!=PT_FIRW && t!=PT_PCLN && t!=PT_HSWC && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_NTCT && t!=PT_PTCT && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY && t!=PT_INWR && t!=PT_GLOW && t!= PT_FOG && t!=PT_PIPE)
if(parts[i].life<=0 && t!=PT_METL && t!=PT_IRON && t!=PT_FIRW && t!=PT_PCLN && t!=PT_HSWC && t!=PT_WATR && t!=PT_RBDM && t!=PT_LRBD && t!=PT_SLTW && t!=PT_BRMT && t!=PT_PSCN && t!=PT_NSCN && t!=PT_NTCT && t!=PT_PTCT && t!=PT_BMTL && t!=PT_SPRK && t!=PT_LAVA && t!=PT_ETRD&&t!=PT_LCRY && t!=PT_INWR && t!=PT_GLOW && t!= PT_FOG && t!=PT_PIPE && t!=PT_FRZW &&(t!=PT_ICEI&&parts[i].ctype!=PT_FRZW))
{
kill_part(i);
continue;
@@ -1456,6 +1458,13 @@ void update_particles_i(pixel *vid, int start, int inc)
}
else if(t==PT_ICEI || t==PT_SNOW)
{
if(parts[i].ctype==PT_FRZW)
{
parts[i].temp -= 1.0f;
if(parts[i].temp<0)
parts[i].temp = 0;
}
for(nx=-2; nx<3; nx++)
for(ny=-2; ny<3; ny++)
if(x+nx>=0 && y+ny>0 &&
@@ -2428,6 +2437,57 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
}
else if(t==PT_FRZZ)
{
for(nx=-1; nx<2; nx++)
for(ny=-1; ny<2; 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_WATR&&5>rand()%100)
{
parts[r>>8].type=PT_FRZW;
parts[r>>8].life = 100;
t = parts[i].type = PT_NONE;
}
}
}
else if(t==PT_FRZW)
{
for(nx=-1; nx<2; nx++)
for(ny=-1; ny<2; 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_WATR&&5>rand()%70)
{
parts[r>>8].type=PT_FRZW;
}
}
if(parts[i].life==0&&13>rand()%2500)
{
t = parts[i].type=PT_ICEI;
parts[i].ctype=PT_FRZW;
parts[i].temp -= 200.0f;
if(parts[i].temp<0)
parts[i].temp = 0;
}
else if((100-(parts[i].life))>rand()%50000)
{
t = parts[i].type=PT_ICEI;
parts[i].ctype=PT_FRZW;
parts[i].temp -= 200.0f;
if(parts[i].temp<0)
parts[i].temp = 0;
}
}
else if(t==PT_PCLN)
{
for(nx=-2; nx<3; nx++)
@@ -4342,7 +4402,7 @@ int create_parts(int x, int y, int r, int c)
{
for(j=-r; j<=r; j++)
for(i=-r; i<=r; i++)
if(i*i+j*j<=r*r)
if((CURRENT_BRUSH==CIRCLE_BRUSH && i*i+j*j<=r*r)||CURRENT_BRUSH==SQUARE_BRUSH)
delete_part(x+i, y+j);
return 1;
}
@@ -4350,7 +4410,7 @@ int create_parts(int x, int y, int r, int c)
{
for(j=-r; j<=r; j++)
for(i=-r; i<=r; i++)
if(i*i+j*j<=r*r)
if((CURRENT_BRUSH==CIRCLE_BRUSH && i*i+j*j<=r*r)||CURRENT_BRUSH==SQUARE_BRUSH)
delete_part(x+i, y+j);
if(c==0)
return 1;
@@ -4359,7 +4419,7 @@ int create_parts(int x, int y, int r, int c)
{
for(j=-r; j<=r; j++)
for(i=-r; i<=r; i++)
if(i*i+j*j<=r*r)
if((CURRENT_BRUSH==CIRCLE_BRUSH && i*i+j*j<=r*r)||CURRENT_BRUSH==SQUARE_BRUSH)
create_part(-1, x+i, y+j, c);
return 1;
}
@@ -4370,7 +4430,7 @@ int create_parts(int x, int y, int r, int c)
SLALT = 0;
for(j=-r; j<=r; j++)
for(i=-r; i<=r; i++)
if(i*i+j*j<=r*r)
if((CURRENT_BRUSH==CIRCLE_BRUSH && i*i+j*j<=r*r)||CURRENT_BRUSH==SQUARE_BRUSH)
delete_part(x+i, y+j);
SLALT = stemp;
return 1;
@@ -4378,7 +4438,7 @@ int create_parts(int x, int y, int r, int c)
for(j=-r; j<=r; j++)
for(i=-r; i<=r; i++)
if(i*i+j*j<=r*r)
if((CURRENT_BRUSH==CIRCLE_BRUSH && i*i+j*j<=r*r)||CURRENT_BRUSH==SQUARE_BRUSH)
if(create_part(-1, x+i, y+j, c)==-1)
f = 1;
return !f;