Skip to content

Commit

Permalink
add new PhotonReflectWavelengths property, add reflection color for POLO
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob1 committed Jul 16, 2017
1 parent 08ba035 commit 6d141b0
Show file tree
Hide file tree
Showing 22 changed files with 30 additions and 18 deletions.
6 changes: 6 additions & 0 deletions src/lua/LegacyLuaAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
20 changes: 2 additions & 18 deletions src/simulation/Simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4419,24 +4419,8 @@ void Simulation::UpdateParticles(int start, int end)
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))
{
Expand Down
1 change: 1 addition & 0 deletions src/simulation/elements/ACID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Element_ACID::Element_ACID()
Explosive = 0;
Meltable = 0;
Hardness = 0;
PhotonReflectWavelengths = 0x1FE001FE;

Weight = 10;

Expand Down
1 change: 1 addition & 0 deletions src/simulation/elements/BCOL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Element_BCOL::Element_BCOL()
Explosive = 0;
Meltable = 0;
Hardness = 2;
PhotonReflectWavelengths = 0x00000000;

Weight = 90;

Expand Down
1 change: 1 addition & 0 deletions src/simulation/elements/COAL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Element_COAL::Element_COAL()
Explosive = 0;
Meltable = 0;
Hardness = 20;
PhotonReflectWavelengths = 0x00000000;

Weight = 100;

Expand Down
1 change: 1 addition & 0 deletions src/simulation/elements/DUST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Element_DUST::Element_DUST()
Explosive = 0;
Meltable = 0;
Hardness = 30;
PhotonReflectWavelengths = 0x3FFFFFC0;

Weight = 85;

Expand Down
2 changes: 2 additions & 0 deletions src/simulation/elements/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Element::Element():
Explosive(0),
Meltable(0),
Hardness(30),
PhotonReflectWavelengths(0x3FFFFFFF),

Weight(50),

Expand Down Expand Up @@ -68,6 +69,7 @@ std::vector<StructProperty> 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)));
Expand Down
2 changes: 2 additions & 0 deletions src/simulation/elements/Element.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class Element
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;
Expand Down
1 change: 1 addition & 0 deletions src/simulation/elements/GOLD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Element_GOLD::Element_GOLD()
Explosive = 0;
Meltable = 1;
Hardness = 0;
PhotonReflectWavelengths = 0x3C038100;

Weight = 100;

Expand Down
1 change: 1 addition & 0 deletions src/simulation/elements/GOO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Element_GOO::Element_GOO()
Explosive = 0;
Meltable = 0;
Hardness = 12;
PhotonReflectWavelengths = 0x3FFAAA00;

Weight = 100;

Expand Down
1 change: 1 addition & 0 deletions src/simulation/elements/LAVA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Element_LAVA::Element_LAVA()
Explosive = 0;
Meltable = 0;
Hardness = 2;
PhotonReflectWavelengths = 0x3FF00000;

Weight = 45;

Expand Down
1 change: 1 addition & 0 deletions src/simulation/elements/NBLE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Element_NBLE::Element_NBLE()
Explosive = 0;
Meltable = 0;
Hardness = 1;
PhotonReflectWavelengths = 0x3FFF8000;

Weight = 1;

Expand Down
1 change: 1 addition & 0 deletions src/simulation/elements/NITR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Element_NITR::Element_NITR()
Explosive = 2;
Meltable = 0;
Hardness = 3;
PhotonReflectWavelengths = 0x0007C000;

Weight = 23;

Expand Down
1 change: 1 addition & 0 deletions src/simulation/elements/NSCN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Element_NSCN::Element_NSCN()
Explosive = 0;
Meltable = 1;
Hardness = 1;
PhotonReflectWavelengths = 0x00000000;

Weight = 100;

Expand Down
1 change: 1 addition & 0 deletions src/simulation/elements/PLEX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Element_PLEX::Element_PLEX()
Explosive = 2;
Meltable = 50;
Hardness = 1;
PhotonReflectWavelengths = 0x1F00003E;

Weight = 100;

Expand Down
1 change: 1 addition & 0 deletions src/simulation/elements/PLNT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Element_PLNT::Element_PLNT()
Explosive = 0;
Meltable = 0;
Hardness = 10;
PhotonReflectWavelengths = 0x0007C000;

Weight = 100;

Expand Down
1 change: 1 addition & 0 deletions src/simulation/elements/PLUT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Element_PLUT::Element_PLUT()
Explosive = 0;
Meltable = 0;
Hardness = 0;
PhotonReflectWavelengths = 0x001FCE00;

Weight = 90;

Expand Down
1 change: 1 addition & 0 deletions src/simulation/elements/POLO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Element_POLO::Element_POLO()
Explosive = 0;
Meltable = 1;
Hardness = 0;
PhotonReflectWavelengths = 0x000FF200;

Weight = 90;

Expand Down
1 change: 1 addition & 0 deletions src/simulation/elements/PSCN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Element_PSCN::Element_PSCN()
Explosive = 0;
Meltable = 1;
Hardness = 1;
PhotonReflectWavelengths = 0x00000000;

Weight = 100;

Expand Down
1 change: 1 addition & 0 deletions src/simulation/elements/SNOW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Element_SNOW::Element_SNOW()
Explosive = 0;
Meltable = 0;
Hardness = 20;
PhotonReflectWavelengths = 0x03FFFFFF;

Weight = 50;

Expand Down
1 change: 1 addition & 0 deletions src/simulation/elements/SPRK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Element_SPRK::Element_SPRK()
Explosive = 0;
Meltable = 0;
Hardness = 1;
PhotonReflectWavelengths = 0x00000000;

Weight = 100;

Expand Down
1 change: 1 addition & 0 deletions src/simulation/elements/URAN.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Element_URAN::Element_URAN()
Explosive = 0;
Meltable = 0;
Hardness = 0;
PhotonReflectWavelengths = 0x003FC000;

Weight = 90;

Expand Down

0 comments on commit 6d141b0

Please sign in to comment.