Make PHOT change its wavelength upon colliding with charged LITH (#841)

Co-authored-by: Tamás Bálint Misius <lbphacker@gmail.com>
This commit is contained in:
Cracker1000 2022-05-05 02:04:23 +05:30 committed by GitHub
parent f70f222a61
commit 23af1042b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4351,8 +4351,18 @@ killed:
continue;
}
if (TYP(r))
parts[i].ctype &= elements[TYP(r)].PhotonReflectWavelengths;
if (t == PT_PHOT)
{
auto mask = elements[TYP(r)].PhotonReflectWavelengths;
if (TYP(r) == PT_LITH)
{
int wl_bin = parts[ID(r)].ctype / 4;
if (wl_bin < 0) wl_bin = 0;
if (wl_bin > 25) wl_bin = 25;
mask = (0x1F << wl_bin);
}
parts[i].ctype &= mask;
}
if (get_normal_interp(t, parts[i].x, parts[i].y, parts[i].vx, parts[i].vy, &nrx, &nry))
{