CONV tmp value can now be used to restrict which elements get converted. Requires version bump to 92.
This commit is contained in:
parent
d88c18adaf
commit
d0445258c5
@ -1085,6 +1085,15 @@ void GameSave::readOPS(char * data, int dataLength)
|
|||||||
particles[newIndex].tmp2 = 0;
|
particles[newIndex].tmp2 = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case PT_CONV:
|
||||||
|
if (savedVersion < 92)
|
||||||
|
{
|
||||||
|
if (particles[newIndex].tmp)
|
||||||
|
{
|
||||||
|
particles[newIndex].ctype |= particles[newIndex].tmp<<8;
|
||||||
|
particles[newIndex].tmp = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//note: PSv was used in version 77.0 and every version before, add something in PSv too if the element is that old
|
//note: PSv was used in version 77.0 and every version before, add something in PSv too if the element is that old
|
||||||
newIndex++;
|
newIndex++;
|
||||||
@ -1738,6 +1747,17 @@ void GameSave::readPSv(char * data, int dataLength)
|
|||||||
if (particles[i-1].type == PT_VINE)
|
if (particles[i-1].type == PT_VINE)
|
||||||
particles[i-1].tmp = 1;
|
particles[i-1].tmp = 1;
|
||||||
}
|
}
|
||||||
|
if (ver < 92)
|
||||||
|
{
|
||||||
|
if (particles[i-1].type == PT_CONV)
|
||||||
|
{
|
||||||
|
if (particles[i-1].tmp)
|
||||||
|
{
|
||||||
|
particles[i-1].ctype |= particles[i-1].tmp<<8;
|
||||||
|
particles[i-1].tmp = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2267,8 +2267,8 @@ void GameView::OnDraw()
|
|||||||
sampleInfo << c->ElementResolve(sample.particle.type, sample.particle.ctype);
|
sampleInfo << c->ElementResolve(sample.particle.type, sample.particle.ctype);
|
||||||
if (wavelengthGfx)
|
if (wavelengthGfx)
|
||||||
sampleInfo << " (" << ctype << ")";
|
sampleInfo << " (" << ctype << ")";
|
||||||
// CRAY and DRAY store extra LIFE info in upper bits of ctype, instead of tmp2
|
// Some elements store extra LIFE info in upper bits of ctype, instead of tmp/tmp2
|
||||||
else if (sample.particle.type == PT_CRAY || sample.particle.type == PT_DRAY)
|
else if (sample.particle.type == PT_CRAY || sample.particle.type == PT_DRAY || sample.particle.type == PT_CONV)
|
||||||
sampleInfo << " (" << c->ElementResolve(ctype&0xFF, ctype>>8) << ")";
|
sampleInfo << " (" << c->ElementResolve(ctype&0xFF, ctype>>8) << ")";
|
||||||
else if (c->IsValidElement(ctype))
|
else if (c->IsValidElement(ctype))
|
||||||
sampleInfo << " (" << c->ElementResolve(ctype, -1) << ")";
|
sampleInfo << " (" << c->ElementResolve(ctype, -1) << ")";
|
||||||
|
@ -2847,8 +2847,13 @@ int Simulation::create_part(int p, int x, int y, int tv)
|
|||||||
&& (!(elements[t].Properties & PROP_NOCTYPEDRAW)))
|
&& (!(elements[t].Properties & PROP_NOCTYPEDRAW)))
|
||||||
{
|
{
|
||||||
parts[pmap[y][x]>>8].ctype = t;
|
parts[pmap[y][x]>>8].ctype = t;
|
||||||
if (t == PT_LIFE && v >= 0 && v < NGOL && drawOn != PT_STOR)
|
if (t == PT_LIFE && v >= 0 && v < NGOL)
|
||||||
parts[pmap[y][x]>>8].tmp = v;
|
{
|
||||||
|
if (drawOn == PT_CONV)
|
||||||
|
parts[pmap[y][x]>>8].ctype |= v<<8;
|
||||||
|
else if (drawOn != PT_STOR)
|
||||||
|
parts[pmap[y][x]>>8].tmp = v;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if ((drawOn == PT_DTEC || (drawOn == PT_PSTN && t != PT_FRME) || drawOn == PT_DRAY) && drawOn != t)
|
else if ((drawOn == PT_DTEC || (drawOn == PT_PSTN && t != PT_FRME) || drawOn == PT_DRAY) && drawOn != t)
|
||||||
{
|
{
|
||||||
|
@ -50,7 +50,8 @@ Element_CONV::Element_CONV()
|
|||||||
int Element_CONV::update(UPDATE_FUNC_ARGS)
|
int Element_CONV::update(UPDATE_FUNC_ARGS)
|
||||||
{
|
{
|
||||||
int r, rx, ry;
|
int r, rx, ry;
|
||||||
if (parts[i].ctype<=0 || parts[i].ctype>=PT_NUM || !sim->elements[parts[i].ctype].Enabled || parts[i].ctype==PT_CONV || (parts[i].ctype==PT_LIFE && (parts[i].tmp<0 || parts[i].tmp>=NGOL)))
|
int ctype = parts[i].ctype&0xFF, ctypeExtra = parts[i].ctype>>8;
|
||||||
|
if (ctype<=0 || ctype>=PT_NUM || !sim->elements[ctype].Enabled || ctype==PT_CONV || (ctype==PT_LIFE && (ctypeExtra<0 || ctypeExtra>=NGOL)))
|
||||||
{
|
{
|
||||||
for (rx=-1; rx<2; rx++)
|
for (rx=-1; rx<2; rx++)
|
||||||
for (ry=-1; ry<2; ry++)
|
for (ry=-1; ry<2; ry++)
|
||||||
@ -68,26 +69,25 @@ int Element_CONV::update(UPDATE_FUNC_ARGS)
|
|||||||
{
|
{
|
||||||
parts[i].ctype = r&0xFF;
|
parts[i].ctype = r&0xFF;
|
||||||
if ((r&0xFF)==PT_LIFE)
|
if ((r&0xFF)==PT_LIFE)
|
||||||
parts[i].tmp = parts[r>>8].ctype;
|
parts[i].ctype |= (parts[r>>8].ctype << 8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool life = parts[i].ctype==PT_LIFE;
|
int restrictElement = sim->IsValidElement(parts[i].tmp) ? parts[i].tmp : 0;
|
||||||
for (rx=-1; rx<2; rx++)
|
for (rx=-1; rx<2; rx++)
|
||||||
for (ry=-1; ry<2; ry++)
|
for (ry=-1; ry<2; ry++)
|
||||||
if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES)
|
if (x+rx>=0 && y+ry>=0 && x+rx<XRES && y+ry<YRES)
|
||||||
{
|
{
|
||||||
r = sim->photons[y+ry][x+rx];
|
r = sim->photons[y+ry][x+rx];
|
||||||
if (!r)
|
if (!r || (restrictElement && (r&0xFF)!=restrictElement))
|
||||||
r = pmap[y+ry][x+rx];
|
r = pmap[y+ry][x+rx];
|
||||||
if (!r)
|
if (!r || (restrictElement && (r&0xFF)!=restrictElement))
|
||||||
continue;
|
continue;
|
||||||
if((r&0xFF)!=PT_CONV && (r&0xFF)!=PT_DMND && (r&0xFF)!=parts[i].ctype)
|
if((r&0xFF)!=PT_CONV && (r&0xFF)!=PT_DMND && (r&0xFF)!=ctype)
|
||||||
{
|
{
|
||||||
if (life) sim->create_part(r>>8, x+rx, y+ry, parts[i].ctype|(parts[i].tmp<<8));
|
sim->create_part(r>>8, x+rx, y+ry, parts[i].ctype);
|
||||||
else sim->create_part(r>>8, x+rx, y+ry, parts[i].ctype);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user