summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCracker64 <cracker642@gmail.com>2010-11-30 03:42:36 (GMT)
committer Cracker64 <cracker642@gmail.com>2010-11-30 03:42:36 (GMT)
commitbb16ffa2bbef12d8a8b1c151b3d987e272420675 (patch)
treef0d135f964f0f111fbd686fd4507b6f6f5395be1 /src
parent77a17ecaeedb2e7e505527848e8bf4d1465ac529 (diff)
downloadpowder-bb16ffa2bbef12d8a8b1c151b3d987e272420675.zip
powder-bb16ffa2bbef12d8a8b1c151b3d987e272420675.tar.gz
PUMP is now powered and blue, fixed some wall probems, portals are more random, maybe fixed love for mac?
Diffstat (limited to 'src')
-rw-r--r--src/graphics.c16
-rw-r--r--src/main.c6
-rw-r--r--src/powder.c83
3 files changed, 87 insertions, 18 deletions
diff --git a/src/graphics.c b/src/graphics.c
index d74651e..81bc756 100644
--- a/src/graphics.c
+++ b/src/graphics.c
@@ -2086,6 +2086,22 @@ void draw_parts(pixel *vid)
blendpixel(vid, nx-1, ny+1, GR, 10, 10, 112);
}
}
+ else if(t==PT_PUMP)
+ {
+ uint8 GR = 0x3B+(parts[i].life*19);
+ vid[ny*(XRES+BARSIZE)+nx] = PIXRGB(10, 10, GR);
+ if(cmode == CM_BLOB) {
+ blendpixel(vid, nx+1, ny, 10, 10, GR, 223);
+ blendpixel(vid, nx-1, ny, 10, 10, GR, 223);
+ blendpixel(vid, nx, ny+1, 10, 10, GR, 223);
+ blendpixel(vid, nx, ny-1, 10, 10, GR, 223);
+
+ blendpixel(vid, nx+1, ny-1, 10, 10, GR, 112);
+ blendpixel(vid, nx-1, ny-1, 10, 10, GR, 112);
+ blendpixel(vid, nx+1, ny+1, 10, 10, GR, 112);
+ blendpixel(vid, nx-1, ny+1, 10, 10, GR, 112);
+ }
+ }
else if(t==PT_PLSM)
{
float ttemp = (float)parts[i].life;
diff --git a/src/main.c b/src/main.c
index b12dc25..ebb39ba 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1895,7 +1895,7 @@ int main(int argc, char *argv[])
{
c = (b&1) ? sl : sr;
su = c;
- if(c==126)
+ if(c==WL_SIGN+100)
{
if(!bq)
add_sign_ui(vid_buf, x, y);
@@ -1905,7 +1905,7 @@ int main(int argc, char *argv[])
if(lm == 1)
{
xor_line(lx, ly, x, y, vid_buf);
- if(c==127 && lx>=0 && ly>=0 && lx<XRES && ly<YRES && bmap[ly/CELL][lx/CELL]==WL_FAN)
+ if(c==WL_FAN+100 && lx>=0 && ly>=0 && lx<XRES && ly<YRES && bmap[ly/CELL][lx/CELL]==WL_FAN)
{
nfvx = (x-lx)*0.005f;
nfvy = (y-ly)*0.005f;
@@ -2022,7 +2022,7 @@ int main(int argc, char *argv[])
su = c;
if(lm == 1)
{
- if(c!=127 || lx<0 || ly<0 || lx>=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=WL_FAN)
+ if(c!=WL_FAN+100 || lx<0 || ly<0 || lx>=XRES || ly>=YRES || bmap[ly/CELL][lx/CELL]!=WL_FAN)
create_line(lx, ly, x, y, bsx, bsy, c);
}
else
diff --git a/src/powder.c b/src/powder.c
index bd0b7e6..32dc3a9 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -515,6 +515,8 @@ inline int create_part(int p, int x, int y, int t)
parts[i].life = 50;
parts[i].tmp = 50;
}
+ if(t==PT_PUMP)
+ parts[i].life= 10;
if(t==PT_FSEP)
parts[i].life = 50;
if(t==PT_COAL) {
@@ -954,7 +956,7 @@ void update_particles_i(pixel *vid, int start, int inc)
}
if(!rt&&loverule[nnx][nny]==1)
create_part(-1,nx+nnx,ny+nny,PT_LOVE);
- if(parts[rt>>8].type==PT_LOVE&&loverule[nnx][nny]==0)
+ else if(parts[rt>>8].type==PT_LOVE&&loverule[nnx][nny]==0)
parts[rt>>8].type=PT_NONE;
}
@@ -1058,9 +1060,9 @@ void update_particles_i(pixel *vid, int start, int inc)
if(parts[i].life && t!=PT_ACID && t!=PT_COAL && t!=PT_WOOD && t!=PT_NBLE && t!=PT_SWCH && t!=PT_STKM && t!=PT_FUSE && t!=PT_FSEP && t!=PT_BCOL && t!=PT_GOL && t!=PT_CRAC && t!=PT_DEUT)
{
- if(!(parts[i].life==10&&(parts[i].type==PT_LCRY||parts[i].type==PT_PCLN||parts[i].type==PT_HSWC)) && !(parts[i].life%4==0 && parts[i].type==PT_INST))
+ if(!(parts[i].life==10&&(parts[i].type==PT_LCRY||parts[i].type==PT_PCLN||parts[i].type==PT_HSWC||parts[i].type==PT_PUMP)) && !(parts[i].life%4==0 && parts[i].type==PT_INST))
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 && t!=PT_FRZW &&(t!=PT_ICEI&&parts[i].ctype!=PT_FRZW)&&t!=PT_INST)
+ if(parts[i].life<=0 && t!=PT_METL && t!=PT_IRON && t!=PT_FIRW && t!=PT_PCLN && t!=PT_HSWC && t!=PT_PUMP && 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)&&t!=PT_INST)
{
kill_part(i);
continue;
@@ -1122,7 +1124,7 @@ void update_particles_i(pixel *vid, int start, int inc)
}
if(t==PT_GAS||t==PT_NBLE||t==PT_PUMP)
{
- if(t==PT_PUMP)
+ if(t==PT_PUMP && parts[i].life==10)
{
if(parts[i].temp>=256.0+273.15)
parts[i].temp=256.0+273.15;
@@ -1130,14 +1132,14 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[i].temp = -256.0+273.15;
if(pv[y/CELL][x/CELL]<(parts[i].temp-273.15))
- pv[y/CELL][x/CELL] += ptypes[t].hotair*((parts[i].temp-273.15)-pv[y/CELL][x/CELL]);
+ pv[y/CELL][x/CELL] += 0.1f*((parts[i].temp-273.15)-pv[y/CELL][x/CELL]);
if(y+CELL<YRES && pv[y/CELL+1][x/CELL]<(parts[i].temp-273.15))
- pv[y/CELL+1][x/CELL] += ptypes[t].hotair*((parts[i].temp-273.15)-pv[y/CELL+1][x/CELL]);
+ pv[y/CELL+1][x/CELL] += 0.1f*((parts[i].temp-273.15)-pv[y/CELL+1][x/CELL]);
if(x+CELL<XRES)
{
- pv[y/CELL][x/CELL+1] += ptypes[t].hotair*((parts[i].temp-273.15)-pv[y/CELL][x/CELL+1]);
+ pv[y/CELL][x/CELL+1] += 0.1f*((parts[i].temp-273.15)-pv[y/CELL][x/CELL+1]);
if(y+CELL<YRES)
- pv[y/CELL+1][x/CELL+1] += ptypes[t].hotair*((parts[i].temp-273.15)-pv[y/CELL+1][x/CELL+1]);
+ pv[y/CELL+1][x/CELL+1] += 0.1f*((parts[i].temp-273.15)-pv[y/CELL+1][x/CELL+1]);
}
}
else
@@ -2707,6 +2709,7 @@ void update_particles_i(pixel *vid, int start, int inc)
else if(parts[r>>8].type==PT_SPRK&&(parts[r>>8].ctype==PT_PSCN)&&(parts[r>>8].life>=3)&&parts[i].life%4==0)
{
flood_parts(x,y,PT_INST2,PT_INST,-1);
+ parts[r>>8].type==parts[r>>8].ctype;
}
else if(parts[r>>8].type==PT_NSCN&&parts[r>>8].life==0&&(parts[i].life>=4)&&parts[i].life%4<=1)
{
@@ -2720,11 +2723,19 @@ void update_particles_i(pixel *vid, int start, int inc)
parts[r>>8].life=4;
flood_parts(x,y,PT_INST3,PT_INST,-1);
}
+ //else if(parts[r>>8].type==PT_INST&&parts[r>>8].life%4==0&&parts[r>>8].life>parts[i].life)
+ //parts[i].life --;
}
}
- else if(t==PT_INST2 || t==PT_INST3)
+ else if(t==PT_INST2)
{
- t = parts[pmap[y][x]>>8].type=PT_INST;
+ if(parts[i].life%4==0)
+ t = parts[pmap[y][x]>>8].type=PT_INST;
+ }
+ else if(t==PT_INST3)
+ {
+ if(parts[i].life%4!=0)
+ t = parts[pmap[y][x]>>8].type=PT_INST;
}
else if(t==PT_PRTI)
{
@@ -2740,9 +2751,9 @@ void update_particles_i(pixel *vid, int start, int inc)
continue;
if(parts[r>>8].type!=PT_PRTI && parts[r>>8].type!=PT_PRTO && (ptypes[parts[r>>8].type].falldown!= 0 || pstates[parts[r>>8].type].state == ST_GAS))
for(int nnx=0;nnx<8;nnx++)
- if(!portal[count][nnx])
+ if(!portal[count-1][nnx])
{
- portal[count][nnx] = parts[r>>8].type;
+ portal[count-1][nnx] = parts[r>>8].type;
parts[r>>8].type = PT_NONE;
break;
}
@@ -2763,12 +2774,19 @@ void update_particles_i(pixel *vid, int start, int inc)
if(!r)
{
for(int nnx =0 ;nnx<8;nnx++)
- if(portal[count][nnx])
+ {
+ int randomness = count + rand()%3-1;
+ if(randomness<1)
+ randomness=1;
+ if(randomness>8)
+ randomness=8;
+ if(portal[randomness-1][nnx])
{
- create_part(-1,x+nx,y+ny,portal[count][nnx]);
- portal[count][nnx] = 0;
+ create_part(-1,x+nx,y+ny,portal[randomness-1][nnx]);
+ portal[randomness-1][nnx] = 0;
break;
}
+ }
}
}
}
@@ -2842,6 +2860,41 @@ void update_particles_i(pixel *vid, int start, int inc)
}
}
}
+ else if(t==PT_PUMP)
+ {
+ 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;
+ rt = parts[r>>8].type;
+ if(rt==PT_SPRK)
+ {
+ if(parts[r>>8].ctype==PT_PSCN)
+ {
+ parts[i].life = 10;
+ }
+ else if(parts[r>>8].ctype==PT_NSCN)
+ {
+ parts[i].life = 9;
+ }
+ }
+ if(rt==PT_PUMP)
+ {
+ if(parts[i].life==10&&parts[r>>8].life<10&&parts[r>>8].life>0)
+ {
+ parts[i].life = 9;
+ }
+ else if(parts[i].life==0&&parts[r>>8].life==10)
+ {
+ parts[i].life = 10;
+ }
+ }
+ }
+ }
else if(t==PT_AMTR)
{
for(nx=-1; nx<2; nx++)