Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 7 additions & 7 deletions Minecraft.Client/AbstractContainerScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
glColor4f(1, 1, 1, 1);
glEnable(GL_RESCALE_NORMAL);

Slot *hoveredSlot = NULL;
Slot *hoveredSlot = nullptr;

for ( Slot *slot : *menu->slots )
{
Expand All @@ -73,7 +73,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
}

shared_ptr<Inventory> inventory = minecraft->player->inventory;
if (inventory->getCarried() != NULL)
if (inventory->getCarried() != nullptr)
{
glTranslatef(0, 0, 32);
// Slot old = carriedSlot;
Expand All @@ -90,7 +90,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a)

renderLabels();

if (inventory->getCarried() == NULL && hoveredSlot != NULL && hoveredSlot->hasItem())
if (inventory->getCarried() == nullptr && hoveredSlot != nullptr && hoveredSlot->hasItem())
{

wstring elementName = trimString(Language::getInstance()->getElementName(hoveredSlot->getItem()->getDescriptionId()));
Expand Down Expand Up @@ -127,7 +127,7 @@ void AbstractContainerScreen::renderSlot(Slot *slot)
int y = slot->y;
shared_ptr<ItemInstance> item = slot->getItem();

if (item == NULL)
if (item == nullptr)
{
int icon = slot->getNoItemIcon();
if (icon >= 0)
Expand All @@ -151,7 +151,7 @@ Slot *AbstractContainerScreen::findSlot(int x, int y)
{
if (isHovering(slot, x, y)) return slot;
}
return NULL;
return nullptr;
}

bool AbstractContainerScreen::isHovering(Slot *slot, int xm, int ym)
Expand All @@ -177,7 +177,7 @@ void AbstractContainerScreen::mouseClicked(int x, int y, int buttonNum)
bool clickedOutside = (x < xo || y < yo || x >= xo + imageWidth || y >= yo + imageHeight);

int slotId = -1;
if (slot != NULL) slotId = slot->index;
if (slot != nullptr) slotId = slot->index;

if (clickedOutside)
{
Expand Down Expand Up @@ -210,7 +210,7 @@ void AbstractContainerScreen::keyPressed(wchar_t eventCharacter, int eventKey)

void AbstractContainerScreen::removed()
{
if (minecraft->player == NULL) return;
if (minecraft->player == nullptr) return;
}

void AbstractContainerScreen::slotsChanged(shared_ptr<Container> container)
Expand Down
49 changes: 25 additions & 24 deletions Minecraft.Client/AbstractTexturePack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@
#include "AbstractTexturePack.h"
#include "..\Minecraft.World\InputOutputStream.h"
#include "..\Minecraft.World\StringHelpers.h"
#include "Common/UI/UI.h"

AbstractTexturePack::AbstractTexturePack(DWORD id, File *file, const wstring &name, TexturePack *fallback) : id(id), name(name)
{
// 4J init
textureId = -1;
m_colourTable = NULL;
m_colourTable = nullptr;


this->file = file;
this->fallback = fallback;

m_iconData = NULL;
m_iconData = nullptr;
m_iconSize = 0;

m_comparisonData = NULL;
m_comparisonData = nullptr;
m_comparisonSize = 0;

// 4J Stu - These calls need to be in the most derived version of the class
Expand All @@ -41,7 +42,7 @@ void AbstractTexturePack::loadIcon()
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
WCHAR szResourceLocator[ LOCATOR_SIZE ];

const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/TexturePackIcon.png");

UINT size = 0;
Expand All @@ -57,7 +58,7 @@ void AbstractTexturePack::loadComparison()
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
WCHAR szResourceLocator[ LOCATOR_SIZE ];

const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);
swprintf(szResourceLocator, LOCATOR_SIZE ,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/Graphics/DefaultPack_Comparison.png");

UINT size = 0;
Expand All @@ -70,8 +71,8 @@ void AbstractTexturePack::loadDescription()
{
// 4J Unused currently
#if 0
InputStream *inputStream = NULL;
BufferedReader *br = NULL;
InputStream *inputStream = nullptr;
BufferedReader *br = nullptr;
//try {
inputStream = getResourceImplementation(L"/pack.txt");
br = new BufferedReader(new InputStreamReader(inputStream));
Expand All @@ -81,12 +82,12 @@ void AbstractTexturePack::loadDescription()
//} finally {
// TODO [EB]: use IOUtils.closeSilently()
// try {
if (br != NULL)
if (br != nullptr)
{
br->close();
delete br;
}
if (inputStream != NULL)
if (inputStream != nullptr)
{
inputStream->close();
delete inputStream;
Expand All @@ -105,7 +106,7 @@ InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFal
{
app.DebugPrintf("texture - %ls\n",name.c_str());
InputStream *is = getResourceImplementation(name);
if (is == NULL && fallback != NULL && allowFallback)
if (is == nullptr && fallback != nullptr && allowFallback)
{
is = fallback->getResource(name, true);
}
Expand All @@ -121,15 +122,15 @@ InputStream *AbstractTexturePack::getResource(const wstring &name, bool allowFal

void AbstractTexturePack::unload(Textures *textures)
{
if (iconImage != NULL && textureId != -1)
if (iconImage != nullptr && textureId != -1)
{
textures->releaseTexture(textureId);
}
}

void AbstractTexturePack::load(Textures *textures)
{
if (iconImage != NULL)
if (iconImage != nullptr)
{
if (textureId == -1)
{
Expand All @@ -149,7 +150,7 @@ bool AbstractTexturePack::hasFile(const wstring &name, bool allowFallback)
{
bool hasFile = this->hasFile(name);

return !hasFile && (allowFallback && fallback != NULL) ? fallback->hasFile(name, allowFallback) : hasFile;
return !hasFile && (allowFallback && fallback != nullptr) ? fallback->hasFile(name, allowFallback) : hasFile;
}

DWORD AbstractTexturePack::getId()
Expand Down Expand Up @@ -231,7 +232,7 @@ void AbstractTexturePack::loadDefaultUI()
{
#ifdef _XBOX
// load from the .xzp file
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);

// Load new skin
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
Expand All @@ -240,7 +241,7 @@ void AbstractTexturePack::loadDefaultUI()
swprintf(szResourceLocator, LOCATOR_SIZE,L"section://%X,%ls#%ls",c_ModuleHandle,L"media", L"media/skin_Minecraft.xur");

XuiFreeVisuals(L"");
app.LoadSkin(szResourceLocator,NULL);//L"TexturePack");
app.LoadSkin(szResourceLocator,nullptr);//L"TexturePack");
//CXuiSceneBase::GetInstance()->SetVisualPrefix(L"TexturePack");
CXuiSceneBase::GetInstance()->SkinChanged(CXuiSceneBase::GetInstance()->m_hObj);
#else
Expand All @@ -259,7 +260,7 @@ void AbstractTexturePack::loadDefaultColourTable()
// Load the file
#ifdef __PS3__
// need to check if it's a BD build, so pass in the name
File coloursFile(AbstractTexturePack::getPath(true,app.GetBootedFromDiscPatch()?"colours.col":NULL).append(L"res/colours.col"));
File coloursFile(AbstractTexturePack::getPath(true,app.GetBootedFromDiscPatch()?"colours.col":nullptr).append(L"res/colours.col"));

#else
File coloursFile(AbstractTexturePack::getPath(true).append(L"res/colours.col"));
Expand All @@ -269,12 +270,12 @@ void AbstractTexturePack::loadDefaultColourTable()
if(coloursFile.exists())
{
DWORD dwLength = coloursFile.length();
byteArray data(dwLength);
byteArray data(static_cast<unsigned int>(dwLength));

FileInputStream fis(coloursFile);
fis.read(data,0,dwLength);
fis.close();
if(m_colourTable != NULL) delete m_colourTable;
if(m_colourTable != nullptr) delete m_colourTable;
m_colourTable = new ColourTable(data.data, dwLength);

delete [] data.data;
Expand All @@ -290,7 +291,7 @@ void AbstractTexturePack::loadDefaultHTMLColourTable()
{
#ifdef _XBOX
// load from the .xzp file
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);

const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
WCHAR szResourceLocator[ LOCATOR_SIZE ];
Expand All @@ -309,7 +310,7 @@ void AbstractTexturePack::loadDefaultHTMLColourTable()
{
wsprintfW(szResourceLocator,L"section://%X,%s#%s",c_ModuleHandle,L"media", L"media/");
HXUIOBJ hScene;
HRESULT hr = XuiSceneCreate(szResourceLocator,L"xuiscene_colourtable.xur", NULL, &hScene);
HRESULT hr = XuiSceneCreate(szResourceLocator,L"xuiscene_colourtable.xur", nullptr, &hScene);

if(HRESULT_SUCCEEDED(hr))
{
Expand All @@ -333,7 +334,7 @@ void AbstractTexturePack::loadHTMLColourTableFromXuiScene(HXUIOBJ hObj)
HXUIOBJ child;
HRESULT hr = XuiElementGetFirstChild(hObj, &child);

while(HRESULT_SUCCEEDED(hr) && child != NULL)
while(HRESULT_SUCCEEDED(hr) && child != nullptr)
{
LPCWSTR childName;
XuiElementGetId(child,&childName);
Expand Down Expand Up @@ -374,7 +375,7 @@ void AbstractTexturePack::unloadUI()

wstring AbstractTexturePack::getXuiRootPath()
{
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(NULL);
const ULONG_PTR c_ModuleHandle = (ULONG_PTR)GetModuleHandle(nullptr);

// Load new skin
const DWORD LOCATOR_SIZE = 256; // Use this to allocate space to hold a ResourceLocator string
Expand All @@ -386,14 +387,14 @@ wstring AbstractTexturePack::getXuiRootPath()

PBYTE AbstractTexturePack::getPackIcon(DWORD &dwImageBytes)
{
if(m_iconSize == 0 || m_iconData == NULL) loadIcon();
if(m_iconSize == 0 || m_iconData == nullptr) loadIcon();
dwImageBytes = m_iconSize;
return m_iconData;
}

PBYTE AbstractTexturePack::getPackComparison(DWORD &dwImageBytes)
{
if(m_comparisonSize == 0 || m_comparisonData == NULL) loadComparison();
if(m_comparisonSize == 0 || m_comparisonData == nullptr) loadComparison();

dwImageBytes = m_comparisonSize;
return m_comparisonData;
Expand Down
2 changes: 1 addition & 1 deletion Minecraft.Client/AbstractTexturePack.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ class AbstractTexturePack : public TexturePack
virtual unsigned int getDLCParentPackId();
virtual unsigned char getDLCSubPackId();
virtual ColourTable *getColourTable() { return m_colourTable; }
virtual ArchiveFile *getArchiveFile() { return NULL; }
virtual ArchiveFile *getArchiveFile() { return nullptr; }
};
6 changes: 3 additions & 3 deletions Minecraft.Client/AchievementPopup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ AchievementPopup::AchievementPopup(Minecraft *mc)
// 4J - added initialisers
width = 0;
height = 0;
ach = NULL;
ach = nullptr;
startTime = 0;
isHelper = false;

Expand Down Expand Up @@ -59,7 +59,7 @@ void AchievementPopup::prepareWindow()
glClear(GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, (float)width, (float)height, 0, 1000, 3000);
glOrtho(0, static_cast<float>(width), static_cast<float>(height), 0, 1000, 3000);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0, 0, -2000);
Expand Down Expand Up @@ -88,7 +88,7 @@ void AchievementPopup::render()
glDepthMask(true);
glEnable(GL_DEPTH_TEST);
}
if (ach == NULL || startTime == 0) return;
if (ach == nullptr || startTime == 0) return;

double time = (System::currentTimeMillis() - startTime) / 3000.0;
if (isHelper)
Expand Down
8 changes: 4 additions & 4 deletions Minecraft.Client/AchievementScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ void AchievementScreen::buttonClicked(Button *button)
{
if (button->id == 1)
{
minecraft->setScreen(NULL);
minecraft->setScreen(nullptr);
// minecraft->grabMouse(); // 4J removed
}
Screen::buttonClicked(button);
Expand All @@ -62,7 +62,7 @@ void AchievementScreen::keyPressed(char eventCharacter, int eventKey)
{
if (eventKey == minecraft->options->keyBuild->key)
{
minecraft->setScreen(NULL);
minecraft->setScreen(nullptr);
// minecraft->grabMouse(); // 4J removed
}
else
Expand Down Expand Up @@ -286,7 +286,7 @@ void AchievementScreen::renderBg(int xm, int ym, float a)
vLine(x2, y1, y2, color);
}

Achievement *hoveredAchievement = NULL;
Achievement *hoveredAchievement = nullptr;
ItemRenderer *ir = new ItemRenderer();

glPushMatrix();
Expand Down Expand Up @@ -372,7 +372,7 @@ void AchievementScreen::renderBg(int xm, int ym, float a)
glEnable(GL_TEXTURE_2D);
Screen::render(xm, ym, a);

if (hoveredAchievement != NULL)
if (hoveredAchievement != nullptr)
{
Achievement *ach = hoveredAchievement;
wstring name = ach->name;
Expand Down
Loading