diff --git a/src/lua/LegacyLuaAPI.cpp b/src/lua/LegacyLuaAPI.cpp index ced95074d..7704be205 100644 --- a/src/lua/LegacyLuaAPI.cpp +++ b/src/lua/LegacyLuaAPI.cpp @@ -288,6 +288,12 @@ int luacon_element_getproperty(const char * key, int * format, unsigned int * mo offset = offsetof(Element, Hardness); *format = 0; } + // Not sure if this should be enabled + // Also, needs a new format type for unsigned ints + /*else if (!strcmp(key, "photonreflectwavelengths")) { + offset = offsetof(Element, PhotonReflectWavelengths); + *format = ; + }*/ else if (!strcmp(key, "menu")) { offset = offsetof(Element, MenuVisible); *format = 0; diff --git a/src/simulation/Simulation.cpp b/src/simulation/Simulation.cpp index 88c759c3e..9b9b81606 100644 --- a/src/simulation/Simulation.cpp +++ b/src/simulation/Simulation.cpp @@ -4419,24 +4419,8 @@ killed: continue; } - // this should be replaced with a particle type attribute ("photwl" or something) - if ((r & 0xFF) == PT_PSCN) parts[i].ctype = 0x00000000; - else if ((r & 0xFF) == PT_NSCN) parts[i].ctype = 0x00000000; - else if ((r & 0xFF) == PT_SPRK) parts[i].ctype = 0x00000000; - else if ((r & 0xFF) == PT_COAL) parts[i].ctype = 0x00000000; - else if ((r & 0xFF) == PT_BCOL) parts[i].ctype = 0x00000000; - else if ((r & 0xFF) == PT_PLEX) parts[i].ctype &= 0x1F00003E; - else if ((r & 0xFF) == PT_NITR) parts[i].ctype &= 0x0007C000; - else if ((r & 0xFF) == PT_NBLE) parts[i].ctype &= 0x3FFF8000; - else if ((r & 0xFF) == PT_LAVA) parts[i].ctype &= 0x3FF00000; - else if ((r & 0xFF) == PT_ACID) parts[i].ctype &= 0x1FE001FE; - else if ((r & 0xFF) == PT_DUST) parts[i].ctype &= 0x3FFFFFC0; - else if ((r & 0xFF) == PT_SNOW) parts[i].ctype &= 0x03FFFFFF; - else if ((r & 0xFF) == PT_GOO) parts[i].ctype &= 0x3FFAAA00; - else if ((r & 0xFF) == PT_PLNT) parts[i].ctype &= 0x0007C000; - else if ((r & 0xFF) == PT_PLUT) parts[i].ctype &= 0x001FCE00; - else if ((r & 0xFF) == PT_URAN) parts[i].ctype &= 0x003FC000; - else if ((r & 0xFF) == PT_GOLD) parts[i].ctype &= 0x3C038100; + if (r&0xFF) + parts[i].ctype &= elements[r&0xFF].PhotonReflectWavelengths; if (get_normal_interp(t, parts[i].x, parts[i].y, parts[i].vx, parts[i].vy, &nrx, &nry)) { diff --git a/src/simulation/elements/ACID.cpp b/src/simulation/elements/ACID.cpp index 36ae30b51..9abb65719 100644 --- a/src/simulation/elements/ACID.cpp +++ b/src/simulation/elements/ACID.cpp @@ -23,6 +23,7 @@ Element_ACID::Element_ACID() Explosive = 0; Meltable = 0; Hardness = 0; + PhotonReflectWavelengths = 0x1FE001FE; Weight = 10; diff --git a/src/simulation/elements/BCOL.cpp b/src/simulation/elements/BCOL.cpp index c9bcfd48d..23624d5be 100644 --- a/src/simulation/elements/BCOL.cpp +++ b/src/simulation/elements/BCOL.cpp @@ -23,6 +23,7 @@ Element_BCOL::Element_BCOL() Explosive = 0; Meltable = 0; Hardness = 2; + PhotonReflectWavelengths = 0x00000000; Weight = 90; diff --git a/src/simulation/elements/COAL.cpp b/src/simulation/elements/COAL.cpp index 8bb8cd753..92cefea1a 100644 --- a/src/simulation/elements/COAL.cpp +++ b/src/simulation/elements/COAL.cpp @@ -23,6 +23,7 @@ Element_COAL::Element_COAL() Explosive = 0; Meltable = 0; Hardness = 20; + PhotonReflectWavelengths = 0x00000000; Weight = 100; diff --git a/src/simulation/elements/DUST.cpp b/src/simulation/elements/DUST.cpp index 53105d8a1..78bee8e72 100644 --- a/src/simulation/elements/DUST.cpp +++ b/src/simulation/elements/DUST.cpp @@ -23,6 +23,7 @@ Element_DUST::Element_DUST() Explosive = 0; Meltable = 0; Hardness = 30; + PhotonReflectWavelengths = 0x3FFFFFC0; Weight = 85; diff --git a/src/simulation/elements/Element.cpp b/src/simulation/elements/Element.cpp index f4c472a32..6e000fbd7 100644 --- a/src/simulation/elements/Element.cpp +++ b/src/simulation/elements/Element.cpp @@ -23,6 +23,7 @@ Element::Element(): Explosive(0), Meltable(0), Hardness(30), + PhotonReflectWavelengths(0x3FFFFFFF), Weight(50), @@ -68,6 +69,7 @@ std::vector Element::GetProperties() properties.push_back(StructProperty("Explosive", StructProperty::Integer, offsetof(Element, Explosive))); properties.push_back(StructProperty("Meltable", StructProperty::Integer, offsetof(Element, Meltable))); properties.push_back(StructProperty("Hardness", StructProperty::Integer, offsetof(Element, Hardness))); + properties.push_back(StructProperty("PhotonReflectWavelengths", StructProperty::UInteger, offsetof(Element, PhotonReflectWavelengths))); properties.push_back(StructProperty("Weight", StructProperty::Integer, offsetof(Element, Weight))); properties.push_back(StructProperty("Temperature", StructProperty::Float, offsetof(Element, Temperature))); properties.push_back(StructProperty("HeatConduct", StructProperty::UChar, offsetof(Element, HeatConduct))); diff --git a/src/simulation/elements/Element.h b/src/simulation/elements/Element.h index 4967dc53a..f726d410f 100644 --- a/src/simulation/elements/Element.h +++ b/src/simulation/elements/Element.h @@ -33,6 +33,8 @@ public: int Explosive; int Meltable; int Hardness; + // Photon wavelengths are ANDed with this value when a photon hits an element, meaning that only wavelengths present in both this value and the original photon will remain in the reflected photon + unsigned int PhotonReflectWavelengths; int Weight; float Temperature; unsigned char HeatConduct; diff --git a/src/simulation/elements/GOLD.cpp b/src/simulation/elements/GOLD.cpp index 30177eb85..8bcb51a8c 100644 --- a/src/simulation/elements/GOLD.cpp +++ b/src/simulation/elements/GOLD.cpp @@ -24,6 +24,7 @@ Element_GOLD::Element_GOLD() Explosive = 0; Meltable = 1; Hardness = 0; + PhotonReflectWavelengths = 0x3C038100; Weight = 100; diff --git a/src/simulation/elements/GOO.cpp b/src/simulation/elements/GOO.cpp index 6ec2f6a7b..0fbc7681d 100644 --- a/src/simulation/elements/GOO.cpp +++ b/src/simulation/elements/GOO.cpp @@ -23,6 +23,7 @@ Element_GOO::Element_GOO() Explosive = 0; Meltable = 0; Hardness = 12; + PhotonReflectWavelengths = 0x3FFAAA00; Weight = 100; diff --git a/src/simulation/elements/LAVA.cpp b/src/simulation/elements/LAVA.cpp index 4b95065c9..04d282374 100644 --- a/src/simulation/elements/LAVA.cpp +++ b/src/simulation/elements/LAVA.cpp @@ -23,6 +23,7 @@ Element_LAVA::Element_LAVA() Explosive = 0; Meltable = 0; Hardness = 2; + PhotonReflectWavelengths = 0x3FF00000; Weight = 45; diff --git a/src/simulation/elements/NBLE.cpp b/src/simulation/elements/NBLE.cpp index 1ce98c1c5..802f68798 100644 --- a/src/simulation/elements/NBLE.cpp +++ b/src/simulation/elements/NBLE.cpp @@ -23,6 +23,7 @@ Element_NBLE::Element_NBLE() Explosive = 0; Meltable = 0; Hardness = 1; + PhotonReflectWavelengths = 0x3FFF8000; Weight = 1; diff --git a/src/simulation/elements/NITR.cpp b/src/simulation/elements/NITR.cpp index 088972677..16d03b2ff 100644 --- a/src/simulation/elements/NITR.cpp +++ b/src/simulation/elements/NITR.cpp @@ -23,6 +23,7 @@ Element_NITR::Element_NITR() Explosive = 2; Meltable = 0; Hardness = 3; + PhotonReflectWavelengths = 0x0007C000; Weight = 23; diff --git a/src/simulation/elements/NSCN.cpp b/src/simulation/elements/NSCN.cpp index 200a9765a..cbe056c2d 100644 --- a/src/simulation/elements/NSCN.cpp +++ b/src/simulation/elements/NSCN.cpp @@ -23,6 +23,7 @@ Element_NSCN::Element_NSCN() Explosive = 0; Meltable = 1; Hardness = 1; + PhotonReflectWavelengths = 0x00000000; Weight = 100; diff --git a/src/simulation/elements/PLEX.cpp b/src/simulation/elements/PLEX.cpp index dda78c07a..0a1fa9809 100644 --- a/src/simulation/elements/PLEX.cpp +++ b/src/simulation/elements/PLEX.cpp @@ -23,6 +23,7 @@ Element_PLEX::Element_PLEX() Explosive = 2; Meltable = 50; Hardness = 1; + PhotonReflectWavelengths = 0x1F00003E; Weight = 100; diff --git a/src/simulation/elements/PLNT.cpp b/src/simulation/elements/PLNT.cpp index 83ed11abb..87be16a04 100644 --- a/src/simulation/elements/PLNT.cpp +++ b/src/simulation/elements/PLNT.cpp @@ -23,6 +23,7 @@ Element_PLNT::Element_PLNT() Explosive = 0; Meltable = 0; Hardness = 10; + PhotonReflectWavelengths = 0x0007C000; Weight = 100; diff --git a/src/simulation/elements/PLUT.cpp b/src/simulation/elements/PLUT.cpp index 99cccb5be..dd0829d94 100644 --- a/src/simulation/elements/PLUT.cpp +++ b/src/simulation/elements/PLUT.cpp @@ -23,6 +23,7 @@ Element_PLUT::Element_PLUT() Explosive = 0; Meltable = 0; Hardness = 0; + PhotonReflectWavelengths = 0x001FCE00; Weight = 90; diff --git a/src/simulation/elements/POLO.cpp b/src/simulation/elements/POLO.cpp index b3b9e7bd1..321c63571 100644 --- a/src/simulation/elements/POLO.cpp +++ b/src/simulation/elements/POLO.cpp @@ -23,6 +23,7 @@ Element_POLO::Element_POLO() Explosive = 0; Meltable = 1; Hardness = 0; + PhotonReflectWavelengths = 0x000FF200; Weight = 90; diff --git a/src/simulation/elements/PSCN.cpp b/src/simulation/elements/PSCN.cpp index 4ad941b1d..750c1536c 100644 --- a/src/simulation/elements/PSCN.cpp +++ b/src/simulation/elements/PSCN.cpp @@ -23,6 +23,7 @@ Element_PSCN::Element_PSCN() Explosive = 0; Meltable = 1; Hardness = 1; + PhotonReflectWavelengths = 0x00000000; Weight = 100; diff --git a/src/simulation/elements/SNOW.cpp b/src/simulation/elements/SNOW.cpp index 7db9355e5..0f5a737f2 100644 --- a/src/simulation/elements/SNOW.cpp +++ b/src/simulation/elements/SNOW.cpp @@ -23,6 +23,7 @@ Element_SNOW::Element_SNOW() Explosive = 0; Meltable = 0; Hardness = 20; + PhotonReflectWavelengths = 0x03FFFFFF; Weight = 50; diff --git a/src/simulation/elements/SPRK.cpp b/src/simulation/elements/SPRK.cpp index 79a2501bd..90c2cae17 100644 --- a/src/simulation/elements/SPRK.cpp +++ b/src/simulation/elements/SPRK.cpp @@ -23,6 +23,7 @@ Element_SPRK::Element_SPRK() Explosive = 0; Meltable = 0; Hardness = 1; + PhotonReflectWavelengths = 0x00000000; Weight = 100; diff --git a/src/simulation/elements/URAN.cpp b/src/simulation/elements/URAN.cpp index 176e9bd60..cf7c59acb 100644 --- a/src/simulation/elements/URAN.cpp +++ b/src/simulation/elements/URAN.cpp @@ -23,6 +23,7 @@ Element_URAN::Element_URAN() Explosive = 0; Meltable = 0; Hardness = 0; + PhotonReflectWavelengths = 0x003FC000; Weight = 90;