From e20f6b101bf4be2fc6b7d2de82e427cfae7a661e Mon Sep 17 00:00:00 2001 From: jacob1 Date: Fri, 21 Nov 2014 15:03:10 -0500 Subject: [PATCH] jacksonmj: "Allow ELEC to pass through GLOW, fixes ELEC->PHOT reaction in GLOW." f162984e22e5 + some parts of "Misc small fixes" 95cf5bd67c2b --- src/simulation/Simulation.cpp | 11 ++++++++++- src/simulation/elements/BIZR.cpp | 5 ----- src/simulation/elements/ELEC.cpp | 4 ---- src/simulation/elements/EXOT.cpp | 4 ++-- src/simulation/elements/FIRE.cpp | 16 ++++++++++------ src/simulation/elements/H2.cpp | 4 ++++ src/simulation/elements/LCRY.cpp | 2 ++ 7 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 34d7ea1666..b9a8e6c1ff 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -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; @@ -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); diff --git a/src/simulation/elements/BIZR.cpp b/src/simulation/elements/BIZR.cpp index eb1fc2075c..5a5ab7446b 100644 --- a/src/simulation/elements/BIZR.cpp +++ b/src/simulation/elements/BIZR.cpp @@ -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; } diff --git a/src/simulation/elements/ELEC.cpp b/src/simulation/elements/ELEC.cpp index 48029ace70..85312b8b80 100644 --- a/src/simulation/elements/ELEC.cpp +++ b/src/simulation/elements/ELEC.cpp @@ -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: diff --git a/src/simulation/elements/EXOT.cpp b/src/simulation/elements/EXOT.cpp index 6b3af102f0..fc0c3f0089 100644 --- a/src/simulation/elements/EXOT.cpp +++ b/src/simulation/elements/EXOT.cpp @@ -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) @@ -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) { diff --git a/src/simulation/elements/FIRE.cpp b/src/simulation/elements/FIRE.cpp index b467d5da15..aea4217731 100644 --- a/src/simulation/elements/FIRE.cpp +++ b/src/simulation/elements/FIRE.cpp @@ -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; } @@ -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; } @@ -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) @@ -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) diff --git a/src/simulation/elements/H2.cpp b/src/simulation/elements/H2.cpp index 4610fd8cbb..98ad6e7ead 100644 --- a/src/simulation/elements/H2.cpp +++ b/src/simulation/elements/H2.cpp @@ -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) { @@ -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; } } } @@ -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; diff --git a/src/simulation/elements/LCRY.cpp b/src/simulation/elements/LCRY.cpp index 85c228d12a..eddd705afb 100644 --- a/src/simulation/elements/LCRY.cpp +++ b/src/simulation/elements/LCRY.cpp @@ -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++)