From 38742f08ba1ea0c5a4f6194bba3949a149825bb2 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 5 Oct 2010 18:48:40 +0100 Subject: [PATCH] Fixed Powered clone saving and suitibility as a light emitter. Fixed Photons igniting Insulator --- src/main.c | 4 ++-- src/powder.c | 24 +++++++++++++++++++----- 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/src/main.c b/src/main.c index f7ffec97b..b91d86dd7 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=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 12dbe59e2..8cd0f73c4 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) {