Skip to content

Commit

Permalink
jacksonmj: "Allow ELEC to pass through GLOW, fixes ELEC->PHOT reactio…
Browse files Browse the repository at this point in the history
…n in GLOW." f162984 + some parts of "Misc small fixes" 95cf5bd
  • Loading branch information
jacob1 committed Nov 21, 2014
1 parent a182e92 commit e20f6b1
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 18 deletions.
11 changes: 10 additions & 1 deletion src/simulation/Simulation.cpp
Expand Up @@ -2079,6 +2079,7 @@ void Simulation::init_can_move()
can_move[PT_NEUT][PT_INVIS] = 2;
can_move[PT_ELEC][PT_LCRY] = 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_BIZR] = 2;
Expand Down Expand Up @@ -2274,12 +2275,20 @@ int Simulation::try_move(int i, int x, int y, int nx, int ny)
if (rand() < RAND_MAX/10)
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)
{
if ((r&0xFF) == PT_INVIS)
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)
parts[i].ctype = Element_FILT::interactWavelengths(&parts[r>>8], parts[i].ctype);
Expand Down
5 changes: 0 additions & 5 deletions src/simulation/elements/BIZR.cpp
Expand Up @@ -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;
}

Expand Down
4 changes: 0 additions & 4 deletions src/simulation/elements/ELEC.cpp
Expand Up @@ -107,10 +107,6 @@ int Element_ELEC::update(UPDATE_FUNC_ARGS)
parts[r>>8].tmp2 += 5;
parts[r>>8].life = 1000;
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
break;
default:
Expand Down
4 changes: 2 additions & 2 deletions src/simulation/elements/EXOT.cpp
Expand Up @@ -116,7 +116,7 @@ int Element_EXOT::update(UPDATE_FUNC_ARGS)
if (parts[i].life < 1001)
{
sim->part_change_type(i, x, y, PT_WARP);
return 0;
return 1;
}
}
else if(parts[i].life < 1001)
Expand All @@ -126,7 +126,7 @@ int Element_EXOT::update(UPDATE_FUNC_ARGS)
{
parts[i].tmp2 = 6000;
sim->part_change_type(i, x, y, PT_WARP);
return 0;
return 1;
}
if (parts[i].tmp2 > 100)
{
Expand Down
16 changes: 10 additions & 6 deletions src/simulation/elements/FIRE.cpp
Expand Up @@ -146,7 +146,7 @@ int Element_FIRE::update(UPDATE_FUNC_ARGS)
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);
return 0;
}
Expand All @@ -167,12 +167,16 @@ int Element_FIRE::updateLegacy(UPDATE_FUNC_ARGS) {

lpv = (int)sim->pv[(y+ry)/CELL][(x+rx)/CELL];
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)
{
parts[r>>8].ctype = (rt==PT_BRMT)?PT_BMTL:(r&0xFF);
parts[r>>8].ctype = (parts[r>>8].ctype==PT_SAND)?PT_GLAS:parts[r>>8].ctype;
if (rt==PT_BRMT)
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);
parts[r>>8].life = rand()%120+240;
}
Expand All @@ -184,7 +188,7 @@ int Element_FIRE::updateLegacy(UPDATE_FUNC_ARGS) {
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;
if (t==PT_FIRE)
Expand All @@ -198,7 +202,7 @@ int Element_FIRE::updateLegacy(UPDATE_FUNC_ARGS) {
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);
if (t==PT_FIRE)
Expand Down
4 changes: 4 additions & 0 deletions src/simulation/elements/H2.cpp
Expand Up @@ -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(i,x,y,PT_OIL);
return 1;
}
if (sim->pv[y/CELL][x/CELL] > 45.0f)
{
Expand All @@ -80,12 +81,14 @@ int Element_H2::update(UPDATE_FUNC_ARGS)
sim->create_part(i,x,y,PT_FIRE);
parts[i].temp+=(rand()%100);
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))
{
sim->create_part(i,x,y,PT_FIRE);
parts[i].temp+=(rand()%100);
parts[i].tmp |= 1;
return 1;
}
}
}
Expand Down Expand Up @@ -122,6 +125,7 @@ int Element_H2::update(UPDATE_FUNC_ARGS)
}
parts[i].temp = temp+750+rand()%500;
sim->pv[y/CELL][x/CELL] += 30;
return 1;
}
}
return 0;
Expand Down
2 changes: 2 additions & 0 deletions src/simulation/elements/LCRY.cpp
Expand Up @@ -82,6 +82,8 @@ int Element_LCRY::update(UPDATE_FUNC_ARGS)
setto=2;
break;
default:
parts[i].tmp = 0;
parts[i].life = 0;
return 0;
}
for (rx=-1; rx<2; rx++)
Expand Down

0 comments on commit e20f6b1

Please sign in to comment.