diff options
| author | Loki Rautio <lokirautio@gmail.com> | 2026-03-07 21:12:22 -0600 |
|---|---|---|
| committer | Loki Rautio <lokirautio@gmail.com> | 2026-03-07 21:12:22 -0600 |
| commit | 087b7e7abfe81dd7f0fdcdea36ac9f245950df1a (patch) | |
| tree | 69454763e73ca764af4e682d3573080b13138a0e /Minecraft.World/Color.cpp | |
| parent | a9be52c41a02d207233199e98898fe7483d7e817 (diff) | |
Revert "Project modernization (#630)"
This code was not tested and breaks in Release builds, reverting to restore
functionality of the nightly. All in-game menus do not work and generating
a world crashes.
This reverts commit a9be52c41a02d207233199e98898fe7483d7e817.
Diffstat (limited to 'Minecraft.World/Color.cpp')
| -rw-r--r-- | Minecraft.World/Color.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/Minecraft.World/Color.cpp b/Minecraft.World/Color.cpp index 554ee379..256e9017 100644 --- a/Minecraft.World/Color.cpp +++ b/Minecraft.World/Color.cpp @@ -18,7 +18,7 @@ Color::Color( float r, float g, float b) assert( b >= 0.0f && b <= 1.0f ); //argb - colour = ( (0xFF<<24) | ( static_cast<int>(r * 255)<<16 ) | ( static_cast<int>(g * 255)<<8 ) | static_cast<int>(b * 255) ); + colour = ( (0xFF<<24) | ( (int)(r*255)<<16 ) | ( (int)(g*255)<<8 ) | ( (int)(b*255) ) ); } Color::Color( int r, int g, int b) @@ -43,7 +43,7 @@ Color Color::getHSBColor(float hue, float saturation, float brightness) int r = 0, g = 0, b = 0; if (saturation == 0) { - r = g = b = static_cast<int>(brightness * 255.0f + 0.5f); + r = g = b = (int) (brightness * 255.0f + 0.5f); } else { @@ -52,37 +52,37 @@ Color Color::getHSBColor(float hue, float saturation, float brightness) float p = brightness * (1.0f - saturation); float q = brightness * (1.0f - saturation * f); float t = brightness * (1.0f - (saturation * (1.0f - f))); - switch (static_cast<int>(h)) + switch ((int) h) { case 0: - r = static_cast<int>(brightness * 255.0f + 0.5f); - g = static_cast<int>(t * 255.0f + 0.5f); - b = static_cast<int>(p * 255.0f + 0.5f); + r = (int) (brightness * 255.0f + 0.5f); + g = (int) (t * 255.0f + 0.5f); + b = (int) (p * 255.0f + 0.5f); break; case 1: - r = static_cast<int>(q * 255.0f + 0.5f); - g = static_cast<int>(brightness * 255.0f + 0.5f); - b = static_cast<int>(p * 255.0f + 0.5f); + r = (int) (q * 255.0f + 0.5f); + g = (int) (brightness * 255.0f + 0.5f); + b = (int) (p * 255.0f + 0.5f); break; case 2: - r = static_cast<int>(p * 255.0f + 0.5f); - g = static_cast<int>(brightness * 255.0f + 0.5f); - b = static_cast<int>(t * 255.0f + 0.5f); + r = (int) (p * 255.0f + 0.5f); + g = (int) (brightness * 255.0f + 0.5f); + b = (int) (t * 255.0f + 0.5f); break; case 3: - r = static_cast<int>(p * 255.0f + 0.5f); - g = static_cast<int>(q * 255.0f + 0.5f); - b = static_cast<int>(brightness * 255.0f + 0.5f); + r = (int) (p * 255.0f + 0.5f); + g = (int) (q * 255.0f + 0.5f); + b = (int) (brightness * 255.0f + 0.5f); break; case 4: - r = static_cast<int>(t * 255.0f + 0.5f); - g = static_cast<int>(p * 255.0f + 0.5f); - b = static_cast<int>(brightness * 255.0f + 0.5f); + r = (int) (t * 255.0f + 0.5f); + g = (int) (p * 255.0f + 0.5f); + b = (int) (brightness * 255.0f + 0.5f); break; case 5: - r = static_cast<int>(brightness * 255.0f + 0.5f); - g = static_cast<int>(p * 255.0f + 0.5f); - b = static_cast<int>(q * 255.0f + 0.5f); + r = (int) (brightness * 255.0f + 0.5f); + g = (int) (p * 255.0f + 0.5f); + b = (int) (q * 255.0f + 0.5f); break; } } |
