aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp')
-rw-r--r--Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp73
1 files changed, 36 insertions, 37 deletions
diff --git a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp
index 21f21627..e55f207d 100644
--- a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp
+++ b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp
@@ -2,7 +2,6 @@
#include "IUIScene_AbstractContainerMenu.h"
-#include "UI.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.item.crafting.h"
@@ -22,9 +21,9 @@ SavedInventoryCursorPos g_savedInventoryCursorPos = { 0.0f, 0.0f, false };
IUIScene_AbstractContainerMenu::IUIScene_AbstractContainerMenu()
{
- m_menu = nullptr;
+ m_menu = NULL;
m_autoDeleteMenu = false;
- m_lastPointerLabelSlot = nullptr;
+ m_lastPointerLabelSlot = NULL;
m_pointerPos.x = 0.0f;
m_pointerPos.y = 0.0f;
@@ -42,7 +41,7 @@ IUIScene_AbstractContainerMenu::~IUIScene_AbstractContainerMenu()
void IUIScene_AbstractContainerMenu::Initialize(int iPad, AbstractContainerMenu* menu, bool autoDeleteMenu, int startIndex,ESceneSection firstSection,ESceneSection maxSection, bool bNavigateBack)
{
- assert( menu != nullptr );
+ assert( menu != NULL );
m_menu = menu;
m_autoDeleteMenu = autoDeleteMenu;
@@ -268,10 +267,10 @@ void IUIScene_AbstractContainerMenu::UpdateTooltips()
void IUIScene_AbstractContainerMenu::onMouseTick()
{
Minecraft *pMinecraft = Minecraft::GetInstance();
- if( pMinecraft->localgameModes[getPad()] != nullptr)
+ if( pMinecraft->localgameModes[getPad()] != NULL)
{
Tutorial *tutorial = pMinecraft->localgameModes[getPad()]->getTutorial();
- if(tutorial != nullptr)
+ if(tutorial != NULL)
{
if(ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(ACTION_MENU_UP))
{
@@ -297,8 +296,8 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
int iPad = getPad();
bool bStickInput = false;
- float fInputX = InputManager.GetJoypadStick_LX( iPad, false )*(static_cast<float>(app.GetGameSettings(iPad, eGameSetting_Sensitivity_InMenu))/100.0f); // apply the sensitivity
- float fInputY = InputManager.GetJoypadStick_LY( iPad, false )*(static_cast<float>(app.GetGameSettings(iPad, eGameSetting_Sensitivity_InMenu))/100.0f); // apply the sensitivity
+ float fInputX = InputManager.GetJoypadStick_LX( iPad, false )*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f); // apply the sensitivity
+ float fInputY = InputManager.GetJoypadStick_LY( iPad, false )*((float)app.GetGameSettings(iPad,eGameSetting_Sensitivity_InMenu)/100.0f); // apply the sensitivity
#ifdef __ORBIS__
// should have sensitivity for the touchpad
@@ -407,7 +406,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
if ( m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_SCALING )
{
++m_iConsectiveInputTicks;
- fInputScale = ( static_cast<float>(m_iConsectiveInputTicks) / static_cast<float>((MAX_INPUT_TICKS_FOR_SCALING)) );
+ fInputScale = ( (float)( m_iConsectiveInputTicks) / (float)(MAX_INPUT_TICKS_FOR_SCALING) );
}
#ifdef TAP_DETECTION
else if ( m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_TAPPING )
@@ -495,11 +494,11 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
if (winW > 0 && winH > 0)
{
- float scaleX = static_cast<float>(getMovieWidth()) / static_cast<float>(winW);
- float scaleY = static_cast<float>(getMovieHeight()) / static_cast<float>(winH);
+ float scaleX = (float)getMovieWidth() / (float)winW;
+ float scaleY = (float)getMovieHeight() / (float)winH;
- vPointerPos.x += static_cast<float>(deltaX) * scaleX;
- vPointerPos.y += static_cast<float>(deltaY) * scaleY;
+ vPointerPos.x += (float)deltaX * scaleX;
+ vPointerPos.y += (float)deltaY * scaleY;
}
if (deltaX != 0 || deltaY != 0)
@@ -528,7 +527,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
}
else if ( eSectionUnderPointer == eSectionNone )
{
- ESceneSection eSection = static_cast<ESceneSection>(iSection);
+ ESceneSection eSection = ( ESceneSection )( iSection );
// Get position of this section.
UIVec2D sectionPos;
@@ -759,17 +758,17 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
// What are we carrying on pointer.
shared_ptr<LocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
shared_ptr<ItemInstance> carriedItem = nullptr;
- if(player != nullptr) carriedItem = player->inventory->getCarried();
+ if(player != NULL) carriedItem = player->inventory->getCarried();
shared_ptr<ItemInstance> slotItem = nullptr;
- Slot *slot = nullptr;
+ Slot *slot = NULL;
int slotIndex = 0;
if(bPointerIsOverSlot)
{
slotIndex = iNewSlotIndex + getSectionStartOffset( eSectionUnderPointer );
slot = m_menu->getSlot(slotIndex);
}
- bool bIsItemCarried = carriedItem != nullptr;
+ bool bIsItemCarried = carriedItem != NULL;
int iCarriedCount = 0;
bool bCarriedIsSameAsSlot = false; // Indicates if same item is carried on pointer as is in slot under pointer.
if ( bIsItemCarried )
@@ -789,7 +788,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
if ( bPointerIsOverSlot )
{
slotItem = slot->getItem();
- bSlotHasItem = slotItem != nullptr;
+ bSlotHasItem = slotItem != NULL;
if ( bSlotHasItem )
{
iSlotCount = slotItem->GetCount();
@@ -830,13 +829,13 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
{
vector<HtmlString> *desc = GetSectionHoverText(eSectionUnderPointer);
SetPointerText(desc, false);
- m_lastPointerLabelSlot = nullptr;
+ m_lastPointerLabelSlot = NULL;
delete desc;
}
else
{
- SetPointerText(nullptr, false);
- m_lastPointerLabelSlot = nullptr;
+ SetPointerText(NULL, false);
+ m_lastPointerLabelSlot = NULL;
}
EToolTipItem buttonA, buttonX, buttonY, buttonRT, buttonBack;
@@ -1022,7 +1021,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
// Get the info on this item.
shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
bool bValidFuel = FurnaceTileEntity::isFuel(item);
- bool bValidIngredient = FurnaceRecipes::getInstance()->getResult(item->getItem()->id) != nullptr;
+ bool bValidIngredient = FurnaceRecipes::getInstance()->getResult(item->getItem()->id) != NULL;
if(bValidIngredient)
{
@@ -1037,7 +1036,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
}
else
{
- if(FurnaceRecipes::getInstance()->getResult(item->id)==nullptr)
+ if(FurnaceRecipes::getInstance()->getResult(item->id)==NULL)
{
buttonY = eToolTipQuickMove;
}
@@ -1077,7 +1076,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
}
else
{
- if(FurnaceRecipes::getInstance()->getResult(item->id)==nullptr)
+ if(FurnaceRecipes::getInstance()->getResult(item->id)==NULL)
{
buttonY = eToolTipQuickMove;
}
@@ -1310,9 +1309,9 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
}
vPointerPos.x = floor(vPointerPos.x);
- vPointerPos.x += ( static_cast<int>(vPointerPos.x)%2);
+ vPointerPos.x += ( (int)vPointerPos.x%2);
vPointerPos.y = floor(vPointerPos.y);
- vPointerPos.y += ( static_cast<int>(vPointerPos.y)%2);
+ vPointerPos.y += ( (int)vPointerPos.y%2);
m_pointerPos = vPointerPos;
adjustPointerForSafeZone();
@@ -1323,10 +1322,10 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
bool bHandled = false;
Minecraft *pMinecraft = Minecraft::GetInstance();
- if( pMinecraft->localgameModes[getPad()] != nullptr )
+ if( pMinecraft->localgameModes[getPad()] != NULL )
{
Tutorial *tutorial = pMinecraft->localgameModes[getPad()]->getTutorial();
- if(tutorial != nullptr)
+ if(tutorial != NULL)
{
tutorial->handleUIInput(iAction);
if(ui.IsTutorialVisible(getPad()) && !tutorial->isInputAllowed(iAction))
@@ -1528,20 +1527,20 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
if ( bSlotHasItem )
{
shared_ptr<ItemInstance> item = getSlotItem(m_eCurrSection, currentIndex);
- if( Minecraft::GetInstance()->localgameModes[iPad] != nullptr )
+ if( Minecraft::GetInstance()->localgameModes[iPad] != NULL )
{
Tutorial::PopupMessageDetails *message = new Tutorial::PopupMessageDetails;
message->m_messageId = item->getUseDescriptionId();
- if(Item::items[item->id] != nullptr) message->m_titleString = Item::items[item->id]->getHoverName(item);
+ if(Item::items[item->id] != NULL) message->m_titleString = Item::items[item->id]->getHoverName(item);
message->m_titleId = item->getDescriptionId();
message->m_icon = item->id;
message->m_iAuxVal = item->getAuxValue();
message->m_forceDisplay = true;
- TutorialMode *gameMode = static_cast<TutorialMode *>(Minecraft::GetInstance()->localgameModes[iPad]);
- gameMode->getTutorial()->setMessage(nullptr, message);
+ TutorialMode *gameMode = (TutorialMode *)Minecraft::GetInstance()->localgameModes[iPad];
+ gameMode->getTutorial()->setMessage(NULL, message);
ui.PlayUISFX(eSFX_Press);
}
}
@@ -1643,7 +1642,7 @@ void IUIScene_AbstractContainerMenu::handleSlotListClicked(ESceneSection eSectio
void IUIScene_AbstractContainerMenu::slotClicked(int slotId, int buttonNum, bool quickKey)
{
// 4J Stu - Removed this line as unused
- //if (slot != nullptr) slotId = slot->index;
+ //if (slot != NULL) slotId = slot->index;
Minecraft *pMinecraft = Minecraft::GetInstance();
pMinecraft->localgameModes[getPad()]->handleInventoryMouseClick(m_menu->containerId, slotId, buttonNum, quickKey, pMinecraft->localplayers[getPad()] );
@@ -1660,7 +1659,7 @@ int IUIScene_AbstractContainerMenu::getCurrentIndex(ESceneSection eSection)
bool IUIScene_AbstractContainerMenu::IsSameItemAs(shared_ptr<ItemInstance> itemA, shared_ptr<ItemInstance> itemB)
{
- if(itemA == nullptr || itemB == nullptr) return false;
+ if(itemA == NULL || itemB == NULL) return false;
return (itemA->id == itemB->id && (!itemB->isStackedByData() || itemB->getAuxValue() == itemA->getAuxValue()) && ItemInstance::tagMatches(itemB, itemA) );
}
@@ -1669,7 +1668,7 @@ int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot *slot)
{
int iResult = 0;
- if(slot != nullptr && slot->hasItem())
+ if(slot != NULL && slot->hasItem())
{
shared_ptr<ItemInstance> item = slot->getItem();
if ( item->isStackable() )
@@ -1688,7 +1687,7 @@ int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot *slot)
vector<HtmlString> *IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slot)
{
- if(slot == nullptr) return nullptr;
+ if(slot == NULL) return NULL;
vector<HtmlString> *lines = slot->getItem()->getHoverText(nullptr, false);
@@ -1708,5 +1707,5 @@ vector<HtmlString> *IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slo
vector<HtmlString> *IUIScene_AbstractContainerMenu::GetSectionHoverText(ESceneSection eSection)
{
- return nullptr;
+ return NULL;
}