jacksonmj: "Allow ELEC to pass through GLOW, fixes ELEC->PHOT reaction in GLOW." f162984e22e5 + some parts of "Misc small fixes" 95cf5bd67c2b

This commit is contained in:
jacob1 2014-11-21 15:03:10 -05:00
parent a182e925fe
commit e20f6b101b
7 changed files with 28 additions and 18 deletions

View File

@ -2079,6 +2079,7 @@ void Simulation::init_can_move()
can_move[PT_NEUT][PT_INVIS] = 2; can_move[PT_NEUT][PT_INVIS] = 2;
can_move[PT_ELEC][PT_LCRY] = 2; can_move[PT_ELEC][PT_LCRY] = 2;
can_move[PT_ELEC][PT_EXOT] = 2; can_move[PT_ELEC][PT_EXOT] = 2;
can_move[PT_ELEC][PT_GLOW] = 2;
can_move[PT_PHOT][PT_LCRY] = 3; //varies according to LCRY life can_move[PT_PHOT][PT_LCRY] = 3; //varies according to LCRY life
can_move[PT_PHOT][PT_BIZR] = 2; can_move[PT_PHOT][PT_BIZR] = 2;
@ -2274,12 +2275,20 @@ int Simulation::try_move(int i, int x, int y, int nx, int ny)
if (rand() < RAND_MAX/10) if (rand() < RAND_MAX/10)
create_cherenkov_photon(i); create_cherenkov_photon(i);
} }
else if (parts[i].type == PT_ELEC)
{
if ((r&0xFF) == PT_GLOW)
{
part_change_type(i, x, y, PT_PHOT);
parts[i].ctype = 0x3FFFFFFF;
}
}
else if (parts[i].type == PT_PROT) else if (parts[i].type == PT_PROT)
{ {
if ((r&0xFF) == PT_INVIS) if ((r&0xFF) == PT_INVIS)
part_change_type(i, x, y, PT_NEUT); part_change_type(i, x, y, PT_NEUT);
} }
else if ((parts[i].type==PT_BIZR || parts[i].type==PT_BIZRG)) else if ((parts[i].type == PT_BIZR || parts[i].type == PT_BIZRG))
{ {
if ((r&0xFF) == PT_FILT) if ((r&0xFF) == PT_FILT)
parts[i].ctype = Element_FILT::interactWavelengths(&parts[r>>8], parts[i].ctype); parts[i].ctype = Element_FILT::interactWavelengths(&parts[r>>8], parts[i].ctype);

View File

@ -82,11 +82,6 @@ int Element_BIZR::update(UPDATE_FUNC_ARGS)
} }
} }
} }
if(((r = sim->photons[y][x])&0xFF)==PT_PHOT)//this should be in movement checks?
{
sim->part_change_type(r>>8, x, y, PT_ELEC);
parts[r>>8].ctype = 0;
}
return 0; return 0;
} }

View File

@ -107,10 +107,6 @@ int Element_ELEC::update(UPDATE_FUNC_ARGS)
parts[r>>8].tmp2 += 5; parts[r>>8].tmp2 += 5;
parts[r>>8].life = 1000; parts[r>>8].life = 1000;
break; break;
case PT_GLOW:
if (!rx && !ry)//if on GLOW
sim->part_change_type(i, x, y, PT_PHOT);
break;
case PT_NONE: //seems to speed up ELEC even if it isn't used case PT_NONE: //seems to speed up ELEC even if it isn't used
break; break;
default: default:

View File

