aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Texture.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/Texture.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/Texture.cpp')
-rw-r--r--Minecraft.Client/Texture.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/Minecraft.Client/Texture.cpp b/Minecraft.Client/Texture.cpp
index b7e58d5f..809f606a 100644
--- a/Minecraft.Client/Texture.cpp
+++ b/Minecraft.Client/Texture.cpp
@@ -24,7 +24,7 @@ Texture::Texture(const wstring &name, int mode, int width, int height, int depth
void Texture::_init(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, bool mipMap)
{
#ifdef __PS3__
- if(g_texBlitJobQueuePort == nullptr)
+ if(g_texBlitJobQueuePort == NULL)
g_texBlitJobQueuePort = new C4JSpursJobQueue::Port("C4JSpursJob_Texture_blit");
#endif
this->name = name;
@@ -40,7 +40,7 @@ void Texture::_init(const wstring &name, int mode, int width, int height, int de
m_bInitialised = false;
for( int i = 0 ; i < 10; i++ )
{
- data[i] = nullptr;
+ data[i] = NULL;
}
rect = new Rect2i(0, 0, width, height);
@@ -105,7 +105,7 @@ void Texture::_init(const wstring &name, int mode, int width, int height, int de
void Texture::_init(const wstring &name, int mode, int width, int height, int depth, int wrapMode, int format, int minFilter, int magFilter, BufferedImage *image, bool mipMap)
{
_init(name, mode, width, height, depth, wrapMode, format, minFilter, magFilter, mipMap);
- if (image == nullptr)
+ if (image == NULL)
{
if (width == -1 || height == -1)
{
@@ -195,7 +195,7 @@ Texture::~Texture()
for(int i = 0; i < 10; i++ )
{
- if(data[i] != nullptr) delete data[i];
+ if(data[i] != NULL) delete data[i];
}
if(glId >= 0)
@@ -225,10 +225,10 @@ void Texture::fill(const Rect2i *rect, int color)
int line = y * width * 4;
for (int x = myRect->getX(); x < (myRect->getX() + myRect->getWidth()); x++)
{
- data[0]->put(line + x * 4 + 0, static_cast<BYTE>((color >> 24) & 0x000000ff));
- data[0]->put(line + x * 4 + 1, static_cast<BYTE>((color >> 16) & 0x000000ff));
- data[0]->put(line + x * 4 + 2, static_cast<BYTE>((color >> 8) & 0x000000ff));
- data[0]->put(line + x * 4 + 3, static_cast<BYTE>((color >> 0) & 0x000000ff));
+ data[0]->put(line + x * 4 + 0, (BYTE)((color >> 24) & 0x000000ff));
+ data[0]->put(line + x * 4 + 1, (BYTE)((color >> 16) & 0x000000ff));
+ data[0]->put(line + x * 4 + 2, (BYTE)((color >> 8) & 0x000000ff));
+ data[0]->put(line + x * 4 + 3, (BYTE)((color >> 0) & 0x000000ff));
}
}
delete myRect;
@@ -258,7 +258,7 @@ void Texture::writeAsBMP(const wstring &name)
outFile.delete();
}
- DataOutputStream *outStream = nullptr;
+ DataOutputStream *outStream = NULL;
//try {
outStream = new DataOutputStream(new FileOutputStream(outFile));
//} catch (IOException e) {
@@ -384,7 +384,7 @@ void Texture::blit(int x, int y, Texture *source, bool rotated)
{
ByteBuffer *srcBuffer = source->getData(level);
- if(srcBuffer == nullptr) break;
+ if(srcBuffer == NULL) break;
int yy = y >> level;
int xx = x >> level;
@@ -530,10 +530,10 @@ void Texture::transferFromBuffer(intArray buffer)
{
int texel = column + x * 4;
data[0]->position(0);
- data[0]->put(texel + byteRemap[0], static_cast<byte>((buffer[texel >> 2] >> 24) & 0xff));
- data[0]->put(texel + byteRemap[1], static_cast<byte>((buffer[texel >> 2] >> 16) & 0xff));
- data[0]->put(texel + byteRemap[2], static_cast<byte>((buffer[texel >> 2] >> 8) & 0xff));
- data[0]->put(texel + byteRemap[3], static_cast<byte>((buffer[texel >> 2] >> 0) & 0xff));
+ data[0]->put(texel + byteRemap[0], (byte)((buffer[texel >> 2] >> 24) & 0xff));
+ data[0]->put(texel + byteRemap[1], (byte)((buffer[texel >> 2] >> 16) & 0xff));
+ data[0]->put(texel + byteRemap[2], (byte)((buffer[texel >> 2] >> 8) & 0xff));
+ data[0]->put(texel + byteRemap[3], (byte)((buffer[texel >> 2] >> 0) & 0xff));
}
}
}
@@ -589,19 +589,19 @@ void Texture::transferFromImage(BufferedImage *image)
// Pull ARGB bytes into either RGBA or BGRA depending on format
- tempBytes[byteIndex + byteRemap[0]] = static_cast<byte>((tempPixels[intIndex] >> 24) & 0xff);
- tempBytes[byteIndex + byteRemap[1]] = static_cast<byte>((tempPixels[intIndex] >> 16) & 0xff);
- tempBytes[byteIndex + byteRemap[2]] = static_cast<byte>((tempPixels[intIndex] >> 8) & 0xff);
- tempBytes[byteIndex + byteRemap[3]] = static_cast<byte>((tempPixels[intIndex] >> 0) & 0xff);
+ tempBytes[byteIndex + byteRemap[0]] = (byte)((tempPixels[intIndex] >> 24) & 0xff);
+ tempBytes[byteIndex + byteRemap[1]] = (byte)((tempPixels[intIndex] >> 16) & 0xff);
+ tempBytes[byteIndex + byteRemap[2]] = (byte)((tempPixels[intIndex] >> 8) & 0xff);
+ tempBytes[byteIndex + byteRemap[3]] = (byte)((tempPixels[intIndex] >> 0) & 0xff);
}
}
for(int i = 0; i < 10; i++ )
{
- if(data[i] != nullptr)
+ if(data[i] != NULL)
{
delete data[i];
- data[i] = nullptr;
+ data[i] = NULL;
}
}
@@ -618,7 +618,7 @@ void Texture::transferFromImage(BufferedImage *image)
delete [] tempBytes.data;
- if(mipmapped || image->getData(1) != nullptr)
+ if(mipmapped || image->getData(1) != NULL)
{
mipmapped = true;
for(unsigned int level = 1; level < MAX_MIP_LEVELS; ++level)
@@ -641,10 +641,10 @@ void Texture::transferFromImage(BufferedImage *image)
// Pull ARGB bytes into either RGBA or BGRA depending on format
- tempBytes[byteIndex + byteRemap[0]] = static_cast<byte>((tempData[intIndex] >> 24) & 0xff);
- tempBytes[byteIndex + byteRemap[1]] = static_cast<byte>((tempData[intIndex] >> 16) & 0xff);
- tempBytes[byteIndex + byteRemap[2]] = static_cast<byte>((tempData[intIndex] >> 8) & 0xff);
- tempBytes[byteIndex + byteRemap[3]] = static_cast<byte>((tempData[intIndex] >> 0) & 0xff);
+ tempBytes[byteIndex + byteRemap[0]] = (byte)((tempData[intIndex] >> 24) & 0xff);
+ tempBytes[byteIndex + byteRemap[1]] = (byte)((tempData[intIndex] >> 16) & 0xff);
+ tempBytes[byteIndex + byteRemap[2]] = (byte)((tempData[intIndex] >> 8) & 0xff);
+ tempBytes[byteIndex + byteRemap[3]] = (byte)((tempData[intIndex] >> 0) & 0xff);
}
}
}
@@ -676,10 +676,10 @@ void Texture::transferFromImage(BufferedImage *image)
// Pull ARGB bytes into either RGBA or BGRA depending on format
- tempBytes[byteIndex + byteRemap[0]] = static_cast<byte>((col >> 24) & 0xff);
- tempBytes[byteIndex + byteRemap[1]] = static_cast<byte>((col >> 16) & 0xff);
- tempBytes[byteIndex + byteRemap[2]] = static_cast<byte>((col >> 8) & 0xff);
- tempBytes[byteIndex + byteRemap[3]] = static_cast<byte>((col >> 0) & 0xff);
+ tempBytes[byteIndex + byteRemap[0]] = (byte)((col >> 24) & 0xff);
+ tempBytes[byteIndex + byteRemap[1]] = (byte)((col >> 16) & 0xff);
+ tempBytes[byteIndex + byteRemap[2]] = (byte)((col >> 8) & 0xff);
+ tempBytes[byteIndex + byteRemap[3]] = (byte)((col >> 0) & 0xff);
}
}
@@ -713,8 +713,8 @@ void Texture::transferFromImage(BufferedImage *image)
// 4J Kept from older versions for where we create mip-maps for levels that do not have pre-made graphics
int Texture::crispBlend(int c0, int c1)
{
- int a0 = static_cast<int>(((c0 & 0xff000000) >> 24)) & 0xff;
- int a1 = static_cast<int>(((c1 & 0xff000000) >> 24)) & 0xff;
+ int a0 = (int) (((c0 & 0xff000000) >> 24)) & 0xff;
+ int a1 = (int) (((c1 & 0xff000000) >> 24)) & 0xff;
int a = 255;
if (a0 + a1 < 255)
@@ -807,7 +807,7 @@ void Texture::updateOnGPU()
{
for (int level = 1; level < m_iMipLevels; level++)
{
- if(data[level] == nullptr) break;
+ if(data[level] == NULL) break;
data[level]->flip();
}