aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/CompassTexture.cpp
diff options
context:
space:
mode:
authorLoki Rautio <lokirautio@gmail.com>2026-03-07 21:12:22 -0600
committerLoki Rautio <lokirautio@gmail.com>2026-03-07 21:12:22 -0600
commit087b7e7abfe81dd7f0fdcdea36ac9f245950df1a (patch)
tree69454763e73ca764af4e682d3573080b13138a0e /Minecraft.Client/CompassTexture.cpp
parenta9be52c41a02d207233199e98898fe7483d7e817 (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.Client/CompassTexture.cpp')
-rw-r--r--Minecraft.Client/CompassTexture.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/Minecraft.Client/CompassTexture.cpp b/Minecraft.Client/CompassTexture.cpp
index 14806991..bba43b78 100644
--- a/Minecraft.Client/CompassTexture.cpp
+++ b/Minecraft.Client/CompassTexture.cpp
@@ -7,13 +7,13 @@
#include "Texture.h"
#include "CompassTexture.h"
-CompassTexture *CompassTexture::instance = nullptr;
+CompassTexture *CompassTexture::instance = NULL;
CompassTexture::CompassTexture() : StitchedTexture(L"compass",L"compass")
{
instance = this;
- m_dataTexture = nullptr;
+ m_dataTexture = NULL;
m_iPad = XUSER_INDEX_ANY;
rot = rota = 0.0;
@@ -31,27 +31,27 @@ void CompassTexture::cycleFrames()
{
Minecraft *mc = Minecraft::GetInstance();
- if (m_iPad >= 0 && m_iPad < XUSER_MAX_COUNT && mc->level != nullptr && mc->localplayers[m_iPad] != nullptr)
+ if (m_iPad >= 0 && m_iPad < XUSER_MAX_COUNT && mc->level != NULL && mc->localplayers[m_iPad] != NULL)
{
updateFromPosition(mc->localplayers[m_iPad]->level, mc->localplayers[m_iPad]->x, mc->localplayers[m_iPad]->z, mc->localplayers[m_iPad]->yRot, false, false);
}
else
{
frame = 1;
- updateFromPosition(nullptr, 0, 0, 0, false, true);
+ updateFromPosition(NULL, 0, 0, 0, false, true);
}
}
void CompassTexture::updateFromPosition(Level *level, double x, double z, double yRot, bool noNeedle, bool instant)
{
double rott = 0;
- if (level != nullptr && !noNeedle)
+ if (level != NULL && !noNeedle)
{
Pos *spawnPos = level->getSharedSpawnPos();
double xa = spawnPos->x - x;
double za = spawnPos->z - z;
delete spawnPos;
- yRot = static_cast<int>(yRot) % 360;
+ yRot = (int)yRot % 360;
rott = -((yRot - 90) * PI / 180 - atan2(za, xa));
if (!level->dimension->isNaturalDimension())
{
@@ -78,9 +78,9 @@ void CompassTexture::updateFromPosition(Level *level, double x, double z, double
}
// 4J Stu - We share data with another texture
- if(m_dataTexture != nullptr)
+ if(m_dataTexture != NULL)
{
- int newFrame = static_cast<int>(((rot / (PI * 2)) + 1.0) * m_dataTexture->frames->size()) % m_dataTexture->frames->size();
+ int newFrame = (int) (((rot / (PI * 2)) + 1.0) * m_dataTexture->frames->size()) % m_dataTexture->frames->size();
while (newFrame < 0)
{
newFrame = (newFrame + m_dataTexture->frames->size()) % m_dataTexture->frames->size();
@@ -93,7 +93,7 @@ void CompassTexture::updateFromPosition(Level *level, double x, double z, double
}
else
{
- int newFrame = static_cast<int>(((rot / (PI * 2)) + 1.0) * frames->size()) % frames->size();
+ int newFrame = (int) (((rot / (PI * 2)) + 1.0) * frames->size()) % frames->size();
while (newFrame < 0)
{
newFrame = (newFrame + frames->size()) % frames->size();
@@ -118,7 +118,7 @@ int CompassTexture::getSourceHeight() const
int CompassTexture::getFrames()
{
- if(m_dataTexture == nullptr)
+ if(m_dataTexture == NULL)
{
return StitchedTexture::getFrames();
}
@@ -130,7 +130,7 @@ int CompassTexture::getFrames()
void CompassTexture::freeFrameTextures()
{
- if(m_dataTexture == nullptr)
+ if(m_dataTexture == NULL)
{
StitchedTexture::freeFrameTextures();
}
@@ -138,5 +138,5 @@ void CompassTexture::freeFrameTextures()
bool CompassTexture::hasOwnData()
{
- return m_dataTexture == nullptr;
+ return m_dataTexture == NULL;
} \ No newline at end of file