@ -116,7 +116,7 @@ int Element_EXOT::update(UPDATE_FUNC_ARGS)
if (parts[i].life < 1001) if (parts[i].life < 1001)
{ {
sim->part_change_type(i, x, y, PT_WARP); sim->part_change_type(i, x, y, PT_WARP);
return 0; return 1;
} }
} }
else if(parts[i].life < 1001) else if(parts[i].life < 1001)
@ -126,7 +126,7 @@ int Element_EXOT::update(UPDATE_FUNC_ARGS)
{ {
parts[i].tmp2 = 6000; parts[i].tmp2 = 6000;
sim->part_change_type(i, x, y, PT_WARP); sim->part_change_type(i, x, y, PT_WARP);
return 0; return 1;
} }
if (parts[i].tmp2 > 100) if (parts[i].tmp2 > 100)
{ {

View File

@ -146,7 +146,7 @@ int Element_FIRE::update(UPDATE_FUNC_ARGS)
sim->pv[y/CELL][x/CELL] += 0.25f * CFDS; sim->pv[y/CELL][x/CELL] += 0.25f * CFDS;
} }
} }
if (sim->legacy_enable) if (sim->legacy_enable && t!=PT_SPRK) // SPRK has no legacy reactions
updateLegacy(UPDATE_FUNC_SUBCALL_ARGS); updateLegacy(UPDATE_FUNC_SUBCALL_ARGS);
return 0; return 0;
} }
@ -167,12 +167,16 @@ int Element_FIRE::updateLegacy(UPDATE_FUNC_ARGS) {
lpv = (int)sim->pv[(y+ry)/CELL][(x+rx)/CELL]; lpv = (int)sim->pv[(y+ry)/CELL][(x+rx)/CELL];
if (lpv < 1) lpv = 1; if (lpv < 1) lpv = 1;
if (t!=PT_SPRK && sim->elements[rt].Meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_IRON && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) &&sim->elements[rt].Meltable*lpv>(rand()%1000)) if (sim->elements[rt].Meltable && ((rt!=PT_RBDM && rt!=PT_LRBD) || t!=PT_SPRK) && ((t!=PT_FIRE&&t!=PT_PLSM) || (rt!=PT_METL && rt!=PT_IRON && rt!=PT_ETRD && rt!=PT_PSCN && rt!=PT_NSCN && rt!=PT_NTCT && rt!=PT_PTCT && rt!=PT_BMTL && rt!=PT_BRMT && rt!=PT_SALT && rt!=PT_INWR)) &&sim->elements[rt].Meltable*lpv>(rand()%1000))
{ {
if (t!=PT_LAVA || parts[i].life>0) if (t!=PT_LAVA || parts[i].life>0)
{ {
parts[r>>8].ctype = (rt==PT_BRMT)?PT_BMTL:(r&0xFF); if (rt==PT_BRMT)
parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype; parts[r>>8].ctype = PT_BMTL;
else if (rt==PT_SAND)
parts[r>>8].ctype = PT_GLAS;
else
parts[r>>8].ctype = rt;
sim->part_change_type(r>>8,x+rx,y+ry,PT_LAVA); sim->part_change_type(r>>8,x+rx,y+ry,PT_LAVA);
parts[r>>8].life = rand()%120+240; parts[r>>8].life = rand()%120+240;
} }
@ -184,7 +188,7 @@ int Element_FIRE::updateLegacy(UPDATE_FUNC_ARGS) {
return 1; return 1;
} }
} }
if (t!=PT_SPRK && (rt==PT_ICEI || rt==PT_SNOW)) if (rt==PT_ICEI || rt==PT_SNOW)
{ {
parts[r>>8].type = PT_WATR; parts[r>>8].type = PT_WATR;
if (t==PT_FIRE) if (t==PT_FIRE)
@ -198,7 +202,7 @@ int Element_FIRE::updateLegacy(UPDATE_FUNC_ARGS) {
sim->part_change_type(i,x,y,PT_STNE); sim->part_change_type(i,x,y,PT_STNE);
} }
} }
if (t!=PT_SPRK && (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)) if (rt==PT_WATR || rt==PT_DSTW || rt==PT_SLTW)
{ {
sim->kill_part(r>>8); sim->kill_part(r>>8);
if (t==PT_FIRE) if (t==PT_FIRE)

View File

@ -62,6 +62,7 @@ int Element_H2::update(UPDATE_FUNC_ARGS)
{ {
sim->part_change_type(r>>8,x+rx,y+ry,PT_WATR); sim->part_change_type(r>>8,x+rx,y+ry,PT_WATR);
sim->part_change_type(i,x,y,PT_OIL); sim->part_change_type(i,x,y,PT_OIL);
return 1;
} }
if (sim->pv[y/CELL][x/CELL] > 45.0f) if (sim->pv[y/CELL][x/CELL] > 45.0f)
{ {
@ -80,12 +81,14 @@ int Element_H2::update(UPDATE_FUNC_ARGS)
sim->create_part(i,x,y,PT_FIRE); sim->create_part(i,x,y,PT_FIRE);
parts[i].temp+=(rand()%100); parts[i].temp+=(rand()%100);
parts[i].tmp |= 1; parts[i].tmp |= 1;
return 1;
} }
else if ((rt==PT_PLSM && !(parts[r>>8].tmp&4)) || (rt==PT_LAVA && parts[r>>8].ctype != PT_BMTL)) else if ((rt==PT_PLSM && !(parts[r>>8].tmp&4)) || (rt==PT_LAVA && parts[r>>8].ctype != PT_BMTL))
{ {
sim->create_part(i,x,y,PT_FIRE); sim->create_part(i,x,y,PT_FIRE);
parts[i].temp+=(rand()%100); parts[i].temp+=(rand()%100);
parts[i].tmp |= 1; parts[i].tmp |= 1;
return 1;
} }
} }
} }
@ -122,6 +125,7 @@ int Element_H2::update(UPDATE_FUNC_ARGS)
} }
parts[i].temp = temp+750+rand()%500; parts[i].temp = temp+750+rand()%500;
sim->pv[y/CELL][x/CELL] += 30; sim->pv[y/CELL][x/CELL] += 30;
return 1;
} }
} }
return 0; return 0;

View File

@ -82,6 +82,8 @@ int Element_LCRY::update(UPDATE_FUNC_ARGS)
setto=2; setto=2;
break; break;
default: default:
parts[i].tmp = 0;
parts[i].life = 0;
return 0; return 0;
} }
for (rx=-1; rx<2; rx++) for (rx=-1; rx<2; rx++)