Fixed Powered clone saving and suitibility as a light emitter. Fixed Photons igniting Insulator

This commit is contained in:
Simon 2010-10-05 18:48:40 +01:00
parent 6627e418b2
commit 38742f08ba
2 changed files with 21 additions and 7 deletions

View File

@ -322,7 +322,7 @@ void *build_save(int *size, int x0, int y0, int w, int h)
for(j=0; j<w*h; j++) for(j=0; j<w*h; j++)
{ {
i = m[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; 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]; i = m[j];
ty = d[pty+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) if(p >= size)
goto corrupt; goto corrupt;

View File

@ -500,9 +500,9 @@ inline int create_part(int p, int x, int y, int t)
} }
if(t==PT_PHOT) if(t==PT_PHOT)
{ {
float a = (rand()%8) * 0.78540f; float a = (rand()%8) * 0.78540f;
parts[i].life = 680; parts[i].life = 680;
parts[i].ctype = 0x3FFFFFFF; parts[i].ctype = 0x3FFFFFFF;
parts[i].vx = 3.0f*cosf(a); parts[i].vx = 3.0f*cosf(a);
parts[i].vy = 3.0f*sinf(a); parts[i].vy = 3.0f*sinf(a);
} }
@ -1968,6 +1968,7 @@ void update_particles_i(pixel *vid, int start, int inc)
continue; continue;
rt = parts[r>>8].type; 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) && 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)) && (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)) 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) (pmap[y+ny][x+nx]&0xFF)!=0xFF)
parts[i].ctype = pmap[y+ny][x+nx]&0xFF; parts[i].ctype = pmap[y+ny][x+nx]&0xFF;
} }
else else {
create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype); create_part(-1, x+rand()%3-1, y+rand()%3-1, parts[i].ctype);
}
} }
if(parts[i].type==PT_PCLN) if(parts[i].type==PT_PCLN)
{ {
@ -2567,7 +2570,18 @@ killed:
(pmap[y+ny][x+nx]&0xFF)!=0xFF) (pmap[y+ny][x+nx]&0xFF)!=0xFF)
parts[i].ctype = pmap[y+ny][x+nx]&0xFF; parts[i].ctype = pmap[y+ny][x+nx]&0xFF;
if(parts[i].ctype && parts[i].life==10) 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) if(t==PT_YEST)
{ {