summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilip <philip@philip-linuxlaptop.(none)>2010-11-19 04:27:24 (GMT)
committer Philip <philip@philip-linuxlaptop.(none)>2010-11-19 04:27:24 (GMT)
commit435f71c7814cf9d4c55168852caf21ac80674490 (patch)
treecee001bacce34a5dfc7258d658559e9d31411534 /src
parent5e56850682e033a202f633319c08965b0ed1ac69 (diff)
downloadpowder-435f71c7814cf9d4c55168852caf21ac80674490.zip
powder-435f71c7814cf9d4c55168852caf21ac80674490.tar.gz
Added FRZZ FRZW GRAV. add square brush, hit tab to switch between the two. pipe ctype saves.
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c34
-rw-r--r--src/main.c8
-rw-r--r--src/powder.c72
3 files changed, 105 insertions, 9 deletions
diff --git a/src/graphics.c b/src/graphics.c
index c58d4f2..ee89625 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -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))
diff --git a/src/main.c b/src/main.c
index 17ccbab..beedda7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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)
{
diff --git a/src/powder.c b/src/powder.c
index 2adf880..8657f6a 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -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;