summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon <simon@hardwired.org.uk>2010-10-05 17:48:40 (GMT)
committer Simon <simon@hardwired.org.uk>2010-10-05 17:48:40 (GMT)
commit38742f08ba1ea0c5a4f6194bba3949a149825bb2 (patch)
treeac93cb329d0febe63762a97d04c82095705434ee /src
parent6627e418b2fd887c7125537930a4c40731d698af (diff)
downloadpowder-38742f08ba1ea0c5a4f6194bba3949a149825bb2.zip
powder-38742f08ba1ea0c5a4f6194bba3949a149825bb2.tar.gz
Fixed Powered clone saving and suitibility as a light emitter. Fixed Photons igniting Insulator
Diffstat (limited to 'src')
-rwxr-xr-xsrc/main.c4
-rw-r--r--src/powder.c24
2 files changed, 21 insertions, 7 deletions
diff --git a/src/main.c b/src/main.c
index f7ffec9..b91d86d 100755
--- a/src/main.c
+++ b/src/main.c
@@ -322,7 +322,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_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))
d[p++] = parts[i-1].ctype;
}
@@ -636,7 +636,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_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)))
{
if(p >= size)
goto corrupt;
diff --git a/src/powder.c b/src/powder.c
index 12dbe59..8cd0f73 100644
--- a/src/powder.c
+++ b/src/powder.c
@@ -500,9 +500,9 @@ inline int create_part(int p, int x, int y, int t)
}
if(t==PT_PHOT)
{
- float a = (rand()%8) * 0.78540f;
+ float a = (rand()%8) * 0.78540f;
parts[i].life = 680;
- parts[i].ctype = 0x3FFFFFFF;
+ parts[i].ctype = 0x3FFFFFFF;
parts[i].vx = 3.0f*cosf(a);
parts[i].vy = 3.0f*sinf(a);
}
@@ -1968,6 +1968,7 @@ void update_particles_i(pixel *vid, int start, int inc)
continue;
rt = parts[r>>8].type;
if((a || ptypes[rt].explosive) && ((rt!=PT_RBDM && rt!=PT_LRBD && rt!=PT_INSL && rt!=PT_SWCH) || t!=PT_SPRK) &&
+ !(t==PT_PHOT && rt==PT_INSL) &&
(t!=PT_LAVA || parts[i].life>0 || (rt!=PT_STNE && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_METL && rt!=PT_ETRD && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SWCH && rt!=PT_INWR)) &&
ptypes[rt].flammable && (ptypes[rt].flammable + (int)(pv[(y+ny)/CELL][(x+nx)/CELL]*10.0f))>(rand()%1000))
{
@@ -2547,8 +2548,10 @@ killed:
(pmap[y+ny][x+nx]&0xFF)!=0xFF)
parts[i].ctype = pmap[y+ny][x+nx]&0xFF;
}
- else
- create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
+ else {
+ create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
+ }
+
}
if(parts[i].type==PT_PCLN)
{
@@ -2567,7 +2570,18 @@ killed:
(pmap[y+ny][x+nx]&0xFF)!=0xFF)
parts[i].ctype = pmap[y+ny][x+nx]&0xFF;
if(parts[i].ctype && parts[i].life==10)
- create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
+ if(parts[i].ctype==PT_PHOT){
+ for(nx=-1; nx<2; nx++)
+ for(ny=-1; ny<2; ny++){
+ r = create_part(-1, x+nx, y+ny, parts[i].ctype);
+ if(r!=-1){
+ parts[r].vx = nx*3;
+ parts[r].vy = ny*3;
+ }
+ }
+ } else {
+ create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
+ }
}
if(t==PT_YEST)
{