Add PAPR interaction with LDTC

This commit is contained in:
Rebmiami 2023-12-12 08:38:02 -05:00
parent f4dd854b78
commit cb40d869cd

View File

@ -104,7 +104,7 @@ static int update(UPDATE_FUNC_ARGS)
if (!r) if (!r)
continue; continue;
bool boolMode = accepted_conductor(sim, r); bool boolMode = accepted_conductor(sim, r);
bool filtMode = copyColor && TYP(r) == PT_FILT; bool filtMode = copyColor && (TYP(r) == PT_FILT || TYP(r) == PT_PAPR);
if (!boolMode && !filtMode) if (!boolMode && !filtMode)
continue; continue;
@ -147,21 +147,59 @@ static int update(UPDATE_FUNC_ARGS)
if (filtMode) if (filtMode)
{ {
if (!phot_data_type(TYP(rr))) if (!phot_data_type(TYP(rr)) && TYP(rr) != PT_PAPR)
continue; continue;
int nx = x + rx, ny = y + ry; int nx = x + rx, ny = y + ry;
int photonWl = TYP(rr) == PT_FILT ? int photonWl = TYP(rr) == PT_FILT ?
Element_FILT_getWavelengths(&parts[ID(rr)]) : Element_FILT_getWavelengths(&parts[ID(rr)]) :
parts[ID(rr)].ctype; parts[ID(rr)].ctype;
while (TYP(r) == PT_FILT) if (TYP(rr) == PT_PAPR)
{ {
parts[ID(r)].ctype = photonWl; photonWl = 0x0;
nx += rx; int bit = 0x1;
ny += ry; while (TYP(rr) == PT_PAPR && bit <= 0x3FFFFFFF)
if (nx < 0 || ny < 0 || nx >= XRES || ny >= YRES) {
break; if ((parts[ID(rr)].life >> 24) & 0x1)
r = pmap[ny][nx]; {
photonWl |= bit;
}
xCurrent += xStep;
yCurrent += yStep;
if (xCurrent < 0 || yCurrent < 0 || xCurrent >= XRES || yCurrent >= YRES)
break;
rr = pmap[yCurrent][xCurrent];
bit <<= 1;
}
}
if (TYP(r) == PT_FILT)
{
while (TYP(r) == PT_FILT)
{
parts[ID(r)].ctype = photonWl;
nx += rx;
ny += ry;
if (nx < 0 || ny < 0 || nx >= XRES || ny >= YRES)
break;
r = pmap[ny][nx];
}
}
if (TYP(r) == PT_PAPR)
{
int bit = 0x1;
while (TYP(r) == PT_PAPR && bit <= 0x3FFFFFFF)
{
if (photonWl & bit)
parts[ID(r)].life = 0x1080820;
else
parts[ID(r)].life = 0x0;
nx += rx;
ny += ry;
if (nx < 0 || ny < 0 || nx >= XRES || ny >= YRES)
break;
r = pmap[ny][nx];
bit <<= 1;
}
} }
break; break;
} }