Skip to content

Commit

Permalink
Fix color value
Browse files Browse the repository at this point in the history
  • Loading branch information
FileEX committed Sep 26, 2024
1 parent 837354d commit a26b3e6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Client/mods/deathmatch/logic/CClient2DFXManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ bool CClient2DFXManager::Set2DFXProperties(C2DEffectSAInterface* effect, const e
light.offsetZ = static_cast<std::int8_t>(std::get<float>(*offsetZ));

auto* color = MapFind(effectData, "color");
int colorValue = static_cast<int>(std::get<float>(*color));
light.color = RwColor{static_cast<std::uint8_t>((colorValue >> 0) & mask(8)), static_cast<std::uint8_t>((colorValue >> 8) & mask(8)), static_cast<std::uint8_t>((colorValue >> 16) & mask(8)), static_cast<std::uint8_t>((colorValue >> 24) & mask(8))};
unsigned long colorValue = static_cast<unsigned long>(std::get<float>(*color));
light.color = RwColor{static_cast<std::uint8_t>((colorValue >> 16) & mask(8)), static_cast<std::uint8_t>((colorValue >> 8) & mask(8)), static_cast<std::uint8_t>((colorValue >> 0) & mask(8)), static_cast<std::uint8_t>((colorValue >> 24) & mask(8))};

auto* coronaTexture = MapFind(effectData, "coronaName");
auto* shadowTexture = MapFind(effectData, "shadowName");
Expand Down Expand Up @@ -416,8 +416,8 @@ bool CClient2DFXManager::Set2DFXProperty(C2DEffectSAInterface* effect, const e2d
{
if (std::holds_alternative<float>(propertyValue))
{
int colorValue = static_cast<int>(std::get<float>(propertyValue));
light.color = RwColor{static_cast<std::uint8_t>((colorValue >> 0) & mask(8)), static_cast<std::uint8_t>((colorValue >> 8) & mask(8)), static_cast<std::uint8_t>((colorValue >> 16) & mask(8)), static_cast<std::uint8_t>((colorValue >> 24) & mask(8))};
unsigned long colorValue = static_cast<unsigned long>(std::get<float>(propertyValue));
light.color = RwColor{static_cast<std::uint8_t>((colorValue >> 16) & mask(8)), static_cast<std::uint8_t>((colorValue >> 8) & mask(8)), static_cast<std::uint8_t>((colorValue >> 0) & mask(8)), static_cast<std::uint8_t>((colorValue >> 24) & mask(8))};

return true;
}
Expand Down

0 comments on commit a26b3e6

Please sign in to comment.