mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-30 04:02:54 +00:00
TU19: merge Minecraft.Client/Platform/Common/UI
This commit is contained in:
parent
4dd9b683bf
commit
b9d18bf641
|
|
@ -12,6 +12,7 @@
|
|||
#ifdef __ORBIS__
|
||||
#include <pad.h>
|
||||
#endif
|
||||
|
||||
IUIScene_AbstractContainerMenu::IUIScene_AbstractContainerMenu() {
|
||||
m_menu = NULL;
|
||||
m_autoDeleteMenu = false;
|
||||
|
|
@ -100,7 +101,7 @@ int IUIScene_AbstractContainerMenu::GetSectionDimensions(ESceneSection eSection,
|
|||
|
||||
void IUIScene_AbstractContainerMenu::updateSlotPosition(
|
||||
ESceneSection eSection, ESceneSection newSection, ETapState eTapDirection,
|
||||
int* piTargetX, int* piTargetY, int xOffset) {
|
||||
int* piTargetX, int* piTargetY, int xOffset, int yOffset) {
|
||||
// Update the target slot based on the size of the current section
|
||||
int columns, rows;
|
||||
|
||||
|
|
@ -116,8 +117,13 @@ void IUIScene_AbstractContainerMenu::updateSlotPosition(
|
|||
} else if (eTapDirection == eTapStateDown) {
|
||||
(*piTargetY) = 0;
|
||||
}
|
||||
if ((*piTargetY) < 0) {
|
||||
int offsetY = (*piTargetY) - yOffset;
|
||||
if (offsetY < 0) {
|
||||
(*piTargetY) = 0;
|
||||
} else if (offsetY >= rows) {
|
||||
(*piTargetY) = rows - 1;
|
||||
} else {
|
||||
(*piTargetY) = offsetY;
|
||||
}
|
||||
|
||||
// Update X
|
||||
|
|
@ -566,6 +572,9 @@ void IUIScene_AbstractContainerMenu::onMouseTick() {
|
|||
}
|
||||
}
|
||||
|
||||
// 4J - TomK - set to section none if this is a non-visible section
|
||||
if (!IsVisible(eSectionUnderPointer)) eSectionUnderPointer = eSectionNone;
|
||||
|
||||
// If we are not over any slot, set focus elsewhere.
|
||||
if (eSectionUnderPointer == eSectionNone) {
|
||||
setFocusToPointer(getPad());
|
||||
|
|
@ -755,19 +764,24 @@ void IUIScene_AbstractContainerMenu::onMouseTick() {
|
|||
}
|
||||
|
||||
if (bPointerIsOverSlot && bSlotHasItem) {
|
||||
std::vector<std::wstring> unformattedStrings;
|
||||
std::wstring desc = GetItemDescription(slot, unformattedStrings);
|
||||
SetPointerText(desc, unformattedStrings,
|
||||
slot != m_lastPointerLabelSlot);
|
||||
std::vector<HtmlString>* desc = GetItemDescription(slot);
|
||||
SetPointerText(desc, slot != m_lastPointerLabelSlot);
|
||||
m_lastPointerLabelSlot = slot;
|
||||
delete desc;
|
||||
} else if (eSectionUnderPointer != eSectionNone &&
|
||||
!IsSectionSlotList(eSectionUnderPointer)) {
|
||||
std::vector<HtmlString>* desc =
|
||||
GetSectionHoverText(eSectionUnderPointer);
|
||||
SetPointerText(desc, false);
|
||||
m_lastPointerLabelSlot = NULL;
|
||||
delete desc;
|
||||
} else {
|
||||
std::vector<std::wstring> unformattedStrings;
|
||||
SetPointerText(L"", unformattedStrings, false);
|
||||
SetPointerText(NULL, false);
|
||||
m_lastPointerLabelSlot = NULL;
|
||||
}
|
||||
|
||||
EToolTipItem buttonA, buttonX, buttonY, buttonRT;
|
||||
buttonA = buttonX = buttonY = buttonRT = eToolTipNone;
|
||||
EToolTipItem buttonA, buttonX, buttonY, buttonRT, buttonBack;
|
||||
buttonA = buttonX = buttonY = buttonRT = buttonBack = eToolTipNone;
|
||||
if (bPointerIsOverSlot) {
|
||||
SetPointerOutsideMenu(false);
|
||||
if (bIsItemCarried) {
|
||||
|
|
@ -828,11 +842,18 @@ void IUIScene_AbstractContainerMenu::onMouseTick() {
|
|||
if (bSlotHasItem) {
|
||||
if (iSlotCount == 1) {
|
||||
buttonA = eToolTipPickUpGeneric;
|
||||
buttonRT = eToolTipWhatIsThis;
|
||||
} else {
|
||||
// Multiple items in slot.
|
||||
buttonA = eToolTipPickUpAll;
|
||||
buttonX = eToolTipPickUpHalf;
|
||||
}
|
||||
|
||||
#ifdef __PSVITA__
|
||||
if (!InputManager.IsVitaTV()) {
|
||||
buttonBack = eToolTipWhatIsThis;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
buttonRT = eToolTipWhatIsThis;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -974,7 +995,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick() {
|
|||
// bool bValidIngredientBottom=false;
|
||||
|
||||
if (Item::items[iId]->hasPotionBrewingFormula() ||
|
||||
(iId == Item::netherStalkSeeds_Id)) {
|
||||
(iId == Item::netherwart_seeds_Id)) {
|
||||
bValidIngredient = true;
|
||||
}
|
||||
|
||||
|
|
@ -1030,10 +1051,10 @@ void IUIScene_AbstractContainerMenu::onMouseTick() {
|
|||
buttonY = eToolTipQuickMoveWeapon;
|
||||
break;
|
||||
|
||||
case Item::helmet_cloth_Id:
|
||||
case Item::chestplate_cloth_Id:
|
||||
case Item::leggings_cloth_Id:
|
||||
case Item::boots_cloth_Id:
|
||||
case Item::helmet_leather_Id:
|
||||
case Item::chestplate_leather_Id:
|
||||
case Item::leggings_leather_Id:
|
||||
case Item::boots_leather_Id:
|
||||
|
||||
case Item::helmet_chain_Id:
|
||||
case Item::chestplate_chain_Id:
|
||||
|
|
@ -1099,12 +1120,13 @@ void IUIScene_AbstractContainerMenu::onMouseTick() {
|
|||
item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
||||
overrideTooltips(eSectionUnderPointer, item, bIsItemCarried, bSlotHasItem,
|
||||
bCarriedIsSameAsSlot, iSlotStackSizeRemaining, buttonA,
|
||||
buttonX, buttonY, buttonRT);
|
||||
buttonX, buttonY, buttonRT, buttonBack);
|
||||
|
||||
SetToolTip(eToolTipButtonA, buttonA);
|
||||
SetToolTip(eToolTipButtonX, buttonX);
|
||||
SetToolTip(eToolTipButtonY, buttonY);
|
||||
SetToolTip(eToolTipButtonRT, buttonRT);
|
||||
SetToolTip(eToolTipButtonBack, buttonBack);
|
||||
|
||||
// Offset back to image top left.
|
||||
vPointerPos.x -= m_fPointerImageOffsetX;
|
||||
|
|
@ -1165,21 +1187,19 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction,
|
|||
#endif
|
||||
|
||||
int buttonNum = 0; // 0 = LeftMouse, 1 = RightMouse
|
||||
bool quickKeyHeld = false; // Represents shift key on PC
|
||||
BOOL quickKeyHeld = FALSE; // Represents shift key on PC
|
||||
|
||||
bool validKeyPress = false;
|
||||
// BOOL itemEditorKeyPress = FALSE;
|
||||
BOOL validKeyPress = FALSE;
|
||||
bool itemEditorKeyPress = false;
|
||||
|
||||
// Ignore input from other players
|
||||
// if(pMinecraft->player->GetXboxPad()!=pInputData->UserIndex) return S_OK;
|
||||
|
||||
switch (iAction) {
|
||||
#ifdef _DEBUG_MENUS_ENABLED
|
||||
#if TO_BE_IMPLEMENTED
|
||||
case VK_PAD_RTHUMB_PRESS:
|
||||
case ACTION_MENU_OTHER_STICK_PRESS:
|
||||
itemEditorKeyPress = TRUE;
|
||||
break;
|
||||
#endif
|
||||
#endif
|
||||
case ACTION_MENU_A:
|
||||
#ifdef __ORBIS__
|
||||
|
|
@ -1275,14 +1295,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction,
|
|||
// 4J Stu - Do nothing except stop this being passed anywhere else
|
||||
bHandled = true;
|
||||
} break;
|
||||
#ifdef __PSVITA__
|
||||
// CD - Vita uses select for What's this - key 40
|
||||
case MINECRAFT_ACTION_GAME_INFO:
|
||||
#else
|
||||
case ACTION_MENU_PAGEDOWN:
|
||||
#endif
|
||||
|
||||
{
|
||||
case ACTION_MENU_PAGEDOWN: {
|
||||
if (IsSectionSlotList(m_eCurrSection)) {
|
||||
int currentIndex = getCurrentIndex(m_eCurrSection) -
|
||||
getSectionStartOffset(m_eCurrSection);
|
||||
|
|
@ -1345,48 +1358,18 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction,
|
|||
bHandled = true;
|
||||
}
|
||||
#ifdef _DEBUG_MENUS_ENABLED
|
||||
#if TO_BE_IMPLEMENTED
|
||||
else if (itemEditorKeyPress == TRUE) {
|
||||
HXUIOBJ hFocusObject = GetFocus(pInputData->UserIndex);
|
||||
HXUIOBJ hFocusObjectParent;
|
||||
XuiElementGetParent(hFocusObject, &hFocusObjectParent);
|
||||
|
||||
HXUICLASS hClassCXuiCtrlSlotList;
|
||||
|
||||
// TODO Define values for these
|
||||
hClassCXuiCtrlSlotList = XuiFindClass(L"CXuiCtrlSlotList");
|
||||
|
||||
// If the press comes from a SlotList, cast it up then send a clicked
|
||||
// call to it's menu
|
||||
if (XuiIsInstanceOf(hFocusObjectParent, hClassCXuiCtrlSlotList)) {
|
||||
CXuiCtrlSlotList* slotList;
|
||||
void* pObj;
|
||||
XuiObjectFromHandle(hFocusObjectParent, &pObj);
|
||||
slotList = (CXuiCtrlSlotList*)pObj;
|
||||
|
||||
int currentIndex = slotList->GetCurSel();
|
||||
|
||||
CXuiCtrlSlotItemListItem* pCXuiCtrlSlotItem;
|
||||
slotList->GetCXuiCtrlSlotItem(currentIndex, &(pCXuiCtrlSlotItem));
|
||||
|
||||
// Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
CScene_DebugItemEditor::ItemEditorInput* initData =
|
||||
new CScene_DebugItemEditor::ItemEditorInput();
|
||||
initData->iPad = m_iPad;
|
||||
if (IsSectionSlotList(m_eCurrSection)) {
|
||||
ItemEditorInput* initData = new ItemEditorInput();
|
||||
initData->iPad = getPad();
|
||||
initData->slot =
|
||||
pCXuiCtrlSlotItem->getSlot(pCXuiCtrlSlotItem->m_hObj);
|
||||
getSlot(m_eCurrSection, getCurrentIndex(m_eCurrSection));
|
||||
initData->menu = m_menu;
|
||||
|
||||
// Add timer to poll controller stick input at 60Hz
|
||||
HRESULT timerResult = KillTimer(POINTER_INPUT_TIMER_ID);
|
||||
assert(timerResult == S_OK);
|
||||
|
||||
app.NavigateToScene(m_iPad, eUIScene_DebugItemEditor,
|
||||
(void*)initData, false, TRUE);
|
||||
ui.NavigateToScene(getPad(), eUIScene_DebugItemEditor,
|
||||
(void*)initData);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
else {
|
||||
handleAdditionalKeyPress(iAction);
|
||||
|
|
@ -1411,7 +1394,7 @@ void IUIScene_AbstractContainerMenu::handleOutsideClicked(int iPad,
|
|||
// pMinecraft->localgameModes[m_iPad]->handleInventoryMouseClick(menu->containerId,
|
||||
// AbstractContainerMenu::CLICKED_OUTSIDE, buttonNum,
|
||||
// quickKeyHeld?true:false, pMinecraft->localplayers[m_iPad] );
|
||||
slotClicked(AbstractContainerMenu::CLICKED_OUTSIDE, buttonNum,
|
||||
slotClicked(AbstractContainerMenu::SLOT_CLICKED_OUTSIDE, buttonNum,
|
||||
quickKeyHeld ? true : false);
|
||||
}
|
||||
|
||||
|
|
@ -1461,10 +1444,10 @@ bool IUIScene_AbstractContainerMenu::IsSameItemAs(
|
|||
std::shared_ptr<ItemInstance> itemA, std::shared_ptr<ItemInstance> itemB) {
|
||||
if (itemA == NULL || itemB == NULL) return false;
|
||||
|
||||
bool bStackedByData = itemA->isStackedByData();
|
||||
return ((itemA->id == itemB->id) &&
|
||||
((bStackedByData && itemA->getAuxValue() == itemB->getAuxValue()) ||
|
||||
!bStackedByData));
|
||||
return (itemA->id == itemB->id &&
|
||||
(!itemB->isStackedByData() ||
|
||||
itemB->getAuxValue() == itemA->getAuxValue()) &&
|
||||
ItemInstance::tagMatches(itemB, itemA));
|
||||
}
|
||||
|
||||
int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot* slot) {
|
||||
|
|
@ -1486,35 +1469,26 @@ int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot* slot) {
|
|||
return iResult;
|
||||
}
|
||||
|
||||
std::wstring IUIScene_AbstractContainerMenu::GetItemDescription(
|
||||
Slot* slot, std::vector<std::wstring>& unformattedStrings) {
|
||||
if (slot == NULL) return L"";
|
||||
std::vector<HtmlString>* IUIScene_AbstractContainerMenu::GetItemDescription(
|
||||
Slot* slot) {
|
||||
if (slot == NULL) return NULL;
|
||||
|
||||
std::wstring desc = L"";
|
||||
std::vector<std::wstring>* strings =
|
||||
slot->getItem()->getHoverText(nullptr, false, unformattedStrings);
|
||||
bool firstLine = true;
|
||||
for (AUTO_VAR(it, strings->begin()); it != strings->end(); ++it) {
|
||||
std::wstring thisString = *it;
|
||||
if (!firstLine) {
|
||||
desc.append(L"<br />");
|
||||
} else {
|
||||
firstLine = false;
|
||||
wchar_t formatted[256];
|
||||
eMinecraftColour rarityColour = slot->getItem()->getRarity()->color;
|
||||
int colour = app.GetHTMLColour(rarityColour);
|
||||
std::vector<HtmlString>* lines =
|
||||
slot->getItem()->getHoverText(nullptr, false);
|
||||
|
||||
if (slot->getItem()->hasCustomHoverName()) {
|
||||
colour = app.GetHTMLColour(eTextColor_RenamedItemTitle);
|
||||
}
|
||||
// Add rarity to first line
|
||||
if (lines->size() > 0) {
|
||||
lines->at(0).color = slot->getItem()->getRarity()->color;
|
||||
|
||||
swprintf(formatted, 256, L"<font color=\"#%08x\">%ls</font>",
|
||||
colour, thisString.c_str());
|
||||
thisString = formatted;
|
||||
if (slot->getItem()->hasCustomHoverName()) {
|
||||
lines->at(0).color = eTextColor_RenamedItemTitle;
|
||||
}
|
||||
desc.append(thisString);
|
||||
}
|
||||
strings->clear();
|
||||
delete strings;
|
||||
return desc;
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
std::vector<HtmlString>* IUIScene_AbstractContainerMenu::GetSectionHoverText(
|
||||
ESceneSection eSection) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -54,7 +54,6 @@ protected:
|
|||
|
||||
eSectionInventoryCreativeUsing,
|
||||
eSectionInventoryCreativeSelector,
|
||||
#ifndef _XBOX
|
||||
eSectionInventoryCreativeTab_0,
|
||||
eSectionInventoryCreativeTab_1,
|
||||
eSectionInventoryCreativeTab_2,
|
||||
|
|
@ -64,7 +63,6 @@ protected:
|
|||
eSectionInventoryCreativeTab_6,
|
||||
eSectionInventoryCreativeTab_7,
|
||||
eSectionInventoryCreativeSlider,
|
||||
#endif
|
||||
eSectionInventoryCreativeMax,
|
||||
|
||||
eSectionEnchantUsing,
|
||||
|
|
@ -90,6 +88,37 @@ protected:
|
|||
eSectionAnvilResult,
|
||||
eSectionAnvilName,
|
||||
eSectionAnvilMax,
|
||||
|
||||
eSectionBeaconUsing,
|
||||
eSectionBeaconInventory,
|
||||
eSectionBeaconItem,
|
||||
eSectionBeaconPrimaryTierOneOne,
|
||||
eSectionBeaconPrimaryTierOneTwo,
|
||||
eSectionBeaconPrimaryTierTwoOne,
|
||||
eSectionBeaconPrimaryTierTwoTwo,
|
||||
eSectionBeaconPrimaryTierThree,
|
||||
eSectionBeaconSecondaryOne,
|
||||
eSectionBeaconSecondaryTwo,
|
||||
eSectionBeaconConfirm,
|
||||
eSectionBeaconMax,
|
||||
|
||||
eSectionHopperUsing,
|
||||
eSectionHopperInventory,
|
||||
eSectionHopperContents,
|
||||
eSectionHopperMax,
|
||||
|
||||
eSectionHorseUsing,
|
||||
eSectionHorseInventory,
|
||||
eSectionHorseChest,
|
||||
eSectionHorseArmor,
|
||||
eSectionHorseSaddle,
|
||||
eSectionHorseMax,
|
||||
|
||||
eSectionFireworksUsing,
|
||||
eSectionFireworksInventory,
|
||||
eSectionFireworksResult,
|
||||
eSectionFireworksIngredients,
|
||||
eSectionFireworksMax,
|
||||
};
|
||||
|
||||
AbstractContainerMenu* m_menu;
|
||||
|
|
@ -170,6 +199,7 @@ protected:
|
|||
return eSection != eSectionNone;
|
||||
}
|
||||
virtual bool CanHaveFocus(ESceneSection eSection) { return true; }
|
||||
virtual bool IsVisible(ESceneSection eSection) { return true; }
|
||||
int GetSectionDimensions(ESceneSection eSection, int* piNumColumns,
|
||||
int* piNumRows);
|
||||
virtual int getSectionColumns(ESceneSection eSection) = 0;
|
||||
|
|
@ -184,7 +214,7 @@ protected:
|
|||
UIVec2D* pPosition, UIVec2D* pSize) = 0;
|
||||
void updateSlotPosition(ESceneSection eSection, ESceneSection newSection,
|
||||
ETapState eTapDirection, int* piTargetX,
|
||||
int* piTargetY, int xOffset);
|
||||
int* piTargetY, int xOffset = 0, int yOffset = 0);
|
||||
|
||||
#ifdef TAP_DETECTION
|
||||
ETapState GetTapInputType(float fInputX, float fInputY);
|
||||
|
|
@ -227,11 +257,13 @@ protected:
|
|||
virtual void setSectionSelectedSlot(ESceneSection eSection, int x,
|
||||
int y) = 0;
|
||||
virtual void setFocusToPointer(int iPad) = 0;
|
||||
virtual void SetPointerText(const std::wstring& description,
|
||||
std::vector<std::wstring>& unformattedStrings,
|
||||
virtual void SetPointerText(std::vector<HtmlString>* description,
|
||||
bool newSlot) = 0;
|
||||
virtual std::vector<HtmlString>* GetSectionHoverText(
|
||||
ESceneSection eSection);
|
||||
virtual std::shared_ptr<ItemInstance> getSlotItem(ESceneSection eSection,
|
||||
int iSlot) = 0;
|
||||
virtual Slot* getSlot(ESceneSection eSection, int iSlot) = 0;
|
||||
virtual bool isSlotEmpty(ESceneSection eSection, int iSlot) = 0;
|
||||
virtual void adjustPointerForSafeZone() = 0;
|
||||
|
||||
|
|
@ -240,7 +272,8 @@ protected:
|
|||
std::shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried,
|
||||
bool bSlotHasItem, bool bCarriedIsSameAsSlot,
|
||||
int iSlotStackSizeRemaining, EToolTipItem& buttonA,
|
||||
EToolTipItem& buttonX, EToolTipItem& buttonY, EToolTipItem& buttonRT) {
|
||||
EToolTipItem& buttonX, EToolTipItem& buttonY, EToolTipItem& buttonRT,
|
||||
EToolTipItem& buttonBack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -248,8 +281,8 @@ private:
|
|||
bool IsSameItemAs(std::shared_ptr<ItemInstance> itemA,
|
||||
std::shared_ptr<ItemInstance> itemB);
|
||||
int GetEmptyStackSpace(Slot* slot);
|
||||
std::wstring GetItemDescription(
|
||||
Slot* slot, std::vector<std::wstring>& unformattedStrings);
|
||||
|
||||
std::vector<HtmlString>* GetItemDescription(Slot* slot);
|
||||
|
||||
protected:
|
||||
IUIScene_AbstractContainerMenu();
|
||||
|
|
|
|||
|
|
@ -164,14 +164,14 @@ void IUIScene_AnvilMenu::handleTick() {
|
|||
!pMinecraft->localplayers[getPad()]->abilities.instabuild) {
|
||||
m_costString = app.GetString(IDS_REPAIR_EXPENSIVE);
|
||||
canAfford = false;
|
||||
} else if (!m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)->hasItem()) {
|
||||
} else if (!m_repairMenu->getSlot(AnvilMenu::RESULT_SLOT)->hasItem()) {
|
||||
// Do nothing
|
||||
} else {
|
||||
const wchar_t* costString = app.GetString(IDS_REPAIR_COST);
|
||||
wchar_t temp[256];
|
||||
swprintf(temp, 256, costString, m_repairMenu->cost);
|
||||
m_costString = temp;
|
||||
if (!m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)
|
||||
if (!m_repairMenu->getSlot(AnvilMenu::RESULT_SLOT)
|
||||
->mayPickup(std::dynamic_pointer_cast<Player>(
|
||||
m_inventory->player->shared_from_this()))) {
|
||||
canAfford = false;
|
||||
|
|
@ -181,14 +181,14 @@ void IUIScene_AnvilMenu::handleTick() {
|
|||
setCostLabel(m_costString, canAfford);
|
||||
|
||||
bool crossVisible =
|
||||
(m_repairMenu->getSlot(RepairMenu::INPUT_SLOT)->hasItem() ||
|
||||
m_repairMenu->getSlot(RepairMenu::ADDITIONAL_SLOT)->hasItem()) &&
|
||||
!m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)->hasItem();
|
||||
(m_repairMenu->getSlot(AnvilMenu::INPUT_SLOT)->hasItem() ||
|
||||
m_repairMenu->getSlot(AnvilMenu::ADDITIONAL_SLOT)->hasItem()) &&
|
||||
!m_repairMenu->getSlot(AnvilMenu::RESULT_SLOT)->hasItem();
|
||||
showCross(crossVisible);
|
||||
}
|
||||
|
||||
void IUIScene_AnvilMenu::updateItemName() {
|
||||
Slot* slot = m_repairMenu->getSlot(RepairMenu::INPUT_SLOT);
|
||||
Slot* slot = m_repairMenu->getSlot(AnvilMenu::INPUT_SLOT);
|
||||
if (slot != NULL && slot->hasItem()) {
|
||||
if (!slot->getItem()->hasCustomHoverName() &&
|
||||
m_itemName.compare(slot->getItem()->getHoverName()) == 0) {
|
||||
|
|
@ -210,14 +210,14 @@ void IUIScene_AnvilMenu::updateItemName() {
|
|||
void IUIScene_AnvilMenu::refreshContainer(
|
||||
AbstractContainerMenu* container,
|
||||
std::vector<std::shared_ptr<ItemInstance> >* items) {
|
||||
slotChanged(container, RepairMenu::INPUT_SLOT,
|
||||
slotChanged(container, AnvilMenu::INPUT_SLOT,
|
||||
container->getSlot(0)->getItem());
|
||||
}
|
||||
|
||||
void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu* container,
|
||||
int slotIndex,
|
||||
std::shared_ptr<ItemInstance> item) {
|
||||
if (slotIndex == RepairMenu::INPUT_SLOT) {
|
||||
if (slotIndex == AnvilMenu::INPUT_SLOT) {
|
||||
m_itemName = item == NULL ? L"" : item->getHoverName();
|
||||
setEditNameValue(m_itemName);
|
||||
setEditNameEditable(item != NULL);
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@
|
|||
#define ANVIL_SCENE_ITEM2_SLOT_DOWN_OFFSET 4
|
||||
|
||||
class Inventory;
|
||||
class RepairMenu;
|
||||
class AnvilMenu;
|
||||
|
||||
class IUIScene_AnvilMenu
|
||||
: public virtual IUIScene_AbstractContainerMenu,
|
||||
public net_minecraft_world_inventory::ContainerListener {
|
||||
protected:
|
||||
std::shared_ptr<Inventory> m_inventory;
|
||||
RepairMenu* m_repairMenu;
|
||||
AnvilMenu* m_repairMenu;
|
||||
std::wstring m_itemName;
|
||||
|
||||
protected:
|
||||
|
|
|
|||
380
Minecraft.Client/Platform/Common/UI/IUIScene_BeaconMenu.cpp
Normal file
380
Minecraft.Client/Platform/Common/UI/IUIScene_BeaconMenu.cpp
Normal file
|
|
@ -0,0 +1,380 @@
|
|||
#include "../../stdafx.h"
|
||||
#include "../../../../Minecraft.World/Network/Packets/CustomPayloadPacket.h"
|
||||
#include "../../../../Minecraft.World/Headers/net.minecraft.world.inventory.h"
|
||||
#include "../../../../Minecraft.World/Headers/net.minecraft.world.level.tile.entity.h"
|
||||
#include "../../../../Minecraft.World/Headers/net.minecraft.world.effect.h"
|
||||
#include "../../../../Minecraft.World/Util/HtmlString.h"
|
||||
#include "IUIScene_BeaconMenu.h"
|
||||
#include "../../../Minecraft.h"
|
||||
#include "../../../Player/MultiPlayerLocalPlayer.h"
|
||||
#include "../../../Network/ClientConnection.h"
|
||||
|
||||
IUIScene_BeaconMenu::IUIScene_BeaconMenu() {
|
||||
m_beacon = nullptr;
|
||||
m_initPowerButtons = true;
|
||||
}
|
||||
|
||||
IUIScene_AbstractContainerMenu::ESceneSection
|
||||
IUIScene_BeaconMenu::GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY) {
|
||||
ESceneSection newSection = eSection;
|
||||
|
||||
int xOffset = 0;
|
||||
|
||||
// Find the new section if there is one
|
||||
switch (eSection) {
|
||||
case eSectionBeaconInventory:
|
||||
if (eTapDirection == eTapStateDown)
|
||||
newSection = eSectionBeaconUsing;
|
||||
else if (eTapDirection == eTapStateUp) {
|
||||
if (*piTargetX < 4) {
|
||||
newSection = eSectionBeaconPrimaryTierThree;
|
||||
} else if (*piTargetX < 7) {
|
||||
newSection = eSectionBeaconItem;
|
||||
} else {
|
||||
newSection = eSectionBeaconConfirm;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case eSectionBeaconUsing:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
if (*piTargetX < 2) {
|
||||
newSection = eSectionBeaconPrimaryTierOneOne;
|
||||
} else if (*piTargetX < 5) {
|
||||
newSection = eSectionBeaconPrimaryTierOneTwo;
|
||||
} else if (*piTargetX > 8 &&
|
||||
GetPowerButtonId(eSectionBeaconSecondaryTwo) > 0) {
|
||||
newSection = eSectionBeaconSecondaryTwo;
|
||||
} else {
|
||||
newSection = eSectionBeaconSecondaryOne;
|
||||
}
|
||||
} else if (eTapDirection == eTapStateUp)
|
||||
newSection = eSectionBeaconInventory;
|
||||
break;
|
||||
case eSectionBeaconItem:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionBeaconInventory;
|
||||
xOffset = -5;
|
||||
} else if (eTapDirection == eTapStateUp)
|
||||
newSection = eSectionBeaconSecondaryOne;
|
||||
else if (eTapDirection == eTapStateLeft)
|
||||
newSection = eSectionBeaconConfirm;
|
||||
else if (eTapDirection == eTapStateRight)
|
||||
newSection = eSectionBeaconConfirm;
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierOneOne:
|
||||
if (eTapDirection == eTapStateDown)
|
||||
newSection = eSectionBeaconPrimaryTierTwoOne;
|
||||
else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionBeaconUsing;
|
||||
xOffset = -1;
|
||||
} else if (eTapDirection == eTapStateLeft)
|
||||
newSection = eSectionBeaconPrimaryTierOneTwo;
|
||||
else if (eTapDirection == eTapStateRight)
|
||||
newSection = eSectionBeaconPrimaryTierOneTwo;
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierOneTwo:
|
||||
if (eTapDirection == eTapStateDown)
|
||||
newSection = eSectionBeaconPrimaryTierTwoTwo;
|
||||
else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionBeaconUsing;
|
||||
xOffset = -3;
|
||||
} else if (eTapDirection == eTapStateLeft)
|
||||
newSection = eSectionBeaconPrimaryTierOneOne;
|
||||
else if (eTapDirection == eTapStateRight)
|
||||
newSection = eSectionBeaconPrimaryTierOneOne;
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierTwoOne:
|
||||
if (eTapDirection == eTapStateDown)
|
||||
newSection = eSectionBeaconPrimaryTierThree;
|
||||
else if (eTapDirection == eTapStateUp)
|
||||
newSection = eSectionBeaconPrimaryTierOneOne;
|
||||
else if (eTapDirection == eTapStateLeft) {
|
||||
if (GetPowerButtonId(eSectionBeaconSecondaryTwo) > 0) {
|
||||
newSection = eSectionBeaconSecondaryTwo;
|
||||
} else {
|
||||
newSection = eSectionBeaconSecondaryOne;
|
||||
}
|
||||
} else if (eTapDirection == eTapStateRight)
|
||||
newSection = eSectionBeaconPrimaryTierTwoTwo;
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierTwoTwo:
|
||||
if (eTapDirection == eTapStateDown)
|
||||
newSection = eSectionBeaconPrimaryTierThree;
|
||||
else if (eTapDirection == eTapStateUp)
|
||||
newSection = eSectionBeaconPrimaryTierOneTwo;
|
||||
else if (eTapDirection == eTapStateLeft)
|
||||
newSection = eSectionBeaconPrimaryTierTwoOne;
|
||||
else if (eTapDirection == eTapStateRight)
|
||||
newSection = eSectionBeaconSecondaryOne;
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierThree:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionBeaconInventory;
|
||||
xOffset = -3;
|
||||
} else if (eTapDirection == eTapStateUp)
|
||||
newSection = eSectionBeaconPrimaryTierTwoOne;
|
||||
break;
|
||||
case eSectionBeaconSecondaryOne:
|
||||
if (eTapDirection == eTapStateDown)
|
||||
newSection = eSectionBeaconItem;
|
||||
else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionBeaconUsing;
|
||||
xOffset = -7;
|
||||
} else if (eTapDirection == eTapStateLeft)
|
||||
newSection = eSectionBeaconPrimaryTierTwoTwo;
|
||||
else if (eTapDirection == eTapStateRight) {
|
||||
if (GetPowerButtonId(eSectionBeaconSecondaryTwo) > 0) {
|
||||
newSection = eSectionBeaconSecondaryTwo;
|
||||
} else {
|
||||
newSection = eSectionBeaconPrimaryTierTwoOne;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case eSectionBeaconSecondaryTwo:
|
||||
if (eTapDirection == eTapStateDown)
|
||||
newSection = eSectionBeaconItem;
|
||||
else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionBeaconUsing;
|
||||
xOffset = -8;
|
||||
} else if (eTapDirection == eTapStateLeft)
|
||||
newSection = eSectionBeaconSecondaryOne;
|
||||
else if (eTapDirection == eTapStateRight)
|
||||
newSection = eSectionBeaconPrimaryTierTwoOne;
|
||||
break;
|
||||
case eSectionBeaconConfirm:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionBeaconInventory;
|
||||
xOffset = -8;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionBeaconSecondaryOne;
|
||||
} else if (eTapDirection == eTapStateLeft)
|
||||
newSection = eSectionBeaconItem;
|
||||
else if (eTapDirection == eTapStateRight)
|
||||
newSection = eSectionBeaconItem;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX,
|
||||
piTargetY, xOffset);
|
||||
|
||||
return newSection;
|
||||
}
|
||||
|
||||
int IUIScene_BeaconMenu::getSectionStartOffset(
|
||||
IUIScene_AbstractContainerMenu::ESceneSection eSection) {
|
||||
int offset = 0;
|
||||
switch (eSection) {
|
||||
case eSectionBeaconItem:
|
||||
offset = BeaconMenu::PAYMENT_SLOT;
|
||||
break;
|
||||
case eSectionBeaconInventory:
|
||||
offset = BeaconMenu::INV_SLOT_START;
|
||||
break;
|
||||
case eSectionBeaconUsing:
|
||||
offset = BeaconMenu::USE_ROW_SLOT_START;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
bool IUIScene_BeaconMenu::IsSectionSlotList(ESceneSection eSection) {
|
||||
switch (eSection) {
|
||||
case eSectionBeaconItem:
|
||||
case eSectionBeaconInventory:
|
||||
case eSectionBeaconUsing:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void IUIScene_BeaconMenu::handleOtherClicked(int iPad, ESceneSection eSection,
|
||||
int buttonNum, bool quickKey) {
|
||||
switch (eSection) {
|
||||
case eSectionBeaconConfirm: {
|
||||
if ((m_beacon->getItem(0) == NULL) ||
|
||||
(m_beacon->getPrimaryPower() <= 0))
|
||||
return;
|
||||
ByteArrayOutputStream baos;
|
||||
DataOutputStream dos(&baos);
|
||||
dos.writeInt(m_beacon->getPrimaryPower());
|
||||
dos.writeInt(m_beacon->getSecondaryPower());
|
||||
|
||||
Minecraft::GetInstance()->localplayers[getPad()]->connection->send(
|
||||
std::shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(
|
||||
CustomPayloadPacket::SET_BEACON_PACKET,
|
||||
baos.toByteArray())));
|
||||
|
||||
if (m_beacon->getPrimaryPower() > 0) {
|
||||
int effectId = m_beacon->getPrimaryPower();
|
||||
|
||||
bool active = true;
|
||||
bool selected = false;
|
||||
|
||||
int tier = 3;
|
||||
if (tier >= m_beacon->getLevels()) {
|
||||
active = false;
|
||||
} else if (effectId == m_beacon->getSecondaryPower()) {
|
||||
selected = true;
|
||||
}
|
||||
|
||||
AddPowerButton(
|
||||
GetId(tier, m_beacon->getPrimaryPower()),
|
||||
MobEffect::effects[m_beacon->getPrimaryPower()]->getIcon(),
|
||||
tier, 1, active, selected);
|
||||
}
|
||||
} break;
|
||||
case eSectionBeaconPrimaryTierOneOne:
|
||||
case eSectionBeaconPrimaryTierOneTwo:
|
||||
case eSectionBeaconPrimaryTierTwoOne:
|
||||
case eSectionBeaconPrimaryTierTwoTwo:
|
||||
case eSectionBeaconPrimaryTierThree:
|
||||
case eSectionBeaconSecondaryOne:
|
||||
case eSectionBeaconSecondaryTwo:
|
||||
if (IsPowerButtonSelected(eSection)) {
|
||||
return;
|
||||
}
|
||||
|
||||
int id = GetPowerButtonId(eSection);
|
||||
int effectId = (id & 0xff);
|
||||
int tier = (id >> 8);
|
||||
|
||||
if (tier < 3) {
|
||||
m_beacon->setPrimaryPower(effectId);
|
||||
} else {
|
||||
m_beacon->setSecondaryPower(effectId);
|
||||
}
|
||||
SetPowerButtonSelected(eSection);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
void IUIScene_BeaconMenu::handleTick() {
|
||||
if (m_initPowerButtons && m_beacon->getLevels() >= 0) {
|
||||
m_initPowerButtons = false;
|
||||
for (int tier = 0; tier <= 2; tier++) {
|
||||
int count = BeaconTileEntity::
|
||||
BEACON_EFFECTS_EFFECTS; // BEACON_EFFECTS[tier].length;
|
||||
int totalWidth = count * 22 + (count - 1) * 2;
|
||||
|
||||
for (int c = 0; c < count; c++) {
|
||||
if (BeaconTileEntity::BEACON_EFFECTS[tier][c] == NULL) continue;
|
||||
|
||||
int effectId = BeaconTileEntity::BEACON_EFFECTS[tier][c]->id;
|
||||
int icon = BeaconTileEntity::BEACON_EFFECTS[tier][c]->getIcon();
|
||||
|
||||
bool active = true;
|
||||
bool selected = false;
|
||||
|
||||
if (tier >= m_beacon->getLevels()) {
|
||||
active = false;
|
||||
} else if (effectId == m_beacon->getPrimaryPower()) {
|
||||
selected = true;
|
||||
}
|
||||
|
||||
AddPowerButton(GetId(tier, effectId), icon, tier, c, active,
|
||||
selected);
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
int tier = 3;
|
||||
|
||||
int count = BeaconTileEntity::BEACON_EFFECTS_EFFECTS +
|
||||
1; // BEACON_EFFECTS[tier].length + 1;
|
||||
int totalWidth = count * 22 + (count - 1) * 2;
|
||||
|
||||
for (int c = 0; c < count - 1; c++) {
|
||||
if (BeaconTileEntity::BEACON_EFFECTS[tier][c] == NULL) continue;
|
||||
|
||||
int effectId = BeaconTileEntity::BEACON_EFFECTS[tier][c]->id;
|
||||
int icon = BeaconTileEntity::BEACON_EFFECTS[tier][c]->getIcon();
|
||||
|
||||
bool active = true;
|
||||
bool selected = false;
|
||||
|
||||
if (tier >= m_beacon->getLevels()) {
|
||||
active = false;
|
||||
} else if (effectId == m_beacon->getSecondaryPower()) {
|
||||
selected = true;
|
||||
}
|
||||
|
||||
AddPowerButton(GetId(tier, effectId), icon, tier, c, active,
|
||||
selected);
|
||||
}
|
||||
if (m_beacon->getPrimaryPower() > 0) {
|
||||
int effectId = m_beacon->getPrimaryPower();
|
||||
|
||||
bool active = true;
|
||||
bool selected = false;
|
||||
|
||||
if (tier >= m_beacon->getLevels()) {
|
||||
active = false;
|
||||
} else if (effectId == m_beacon->getSecondaryPower()) {
|
||||
selected = true;
|
||||
}
|
||||
|
||||
AddPowerButton(
|
||||
GetId(tier, m_beacon->getPrimaryPower()),
|
||||
MobEffect::effects[m_beacon->getPrimaryPower()]->getIcon(),
|
||||
tier, 1, active, selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SetConfirmButtonEnabled((m_beacon->getItem(0) != NULL) &&
|
||||
(m_beacon->getPrimaryPower() > 0));
|
||||
}
|
||||
|
||||
int IUIScene_BeaconMenu::GetId(int tier, int effectId) {
|
||||
return (tier << 8) | effectId;
|
||||
}
|
||||
|
||||
std::vector<HtmlString>* IUIScene_BeaconMenu::GetSectionHoverText(
|
||||
ESceneSection eSection) {
|
||||
std::vector<HtmlString>* desc = NULL;
|
||||
switch (eSection) {
|
||||
case eSectionBeaconSecondaryTwo:
|
||||
if (GetPowerButtonId(eSectionBeaconSecondaryTwo) == 0) {
|
||||
// This isn't visible
|
||||
break;
|
||||
}
|
||||
// Fall through otherwise
|
||||
case eSectionBeaconPrimaryTierOneOne:
|
||||
case eSectionBeaconPrimaryTierOneTwo:
|
||||
case eSectionBeaconPrimaryTierTwoOne:
|
||||
case eSectionBeaconPrimaryTierTwoTwo:
|
||||
case eSectionBeaconPrimaryTierThree:
|
||||
case eSectionBeaconSecondaryOne: {
|
||||
int id = GetPowerButtonId(eSection);
|
||||
int effectId = (id & 0xff);
|
||||
|
||||
desc = new std::vector<HtmlString>();
|
||||
|
||||
HtmlString std::string(
|
||||
app.GetString(MobEffect::effects[effectId]->getDescriptionId()),
|
||||
eHTMLColor_White);
|
||||
desc->push_back(std::string);
|
||||
} break;
|
||||
}
|
||||
return desc;
|
||||
}
|
||||
|
||||
bool IUIScene_BeaconMenu::IsVisible(ESceneSection eSection) {
|
||||
switch (eSection) {
|
||||
case eSectionBeaconSecondaryTwo:
|
||||
if (GetPowerButtonId(eSectionBeaconSecondaryTwo) == 0) {
|
||||
// This isn't visible
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
35
Minecraft.Client/Platform/Common/UI/IUIScene_BeaconMenu.h
Normal file
35
Minecraft.Client/Platform/Common/UI/IUIScene_BeaconMenu.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
#pragma once
|
||||
#include "Common/UI/IUIScene_AbstractContainerMenu.h"
|
||||
|
||||
class BeaconTileEntity;
|
||||
|
||||
class IUIScene_BeaconMenu : public virtual IUIScene_AbstractContainerMenu {
|
||||
public:
|
||||
IUIScene_BeaconMenu();
|
||||
|
||||
virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY);
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
virtual void handleOtherClicked(int iPad, ESceneSection eSection,
|
||||
int buttonNum, bool quickKey);
|
||||
virtual bool IsSectionSlotList(ESceneSection eSection);
|
||||
virtual std::vector<HtmlString>* GetSectionHoverText(
|
||||
ESceneSection eSection);
|
||||
bool IsVisible(ESceneSection eSection);
|
||||
|
||||
protected:
|
||||
void handleTick();
|
||||
int GetId(int tier, int effectId);
|
||||
|
||||
virtual void SetConfirmButtonEnabled(bool enabled) = 0;
|
||||
virtual void AddPowerButton(int id, int icon, int tier, int count,
|
||||
bool active, bool selected) = 0;
|
||||
virtual int GetPowerButtonId(ESceneSection eSection) = 0;
|
||||
virtual bool IsPowerButtonSelected(ESceneSection eSection) = 0;
|
||||
virtual void SetPowerButtonSelected(ESceneSection eSection) = 0;
|
||||
|
||||
std::shared_ptr<BeaconTileEntity> m_beacon;
|
||||
bool m_initPowerButtons;
|
||||
};
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
#include "../../stdafx.h"
|
||||
#include "../../../../Minecraft.World/Network/Packets/CustomPayloadPacket.h"
|
||||
#include "../../../Player/MultiPlayerLocalPlayer.h"
|
||||
#include "../../../Network/ClientConnection.h"
|
||||
#include "IUIScene_CommandBlockMenu.h"
|
||||
|
||||
void IUIScene_CommandBlockMenu::Initialise(CommandBlockEntity* commandBlock) {
|
||||
m_commandBlock = commandBlock;
|
||||
SetCommand(m_commandBlock->getCommand());
|
||||
}
|
||||
|
||||
void IUIScene_CommandBlockMenu::ConfirmButtonClicked() {
|
||||
ByteArrayOutputStream baos;
|
||||
DataOutputStream dos(&baos);
|
||||
|
||||
dos.writeInt(m_commandBlock->x);
|
||||
dos.writeInt(m_commandBlock->y);
|
||||
dos.writeInt(m_commandBlock->z);
|
||||
dos.writeUTF(GetCommand());
|
||||
|
||||
Minecraft::GetInstance()->localplayers[GetPad()]->connection->send(
|
||||
std::shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(
|
||||
CustomPayloadPacket::SET_ADVENTURE_COMMAND_PACKET,
|
||||
baos.toByteArray())));
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
#pragma once
|
||||
#include "../../../../Minecraft.World/Headers/net.minecraft.world.level.tile.entity.h"
|
||||
|
||||
class IUIScene_CommandBlockMenu {
|
||||
public:
|
||||
void Initialise(CommandBlockEntity* commandBlock);
|
||||
|
||||
protected:
|
||||
void ConfirmButtonClicked();
|
||||
|
||||
virtual std::wstring GetCommand();
|
||||
virtual void SetCommand(std::wstring command);
|
||||
virtual int GetPad();
|
||||
|
||||
private:
|
||||
CommandBlockEntity* m_commandBlock;
|
||||
};
|
||||
|
|
@ -254,130 +254,142 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) {
|
|||
// L"random.pop", 1.0f, 1.0f);
|
||||
ui.PlayUISFX(eSFX_Craft);
|
||||
|
||||
// and remove those resources from your inventory
|
||||
for (int i = 0;
|
||||
i < pRecipeIngredientsRequired[iRecipe].iIngC;
|
||||
i++) {
|
||||
for (int j = 0;
|
||||
j < pRecipeIngredientsRequired[iRecipe]
|
||||
.iIngValA[i];
|
||||
j++) {
|
||||
std::shared_ptr<ItemInstance> ingItemInst =
|
||||
nullptr;
|
||||
// do we need to remove a specific aux value?
|
||||
if (pRecipeIngredientsRequired[iRecipe]
|
||||
.iIngAuxValA[i] !=
|
||||
Recipes::ANY_AUX_VALUE) {
|
||||
ingItemInst =
|
||||
m_pPlayer->inventory->getResourceItem(
|
||||
if (pTempItemInst->id != Item::fireworksCharge_Id &&
|
||||
pTempItemInst->id != Item::fireworks_Id) {
|
||||
// and remove those resources from your inventory
|
||||
for (int i = 0;
|
||||
i < pRecipeIngredientsRequired[iRecipe].iIngC;
|
||||
i++) {
|
||||
for (int j = 0;
|
||||
j < pRecipeIngredientsRequired[iRecipe]
|
||||
.iIngValA[i];
|
||||
j++) {
|
||||
std::shared_ptr<ItemInstance> ingItemInst =
|
||||
nullptr;
|
||||
// do we need to remove a specific aux
|
||||
// value?
|
||||
if (pRecipeIngredientsRequired[iRecipe]
|
||||
.iIngAuxValA[i] !=
|
||||
Recipes::ANY_AUX_VALUE) {
|
||||
ingItemInst =
|
||||
m_pPlayer->inventory
|
||||
->getResourceItem(
|
||||
pRecipeIngredientsRequired
|
||||
[iRecipe]
|
||||
.iIngIDA[i],
|
||||
pRecipeIngredientsRequired
|
||||
[iRecipe]
|
||||
.iIngAuxValA[i]);
|
||||
m_pPlayer->inventory->removeResource(
|
||||
pRecipeIngredientsRequired[iRecipe]
|
||||
.iIngIDA[i],
|
||||
pRecipeIngredientsRequired[iRecipe]
|
||||
.iIngAuxValA[i]);
|
||||
m_pPlayer->inventory->removeResource(
|
||||
pRecipeIngredientsRequired[iRecipe]
|
||||
.iIngIDA[i],
|
||||
pRecipeIngredientsRequired[iRecipe]
|
||||
.iIngAuxValA[i]);
|
||||
} else {
|
||||
ingItemInst =
|
||||
m_pPlayer->inventory->getResourceItem(
|
||||
} else {
|
||||
ingItemInst =
|
||||
m_pPlayer->inventory
|
||||
->getResourceItem(
|
||||
pRecipeIngredientsRequired
|
||||
[iRecipe]
|
||||
.iIngIDA[i]);
|
||||
m_pPlayer->inventory->removeResource(
|
||||
pRecipeIngredientsRequired[iRecipe]
|
||||
.iIngIDA[i]);
|
||||
m_pPlayer->inventory->removeResource(
|
||||
pRecipeIngredientsRequired[iRecipe]
|
||||
.iIngIDA[i]);
|
||||
}
|
||||
}
|
||||
|
||||
// 4J Stu - Fix for #13097 - Bug: Milk Buckets
|
||||
// are removed when crafting Cake
|
||||
if (ingItemInst != NULL) {
|
||||
if (ingItemInst->getItem()
|
||||
->hasCraftingRemainingItem()) {
|
||||
// replace item with remaining result
|
||||
m_pPlayer->inventory->add(
|
||||
std::shared_ptr<
|
||||
ItemInstance>(new ItemInstance(
|
||||
ingItemInst->getItem()
|
||||
->getCraftingRemainingItem())));
|
||||
// 4J Stu - Fix for #13097 - Bug: Milk
|
||||
// Buckets are removed when crafting Cake
|
||||
if (ingItemInst != NULL) {
|
||||
if (ingItemInst->getItem()
|
||||
->hasCraftingRemainingItem()) {
|
||||
// replace item with remaining
|
||||
// result
|
||||
m_pPlayer->inventory->add(
|
||||
std::shared_ptr<
|
||||
ItemInstance>(new ItemInstance(
|
||||
ingItemInst->getItem()
|
||||
->getCraftingRemainingItem())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 4J Stu - Fix for #13119 - We should add the item
|
||||
// after we remove the ingredients
|
||||
if (m_pPlayer->inventory->add(pTempItemInst) == false) {
|
||||
// no room in inventory, so throw it down
|
||||
m_pPlayer->drop(pTempItemInst);
|
||||
}
|
||||
// 4J Stu - Fix for #13119 - We should add the item
|
||||
// after we remove the ingredients
|
||||
if (m_pPlayer->inventory->add(pTempItemInst) ==
|
||||
false) {
|
||||
// no room in inventory, so throw it down
|
||||
m_pPlayer->drop(pTempItemInst);
|
||||
}
|
||||
|
||||
// 4J Gordon: Achievements
|
||||
switch (pTempItemInst->id) {
|
||||
case Tile::workBench_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::buildWorkbench(),
|
||||
GenericStats::param_buildWorkbench());
|
||||
break;
|
||||
case Item::pickAxe_wood_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::buildPickaxe(),
|
||||
GenericStats::param_buildPickaxe());
|
||||
break;
|
||||
case Tile::furnace_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::buildFurnace(),
|
||||
GenericStats::param_buildFurnace());
|
||||
break;
|
||||
case Item::hoe_wood_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::buildHoe(),
|
||||
GenericStats::param_buildHoe());
|
||||
break;
|
||||
case Item::bread_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::makeBread(),
|
||||
GenericStats::param_makeBread());
|
||||
break;
|
||||
case Item::cake_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::bakeCake(),
|
||||
GenericStats::param_bakeCake());
|
||||
break;
|
||||
case Item::pickAxe_stone_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::buildBetterPickaxe(),
|
||||
GenericStats::param_buildBetterPickaxe());
|
||||
break;
|
||||
case Item::sword_wood_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::buildSword(),
|
||||
GenericStats::param_buildSword());
|
||||
break;
|
||||
case Tile::dispenser_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::dispenseWithThis(),
|
||||
GenericStats::param_dispenseWithThis());
|
||||
break;
|
||||
case Tile::enchantTable_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::enchantments(),
|
||||
GenericStats::param_enchantments());
|
||||
break;
|
||||
case Tile::bookshelf_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::bookcase(),
|
||||
GenericStats::param_bookcase());
|
||||
break;
|
||||
}
|
||||
// 4J Gordon: Achievements
|
||||
switch (pTempItemInst->id) {
|
||||
case Tile::workBench_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::buildWorkbench(),
|
||||
GenericStats::param_buildWorkbench());
|
||||
break;
|
||||
case Item::pickAxe_wood_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::buildPickaxe(),
|
||||
GenericStats::param_buildPickaxe());
|
||||
break;
|
||||
case Tile::furnace_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::buildFurnace(),
|
||||
GenericStats::param_buildFurnace());
|
||||
break;
|
||||
case Item::hoe_wood_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::buildHoe(),
|
||||
GenericStats::param_buildHoe());
|
||||
break;
|
||||
case Item::bread_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::makeBread(),
|
||||
GenericStats::param_makeBread());
|
||||
break;
|
||||
case Item::cake_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::bakeCake(),
|
||||
GenericStats::param_bakeCake());
|
||||
break;
|
||||
case Item::pickAxe_stone_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::buildBetterPickaxe(),
|
||||
GenericStats::
|
||||
param_buildBetterPickaxe());
|
||||
break;
|
||||
case Item::sword_wood_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::buildSword(),
|
||||
GenericStats::param_buildSword());
|
||||
break;
|
||||
case Tile::dispenser_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::dispenseWithThis(),
|
||||
GenericStats::param_dispenseWithThis());
|
||||
break;
|
||||
case Tile::enchantTable_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::enchantments(),
|
||||
GenericStats::param_enchantments());
|
||||
break;
|
||||
case Tile::bookshelf_Id:
|
||||
m_pPlayer->awardStat(
|
||||
GenericStats::bookcase(),
|
||||
GenericStats::param_bookcase());
|
||||
break;
|
||||
}
|
||||
|
||||
// We've used some ingredients from our inventory, so
|
||||
// update the recipes we can make
|
||||
CheckRecipesAvailable();
|
||||
// don't reset the vertical slots - we want to stay
|
||||
// where we are
|
||||
UpdateVerticalSlots();
|
||||
UpdateHighlight();
|
||||
// We've used some ingredients from our inventory,
|
||||
// so update the recipes we can make
|
||||
CheckRecipesAvailable();
|
||||
// don't reset the vertical slots - we want to stay
|
||||
// where we are
|
||||
UpdateVerticalSlots();
|
||||
UpdateHighlight();
|
||||
}
|
||||
} else {
|
||||
// pMinecraft->soundEngine->playUI(
|
||||
// L"btn.back", 1.0f, 1.0f);
|
||||
|
|
@ -1090,6 +1102,27 @@ void IUIScene_CraftingMenu::DisplayIngredients() {
|
|||
int id = pRecipeIngredientsRequired[iRecipe].iIngIDA[i];
|
||||
int iAuxVal = pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i];
|
||||
Item* item = Item::items[id];
|
||||
|
||||
std::shared_ptr<ItemInstance> itemInst =
|
||||
std::shared_ptr<ItemInstance>(new ItemInstance(
|
||||
item, pRecipeIngredientsRequired[iRecipe].iIngValA[i],
|
||||
iAuxVal));
|
||||
|
||||
// 4J-PB - a very special case - the bed can use any kind of wool,
|
||||
// so we can't use the item description and the same goes for the
|
||||
// painting
|
||||
int idescID;
|
||||
|
||||
if (((pTempItemInst->id == Item::bed_Id) &&
|
||||
(id == Tile::wool_Id)) ||
|
||||
((pTempItemInst->id == Item::painting_Id) &&
|
||||
(id == Tile::wool_Id))) {
|
||||
idescID = IDS_ANY_WOOL;
|
||||
} else {
|
||||
idescID = itemInst->getDescriptionId();
|
||||
}
|
||||
setIngredientDescriptionText(i, app.GetString(idescID));
|
||||
|
||||
if ((iAuxVal & 0xFF) ==
|
||||
0xFF) // 4J Stu - If the aux value is set to match any
|
||||
iAuxVal = 0;
|
||||
|
|
@ -1100,29 +1133,10 @@ void IUIScene_CraftingMenu::DisplayIngredients() {
|
|||
if (id == Item::clock_Id || id == Item::compass_Id) {
|
||||
iAuxVal = 0xFF;
|
||||
}
|
||||
|
||||
std::shared_ptr<ItemInstance> itemInst =
|
||||
std::shared_ptr<ItemInstance>(new ItemInstance(
|
||||
item, pRecipeIngredientsRequired[iRecipe].iIngValA[i],
|
||||
iAuxVal));
|
||||
itemInst->setAuxValue(iAuxVal);
|
||||
|
||||
setIngredientDescriptionItem(getPad(), i, itemInst);
|
||||
setIngredientDescriptionRedBox(i, false);
|
||||
|
||||
// 4J-PB - a very special case - the bed can use any kind of wool,
|
||||
// so we can't use the item description and the same goes for the
|
||||
// painting
|
||||
int idescID;
|
||||
|
||||
if (((pTempItemInst->id == Item::bed_Id) &&
|
||||
(id == Tile::cloth_Id)) ||
|
||||
((pTempItemInst->id == Item::painting_Id) &&
|
||||
(id == Tile::cloth_Id))) {
|
||||
idescID = IDS_ANY_WOOL;
|
||||
} else {
|
||||
idescID = itemInst->getDescriptionId();
|
||||
}
|
||||
setIngredientDescriptionText(i, app.GetString(idescID));
|
||||
}
|
||||
|
||||
// 4J Stu - For clocks and compasses we set the aux value to a special
|
||||
|
|
@ -1166,6 +1180,9 @@ void IUIScene_CraftingMenu::DisplayIngredients() {
|
|||
// texture rather than the dynamic one for the player
|
||||
if (id == Item::clock_Id || id == Item::compass_Id) {
|
||||
iAuxVal = 0xFF;
|
||||
} else if (pTempItemInst->id == Item::fireworksCharge_Id &&
|
||||
id == Item::dye_powder_Id) {
|
||||
iAuxVal = 1;
|
||||
}
|
||||
std::shared_ptr<ItemInstance> itemInst =
|
||||
std::shared_ptr<ItemInstance>(
|
||||
|
|
@ -1378,6 +1395,14 @@ void IUIScene_CraftingMenu::UpdateTooltips() {
|
|||
}*/
|
||||
}
|
||||
|
||||
void IUIScene_CraftingMenu::HandleInventoryUpdated() {
|
||||
// Check which recipes are available with the resources we have
|
||||
CheckRecipesAvailable();
|
||||
UpdateVerticalSlots();
|
||||
UpdateHighlight();
|
||||
UpdateTooltips();
|
||||
}
|
||||
|
||||
bool IUIScene_CraftingMenu::isItemSelected(int itemId) {
|
||||
bool isSelected = false;
|
||||
if (m_pPlayer && m_pPlayer->inventory) {
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@ protected:
|
|||
void DisplayIngredients();
|
||||
void UpdateTooltips();
|
||||
void UpdateDescriptionText(bool);
|
||||
void HandleInventoryUpdated();
|
||||
|
||||
public:
|
||||
Recipy::_eGroupType getCurrentGroup() { return m_pGroupA[m_iGroupIndex]; }
|
||||
|
|
|
|||
|
|
@ -27,14 +27,15 @@ void IUIScene_CreativeMenu::staticCtor() {
|
|||
|
||||
// Building Blocks
|
||||
DEF(eCreativeInventory_BuildingBlocks)
|
||||
ITEM(Tile::rock_Id)
|
||||
ITEM(Tile::stone_Id)
|
||||
ITEM(Tile::grass_Id)
|
||||
ITEM(Tile::dirt_Id)
|
||||
ITEM(Tile::stoneBrick_Id)
|
||||
ITEM(Tile::cobblestone_Id)
|
||||
ITEM(Tile::sand_Id)
|
||||
ITEM(Tile::sandStone_Id)
|
||||
ITEM_AUX(Tile::sandStone_Id, SandStoneTile::TYPE_SMOOTHSIDE)
|
||||
ITEM_AUX(Tile::sandStone_Id, SandStoneTile::TYPE_HEIROGLYPHS)
|
||||
ITEM(Tile::coalBlock_Id)
|
||||
ITEM(Tile::goldBlock_Id)
|
||||
ITEM(Tile::ironBlock_Id)
|
||||
ITEM(Tile::lapisBlock_Id)
|
||||
|
|
@ -60,24 +61,29 @@ void IUIScene_CreativeMenu::staticCtor() {
|
|||
ITEM_AUX(Tile::treeTrunk_Id, TreeTile::JUNGLE_TRUNK)
|
||||
ITEM(Tile::gravel_Id)
|
||||
ITEM(Tile::redBrick_Id)
|
||||
ITEM(Tile::mossStone_Id)
|
||||
ITEM(Tile::mossyCobblestone_Id)
|
||||
ITEM(Tile::obsidian_Id)
|
||||
ITEM(Tile::clay)
|
||||
ITEM(Tile::ice_Id)
|
||||
ITEM(Tile::snow_Id)
|
||||
ITEM(Tile::hellRock_Id)
|
||||
ITEM(Tile::hellSand_Id)
|
||||
ITEM(Tile::lightGem_Id)
|
||||
ITEM_AUX(Tile::stoneBrickSmooth_Id, SmoothStoneBrickTile::TYPE_DEFAULT)
|
||||
ITEM_AUX(Tile::stoneBrickSmooth_Id, SmoothStoneBrickTile::TYPE_MOSSY)
|
||||
ITEM_AUX(Tile::stoneBrickSmooth_Id, SmoothStoneBrickTile::TYPE_CRACKED)
|
||||
ITEM_AUX(Tile::stoneBrickSmooth_Id, SmoothStoneBrickTile::TYPE_DETAIL)
|
||||
ITEM(Tile::netherRack_Id)
|
||||
ITEM(Tile::soulsand_Id)
|
||||
ITEM(Tile::glowstone_Id)
|
||||
ITEM(Tile::fence_Id)
|
||||
ITEM(Tile::netherFence_Id)
|
||||
ITEM(Tile::ironFence_Id)
|
||||
ITEM_AUX(Tile::cobbleWall_Id, WallTile::TYPE_NORMAL)
|
||||
ITEM_AUX(Tile::cobbleWall_Id, WallTile::TYPE_MOSSY)
|
||||
ITEM_AUX(Tile::stoneBrick_Id, SmoothStoneBrickTile::TYPE_DEFAULT)
|
||||
ITEM_AUX(Tile::stoneBrick_Id, SmoothStoneBrickTile::TYPE_MOSSY)
|
||||
ITEM_AUX(Tile::stoneBrick_Id, SmoothStoneBrickTile::TYPE_CRACKED)
|
||||
ITEM_AUX(Tile::stoneBrick_Id, SmoothStoneBrickTile::TYPE_DETAIL)
|
||||
ITEM_AUX(Tile::monsterStoneEgg_Id, StoneMonsterTile::HOST_ROCK)
|
||||
ITEM_AUX(Tile::monsterStoneEgg_Id, StoneMonsterTile::HOST_COBBLE)
|
||||
ITEM_AUX(Tile::monsterStoneEgg_Id, StoneMonsterTile::HOST_STONEBRICK)
|
||||
ITEM(Tile::mycel_Id)
|
||||
ITEM(Tile::netherBrick_Id)
|
||||
ITEM(Tile::whiteStone_Id)
|
||||
ITEM(Tile::endStone_Id)
|
||||
ITEM_AUX(Tile::quartzBlock_Id, QuartzBlockTile::TYPE_CHISELED)
|
||||
ITEM_AUX(Tile::quartzBlock_Id, QuartzBlockTile::TYPE_LINES_Y)
|
||||
ITEM(Tile::trapdoor_Id)
|
||||
|
|
@ -103,11 +109,29 @@ void IUIScene_CreativeMenu::staticCtor() {
|
|||
ITEM(Tile::stairs_junglewood_Id)
|
||||
ITEM(Tile::stairs_stone_Id)
|
||||
ITEM(Tile::stairs_bricks_Id)
|
||||
ITEM(Tile::stairs_stoneBrickSmooth_Id)
|
||||
ITEM(Tile::stairs_stoneBrick_Id)
|
||||
ITEM(Tile::stairs_netherBricks_Id)
|
||||
ITEM(Tile::stairs_sandstone_Id)
|
||||
ITEM(Tile::stairs_quartz_Id)
|
||||
|
||||
ITEM(Tile::clayHardened_Id)
|
||||
ITEM_AUX(Tile::clayHardened_colored_Id, 14) // Red
|
||||
ITEM_AUX(Tile::clayHardened_colored_Id, 1) // Orange
|
||||
ITEM_AUX(Tile::clayHardened_colored_Id, 4) // Yellow
|
||||
ITEM_AUX(Tile::clayHardened_colored_Id, 5) // Lime
|
||||
ITEM_AUX(Tile::clayHardened_colored_Id, 3) // Light Blue
|
||||
ITEM_AUX(Tile::clayHardened_colored_Id, 9) // Cyan
|
||||
ITEM_AUX(Tile::clayHardened_colored_Id, 11) // Blue
|
||||
ITEM_AUX(Tile::clayHardened_colored_Id, 10) // Purple
|
||||
ITEM_AUX(Tile::clayHardened_colored_Id, 2) // Magenta
|
||||
ITEM_AUX(Tile::clayHardened_colored_Id, 6) // Pink
|
||||
ITEM_AUX(Tile::clayHardened_colored_Id, 0) // White
|
||||
ITEM_AUX(Tile::clayHardened_colored_Id, 8) // Light Gray
|
||||
ITEM_AUX(Tile::clayHardened_colored_Id, 7) // Gray
|
||||
ITEM_AUX(Tile::clayHardened_colored_Id, 15) // Black
|
||||
ITEM_AUX(Tile::clayHardened_colored_Id, 13) // Green
|
||||
ITEM_AUX(Tile::clayHardened_colored_Id, 12) // Brown
|
||||
|
||||
// Decoration
|
||||
DEF(eCreativeInventory_Decoration)
|
||||
ITEM_AUX(Item::skull_Id, SkullTileEntity::TYPE_SKELETON)
|
||||
|
|
@ -136,8 +160,8 @@ void IUIScene_CreativeMenu::staticCtor() {
|
|||
ITEM(Tile::deadBush_Id)
|
||||
ITEM(Tile::flower_Id)
|
||||
ITEM(Tile::rose_Id)
|
||||
ITEM(Tile::mushroom1_Id)
|
||||
ITEM(Tile::mushroom2_Id)
|
||||
ITEM(Tile::mushroom_brown_Id)
|
||||
ITEM(Tile::mushroom_red_Id)
|
||||
ITEM(Tile::cactus_Id)
|
||||
ITEM(Tile::topSnow_Id)
|
||||
// 4J-PB - Already got sugar cane in Materials ITEM_11(Tile::reeds_Id)
|
||||
|
|
@ -149,22 +173,23 @@ void IUIScene_CreativeMenu::staticCtor() {
|
|||
ITEM(Item::sign_Id)
|
||||
ITEM(Tile::bookshelf_Id)
|
||||
ITEM(Item::flowerPot_Id)
|
||||
ITEM_AUX(Tile::cloth_Id, 14) // Red
|
||||
ITEM_AUX(Tile::cloth_Id, 1) // Orange
|
||||
ITEM_AUX(Tile::cloth_Id, 4) // Yellow
|
||||
ITEM_AUX(Tile::cloth_Id, 5) // Lime
|
||||
ITEM_AUX(Tile::cloth_Id, 3) // Light Blue
|
||||
ITEM_AUX(Tile::cloth_Id, 9) // Cyan
|
||||
ITEM_AUX(Tile::cloth_Id, 11) // Blue
|
||||
ITEM_AUX(Tile::cloth_Id, 10) // Purple
|
||||
ITEM_AUX(Tile::cloth_Id, 2) // Magenta
|
||||
ITEM_AUX(Tile::cloth_Id, 6) // Pink
|
||||
ITEM_AUX(Tile::cloth_Id, 0) // White
|
||||
ITEM_AUX(Tile::cloth_Id, 8) // Light Gray
|
||||
ITEM_AUX(Tile::cloth_Id, 7) // Gray
|
||||
ITEM_AUX(Tile::cloth_Id, 15) // Black
|
||||
ITEM_AUX(Tile::cloth_Id, 13) // Green
|
||||
ITEM_AUX(Tile::cloth_Id, 12) // Brown
|
||||
ITEM(Tile::hayBlock_Id)
|
||||
ITEM_AUX(Tile::wool_Id, 14) // Red
|
||||
ITEM_AUX(Tile::wool_Id, 1) // Orange
|
||||
ITEM_AUX(Tile::wool_Id, 4) // Yellow
|
||||
ITEM_AUX(Tile::wool_Id, 5) // Lime
|
||||
ITEM_AUX(Tile::wool_Id, 3) // Light Blue
|
||||
ITEM_AUX(Tile::wool_Id, 9) // Cyan
|
||||
ITEM_AUX(Tile::wool_Id, 11) // Blue
|
||||
ITEM_AUX(Tile::wool_Id, 10) // Purple
|
||||
ITEM_AUX(Tile::wool_Id, 2) // Magenta
|
||||
ITEM_AUX(Tile::wool_Id, 6) // Pink
|
||||
ITEM_AUX(Tile::wool_Id, 0) // White
|
||||
ITEM_AUX(Tile::wool_Id, 8) // Light Gray
|
||||
ITEM_AUX(Tile::wool_Id, 7) // Gray
|
||||
ITEM_AUX(Tile::wool_Id, 15) // Black
|
||||
ITEM_AUX(Tile::wool_Id, 13) // Green
|
||||
ITEM_AUX(Tile::wool_Id, 12) // Brown
|
||||
|
||||
ITEM_AUX(Tile::woolCarpet_Id, 14) // Red
|
||||
ITEM_AUX(Tile::woolCarpet_Id, 1) // Orange
|
||||
|
|
@ -183,10 +208,108 @@ void IUIScene_CreativeMenu::staticCtor() {
|
|||
ITEM_AUX(Tile::woolCarpet_Id, 13) // Green
|
||||
ITEM_AUX(Tile::woolCarpet_Id, 12) // Brown
|
||||
|
||||
#if 0
|
||||
ITEM_AUX(Tile::stained_glass_Id,14) // Red
|
||||
ITEM_AUX(Tile::stained_glass_Id,1) // Orange
|
||||
ITEM_AUX(Tile::stained_glass_Id,4) // Yellow
|
||||
ITEM_AUX(Tile::stained_glass_Id,5) // Lime
|
||||
ITEM_AUX(Tile::stained_glass_Id,3) // Light Blue
|
||||
ITEM_AUX(Tile::stained_glass_Id,9) // Cyan
|
||||
ITEM_AUX(Tile::stained_glass_Id,11) // Blue
|
||||
ITEM_AUX(Tile::stained_glass_Id,10) // Purple
|
||||
ITEM_AUX(Tile::stained_glass_Id,2) // Magenta
|
||||
ITEM_AUX(Tile::stained_glass_Id,6) // Pink
|
||||
ITEM_AUX(Tile::stained_glass_Id,0) // White
|
||||
ITEM_AUX(Tile::stained_glass_Id,8) // Light Gray
|
||||
ITEM_AUX(Tile::stained_glass_Id,7) // Gray
|
||||
ITEM_AUX(Tile::stained_glass_Id,15) // Black
|
||||
ITEM_AUX(Tile::stained_glass_Id,13) // Green
|
||||
ITEM_AUX(Tile::stained_glass_Id,12) // Brown
|
||||
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id,14) // Red
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id,1) // Orange
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id,4) // Yellow
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id,5) // Lime
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id,3) // Light Blue
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id,9) // Cyan
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id,11) // Blue
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id,10) // Purple
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id,2) // Magenta
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id,6) // Pink
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id,0) // White
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id,8) // Light Gray
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id,7) // Gray
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id,15) // Black
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id,13) // Green
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id,12) // Brown
|
||||
#endif
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
DEF(eCreativeInventory_ArtToolsDecorations)
|
||||
if (app.DebugSettingsOn()) {
|
||||
for (unsigned int i = 0; i < Painting::LAST_VALUE; ++i) {
|
||||
ITEM_AUX(Item::painting_Id, i + 1)
|
||||
}
|
||||
|
||||
BuildFirework(list, FireworksItem::TYPE_BIG, DyePowderItem::PURPLE, 1,
|
||||
false, false);
|
||||
|
||||
BuildFirework(list, FireworksItem::TYPE_SMALL, DyePowderItem::RED, 1,
|
||||
false, false);
|
||||
BuildFirework(list, FireworksItem::TYPE_SMALL, DyePowderItem::RED, 2,
|
||||
false, false);
|
||||
BuildFirework(list, FireworksItem::TYPE_SMALL, DyePowderItem::RED, 3,
|
||||
false, false);
|
||||
|
||||
BuildFirework(list, FireworksItem::TYPE_BURST, DyePowderItem::GREEN, 1,
|
||||
false, true);
|
||||
BuildFirework(list, FireworksItem::TYPE_CREEPER, DyePowderItem::BLUE, 1,
|
||||
true, false);
|
||||
BuildFirework(list, FireworksItem::TYPE_STAR, DyePowderItem::YELLOW, 1,
|
||||
false, false);
|
||||
BuildFirework(list, FireworksItem::TYPE_BIG, DyePowderItem::WHITE, 1,
|
||||
true, true);
|
||||
|
||||
ITEM_AUX(Tile::stained_glass_Id, 14) // Red
|
||||
ITEM_AUX(Tile::stained_glass_Id, 1) // Orange
|
||||
ITEM_AUX(Tile::stained_glass_Id, 4) // Yellow
|
||||
ITEM_AUX(Tile::stained_glass_Id, 5) // Lime
|
||||
ITEM_AUX(Tile::stained_glass_Id, 3) // Light Blue
|
||||
ITEM_AUX(Tile::stained_glass_Id, 9) // Cyan
|
||||
ITEM_AUX(Tile::stained_glass_Id, 11) // Blue
|
||||
ITEM_AUX(Tile::stained_glass_Id, 10) // Purple
|
||||
ITEM_AUX(Tile::stained_glass_Id, 2) // Magenta
|
||||
ITEM_AUX(Tile::stained_glass_Id, 6) // Pink
|
||||
ITEM_AUX(Tile::stained_glass_Id, 0) // White
|
||||
ITEM_AUX(Tile::stained_glass_Id, 8) // Light Gray
|
||||
ITEM_AUX(Tile::stained_glass_Id, 7) // Gray
|
||||
ITEM_AUX(Tile::stained_glass_Id, 15) // Black
|
||||
ITEM_AUX(Tile::stained_glass_Id, 13) // Green
|
||||
ITEM_AUX(Tile::stained_glass_Id, 12) // Brown
|
||||
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id, 14) // Red
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id, 1) // Orange
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id, 4) // Yellow
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id, 5) // Lime
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id, 3) // Light Blue
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id, 9) // Cyan
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id, 11) // Blue
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id, 10) // Purple
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id, 2) // Magenta
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id, 6) // Pink
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id, 0) // White
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id, 8) // Light Gray
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id, 7) // Gray
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id, 15) // Black
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id, 13) // Green
|
||||
ITEM_AUX(Tile::stained_glass_pane_Id, 12) // Brown
|
||||
}
|
||||
#endif
|
||||
|
||||
// Redstone
|
||||
DEF(eCreativeInventory_Redstone)
|
||||
ITEM(Tile::dispenser_Id)
|
||||
ITEM(Tile::musicBlock_Id)
|
||||
ITEM(Tile::noteblock_Id)
|
||||
ITEM(Tile::pistonBase_Id)
|
||||
ITEM(Tile::pistonStickyBase_Id)
|
||||
ITEM(Tile::tnt_Id)
|
||||
|
|
@ -196,20 +319,31 @@ void IUIScene_CreativeMenu::staticCtor() {
|
|||
ITEM(Tile::pressurePlate_stone_Id)
|
||||
ITEM(Tile::pressurePlate_wood_Id)
|
||||
ITEM(Item::redStone_Id)
|
||||
ITEM(Tile::notGate_on_Id)
|
||||
ITEM(Item::diode_Id)
|
||||
ITEM(Tile::redstoneBlock_Id)
|
||||
ITEM(Tile::redstoneTorch_on_Id)
|
||||
ITEM(Item::repeater_Id)
|
||||
ITEM(Tile::redstoneLight_Id)
|
||||
ITEM(Tile::tripWireSource_Id)
|
||||
ITEM(Tile::daylightDetector_Id)
|
||||
ITEM(Tile::dropper_Id)
|
||||
ITEM(Tile::hopper_Id)
|
||||
ITEM(Item::comparator_Id)
|
||||
ITEM(Tile::chest_trap_Id)
|
||||
ITEM(Tile::weightedPlate_heavy_Id)
|
||||
ITEM(Tile::weightedPlate_light_Id)
|
||||
|
||||
// Transport
|
||||
DEF(eCreativeInventory_Transport)
|
||||
ITEM(Tile::rail_Id)
|
||||
ITEM(Tile::goldenRail_Id)
|
||||
ITEM(Tile::detectorRail_Id)
|
||||
ITEM(Tile::activatorRail_Id)
|
||||
ITEM(Tile::ladder_Id)
|
||||
ITEM(Item::minecart_Id)
|
||||
ITEM(Item::minecart_chest_Id)
|
||||
ITEM(Item::minecart_furnace_Id)
|
||||
ITEM(Item::minecart_hopper_Id)
|
||||
ITEM(Item::minecart_tnt_Id)
|
||||
ITEM(Item::saddle_Id)
|
||||
ITEM(Item::boat_Id)
|
||||
|
||||
|
|
@ -221,25 +355,51 @@ void IUIScene_CreativeMenu::staticCtor() {
|
|||
ITEM(Tile::furnace_Id)
|
||||
ITEM(Item::brewingStand_Id)
|
||||
ITEM(Tile::enchantTable_Id)
|
||||
ITEM(Tile::beacon_Id)
|
||||
ITEM(Tile::endPortalFrameTile_Id)
|
||||
ITEM(Tile::recordPlayer_Id)
|
||||
ITEM(Tile::jukebox_Id)
|
||||
ITEM(Tile::anvil_Id);
|
||||
ITEM(Tile::fence_Id)
|
||||
ITEM(Tile::netherFence_Id)
|
||||
ITEM(Tile::ironFence_Id)
|
||||
ITEM_AUX(Tile::cobbleWall_Id, WallTile::TYPE_NORMAL)
|
||||
ITEM_AUX(Tile::cobbleWall_Id, WallTile::TYPE_MOSSY)
|
||||
ITEM(Item::bed_Id)
|
||||
ITEM(Item::bucket_empty_Id)
|
||||
ITEM(Item::bucket_lava_Id)
|
||||
ITEM(Item::bucket_water_Id)
|
||||
ITEM(Item::milk_Id)
|
||||
ITEM(Item::bucket_milk_Id)
|
||||
ITEM(Item::cauldron_Id)
|
||||
ITEM(Item::snowBall_Id)
|
||||
ITEM(Item::paper_Id)
|
||||
ITEM(Item::book_Id)
|
||||
ITEM(Item::enderPearl_Id)
|
||||
ITEM(Item::eyeOfEnder_Id)
|
||||
ITEM(Item::nameTag_Id)
|
||||
ITEM(Item::netherStar_Id)
|
||||
ITEM_AUX(Item::spawnEgg_Id, 50); // Creeper
|
||||
ITEM_AUX(Item::spawnEgg_Id, 51); // Skeleton
|
||||
ITEM_AUX(Item::spawnEgg_Id, 52); // Spider
|
||||
ITEM_AUX(Item::spawnEgg_Id, 54); // Zombie
|
||||
ITEM_AUX(Item::spawnEgg_Id, 55); // Slime
|
||||
ITEM_AUX(Item::spawnEgg_Id, 56); // Ghast
|
||||
ITEM_AUX(Item::spawnEgg_Id, 57); // Zombie Pigman
|
||||
ITEM_AUX(Item::spawnEgg_Id, 58); // Enderman
|
||||
ITEM_AUX(Item::spawnEgg_Id, 59); // Cave Spider
|
||||
ITEM_AUX(Item::spawnEgg_Id, 60); // Silverfish
|
||||
ITEM_AUX(Item::spawnEgg_Id, 61); // Blaze
|
||||
ITEM_AUX(Item::spawnEgg_Id, 62); // Magma Cube
|
||||
ITEM_AUX(Item::spawnEgg_Id, 65); // Bat
|
||||
ITEM_AUX(Item::spawnEgg_Id, 66); // Witch
|
||||
ITEM_AUX(Item::spawnEgg_Id, 90); // Pig
|
||||
ITEM_AUX(Item::spawnEgg_Id, 91); // Sheep
|
||||
ITEM_AUX(Item::spawnEgg_Id, 92); // Cow
|
||||
ITEM_AUX(Item::spawnEgg_Id, 93); // Chicken
|
||||
ITEM_AUX(Item::spawnEgg_Id, 94); // Squid
|
||||
ITEM_AUX(Item::spawnEgg_Id, 95); // Wolf
|
||||
ITEM_AUX(Item::spawnEgg_Id, 96); // Mooshroom
|
||||
ITEM_AUX(Item::spawnEgg_Id, 98); // Ozelot
|
||||
ITEM_AUX(Item::spawnEgg_Id, 100); // Horse
|
||||
ITEM_AUX(Item::spawnEgg_Id,
|
||||
100 | ((EntityHorse::TYPE_DONKEY + 1) << 12)); // Donkey
|
||||
ITEM_AUX(Item::spawnEgg_Id,
|
||||
100 | ((EntityHorse::TYPE_MULE + 1) << 12)); // Mule
|
||||
ITEM_AUX(Item::spawnEgg_Id, 120); // Villager
|
||||
ITEM(Item::record_01_Id)
|
||||
ITEM(Item::record_02_Id)
|
||||
ITEM(Item::record_03_Id)
|
||||
|
|
@ -252,27 +412,32 @@ void IUIScene_CreativeMenu::staticCtor() {
|
|||
ITEM(Item::record_10_Id)
|
||||
ITEM(Item::record_11_Id)
|
||||
ITEM(Item::record_12_Id)
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 50); // Creeper
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 51); // Skeleton
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 52); // Spider
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 54); // Zombie
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 55); // Slime
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 56); // Ghast
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 57); // Zombie Pigman
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 58); // Enderman
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 59); // Cave Spider
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 60); // Silverfish
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 61); // Blaze
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 62); // Magma Cube
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 90); // Pig
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 91); // Sheep
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 92); // Cow
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 93); // Chicken
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 94); // Squid
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 95); // Wolf
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 96); // Mooshroom
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 98); // Ozelot
|
||||
ITEM_AUX(Item::monsterPlacer_Id, 120); // Villager
|
||||
|
||||
BuildFirework(list, FireworksItem::TYPE_SMALL, DyePowderItem::LIGHT_BLUE, 1,
|
||||
true, false);
|
||||
BuildFirework(list, FireworksItem::TYPE_CREEPER, DyePowderItem::GREEN, 2,
|
||||
false, false);
|
||||
BuildFirework(list, FireworksItem::TYPE_MAX, DyePowderItem::RED, 2, false,
|
||||
false, DyePowderItem::ORANGE);
|
||||
BuildFirework(list, FireworksItem::TYPE_BURST, DyePowderItem::MAGENTA, 3,
|
||||
true, false, DyePowderItem::BLUE);
|
||||
BuildFirework(list, FireworksItem::TYPE_STAR, DyePowderItem::YELLOW, 2,
|
||||
false, true, DyePowderItem::ORANGE);
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
DEF(eCreativeInventory_ArtToolsMisc)
|
||||
if (app.DebugSettingsOn()) {
|
||||
ITEM_AUX(Item::spawnEgg_Id,
|
||||
100 | ((EntityHorse::TYPE_SKELETON + 1) << 12)); // Skeleton
|
||||
ITEM_AUX(Item::spawnEgg_Id,
|
||||
100 | ((EntityHorse::TYPE_UNDEAD + 1) << 12)); // Zombie
|
||||
ITEM_AUX(Item::spawnEgg_Id, 98 | ((Ocelot::TYPE_BLACK + 1) << 12));
|
||||
ITEM_AUX(Item::spawnEgg_Id, 98 | ((Ocelot::TYPE_RED + 1) << 12));
|
||||
ITEM_AUX(Item::spawnEgg_Id, 98 | ((Ocelot::TYPE_SIAMESE + 1) << 12));
|
||||
ITEM_AUX(Item::spawnEgg_Id, 52 | (2 << 12)); // Spider-Jockey
|
||||
ITEM_AUX(Item::spawnEgg_Id, 63); // Enderdragon
|
||||
}
|
||||
#endif
|
||||
|
||||
// Food
|
||||
DEF(eCreativeInventory_Food)
|
||||
|
|
@ -304,17 +469,17 @@ void IUIScene_CreativeMenu::staticCtor() {
|
|||
// Tools, Armour and Weapons (Complete)
|
||||
DEF(eCreativeInventory_ToolsArmourWeapons)
|
||||
ITEM(Item::compass_Id)
|
||||
ITEM(Item::helmet_cloth_Id)
|
||||
ITEM(Item::chestplate_cloth_Id)
|
||||
ITEM(Item::leggings_cloth_Id)
|
||||
ITEM(Item::boots_cloth_Id)
|
||||
ITEM(Item::helmet_leather_Id)
|
||||
ITEM(Item::chestplate_leather_Id)
|
||||
ITEM(Item::leggings_leather_Id)
|
||||
ITEM(Item::boots_leather_Id)
|
||||
ITEM(Item::sword_wood_Id)
|
||||
ITEM(Item::shovel_wood_Id)
|
||||
ITEM(Item::pickAxe_wood_Id)
|
||||
ITEM(Item::hatchet_wood_Id)
|
||||
ITEM(Item::hoe_wood_Id)
|
||||
|
||||
ITEM(Item::map_Id)
|
||||
ITEM(Item::emptyMap_Id)
|
||||
ITEM(Item::helmet_chain_Id)
|
||||
ITEM(Item::chestplate_chain_Id)
|
||||
ITEM(Item::leggings_chain_Id)
|
||||
|
|
@ -363,6 +528,10 @@ void IUIScene_CreativeMenu::staticCtor() {
|
|||
ITEM(Item::shears_Id)
|
||||
ITEM(Item::fishingRod_Id)
|
||||
ITEM(Item::carrotOnAStick_Id)
|
||||
ITEM(Item::lead_Id)
|
||||
ITEM(Item::horseArmorDiamond_Id)
|
||||
ITEM(Item::horseArmorGold_Id)
|
||||
ITEM(Item::horseArmorMetal_Id)
|
||||
|
||||
for (unsigned int i = 0; i < Enchantment::enchantments.length; ++i) {
|
||||
Enchantment* enchantment = Enchantment::enchantments[i];
|
||||
|
|
@ -371,6 +540,17 @@ void IUIScene_CreativeMenu::staticCtor() {
|
|||
new EnchantmentInstance(enchantment, enchantment->getMaxLevel())));
|
||||
}
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
if (app.DebugSettingsOn()) {
|
||||
std::shared_ptr<ItemInstance> debugSword =
|
||||
std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Item::sword_diamond_Id, 1, 0));
|
||||
debugSword->enchant(Enchantment::damageBonus, 50);
|
||||
debugSword->setHoverName(L"Sword of Debug");
|
||||
list->push_back(debugSword);
|
||||
}
|
||||
#endif
|
||||
|
||||
// Materials
|
||||
DEF(eCreativeInventory_Materials)
|
||||
ITEM(Item::coal_Id)
|
||||
|
|
@ -389,7 +569,7 @@ void IUIScene_CreativeMenu::staticCtor() {
|
|||
ITEM(Item::feather_Id)
|
||||
ITEM(Item::flint_Id)
|
||||
ITEM(Item::leather_Id)
|
||||
ITEM(Item::sulphur_Id)
|
||||
ITEM(Item::gunpowder_Id)
|
||||
ITEM(Item::clay_Id)
|
||||
ITEM(Item::yellowDust_Id)
|
||||
ITEM(Item::seeds_wheat_Id)
|
||||
|
|
@ -402,7 +582,7 @@ void IUIScene_CreativeMenu::staticCtor() {
|
|||
ITEM(Item::slimeBall_Id)
|
||||
ITEM(Item::blazeRod_Id)
|
||||
ITEM(Item::goldNugget_Id)
|
||||
ITEM(Item::netherStalkSeeds_Id)
|
||||
ITEM(Item::netherwart_seeds_Id)
|
||||
ITEM_AUX(Item::dye_powder_Id, 1) // Red
|
||||
ITEM_AUX(Item::dye_powder_Id, 14) // Orange
|
||||
ITEM_AUX(Item::dye_powder_Id, 11) // Yellow
|
||||
|
|
@ -641,32 +821,42 @@ void IUIScene_CreativeMenu::staticCtor() {
|
|||
ECreative_Inventory_Groups blocksGroup[] = {
|
||||
eCreativeInventory_BuildingBlocks};
|
||||
specs[eCreativeInventoryTab_BuildingBlocks] = new TabSpec(
|
||||
L"Structures", IDS_GROUPNAME_BUILDING_BLOCKS, 1, blocksGroup, 0, NULL);
|
||||
L"Structures", IDS_GROUPNAME_BUILDING_BLOCKS, 1, blocksGroup);
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
ECreative_Inventory_Groups decorationsGroup[] = {
|
||||
eCreativeInventory_Decoration};
|
||||
ECreative_Inventory_Groups debugDecorationsGroup[] = {
|
||||
eCreativeInventory_ArtToolsDecorations};
|
||||
specs[eCreativeInventoryTab_Decorations] =
|
||||
new TabSpec(L"Decoration", IDS_GROUPNAME_DECORATIONS, 1,
|
||||
decorationsGroup, 0, NULL, 1, debugDecorationsGroup);
|
||||
#else
|
||||
ECreative_Inventory_Groups decorationsGroup[] = {
|
||||
eCreativeInventory_Decoration};
|
||||
specs[eCreativeInventoryTab_Decorations] = new TabSpec(
|
||||
L"Decoration", IDS_GROUPNAME_DECORATIONS, 1, decorationsGroup, 0, NULL);
|
||||
L"Decoration", IDS_GROUPNAME_DECORATIONS, 1, decorationsGroup);
|
||||
#endif
|
||||
|
||||
ECreative_Inventory_Groups redAndTranGroup[] = {
|
||||
eCreativeInventory_Transport, eCreativeInventory_Redstone};
|
||||
specs[eCreativeInventoryTab_RedstoneAndTransport] = new TabSpec(
|
||||
L"RedstoneAndTransport", IDS_GROUPNAME_REDSTONE_AND_TRANSPORT, 2,
|
||||
redAndTranGroup, 0, NULL);
|
||||
specs[eCreativeInventoryTab_RedstoneAndTransport] =
|
||||
new TabSpec(L"RedstoneAndTransport",
|
||||
IDS_GROUPNAME_REDSTONE_AND_TRANSPORT, 2, redAndTranGroup);
|
||||
|
||||
ECreative_Inventory_Groups materialsGroup[] = {
|
||||
eCreativeInventory_Materials};
|
||||
specs[eCreativeInventoryTab_Materials] = new TabSpec(
|
||||
L"Materials", IDS_GROUPNAME_MATERIALS, 1, materialsGroup, 0, NULL);
|
||||
specs[eCreativeInventoryTab_Materials] =
|
||||
new TabSpec(L"Materials", IDS_GROUPNAME_MATERIALS, 1, materialsGroup);
|
||||
|
||||
ECreative_Inventory_Groups foodGroup[] = {eCreativeInventory_Food};
|
||||
specs[eCreativeInventoryTab_Food] =
|
||||
new TabSpec(L"Food", IDS_GROUPNAME_FOOD, 1, foodGroup, 0, NULL);
|
||||
new TabSpec(L"Food", IDS_GROUPNAME_FOOD, 1, foodGroup);
|
||||
|
||||
ECreative_Inventory_Groups toolsGroup[] = {
|
||||
eCreativeInventory_ToolsArmourWeapons};
|
||||
specs[eCreativeInventoryTab_ToolsWeaponsArmor] = new TabSpec(
|
||||
L"Tools", IDS_GROUPNAME_TOOLS_WEAPONS_ARMOR, 1, toolsGroup, 0, NULL);
|
||||
specs[eCreativeInventoryTab_ToolsWeaponsArmor] =
|
||||
new TabSpec(L"Tools", IDS_GROUPNAME_TOOLS_WEAPONS_ARMOR, 1, toolsGroup);
|
||||
|
||||
ECreative_Inventory_Groups brewingGroup[] = {
|
||||
eCreativeInventory_Brewing, eCreativeInventory_Potions_Level2_Extended,
|
||||
|
|
@ -677,8 +867,8 @@ void IUIScene_CreativeMenu::staticCtor() {
|
|||
// In 480p there's not enough room for the LT button, so use text instead
|
||||
// if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen())
|
||||
{
|
||||
specs[eCreativeInventoryTab_Brewing] = new TabSpec(
|
||||
L"Brewing", IDS_GROUPNAME_POTIONS_480, 5, brewingGroup, 0, NULL);
|
||||
specs[eCreativeInventoryTab_Brewing] =
|
||||
new TabSpec(L"Brewing", IDS_GROUPNAME_POTIONS_480, 5, brewingGroup);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
|
|
@ -687,9 +877,18 @@ void IUIScene_CreativeMenu::staticCtor() {
|
|||
// potionsGroup);
|
||||
// }
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
ECreative_Inventory_Groups miscGroup[] = {eCreativeInventory_Misc};
|
||||
specs[eCreativeInventoryTab_Misc] = new TabSpec(
|
||||
L"Misc", IDS_GROUPNAME_MISCELLANEOUS, 1, miscGroup, 0, NULL);
|
||||
ECreative_Inventory_Groups debugMiscGroup[] = {
|
||||
eCreativeInventory_ArtToolsMisc};
|
||||
specs[eCreativeInventoryTab_Misc] =
|
||||
new TabSpec(L"Misc", IDS_GROUPNAME_MISCELLANEOUS, 1, miscGroup, 0, NULL,
|
||||
1, debugMiscGroup);
|
||||
#else
|
||||
ECreative_Inventory_Groups miscGroup[] = {eCreativeInventory_Misc};
|
||||
specs[eCreativeInventoryTab_Misc] =
|
||||
new TabSpec(L"Misc", IDS_GROUPNAME_MISCELLANEOUS, 1, miscGroup);
|
||||
#endif
|
||||
}
|
||||
|
||||
IUIScene_CreativeMenu::IUIScene_CreativeMenu() {
|
||||
|
|
@ -718,16 +917,41 @@ void IUIScene_CreativeMenu::switchTab(ECreativeInventoryTabs tab) {
|
|||
m_tabPage[m_curTab]);
|
||||
}
|
||||
|
||||
void IUIScene_CreativeMenu::ScrollBar(UIVec2D pointerPos) {
|
||||
UIVec2D pos;
|
||||
UIVec2D size;
|
||||
GetItemScreenData(eSectionInventoryCreativeSlider, 0, &pos, &size);
|
||||
float fPosition = ((float)pointerPos.y - pos.y) / size.y;
|
||||
|
||||
// clamp
|
||||
if (fPosition > 1)
|
||||
fPosition = 1.0f;
|
||||
else if (fPosition < 0)
|
||||
fPosition = 0.0f;
|
||||
|
||||
// calculate page position according to page count
|
||||
int iCurrentPage =
|
||||
Math::round(fPosition * (specs[m_curTab]->getPageCount() - 1));
|
||||
|
||||
// set tab page
|
||||
m_tabPage[m_curTab] = iCurrentPage;
|
||||
|
||||
// update tab
|
||||
switchTab(m_curTab);
|
||||
}
|
||||
|
||||
// 4J JEV - Tab Spec Struct
|
||||
|
||||
IUIScene_CreativeMenu::TabSpec::TabSpec(
|
||||
const wchar_t* icon, int descriptionId, int staticGroupsCount,
|
||||
ECreative_Inventory_Groups* staticGroups, int dynamicGroupsCount,
|
||||
ECreative_Inventory_Groups* dynamicGroups)
|
||||
ECreative_Inventory_Groups* dynamicGroups, int debugGroupsCount /*= 0*/,
|
||||
ECreative_Inventory_Groups* debugGroups /*= NULL*/)
|
||||
: m_icon(icon),
|
||||
m_descriptionId(descriptionId),
|
||||
m_staticGroupsCount(staticGroupsCount),
|
||||
m_dynamicGroupsCount(dynamicGroupsCount) {
|
||||
m_dynamicGroupsCount(dynamicGroupsCount),
|
||||
m_debugGroupsCount(debugGroupsCount) {
|
||||
m_pages = 0;
|
||||
m_staticGroupsA = NULL;
|
||||
|
||||
|
|
@ -742,8 +966,18 @@ IUIScene_CreativeMenu::TabSpec::TabSpec(
|
|||
}
|
||||
}
|
||||
|
||||
m_debugGroupsA = NULL;
|
||||
m_debugItems = 0;
|
||||
if (debugGroupsCount > 0) {
|
||||
m_debugGroupsA = new ECreative_Inventory_Groups[debugGroupsCount];
|
||||
for (int i = 0; i < debugGroupsCount; ++i) {
|
||||
m_debugGroupsA[i] = debugGroups[i];
|
||||
m_debugItems += categoryGroups[m_debugGroupsA[i]].size();
|
||||
}
|
||||
}
|
||||
|
||||
m_dynamicGroupsA = NULL;
|
||||
if (dynamicGroupsCount > 0) {
|
||||
if (dynamicGroupsCount > 0 && dynamicGroups != NULL) {
|
||||
m_dynamicGroupsA = new ECreative_Inventory_Groups[dynamicGroupsCount];
|
||||
for (int i = 0; i < dynamicGroupsCount; ++i) {
|
||||
m_dynamicGroupsA[i] = dynamicGroups[i];
|
||||
|
|
@ -758,6 +992,7 @@ IUIScene_CreativeMenu::TabSpec::TabSpec(
|
|||
IUIScene_CreativeMenu::TabSpec::~TabSpec() {
|
||||
if (m_staticGroupsA != NULL) delete[] m_staticGroupsA;
|
||||
if (m_dynamicGroupsA != NULL) delete[] m_dynamicGroupsA;
|
||||
if (m_debugGroupsA != NULL) delete[] m_debugGroupsA;
|
||||
}
|
||||
|
||||
void IUIScene_CreativeMenu::TabSpec::populateMenu(AbstractContainerMenu* menu,
|
||||
|
|
@ -779,45 +1014,103 @@ void IUIScene_CreativeMenu::TabSpec::populateMenu(AbstractContainerMenu* menu,
|
|||
|
||||
// Fill from the static groups
|
||||
unsigned int startIndex = page * m_staticPerPage;
|
||||
int remainingItems = m_staticItems - startIndex;
|
||||
|
||||
// Work out the first group with an item the want to display, and which item
|
||||
// in that group
|
||||
unsigned int currentIndex = 0;
|
||||
unsigned int currentGroup = 0;
|
||||
unsigned int currentItem = 0;
|
||||
bool displayStatic = false;
|
||||
for (; currentGroup < m_staticGroupsCount; ++currentGroup) {
|
||||
int size = categoryGroups[m_staticGroupsA[currentGroup]].size();
|
||||
if (currentIndex + size < startIndex) {
|
||||
currentIndex += size;
|
||||
continue;
|
||||
}
|
||||
displayStatic = true;
|
||||
currentItem = size - ((currentIndex + size) - startIndex);
|
||||
break;
|
||||
}
|
||||
|
||||
for (; lastSlotIndex < MAX_SIZE;) {
|
||||
Slot* slot = menu->getSlot(lastSlotIndex++);
|
||||
slot->set(categoryGroups[m_staticGroupsA[currentGroup]][currentItem]);
|
||||
int lastStaticPageCount = currentIndex;
|
||||
while (lastStaticPageCount > m_staticPerPage)
|
||||
lastStaticPageCount -= m_staticPerPage;
|
||||
|
||||
++currentItem;
|
||||
if (currentItem >=
|
||||
categoryGroups[m_staticGroupsA[currentGroup]].size()) {
|
||||
currentItem = 0;
|
||||
++currentGroup;
|
||||
if (currentGroup >= m_staticGroupsCount) {
|
||||
break;
|
||||
if (displayStatic) {
|
||||
for (; lastSlotIndex < MAX_SIZE;) {
|
||||
Slot* slot = menu->getSlot(lastSlotIndex++);
|
||||
slot->set(
|
||||
categoryGroups[m_staticGroupsA[currentGroup]][currentItem]);
|
||||
|
||||
++currentItem;
|
||||
if (currentItem >=
|
||||
categoryGroups[m_staticGroupsA[currentGroup]].size()) {
|
||||
currentItem = 0;
|
||||
++currentGroup;
|
||||
if (currentGroup >= m_staticGroupsCount) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
if (app.DebugArtToolsOn()) {
|
||||
if (m_debugGroupsCount > 0) {
|
||||
startIndex = 0;
|
||||
if (lastStaticPageCount != 0) {
|
||||
startIndex = m_staticPerPage - lastStaticPageCount;
|
||||
}
|
||||
currentIndex = 0;
|
||||
currentGroup = 0;
|
||||
currentItem = 0;
|
||||
bool showDebug = false;
|
||||
for (; currentGroup < m_debugGroupsCount; ++currentGroup) {
|
||||
int size = categoryGroups[m_debugGroupsA[currentGroup]].size();
|
||||
if (currentIndex + size < startIndex) {
|
||||
currentIndex += size;
|
||||
continue;
|
||||
}
|
||||
currentItem = size - ((currentIndex + size) - startIndex);
|
||||
break;
|
||||
}
|
||||
|
||||
for (; lastSlotIndex < MAX_SIZE;) {
|
||||
Slot* slot = menu->getSlot(lastSlotIndex++);
|
||||
slot->set(
|
||||
categoryGroups[m_debugGroupsA[currentGroup]][currentItem]);
|
||||
|
||||
++currentItem;
|
||||
if (currentItem >=
|
||||
categoryGroups[m_debugGroupsA[currentGroup]].size()) {
|
||||
currentItem = 0;
|
||||
++currentGroup;
|
||||
if (currentGroup >= m_debugGroupsCount) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (; lastSlotIndex < MAX_SIZE; ++lastSlotIndex) {
|
||||
Slot* slot = menu->getSlot(lastSlotIndex);
|
||||
slot->remove(1);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int IUIScene_CreativeMenu::TabSpec::getPageCount() { return m_pages; }
|
||||
unsigned int IUIScene_CreativeMenu::TabSpec::getPageCount() {
|
||||
#ifndef _CONTENT_PACKAGE
|
||||
if (app.DebugArtToolsOn()) {
|
||||
return (int)ceil((float)(m_staticItems + m_debugItems) /
|
||||
m_staticPerPage);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
return m_pages;
|
||||
}
|
||||
}
|
||||
|
||||
// 4J JEV - Item Picker Menu
|
||||
IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu(
|
||||
|
|
@ -876,7 +1169,6 @@ IUIScene_CreativeMenu::GetSectionAndSlotInDirection(ESceneSection eSection,
|
|||
newSection = eSectionInventoryCreativeSelector;
|
||||
}
|
||||
break;
|
||||
#ifndef _XBOX
|
||||
case eSectionInventoryCreativeTab_0:
|
||||
case eSectionInventoryCreativeTab_1:
|
||||
case eSectionInventoryCreativeTab_2:
|
||||
|
|
@ -888,7 +1180,6 @@ IUIScene_CreativeMenu::GetSectionAndSlotInDirection(ESceneSection eSection,
|
|||
case eSectionInventoryCreativeSlider:
|
||||
/* do nothing */
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
|
|
@ -914,7 +1205,7 @@ bool IUIScene_CreativeMenu::handleValidKeyPress(int iPad, int buttonNum,
|
|||
m_menu->getSlot(i)->set(nullptr);
|
||||
// call this function to synchronize multiplayer item bar
|
||||
pMinecraft->localgameModes[iPad]->handleCreativeModeItemAdd(
|
||||
nullptr, i - (int)m_menu->slots->size() + 9 +
|
||||
nullptr, i - (int)m_menu->slots.size() + 9 +
|
||||
InventoryMenu::USE_ROW_SLOT_START);
|
||||
}
|
||||
}
|
||||
|
|
@ -924,7 +1215,7 @@ bool IUIScene_CreativeMenu::handleValidKeyPress(int iPad, int buttonNum,
|
|||
}
|
||||
|
||||
void IUIScene_CreativeMenu::handleOutsideClicked(int iPad, int buttonNum,
|
||||
bool quickKeyHeld) {
|
||||
BOOL quickKeyHeld) {
|
||||
// Drop items.
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
|
|
@ -1047,7 +1338,7 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection,
|
|||
m_menu->getSlot(currentIndex)->getItem();
|
||||
// call this function to synchronize multiplayer item bar
|
||||
pMinecraft->localgameModes[getPad()]->handleCreativeModeItemAdd(
|
||||
newItem, currentIndex - (int)m_menu->slots->size() + 9 +
|
||||
newItem, currentIndex - (int)m_menu->slots.size() + 9 +
|
||||
InventoryMenu::USE_ROW_SLOT_START);
|
||||
|
||||
if (m_bCarryingCreativeItem) {
|
||||
|
|
@ -1095,7 +1386,7 @@ bool IUIScene_CreativeMenu::getEmptyInventorySlot(
|
|||
// Jump to the slot with this item already on it, if we can stack more
|
||||
for (unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i) {
|
||||
std::shared_ptr<ItemInstance> slotItem = m_menu->getSlot(i)->getItem();
|
||||
if (slotItem != NULL && slotItem->sameItem(item) &&
|
||||
if (slotItem != NULL && slotItem->sameItemWithTags(item) &&
|
||||
(slotItem->GetCount() + item->GetCount() <=
|
||||
item->getMaxStackSize())) {
|
||||
sameItemFound = true;
|
||||
|
|
@ -1139,13 +1430,12 @@ bool IUIScene_CreativeMenu::overrideTooltips(
|
|||
std::shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried,
|
||||
bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
|
||||
EToolTipItem& buttonA, EToolTipItem& buttonX, EToolTipItem& buttonY,
|
||||
EToolTipItem& buttonRT) {
|
||||
EToolTipItem& buttonRT, EToolTipItem& buttonBack) {
|
||||
bool _override = false;
|
||||
|
||||
if (sectionUnderPointer == eSectionInventoryCreativeSelector) {
|
||||
if (bSlotHasItem) {
|
||||
buttonA = eToolTipPickUpGeneric;
|
||||
buttonRT = eToolTipWhatIsThis;
|
||||
|
||||
if (itemUnderPointer->isStackable()) {
|
||||
buttonY = eToolTipPickUpAll;
|
||||
|
|
@ -1161,3 +1451,73 @@ bool IUIScene_CreativeMenu::overrideTooltips(
|
|||
|
||||
return _override;
|
||||
}
|
||||
|
||||
void IUIScene_CreativeMenu::BuildFirework(
|
||||
std::vector<std::shared_ptr<ItemInstance> >* list, uint8_t type, int color,
|
||||
int sulphur, bool flicker, bool trail, int fadeColor /*= -1*/) {
|
||||
/////////////////////////////////
|
||||
// Create firecharge
|
||||
/////////////////////////////////
|
||||
|
||||
CompoundTag* expTag = new CompoundTag(FireworksItem::TAG_EXPLOSION);
|
||||
|
||||
std::vector<int> colors;
|
||||
|
||||
colors.push_back(DyePowderItem::COLOR_RGB[color]);
|
||||
|
||||
// glowstone dust gives flickering
|
||||
if (flicker) expTag->putBoolean(FireworksItem::TAG_E_FLICKER, true);
|
||||
|
||||
// diamonds give trails
|
||||
if (trail) expTag->putBoolean(FireworksItem::TAG_E_TRAIL, true);
|
||||
|
||||
intArray colorArray(colors.size());
|
||||
for (int i = 0; i < colorArray.length; i++) {
|
||||
colorArray[i] = colors.at(i);
|
||||
}
|
||||
expTag->putIntArray(FireworksItem::TAG_E_COLORS, colorArray);
|
||||
// delete colorArray.data;
|
||||
|
||||
expTag->putByte(FireworksItem::TAG_E_TYPE, type);
|
||||
|
||||
if (fadeColor != -1) {
|
||||
////////////////////////////////////
|
||||
// Apply fade colors to firecharge
|
||||
////////////////////////////////////
|
||||
|
||||
std::vector<int> colors;
|
||||
colors.push_back(DyePowderItem::COLOR_RGB[fadeColor]);
|
||||
|
||||
intArray colorArray(colors.size());
|
||||
for (int i = 0; i < colorArray.length; i++) {
|
||||
colorArray[i] = colors.at(i);
|
||||
}
|
||||
expTag->putIntArray(FireworksItem::TAG_E_FADECOLORS, colorArray);
|
||||
}
|
||||
|
||||
/////////////////////////////////
|
||||
// Create fireworks
|
||||
/////////////////////////////////
|
||||
|
||||
std::shared_ptr<ItemInstance> firework;
|
||||
|
||||
{
|
||||
firework =
|
||||
std::shared_ptr<ItemInstance>(new ItemInstance(Item::fireworks));
|
||||
CompoundTag* itemTag = new CompoundTag();
|
||||
CompoundTag* fireTag = new CompoundTag(FireworksItem::TAG_FIREWORKS);
|
||||
ListTag<CompoundTag>* expTags =
|
||||
new ListTag<CompoundTag>(FireworksItem::TAG_EXPLOSIONS);
|
||||
|
||||
expTags->add(expTag);
|
||||
|
||||
fireTag->put(FireworksItem::TAG_EXPLOSIONS, expTags);
|
||||
fireTag->putByte(FireworksItem::TAG_FLIGHT, (uint8_t)sulphur);
|
||||
|
||||
itemTag->put(FireworksItem::TAG_FIREWORKS, fireTag);
|
||||
|
||||
firework->setTag(itemTag);
|
||||
}
|
||||
|
||||
list->push_back(firework);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,8 @@
|
|||
// 4J Stu - This class is for code that is common between XUI and Iggy
|
||||
|
||||
class SimpleContainer;
|
||||
class CreativeInventoryScreen;
|
||||
|
||||
class IUIScene_CreativeMenu : public virtual IUIScene_AbstractContainerMenu {
|
||||
friend class CreativeInventoryScreen;
|
||||
|
||||
public:
|
||||
// 4J Stu - These map directly to the tabs seenon the screen
|
||||
enum ECreativeInventoryTabs {
|
||||
|
|
@ -39,6 +36,8 @@ public:
|
|||
eCreativeInventory_Potions_Extended,
|
||||
eCreativeInventory_Potions_Level2_Extended,
|
||||
eCreativeInventory_Misc,
|
||||
eCreativeInventory_ArtToolsDecorations,
|
||||
eCreativeInventory_ArtToolsMisc,
|
||||
eCreativeInventoryGroupsCount
|
||||
};
|
||||
|
||||
|
|
@ -57,6 +56,8 @@ public:
|
|||
ECreative_Inventory_Groups* m_staticGroupsA;
|
||||
const int m_dynamicGroupsCount;
|
||||
ECreative_Inventory_Groups* m_dynamicGroupsA;
|
||||
const int m_debugGroupsCount;
|
||||
ECreative_Inventory_Groups* m_debugGroupsA;
|
||||
|
||||
private:
|
||||
unsigned int m_pages;
|
||||
|
|
@ -66,8 +67,10 @@ public:
|
|||
public:
|
||||
TabSpec(const wchar_t* icon, int descriptionId, int staticGroupsCount,
|
||||
ECreative_Inventory_Groups* staticGroups,
|
||||
int dynamicGroupsCount,
|
||||
ECreative_Inventory_Groups* dynamicGroups);
|
||||
int dynamicGroupsCount = 0,
|
||||
ECreative_Inventory_Groups* dynamicGroups = NULL,
|
||||
int debugGroupsCount = 0,
|
||||
ECreative_Inventory_Groups* debugGroups = NULL);
|
||||
~TabSpec();
|
||||
|
||||
void populateMenu(AbstractContainerMenu* menu, int dynamicIndex,
|
||||
|
|
@ -113,6 +116,7 @@ protected:
|
|||
int m_tabPage[eCreativeInventoryTab_COUNT];
|
||||
|
||||
void switchTab(ECreativeInventoryTabs tab);
|
||||
void ScrollBar(UIVec2D pointerPos);
|
||||
virtual void updateTabHighlightAndText(ECreativeInventoryTabs tab) = 0;
|
||||
virtual void updateScrollCurrentPage(int currentPage, int pageCount) = 0;
|
||||
virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
|
|
@ -136,5 +140,10 @@ protected:
|
|||
std::shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried,
|
||||
bool bSlotHasItem, bool bCarriedIsSameAsSlot,
|
||||
int iSlotStackSizeRemaining, EToolTipItem& buttonA,
|
||||
EToolTipItem& buttonX, EToolTipItem& buttonY, EToolTipItem& buttonRT);
|
||||
};
|
||||
EToolTipItem& buttonX, EToolTipItem& buttonY, EToolTipItem& buttonRT,
|
||||
EToolTipItem& buttonBack);
|
||||
|
||||
static void BuildFirework(std::vector<std::shared_ptr<ItemInstance> >* list,
|
||||
uint8_t type, int color, int sulphur,
|
||||
bool flicker, bool trail, int fadeColor = -1);
|
||||
};
|
||||
103
Minecraft.Client/Platform/Common/UI/IUIScene_FireworksMenu.cpp
Normal file
103
Minecraft.Client/Platform/Common/UI/IUIScene_FireworksMenu.cpp
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
#include "../../stdafx.h"
|
||||
|
||||
#include "IUIScene_FireworksMenu.h"
|
||||
#include "../../../../Minecraft.World/Headers/net.minecraft.world.inventory.h"
|
||||
|
||||
IUIScene_AbstractContainerMenu::ESceneSection
|
||||
IUIScene_FireworksMenu::GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY) {
|
||||
ESceneSection newSection = eSection;
|
||||
int xOffset = 0;
|
||||
int yOffset = 0;
|
||||
|
||||
// Find the new section if there is one
|
||||
switch (eSection) {
|
||||
case eSectionFireworksIngredients:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionFireworksInventory;
|
||||
xOffset = -1;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionFireworksUsing;
|
||||
xOffset = -1;
|
||||
} else if (eTapDirection == eTapStateLeft) {
|
||||
newSection = eSectionFireworksResult;
|
||||
} else if (eTapDirection == eTapStateRight) {
|
||||
newSection = eSectionFireworksResult;
|
||||
}
|
||||
break;
|
||||
case eSectionFireworksResult:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionFireworksInventory;
|
||||
xOffset = -7;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionFireworksUsing;
|
||||
xOffset = -7;
|
||||
} else if (eTapDirection == eTapStateLeft) {
|
||||
newSection = eSectionFireworksIngredients;
|
||||
yOffset = -1;
|
||||
*piTargetX = getSectionColumns(eSectionFireworksIngredients);
|
||||
} else if (eTapDirection == eTapStateRight) {
|
||||
newSection = eSectionFireworksIngredients;
|
||||
yOffset = -1;
|
||||
*piTargetX = 0;
|
||||
}
|
||||
break;
|
||||
case eSectionFireworksInventory:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionFireworksUsing;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
if (*piTargetX < 6) {
|
||||
newSection = eSectionFireworksIngredients;
|
||||
xOffset = 1;
|
||||
} else {
|
||||
newSection = eSectionFireworksResult;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case eSectionFireworksUsing:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
if (*piTargetX < 6) {
|
||||
newSection = eSectionFireworksIngredients;
|
||||
xOffset = 1;
|
||||
} else {
|
||||
newSection = eSectionFireworksResult;
|
||||
}
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionFireworksInventory;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX,
|
||||
piTargetY, xOffset, yOffset);
|
||||
|
||||
return newSection;
|
||||
}
|
||||
|
||||
int IUIScene_FireworksMenu::getSectionStartOffset(ESceneSection eSection) {
|
||||
int offset = 0;
|
||||
switch (eSection) {
|
||||
case eSectionFireworksIngredients:
|
||||
offset = FireworksMenu::CRAFT_SLOT_START;
|
||||
break;
|
||||
|
||||
case eSectionFireworksResult:
|
||||
offset = FireworksMenu::RESULT_SLOT;
|
||||
break;
|
||||
case eSectionFireworksInventory:
|
||||
offset = FireworksMenu::INV_SLOT_START;
|
||||
break;
|
||||
case eSectionFireworksUsing:
|
||||
offset = FireworksMenu::INV_SLOT_START + 27;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
11
Minecraft.Client/Platform/Common/UI/IUIScene_FireworksMenu.h
Normal file
11
Minecraft.Client/Platform/Common/UI/IUIScene_FireworksMenu.h
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
#include "IUIScene_AbstractContainerMenu.h"
|
||||
|
||||
class IUIScene_FireworksMenu : public virtual IUIScene_AbstractContainerMenu {
|
||||
protected:
|
||||
virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY);
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
};
|
||||
253
Minecraft.Client/Platform/Common/UI/IUIScene_HUD.cpp
Normal file
253
Minecraft.Client/Platform/Common/UI/IUIScene_HUD.cpp
Normal file
|
|
@ -0,0 +1,253 @@
|
|||
#include "../../stdafx.h"
|
||||
#include "../../Minecraft.h"
|
||||
#include "../../MultiPlayerLocalPlayer.h"
|
||||
#include "../../../../Minecraft.World/Headers/net.minecraft.world.effect.h"
|
||||
#include "../../../../Minecraft.World/Headers/net.minecraft.world.item.h"
|
||||
#include "../../../../Minecraft.World/Headers/net.minecraft.world.entity.ai.attributes.h"
|
||||
#include "../../../../Minecraft.World/Headers/net.minecraft.world.entity.monster.h"
|
||||
#include "IUIScene_HUD.h"
|
||||
|
||||
IUIScene_HUD::IUIScene_HUD() {
|
||||
m_lastActiveSlot = -1;
|
||||
m_iGuiScale = -1;
|
||||
m_bToolTipsVisible = true;
|
||||
m_lastExpProgress = 0.0f;
|
||||
m_lastExpLevel = 0;
|
||||
m_iCurrentHealth = 0;
|
||||
m_lastMaxHealth = 20;
|
||||
m_lastHealthBlink = false;
|
||||
m_lastHealthPoison = false;
|
||||
m_iCurrentFood = -1;
|
||||
m_lastFoodPoison = false;
|
||||
m_lastAir = 10;
|
||||
m_currentExtraAir = 0;
|
||||
m_lastArmour = 0;
|
||||
m_showHealth = true;
|
||||
m_showHorseHealth = true;
|
||||
m_showFood = true;
|
||||
m_showAir = true;
|
||||
m_showArmour = true;
|
||||
m_showExpBar = true;
|
||||
m_bRegenEffectEnabled = false;
|
||||
m_iFoodSaturation = 0;
|
||||
m_lastDragonHealth = 0.0f;
|
||||
m_showDragonHealth = false;
|
||||
m_ticksWithNoBoss = 0;
|
||||
m_uiSelectedItemOpacityCountDown = 0;
|
||||
m_displayName = L"";
|
||||
m_lastShowDisplayName = true;
|
||||
m_bRidingHorse = true;
|
||||
m_horseHealth = 1;
|
||||
m_lastHealthWither = true;
|
||||
m_iCurrentHealthAbsorb = -1;
|
||||
m_horseJumpProgress = 1.0f;
|
||||
m_iHeartOffsetIndex = -1;
|
||||
m_bHealthAbsorbActive = false;
|
||||
m_iHorseMaxHealth = -1;
|
||||
m_bIsJumpable = false;
|
||||
}
|
||||
|
||||
void IUIScene_HUD::updateFrameTick() {
|
||||
int iPad = getPad();
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
int iGuiScale;
|
||||
|
||||
if (pMinecraft->localplayers[iPad]->m_iScreenSection ==
|
||||
C4JRender::VIEWPORT_TYPE_FULLSCREEN) {
|
||||
iGuiScale = app.GetGameSettings(iPad, eGameSetting_UISize);
|
||||
} else {
|
||||
iGuiScale = app.GetGameSettings(iPad, eGameSetting_UISizeSplitscreen);
|
||||
}
|
||||
SetHudSize(iGuiScale);
|
||||
|
||||
SetDisplayName(ProfileManager.GetDisplayName(iPad));
|
||||
|
||||
SetTooltipsEnabled(((ui.GetMenuDisplayed(ProfileManager.GetPrimaryPad())) ||
|
||||
(app.GetGameSettings(ProfileManager.GetPrimaryPad(),
|
||||
eGameSetting_Tooltips) != 0)));
|
||||
|
||||
SetActiveSlot(pMinecraft->localplayers[iPad]->inventory->selected);
|
||||
|
||||
if (pMinecraft->localgameModes[iPad]->canHurtPlayer()) {
|
||||
renderPlayerHealth();
|
||||
} else {
|
||||
// SetRidingHorse(false, 0);
|
||||
std::shared_ptr<Entity> riding = pMinecraft->localplayers[iPad]->riding;
|
||||
if (riding == NULL) {
|
||||
SetRidingHorse(false, false, 0);
|
||||
} else {
|
||||
SetRidingHorse(
|
||||
true, pMinecraft->localplayers[iPad]->isRidingJumpable(), 0);
|
||||
}
|
||||
ShowHorseHealth(false);
|
||||
m_horseHealth = 0;
|
||||
ShowHealth(false);
|
||||
ShowFood(false);
|
||||
ShowAir(false);
|
||||
ShowArmour(false);
|
||||
ShowExpBar(false);
|
||||
SetHealthAbsorb(0);
|
||||
}
|
||||
|
||||
if (pMinecraft->localplayers[iPad]->isRidingJumpable()) {
|
||||
SetHorseJumpBarProgress(
|
||||
pMinecraft->localplayers[iPad]->getJumpRidingScale());
|
||||
} else if (pMinecraft->localgameModes[iPad]->hasExperience()) {
|
||||
// Update xp progress
|
||||
ShowExpBar(true);
|
||||
|
||||
SetExpBarProgress(
|
||||
pMinecraft->localplayers[iPad]->experienceProgress,
|
||||
pMinecraft->localplayers[iPad]->getXpNeededForNextLevel());
|
||||
|
||||
// Update xp level
|
||||
SetExpLevel(pMinecraft->localplayers[iPad]->experienceLevel);
|
||||
} else {
|
||||
ShowExpBar(false);
|
||||
SetExpLevel(0);
|
||||
}
|
||||
|
||||
if (m_uiSelectedItemOpacityCountDown > 0) {
|
||||
--m_uiSelectedItemOpacityCountDown;
|
||||
|
||||
// 4J Stu - Timing here is kept the same as on Xbox360, even though we
|
||||
// do it differently now and do the fade out in Flash rather than
|
||||
// directly setting opacity
|
||||
if (m_uiSelectedItemOpacityCountDown <
|
||||
(SharedConstants::TICKS_PER_SECOND * 1)) {
|
||||
HideSelectedLabel();
|
||||
m_uiSelectedItemOpacityCountDown = 0;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char ucAlpha = app.GetGameSettings(ProfileManager.GetPrimaryPad(),
|
||||
eGameSetting_InterfaceOpacity);
|
||||
float fVal;
|
||||
|
||||
if (ucAlpha < 80) {
|
||||
// if we are in a menu, set the minimum opacity for tooltips to 15%
|
||||
if (ui.GetMenuDisplayed(iPad) && (ucAlpha < 15)) {
|
||||
ucAlpha = 15;
|
||||
}
|
||||
|
||||
// check if we have the timer running for the opacity
|
||||
unsigned int uiOpacityTimer = app.GetOpacityTimer(iPad);
|
||||
if (uiOpacityTimer != 0) {
|
||||
if (uiOpacityTimer < 10) {
|
||||
float fStep = (80.0f - (float)ucAlpha) / 10.0f;
|
||||
fVal =
|
||||
0.01f * (80.0f - ((10.0f - (float)uiOpacityTimer) * fStep));
|
||||
} else {
|
||||
fVal = 0.01f * 80.0f;
|
||||
}
|
||||
} else {
|
||||
fVal = 0.01f * (float)ucAlpha;
|
||||
}
|
||||
} else {
|
||||
// if we are in a menu, set the minimum opacity for tooltips to 15%
|
||||
if (ui.GetMenuDisplayed(iPad) && (ucAlpha < 15)) {
|
||||
ucAlpha = 15;
|
||||
}
|
||||
fVal = 0.01f * (float)ucAlpha;
|
||||
}
|
||||
SetOpacity(fVal);
|
||||
|
||||
bool bDisplayGui = app.GetGameStarted() && !ui.GetMenuDisplayed(iPad) &&
|
||||
!(app.GetXuiAction(iPad) ==
|
||||
eAppAction_AutosaveSaveGameCapturedThumbnail) &&
|
||||
app.GetGameSettings(iPad, eGameSetting_DisplayHUD) != 0;
|
||||
if (bDisplayGui && pMinecraft->localplayers[iPad] != NULL) {
|
||||
SetVisible(true);
|
||||
} else {
|
||||
SetVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
void IUIScene_HUD::renderPlayerHealth() {
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
int iPad = getPad();
|
||||
|
||||
ShowHealth(true);
|
||||
|
||||
SetRegenerationEffect(
|
||||
pMinecraft->localplayers[iPad]->hasEffect(MobEffect::regeneration));
|
||||
|
||||
// Update health
|
||||
bool blink = pMinecraft->localplayers[iPad]->invulnerableTime / 3 % 2 == 1;
|
||||
if (pMinecraft->localplayers[iPad]->invulnerableTime < 10) blink = false;
|
||||
int currentHealth = pMinecraft->localplayers[iPad]->getHealth();
|
||||
int oldHealth = pMinecraft->localplayers[iPad]->lastHealth;
|
||||
bool bHasPoison =
|
||||
pMinecraft->localplayers[iPad]->hasEffect(MobEffect::poison);
|
||||
bool bHasWither =
|
||||
pMinecraft->localplayers[iPad]->hasEffect(MobEffect::wither);
|
||||
AttributeInstance* maxHealthAttribute =
|
||||
pMinecraft->localplayers[iPad]->getAttribute(
|
||||
SharedMonsterAttributes::MAX_HEALTH);
|
||||
float maxHealth = (float)maxHealthAttribute->getValue();
|
||||
float totalAbsorption =
|
||||
pMinecraft->localplayers[iPad]->getAbsorptionAmount();
|
||||
|
||||
// Update armour
|
||||
int armor = pMinecraft->localplayers[iPad]->getArmorValue();
|
||||
|
||||
SetHealth(currentHealth, oldHealth, blink, bHasPoison || bHasWither,
|
||||
bHasWither);
|
||||
SetHealthAbsorb(totalAbsorption);
|
||||
|
||||
if (armor > 0) {
|
||||
ShowArmour(true);
|
||||
SetArmour(armor);
|
||||
} else {
|
||||
ShowArmour(false);
|
||||
}
|
||||
|
||||
std::shared_ptr<Entity> riding = pMinecraft->localplayers[iPad]->riding;
|
||||
|
||||
if (riding == NULL || riding && !riding->instanceof(eTYPE_LIVINGENTITY)) {
|
||||
SetRidingHorse(false, false, 0);
|
||||
|
||||
ShowFood(true);
|
||||
ShowHorseHealth(false);
|
||||
m_horseHealth = 0;
|
||||
|
||||
// Update food
|
||||
// bool foodBlink = false;
|
||||
FoodData* foodData = pMinecraft->localplayers[iPad]->getFoodData();
|
||||
int food = foodData->getFoodLevel();
|
||||
int oldFood = foodData->getLastFoodLevel();
|
||||
bool hasHungerEffect =
|
||||
pMinecraft->localplayers[iPad]->hasEffect(MobEffect::hunger);
|
||||
int saturationLevel =
|
||||
pMinecraft->localplayers[iPad]->getFoodData()->getSaturationLevel();
|
||||
|
||||
SetFood(food, oldFood, hasHungerEffect);
|
||||
SetFoodSaturationLevel(saturationLevel);
|
||||
|
||||
// Update air
|
||||
if (pMinecraft->localplayers[iPad]->isUnderLiquid(Material::water)) {
|
||||
ShowAir(true);
|
||||
int count =
|
||||
(int)ceil((pMinecraft->localplayers[iPad]->getAirSupply() - 2) *
|
||||
10.0f / Player::TOTAL_AIR_SUPPLY);
|
||||
int extra =
|
||||
(int)ceil((pMinecraft->localplayers[iPad]->getAirSupply()) *
|
||||
10.0f / Player::TOTAL_AIR_SUPPLY) -
|
||||
count;
|
||||
SetAir(count, extra);
|
||||
} else {
|
||||
ShowAir(false);
|
||||
}
|
||||
} else if (riding->instanceof(eTYPE_LIVINGENTITY)) {
|
||||
std::shared_ptr<LivingEntity> living =
|
||||
std::dynamic_pointer_cast<LivingEntity>(riding);
|
||||
int riderCurrentHealth = (int)ceil(living->getHealth());
|
||||
float maxRiderHealth = living->getMaxHealth();
|
||||
|
||||
SetRidingHorse(true, pMinecraft->localplayers[iPad]->isRidingJumpable(),
|
||||
maxRiderHealth);
|
||||
SetHorseHealth(riderCurrentHealth);
|
||||
ShowHorseHealth(true);
|
||||
}
|
||||
}
|
||||
88
Minecraft.Client/Platform/Common/UI/IUIScene_HUD.h
Normal file
88
Minecraft.Client/Platform/Common/UI/IUIScene_HUD.h
Normal file
|
|
@ -0,0 +1,88 @@
|
|||
#pragma once
|
||||
|
||||
class IUIScene_HUD {
|
||||
protected:
|
||||
int m_lastActiveSlot;
|
||||
int m_iGuiScale;
|
||||
bool m_bToolTipsVisible;
|
||||
float m_lastExpProgress;
|
||||
int m_lastExpLevel;
|
||||
int m_iCurrentHealth;
|
||||
int m_lastMaxHealth;
|
||||
bool m_lastHealthBlink, m_lastHealthPoison, m_lastHealthWither;
|
||||
int m_iCurrentFood;
|
||||
bool m_lastFoodPoison;
|
||||
int m_lastAir, m_currentExtraAir;
|
||||
int m_lastArmour;
|
||||
float m_lastDragonHealth;
|
||||
bool m_showDragonHealth;
|
||||
int m_ticksWithNoBoss;
|
||||
bool m_lastShowDisplayName;
|
||||
int m_horseHealth;
|
||||
int m_iCurrentHealthAbsorb;
|
||||
float m_horseJumpProgress;
|
||||
int m_iHeartOffsetIndex;
|
||||
bool m_bHealthAbsorbActive;
|
||||
int m_iHorseMaxHealth;
|
||||
|
||||
bool m_showHealth, m_showHorseHealth, m_showFood, m_showAir, m_showArmour,
|
||||
m_showExpBar, m_bRidingHorse, m_bIsJumpable;
|
||||
bool m_bRegenEffectEnabled;
|
||||
int m_iFoodSaturation;
|
||||
|
||||
unsigned int m_uiSelectedItemOpacityCountDown;
|
||||
|
||||
std::wstring m_displayName;
|
||||
|
||||
IUIScene_HUD();
|
||||
|
||||
virtual int getPad() = 0;
|
||||
virtual void SetOpacity(float opacity) = 0;
|
||||
virtual void SetVisible(bool visible) = 0;
|
||||
|
||||
virtual void SetHudSize(int scale) = 0;
|
||||
virtual void SetExpBarProgress(float progress,
|
||||
int xpNeededForNextLevel) = 0;
|
||||
virtual void SetExpLevel(int level) = 0;
|
||||
virtual void SetActiveSlot(int slot) = 0;
|
||||
|
||||
virtual void SetHealth(int iHealth, int iLastHealth, bool bBlink,
|
||||
bool bPoison, bool bWither) = 0;
|
||||
virtual void SetFood(int iFood, int iLastFood, bool bPoison) = 0;
|
||||
virtual void SetAir(int iAir, int extra) = 0;
|
||||
virtual void SetArmour(int iArmour) = 0;
|
||||
|
||||
virtual void ShowHealth(bool show) = 0;
|
||||
virtual void ShowHorseHealth(bool show) = 0;
|
||||
virtual void ShowFood(bool show) = 0;
|
||||
virtual void ShowAir(bool show) = 0;
|
||||
virtual void ShowArmour(bool show) = 0;
|
||||
virtual void ShowExpBar(bool show) = 0;
|
||||
|
||||
virtual void SetRegenerationEffect(bool bEnabled) = 0;
|
||||
virtual void SetFoodSaturationLevel(int iSaturation) = 0;
|
||||
|
||||
virtual void SetDragonHealth(float health) = 0;
|
||||
virtual void SetDragonLabel(const std::wstring& label) = 0;
|
||||
virtual void ShowDragonHealth(bool show) = 0;
|
||||
|
||||
virtual void HideSelectedLabel() = 0;
|
||||
|
||||
virtual void SetDisplayName(const std::wstring& displayName) = 0;
|
||||
|
||||
virtual void SetTooltipsEnabled(bool bEnabled) = 0;
|
||||
|
||||
virtual void SetRidingHorse(bool ridingHorse, bool bIsJumpable,
|
||||
int maxHorseHealth) = 0;
|
||||
virtual void SetHorseHealth(int health, bool blink = false) = 0;
|
||||
virtual void SetHorseJumpBarProgress(float progress) = 0;
|
||||
|
||||
virtual void SetHealthAbsorb(int healthAbsorb) = 0;
|
||||
|
||||
virtual void SetSelectedLabel(const std::wstring& label) = 0;
|
||||
virtual void ShowDisplayName(bool show) = 0;
|
||||
|
||||
public:
|
||||
void updateFrameTick();
|
||||
void renderPlayerHealth();
|
||||
};
|
||||
69
Minecraft.Client/Platform/Common/UI/IUIScene_HopperMenu.cpp
Normal file
69
Minecraft.Client/Platform/Common/UI/IUIScene_HopperMenu.cpp
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
#include "../../stdafx.h"
|
||||
#include "IUIScene_HopperMenu.h"
|
||||
#include "../../../../Minecraft.World/Headers/net.minecraft.world.inventory.h"
|
||||
|
||||
IUIScene_AbstractContainerMenu::ESceneSection
|
||||
IUIScene_HopperMenu::GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY) {
|
||||
ESceneSection newSection = eSection;
|
||||
|
||||
int xOffset = 0;
|
||||
|
||||
// Find the new section if there is one
|
||||
switch (eSection) {
|
||||
case eSectionHopperContents:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionHopperInventory;
|
||||
xOffset = -2;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
xOffset = -2;
|
||||
newSection = eSectionHopperUsing;
|
||||
}
|
||||
break;
|
||||
case eSectionHopperInventory:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionHopperUsing;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
xOffset = 2;
|
||||
newSection = eSectionHopperContents;
|
||||
}
|
||||
break;
|
||||
case eSectionHopperUsing:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
xOffset = 2;
|
||||
newSection = eSectionHopperContents;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionHopperInventory;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX,
|
||||
piTargetY, xOffset);
|
||||
|
||||
return newSection;
|
||||
}
|
||||
|
||||
int IUIScene_HopperMenu::getSectionStartOffset(ESceneSection eSection) {
|
||||
int offset = 0;
|
||||
switch (eSection) {
|
||||
case eSectionHopperContents:
|
||||
offset = HopperMenu::CONTENTS_SLOT_START;
|
||||
break;
|
||||
case eSectionHopperInventory:
|
||||
offset = HopperMenu::INV_SLOT_START;
|
||||
break;
|
||||
case eSectionHopperUsing:
|
||||
offset = HopperMenu::USE_ROW_SLOT_START;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
14
Minecraft.Client/Platform/Common/UI/IUIScene_HopperMenu.h
Normal file
14
Minecraft.Client/Platform/Common/UI/IUIScene_HopperMenu.h
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include "IUIScene_AbstractContainerMenu.h"
|
||||
#include "../../../../Minecraft.World/Containers/Container.h"
|
||||
#include "../../../../Minecraft.World/Containers/Inventory.h"
|
||||
|
||||
class IUIScene_HopperMenu : public virtual IUIScene_AbstractContainerMenu {
|
||||
public:
|
||||
virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY);
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
};
|
||||
|
|
@ -0,0 +1,193 @@
|
|||
#include "../../stdafx.h"
|
||||
#include "IUIScene_HorseInventoryMenu.h"
|
||||
#include "../../../../Minecraft.World/Headers/net.minecraft.world.entity.animal.h"
|
||||
|
||||
IUIScene_AbstractContainerMenu::ESceneSection
|
||||
IUIScene_HorseInventoryMenu::GetSectionAndSlotInDirection(
|
||||
ESceneSection eSection, ETapState eTapDirection, int* piTargetX,
|
||||
int* piTargetY) {
|
||||
ESceneSection newSection = eSection;
|
||||
|
||||
int xOffset = 0;
|
||||
int yOffset = 0;
|
||||
|
||||
// Find the new section if there is one
|
||||
switch (eSection) {
|
||||
case eSectionHorseUsing:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
if (m_horse->isChestedHorse() && *piTargetX >= 4) {
|
||||
newSection = eSectionHorseChest;
|
||||
xOffset = 4;
|
||||
} else {
|
||||
newSection = eSectionHorseSaddle;
|
||||
}
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionHorseInventory;
|
||||
}
|
||||
break;
|
||||
case eSectionHorseInventory:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
newSection = eSectionHorseUsing;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
if (m_horse->isChestedHorse() && *piTargetX >= 4) {
|
||||
xOffset = 4;
|
||||
newSection = eSectionHorseChest;
|
||||
} else if (m_horse->canWearArmor()) {
|
||||
newSection = eSectionHorseArmor;
|
||||
} else {
|
||||
newSection = eSectionHorseSaddle;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case eSectionHorseChest:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
xOffset = -4;
|
||||
newSection = eSectionHorseInventory;
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
xOffset = -4;
|
||||
newSection = eSectionHorseUsing;
|
||||
} else if (eTapDirection == eTapStateLeft) {
|
||||
if (*piTargetX < 0) {
|
||||
if (m_horse->canWearArmor() && *piTargetY == 1) {
|
||||
newSection = eSectionHorseArmor;
|
||||
} else if (*piTargetY == 0) {
|
||||
newSection = eSectionHorseSaddle;
|
||||
}
|
||||
}
|
||||
} else if (eTapDirection == eTapStateRight) {
|
||||
if (*piTargetX >= getSectionColumns(eSectionHorseChest)) {
|
||||
if (m_horse->canWearArmor() && *piTargetY == 1) {
|
||||
newSection = eSectionHorseArmor;
|
||||
} else if (*piTargetY == 0) {
|
||||
newSection = eSectionHorseSaddle;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case eSectionHorseArmor:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
if (m_horse->isChestedHorse()) {
|
||||
newSection = eSectionHorseChest;
|
||||
} else {
|
||||
newSection = eSectionHorseInventory;
|
||||
}
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionHorseSaddle;
|
||||
} else if (eTapDirection == eTapStateRight) {
|
||||
if (m_horse->isChestedHorse()) {
|
||||
yOffset = -1;
|
||||
*piTargetX = 0;
|
||||
newSection = eSectionHorseChest;
|
||||
}
|
||||
} else if (eTapDirection == eTapStateLeft) {
|
||||
if (m_horse->isChestedHorse()) {
|
||||
yOffset = -1;
|
||||
*piTargetX = getSectionColumns(eSectionHorseChest);
|
||||
newSection = eSectionHorseChest;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case eSectionHorseSaddle:
|
||||
if (eTapDirection == eTapStateDown) {
|
||||
if (m_horse->canWearArmor()) {
|
||||
newSection = eSectionHorseArmor;
|
||||
} else {
|
||||
newSection = eSectionHorseInventory;
|
||||
}
|
||||
} else if (eTapDirection == eTapStateUp) {
|
||||
newSection = eSectionHorseUsing;
|
||||
} else if (eTapDirection == eTapStateRight) {
|
||||
if (m_horse->isChestedHorse()) {
|
||||
*piTargetX = 0;
|
||||
newSection = eSectionHorseChest;
|
||||
}
|
||||
} else if (eTapDirection == eTapStateLeft) {
|
||||
if (m_horse->isChestedHorse()) {
|
||||
*piTargetX = getSectionColumns(eSectionHorseChest);
|
||||
newSection = eSectionHorseChest;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX,
|
||||
piTargetY, xOffset, yOffset);
|
||||
|
||||
return newSection;
|
||||
}
|
||||
|
||||
// TODO: Offset will vary by type of horse, add in once horse menu and horse
|
||||
// entity are implemented
|
||||
int IUIScene_HorseInventoryMenu::getSectionStartOffset(ESceneSection eSection) {
|
||||
int offset = 0;
|
||||
switch (eSection) {
|
||||
case eSectionHorseSaddle:
|
||||
offset = EntityHorse::INV_SLOT_SADDLE;
|
||||
break;
|
||||
case eSectionHorseArmor:
|
||||
offset = EntityHorse::INV_SLOT_ARMOR;
|
||||
break;
|
||||
case eSectionHorseChest:
|
||||
offset = EntityHorse::INV_BASE_COUNT;
|
||||
break;
|
||||
case eSectionHorseInventory:
|
||||
offset = EntityHorse::INV_BASE_COUNT;
|
||||
if (m_horse->isChestedHorse()) {
|
||||
offset += EntityHorse::INV_DONKEY_CHEST_COUNT;
|
||||
}
|
||||
break;
|
||||
case eSectionHorseUsing:
|
||||
offset = EntityHorse::INV_BASE_COUNT + 27;
|
||||
if (m_horse->isChestedHorse()) {
|
||||
offset += EntityHorse::INV_DONKEY_CHEST_COUNT;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
return offset;
|
||||
}
|
||||
|
||||
bool IUIScene_HorseInventoryMenu::IsSectionSlotList(ESceneSection eSection) {
|
||||
switch (eSection) {
|
||||
case eSectionHorseChest:
|
||||
if (!m_horse->isChestedHorse())
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
case eSectionHorseArmor:
|
||||
if (!m_horse->canWearArmor())
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
case eSectionHorseSaddle:
|
||||
case eSectionHorseInventory:
|
||||
case eSectionHorseUsing:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IUIScene_HorseInventoryMenu::IsVisible(ESceneSection eSection) {
|
||||
switch (eSection) {
|
||||
case eSectionHorseChest:
|
||||
if (!m_horse->isChestedHorse())
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
case eSectionHorseArmor:
|
||||
if (!m_horse->canWearArmor())
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
case eSectionHorseSaddle:
|
||||
case eSectionHorseInventory:
|
||||
case eSectionHorseUsing:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
#pragma once
|
||||
|
||||
#include "IUIScene_AbstractContainerMenu.h"
|
||||
#include "../../../../Minecraft.World/Containers/Container.h"
|
||||
#include "../../../../Minecraft.World/Containers/Inventory.h"
|
||||
#include "../../../../Minecraft.World/Entities/Mobs/EntityHorse.h"
|
||||
|
||||
class IUIScene_HorseInventoryMenu
|
||||
: public virtual IUIScene_AbstractContainerMenu {
|
||||
protected:
|
||||
std::shared_ptr<Inventory> m_inventory;
|
||||
std::shared_ptr<Container> m_container;
|
||||
std::shared_ptr<EntityHorse> m_horse;
|
||||
|
||||
public:
|
||||
virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection,
|
||||
ETapState eTapDirection,
|
||||
int* piTargetX,
|
||||
int* piTargetY);
|
||||
int getSectionStartOffset(ESceneSection eSection);
|
||||
bool IsSectionSlotList(ESceneSection eSection);
|
||||
bool IsVisible(ESceneSection eSection);
|
||||
};
|
||||
|
|
@ -13,11 +13,16 @@
|
|||
|
||||
int IUIScene_PauseMenu::ExitGameDialogReturned(
|
||||
void* pParam, int iPad, C4JStorage::EMessageResult result) {
|
||||
IUIScene_PauseMenu* scene = (IUIScene_PauseMenu*)pParam;
|
||||
#ifdef _XBOX
|
||||
IUIScene_PauseMenu* pScene = (IUIScene_PauseMenu*)pParam;
|
||||
#else
|
||||
IUIScene_PauseMenu* pScene = dynamic_cast<IUIScene_PauseMenu*>(
|
||||
ui.GetSceneFromCallbackId((std::size_t)pParam));
|
||||
#endif
|
||||
|
||||
// Results switched for this dialog
|
||||
if (result == C4JStorage::EMessage_ResultDecline) {
|
||||
scene->SetIgnoreInput(true);
|
||||
if (pScene) pScene->SetIgnoreInput(true);
|
||||
app.SetAction(iPad, eAppAction_ExitWorld);
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -25,7 +30,12 @@ int IUIScene_PauseMenu::ExitGameDialogReturned(
|
|||
|
||||
int IUIScene_PauseMenu::ExitGameSaveDialogReturned(
|
||||
void* pParam, int iPad, C4JStorage::EMessageResult result) {
|
||||
IUIScene_PauseMenu* scene = (IUIScene_PauseMenu*)pParam;
|
||||
#ifdef _XBOX
|
||||
IUIScene_PauseMenu* pScene = (IUIScene_PauseMenu*)pParam;
|
||||
#else
|
||||
IUIScene_PauseMenu* pScene = dynamic_cast<IUIScene_PauseMenu*>(
|
||||
ui.GetSceneFromCallbackId((std::size_t)pParam));
|
||||
#endif
|
||||
|
||||
// Exit with or without saving
|
||||
// Decline means save in this dialog
|
||||
|
|
@ -67,12 +77,12 @@ int IUIScene_PauseMenu::ExitGameSaveDialogReturned(
|
|||
|
||||
// Give the player a warning about the trial version of the
|
||||
// texture pack
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE,
|
||||
IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2,
|
||||
ProfileManager.GetPrimaryPad(),
|
||||
&IUIScene_PauseMenu::WarningTrialTexturePackReturned,
|
||||
scene, app.GetStringTable(), NULL, 0, false);
|
||||
pParam);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
|
@ -88,11 +98,10 @@ int IUIScene_PauseMenu::ExitGameSaveDialogReturned(
|
|||
unsigned int uiIDA[2];
|
||||
uiIDA[0] = IDS_CONFIRM_CANCEL;
|
||||
uiIDA[1] = IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2,
|
||||
ProfileManager.GetPrimaryPad(),
|
||||
&IUIScene_PauseMenu::ExitGameAndSaveReturned, scene,
|
||||
app.GetStringTable(), NULL, 0, false);
|
||||
&IUIScene_PauseMenu::ExitGameAndSaveReturned, pParam);
|
||||
return 0;
|
||||
} else {
|
||||
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||
|
|
@ -105,15 +114,14 @@ int IUIScene_PauseMenu::ExitGameSaveDialogReturned(
|
|||
unsigned int uiIDA[2];
|
||||
uiIDA[0] = IDS_CONFIRM_CANCEL;
|
||||
uiIDA[1] = IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_TITLE_DECLINE_SAVE_GAME, IDS_CONFIRM_DECLINE_SAVE_GAME,
|
||||
uiIDA, 2, ProfileManager.GetPrimaryPad(),
|
||||
&IUIScene_PauseMenu::ExitGameDeclineSaveReturned, scene,
|
||||
app.GetStringTable(), NULL, 0, false);
|
||||
&IUIScene_PauseMenu::ExitGameDeclineSaveReturned, pParam);
|
||||
return 0;
|
||||
}
|
||||
|
||||
scene->SetIgnoreInput(true);
|
||||
if (pScene) pScene->SetIgnoreInput(true);
|
||||
|
||||
app.SetAction(iPad, eAppAction_ExitWorld);
|
||||
}
|
||||
|
|
@ -123,7 +131,12 @@ int IUIScene_PauseMenu::ExitGameSaveDialogReturned(
|
|||
int IUIScene_PauseMenu::ExitGameAndSaveReturned(
|
||||
void* pParam, int iPad, C4JStorage::EMessageResult result) {
|
||||
// 4J-PB - we won't come in here if we have a trial texture pack
|
||||
IUIScene_PauseMenu* scene = (IUIScene_PauseMenu*)pParam;
|
||||
#ifdef _XBOX
|
||||
IUIScene_PauseMenu* pScene = (IUIScene_PauseMenu*)pParam;
|
||||
#else
|
||||
IUIScene_PauseMenu* pScene = dynamic_cast<IUIScene_PauseMenu*>(
|
||||
ui.GetSceneFromCallbackId((std::size_t)pParam));
|
||||
#endif
|
||||
|
||||
// results switched for this dialog
|
||||
if (result == C4JStorage::EMessage_ResultDecline) {
|
||||
|
|
@ -135,7 +148,7 @@ int IUIScene_PauseMenu::ExitGameAndSaveReturned(
|
|||
#if defined(_XBOX_ONE) || defined(__ORBIS__)
|
||||
StorageManager.SetSaveDisabled(false);
|
||||
#endif
|
||||
scene->SetIgnoreInput(true);
|
||||
if (pScene) pScene->SetIgnoreInput(true);
|
||||
MinecraftServer::getInstance()->setSaveOnExit(true);
|
||||
// flag a app action of exit game
|
||||
app.SetAction(iPad, eAppAction_ExitWorld);
|
||||
|
|
@ -151,18 +164,16 @@ int IUIScene_PauseMenu::ExitGameAndSaveReturned(
|
|||
uiIDA[2] = IDS_EXIT_GAME_NO_SAVE;
|
||||
|
||||
if (g_NetworkManager.GetPlayerCount() > 1) {
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_EXIT_GAME,
|
||||
IDS_CONFIRM_EXIT_GAME_CONFIRM_DISCONNECT_SAVE, uiIDA, 3,
|
||||
ProfileManager.GetPrimaryPad(),
|
||||
&IUIScene_PauseMenu::ExitGameSaveDialogReturned, scene,
|
||||
app.GetStringTable(), NULL, 0, false);
|
||||
&IUIScene_PauseMenu::ExitGameSaveDialogReturned, pParam);
|
||||
} else {
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3,
|
||||
ProfileManager.GetPrimaryPad(),
|
||||
&IUIScene_PauseMenu::ExitGameSaveDialogReturned, scene,
|
||||
app.GetStringTable(), NULL, 0, false);
|
||||
&IUIScene_PauseMenu::ExitGameSaveDialogReturned, pParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -171,7 +182,12 @@ int IUIScene_PauseMenu::ExitGameAndSaveReturned(
|
|||
|
||||
int IUIScene_PauseMenu::ExitGameDeclineSaveReturned(
|
||||
void* pParam, int iPad, C4JStorage::EMessageResult result) {
|
||||
IUIScene_PauseMenu* scene = (IUIScene_PauseMenu*)pParam;
|
||||
#ifdef _XBOX
|
||||
IUIScene_PauseMenu* pScene = (IUIScene_PauseMenu*)pParam;
|
||||
#else
|
||||
IUIScene_PauseMenu* pScene = dynamic_cast<IUIScene_PauseMenu*>(
|
||||
ui.GetSceneFromCallbackId((std::size_t)pParam));
|
||||
#endif
|
||||
|
||||
// results switched for this dialog
|
||||
if (result == C4JStorage::EMessage_ResultDecline) {
|
||||
|
|
@ -180,7 +196,7 @@ int IUIScene_PauseMenu::ExitGameDeclineSaveReturned(
|
|||
// though it shouldn't!
|
||||
// StorageManager.SetSaveDisabled(false);
|
||||
#endif
|
||||
scene->SetIgnoreInput(true);
|
||||
if (pScene) pScene->SetIgnoreInput(true);
|
||||
MinecraftServer::getInstance()->setSaveOnExit(false);
|
||||
// flag a app action of exit game
|
||||
app.SetAction(iPad, eAppAction_ExitWorld);
|
||||
|
|
@ -196,18 +212,16 @@ int IUIScene_PauseMenu::ExitGameDeclineSaveReturned(
|
|||
uiIDA[2] = IDS_EXIT_GAME_NO_SAVE;
|
||||
|
||||
if (g_NetworkManager.GetPlayerCount() > 1) {
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_EXIT_GAME,
|
||||
IDS_CONFIRM_EXIT_GAME_CONFIRM_DISCONNECT_SAVE, uiIDA, 3,
|
||||
ProfileManager.GetPrimaryPad(),
|
||||
&IUIScene_PauseMenu::ExitGameSaveDialogReturned, scene,
|
||||
app.GetStringTable(), NULL, 0, false);
|
||||
&IUIScene_PauseMenu::ExitGameSaveDialogReturned, pParam);
|
||||
} else {
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3,
|
||||
ProfileManager.GetPrimaryPad(),
|
||||
&IUIScene_PauseMenu::ExitGameSaveDialogReturned, scene,
|
||||
app.GetStringTable(), NULL, 0, false);
|
||||
&IUIScene_PauseMenu::ExitGameSaveDialogReturned, pParam);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -229,9 +243,8 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(
|
|||
if (bContentRestricted) {
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(
|
||||
IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1,
|
||||
iPad, NULL, &app, app.GetStringTable(), NULL, 0, false);
|
||||
ui.RequestAlertMessage(IDS_ONLINE_SERVICE_TITLE,
|
||||
IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad);
|
||||
} else {
|
||||
// need to get info on the pack to see if the user has already
|
||||
// downloaded it
|
||||
|
|
@ -308,9 +321,9 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(
|
|||
// active network connection user is unable to convert from
|
||||
// Trial to Full texture pack and is not messaged why.
|
||||
unsigned int uiIDA[1] = {IDS_CONFIRM_OK};
|
||||
ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE,
|
||||
IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1,
|
||||
iPad, NULL, NULL, app.GetStringTable());
|
||||
ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE,
|
||||
IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1,
|
||||
iPad);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -531,9 +544,9 @@ void IUIScene_PauseMenu::_ExitWorld(void* lpParameter) {
|
|||
// display a message box. This will allow the message box requested
|
||||
// by the libraries to be brought up
|
||||
if (ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad()))
|
||||
ui.RequestMessageBox(exitReasonTitleId, exitReasonStringId,
|
||||
uiIDA, 1, ProfileManager.GetPrimaryPad(),
|
||||
NULL, NULL, app.GetStringTable());
|
||||
ui.RequestErrorMessage(exitReasonTitleId, exitReasonStringId,
|
||||
uiIDA, 1,
|
||||
ProfileManager.GetPrimaryPad());
|
||||
exitReasonStringId = -1;
|
||||
|
||||
// 4J - Force a disconnection, this handles the situation that the
|
||||
|
|
@ -640,9 +653,8 @@ void IUIScene_PauseMenu::_ExitWorld(void* lpParameter) {
|
|||
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(exitReasonTitleId, exitReasonStringId, uiIDA,
|
||||
1, ProfileManager.GetPrimaryPad(), NULL, NULL,
|
||||
app.GetStringTable());
|
||||
ui.RequestErrorMessage(exitReasonTitleId, exitReasonStringId, uiIDA,
|
||||
1, ProfileManager.GetPrimaryPad());
|
||||
exitReasonStringId = -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -691,10 +703,9 @@ int IUIScene_PauseMenu::SaveGameDialogReturned(
|
|||
unsigned int uiIDA[2];
|
||||
uiIDA[0] = IDS_CONFIRM_CANCEL;
|
||||
uiIDA[1] = IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(IDS_TITLE_ENABLE_AUTOSAVE,
|
||||
IDS_CONFIRM_ENABLE_AUTOSAVE, uiIDA, 2, iPad,
|
||||
&IUIScene_PauseMenu::EnableAutosaveDialogReturned,
|
||||
pParam, app.GetStringTable(), NULL, 0, false);
|
||||
ui.RequestAlertMessage(
|
||||
IDS_TITLE_ENABLE_AUTOSAVE, IDS_CONFIRM_ENABLE_AUTOSAVE, uiIDA, 2,
|
||||
iPad, &IUIScene_PauseMenu::EnableAutosaveDialogReturned, pParam);
|
||||
#else
|
||||
// flag a app action of save game
|
||||
app.SetAction(iPad, eAppAction_SaveGame);
|
||||
|
|
|
|||
|
|
@ -224,11 +224,10 @@ void IUIScene_StartGame::UpdateCurrentTexturePack(int iSlot) {
|
|||
uiIDA[2] = IDS_CONFIRM_CANCEL;
|
||||
|
||||
// Give the player a warning about the texture pack missing
|
||||
ui.RequestMessageBox(IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE,
|
||||
IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 3,
|
||||
ProfileManager.GetPrimaryPad(),
|
||||
& : TexturePackDialogReturned, this,
|
||||
app.GetStringTable());
|
||||
ui.RequestErrorMessage(IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE,
|
||||
IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 3,
|
||||
ProfileManager.GetPrimaryPad(),
|
||||
& : TexturePackDialogReturned, this);
|
||||
|
||||
// do set the texture pack id, and on the user pressing create world,
|
||||
// check they have it
|
||||
|
|
|
|||
|
|
@ -77,6 +77,12 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) {
|
|||
buyAMatches >= buyAItem->count) &&
|
||||
(buyBItem == NULL ||
|
||||
buyBMatches >= buyBItem->count)) {
|
||||
// 4J-JEV: Fix for PS4 #7111: [PATCH 1.12] Trading
|
||||
// Librarian villagers for multiple <20>Enchanted
|
||||
// Books<6B> will cause the title to crash.
|
||||
int actualShopItem =
|
||||
m_activeOffers.at(selectedShopItem).second;
|
||||
|
||||
m_merchant->notifyTrade(activeRecipe);
|
||||
|
||||
// Remove the items we are purchasing with
|
||||
|
|
@ -91,8 +97,6 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat) {
|
|||
}
|
||||
|
||||
// Send a packet to the server
|
||||
int actualShopItem =
|
||||
m_activeOffers.at(selectedShopItem).second;
|
||||
player->connection->send(
|
||||
std::shared_ptr<TradeItemPacket>(
|
||||
new TradeItemPacket(m_menu->containerId,
|
||||
|
|
@ -235,17 +239,16 @@ void IUIScene_TradingMenu::updateDisplay() {
|
|||
// 4J-PB - need to get the villager type here
|
||||
wsTemp = app.GetString(IDS_VILLAGER_OFFERS_ITEM);
|
||||
wsTemp = replaceAll(wsTemp, L"{*VILLAGER_TYPE*}",
|
||||
app.GetString(m_merchant->getDisplayName()));
|
||||
m_merchant->getDisplayName());
|
||||
int iPos = wsTemp.find(L"%s");
|
||||
wsTemp.replace(iPos, 2,
|
||||
activeRecipe->getSellItem()->getHoverName());
|
||||
|
||||
setTitle(wsTemp.c_str());
|
||||
|
||||
std::vector<std::wstring> unformattedStrings;
|
||||
std::wstring offerDescription = GetItemDescription(
|
||||
activeRecipe->getSellItem(), unformattedStrings);
|
||||
setOfferDescription(offerDescription, unformattedStrings);
|
||||
std::vector<HtmlString>* offerDescription =
|
||||
GetItemDescription(activeRecipe->getSellItem());
|
||||
setOfferDescription(offerDescription);
|
||||
|
||||
std::shared_ptr<ItemInstance> buyAItem =
|
||||
activeRecipe->getBuyAItem();
|
||||
|
|
@ -294,13 +297,15 @@ void IUIScene_TradingMenu::updateDisplay() {
|
|||
|
||||
if (canMake) iA = IDS_TOOLTIPS_TRADE;
|
||||
} else {
|
||||
setTitle(app.GetString(m_merchant->getDisplayName()));
|
||||
setTitle(m_merchant->getDisplayName());
|
||||
setRequest1Name(L"");
|
||||
setRequest2Name(L"");
|
||||
setRequest1RedBox(false);
|
||||
setRequest2RedBox(false);
|
||||
setRequest1Item(nullptr);
|
||||
setRequest2Item(nullptr);
|
||||
std::vector<HtmlString> offerDescription;
|
||||
setOfferDescription(&offerDescription);
|
||||
}
|
||||
|
||||
m_bHasUpdatedOnce = true;
|
||||
|
|
@ -345,25 +350,16 @@ void IUIScene_TradingMenu::setRequest2Item(std::shared_ptr<ItemInstance> item) {
|
|||
void IUIScene_TradingMenu::setTradeItem(int index,
|
||||
std::shared_ptr<ItemInstance> item) {}
|
||||
|
||||
std::wstring IUIScene_TradingMenu::GetItemDescription(
|
||||
std::shared_ptr<ItemInstance> item,
|
||||
std::vector<std::wstring>& unformattedStrings) {
|
||||
if (item == NULL) return L"";
|
||||
std::vector<HtmlString>* IUIScene_TradingMenu::GetItemDescription(
|
||||
std::shared_ptr<ItemInstance> item) {
|
||||
std::vector<HtmlString>* lines = item->getHoverText(nullptr, false);
|
||||
|
||||
std::wstring desc = L"";
|
||||
std::vector<std::wstring>* strings =
|
||||
item->getHoverTextOnly(nullptr, false, unformattedStrings);
|
||||
bool firstLine = true;
|
||||
for (AUTO_VAR(it, strings->begin()); it != strings->end(); ++it) {
|
||||
std::wstring thisString = *it;
|
||||
if (!firstLine) {
|
||||
desc.append(L"<br />");
|
||||
} else {
|
||||
firstLine = false;
|
||||
}
|
||||
desc.append(thisString);
|
||||
// Add rarity to first line
|
||||
if (lines->size() > 0) {
|
||||
lines->at(0).color = item->getRarity()->color;
|
||||
}
|
||||
strings->clear();
|
||||
delete strings;
|
||||
return desc;
|
||||
|
||||
return lines;
|
||||
}
|
||||
|
||||
void IUIScene_TradingMenu::HandleInventoryUpdated() { updateDisplay(); }
|
||||
|
|
@ -39,20 +39,20 @@ protected:
|
|||
virtual void setRequest2RedBox(bool show) = 0;
|
||||
virtual void setTradeRedBox(int index, bool show) = 0;
|
||||
|
||||
virtual void setOfferDescription(
|
||||
const std::wstring& name,
|
||||
std::vector<std::wstring>& unformattedStrings) = 0;
|
||||
virtual void setOfferDescription(std::vector<HtmlString>* description) = 0;
|
||||
|
||||
virtual void setRequest1Item(std::shared_ptr<ItemInstance> item);
|
||||
virtual void setRequest2Item(std::shared_ptr<ItemInstance> item);
|
||||
virtual void setTradeItem(int index, std::shared_ptr<ItemInstance> item);
|
||||
|
||||
private:
|
||||
void updateDisplay();
|
||||
void HandleInventoryUpdated();
|
||||
|
||||
private:
|
||||
bool canMake(MerchantRecipe* recipe);
|
||||
std::wstring GetItemDescription(
|
||||
std::shared_ptr<ItemInstance> item,
|
||||
std::vector<std::wstring>& unformattedStrings);
|
||||
|
||||
std::vector<HtmlString>* GetItemDescription(
|
||||
std::shared_ptr<ItemInstance> item);
|
||||
|
||||
public:
|
||||
std::shared_ptr<Merchant> getMerchant();
|
||||
|
|
|
|||
|
|
@ -31,10 +31,12 @@
|
|||
#include "UIControl_HTMLLabel.h"
|
||||
#include "UIControl_DynamicLabel.h"
|
||||
#include "UIControl_MinecraftPlayer.h"
|
||||
#include "UIControl_MinecraftHorse.h"
|
||||
#include "UIControl_PlayerSkinPreview.h"
|
||||
#include "UIControl_EnchantmentButton.h"
|
||||
#include "UIControl_EnchantmentBook.h"
|
||||
#include "UIControl_SpaceIndicatorBar.h"
|
||||
#include "UIControl_BeaconEffectButton.h"
|
||||
|
||||
#ifdef __PSVITA__
|
||||
#include "UIControl_Touch.h"
|
||||
|
|
@ -85,6 +87,7 @@
|
|||
#include "UIScene_SettingsUIMenu.h"
|
||||
#include "UIScene_SkinSelectMenu.h"
|
||||
#include "UIScene_HowToPlayMenu.h"
|
||||
#include "UIScene_LanguageSelector.h"
|
||||
#include "UIScene_HowToPlay.h"
|
||||
#include "UIScene_ControlsMenu.h"
|
||||
#include "UIScene_Credits.h"
|
||||
|
|
@ -101,6 +104,10 @@
|
|||
#include "UIScene_CreativeMenu.h"
|
||||
#include "UIScene_TradingMenu.h"
|
||||
#include "UIScene_AnvilMenu.h"
|
||||
#include "UIScene_HorseInventoryMenu.h"
|
||||
#include "UIScene_HopperMenu.h"
|
||||
#include "UIScene_BeaconMenu.h"
|
||||
#include "UIScene_FireworksMenu.h"
|
||||
|
||||
#include "UIScene_CraftingMenu.h"
|
||||
#include "UIScene_SignEntryMenu.h"
|
||||
|
|
@ -116,3 +123,4 @@
|
|||
#include "UIScene_TeleportMenu.h"
|
||||
#include "UIScene_EndPoem.h"
|
||||
#include "UIScene_EULA.h"
|
||||
#include "UIScene_NewUpdateMessage.h"
|
||||
|
|
@ -43,17 +43,19 @@ UIAbstractBitmapFont::UIAbstractBitmapFont(const std::string& fontname) {
|
|||
}
|
||||
|
||||
void UIAbstractBitmapFont::registerFont() {
|
||||
if (m_registered) {
|
||||
return;
|
||||
if (!m_registered) {
|
||||
// 4J-JEV: These only need registering the once when we first use this
|
||||
// font in Iggy.
|
||||
m_bitmapFontProvider->num_glyphs = m_numGlyphs;
|
||||
IggyFontInstallBitmapUTF8(m_bitmapFontProvider, m_fontname.c_str(), -1,
|
||||
IGGY_FONTFLAG_none);
|
||||
m_registered = true;
|
||||
}
|
||||
|
||||
m_bitmapFontProvider->num_glyphs = m_numGlyphs;
|
||||
|
||||
IggyFontInstallBitmapUTF8(m_bitmapFontProvider, m_fontname.c_str(), -1,
|
||||
IGGY_FONTFLAG_none);
|
||||
// 4J-JEV: Reset the font redirect to these fonts (we must do this everytime
|
||||
// in-case we switched away elsewhere).
|
||||
IggyFontSetIndirectUTF8(m_fontname.c_str(), -1, IGGY_FONTFLAG_all,
|
||||
m_fontname.c_str(), -1, IGGY_FONTFLAG_none);
|
||||
m_registered = true;
|
||||
}
|
||||
|
||||
IggyFontMetrics* RADLINK UIAbstractBitmapFont::GetFontMetrics_Callback(
|
||||
|
|
@ -110,15 +112,6 @@ UIBitmapFont::UIBitmapFont(SFontData& sfontdata)
|
|||
BufferedImage bimg(sfontdata.m_wstrFilename);
|
||||
int* bimgData = bimg.getData();
|
||||
|
||||
if (bimgData == nullptr) {
|
||||
fprintf(stderr,
|
||||
"[UIBitmapFont] ERROR: failed to load font image for '%s' is "
|
||||
"font included?\n",
|
||||
sfontdata.m_strFontName.c_str());
|
||||
m_cFontData = new CFontData(); // todo: make font work
|
||||
return;
|
||||
}
|
||||
|
||||
m_cFontData = new CFontData(sfontdata, bimgData);
|
||||
|
||||
// delete [] bimgData;
|
||||
|
|
@ -392,8 +385,8 @@ bitmap->pixel_scale_max = actualScale * glyphScaleMax * 1.001f; */
|
|||
}
|
||||
|
||||
// Callback function type for freeing a bitmap shape returned by GetGlyphBitmap
|
||||
void RADLINK UIBitmapFont::FreeGlyphBitmap(S32 glyph, F32 pixel_scale,
|
||||
IggyBitmapCharacter* bitmap) {
|
||||
void UIBitmapFont::FreeGlyphBitmap(S32 glyph, F32 pixel_scale,
|
||||
IggyBitmapCharacter* bitmap) {
|
||||
// We don't need to free anything,it just comes from the archive.
|
||||
// app.DebugPrintf("Free bitmap for glyph %d at scale
|
||||
// %f\n",glyph,pixel_scale);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@ void UIComponent_Panorama::tick() {
|
|||
// are we in the Nether? - Leave the time as 0 if we are, so we show
|
||||
// daylight
|
||||
if (pMinecraft->level->dimension->id == 0) {
|
||||
i64TimeOfDay = pMinecraft->level->getLevelData()->getTime() % 24000;
|
||||
i64TimeOfDay =
|
||||
pMinecraft->level->getLevelData()->getGameTime() % 24000;
|
||||
}
|
||||
|
||||
if (i64TimeOfDay > 14000) {
|
||||
|
|
|
|||
|
|
@ -22,20 +22,24 @@ UIComponent_PressStartToPlay::UIComponent_PressStartToPlay(int iPad,
|
|||
m_labelTrialTimer.init(L"");
|
||||
m_labelTrialTimer.setVisible(false);
|
||||
|
||||
// 4J-JEV: This object is persistent, so this string needs to be able to
|
||||
// handle language changes.
|
||||
#ifdef __ORBIS__
|
||||
std::wstring text = app.GetString(IDS_PRESS_X_TO_JOIN);
|
||||
text = replaceAll(text, L"{*CONTROLLER_VK_A*}",
|
||||
app.GetVKReplacement(VK_PAD_A));
|
||||
|
||||
m_labelPressStart.init(text.c_str());
|
||||
m_labelPressStart.init((UIString)[] {
|
||||
return replaceAll(app.GetString(IDS_PRESS_X_TO_JOIN),
|
||||
L"{*CONTROLLER_VK_A*}",
|
||||
app.GetVKReplacement(VK_PAD_A));
|
||||
});
|
||||
#elif defined _XBOX_ONE
|
||||
std::wstring text = app.GetString(IDS_PRESS_START_TO_JOIN);
|
||||
text = replaceAll(text, L"{*CONTROLLER_VK_START*}",
|
||||
app.GetVKReplacement(VK_PAD_START));
|
||||
m_labelPressStart.init(text.c_str());
|
||||
m_labelPressStart.init((UIString)[] {
|
||||
return replaceAll(app.GetString(IDS_PRESS_START_TO_JOIN),
|
||||
L"{*CONTROLLER_VK_START*}",
|
||||
app.GetVKReplacement(VK_PAD_START));
|
||||
});
|
||||
#else
|
||||
m_labelPressStart.init(app.GetString(IDS_PRESS_START_TO_JOIN));
|
||||
m_labelPressStart.init(IDS_PRESS_START_TO_JOIN);
|
||||
#endif
|
||||
|
||||
m_controlSaveIcon.setVisible(false);
|
||||
m_controlPressStartPanel.setVisible(false);
|
||||
m_playerDisplayName.setVisible(false);
|
||||
|
|
|
|||
|
|
@ -158,6 +158,18 @@ void UIComponent_Tooltips::tick() {
|
|||
fVal = 0.01f * (float)ucAlpha;
|
||||
}
|
||||
setOpacity(fVal);
|
||||
|
||||
bool layoutChanges = false;
|
||||
for (int i = 0; i < eToolTipNumButtons; i++) {
|
||||
if (!ui.IsReloadingSkin() && m_tooltipValues[i].show &&
|
||||
m_tooltipValues[i].label.needsUpdating()) {
|
||||
layoutChanges = true;
|
||||
_SetTooltip(i, m_tooltipValues[i].label, m_tooltipValues[i].show,
|
||||
true);
|
||||
m_tooltipValues[i].label.setUpdated();
|
||||
}
|
||||
}
|
||||
if (layoutChanges) _Relayout();
|
||||
}
|
||||
|
||||
void UIComponent_Tooltips::render(S32 width, S32 height,
|
||||
|
|
@ -247,7 +259,7 @@ void UIComponent_Tooltips::ShowTooltip(unsigned int tooltip, bool show) {
|
|||
|
||||
void UIComponent_Tooltips::SetTooltips(int iA, int iB, int iX, int iY, int iLT,
|
||||
int iRT, int iLB, int iRB, int iLS,
|
||||
bool forceUpdate) {
|
||||
int iRS, int iBack, bool forceUpdate) {
|
||||
bool needsRelayout = false;
|
||||
needsRelayout = _SetTooltip(eToolTipButtonA, iA) || needsRelayout;
|
||||
needsRelayout = _SetTooltip(eToolTipButtonB, iB) || needsRelayout;
|
||||
|
|
@ -258,7 +270,9 @@ void UIComponent_Tooltips::SetTooltips(int iA, int iB, int iX, int iY, int iLT,
|
|||
needsRelayout = _SetTooltip(eToolTipButtonLB, iLB) || needsRelayout;
|
||||
needsRelayout = _SetTooltip(eToolTipButtonRB, iRB) || needsRelayout;
|
||||
needsRelayout = _SetTooltip(eToolTipButtonLS, iLS) || needsRelayout;
|
||||
|
||||
needsRelayout = _SetTooltip(eToolTipButtonRS, iRS) || needsRelayout;
|
||||
needsRelayout = _SetTooltip(eToolTipButtonRS, iRS) || needsRelayout;
|
||||
needsRelayout = _SetTooltip(eToolTipButtonBack, iBack) || needsRelayout;
|
||||
if (needsRelayout) _Relayout();
|
||||
}
|
||||
|
||||
|
|
@ -271,7 +285,7 @@ bool UIComponent_Tooltips::_SetTooltip(unsigned int iToolTip, int iTextID) {
|
|||
m_tooltipValues[iToolTip].iString = iTextID;
|
||||
changed = true;
|
||||
if (iTextID > -1)
|
||||
_SetTooltip(iToolTip, app.GetString(iTextID), true);
|
||||
_SetTooltip(iToolTip, iTextID, true);
|
||||
else if (iTextID == -2)
|
||||
_SetTooltip(iToolTip, L"", true);
|
||||
else
|
||||
|
|
@ -280,13 +294,13 @@ bool UIComponent_Tooltips::_SetTooltip(unsigned int iToolTip, int iTextID) {
|
|||
return changed;
|
||||
}
|
||||
|
||||
void UIComponent_Tooltips::_SetTooltip(unsigned int iToolTipId,
|
||||
const std::wstring& label, bool show,
|
||||
bool force) {
|
||||
void UIComponent_Tooltips::_SetTooltip(unsigned int iToolTipId, UIString label,
|
||||
bool show, bool force) {
|
||||
if (!force && !show && !m_tooltipValues[iToolTipId].show) {
|
||||
return;
|
||||
}
|
||||
m_tooltipValues[iToolTipId].show = show;
|
||||
m_tooltipValues[iToolTipId].label = label;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
|
|
@ -308,7 +322,7 @@ void UIComponent_Tooltips::_SetTooltip(unsigned int iToolTipId,
|
|||
IggyPlayerRootPath(getMovie()),
|
||||
m_funcSetTooltip, 3, value);
|
||||
|
||||
app.DebugPrintf("Actual tooltip update!\n");
|
||||
// app.DebugPrintf("Actual tooltip update!\n");
|
||||
}
|
||||
|
||||
void UIComponent_Tooltips::_Relayout() {
|
||||
|
|
@ -330,18 +344,30 @@ void UIComponent_Tooltips::handleTouchInput(unsigned int iPad, S32 x, S32 y,
|
|||
// app.DebugPrintf("ToolTip Touch ID = %i\n", iId);
|
||||
bool handled = false;
|
||||
|
||||
// 4J - TomK no tooltips no touch!
|
||||
if ((!ui.GetMenuDisplayed(ProfileManager.GetPrimaryPad())) &&
|
||||
(app.GetGameSettings(ProfileManager.GetPrimaryPad(),
|
||||
eGameSetting_Tooltips) == 0))
|
||||
return;
|
||||
|
||||
// perform action on release
|
||||
if (bReleased) {
|
||||
switch (iId) {
|
||||
case ETouchInput_Touch_A:
|
||||
app.DebugPrintf("ToolTip Map Touch to _PSV_JOY_BUTTON_X\n",
|
||||
iId);
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_X);
|
||||
if (InputManager.IsCircleCrossSwapped())
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_O);
|
||||
else
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_X);
|
||||
break;
|
||||
case ETouchInput_Touch_B:
|
||||
app.DebugPrintf("ToolTip Map Touch to _PSV_JOY_BUTTON_O\n",
|
||||
iId);
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_O);
|
||||
if (InputManager.IsCircleCrossSwapped())
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_X);
|
||||
else
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_O);
|
||||
break;
|
||||
case ETouchInput_Touch_X:
|
||||
app.DebugPrintf("ToolTip Map Touch to _PSV_JOY_BUTTON_SQUARE\n",
|
||||
|
|
@ -358,9 +384,8 @@ void UIComponent_Tooltips::handleTouchInput(unsigned int iPad, S32 x, S32 y,
|
|||
app.DebugPrintf("ToolTip no action\n", iId);
|
||||
break;
|
||||
case ETouchInput_Touch_RightTrigger:
|
||||
app.DebugPrintf("ToolTip Map Touch to _PSV_JOY_BUTTON_SELECT\n",
|
||||
iId);
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_SELECT);
|
||||
app.DebugPrintf("ToolTip no action\n", iId);
|
||||
/* no action */
|
||||
break;
|
||||
case ETouchInput_Touch_LeftBumper:
|
||||
app.DebugPrintf("ToolTip Map Touch to _PSV_JOY_BUTTON_L1\n",
|
||||
|
|
@ -376,6 +401,16 @@ void UIComponent_Tooltips::handleTouchInput(unsigned int iPad, S32 x, S32 y,
|
|||
app.DebugPrintf("ToolTip no action\n", iId);
|
||||
/* no action */
|
||||
break;
|
||||
case ETouchInput_Touch_RightStick:
|
||||
app.DebugPrintf(
|
||||
"ToolTip Map Touch to _PSV_JOY_BUTTON_DPAD_DOWN\n", iId);
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_DPAD_DOWN);
|
||||
break;
|
||||
case ETouchInput_Touch_Select:
|
||||
app.DebugPrintf("ToolTip Map Touch to _PSV_JOY_BUTTON_SELECT\n",
|
||||
iId);
|
||||
InputManager.MapTouchInput(iPad, _PSV_JOY_BUTTON_SELECT);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -397,8 +432,8 @@ void UIComponent_Tooltips::handleReload() {
|
|||
#endif
|
||||
|
||||
for (unsigned int i = 0; i < eToolTipNumButtons; ++i) {
|
||||
_SetTooltip(i, app.GetString(m_tooltipValues[i].iString),
|
||||
m_tooltipValues[i].show, true);
|
||||
_SetTooltip(i, m_tooltipValues[i].iString, m_tooltipValues[i].show,
|
||||
true);
|
||||
}
|
||||
_Relayout();
|
||||
}
|
||||
|
|
@ -406,7 +441,7 @@ void UIComponent_Tooltips::handleReload() {
|
|||
void UIComponent_Tooltips::handleInput(int iPad, int key, bool repeat,
|
||||
bool pressed, bool released,
|
||||
bool& handled) {
|
||||
if (m_overrideSFX[iPad][key]) {
|
||||
if ((0 <= iPad) && (iPad <= 3) && m_overrideSFX[iPad][key]) {
|
||||
// don't play a sound for this action
|
||||
switch (key) {
|
||||
case ACTION_MENU_A:
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ protected:
|
|||
bool show;
|
||||
int iString;
|
||||
|
||||
UIString label;
|
||||
|
||||
_TooltipValues() {
|
||||
show = false;
|
||||
iString = -1;
|
||||
|
|
@ -33,6 +35,8 @@ protected:
|
|||
ETouchInput_Touch_LeftBumper,
|
||||
ETouchInput_Touch_RightBumper,
|
||||
ETouchInput_Touch_LeftStick,
|
||||
ETouchInput_Touch_RightStick,
|
||||
ETouchInput_Touch_Select,
|
||||
|
||||
ETouchInput_Count,
|
||||
};
|
||||
|
|
@ -54,6 +58,9 @@ protected:
|
|||
"Touch_RightBumper")
|
||||
UI_MAP_ELEMENT(m_TouchController[ETouchInput_Touch_LeftStick],
|
||||
"Touch_LeftStick")
|
||||
UI_MAP_ELEMENT(m_TouchController[ETouchInput_Touch_RightStick],
|
||||
"Touch_RightStick")
|
||||
UI_MAP_ELEMENT(m_TouchController[ETouchInput_Touch_Select], "Touch_Select")
|
||||
#endif
|
||||
UI_MAP_NAME(m_funcSetTooltip, L"SetToolTip")
|
||||
UI_MAP_NAME(m_funcSetOpacity, L"SetOpacity")
|
||||
|
|
@ -93,8 +100,8 @@ public:
|
|||
virtual void ShowTooltip(unsigned int tooltip, bool show);
|
||||
virtual void SetTooltips(int iA, int iB = -1, int iX = -1, int iY = -1,
|
||||
int iLT = -1, int iRT = -1, int iLB = -1,
|
||||
int iRB = -1, int iLS = -1,
|
||||
bool forceUpdate = false);
|
||||
int iRB = -1, int iLS = -1, int iRS = -1,
|
||||
int iBack = -1, bool forceUpdate = false);
|
||||
virtual void EnableTooltip(unsigned int tooltip, bool enable);
|
||||
|
||||
virtual void handleReload();
|
||||
|
|
@ -105,8 +112,8 @@ public:
|
|||
|
||||
private:
|
||||
bool _SetTooltip(unsigned int iToolTip, int iTextID);
|
||||
void _SetTooltip(unsigned int iToolTipId, const std::wstring& label,
|
||||
bool show, bool force = false);
|
||||
void _SetTooltip(unsigned int iToolTipId, UIString label, bool show,
|
||||
bool force = false);
|
||||
void _Relayout();
|
||||
|
||||
bool m_overrideSFX[XUSER_MAX_COUNT][ACTION_MAX_MENU];
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ UIComponent_TutorialPopup::UIComponent_TutorialPopup(int iPad, void* initData,
|
|||
|
||||
m_bContainerMenuVisible = false;
|
||||
m_bSplitscreenGamertagVisible = false;
|
||||
m_iconType = e_ICON_TYPE_IGGY;
|
||||
|
||||
m_labelDescription.init(L"");
|
||||
|
||||
|
|
@ -76,6 +77,8 @@ void UIComponent_TutorialPopup::handleReload() {
|
|||
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result,
|
||||
IggyPlayerRootPath(getMovie()),
|
||||
m_funcAdjustLayout, 1, value);
|
||||
|
||||
setupIconHolder(m_iconType);
|
||||
}
|
||||
|
||||
void UIComponent_TutorialPopup::SetTutorialDescription(
|
||||
|
|
@ -327,7 +330,7 @@ std::wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal,
|
|||
setupIconHolder(e_ICON_TYPE_TOOLS);
|
||||
} else if (temp.find(L"{*StoneIcon*}") != std::wstring::npos) {
|
||||
m_iconItem = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Tile::rock_Id, 1, 0));
|
||||
new ItemInstance(Tile::stone_Id, 1, 0));
|
||||
} else {
|
||||
m_iconItem = nullptr;
|
||||
}
|
||||
|
|
@ -437,6 +440,8 @@ void UIComponent_TutorialPopup::UpdateInteractScenePosition(bool visible) {
|
|||
(m_interactScene->getSceneType() == eUIScene_Crafting3x3Menu);
|
||||
bool isCreativeScene =
|
||||
(m_interactScene->getSceneType() == eUIScene_CreativeMenu);
|
||||
bool isTradingScene =
|
||||
(m_interactScene->getSceneType() == eUIScene_TradingMenu);
|
||||
switch (Minecraft::GetInstance()->localplayers[m_iPad]->m_iScreenSection) {
|
||||
case C4JRender::VIEWPORT_TYPE_FULLSCREEN:
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
|
|
@ -446,7 +451,7 @@ void UIComponent_TutorialPopup::UpdateInteractScenePosition(bool visible) {
|
|||
default:
|
||||
// anim allowed for everything except the crafting 2x2 and 3x3, and
|
||||
// the creative menu
|
||||
if (!isCraftingScene && !isCreativeScene) {
|
||||
if (!isCraftingScene && !isCreativeScene && !isTradingScene) {
|
||||
bAllowAnim = true;
|
||||
}
|
||||
break;
|
||||
|
|
@ -543,4 +548,6 @@ void UIComponent_TutorialPopup::setupIconHolder(EIcons icon) {
|
|||
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result,
|
||||
IggyPlayerRootPath(getMovie()),
|
||||
m_funcSetupIconHolder, 1, value);
|
||||
|
||||
m_iconType = icon;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ private:
|
|||
e_ICON_TYPE_TRANSPORT = 11,
|
||||
};
|
||||
|
||||
EIcons m_iconType;
|
||||
|
||||
public:
|
||||
UIComponent_TutorialPopup(int iPad, void* initData, UILayer* parentLayer);
|
||||
|
||||
|
|
@ -96,8 +98,7 @@ private:
|
|||
void _SetDescription(UIScene* interactScene, const std::wstring& desc,
|
||||
const std::wstring& title, bool allowFade,
|
||||
bool isReminder);
|
||||
std::wstring _SetIcon(int icon, int iAuxVal, bool isFoil,
|
||||
const wchar_t* desc);
|
||||
std::wstring _SetIcon(int icon, int iAuxVal, bool isFoil, LPCWSTR desc);
|
||||
std::wstring _SetImage(std::wstring& desc);
|
||||
std::wstring ParseDescription(int iPad, std::wstring& text);
|
||||
void UpdateInteractScenePosition(bool visible);
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ public:
|
|||
eLabel,
|
||||
eLeaderboardList,
|
||||
eMinecraftPlayer,
|
||||
eMinecraftHorse,
|
||||
ePlayerList,
|
||||
ePlayerSkinPreview,
|
||||
eProgress,
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
UIControl_Base::UIControl_Base() {
|
||||
m_bLabelChanged = false;
|
||||
m_label = L"";
|
||||
m_label;
|
||||
m_id = 0;
|
||||
}
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ bool UIControl_Base::setupControl(UIScene* scene, IggyValuePath* parent,
|
|||
void UIControl_Base::tick() {
|
||||
UIControl::tick();
|
||||
|
||||
if (m_bLabelChanged) {
|
||||
if (m_label.needsUpdating() || m_bLabelChanged) {
|
||||
// app.DebugPrintf("Calling SetLabel - '%ls'\n", m_label.c_str());
|
||||
m_bLabelChanged = false;
|
||||
|
||||
|
|
@ -43,11 +43,12 @@ void UIControl_Base::tick() {
|
|||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(),
|
||||
&result, getIggyValuePath(),
|
||||
m_setLabelFunc, 1, value);
|
||||
|
||||
m_label.setUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl_Base::setLabel(const std::wstring& label, bool instant,
|
||||
bool force) {
|
||||
void UIControl_Base::setLabel(UIString label, bool instant, bool force) {
|
||||
if (force ||
|
||||
((!m_label.empty() || !label.empty()) && m_label.compare(label) != 0))
|
||||
m_bLabelChanged = true;
|
||||
|
|
@ -73,11 +74,6 @@ void UIControl_Base::setLabel(const std::wstring& label, bool instant,
|
|||
}
|
||||
}
|
||||
|
||||
void UIControl_Base::setLabel(const std::string& label) {
|
||||
std::wstring wlabel = convStringToWstring(label);
|
||||
setLabel(wlabel);
|
||||
}
|
||||
|
||||
const wchar_t* UIControl_Base::getLabel() {
|
||||
IggyDataValue result;
|
||||
IggyResult out =
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "UIControl.h"
|
||||
#include "UIString.h"
|
||||
|
||||
// This class maps to the FJ_Base class in actionscript
|
||||
class UIControl_Base : public UIControl {
|
||||
|
|
@ -11,7 +12,7 @@ protected:
|
|||
IggyName m_funcCheckLabelWidths;
|
||||
|
||||
bool m_bLabelChanged;
|
||||
std::wstring m_label;
|
||||
UIString m_label;
|
||||
|
||||
public:
|
||||
UIControl_Base();
|
||||
|
|
@ -21,9 +22,12 @@ public:
|
|||
|
||||
virtual void tick();
|
||||
|
||||
virtual void setLabel(const std::wstring& label, bool instant = false,
|
||||
virtual void setLabel(UIString label, bool instant = false,
|
||||
bool force = false);
|
||||
virtual void setLabel(const std::string& label);
|
||||
// virtual void setLabel(std::wstring label, bool instant = false, bool
|
||||
// force = false) { this->setLabel(UIString::CONSTANT(label), instant,
|
||||
// force); }
|
||||
|
||||
const wchar_t* getLabel();
|
||||
virtual void setAllPossibleLabels(int labelCount, wchar_t labels[][256]);
|
||||
int getId() { return m_id; }
|
||||
|
|
|
|||
|
|
@ -0,0 +1,101 @@
|
|||
#include "../../stdafx.h"
|
||||
#include "UI.h"
|
||||
#include "UIControl_BeaconEffectButton.h"
|
||||
|
||||
UIControl_BeaconEffectButton::UIControl_BeaconEffectButton() {
|
||||
m_data = 0;
|
||||
m_icon = 0;
|
||||
m_selected = false;
|
||||
m_active = false;
|
||||
m_focus = false;
|
||||
}
|
||||
|
||||
bool UIControl_BeaconEffectButton::setupControl(
|
||||
UIScene* scene, IggyValuePath* parent, const std::string& controlName) {
|
||||
bool success = UIControl::setupControl(scene, parent, controlName);
|
||||
|
||||
m_funcChangeState = registerFastName(L"ChangeState");
|
||||
m_funcSetIcon = registerFastName(L"SetIcon");
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
void UIControl_BeaconEffectButton::SetData(int data, int icon, bool active,
|
||||
bool selected) {
|
||||
m_data = data;
|
||||
m_active = active;
|
||||
m_selected = selected;
|
||||
|
||||
SetIcon(icon);
|
||||
UpdateButtonState();
|
||||
}
|
||||
|
||||
int UIControl_BeaconEffectButton::GetData() { return m_data; }
|
||||
|
||||
void UIControl_BeaconEffectButton::SetButtonSelected(bool selected) {
|
||||
if (selected != m_selected) {
|
||||
m_selected = selected;
|
||||
|
||||
UpdateButtonState();
|
||||
}
|
||||
}
|
||||
|
||||
bool UIControl_BeaconEffectButton::IsButtonSelected() { return m_selected; }
|
||||
|
||||
void UIControl_BeaconEffectButton::SetButtonActive(bool active) {
|
||||
if (m_active != active) {
|
||||
m_active = active;
|
||||
|
||||
UpdateButtonState();
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl_BeaconEffectButton::setFocus(bool focus) {
|
||||
if (m_focus != focus) {
|
||||
m_focus = focus;
|
||||
|
||||
UpdateButtonState();
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl_BeaconEffectButton::SetIcon(int icon) {
|
||||
if (icon != m_icon) {
|
||||
m_icon = icon;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = m_icon;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_funcSetIcon, 1, value);
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl_BeaconEffectButton::UpdateButtonState() {
|
||||
EState state = eState_Disabled;
|
||||
|
||||
if (!m_active) {
|
||||
state = eState_Disabled;
|
||||
} else if (m_selected) {
|
||||
state = eState_Pressed;
|
||||
} else if (m_focus) {
|
||||
state = eState_Enabled_Selected;
|
||||
} else {
|
||||
state = eState_Enabled_Unselected;
|
||||
}
|
||||
|
||||
if (state != m_lastState) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = state;
|
||||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(),
|
||||
&result, getIggyValuePath(),
|
||||
m_funcChangeState, 1, value);
|
||||
|
||||
if (out == IGGY_RESULT_SUCCESS) m_lastState = state;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
#pragma once
|
||||
|
||||
#include "UIControl.h"
|
||||
|
||||
class UIControl_BeaconEffectButton : public UIControl {
|
||||
private:
|
||||
static const int BUTTON_DISABLED = 0;
|
||||
static const int BUTTON_ENABLED_UNSELECTED = 1;
|
||||
static const int BUTTON_ENABLED_SELECTED = 2;
|
||||
static const int BUTTON_PRESSED = 3;
|
||||
|
||||
enum EState {
|
||||
eState_Disabled,
|
||||
eState_Enabled_Unselected,
|
||||
eState_Enabled_Selected,
|
||||
eState_Pressed
|
||||
};
|
||||
EState m_lastState;
|
||||
|
||||
int m_data;
|
||||
int m_icon;
|
||||
bool m_selected;
|
||||
bool m_active;
|
||||
bool m_focus;
|
||||
|
||||
IggyName m_funcChangeState, m_funcSetIcon;
|
||||
|
||||
public:
|
||||
UIControl_BeaconEffectButton();
|
||||
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void SetData(int data, int icon, bool active, bool selected);
|
||||
int GetData();
|
||||
|
||||
void SetButtonSelected(bool selected);
|
||||
bool IsButtonSelected();
|
||||
|
||||
void SetButtonActive(bool active);
|
||||
|
||||
virtual void setFocus(bool focus);
|
||||
|
||||
void SetIcon(int icon);
|
||||
|
||||
private:
|
||||
void UpdateButtonState();
|
||||
};
|
||||
|
|
@ -15,7 +15,7 @@ bool UIControl_Button::setupControl(UIScene* scene, IggyValuePath* parent,
|
|||
return success;
|
||||
}
|
||||
|
||||
void UIControl_Button::init(const std::wstring& label, int id) {
|
||||
void UIControl_Button::init(UIString label, int id) {
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,10 @@ public:
|
|||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void init(const std::wstring& label, int id);
|
||||
void init(UIString label, int id);
|
||||
// void init(const std::wstring &label, int id) {
|
||||
// init(UIString::CONSTANT(label), id); }
|
||||
|
||||
virtual void ReInit();
|
||||
|
||||
void setEnable(bool enable);
|
||||
|
|
|
|||
|
|
@ -199,3 +199,37 @@ bool UIControl_ButtonList::CanTouchTrigger(S32 iX, S32 iY) {
|
|||
return bCanTouchTrigger;
|
||||
}
|
||||
#endif
|
||||
|
||||
void UIControl_DynamicButtonList::tick() {
|
||||
UIControl_ButtonList::tick();
|
||||
|
||||
int buttonIndex = 0;
|
||||
std::vector<UIString>::iterator itr;
|
||||
for (itr = m_labels.begin(); itr != m_labels.end(); itr++) {
|
||||
if (itr->needsUpdating()) {
|
||||
setButtonLabel(buttonIndex, itr->getString());
|
||||
itr->setUpdated();
|
||||
}
|
||||
buttonIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
void UIControl_DynamicButtonList::addItem(UIString label, int data) {
|
||||
if (data < 0) data = m_itemCount;
|
||||
|
||||
if (data < m_labels.size()) {
|
||||
m_labels[data] = label;
|
||||
} else {
|
||||
while (data > m_labels.size()) {
|
||||
m_labels.push_back(UIString());
|
||||
}
|
||||
m_labels.push_back(label);
|
||||
}
|
||||
|
||||
UIControl_ButtonList::addItem(label.getString(), data);
|
||||
}
|
||||
|
||||
void UIControl_DynamicButtonList::removeItem(int index) {
|
||||
m_labels.erase(m_labels.begin() + index);
|
||||
UIControl_ButtonList::removeItem(index);
|
||||
}
|
||||
|
|
@ -44,3 +44,15 @@ public:
|
|||
bool CanTouchTrigger(S32 iX, S32 iY);
|
||||
#endif
|
||||
};
|
||||
|
||||
class UIControl_DynamicButtonList : public UIControl_ButtonList {
|
||||
protected:
|
||||
std::vector<UIString> m_labels;
|
||||
|
||||
public:
|
||||
virtual void tick();
|
||||
|
||||
virtual void addItem(UIString label, int data = -1);
|
||||
|
||||
virtual void removeItem(int index);
|
||||
};
|
||||
|
|
@ -14,7 +14,7 @@ public:
|
|||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void init(const std::wstring& label, int id, bool checked);
|
||||
void init(UIString label, int id, bool checked);
|
||||
|
||||
bool IsChecked();
|
||||
bool IsEnabled();
|
||||
|
|
|
|||
|
|
@ -32,9 +32,7 @@ void UIControl_EnchantmentBook::render(IggyCustomDrawCallbackRegion* region) {
|
|||
glTranslatef(m_width / 2, m_height / 2, 50.0f);
|
||||
|
||||
// Add a uniform scale
|
||||
glScalef(1 / ssX, 1 / ssX, 1.0f);
|
||||
|
||||
glScalef(50.0f, 50.0f, 1.0f);
|
||||
glScalef(-57 / ssX, 57 / ssX, 360.0f);
|
||||
|
||||
glRotatef(45 + 90, 0, 1, 0);
|
||||
Lighting::turnOn();
|
||||
|
|
|
|||
|
|
@ -36,6 +36,15 @@ bool UIControl_EnchantmentButton::setupControl(UIScene* scene,
|
|||
|
||||
void UIControl_EnchantmentButton::init(int index) { m_index = index; }
|
||||
|
||||
void UIControl_EnchantmentButton::ReInit() {
|
||||
UIControl_Button::ReInit();
|
||||
|
||||
m_lastState = eState_Inactive;
|
||||
m_lastCost = 0;
|
||||
m_bHasFocus = false;
|
||||
updateState();
|
||||
}
|
||||
|
||||
void UIControl_EnchantmentButton::tick() {
|
||||
updateState();
|
||||
UIControl_Button::tick();
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public:
|
|||
virtual void tick();
|
||||
|
||||
void init(int index);
|
||||
|
||||
virtual void ReInit();
|
||||
void render(IggyCustomDrawCallbackRegion* region);
|
||||
|
||||
void updateState();
|
||||
|
|
|
|||
|
|
@ -15,35 +15,17 @@ bool UIControl_Label::setupControl(UIScene* scene, IggyValuePath* parent,
|
|||
return success;
|
||||
}
|
||||
|
||||
void UIControl_Label::init(const std::wstring& label) {
|
||||
void UIControl_Label::init(UIString label) {
|
||||
m_label = label;
|
||||
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
value[0].string16 = stringVal;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_initFunc, 1, value);
|
||||
}
|
||||
|
||||
void UIControl_Label::init(const std::string& label) {
|
||||
m_label = convStringToWstring(label);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF8;
|
||||
IggyStringUTF8 stringVal;
|
||||
|
||||
stringVal.string = (char*)label.c_str();
|
||||
stringVal.string = (IggyUTF16*)label.c_str();
|
||||
stringVal.length = label.length();
|
||||
value[0].string8 = stringVal;
|
||||
value[0].string16 = stringVal;
|
||||
IggyResult out =
|
||||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_initFunc, 1, value);
|
||||
|
|
@ -51,5 +33,9 @@ void UIControl_Label::init(const std::string& label) {
|
|||
|
||||
void UIControl_Label::ReInit() {
|
||||
UIControl_Base::ReInit();
|
||||
init(m_label);
|
||||
|
||||
// 4J-JEV: This can't be reinitialised.
|
||||
if (m_reinitEnabled) {
|
||||
init(m_label);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,17 @@
|
|||
#include "UIControl_Base.h"
|
||||
|
||||
class UIControl_Label : public UIControl_Base {
|
||||
private:
|
||||
bool m_reinitEnabled;
|
||||
|
||||
public:
|
||||
UIControl_Label();
|
||||
|
||||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void init(const std::wstring& label);
|
||||
void init(const std::string& label);
|
||||
void init(UIString label);
|
||||
virtual void ReInit();
|
||||
|
||||
void disableReinitialisation() { m_reinitEnabled = false; }
|
||||
};
|
||||
108
Minecraft.Client/Platform/Common/UI/UIControl_MinecraftHorse.cpp
Normal file
108
Minecraft.Client/Platform/Common/UI/UIControl_MinecraftHorse.cpp
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
#include "../../stdafx.h"
|
||||
#include "../../Minecraft.h"
|
||||
#include "../../ScreenSizeCalculator.h"
|
||||
#include "../../EntityRenderDispatcher.h"
|
||||
|
||||
#include "../../PlayerRenderer.h"
|
||||
#include "../../HorseRenderer.h"
|
||||
|
||||
#include "../../HumanoidModel.h"
|
||||
#include "../../ModelHorse.h"
|
||||
|
||||
#include "../../Lighting.h"
|
||||
#include "../../ModelPart.h"
|
||||
#include "../../Options.h"
|
||||
|
||||
#include "../../../../Minecraft.World/Headers/net.minecraft.world.entity.player.h"
|
||||
// #include
|
||||
// "../../../Minecraft.World/net.minecraft.world.entity.animal.EntityHorse.h"
|
||||
|
||||
#include "../../MultiPlayerLocalPlayer.h"
|
||||
#include "UI.h"
|
||||
#include "UIControl_MinecraftHorse.h"
|
||||
|
||||
UIControl_MinecraftHorse::UIControl_MinecraftHorse() {
|
||||
UIControl::setControlType(UIControl::eMinecraftHorse);
|
||||
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
|
||||
ScreenSizeCalculator ssc(pMinecraft->options, pMinecraft->width_phys,
|
||||
pMinecraft->height_phys);
|
||||
m_fScreenWidth = (float)pMinecraft->width_phys;
|
||||
m_fRawWidth = (float)ssc.rawWidth;
|
||||
m_fScreenHeight = (float)pMinecraft->height_phys;
|
||||
m_fRawHeight = (float)ssc.rawHeight;
|
||||
}
|
||||
|
||||
void UIControl_MinecraftHorse::render(IggyCustomDrawCallbackRegion* region) {
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
glEnable(GL_RESCALE_NORMAL);
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
glPushMatrix();
|
||||
|
||||
float width = region->x1 - region->x0;
|
||||
float height = region->y1 - region->y0;
|
||||
float xo = width / 2;
|
||||
float yo = height;
|
||||
|
||||
// dynamic y offset according to region height
|
||||
glTranslatef(xo, yo - (height / 7.5f), 50.0f);
|
||||
|
||||
// UIScene_InventoryMenu *containerMenu = (UIScene_InventoryMenu
|
||||
// *)m_parentScene;
|
||||
UIScene_HorseInventoryMenu* containerMenu =
|
||||
(UIScene_HorseInventoryMenu*)m_parentScene;
|
||||
|
||||
std::shared_ptr<LivingEntity> entityHorse = containerMenu->m_horse;
|
||||
|
||||
// Base scale on height of this control
|
||||
// Potentially we might want separate x & y scales here
|
||||
float ss = width / (m_fScreenWidth / m_fScreenHeight) * 0.71f;
|
||||
|
||||
glScalef(-ss, ss, ss);
|
||||
glRotatef(180, 0, 0, 1);
|
||||
|
||||
float oybr = entityHorse->yBodyRot;
|
||||
float oyr = entityHorse->yRot;
|
||||
float oxr = entityHorse->xRot;
|
||||
float oyhr = entityHorse->yHeadRot;
|
||||
|
||||
// float xd = ( matrix._41 + ( (bwidth*matrix._11)/2) ) - m_pointerPos.x;
|
||||
float xd = (m_x + m_width / 2) - containerMenu->m_pointerPos.x;
|
||||
|
||||
// Need to base Y on head position, not centre of mass
|
||||
// float yd = ( matrix._42 + ( (bheight*matrix._22) / 2) - 40 ) -
|
||||
// m_pointerPos.y;
|
||||
float yd = (m_y + m_height / 2 - 40) - containerMenu->m_pointerPos.y;
|
||||
|
||||
glRotatef(45 + 90, 0, 1, 0);
|
||||
Lighting::turnOn();
|
||||
glRotatef(-45 - 90, 0, 1, 0);
|
||||
|
||||
glRotatef(-(float)atan(yd / 40.0f) * 20, 1, 0, 0);
|
||||
|
||||
entityHorse->yBodyRot = (float)atan(xd / 40.0f) * 20;
|
||||
entityHorse->yRot = (float)atan(xd / 40.0f) * 40;
|
||||
entityHorse->xRot = -(float)atan(yd / 40.0f) * 20;
|
||||
entityHorse->yHeadRot = entityHorse->yRot;
|
||||
// entityHorse->glow = 1;
|
||||
glTranslatef(0, entityHorse->heightOffset, 0);
|
||||
EntityRenderDispatcher::instance->playerRotY = 180;
|
||||
|
||||
// 4J Stu - Turning on hideGui while we do this stops the name rendering in
|
||||
// split-screen
|
||||
bool wasHidingGui = pMinecraft->options->hideGui;
|
||||
pMinecraft->options->hideGui = true;
|
||||
EntityRenderDispatcher::instance->render(entityHorse, 0, 0, 0, 0, 1, false,
|
||||
false);
|
||||
pMinecraft->options->hideGui = wasHidingGui;
|
||||
// entityHorse->glow = 0;
|
||||
|
||||
entityHorse->yBodyRot = oybr;
|
||||
entityHorse->yRot = oyr;
|
||||
entityHorse->xRot = oxr;
|
||||
entityHorse->yHeadRot = oyhr;
|
||||
glPopMatrix();
|
||||
Lighting::turnOff();
|
||||
glDisable(GL_RESCALE_NORMAL);
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include "UIControl.h"
|
||||
|
||||
class UIControl_MinecraftHorse : public UIControl {
|
||||
private:
|
||||
float m_fScreenWidth, m_fScreenHeight;
|
||||
float m_fRawWidth, m_fRawHeight;
|
||||
|
||||
public:
|
||||
UIControl_MinecraftHorse();
|
||||
|
||||
void render(IggyCustomDrawCallbackRegion* region);
|
||||
};
|
||||
|
|
@ -36,7 +36,8 @@ void UIControl_MinecraftPlayer::render(IggyCustomDrawCallbackRegion* region) {
|
|||
float xo = width / 2;
|
||||
float yo = height;
|
||||
|
||||
glTranslatef(xo, yo - 7.0f, 50.0f);
|
||||
// dynamic y offset according to region height
|
||||
glTranslatef(xo, yo - (height / 9.0f), 50.0f);
|
||||
|
||||
float ss;
|
||||
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion* region) {
|
|||
// EntityRenderDispatcher::instance->render(pMinecraft->localplayers[0], 0,
|
||||
// 0, 0, 0, 1);
|
||||
EntityRenderer* renderer =
|
||||
EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER);
|
||||
EntityRenderDispatcher::instance->getRenderer(eTYPE_LOCALPLAYER);
|
||||
if (renderer != NULL) {
|
||||
// 4J-PB - any additional parts to turn on for this player (skin
|
||||
// dependent)
|
||||
|
|
@ -324,7 +324,13 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer* renderer, double x,
|
|||
float s = 15 / 16.0f;
|
||||
glScalef(s, s, s);
|
||||
|
||||
// 4J - TomK - pull up character a bit more to make sure extra geo around
|
||||
// feet doesn't cause rendering problems on PSVita
|
||||
#ifdef __PSVITA__
|
||||
glTranslatef(0, -24 * _scale - 1.0f / 16.0f, 0);
|
||||
#else
|
||||
glTranslatef(0, -24 * _scale - 0.125f / 16.0f, 0);
|
||||
#endif
|
||||
|
||||
#ifdef SKIN_PREVIEW_WALKING_ANIM
|
||||
m_walkAnimSpeedO = m_walkAnimSpeed;
|
||||
|
|
|
|||
|
|
@ -22,8 +22,8 @@ bool UIControl_Progress::setupControl(UIScene* scene, IggyValuePath* parent,
|
|||
return success;
|
||||
}
|
||||
|
||||
void UIControl_Progress::init(const std::wstring& label, int id, int min,
|
||||
int max, int current) {
|
||||
void UIControl_Progress::init(UIString label, int id, int min, int max,
|
||||
int current) {
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
m_min = min;
|
||||
|
|
@ -85,4 +85,4 @@ void UIControl_Progress::showBar(bool show) {
|
|||
IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(), m_showBarFunc, 1, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ public:
|
|||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void init(const std::wstring& label, int id, int min, int max, int current);
|
||||
void init(UIString label, int id, int min, int max, int current);
|
||||
virtual void ReInit();
|
||||
|
||||
void setProgress(int current);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ bool UIControl_Slider::setupControl(UIScene* scene, IggyValuePath* parent,
|
|||
return success;
|
||||
}
|
||||
|
||||
void UIControl_Slider::init(const std::wstring& label, int id, int min, int max,
|
||||
void UIControl_Slider::init(UIString label, int id, int min, int max,
|
||||
int current) {
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
|
|
@ -104,6 +104,7 @@ S32 UIControl_Slider::GetRealWidth() {
|
|||
|
||||
void UIControl_Slider::setAllPossibleLabels(int labelCount,
|
||||
wchar_t labels[][256]) {
|
||||
m_allPossibleLabels.clear();
|
||||
for (unsigned int i = 0; i < labelCount; ++i) {
|
||||
m_allPossibleLabels.push_back(labels[i]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ public:
|
|||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void init(const std::wstring& label, int id, int min, int max, int current);
|
||||
void init(UIString label, int id, int min, int max, int current);
|
||||
|
||||
void handleSliderMove(int newValue);
|
||||
void SetSliderTouchPos(float fTouchPos);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,12 @@ bool UIControl_SlotList::setupControl(UIScene* scene, IggyValuePath* parent,
|
|||
return success;
|
||||
}
|
||||
|
||||
void UIControl_SlotList::ReInit() {
|
||||
UIControl_Base::ReInit();
|
||||
|
||||
m_lastHighlighted = -1;
|
||||
}
|
||||
|
||||
void UIControl_SlotList::addSlot(int id) {
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ public:
|
|||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
virtual void ReInit();
|
||||
|
||||
void addSlot(int id);
|
||||
void addSlots(int iStartValue, int iCount);
|
||||
|
||||
|
|
|
|||
|
|
@ -24,22 +24,20 @@ bool UIControl_SpaceIndicatorBar::setupControl(UIScene* scene,
|
|||
return success;
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::init(const std::wstring& label, int id,
|
||||
__int64 min, __int64 max) {
|
||||
void UIControl_SpaceIndicatorBar::init(UIString label, int id, int64_t min,
|
||||
int64_t max) {
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
m_min = min;
|
||||
m_max = max;
|
||||
|
||||
const std::u16string convLabel = convWstringToU16string(label);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_string_UTF16;
|
||||
IggyStringUTF16 stringVal;
|
||||
|
||||
stringVal.string = convLabel.c_str();
|
||||
stringVal.length = convLabel.length();
|
||||
stringVal.string = (IggyUTF16*)label.c_str();
|
||||
stringVal.length = label.length();
|
||||
value[0].string16 = stringVal;
|
||||
|
||||
IggyResult out =
|
||||
|
|
@ -63,10 +61,10 @@ void UIControl_SpaceIndicatorBar::reset() {
|
|||
setSaveGameOffset(0.0f);
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::addSave(__int64 size) {
|
||||
void UIControl_SpaceIndicatorBar::addSave(int64_t size) {
|
||||
float startPercent = (float)((m_currentTotal - m_min)) / (m_max - m_min);
|
||||
|
||||
m_sizeAndOffsets.push_back(std::pair<__int64, float>(size, startPercent));
|
||||
m_sizeAndOffsets.push_back(std::pair<int64_t, float>(size, startPercent));
|
||||
|
||||
m_currentTotal += size;
|
||||
setTotalSize(m_currentTotal);
|
||||
|
|
@ -74,7 +72,7 @@ void UIControl_SpaceIndicatorBar::addSave(__int64 size) {
|
|||
|
||||
void UIControl_SpaceIndicatorBar::selectSave(int index) {
|
||||
if (index >= 0 && index < m_sizeAndOffsets.size()) {
|
||||
std::pair<__int64, float> values = m_sizeAndOffsets[index];
|
||||
std::pair<int64_t, float> values = m_sizeAndOffsets[index];
|
||||
setSaveSize(values.first);
|
||||
setSaveGameOffset(values.second);
|
||||
} else {
|
||||
|
|
@ -83,7 +81,7 @@ void UIControl_SpaceIndicatorBar::selectSave(int index) {
|
|||
}
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::setSaveSize(__int64 size) {
|
||||
void UIControl_SpaceIndicatorBar::setSaveSize(int64_t size) {
|
||||
m_currentSave = size;
|
||||
|
||||
float percent = (float)((m_currentSave - m_min)) / (m_max - m_min);
|
||||
|
|
@ -97,7 +95,7 @@ void UIControl_SpaceIndicatorBar::setSaveSize(__int64 size) {
|
|||
getIggyValuePath(), m_setSaveSizeFunc, 1, value);
|
||||
}
|
||||
|
||||
void UIControl_SpaceIndicatorBar::setTotalSize(__int64 size) {
|
||||
void UIControl_SpaceIndicatorBar::setTotalSize(int64_t size) {
|
||||
float percent = (float)((m_currentTotal - m_min)) / (m_max - m_min);
|
||||
|
||||
IggyDataValue result;
|
||||
|
|
@ -119,4 +117,4 @@ void UIControl_SpaceIndicatorBar::setSaveGameOffset(float offset) {
|
|||
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result,
|
||||
getIggyValuePath(),
|
||||
m_setSaveGameOffsetFunc, 1, value);
|
||||
}
|
||||
}
|
||||
|
|
@ -5,12 +5,12 @@
|
|||
class UIControl_SpaceIndicatorBar : public UIControl_Base {
|
||||
private:
|
||||
IggyName m_setSaveSizeFunc, m_setTotalSizeFunc, m_setSaveGameOffsetFunc;
|
||||
__int64 m_min;
|
||||
__int64 m_max;
|
||||
__int64 m_currentSave, m_currentTotal;
|
||||
int64_t m_min;
|
||||
int64_t m_max;
|
||||
int64_t m_currentSave, m_currentTotal;
|
||||
float m_currentOffset;
|
||||
|
||||
std::vector<std::pair<__int64, float> > m_sizeAndOffsets;
|
||||
std::vector<std::pair<int64_t, float> > m_sizeAndOffsets;
|
||||
|
||||
public:
|
||||
UIControl_SpaceIndicatorBar();
|
||||
|
|
@ -18,15 +18,15 @@ public:
|
|||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void init(const std::wstring& label, int id, __int64 min, __int64 max);
|
||||
void init(UIString label, int id, int64_t min, int64_t max);
|
||||
virtual void ReInit();
|
||||
void reset();
|
||||
|
||||
void addSave(__int64 size);
|
||||
void addSave(int64_t size);
|
||||
void selectSave(int index);
|
||||
|
||||
private:
|
||||
void setSaveSize(__int64 size);
|
||||
void setTotalSize(__int64 totalSize);
|
||||
void setSaveSize(int64_t size);
|
||||
void setTotalSize(int64_t totalSize);
|
||||
void setSaveGameOffset(float offset);
|
||||
};
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
#include "../../Minecraft.World/Platform/stdafx.h"
|
||||
#include "../../stdafx.h"
|
||||
#include "UI.h"
|
||||
#include "UIControl_TextInput.h"
|
||||
|
||||
|
|
@ -17,7 +17,7 @@ bool UIControl_TextInput::setupControl(UIScene* scene, IggyValuePath* parent,
|
|||
return success;
|
||||
}
|
||||
|
||||
void UIControl_TextInput::init(const std::wstring& label, int id) {
|
||||
void UIControl_TextInput::init(UIString label, int id) {
|
||||
m_label = label;
|
||||
m_id = id;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public:
|
|||
virtual bool setupControl(UIScene* scene, IggyValuePath* parent,
|
||||
const std::string& controlName);
|
||||
|
||||
void init(const std::wstring& label, int id);
|
||||
void init(UIString label, int id);
|
||||
void ReInit();
|
||||
|
||||
virtual void setFocus(bool focus);
|
||||
|
|
|
|||
|
|
@ -98,14 +98,23 @@ enum EUIScene {
|
|||
eUIScene_TradingMenu,
|
||||
eUIScene_AnvilMenu,
|
||||
eUIScene_TeleportMenu,
|
||||
eUIScene_HopperMenu,
|
||||
eUIScene_BeaconMenu,
|
||||
eUIScene_HorseMenu,
|
||||
eUIScene_FireworksMenu,
|
||||
|
||||
#ifdef _XBOX
|
||||
// eUIScene_TransferToXboxOne,
|
||||
#endif
|
||||
|
||||
// ****************************************
|
||||
// ****************************************
|
||||
// ********** IMPORTANT ******************
|
||||
// ****************************************
|
||||
// ****************************************
|
||||
// When adding new scenes here, you must also update the switches in
|
||||
// CConsoleMinecraftApp::NavigateToScene There are quite a few so you need to
|
||||
// check them all
|
||||
// check them all Also update UILayer::updateFocusState
|
||||
|
||||
#ifndef _XBOX
|
||||
// Anything non-xbox should be added here. The ordering of scenes above is
|
||||
|
|
@ -123,6 +132,7 @@ enum EUIScene {
|
|||
eUIScene_Timer,
|
||||
eUIScene_EULA,
|
||||
eUIScene_InGameSaveManagementMenu,
|
||||
eUIScene_LanguageSelector,
|
||||
#endif // ndef _XBOX
|
||||
|
||||
#ifdef _DEBUG_MENUS_ENABLED
|
||||
|
|
@ -159,6 +169,8 @@ enum EToolTipButton {
|
|||
eToolTipButtonLB,
|
||||
eToolTipButtonRB,
|
||||
eToolTipButtonLS,
|
||||
eToolTipButtonRS,
|
||||
eToolTipButtonBack,
|
||||
eToolTipNumButtons
|
||||
};
|
||||
|
||||
|
|
@ -212,6 +224,12 @@ enum EHowToPlayPage {
|
|||
eHowToPlay_Breeding,
|
||||
eHowToPlay_Trading,
|
||||
|
||||
eHowToPlay_Horses,
|
||||
eHowToPlay_Beacons,
|
||||
eHowToPlay_Fireworks,
|
||||
eHowToPlay_Hoppers,
|
||||
eHowToPlay_Droppers,
|
||||
|
||||
eHowToPlay_NetherPortal,
|
||||
eHowToPlay_TheEnd,
|
||||
#ifdef _XBOX
|
||||
|
|
@ -231,7 +249,14 @@ enum ECreditTextTypes {
|
|||
eNumTextTypes
|
||||
};
|
||||
|
||||
enum EUIMessage {
|
||||
eUIMessage_InventoryUpdated,
|
||||
|
||||
eUIMessage_COUNT,
|
||||
};
|
||||
|
||||
#define NO_TRANSLATED_STRING \
|
||||
(-1) // String ID used to indicate that we are using non localised string.
|
||||
(-1) // String ID used to indicate that we are using non localised
|
||||
// std::string.
|
||||
|
||||
#define CONNECTING_PROGRESS_CHECK_TIME 500
|
||||
|
|
|
|||
|
|
@ -283,6 +283,14 @@ void UIGroup::HandleDLCLicenseChange() {
|
|||
}
|
||||
#endif
|
||||
|
||||
void UIGroup::HandleMessage(EUIMessage message, void* data) {
|
||||
// Ignore this group if the player isn't signed in
|
||||
if (m_iPad >= 0 && !ProfileManager.IsSignedIn(m_iPad)) return;
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
m_layers[i]->HandleMessage(message, data);
|
||||
}
|
||||
}
|
||||
|
||||
bool UIGroup::IsFullscreenGroup() { return m_group == eUIGroup_Fullscreen; }
|
||||
|
||||
void UIGroup::handleUnlockFullVersion() {
|
||||
|
|
@ -336,10 +344,10 @@ unsigned int UIGroup::GetLayerIndex(UILayer* layerPtr) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void UIGroup::PrintTotalMemoryUsage(__int64& totalStatic,
|
||||
__int64& totalDynamic) {
|
||||
__int64 groupStatic = 0;
|
||||
__int64 groupDynamic = 0;
|
||||
void UIGroup::PrintTotalMemoryUsage(int64_t& totalStatic,
|
||||
int64_t& totalDynamic) {
|
||||
int64_t groupStatic = 0;
|
||||
int64_t groupDynamic = 0;
|
||||
app.DebugPrintf(app.USER_SR, "-- BEGIN GROUP %d\n", m_group);
|
||||
for (unsigned int i = 0; i < eUILayer_COUNT; ++i) {
|
||||
app.DebugPrintf(app.USER_SR, " \\- BEGIN LAYER %d\n", i);
|
||||
|
|
|
|||
|
|
@ -107,11 +107,13 @@ public:
|
|||
#ifdef _XBOX_ONE
|
||||
virtual void HandleDLCLicenseChange();
|
||||
#endif
|
||||
virtual void HandleMessage(EUIMessage message, void* data);
|
||||
|
||||
bool IsFullscreenGroup();
|
||||
|
||||
void handleUnlockFullVersion();
|
||||
|
||||
void PrintTotalMemoryUsage(__int64& totalStatic, __int64& totalDynamic);
|
||||
void PrintTotalMemoryUsage(int64_t& totalStatic, int64_t& totalDynamic);
|
||||
|
||||
unsigned int GetLayerIndex(UILayer* layerPtr);
|
||||
|
||||
|
|
|
|||
|
|
@ -162,7 +162,7 @@ void UILayer::ReloadAll(bool force) {
|
|||
if (!m_sceneStack.empty()) {
|
||||
int lowestRenderable = 0;
|
||||
for (; lowestRenderable < m_sceneStack.size(); ++lowestRenderable) {
|
||||
m_sceneStack[lowestRenderable]->reloadMovie();
|
||||
m_sceneStack[lowestRenderable]->reloadMovie(force);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -221,6 +221,18 @@ bool UILayer::NavigateToScene(int iPad, EUIScene scene, void* initData) {
|
|||
case eUIScene_AnvilMenu:
|
||||
newScene = new UIScene_AnvilMenu(iPad, initData, this);
|
||||
break;
|
||||
case eUIScene_HopperMenu:
|
||||
newScene = new UIScene_HopperMenu(iPad, initData, this);
|
||||
break;
|
||||
case eUIScene_BeaconMenu:
|
||||
newScene = new UIScene_BeaconMenu(iPad, initData, this);
|
||||
break;
|
||||
case eUIScene_HorseMenu:
|
||||
newScene = new UIScene_HorseInventoryMenu(iPad, initData, this);
|
||||
break;
|
||||
case eUIScene_FireworksMenu:
|
||||
newScene = new UIScene_FireworksMenu(iPad, initData, this);
|
||||
break;
|
||||
|
||||
// Help and Options
|
||||
case eUIScene_HelpAndOptionsMenu:
|
||||
|
|
@ -250,6 +262,9 @@ bool UILayer::NavigateToScene(int iPad, EUIScene scene, void* initData) {
|
|||
case eUIScene_HowToPlayMenu:
|
||||
newScene = new UIScene_HowToPlayMenu(iPad, initData, this);
|
||||
break;
|
||||
case eUIScene_LanguageSelector:
|
||||
newScene = new UIScene_LanguageSelector(iPad, initData, this);
|
||||
break;
|
||||
case eUIScene_HowToPlay:
|
||||
newScene = new UIScene_HowToPlay(iPad, initData, this);
|
||||
break;
|
||||
|
|
@ -307,9 +322,6 @@ bool UILayer::NavigateToScene(int iPad, EUIScene scene, void* initData) {
|
|||
// Frontend
|
||||
case eUIScene_TrialExitUpsell:
|
||||
newScene = new UIScene_TrialExitUpsell(iPad, initData, this);
|
||||
app.DebugPrintf(
|
||||
"UILayer::NavigateToScene AFTER UIScene_TrialExitUpsell "
|
||||
"CALL\n");
|
||||
break;
|
||||
case eUIScene_Intro:
|
||||
newScene = new UIScene_Intro(iPad, initData, this);
|
||||
|
|
@ -350,6 +362,9 @@ bool UILayer::NavigateToScene(int iPad, EUIScene scene, void* initData) {
|
|||
case eUIScene_EULA:
|
||||
newScene = new UIScene_EULA(iPad, initData, this);
|
||||
break;
|
||||
case eUIScene_NewUpdateMessage:
|
||||
newScene = new UIScene_NewUpdateMessage(iPad, initData, this);
|
||||
break;
|
||||
|
||||
// Other
|
||||
case eUIScene_Keyboard:
|
||||
|
|
@ -634,6 +649,11 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */) {
|
|||
m_scenesToDestroy.push_back(scene);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (scene->getSceneType() == eUIScene_SettingsOptionsMenu) {
|
||||
scene->loseFocus();
|
||||
m_scenesToDestroy.push_back(scene);
|
||||
}
|
||||
}
|
||||
|
||||
/// UPDATE STACK STATES
|
||||
|
|
@ -656,6 +676,12 @@ bool UILayer::updateFocusState(bool allowedFocus /* = false */) {
|
|||
case eUIScene_DispenserMenu:
|
||||
case eUIScene_BrewingStandMenu:
|
||||
case eUIScene_EnchantingMenu:
|
||||
case eUIScene_TradingMenu:
|
||||
case eUIScene_HopperMenu:
|
||||
case eUIScene_HorseMenu:
|
||||
case eUIScene_FireworksMenu:
|
||||
case eUIScene_BeaconMenu:
|
||||
case eUIScene_AnvilMenu:
|
||||
m_bContainerMenuDisplayed = true;
|
||||
|
||||
// Intentional fall-through
|
||||
|
|
@ -719,7 +745,7 @@ void UILayer::handleInput(int iPad, int key, bool repeat, bool pressed,
|
|||
|
||||
// Fix for PS3 #444 - [IN GAME] If the user keeps pressing CROSS while
|
||||
// on the 'Save Game' screen the title will crash.
|
||||
handled = handled || scene->hidesLowerScenes();
|
||||
handled = handled || scene->hidesLowerScenes() || scene->blocksInput();
|
||||
if (handled) break;
|
||||
}
|
||||
|
||||
|
|
@ -750,6 +776,13 @@ void UILayer::HandleDLCLicenseChange() {
|
|||
}
|
||||
#endif
|
||||
|
||||
void UILayer::HandleMessage(EUIMessage message, void* data) {
|
||||
for (AUTO_VAR(it, m_sceneStack.rbegin()); it != m_sceneStack.rend(); ++it) {
|
||||
UIScene* topScene = *it;
|
||||
topScene->HandleMessage(message, data);
|
||||
}
|
||||
}
|
||||
|
||||
bool UILayer::IsFullscreenGroup() { return m_parentGroup->IsFullscreenGroup(); }
|
||||
|
||||
C4JRender::eViewportType UILayer::getViewport() {
|
||||
|
|
@ -762,10 +795,10 @@ void UILayer::handleUnlockFullVersion() {
|
|||
}
|
||||
}
|
||||
|
||||
void UILayer::PrintTotalMemoryUsage(__int64& totalStatic,
|
||||
__int64& totalDynamic) {
|
||||
__int64 layerStatic = 0;
|
||||
__int64 layerDynamic = 0;
|
||||
void UILayer::PrintTotalMemoryUsage(int64_t& totalStatic,
|
||||
int64_t& totalDynamic) {
|
||||
int64_t layerStatic = 0;
|
||||
int64_t layerDynamic = 0;
|
||||
for (AUTO_VAR(it, m_components.begin()); it != m_components.end(); ++it) {
|
||||
(*it)->PrintTotalMemoryUsage(layerStatic, layerDynamic);
|
||||
}
|
||||
|
|
@ -787,4 +820,4 @@ UIScene* UILayer::FindScene(EUIScene sceneType) {
|
|||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
|
@ -93,8 +93,10 @@ public:
|
|||
#ifdef _XBOX_ONE
|
||||
virtual void HandleDLCLicenseChange();
|
||||
#endif
|
||||
virtual void HandleMessage(EUIMessage message, void* data);
|
||||
|
||||
void handleUnlockFullVersion();
|
||||
UIScene* FindScene(EUIScene sceneType);
|
||||
|
||||
void PrintTotalMemoryUsage(__int64& totalStatic, __int64& totalDynamic);
|
||||
void PrintTotalMemoryUsage(int64_t& totalStatic, int64_t& totalDynamic);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -91,6 +91,7 @@ void UIScene::reloadMovie(bool force) {
|
|||
(*it)->ReInit();
|
||||
}
|
||||
|
||||
updateComponents();
|
||||
handleReload();
|
||||
|
||||
IggyDataValue result;
|
||||
|
|
@ -311,11 +312,11 @@ void UIScene::loadMovie() {
|
|||
}
|
||||
|
||||
byteArray baFile = ui.getMovieData(moviePath.c_str());
|
||||
__int64 beforeLoad = ui.iggyAllocCount;
|
||||
int64_t beforeLoad = ui.iggyAllocCount;
|
||||
swf = IggyPlayerCreateFromMemory(baFile.data, baFile.length, NULL);
|
||||
__int64 afterLoad = ui.iggyAllocCount;
|
||||
int64_t afterLoad = ui.iggyAllocCount;
|
||||
IggyPlayerInitializeAndTickRS(swf);
|
||||
__int64 afterTick = ui.iggyAllocCount;
|
||||
int64_t afterTick = ui.iggyAllocCount;
|
||||
|
||||
if (!swf) {
|
||||
app.DebugPrintf("ERROR: Failed to load iggy scene!\n");
|
||||
|
|
@ -343,8 +344,8 @@ void UIScene::loadMovie() {
|
|||
IggyMemoryUseInfo memoryInfo;
|
||||
rrbool res;
|
||||
int iteration = 0;
|
||||
__int64 totalStatic = 0;
|
||||
__int64 totalDynamic = 0;
|
||||
int64_t totalStatic = 0;
|
||||
int64_t totalDynamic = 0;
|
||||
while(res = IggyDebugGetMemoryUseInfo ( swf ,
|
||||
NULL ,
|
||||
0 ,
|
||||
|
|
@ -372,10 +373,10 @@ void UIScene::getDebugMemoryUseRecursive(const std::wstring& moviePath,
|
|||
rrbool res;
|
||||
IggyMemoryUseInfo internalMemoryInfo;
|
||||
int internalIteration = 0;
|
||||
while ((res = IggyDebugGetMemoryUseInfo(swf, 0, memoryInfo.subcategory,
|
||||
memoryInfo.subcategory_stringlen,
|
||||
internalIteration,
|
||||
&internalMemoryInfo))) {
|
||||
while (res = IggyDebugGetMemoryUseInfo(swf, NULL, memoryInfo.subcategory,
|
||||
memoryInfo.subcategory_stringlen,
|
||||
internalIteration,
|
||||
&internalMemoryInfo)) {
|
||||
app.DebugPrintf(
|
||||
app.USER_SR, "%ls - %.*s static: %d ( %d ) dynamic: %d ( %d )\n",
|
||||
moviePath.c_str(), internalMemoryInfo.subcategory_stringlen,
|
||||
|
|
@ -391,17 +392,17 @@ void UIScene::getDebugMemoryUseRecursive(const std::wstring& moviePath,
|
|||
}
|
||||
}
|
||||
|
||||
void UIScene::PrintTotalMemoryUsage(__int64& totalStatic,
|
||||
__int64& totalDynamic) {
|
||||
void UIScene::PrintTotalMemoryUsage(int64_t& totalStatic,
|
||||
int64_t& totalDynamic) {
|
||||
if (!swf) return;
|
||||
|
||||
IggyMemoryUseInfo memoryInfo;
|
||||
rrbool res;
|
||||
int iteration = 0;
|
||||
__int64 sceneStatic = 0;
|
||||
__int64 sceneDynamic = 0;
|
||||
while ((res = IggyDebugGetMemoryUseInfo(swf, 0, "", 0, iteration,
|
||||
&memoryInfo))) {
|
||||
int64_t sceneStatic = 0;
|
||||
int64_t sceneDynamic = 0;
|
||||
while (res = IggyDebugGetMemoryUseInfo(swf, NULL, "", 0, iteration,
|
||||
&memoryInfo)) {
|
||||
sceneStatic += memoryInfo.static_allocation_bytes;
|
||||
sceneDynamic += memoryInfo.dynamic_allocation_bytes;
|
||||
totalStatic += memoryInfo.static_allocation_bytes;
|
||||
|
|
@ -816,7 +817,7 @@ void UIScene::gainFocus() {
|
|||
app.DebugPrintf("Sent gain focus event to scene\n");
|
||||
*/
|
||||
bHasFocus = true;
|
||||
if (app.GetGameStarted() && needsReloaded()) {
|
||||
if (needsReloaded()) {
|
||||
reloadMovie();
|
||||
}
|
||||
|
||||
|
|
@ -864,7 +865,9 @@ void UIScene::handleGainFocus(bool navBack) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void UIScene::updateTooltips() { ui.SetTooltips(m_iPad, -1); }
|
||||
void UIScene::updateTooltips() {
|
||||
if (!ui.IsReloadingSkin()) ui.SetTooltips(m_iPad, -1);
|
||||
}
|
||||
|
||||
void UIScene::sendInputToMovie(int key, bool repeat, bool pressed,
|
||||
bool released) {
|
||||
|
|
@ -888,6 +891,7 @@ void UIScene::sendInputToMovie(int key, bool repeat, bool pressed,
|
|||
}
|
||||
|
||||
int UIScene::convertGameActionToIggyKeycode(int action) {
|
||||
// TODO: This action to key mapping should probably use the control mapping
|
||||
int keycode = -1;
|
||||
switch (action) {
|
||||
#ifdef __ORBIS__
|
||||
|
|
@ -927,7 +931,14 @@ int UIScene::convertGameActionToIggyKeycode(int action) {
|
|||
keycode = IGGY_KEYCODE_PAGE_UP;
|
||||
break;
|
||||
case ACTION_MENU_PAGEDOWN:
|
||||
keycode = IGGY_KEYCODE_PAGE_DOWN;
|
||||
#ifdef __PSVITA__
|
||||
if (!InputManager.IsVitaTV()) {
|
||||
keycode = IGGY_KEYCODE_F6;
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
keycode = IGGY_KEYCODE_PAGE_DOWN;
|
||||
}
|
||||
break;
|
||||
case ACTION_MENU_RIGHT_SCROLL:
|
||||
keycode = IGGY_KEYCODE_F3;
|
||||
|
|
@ -938,6 +949,7 @@ int UIScene::convertGameActionToIggyKeycode(int action) {
|
|||
case ACTION_MENU_STICK_PRESS:
|
||||
break;
|
||||
case ACTION_MENU_OTHER_STICK_PRESS:
|
||||
keycode = IGGY_KEYCODE_F5;
|
||||
break;
|
||||
case ACTION_MENU_OTHER_STICK_UP:
|
||||
keycode = IGGY_KEYCODE_F11;
|
||||
|
|
@ -1211,7 +1223,9 @@ void UIScene::UpdateSceneControls() {
|
|||
}
|
||||
#endif
|
||||
|
||||
size_t UIScene::GetCallbackUniqueId() {
|
||||
void UIScene::HandleMessage(EUIMessage message, void* data) {}
|
||||
|
||||
std::size_t UIScene::GetCallbackUniqueId() {
|
||||
if (m_callbackUniqueId == 0) {
|
||||
m_callbackUniqueId = ui.RegisterForCallbackId(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,6 +179,10 @@ public:
|
|||
// this scenes layers should be hidden
|
||||
virtual bool hidesLowerScenes() { return m_hasTickedOnce; }
|
||||
|
||||
// Returns true if this scene should block input to lower scenes (works like
|
||||
// hidesLowerScenes but doesn't interfere with rendering)
|
||||
virtual bool blocksInput() { return false; }
|
||||
|
||||
// returns main panel if controls are not living in the root
|
||||
virtual UIControl* GetMainPanel();
|
||||
|
||||
|
|
@ -272,6 +276,9 @@ public:
|
|||
#ifdef _XBOX_ONE
|
||||
virtual void HandleDLCLicenseChange() {}
|
||||
#endif
|
||||
|
||||
virtual void HandleMessage(EUIMessage message, void* data);
|
||||
|
||||
void registerSubstitutionTexture(const std::wstring& textureName,
|
||||
std::uint8_t* pbData,
|
||||
unsigned int dwLength,
|
||||
|
|
|
|||
|
|
@ -50,8 +50,11 @@ void UIScene_AbstractContainerMenu::handleDestroy() {
|
|||
// packet loss. We need to make sure that we call closeContainer() anytime
|
||||
// this menu is closed, even if it is forced to close by some other reason
|
||||
// (like the player dying)
|
||||
if (pMinecraft->localplayers[m_iPad] != NULL)
|
||||
if (pMinecraft->localplayers[m_iPad] != NULL &&
|
||||
pMinecraft->localplayers[m_iPad]->containerMenu->containerId ==
|
||||
m_menu->containerId) {
|
||||
pMinecraft->localplayers[m_iPad]->closeContainer();
|
||||
}
|
||||
|
||||
ui.OverrideSFX(m_iPad, ACTION_MENU_A, false);
|
||||
ui.OverrideSFX(m_iPad, ACTION_MENU_OK, false);
|
||||
|
|
@ -206,7 +209,7 @@ void UIScene_AbstractContainerMenu::render(S32 width, S32 height,
|
|||
m_needsCacheRendered = m_needsCacheRendered || m_menu->needsRendered();
|
||||
|
||||
if (m_needsCacheRendered) {
|
||||
m_expectedCachedSlotCount = 0;
|
||||
m_expectedCachedSlotCount = GetBaseSlotCount();
|
||||
unsigned int count = m_menu->getSize();
|
||||
for (unsigned int i = 0; i < count; ++i) {
|
||||
if (m_menu->getSlot(i)->hasItem()) {
|
||||
|
|
@ -244,7 +247,10 @@ void UIScene_AbstractContainerMenu::customDraw(
|
|||
}
|
||||
|
||||
if (item != NULL)
|
||||
customDrawSlotControl(region, m_iPad, item, 1.0f, item->isFoil(), true);
|
||||
customDrawSlotControl(
|
||||
region, m_iPad, item,
|
||||
m_menu->isValidIngredient(item, slotId) ? 1.0f : 0.5f,
|
||||
item->isFoil(), true);
|
||||
}
|
||||
|
||||
void UIScene_AbstractContainerMenu::handleInput(int iPad, int key, bool repeat,
|
||||
|
|
@ -263,20 +269,24 @@ void UIScene_AbstractContainerMenu::handleInput(int iPad, int key, bool repeat,
|
|||
}
|
||||
|
||||
void UIScene_AbstractContainerMenu::SetPointerText(
|
||||
const std::wstring& description,
|
||||
std::vector<std::wstring>& unformattedStrings, bool newSlot) {
|
||||
// app.DebugPrintf("Setting pointer text\n");
|
||||
m_cursorPath.setLabel(description, false, newSlot);
|
||||
std::vector<HtmlString>* description, bool newSlot) {
|
||||
m_cursorPath.setLabel(HtmlString::Compose(description), false, newSlot);
|
||||
}
|
||||
|
||||
void UIScene_AbstractContainerMenu::setSectionFocus(ESceneSection eSection,
|
||||
int iPad) {
|
||||
if (m_focusSection != eSectionNone) {
|
||||
UIControl* currentFocus = getSection(m_focusSection);
|
||||
if (currentFocus) currentFocus->setFocus(false);
|
||||
}
|
||||
UIControl* newFocus = getSection(eSection);
|
||||
if (newFocus) newFocus->setFocus(true);
|
||||
|
||||
if (m_focusSection != eSectionNone) {
|
||||
UIControl* currentFocus = getSection(m_focusSection);
|
||||
// 4J-TomK only set current focus to false if it differs from last
|
||||
// (previously this continuously fired iggy functions when they were
|
||||
// identical!
|
||||
if (currentFocus != newFocus)
|
||||
if (currentFocus) currentFocus->setFocus(false);
|
||||
}
|
||||
|
||||
m_focusSection = eSection;
|
||||
}
|
||||
|
||||
|
|
@ -297,6 +307,15 @@ std::shared_ptr<ItemInstance> UIScene_AbstractContainerMenu::getSlotItem(
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
Slot* UIScene_AbstractContainerMenu::getSlot(ESceneSection eSection,
|
||||
int iSlot) {
|
||||
Slot* slot = m_menu->getSlot(getSectionStartOffset(eSection) + iSlot);
|
||||
if (slot)
|
||||
return slot;
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool UIScene_AbstractContainerMenu::isSlotEmpty(ESceneSection eSection,
|
||||
int iSlot) {
|
||||
Slot* slot = m_menu->getSlot(getSectionStartOffset(eSection) + iSlot);
|
||||
|
|
|
|||
|
|
@ -49,19 +49,26 @@ protected:
|
|||
}
|
||||
virtual void setSectionFocus(ESceneSection eSection, int iPad);
|
||||
void setFocusToPointer(int iPad);
|
||||
void SetPointerText(const std::wstring& description,
|
||||
std::vector<std::wstring>& unformattedStrings,
|
||||
bool newSlot);
|
||||
void SetPointerText(std::vector<HtmlString>* description, bool newSlot);
|
||||
virtual std::shared_ptr<ItemInstance> getSlotItem(ESceneSection eSection,
|
||||
int iSlot);
|
||||
virtual Slot* getSlot(ESceneSection eSection, int iSlot);
|
||||
virtual bool isSlotEmpty(ESceneSection eSection, int iSlot);
|
||||
virtual void adjustPointerForSafeZone();
|
||||
|
||||
virtual UIControl* getSection(ESceneSection eSection) { return NULL; }
|
||||
virtual int GetBaseSlotCount() { return 0; }
|
||||
|
||||
public:
|
||||
virtual void tick();
|
||||
|
||||
// 4J - TomK If update tooltips is called then make sure the correct parent
|
||||
// is invoked! (both UIScene AND IUIScene_AbstractContainerMenu have an
|
||||
// instance of said function!)
|
||||
virtual void updateTooltips() {
|
||||
IUIScene_AbstractContainerMenu::UpdateTooltips();
|
||||
}
|
||||
|
||||
virtual void render(S32 width, S32 height,
|
||||
C4JRender::eViewportType viewpBort);
|
||||
virtual void customDraw(IggyCustomDrawCallbackRegion* region);
|
||||
|
|
|
|||
|
|
@ -29,17 +29,17 @@ UIScene_AnvilMenu::UIScene_AnvilMenu(int iPad, void* _initData,
|
|||
e_Tutorial_State_Anvil_Menu, this);
|
||||
}
|
||||
|
||||
m_repairMenu = new RepairMenu(initData->inventory, initData->level,
|
||||
initData->x, initData->y, initData->z,
|
||||
pMinecraft->localplayers[iPad]);
|
||||
m_repairMenu =
|
||||
new AnvilMenu(initData->inventory, initData->level, initData->x,
|
||||
initData->y, initData->z, pMinecraft->localplayers[iPad]);
|
||||
m_repairMenu->addSlotListener(this);
|
||||
|
||||
Initialize(iPad, m_repairMenu, true, RepairMenu::INV_SLOT_START,
|
||||
Initialize(iPad, m_repairMenu, true, AnvilMenu::INV_SLOT_START,
|
||||
eSectionAnvilUsing, eSectionAnvilMax);
|
||||
|
||||
m_slotListItem1.addSlots(RepairMenu::INPUT_SLOT, 1);
|
||||
m_slotListItem2.addSlots(RepairMenu::ADDITIONAL_SLOT, 1);
|
||||
m_slotListResult.addSlots(RepairMenu::RESULT_SLOT, 1);
|
||||
m_slotListItem1.addSlots(AnvilMenu::INPUT_SLOT, 1);
|
||||
m_slotListItem2.addSlots(AnvilMenu::ADDITIONAL_SLOT, 1);
|
||||
m_slotListResult.addSlots(AnvilMenu::RESULT_SLOT, 1);
|
||||
|
||||
bool expensive = false;
|
||||
std::wstring m_costString = L"";
|
||||
|
|
@ -49,14 +49,14 @@ UIScene_AnvilMenu::UIScene_AnvilMenu(int iPad, void* _initData,
|
|||
!pMinecraft->localplayers[iPad]->abilities.instabuild) {
|
||||
m_costString = app.GetString(IDS_REPAIR_EXPENSIVE);
|
||||
expensive = true;
|
||||
} else if (!m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)->hasItem()) {
|
||||
} else if (!m_repairMenu->getSlot(AnvilMenu::RESULT_SLOT)->hasItem()) {
|
||||
// Do nothing
|
||||
} else {
|
||||
const wchar_t* costString = app.GetString(IDS_REPAIR_COST);
|
||||
wchar_t temp[256];
|
||||
swprintf(temp, 256, costString, m_repairMenu->cost);
|
||||
m_costString = temp;
|
||||
if (!m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)
|
||||
if (!m_repairMenu->getSlot(AnvilMenu::RESULT_SLOT)
|
||||
->mayPickup(std::dynamic_pointer_cast<Player>(
|
||||
m_inventory->player->shared_from_this()))) {
|
||||
expensive = true;
|
||||
|
|
@ -81,12 +81,12 @@ std::wstring UIScene_AnvilMenu::getMoviePath() {
|
|||
}
|
||||
|
||||
void UIScene_AnvilMenu::handleReload() {
|
||||
Initialize(m_iPad, m_menu, true, RepairMenu::INV_SLOT_START,
|
||||
Initialize(m_iPad, m_menu, true, AnvilMenu::INV_SLOT_START,
|
||||
eSectionAnvilUsing, eSectionAnvilMax);
|
||||
|
||||
m_slotListItem1.addSlots(RepairMenu::INPUT_SLOT, 1);
|
||||
m_slotListItem2.addSlots(RepairMenu::ADDITIONAL_SLOT, 1);
|
||||
m_slotListResult.addSlots(RepairMenu::RESULT_SLOT, 1);
|
||||
m_slotListItem1.addSlots(AnvilMenu::INPUT_SLOT, 1);
|
||||
m_slotListItem2.addSlots(AnvilMenu::ADDITIONAL_SLOT, 1);
|
||||
m_slotListResult.addSlots(AnvilMenu::RESULT_SLOT, 1);
|
||||
}
|
||||
|
||||
void UIScene_AnvilMenu::tick() {
|
||||
|
|
|
|||
497
Minecraft.Client/Platform/Common/UI/UIScene_BeaconMenu.cpp
Normal file
497
Minecraft.Client/Platform/Common/UI/UIScene_BeaconMenu.cpp
Normal file
|
|
@ -0,0 +1,497 @@
|
|||
#include "../../stdafx.h"
|
||||
#include "UI.h"
|
||||
#include "../../../../Minecraft.World/Headers/net.minecraft.world.level.tile.entity.h"
|
||||
#include "../../../../Minecraft.World/Headers/net.minecraft.world.inventory.h"
|
||||
#include "../../Minecraft.h"
|
||||
#include "UIScene_BeaconMenu.h"
|
||||
|
||||
UIScene_BeaconMenu::UIScene_BeaconMenu(int iPad, void* _initData,
|
||||
UILayer* parentLayer)
|
||||
: UIScene_AbstractContainerMenu(iPad, parentLayer) {
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
|
||||
m_labelPrimary.init(IDS_CONTAINER_BEACON_PRIMARY_POWER);
|
||||
m_labelSecondary.init(IDS_CONTAINER_BEACON_SECONDARY_POWER);
|
||||
|
||||
m_buttonsPowers[eControl_Primary1].setVisible(false);
|
||||
m_buttonsPowers[eControl_Primary2].setVisible(false);
|
||||
m_buttonsPowers[eControl_Primary3].setVisible(false);
|
||||
m_buttonsPowers[eControl_Primary4].setVisible(false);
|
||||
m_buttonsPowers[eControl_Primary5].setVisible(false);
|
||||
m_buttonsPowers[eControl_Secondary1].setVisible(false);
|
||||
m_buttonsPowers[eControl_Secondary2].setVisible(false);
|
||||
|
||||
BeaconScreenInput* initData = (BeaconScreenInput*)_initData;
|
||||
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
if (pMinecraft->localgameModes[initData->iPad] != NULL) {
|
||||
TutorialMode* gameMode =
|
||||
(TutorialMode*)pMinecraft->localgameModes[initData->iPad];
|
||||
m_previousTutorialState = gameMode->getTutorial()->getCurrentState();
|
||||
gameMode->getTutorial()->changeTutorialState(
|
||||
e_Tutorial_State_Beacon_Menu, this);
|
||||
}
|
||||
|
||||
m_beacon = initData->beacon;
|
||||
|
||||
BeaconMenu* menu = new BeaconMenu(initData->inventory, initData->beacon);
|
||||
|
||||
Initialize(initData->iPad, menu, true, BeaconMenu::INV_SLOT_START,
|
||||
eSectionBeaconUsing, eSectionBeaconMax);
|
||||
|
||||
m_slotListActivator.addSlots(BeaconMenu::PAYMENT_SLOT, 1);
|
||||
|
||||
m_slotListActivatorIcons.addSlots(m_menu->getSize(), 4);
|
||||
|
||||
// app.SetRichPresenceContext(m_iPad,CONTEXT_GAME_STATE_BEACON);
|
||||
|
||||
delete initData;
|
||||
}
|
||||
|
||||
std::wstring UIScene_BeaconMenu::getMoviePath() {
|
||||
if (app.GetLocalPlayerCount() > 1) {
|
||||
return L"BeaconMenuSplit";
|
||||
} else {
|
||||
return L"BeaconMenu";
|
||||
}
|
||||
}
|
||||
|
||||
void UIScene_BeaconMenu::handleReload() {
|
||||
Initialize(m_iPad, m_menu, true, BeaconMenu::INV_SLOT_START,
|
||||
eSectionBeaconUsing, eSectionBeaconMax);
|
||||
|
||||
m_slotListActivator.addSlots(BeaconMenu::PAYMENT_SLOT, 1);
|
||||
|
||||
m_slotListActivatorIcons.addSlots(m_menu->getSize(), 4);
|
||||
}
|
||||
|
||||
void UIScene_BeaconMenu::tick() {
|
||||
UIScene_AbstractContainerMenu::tick();
|
||||
|
||||
handleTick();
|
||||
}
|
||||
|
||||
int UIScene_BeaconMenu::getSectionColumns(ESceneSection eSection) {
|
||||
int cols = 0;
|
||||
switch (eSection) {
|
||||
case eSectionBeaconItem:
|
||||
cols = 1;
|
||||
break;
|
||||
case eSectionBeaconInventory:
|
||||
cols = 9;
|
||||
break;
|
||||
case eSectionBeaconUsing:
|
||||
cols = 9;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
};
|
||||
return cols;
|
||||
}
|
||||
|
||||
int UIScene_BeaconMenu::getSectionRows(ESceneSection eSection) {
|
||||
int rows = 0;
|
||||
switch (eSection) {
|
||||
case eSectionBeaconItem:
|
||||
rows = 1;
|
||||
break;
|
||||
case eSectionBeaconInventory:
|
||||
rows = 3;
|
||||
break;
|
||||
case eSectionBeaconUsing:
|
||||
rows = 1;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
};
|
||||
return rows;
|
||||
}
|
||||
|
||||
void UIScene_BeaconMenu::GetPositionOfSection(ESceneSection eSection,
|
||||
UIVec2D* pPosition) {
|
||||
switch (eSection) {
|
||||
case eSectionBeaconItem:
|
||||
pPosition->x = m_slotListActivator.getXPos();
|
||||
pPosition->y = m_slotListActivator.getYPos();
|
||||
break;
|
||||
case eSectionBeaconInventory:
|
||||
pPosition->x = m_slotListInventory.getXPos();
|
||||
pPosition->y = m_slotListInventory.getYPos();
|
||||
break;
|
||||
case eSectionBeaconUsing:
|
||||
pPosition->x = m_slotListHotbar.getXPos();
|
||||
pPosition->y = m_slotListHotbar.getYPos();
|
||||
break;
|
||||
|
||||
case eSectionBeaconPrimaryTierOneOne:
|
||||
pPosition->x = m_buttonsPowers[eControl_Primary1].getXPos();
|
||||
pPosition->y = m_buttonsPowers[eControl_Primary1].getYPos();
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierOneTwo:
|
||||
pPosition->x = m_buttonsPowers[eControl_Primary2].getXPos();
|
||||
pPosition->y = m_buttonsPowers[eControl_Primary2].getYPos();
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierTwoOne:
|
||||
pPosition->x = m_buttonsPowers[eControl_Primary3].getXPos();
|
||||
pPosition->y = m_buttonsPowers[eControl_Primary3].getYPos();
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierTwoTwo:
|
||||
pPosition->x = m_buttonsPowers[eControl_Primary4].getXPos();
|
||||
pPosition->y = m_buttonsPowers[eControl_Primary4].getYPos();
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierThree:
|
||||
pPosition->x = m_buttonsPowers[eControl_Primary5].getXPos();
|
||||
pPosition->y = m_buttonsPowers[eControl_Primary5].getYPos();
|
||||
break;
|
||||
case eSectionBeaconSecondaryOne:
|
||||
pPosition->x = m_buttonsPowers[eControl_Secondary1].getXPos();
|
||||
pPosition->y = m_buttonsPowers[eControl_Secondary1].getYPos();
|
||||
break;
|
||||
case eSectionBeaconSecondaryTwo:
|
||||
pPosition->x = m_buttonsPowers[eControl_Secondary2].getXPos();
|
||||
pPosition->y = m_buttonsPowers[eControl_Secondary2].getYPos();
|
||||
break;
|
||||
case eSectionBeaconConfirm:
|
||||
pPosition->x = m_buttonConfirm.getXPos();
|
||||
pPosition->y = m_buttonConfirm.getYPos();
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
void UIScene_BeaconMenu::GetItemScreenData(ESceneSection eSection,
|
||||
int iItemIndex, UIVec2D* pPosition,
|
||||
UIVec2D* pSize) {
|
||||
UIVec2D sectionSize;
|
||||
switch (eSection) {
|
||||
case eSectionBeaconItem:
|
||||
sectionSize.x = m_slotListActivator.getWidth();
|
||||
sectionSize.y = m_slotListActivator.getHeight();
|
||||
break;
|
||||
case eSectionBeaconInventory:
|
||||
sectionSize.x = m_slotListInventory.getWidth();
|
||||
sectionSize.y = m_slotListInventory.getHeight();
|
||||
break;
|
||||
case eSectionBeaconUsing:
|
||||
sectionSize.x = m_slotListHotbar.getWidth();
|
||||
sectionSize.y = m_slotListHotbar.getHeight();
|
||||
break;
|
||||
|
||||
case eSectionBeaconPrimaryTierOneOne:
|
||||
sectionSize.x = m_buttonsPowers[eControl_Primary1].getWidth();
|
||||
sectionSize.y = m_buttonsPowers[eControl_Primary1].getHeight();
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierOneTwo:
|
||||
sectionSize.x = m_buttonsPowers[eControl_Primary2].getWidth();
|
||||
sectionSize.y = m_buttonsPowers[eControl_Primary2].getHeight();
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierTwoOne:
|
||||
sectionSize.x = m_buttonsPowers[eControl_Primary3].getWidth();
|
||||
sectionSize.y = m_buttonsPowers[eControl_Primary3].getHeight();
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierTwoTwo:
|
||||
sectionSize.x = m_buttonsPowers[eControl_Primary4].getWidth();
|
||||
sectionSize.y = m_buttonsPowers[eControl_Primary4].getHeight();
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierThree:
|
||||
sectionSize.x = m_buttonsPowers[eControl_Primary5].getWidth();
|
||||
sectionSize.y = m_buttonsPowers[eControl_Primary5].getHeight();
|
||||
break;
|
||||
case eSectionBeaconSecondaryOne:
|
||||
sectionSize.x = m_buttonsPowers[eControl_Secondary1].getWidth();
|
||||
sectionSize.y = m_buttonsPowers[eControl_Secondary1].getHeight();
|
||||
break;
|
||||
case eSectionBeaconSecondaryTwo:
|
||||
sectionSize.x = m_buttonsPowers[eControl_Secondary2].getWidth();
|
||||
sectionSize.y = m_buttonsPowers[eControl_Secondary2].getHeight();
|
||||
break;
|
||||
case eSectionBeaconConfirm:
|
||||
sectionSize.x = m_buttonConfirm.getWidth();
|
||||
sectionSize.y = m_buttonConfirm.getHeight();
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
};
|
||||
|
||||
if (IsSectionSlotList(eSection)) {
|
||||
int rows = getSectionRows(eSection);
|
||||
int cols = getSectionColumns(eSection);
|
||||
|
||||
pSize->x = sectionSize.x / cols;
|
||||
pSize->y = sectionSize.y / rows;
|
||||
|
||||
int itemCol = iItemIndex % cols;
|
||||
int itemRow = iItemIndex / cols;
|
||||
|
||||
pPosition->x = itemCol * pSize->x;
|
||||
pPosition->y = itemRow * pSize->y;
|
||||
} else {
|
||||
GetPositionOfSection(eSection, pPosition);
|
||||
pSize->x = sectionSize.x;
|
||||
pSize->y = sectionSize.y;
|
||||
}
|
||||
}
|
||||
|
||||
void UIScene_BeaconMenu::setSectionSelectedSlot(ESceneSection eSection, int x,
|
||||
int y) {
|
||||
int cols = getSectionColumns(eSection);
|
||||
|
||||
int index = (y * cols) + x;
|
||||
|
||||
UIControl_SlotList* slotList = NULL;
|
||||
switch (eSection) {
|
||||
case eSectionBeaconItem:
|
||||
slotList = &m_slotListActivator;
|
||||
break;
|
||||
case eSectionBeaconInventory:
|
||||
slotList = &m_slotListInventory;
|
||||
break;
|
||||
case eSectionBeaconUsing:
|
||||
slotList = &m_slotListHotbar;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
};
|
||||
|
||||
slotList->setHighlightSlot(index);
|
||||
}
|
||||
|
||||
UIControl* UIScene_BeaconMenu::getSection(ESceneSection eSection) {
|
||||
UIControl* control = NULL;
|
||||
switch (eSection) {
|
||||
case eSectionBeaconItem:
|
||||
control = &m_slotListActivator;
|
||||
break;
|
||||
case eSectionBeaconInventory:
|
||||
control = &m_slotListInventory;
|
||||
break;
|
||||
case eSectionBeaconUsing:
|
||||
control = &m_slotListHotbar;
|
||||
break;
|
||||
|
||||
case eSectionBeaconPrimaryTierOneOne:
|
||||
control = &m_buttonsPowers[eControl_Primary1];
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierOneTwo:
|
||||
control = &m_buttonsPowers[eControl_Primary2];
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierTwoOne:
|
||||
control = &m_buttonsPowers[eControl_Primary3];
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierTwoTwo:
|
||||
control = &m_buttonsPowers[eControl_Primary4];
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierThree:
|
||||
control = &m_buttonsPowers[eControl_Primary5];
|
||||
break;
|
||||
case eSectionBeaconSecondaryOne:
|
||||
control = &m_buttonsPowers[eControl_Secondary1];
|
||||
break;
|
||||
case eSectionBeaconSecondaryTwo:
|
||||
control = &m_buttonsPowers[eControl_Secondary2];
|
||||
break;
|
||||
case eSectionBeaconConfirm:
|
||||
control = &m_buttonConfirm;
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
};
|
||||
return control;
|
||||
}
|
||||
|
||||
void UIScene_BeaconMenu::customDraw(IggyCustomDrawCallbackRegion* region) {
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
if (pMinecraft->localplayers[m_iPad] == NULL ||
|
||||
pMinecraft->localgameModes[m_iPad] == NULL)
|
||||
return;
|
||||
|
||||
std::shared_ptr<ItemInstance> item = nullptr;
|
||||
int slotId = -1;
|
||||
swscanf((wchar_t*)region->name, L"slot_%d", &slotId);
|
||||
|
||||
if (slotId >= 0 && slotId >= m_menu->getSize()) {
|
||||
int icon = slotId - m_menu->getSize();
|
||||
switch (icon) {
|
||||
case 0:
|
||||
item = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Item::emerald));
|
||||
break;
|
||||
case 1:
|
||||
item = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Item::diamond));
|
||||
break;
|
||||
case 2:
|
||||
item = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Item::goldIngot));
|
||||
break;
|
||||
case 3:
|
||||
item = std::shared_ptr<ItemInstance>(
|
||||
new ItemInstance(Item::ironIngot));
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
};
|
||||
if (item != NULL)
|
||||
customDrawSlotControl(region, m_iPad, item, 1.0f, item->isFoil(),
|
||||
true);
|
||||
} else {
|
||||
UIScene_AbstractContainerMenu::customDraw(region);
|
||||
}
|
||||
}
|
||||
|
||||
void UIScene_BeaconMenu::SetConfirmButtonEnabled(bool enabled) {
|
||||
m_buttonConfirm.SetButtonActive(enabled);
|
||||
}
|
||||
|
||||
void UIScene_BeaconMenu::AddPowerButton(int id, int icon, int tier, int count,
|
||||
bool active, bool selected) {
|
||||
switch (tier) {
|
||||
case 0:
|
||||
if (count == 0) {
|
||||
m_buttonsPowers[eControl_Primary1].SetData(id, icon, active,
|
||||
selected);
|
||||
m_buttonsPowers[eControl_Primary1].setVisible(true);
|
||||
} else {
|
||||
m_buttonsPowers[eControl_Primary2].SetData(id, icon, active,
|
||||
selected);
|
||||
m_buttonsPowers[eControl_Primary2].setVisible(true);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (count == 0) {
|
||||
m_buttonsPowers[eControl_Primary3].SetData(id, icon, active,
|
||||
selected);
|
||||
m_buttonsPowers[eControl_Primary3].setVisible(true);
|
||||
} else {
|
||||
m_buttonsPowers[eControl_Primary4].SetData(id, icon, active,
|
||||
selected);
|
||||
m_buttonsPowers[eControl_Primary4].setVisible(true);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
m_buttonsPowers[eControl_Primary5].SetData(id, icon, active,
|
||||
selected);
|
||||
m_buttonsPowers[eControl_Primary5].setVisible(true);
|
||||
break;
|
||||
case 3:
|
||||
if (count == 0) {
|
||||
m_buttonsPowers[eControl_Secondary1].SetData(id, icon, active,
|
||||
selected);
|
||||
m_buttonsPowers[eControl_Secondary1].setVisible(true);
|
||||
} else {
|
||||
m_buttonsPowers[eControl_Secondary2].SetData(id, icon, active,
|
||||
selected);
|
||||
m_buttonsPowers[eControl_Secondary2].setVisible(true);
|
||||
}
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
int UIScene_BeaconMenu::GetPowerButtonId(ESceneSection eSection) {
|
||||
switch (eSection) {
|
||||
case eSectionBeaconPrimaryTierOneOne:
|
||||
return m_buttonsPowers[eControl_Primary1].GetData();
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierOneTwo:
|
||||
return m_buttonsPowers[eControl_Primary2].GetData();
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierTwoOne:
|
||||
return m_buttonsPowers[eControl_Primary3].GetData();
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierTwoTwo:
|
||||
return m_buttonsPowers[eControl_Primary4].GetData();
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierThree:
|
||||
return m_buttonsPowers[eControl_Primary5].GetData();
|
||||
break;
|
||||
case eSectionBeaconSecondaryOne:
|
||||
return m_buttonsPowers[eControl_Secondary1].GetData();
|
||||
break;
|
||||
case eSectionBeaconSecondaryTwo:
|
||||
return m_buttonsPowers[eControl_Secondary2].GetData();
|
||||
break;
|
||||
};
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool UIScene_BeaconMenu::IsPowerButtonSelected(ESceneSection eSection) {
|
||||
switch (eSection) {
|
||||
case eSectionBeaconPrimaryTierOneOne:
|
||||
return m_buttonsPowers[eControl_Primary1].IsButtonSelected();
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierOneTwo:
|
||||
return m_buttonsPowers[eControl_Primary2].IsButtonSelected();
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierTwoOne:
|
||||
return m_buttonsPowers[eControl_Primary3].IsButtonSelected();
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierTwoTwo:
|
||||
return m_buttonsPowers[eControl_Primary4].IsButtonSelected();
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierThree:
|
||||
return m_buttonsPowers[eControl_Primary5].IsButtonSelected();
|
||||
break;
|
||||
case eSectionBeaconSecondaryOne:
|
||||
return m_buttonsPowers[eControl_Secondary1].IsButtonSelected();
|
||||
break;
|
||||
case eSectionBeaconSecondaryTwo:
|
||||
return m_buttonsPowers[eControl_Secondary2].IsButtonSelected();
|
||||
break;
|
||||
};
|
||||
return false;
|
||||
}
|
||||
|
||||
void UIScene_BeaconMenu::SetPowerButtonSelected(ESceneSection eSection) {
|
||||
switch (eSection) {
|
||||
case eSectionBeaconPrimaryTierOneOne:
|
||||
case eSectionBeaconPrimaryTierOneTwo:
|
||||
case eSectionBeaconPrimaryTierTwoOne:
|
||||
case eSectionBeaconPrimaryTierTwoTwo:
|
||||
case eSectionBeaconPrimaryTierThree:
|
||||
m_buttonsPowers[eControl_Primary1].SetButtonSelected(false);
|
||||
m_buttonsPowers[eControl_Primary2].SetButtonSelected(false);
|
||||
m_buttonsPowers[eControl_Primary3].SetButtonSelected(false);
|
||||
m_buttonsPowers[eControl_Primary4].SetButtonSelected(false);
|
||||
m_buttonsPowers[eControl_Primary5].SetButtonSelected(false);
|
||||
break;
|
||||
case eSectionBeaconSecondaryOne:
|
||||
case eSectionBeaconSecondaryTwo:
|
||||
m_buttonsPowers[eControl_Secondary1].SetButtonSelected(false);
|
||||
m_buttonsPowers[eControl_Secondary2].SetButtonSelected(false);
|
||||
break;
|
||||
};
|
||||
|
||||
switch (eSection) {
|
||||
case eSectionBeaconPrimaryTierOneOne:
|
||||
return m_buttonsPowers[eControl_Primary1].SetButtonSelected(true);
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierOneTwo:
|
||||
return m_buttonsPowers[eControl_Primary2].SetButtonSelected(true);
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierTwoOne:
|
||||
return m_buttonsPowers[eControl_Primary3].SetButtonSelected(true);
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierTwoTwo:
|
||||
return m_buttonsPowers[eControl_Primary4].SetButtonSelected(true);
|
||||
break;
|
||||
case eSectionBeaconPrimaryTierThree:
|
||||
return m_buttonsPowers[eControl_Primary5].SetButtonSelected(true);
|
||||
break;
|
||||
case eSectionBeaconSecondaryOne:
|
||||
return m_buttonsPowers[eControl_Secondary1].SetButtonSelected(true);
|
||||
break;
|
||||
case eSectionBeaconSecondaryTwo:
|
||||
return m_buttonsPowers[eControl_Secondary2].SetButtonSelected(true);
|
||||
break;
|
||||
};
|
||||
}
|
||||
74
Minecraft.Client/Platform/Common/UI/UIScene_BeaconMenu.h
Normal file
74
Minecraft.Client/Platform/Common/UI/UIScene_BeaconMenu.h
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
#pragma once
|
||||
|
||||
#include "UIScene_AbstractContainerMenu.h"
|
||||
#include "UIControl_SlotList.h"
|
||||
#include "IUIScene_BeaconMenu.h"
|
||||
|
||||
class UIScene_BeaconMenu : public UIScene_AbstractContainerMenu,
|
||||
public IUIScene_BeaconMenu {
|
||||
private:
|
||||
enum EControls {
|
||||
eControl_Primary1,
|
||||
eControl_Primary2,
|
||||
eControl_Primary3,
|
||||
eControl_Primary4,
|
||||
eControl_Primary5,
|
||||
eControl_Secondary1,
|
||||
eControl_Secondary2,
|
||||
|
||||
eControl_EFFECT_COUNT,
|
||||
};
|
||||
|
||||
public:
|
||||
UIScene_BeaconMenu(int iPad, void* initData, UILayer* parentLayer);
|
||||
|
||||
virtual EUIScene getSceneType() { return eUIScene_BeaconMenu; }
|
||||
|
||||
protected:
|
||||
UIControl_SlotList m_slotListActivator;
|
||||
UIControl_SlotList m_slotListActivatorIcons;
|
||||
UIControl_Label m_labelPrimary, m_labelSecondary;
|
||||
UIControl_BeaconEffectButton m_buttonsPowers[eControl_EFFECT_COUNT];
|
||||
UIControl_BeaconEffectButton m_buttonConfirm;
|
||||
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene_AbstractContainerMenu)
|
||||
UI_BEGIN_MAP_CHILD_ELEMENTS(m_controlMainPanel)
|
||||
UI_MAP_ELEMENT(m_slotListActivator, "ActivatorSlot")
|
||||
UI_MAP_ELEMENT(m_slotListActivatorIcons, "ActivatorList")
|
||||
UI_MAP_ELEMENT(m_buttonsPowers[eControl_Primary1], "Primary_Slot_01")
|
||||
UI_MAP_ELEMENT(m_buttonsPowers[eControl_Primary2], "Primary_Slot_02")
|
||||
UI_MAP_ELEMENT(m_buttonsPowers[eControl_Primary3], "Primary_Slot_03")
|
||||
UI_MAP_ELEMENT(m_buttonsPowers[eControl_Primary4], "Primary_Slot_04")
|
||||
UI_MAP_ELEMENT(m_buttonsPowers[eControl_Primary5], "Primary_Slot_05")
|
||||
UI_MAP_ELEMENT(m_buttonsPowers[eControl_Secondary1], "Secondary_Slot_01")
|
||||
UI_MAP_ELEMENT(m_buttonsPowers[eControl_Secondary2], "Secondary_Slot_02")
|
||||
UI_MAP_ELEMENT(m_buttonConfirm, "ConfirmButton")
|
||||
UI_MAP_ELEMENT(m_labelPrimary, "PrimaryPowerLabel")
|
||||
UI_MAP_ELEMENT(m_labelSecondary, "SecondaryPowerLabel")
|
||||
UI_END_MAP_CHILD_ELEMENTS()
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
|
||||
virtual std::wstring getMoviePath();
|
||||
virtual void handleReload();
|
||||
virtual void tick();
|
||||
virtual int GetBaseSlotCount() { return 4; }
|
||||
|
||||
virtual int getSectionColumns(ESceneSection eSection);
|
||||
virtual int getSectionRows(ESceneSection eSection);
|
||||
virtual void GetPositionOfSection(ESceneSection eSection,
|
||||
UIVec2D* pPosition);
|
||||
virtual void GetItemScreenData(ESceneSection eSection, int iItemIndex,
|
||||
UIVec2D* pPosition, UIVec2D* pSize);
|
||||
virtual void handleSectionClick(ESceneSection eSection) {}
|
||||
virtual void setSectionSelectedSlot(ESceneSection eSection, int x, int y);
|
||||
|
||||
virtual UIControl* getSection(ESceneSection eSection);
|
||||
virtual void customDraw(IggyCustomDrawCallbackRegion* region);
|
||||
|
||||
virtual void SetConfirmButtonEnabled(bool enabled);
|
||||
virtual void AddPowerButton(int id, int icon, int tier, int count,
|
||||
bool active, bool selected);
|
||||
virtual int GetPowerButtonId(ESceneSection eSection);
|
||||
virtual bool IsPowerButtonSelected(ESceneSection eSection);
|
||||
virtual void SetPowerButtonSelected(ESceneSection eSection);
|
||||
};
|
||||
|
|
@ -18,11 +18,11 @@ UIScene_BrewingStandMenu::UIScene_BrewingStandMenu(int iPad, void* _initData,
|
|||
0);
|
||||
m_progressBrewingBubbles.init(L"", 0, 0, 30, 0);
|
||||
|
||||
m_labelBrewingStand.init(app.GetString(IDS_BREWING_STAND));
|
||||
|
||||
BrewingScreenInput* initData = (BrewingScreenInput*)_initData;
|
||||
m_brewingStand = initData->brewingStand;
|
||||
|
||||
m_labelBrewingStand.init(m_brewingStand->getName());
|
||||
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
if (pMinecraft->localgameModes[initData->iPad] != NULL) {
|
||||
TutorialMode* gameMode =
|
||||
|
|
|
|||
|
|
@ -179,9 +179,8 @@ void UIScene_ConnectingProgress::handleTimerComplete(int id) {
|
|||
} else {
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(IDS_CONNECTION_FAILED, exitReasonStringId,
|
||||
uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL,
|
||||
NULL, app.GetStringTable());
|
||||
ui.RequestErrorMessage(IDS_CONNECTION_FAILED, exitReasonStringId,
|
||||
uiIDA, 1, ProfileManager.GetPrimaryPad());
|
||||
exitReasonStringId = -1;
|
||||
|
||||
// app.NavigateToHomeMenu();
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ UIScene_ContainerMenu::UIScene_ContainerMenu(int iPad, void* _initData,
|
|||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
|
||||
m_labelChest.init(app.GetString(initData->container->getName()));
|
||||
m_labelChest.init(initData->container->getName());
|
||||
|
||||
ContainerMenu* menu =
|
||||
new ContainerMenu(initData->inventory, initData->container);
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ UIScene_ControlsMenu::UIScene_ControlsMenu(int iPad, void* initData,
|
|||
}
|
||||
// 4J-PB - stop the label showing in the in-game controls menu
|
||||
else {
|
||||
m_labelVersion.init(" ");
|
||||
m_labelVersion.init(L" ");
|
||||
}
|
||||
m_bCreativeMode =
|
||||
!bNotInGame && Minecraft::GetInstance()->localplayers[m_iPad] &&
|
||||
|
|
|
|||
|
|
@ -201,8 +201,12 @@ void UIScene_CraftingMenu::handleDestroy() {
|
|||
// We need to make sure that we call closeContainer() anytime this menu is
|
||||
// closed, even if it is forced to close by some other reason (like the
|
||||
// player dying)
|
||||
if (Minecraft::GetInstance()->localplayers[m_iPad] != NULL)
|
||||
if (Minecraft::GetInstance()->localplayers[m_iPad] != NULL &&
|
||||
Minecraft::GetInstance()
|
||||
->localplayers[m_iPad]
|
||||
->containerMenu->containerId == m_menu->containerId) {
|
||||
Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
|
||||
}
|
||||
|
||||
ui.OverrideSFX(m_iPad, ACTION_MENU_A, false);
|
||||
ui.OverrideSFX(m_iPad, ACTION_MENU_OK, false);
|
||||
|
|
@ -425,7 +429,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion* region) {
|
|||
float alpha = 1.0f;
|
||||
bool decorations = true;
|
||||
bool inventoryItem = false;
|
||||
int slotId = parseSlotId(region->name);
|
||||
swscanf((wchar_t*)region->name, L"slot_%d", &slotId);
|
||||
if (slotId == -1) {
|
||||
app.DebugPrintf("This is not the control we are looking for\n");
|
||||
} else if (slotId >= CRAFTING_INVENTORY_SLOT_START &&
|
||||
|
|
@ -720,6 +724,18 @@ void UIScene_CraftingMenu::updateHighlightAndScrollPositions() {
|
|||
}
|
||||
}
|
||||
|
||||
void UIScene_CraftingMenu::HandleMessage(EUIMessage message, void* data) {
|
||||
switch (message) {
|
||||
case eUIMessage_InventoryUpdated:
|
||||
handleInventoryUpdated(data);
|
||||
break;
|
||||
};
|
||||
}
|
||||
|
||||
void UIScene_CraftingMenu::handleInventoryUpdated(LPVOID data) {
|
||||
HandleInventoryUpdated();
|
||||
}
|
||||
|
||||
void UIScene_CraftingMenu::updateVSlotPositions(int iSlots, int i) {
|
||||
// Not needed
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,4 +212,12 @@ protected:
|
|||
virtual void updateVSlotPositions(int iSlots, int i);
|
||||
|
||||
virtual void UpdateMultiPanel();
|
||||
|
||||
virtual void HandleMessage(EUIMessage message, void* data);
|
||||
void handleInventoryUpdated(LPVOID data);
|
||||
|
||||
// 4J - TomK If update tooltips is called then make sure the correct parent
|
||||
// is invoked! (both UIScene AND IUIScene_CraftingMenu have an instance of
|
||||
// said function!)
|
||||
virtual void updateTooltips() { IUIScene_CraftingMenu::UpdateTooltips(); }
|
||||
};
|
||||
|
|
|
|||
|
|
@ -42,11 +42,8 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void* initData,
|
|||
m_iPad = iPad;
|
||||
|
||||
m_labelWorldName.init(app.GetString(IDS_WORLD_NAME));
|
||||
m_labelSeed.init(app.GetString(IDS_CREATE_NEW_WORLD_SEED));
|
||||
m_labelRandomSeed.init(app.GetString(IDS_CREATE_NEW_WORLD_RANDOM_SEED));
|
||||
|
||||
m_editWorldName.init(m_worldName, eControl_EditWorldName);
|
||||
m_editSeed.init(L"", eControl_EditSeed);
|
||||
|
||||
m_buttonGamemode.init(app.GetString(IDS_GAMEMODE_SURVIVAL),
|
||||
eControl_GameModeToggle);
|
||||
|
|
@ -80,7 +77,16 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void* initData,
|
|||
m_MoreOptionsParams.bTNT = true;
|
||||
m_MoreOptionsParams.iPad = iPad;
|
||||
|
||||
m_bGameModeSurvival = true;
|
||||
m_MoreOptionsParams.bMobGriefing = true;
|
||||
m_MoreOptionsParams.bKeepInventory = false;
|
||||
m_MoreOptionsParams.bDoMobSpawning = true;
|
||||
m_MoreOptionsParams.bDoMobLoot = true;
|
||||
m_MoreOptionsParams.bDoTileDrops = true;
|
||||
m_MoreOptionsParams.bNaturalRegeneration = true;
|
||||
m_MoreOptionsParams.bDoDaylightCycle = true;
|
||||
|
||||
m_bGameModeCreative = false;
|
||||
m_iGameModeId = GameType::SURVIVAL->getId();
|
||||
m_pDLCPack = NULL;
|
||||
m_bRebuildTouchBoxes = false;
|
||||
|
||||
|
|
@ -126,26 +132,22 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void* initData,
|
|||
}
|
||||
}
|
||||
|
||||
#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64
|
||||
if (getSceneResolution() == eSceneResolution_1080) {
|
||||
// Set up online game checkbox
|
||||
bool bOnlineGame = m_MoreOptionsParams.bOnlineGame;
|
||||
m_checkboxOnline.SetEnable(true);
|
||||
// Set up online game checkbox
|
||||
bool bOnlineGame = m_MoreOptionsParams.bOnlineGame;
|
||||
m_checkboxOnline.SetEnable(true);
|
||||
|
||||
// 4J-PB - to stop an offline game being able to select the online flag
|
||||
if (ProfileManager.IsSignedInLive(m_iPad) == false) {
|
||||
m_checkboxOnline.SetEnable(false);
|
||||
}
|
||||
|
||||
if (m_MoreOptionsParams.bOnlineSettingChangedBySystem) {
|
||||
m_checkboxOnline.SetEnable(false);
|
||||
bOnlineGame = false;
|
||||
}
|
||||
|
||||
m_checkboxOnline.init(app.GetString(IDS_ONLINE_GAME),
|
||||
eControl_OnlineGame, bOnlineGame);
|
||||
// 4J-PB - to stop an offline game being able to select the online flag
|
||||
if (ProfileManager.IsSignedInLive(m_iPad) == false) {
|
||||
m_checkboxOnline.SetEnable(false);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (m_MoreOptionsParams.bOnlineSettingChangedBySystem) {
|
||||
m_checkboxOnline.SetEnable(false);
|
||||
bOnlineGame = false;
|
||||
}
|
||||
|
||||
m_checkboxOnline.init(app.GetString(IDS_ONLINE_GAME), eControl_OnlineGame,
|
||||
bOnlineGame);
|
||||
|
||||
addTimer(GAME_CREATE_ONLINE_TIMER_ID, GAME_CREATE_ONLINE_TIMER_TIME);
|
||||
#if TO_BE_IMPLEMENTED
|
||||
|
|
@ -176,6 +178,8 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void* initData,
|
|||
swprintf(imageName, 64, L"tpack%08x", tp->getId());
|
||||
registerSubstitutionTexture(imageName, imageData, imageBytes);
|
||||
m_texturePackList.addPack(i, imageName);
|
||||
app.DebugPrintf("Adding texture pack %ls at %d\n", imageName,
|
||||
i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -304,12 +308,11 @@ void UIScene_CreateWorldMenu::tick() {
|
|||
uiIDA[0] = IDS_PRO_NOTONLINE_DECLINE;
|
||||
|
||||
// Give the player a warning about the texture pack missing
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_PLAY_OFFLINE, IDS_NO_PLAYSTATIONPLUS, uiIDA, 1,
|
||||
ProfileManager.GetPrimaryPad(),
|
||||
&UIScene_CreateWorldMenu::ContinueOffline,
|
||||
dynamic_cast<UIScene_CreateWorldMenu*>(this),
|
||||
app.GetStringTable(), 0, 0, false);
|
||||
dynamic_cast<UIScene_CreateWorldMenu*>(this));
|
||||
}
|
||||
} break;
|
||||
default:
|
||||
|
|
@ -357,9 +360,9 @@ void UIScene_CreateWorldMenu::handleInput(int iPad, int key, bool repeat,
|
|||
if (pressed && controlHasFocus(m_checkboxOnline.getId()) &&
|
||||
!m_checkboxOnline.IsEnabled()) {
|
||||
unsigned int uiIDA[1] = {IDS_CONFIRM_OK};
|
||||
ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE,
|
||||
IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1,
|
||||
iPad, NULL, NULL, app.GetStringTable());
|
||||
ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE,
|
||||
IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1,
|
||||
iPad);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -371,16 +374,13 @@ void UIScene_CreateWorldMenu::handleInput(int iPad, int key, bool repeat,
|
|||
case ACTION_MENU_OTHER_STICK_DOWN:
|
||||
sendInputToMovie(key, repeat, pressed, released);
|
||||
|
||||
#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64
|
||||
if (getSceneResolution() == eSceneResolution_1080) {
|
||||
bool bOnlineGame = m_checkboxOnline.IsChecked();
|
||||
if (m_MoreOptionsParams.bOnlineGame != bOnlineGame) {
|
||||
m_MoreOptionsParams.bOnlineGame = bOnlineGame;
|
||||
bool bOnlineGame = m_checkboxOnline.IsChecked();
|
||||
if (m_MoreOptionsParams.bOnlineGame != bOnlineGame) {
|
||||
m_MoreOptionsParams.bOnlineGame = bOnlineGame;
|
||||
|
||||
if (!m_MoreOptionsParams.bOnlineGame) {
|
||||
m_MoreOptionsParams.bInviteOnly = false;
|
||||
m_MoreOptionsParams.bAllowFriendsOfFriends = false;
|
||||
}
|
||||
if (!m_MoreOptionsParams.bOnlineGame) {
|
||||
m_MoreOptionsParams.bInviteOnly = false;
|
||||
m_MoreOptionsParams.bAllowFriendsOfFriends = false;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -405,45 +405,21 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId) {
|
|||
&UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback,
|
||||
this, C_4JInput::EKeyboardMode_Default);
|
||||
} break;
|
||||
case eControl_EditSeed: {
|
||||
m_bIgnoreInput = true;
|
||||
#ifdef __PS3__
|
||||
int language = XGetLanguage();
|
||||
switch (language) {
|
||||
case XC_LANGUAGE_JAPANESE:
|
||||
case XC_LANGUAGE_KOREAN:
|
||||
case XC_LANGUAGE_TCHINESE:
|
||||
InputManager.RequestKeyboard(
|
||||
app.GetString(IDS_CREATE_NEW_WORLD_SEED),
|
||||
m_editSeed.getLabel(), 0, 60,
|
||||
&UIScene_CreateWorldMenu::KeyboardCompleteSeedCallback,
|
||||
this, C_4JInput::EKeyboardMode_Default);
|
||||
break;
|
||||
default:
|
||||
// 4J Stu - Use a different keyboard for non-asian languages
|
||||
// so we don't have prediction on
|
||||
InputManager.RequestKeyboard(
|
||||
app.GetString(IDS_CREATE_NEW_WORLD_SEED),
|
||||
m_editSeed.getLabel(), 0, 60,
|
||||
&UIScene_CreateWorldMenu::KeyboardCompleteSeedCallback,
|
||||
this, C_4JInput::EKeyboardMode_Alphabet_Extended);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
InputManager.RequestKeyboard(
|
||||
app.GetString(IDS_CREATE_NEW_WORLD_SEED), m_editSeed.getLabel(),
|
||||
0, 60, &UIScene_CreateWorldMenu::KeyboardCompleteSeedCallback,
|
||||
this, C_4JInput::EKeyboardMode_Default);
|
||||
#endif
|
||||
} break;
|
||||
case eControl_GameModeToggle:
|
||||
if (m_bGameModeSurvival) {
|
||||
m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_CREATIVE));
|
||||
m_bGameModeSurvival = false;
|
||||
} else {
|
||||
m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_SURVIVAL));
|
||||
m_bGameModeSurvival = true;
|
||||
}
|
||||
switch (m_iGameModeId) {
|
||||
case 0: // Survival
|
||||
m_buttonGamemode.setLabel(
|
||||
app.GetString(IDS_GAMEMODE_CREATIVE));
|
||||
m_iGameModeId = GameType::CREATIVE->getId();
|
||||
m_bGameModeCreative = true;
|
||||
break;
|
||||
case 1: // Creative
|
||||
m_buttonGamemode.setLabel(
|
||||
app.GetString(IDS_GAMEMODE_SURVIVAL));
|
||||
m_iGameModeId = GameType::SURVIVAL->getId();
|
||||
m_bGameModeCreative = false;
|
||||
break;
|
||||
};
|
||||
break;
|
||||
case eControl_MoreOptions:
|
||||
ui.NavigateToScene(m_iPad, eUIScene_LaunchMoreOptionsMenu,
|
||||
|
|
@ -517,11 +493,10 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow() {
|
|||
uiIDA[1] = IDS_CONFIRM_CANCEL;
|
||||
|
||||
// Give the player a warning about the texture pack missing
|
||||
ui.RequestMessageBox(IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE,
|
||||
IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 2,
|
||||
ProfileManager.GetPrimaryPad(),
|
||||
&TexturePackDialogReturned, this,
|
||||
app.GetStringTable(), NULL, 0, false);
|
||||
ui.RequestAlertMessage(IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE,
|
||||
IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 2,
|
||||
ProfileManager.GetPrimaryPad(),
|
||||
&TexturePackDialogReturned, this);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -598,21 +573,19 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow() {
|
|||
// trial pack warning
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE,
|
||||
IDS_USING_TRIAL_TEXUREPACK_WARNING, uiIDA,
|
||||
1, m_iPad,
|
||||
&TrialTexturePackWarningReturned, this,
|
||||
app.GetStringTable(), NULL, 0, false);
|
||||
ui.RequestAlertMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE,
|
||||
IDS_USING_TRIAL_TEXUREPACK_WARNING,
|
||||
uiIDA, 1, m_iPad,
|
||||
&TrialTexturePackWarningReturned, this);
|
||||
#elif defined __PS3__ || defined __ORBIS__ || defined(__PSVITA__)
|
||||
// trial pack warning
|
||||
unsigned int uiIDA[2];
|
||||
uiIDA[0] = IDS_CONFIRM_OK;
|
||||
uiIDA[1] = IDS_CONFIRM_CANCEL;
|
||||
ui.RequestMessageBox(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE,
|
||||
IDS_USING_TRIAL_TEXUREPACK_WARNING, uiIDA,
|
||||
2, m_iPad,
|
||||
&TrialTexturePackWarningReturned, this,
|
||||
app.GetStringTable(), NULL, 0, false);
|
||||
ui.RequestAlertMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE,
|
||||
IDS_USING_TRIAL_TEXUREPACK_WARNING,
|
||||
uiIDA, 2, m_iPad,
|
||||
&TrialTexturePackWarningReturned, this);
|
||||
#endif
|
||||
|
||||
#if defined _XBOX_ONE || defined __ORBIS__
|
||||
|
|
@ -685,13 +658,9 @@ void UIScene_CreateWorldMenu::handleTimerComplete(int id) {
|
|||
m_MoreOptionsParams.bAllowFriendsOfFriends = false;
|
||||
}
|
||||
|
||||
#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64
|
||||
if (getSceneResolution() == eSceneResolution_1080) {
|
||||
m_checkboxOnline.SetEnable(bMultiplayerAllowed);
|
||||
m_checkboxOnline.setChecked(
|
||||
m_MoreOptionsParams.bOnlineGame);
|
||||
}
|
||||
#endif
|
||||
m_checkboxOnline.SetEnable(bMultiplayerAllowed);
|
||||
m_checkboxOnline.setChecked(m_MoreOptionsParams.bOnlineGame);
|
||||
|
||||
m_bMultiplayerAllowed = bMultiplayerAllowed;
|
||||
}
|
||||
} break;
|
||||
|
|
@ -741,12 +710,7 @@ void UIScene_CreateWorldMenu::handleTimerComplete(int id) {
|
|||
|
||||
void UIScene_CreateWorldMenu::handleGainFocus(bool navBack) {
|
||||
if (navBack) {
|
||||
#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64
|
||||
if (getSceneResolution() == eSceneResolution_1080) {
|
||||
m_checkboxOnline.setChecked(m_MoreOptionsParams.bOnlineGame);
|
||||
}
|
||||
m_editSeed.setLabel(m_MoreOptionsParams.seed);
|
||||
#endif
|
||||
m_checkboxOnline.setChecked(m_MoreOptionsParams.bOnlineGame);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -756,8 +720,8 @@ int UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback(void* lpParam,
|
|||
pClass->m_bIgnoreInput = false;
|
||||
// 4J HEG - No reason to set value if keyboard was cancelled
|
||||
if (bRes) {
|
||||
std::uint16_t pchText[128];
|
||||
ZeroMemory(pchText, 128 * sizeof(std::uint16_t));
|
||||
uint16_t pchText[128];
|
||||
ZeroMemory(pchText, 128 * sizeof(uint16_t));
|
||||
InputManager.GetText(pchText);
|
||||
|
||||
if (pchText[0] != 0) {
|
||||
|
|
@ -826,19 +790,18 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() {
|
|||
// npAvailability isn't SCE_OK
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_OK;
|
||||
ui.RequestMessageBox(
|
||||
IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1,
|
||||
iPadNotSignedInLive, NULL, NULL, app.GetStringTable());
|
||||
ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE,
|
||||
IDS_CONTENT_RESTRICTION, uiIDA, 1,
|
||||
iPadNotSignedInLive);
|
||||
} else {
|
||||
m_bIgnoreInput = true;
|
||||
unsigned int uiIDA[2];
|
||||
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT;
|
||||
uiIDA[1] = IDS_CANCEL;
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2,
|
||||
iPadNotSignedInLive,
|
||||
&UIScene_CreateWorldMenu::MustSignInReturnedPSN, this,
|
||||
app.GetStringTable(), NULL, 0, false);
|
||||
&UIScene_CreateWorldMenu::MustSignInReturnedPSN, this);
|
||||
}
|
||||
return;
|
||||
/* 4J-PB - Add this after release
|
||||
|
|
@ -849,27 +812,24 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame() {
|
|||
(ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad()))
|
||||
{
|
||||
// Signed in to PSN but not connected (no internet
|
||||
access) unsigned int uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(IDS_PRO_CURRENTLY_NOT_ONLINE_TITLE,
|
||||
IDS_PRO_PSNOFFLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL,NULL,
|
||||
app.GetStringTable());
|
||||
access) UINT uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK;
|
||||
ui.RequestErrorMessage(IDS_PRO_CURRENTLY_NOT_ONLINE_TITLE,
|
||||
IDS_PRO_PSNOFFLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad());
|
||||
}
|
||||
else
|
||||
{
|
||||
// Not signed in to PSN
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE,
|
||||
IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL,NULL,
|
||||
app.GetStringTable()); return;
|
||||
ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE,
|
||||
IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad()); return;
|
||||
}*/
|
||||
#else
|
||||
m_bIgnoreInput = false;
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT,
|
||||
uiIDA, 1, ProfileManager.GetPrimaryPad(), NULL,
|
||||
NULL, app.GetStringTable(), NULL, 0, false);
|
||||
ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT,
|
||||
uiIDA, 1, ProfileManager.GetPrimaryPad());
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -893,6 +853,19 @@ app.GetStringTable()); return;
|
|||
if (bPlayStationPlus == false) {
|
||||
m_bIgnoreInput = false;
|
||||
|
||||
if (ProfileManager.RequestingPlaystationPlus(
|
||||
iPadWithNoPlaystationPlus)) {
|
||||
// MGH - added this so we don't try and upsell when we don't
|
||||
// know if the player has PS Plus yet (if it can't connect to
|
||||
// the PS Plus server).
|
||||
UINT uiIDA[1];
|
||||
uiIDA[0] = IDS_OK;
|
||||
ui.RequestAlertMessage(
|
||||
IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1,
|
||||
ProfileManager.GetPrimaryPad(), NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
// 4J-PB - we're not allowed to show the text Playstation Plus -
|
||||
// have to call the upsell all the time! upsell psplus
|
||||
std::int32_t iResult = sceNpCommerceDialogInitialize();
|
||||
|
|
@ -917,20 +890,20 @@ app.GetStringTable()); return;
|
|||
}
|
||||
#endif
|
||||
|
||||
if (m_bGameModeSurvival != true || m_MoreOptionsParams.bHostPrivileges) {
|
||||
unsigned int uiIDA[2];
|
||||
if (m_bGameModeCreative == true ||
|
||||
m_MoreOptionsParams.bHostPrivileges == TRUE) {
|
||||
uiIDA[0] = IDS_CONFIRM_OK;
|
||||
uiIDA[1] = IDS_CONFIRM_CANCEL;
|
||||
if (m_bGameModeSurvival != true) {
|
||||
ui.RequestMessageBox(
|
||||
if (m_bGameModeCreative == true) {
|
||||
ui.RequestAlertMessage(
|
||||
IDS_TITLE_START_GAME, IDS_CONFIRM_START_CREATIVE, uiIDA, 2,
|
||||
m_iPad, &UIScene_CreateWorldMenu::ConfirmCreateReturned, this,
|
||||
app.GetStringTable(), NULL, 0, false);
|
||||
m_iPad, &UIScene_CreateWorldMenu::ConfirmCreateReturned, this);
|
||||
} else {
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_TITLE_START_GAME, IDS_CONFIRM_START_HOST_PRIVILEGES, uiIDA,
|
||||
2, m_iPad, &UIScene_CreateWorldMenu::ConfirmCreateReturned,
|
||||
this, app.GetStringTable(), NULL, 0, false);
|
||||
this);
|
||||
}
|
||||
} else {
|
||||
// 4J Stu - If we only have one controller connected, then don't show
|
||||
|
|
@ -980,6 +953,19 @@ app.GetStringTable()); return;
|
|||
else if (bPlayStationPlus == false) {
|
||||
m_bIgnoreInput = false;
|
||||
|
||||
if (ProfileManager.RequestingPlaystationPlus(
|
||||
iPadWithNoPlaystationPlus)) {
|
||||
// MGH - added this so we don't try and upsell when we
|
||||
// don't know if the player has PS Plus yet (if it can't
|
||||
// connect to the PS Plus server).
|
||||
UINT uiIDA[1];
|
||||
uiIDA[0] = IDS_OK;
|
||||
ui.RequestAlertMessage(
|
||||
IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1,
|
||||
ProfileManager.GetPrimaryPad(), NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
// 4J-PB - we're not allowed to show the text Playstation Plus -
|
||||
// have to call the upsell all the time! upsell psplus
|
||||
std::int32_t iResult = sceNpCommerceDialogInitialize();
|
||||
|
|
@ -1026,6 +1012,19 @@ app.GetStringTable()); return;
|
|||
else if (isOnlineGame && isSignedInLive &&
|
||||
(bPlayStationPlus == false)) {
|
||||
m_bIgnoreInput = false;
|
||||
if (ProfileManager.RequestingPlaystationPlus(
|
||||
iPadWithNoPlaystationPlus)) {
|
||||
// MGH - added this so we don't try and upsell when we
|
||||
// don't know if the player has PS Plus yet (if it can't
|
||||
// connect to the PS Plus server).
|
||||
UINT uiIDA[1];
|
||||
uiIDA[0] = IDS_OK;
|
||||
ui.RequestAlertMessage(
|
||||
IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1,
|
||||
ProfileManager.GetPrimaryPad(), NULL, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
setVisible(true);
|
||||
|
||||
// 4J-PB - we're not allowed to show the text Playstation Plus -
|
||||
|
|
@ -1176,10 +1175,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass,
|
|||
eGameHostOption_BedrockFog,
|
||||
app.GetGameSettings(pClass->m_iPad, eGameSetting_BedrockFog) ? 1 : 0);
|
||||
|
||||
app.SetGameHostOption(eGameHostOption_GameType,
|
||||
pClass->m_bGameModeSurvival
|
||||
? GameType::SURVIVAL->getId()
|
||||
: GameType::CREATIVE->getId());
|
||||
app.SetGameHostOption(eGameHostOption_GameType, pClass->m_iGameModeId);
|
||||
app.SetGameHostOption(eGameHostOption_LevelType,
|
||||
pClass->m_MoreOptionsParams.bFlatWorld);
|
||||
app.SetGameHostOption(eGameHostOption_Structures,
|
||||
|
|
@ -1202,7 +1198,33 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass,
|
|||
app.SetGameHostOption(eGameHostOption_HostCanBeInvisible,
|
||||
pClass->m_MoreOptionsParams.bHostPrivileges);
|
||||
|
||||
g_NetworkManager.HostGame(localUsersMask, isClientSide, isPrivate,
|
||||
app.SetGameHostOption(eGameHostOption_MobGriefing,
|
||||
pClass->m_MoreOptionsParams.bMobGriefing);
|
||||
app.SetGameHostOption(eGameHostOption_KeepInventory,
|
||||
pClass->m_MoreOptionsParams.bKeepInventory);
|
||||
app.SetGameHostOption(eGameHostOption_DoMobSpawning,
|
||||
pClass->m_MoreOptionsParams.bDoMobSpawning);
|
||||
app.SetGameHostOption(eGameHostOption_DoMobLoot,
|
||||
pClass->m_MoreOptionsParams.bDoMobLoot);
|
||||
app.SetGameHostOption(eGameHostOption_DoTileDrops,
|
||||
pClass->m_MoreOptionsParams.bDoTileDrops);
|
||||
app.SetGameHostOption(eGameHostOption_NaturalRegeneration,
|
||||
pClass->m_MoreOptionsParams.bNaturalRegeneration);
|
||||
app.SetGameHostOption(eGameHostOption_DoDaylightCycle,
|
||||
pClass->m_MoreOptionsParams.bDoDaylightCycle);
|
||||
|
||||
app.SetGameHostOption(eGameHostOption_WasntSaveOwner, false);
|
||||
#ifdef _LARGE_WORLDS
|
||||
app.SetGameHostOption(eGameHostOption_WorldSize,
|
||||
pClass->m_MoreOptionsParams.worldSize +
|
||||
1); // 0 is GAME_HOST_OPTION_WORLDSIZE_UNKNOWN
|
||||
pClass->m_MoreOptionsParams.currentWorldSize =
|
||||
(EGameHostOptionWorldSize)(pClass->m_MoreOptionsParams.worldSize + 1);
|
||||
pClass->m_MoreOptionsParams.newWorldSize =
|
||||
(EGameHostOptionWorldSize)(pClass->m_MoreOptionsParams.worldSize + 1);
|
||||
#endif
|
||||
|
||||
g_NetworkManager.HostGame(dwLocalUsersMask, isClientSide, isPrivate,
|
||||
MINECRAFT_NET_MAX_PLAYERS, 0);
|
||||
|
||||
param->settings = app.GetGameHostOption(eGameHostOption_All);
|
||||
|
|
@ -1211,26 +1233,27 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass,
|
|||
switch (pClass->m_MoreOptionsParams.worldSize) {
|
||||
case 0:
|
||||
// Classic
|
||||
param->xzSize = 1 * 54;
|
||||
param->hellScale = 3;
|
||||
param->xzSize = LEVEL_WIDTH_CLASSIC;
|
||||
param->hellScale =
|
||||
HELL_LEVEL_SCALE_CLASSIC; // hellsize = 54/3 = 18
|
||||
break;
|
||||
case 1:
|
||||
// Small
|
||||
param->xzSize = 1 * 64;
|
||||
param->hellScale = 3;
|
||||
param->xzSize = LEVEL_WIDTH_SMALL;
|
||||
param->hellScale =
|
||||
HELL_LEVEL_SCALE_SMALL; // hellsize = ceil(64/3) = 22
|
||||
break;
|
||||
case 2:
|
||||
// Medium
|
||||
param->xzSize = 3 * 64;
|
||||
param->hellScale = 6;
|
||||
param->xzSize = LEVEL_WIDTH_MEDIUM;
|
||||
param->hellScale =
|
||||
HELL_LEVEL_SCALE_MEDIUM; // hellsize= ceil(3*64/6) = 32
|
||||
break;
|
||||
case 3:
|
||||
// param->xzSize = 5 * 64;
|
||||
// param->hellScale = 8;
|
||||
|
||||
// Large
|
||||
param->xzSize = LEVEL_MAX_WIDTH;
|
||||
param->hellScale = HELL_LEVEL_MAX_SCALE;
|
||||
param->xzSize = LEVEL_WIDTH_LARGE;
|
||||
param->hellScale =
|
||||
HELL_LEVEL_SCALE_LARGE; // hellsize = ceil(5*64/8) = 40
|
||||
break;
|
||||
};
|
||||
#else
|
||||
|
|
@ -1314,30 +1337,28 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void* pParam,
|
|||
// npAvailability isn't SCE_OK
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_OK;
|
||||
ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE,
|
||||
IDS_CONTENT_RESTRICTION, uiIDA, 1,
|
||||
iPadNotSignedInLive, NULL, NULL,
|
||||
app.GetStringTable());
|
||||
ui.RequestAlertMessage(IDS_ONLINE_SERVICE_TITLE,
|
||||
IDS_CONTENT_RESTRICTION, uiIDA, 1,
|
||||
iPadNotSignedInLive);
|
||||
} else {
|
||||
pClass->m_bIgnoreInput = true;
|
||||
unsigned int uiIDA[2];
|
||||
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT;
|
||||
uiIDA[1] = IDS_CANCEL;
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA,
|
||||
2, iPadNotSignedInLive,
|
||||
&UIScene_CreateWorldMenu::MustSignInReturnedPSN, pClass,
|
||||
app.GetStringTable(), NULL, 0, false);
|
||||
&UIScene_CreateWorldMenu::MustSignInReturnedPSN,
|
||||
pClass);
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
pClass->m_bIgnoreInput = false;
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE,
|
||||
IDS_PRO_NOTONLINE_TEXT, uiIDA, 1,
|
||||
ProfileManager.GetPrimaryPad(), NULL, NULL,
|
||||
app.GetStringTable(), NULL, 0, false);
|
||||
ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE,
|
||||
IDS_PRO_NOTONLINE_TEXT, uiIDA, 1,
|
||||
ProfileManager.GetPrimaryPad());
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
|
@ -1358,20 +1379,18 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void* pParam,
|
|||
pClass->m_bIgnoreInput = false;
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_FAILED_TO_CREATE_GAME_TITLE,
|
||||
IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA, 1,
|
||||
ProfileManager.GetPrimaryPad(), NULL, NULL,
|
||||
app.GetStringTable(), NULL, 0, false);
|
||||
ProfileManager.GetPrimaryPad());
|
||||
} else {
|
||||
pClass->m_bIgnoreInput = false;
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE,
|
||||
IDS_NO_MULTIPLAYER_PRIVILEGE_HOST_TEXT, uiIDA, 1,
|
||||
ProfileManager.GetPrimaryPad(), NULL, NULL,
|
||||
app.GetStringTable(), NULL, 0, false);
|
||||
ProfileManager.GetPrimaryPad());
|
||||
}
|
||||
} else {
|
||||
// This is NOT called from a storage manager thread, and is in
|
||||
|
|
@ -1432,11 +1451,10 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned(
|
|||
pClass->m_bIgnoreInput = false;
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_FAILED_TO_CREATE_GAME_TITLE,
|
||||
IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA, 1,
|
||||
ProfileManager.GetPrimaryPad(), NULL, NULL,
|
||||
app.GetStringTable(), NULL, 0, false);
|
||||
ProfileManager.GetPrimaryPad());
|
||||
} else {
|
||||
#if defined(__ORBIS__) || defined(__PSVITA__)
|
||||
bool isOnlineGame = ProfileManager.IsSignedInLive(
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ class UIScene_CreateWorldMenu : public IUIScene_StartGame {
|
|||
private:
|
||||
enum EControls {
|
||||
eControl_EditWorldName,
|
||||
eControl_EditSeed,
|
||||
eControl_TexturePackList,
|
||||
eControl_GameModeToggle,
|
||||
eControl_Difficulty,
|
||||
|
|
@ -21,14 +20,11 @@ private:
|
|||
std::wstring m_seed;
|
||||
|
||||
UIControl m_controlMainPanel;
|
||||
UIControl_Label m_labelWorldName, m_labelSeed, m_labelRandomSeed;
|
||||
UIControl_Label m_labelWorldName;
|
||||
UIControl_Button m_buttonGamemode, m_buttonMoreOptions, m_buttonCreateWorld;
|
||||
UIControl_TextInput m_editWorldName, m_editSeed;
|
||||
UIControl_TextInput m_editWorldName;
|
||||
UIControl_Slider m_sliderDifficulty;
|
||||
|
||||
#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64
|
||||
UIControl_CheckBox m_checkboxOnline;
|
||||
#endif
|
||||
|
||||
UIControl_BitmapIcon m_bitmapIcon, m_bitmapComparison;
|
||||
|
||||
|
|
@ -37,22 +33,17 @@ private:
|
|||
UI_BEGIN_MAP_CHILD_ELEMENTS(m_controlMainPanel)
|
||||
UI_MAP_ELEMENT(m_labelWorldName, "WorldName")
|
||||
UI_MAP_ELEMENT(m_editWorldName, "EditWorldName")
|
||||
UI_MAP_ELEMENT(m_labelSeed, "Seed")
|
||||
UI_MAP_ELEMENT(m_editSeed, "EditSeed")
|
||||
UI_MAP_ELEMENT(m_labelRandomSeed, "RandomSeed")
|
||||
UI_MAP_ELEMENT(m_texturePackList, "TexturePackSelector")
|
||||
UI_MAP_ELEMENT(m_buttonGamemode, "GameModeToggle")
|
||||
|
||||
#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64
|
||||
UI_MAP_ELEMENT(m_checkboxOnline, "CheckboxOnline")
|
||||
#endif
|
||||
UI_MAP_ELEMENT(m_buttonMoreOptions, "MoreOptions")
|
||||
UI_MAP_ELEMENT(m_buttonCreateWorld, "NewWorld")
|
||||
UI_MAP_ELEMENT(m_sliderDifficulty, "Difficulty")
|
||||
UI_END_MAP_CHILD_ELEMENTS()
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
|
||||
bool m_bGameModeSurvival;
|
||||
bool m_bGameModeCreative;
|
||||
int m_iGameModeId;
|
||||
bool m_bMultiplayerAllowed;
|
||||
DLCPack* m_pDLCPack;
|
||||
bool m_bRebuildTouchBoxes;
|
||||
|
|
@ -97,11 +88,11 @@ private:
|
|||
protected:
|
||||
static int KeyboardCompleteWorldNameCallback(void* lpParam,
|
||||
const bool bRes);
|
||||
static int KeyboardCompleteSeedCallback(void* lpParam, const bool bRes);
|
||||
void handlePress(F64 controlId, F64 childId);
|
||||
void handleSliderMove(F64 sliderId, F64 currentValue);
|
||||
|
||||
static void CreateGame(UIScene_CreateWorldMenu* pClass, int localUsersMask);
|
||||
static void CreateGame(UIScene_CreateWorldMenu* pClass,
|
||||
DWORD dwLocalUsersMask);
|
||||
static int ConfirmCreateReturned(void* pParam, int iPad,
|
||||
C4JStorage::EMessageResult result);
|
||||
static int StartGame_SignInReturned(void* pParam, bool bContinue, int iPad);
|
||||
|
|
@ -116,4 +107,4 @@ protected:
|
|||
#endif
|
||||
|
||||
virtual void checkStateAndStartGame();
|
||||
};
|
||||
};
|
||||
|
|
@ -24,7 +24,7 @@ UIScene_CreativeMenu::UIScene_CreativeMenu(int iPad, void* _initData,
|
|||
|
||||
std::shared_ptr<SimpleContainer> creativeContainer =
|
||||
std::shared_ptr<SimpleContainer>(
|
||||
new SimpleContainer(0, TabSpec::MAX_SIZE));
|
||||
new SimpleContainer(0, L"", false, TabSpec::MAX_SIZE));
|
||||
itemPickerMenu =
|
||||
new ItemPickerMenu(creativeContainer, initData->player->inventory);
|
||||
|
||||
|
|
@ -160,28 +160,6 @@ void UIScene_CreativeMenu::handleOtherClicked(int iPad, ESceneSection eSection,
|
|||
}
|
||||
}
|
||||
|
||||
void UIScene_CreativeMenu::ScrollBar(UIVec2D pointerPos) {
|
||||
float fPosition = ((float)pointerPos.y -
|
||||
(float)m_TouchInput[ETouchInput_TouchSlider].getYPos()) /
|
||||
(float)m_TouchInput[ETouchInput_TouchSlider].getHeight();
|
||||
|
||||
// clamp
|
||||
if (fPosition > 1)
|
||||
fPosition = 1.0f;
|
||||
else if (fPosition < 0)
|
||||
fPosition = 0.0f;
|
||||
|
||||
// calculate page position according to page count
|
||||
int iCurrentPage =
|
||||
Math::round(fPosition * (specs[m_curTab]->getPageCount() - 1));
|
||||
|
||||
// set tab page
|
||||
m_tabPage[m_curTab] = iCurrentPage;
|
||||
|
||||
// update tab
|
||||
switchTab(m_curTab);
|
||||
}
|
||||
|
||||
void UIScene_CreativeMenu::handleReload() {
|
||||
Initialize(m_iPad, m_menu, false, -1, eSectionInventoryCreativeUsing,
|
||||
eSectionInventoryCreativeMax, m_bNavigateBack);
|
||||
|
|
@ -193,6 +171,10 @@ void UIScene_CreativeMenu::handleReload() {
|
|||
for (unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i) {
|
||||
m_slotListHotbar.addSlot(i);
|
||||
}
|
||||
|
||||
ECreativeInventoryTabs lastTab = m_curTab;
|
||||
m_curTab = eCreativeInventoryTab_COUNT;
|
||||
switchTab(lastTab);
|
||||
}
|
||||
|
||||
void UIScene_CreativeMenu::handleInput(int iPad, int key, bool repeat,
|
||||
|
|
@ -491,4 +473,4 @@ void UIScene_CreativeMenu::updateScrollCurrentPage(int currentPage,
|
|||
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result,
|
||||
IggyPlayerRootPath(getMovie()),
|
||||
m_funcSetScrollBar, 2, value);
|
||||
}
|
||||
}
|
||||
|
|
@ -84,7 +84,6 @@ public:
|
|||
virtual void handleTouchBoxRebuild();
|
||||
virtual void handleTimerComplete(int id);
|
||||
#endif
|
||||
virtual void ScrollBar(UIVec2D pointerPos);
|
||||
|
||||
private:
|
||||
// IUIScene_CreativeMenu
|
||||
|
|
|
|||
|
|
@ -62,6 +62,18 @@ SCreditTextItemDef UIScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] = {
|
|||
eSmallText},
|
||||
{L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,
|
||||
eSmallText}, // extra blank line
|
||||
|
||||
// Added credit for horses
|
||||
{L"Developers of Mo' Creatures:", NO_TRANSLATED_STRING,
|
||||
NO_TRANSLATED_STRING, eExtraLargeText},
|
||||
{L"John Olarte (DrZhark)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,
|
||||
eSmallText},
|
||||
{L"Kent Christian Jensen", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,
|
||||
eSmallText},
|
||||
{L"Dan Roque", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING, eSmallText},
|
||||
{L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,
|
||||
eSmallText}, // extra blank line
|
||||
|
||||
{L"4J Studios", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,
|
||||
eExtraLargeText},
|
||||
{L"%ls", IDS_CREDITS_PROGRAMMING, NO_TRANSLATED_STRING, eLargeText},
|
||||
|
|
@ -758,19 +770,35 @@ void UIScene_Credits::tick() {
|
|||
{
|
||||
if (pDef->m_iStringID[0] == CREDIT_ICON) {
|
||||
addImage((ECreditIcons)pDef->m_iStringID[1]);
|
||||
} else if (pDef->m_iStringID[0] == NO_TRANSLATED_STRING) {
|
||||
setNextLabel(pDef->m_Text, pDef->m_eType);
|
||||
} else // using additional translated string.
|
||||
{
|
||||
std::wstring sanitisedString = std::wstring(pDef->m_Text);
|
||||
|
||||
// 4J-JEV: Some DLC credits contain copyright or registered
|
||||
// symbols that are not rendered in some fonts.
|
||||
if (!ui.UsingBitmapFont()) {
|
||||
sanitisedString =
|
||||
replaceAll(sanitisedString, L"\u00A9", L"(C)");
|
||||
sanitisedString =
|
||||
replaceAll(sanitisedString, L"\u00AE", L"(R)");
|
||||
sanitisedString =
|
||||
replaceAll(sanitisedString, L"\u2013", L"-");
|
||||
}
|
||||
|
||||
LPWSTR creditsString = new wchar_t[128];
|
||||
if (pDef->m_iStringID[1] != NO_TRANSLATED_STRING) {
|
||||
swprintf(creditsString, 128, pDef->m_Text,
|
||||
if (pDef->m_iStringID[0] == NO_TRANSLATED_STRING) {
|
||||
ZeroMemory(creditsString, 128);
|
||||
memcpy(creditsString, sanitisedString.c_str(),
|
||||
sizeof(WCHAR) * sanitisedString.length());
|
||||
} else if (pDef->m_iStringID[1] != NO_TRANSLATED_STRING) {
|
||||
swprintf(creditsString, 128, sanitisedString.c_str(),
|
||||
app.GetString(pDef->m_iStringID[0]),
|
||||
app.GetString(pDef->m_iStringID[1]));
|
||||
} else {
|
||||
swprintf(creditsString, 128, pDef->m_Text,
|
||||
swprintf(creditsString, 128, sanitisedString.c_str(),
|
||||
app.GetString(pDef->m_iStringID[0]));
|
||||
}
|
||||
|
||||
setNextLabel(creditsString, pDef->m_eType);
|
||||
delete[] creditsString;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
#include "UIScene.h"
|
||||
|
||||
#define PS3_CREDITS_COUNT 75
|
||||
#define PSVITA_CREDITS_COUNT 77
|
||||
#define PS4_CREDITS_COUNT 75
|
||||
#define XBOXONE_CREDITS_COUNT (75 + 318)
|
||||
#define PS3_CREDITS_COUNT 80
|
||||
#define PSVITA_CREDITS_COUNT 82
|
||||
#define PS4_CREDITS_COUNT 80
|
||||
#define XBOXONE_CREDITS_COUNT (80 + 318)
|
||||
#define MILES_AND_IGGY_CREDITS_COUNT 8
|
||||
#define DYNAMODE_FONT_CREDITS_COUNT 2
|
||||
#define PS3_DOLBY_CREDIT 4
|
||||
|
|
@ -18,10 +18,7 @@
|
|||
#define MAX_CREDIT_STRINGS \
|
||||
(PS4_CREDITS_COUNT + MILES_AND_IGGY_CREDITS_COUNT + \
|
||||
DYNAMODE_FONT_CREDITS_COUNT)
|
||||
#elif defined(_DURANGO) || defined _WIN64
|
||||
#define MAX_CREDIT_STRINGS \
|
||||
(XBOXONE_CREDITS_COUNT + MILES_AND_IGGY_CREDITS_COUNT)
|
||||
#elif defined(__linux__)
|
||||
#elif defined(_DURANGO) || defined _WINDOWS64 || defined __linux__
|
||||
#define MAX_CREDIT_STRINGS \
|
||||
(XBOXONE_CREDITS_COUNT + MILES_AND_IGGY_CREDITS_COUNT)
|
||||
#elif defined(__PSVITA__)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ UIScene_DLCMainMenu::UIScene_DLCMainMenu(int iPad, void* initData,
|
|||
// Alert the app the we want to be informed of ethernet connections
|
||||
app.SetLiveLinkRequired(true);
|
||||
|
||||
m_labelOffers.init(app.GetString(IDS_DOWNLOADABLE_CONTENT_OFFERS));
|
||||
m_labelOffers.init(IDS_DOWNLOADABLE_CONTENT_OFFERS);
|
||||
m_buttonListOffers.init(eControl_OffersList);
|
||||
|
||||
#if defined _XBOX_ONE || defined __ORBIS__
|
||||
|
|
@ -33,7 +33,7 @@ UIScene_DLCMainMenu::UIScene_DLCMainMenu(int iPad, void* initData,
|
|||
|
||||
if (m_loadedResolution == eSceneResolution_1080) {
|
||||
#ifdef _DURANGO
|
||||
m_labelXboxStore.init(app.GetString(IDS_XBOX_STORE));
|
||||
m_labelXboxStore.init(IDS_XBOX_STORE);
|
||||
#else
|
||||
m_labelXboxStore.init(L"");
|
||||
#endif
|
||||
|
|
@ -42,12 +42,9 @@ UIScene_DLCMainMenu::UIScene_DLCMainMenu(int iPad, void* initData,
|
|||
#if defined(_DURANGO)
|
||||
m_Timer.setVisible(false);
|
||||
|
||||
m_buttonListOffers.addItem(app.GetString(IDS_DLC_MENU_SKINPACKS),
|
||||
e_DLC_SkinPack);
|
||||
m_buttonListOffers.addItem(app.GetString(IDS_DLC_MENU_TEXTUREPACKS),
|
||||
e_DLC_TexturePacks);
|
||||
m_buttonListOffers.addItem(app.GetString(IDS_DLC_MENU_MASHUPPACKS),
|
||||
e_DLC_MashupPacks);
|
||||
m_buttonListOffers.addItem(IDS_DLC_MENU_SKINPACKS, e_DLC_SkinPack);
|
||||
m_buttonListOffers.addItem(IDS_DLC_MENU_TEXTUREPACKS, e_DLC_TexturePacks);
|
||||
m_buttonListOffers.addItem(IDS_DLC_MENU_MASHUPPACKS, e_DLC_MashupPacks);
|
||||
|
||||
app.AddDLCRequest(e_Marketplace_Content); // content is skin packs, texture
|
||||
// packs and mash-up packs
|
||||
|
|
@ -57,10 +54,8 @@ UIScene_DLCMainMenu::UIScene_DLCMainMenu(int iPad, void* initData,
|
|||
|
||||
TelemetryManager->RecordMenuShown(iPad, eUIScene_DLCMainMenu, 0);
|
||||
|
||||
#ifdef __ORBIS__
|
||||
sceNpCommerceShowPsStoreIcon(SCE_NP_COMMERCE_PS_STORE_ICON_RIGHT);
|
||||
#elif defined __PSVITA__
|
||||
sceNpCommerce2ShowPsStoreIcon(SCE_NP_COMMERCE2_ICON_DISP_RIGHT);
|
||||
#if defined __ORBIS__ || defined __PSVITA__
|
||||
app.GetCommerce()->ShowPsStoreIcon();
|
||||
#endif
|
||||
|
||||
#if (defined __PS3__ || defined __ORBIS__ || defined __PSVITA__)
|
||||
|
|
@ -75,6 +70,11 @@ UIScene_DLCMainMenu::~UIScene_DLCMainMenu() {
|
|||
#if defined _XBOX_ONE || defined __ORBIS__
|
||||
app.FreeLocalDLCImages();
|
||||
#endif
|
||||
|
||||
#ifdef _XBOX_ONE
|
||||
// 4J-JEV: Have to switch back to user preferred languge now.
|
||||
setLanguageOverride(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::wstring UIScene_DLCMainMenu::getMoviePath() { return L"DLCMainMenu"; }
|
||||
|
|
@ -94,10 +94,8 @@ void UIScene_DLCMainMenu::handleInput(int iPad, int key, bool repeat,
|
|||
switch (key) {
|
||||
case ACTION_MENU_CANCEL:
|
||||
if (pressed) {
|
||||
#ifdef __ORBIS__
|
||||
sceNpCommerceHidePsStoreIcon();
|
||||
#elif defined __PSVITA__
|
||||
sceNpCommerce2HidePsStoreIcon();
|
||||
#if defined __ORBIS__ || defined __PSVITA__
|
||||
app.GetCommerce()->HidePsStoreIcon();
|
||||
#endif
|
||||
navigateBack();
|
||||
}
|
||||
|
|
@ -153,13 +151,12 @@ void UIScene_DLCMainMenu::handleTimerComplete(int id) {
|
|||
// leaderboards
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_OK;
|
||||
C4JStorage::EMessageResult result = ui.RequestMessageBox(
|
||||
C4JStorage::EMessageResult result = ui.RequestErrorMessage(
|
||||
IDS_CONNECTION_LOST,
|
||||
g_NetworkManager.CorrectErrorIDS(
|
||||
IDS_CONNECTION_LOST_LIVE_NO_EXIT),
|
||||
uiIDA, 1, ProfileManager.GetPrimaryPad(),
|
||||
UIScene_DLCMainMenu::ExitDLCMainMenu, this,
|
||||
app.GetStringTable());
|
||||
UIScene_DLCMainMenu::ExitDLCMainMenu, this);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
|
@ -171,10 +168,8 @@ int UIScene_DLCMainMenu::ExitDLCMainMenu(void* pParam, int iPad,
|
|||
C4JStorage::EMessageResult result) {
|
||||
UIScene_DLCMainMenu* pClass = (UIScene_DLCMainMenu*)pParam;
|
||||
|
||||
#ifdef __ORBIS__
|
||||
sceNpCommerceHidePsStoreIcon();
|
||||
#elif defined __PSVITA__
|
||||
sceNpCommerce2HidePsStoreIcon();
|
||||
#if defined __ORBIS__ || defined __PSVITA__
|
||||
app.GetCommerce()->HidePsStoreIcon();
|
||||
#endif
|
||||
pClass->navigateBack();
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ private:
|
|||
eControl_OffersList,
|
||||
};
|
||||
|
||||
UIControl_ButtonList m_buttonListOffers;
|
||||
UIControl_DynamicButtonList m_buttonListOffers;
|
||||
UIControl_Label m_labelOffers, m_labelXboxStore;
|
||||
UIControl m_Timer;
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
|
|
|
|||
|
|
@ -35,8 +35,8 @@ UIScene_DLCOffersMenu::UIScene_DLCOffersMenu(int iPad, void* initData,
|
|||
|
||||
m_labelOffers.init(app.GetString(IDS_DOWNLOADABLE_CONTENT_OFFERS));
|
||||
m_buttonListOffers.init(eControl_OffersList);
|
||||
m_labelHTMLSellText.init(" ");
|
||||
m_labelPriceTag.init(" ");
|
||||
m_labelHTMLSellText.init(L" ");
|
||||
m_labelPriceTag.init(L" ");
|
||||
TelemetryManager->RecordMenuShown(m_iPad, eUIScene_DLCOffersMenu, 0);
|
||||
|
||||
m_bHasPurchased = false;
|
||||
|
|
@ -92,13 +92,12 @@ void UIScene_DLCOffersMenu::handleTimerComplete(int id) {
|
|||
// menu
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_OK;
|
||||
C4JStorage::EMessageResult result = ui.RequestMessageBox(
|
||||
C4JStorage::EMessageResult result = ui.RequestErrorMessage(
|
||||
IDS_CONNECTION_LOST,
|
||||
g_NetworkManager.CorrectErrorIDS(
|
||||
IDS_CONNECTION_LOST_LIVE_NO_EXIT),
|
||||
uiIDA, 1, ProfileManager.GetPrimaryPad(),
|
||||
UIScene_DLCOffersMenu::ExitDLCOffersMenu, this,
|
||||
app.GetStringTable());
|
||||
UIScene_DLCOffersMenu::ExitDLCOffersMenu, this);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
|
@ -110,10 +109,8 @@ int UIScene_DLCOffersMenu::ExitDLCOffersMenu(
|
|||
void* pParam, int iPad, C4JStorage::EMessageResult result) {
|
||||
UIScene_DLCOffersMenu* pClass = (UIScene_DLCOffersMenu*)pParam;
|
||||
|
||||
#ifdef __ORBIS__
|
||||
sceNpCommerceHidePsStoreIcon();
|
||||
#elif defined __PSVITA__
|
||||
sceNpCommerce2HidePsStoreIcon();
|
||||
#if defined __ORBIS__ || defined __PSVITA__
|
||||
app.GetCommerce()->HidePsStoreIcon();
|
||||
#endif
|
||||
ui.NavigateToHomeMenu(); // iPad,eUIScene_MainMenu);
|
||||
|
||||
|
|
@ -284,7 +281,7 @@ void UIScene_DLCOffersMenu::handlePress(F64 controlId, F64 childId) {
|
|||
|
||||
ULONGLONG ullIndexA[1];
|
||||
ullIndexA[0] = StorageManager.GetOffer(iIndex).qwOfferID;
|
||||
StorageManager.InstallOffer(1, (__uint64*)ullIndexA, NULL, NULL);
|
||||
StorageManager.InstallOffer(1, ullIndexA, NULL, NULL);
|
||||
#endif
|
||||
} break;
|
||||
}
|
||||
|
|
@ -439,7 +436,7 @@ void UIScene_DLCOffersMenu::tick() {
|
|||
|
||||
if (hasRegisteredSubstitutionTexture(textureName) ==
|
||||
false) {
|
||||
std::uint8_t* pbImageData = NULL;
|
||||
PBYTE pbImageData;
|
||||
int iImageDataBytes = 0;
|
||||
bool bDeleteData;
|
||||
#ifdef __ORBIS__
|
||||
|
|
@ -448,7 +445,7 @@ void UIScene_DLCOffersMenu::tick() {
|
|||
app.GetSONYDLCInfoFromKeyname(info.productId);
|
||||
|
||||
// does the DLC info have an image?
|
||||
if (pSONYDLCInfo->dwImageBytes != 0) {
|
||||
if (pSONYDLCInfo && pSONYDLCInfo->dwImageBytes != 0) {
|
||||
pbImageData = pSONYDLCInfo->pbImageData;
|
||||
iImageDataBytes = pSONYDLCInfo->dwImageBytes;
|
||||
bDeleteData =
|
||||
|
|
@ -560,7 +557,7 @@ void UIScene_DLCOffersMenu::tick() {
|
|||
std::wstring textureName = filenametostd::wstring(info.imageUrl);
|
||||
|
||||
if (hasRegisteredSubstitutionTexture(textureName) == false) {
|
||||
std::uint8_t* pbImageData = NULL;
|
||||
PBYTE pbImageData;
|
||||
int iImageDataBytes = 0;
|
||||
bool bDeleteData;
|
||||
#ifdef __ORBIS__
|
||||
|
|
@ -628,6 +625,18 @@ void UIScene_DLCOffersMenu::tick() {
|
|||
MARKETPLACE_CONTENTOFFER_INFO xOffer =
|
||||
StorageManager.GetOffer(iIndex);
|
||||
|
||||
if (!ui.UsingBitmapFont()) // 4J-JEV: Replace characters we don't
|
||||
// have.
|
||||
{
|
||||
for (int i = 0; xOffer.wszCurrencyPrice[i] != 0; i++) {
|
||||
WCHAR* c = &xOffer.wszCurrencyPrice[i];
|
||||
if (*c == L'\u20A9')
|
||||
*c = L'\uFFE6'; // Korean Won.
|
||||
else if (*c == L'\u00A5')
|
||||
*c = L'\uFFE5'; // Japanese Yen.
|
||||
}
|
||||
}
|
||||
|
||||
if (UpdateDisplay(xOffer)) {
|
||||
// image was available
|
||||
m_bSelectionChanged = false;
|
||||
|
|
@ -710,7 +719,8 @@ void UIScene_DLCOffersMenu::GetDLCInfo(int iOfferC, bool bUpdateOnly) {
|
|||
|
||||
if (wcsncmp(L"Minecraft ", wstrTemp.c_str(), 10) == 0) {
|
||||
app.DebugPrintf("Removing Minecraft from name\n");
|
||||
wstrTemp = wstrTemp.substr(10);
|
||||
WCHAR* pwchNewName = (WCHAR*)wstrTemp.c_str();
|
||||
wstrTemp = &pwchNewName[10];
|
||||
}
|
||||
|
||||
#ifdef _XBOX_ONE
|
||||
|
|
@ -792,7 +802,7 @@ bool UIScene_DLCOffersMenu::UpdateDisplay(
|
|||
#endif
|
||||
|
||||
if (dlc != NULL) {
|
||||
wchar_t* cString = dlc->wchBanner;
|
||||
WCHAR* cString = dlc->wchBanner;
|
||||
|
||||
// is the file in the local DLC images?
|
||||
// is the file in the TMS XZP?
|
||||
|
|
@ -819,8 +829,8 @@ bool UIScene_DLCOffersMenu::UpdateDisplay(
|
|||
// m_bitmapIconOfferImage.setTextureName(L"");
|
||||
} else {
|
||||
if (hasRegisteredSubstitutionTexture(cString) == false) {
|
||||
std::uint8_t* pData = NULL;
|
||||
unsigned int dwSize = 0;
|
||||
BYTE* pData = NULL;
|
||||
DWORD dwSize = 0;
|
||||
app.GetMemFileDetails(cString, &pData, &dwSize);
|
||||
// set the image
|
||||
#ifdef _XBOX_ONE
|
||||
|
|
|
|||
|
|
@ -108,49 +108,49 @@ void UIScene_DeathMenu::handlePress(F64 controlId, F64 childId) {
|
|||
uiIDA[1] = IDS_EXIT_GAME_SAVE;
|
||||
uiIDA[2] = IDS_EXIT_GAME_NO_SAVE;
|
||||
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3,
|
||||
m_iPad,
|
||||
&IUIScene_PauseMenu::ExitGameSaveDialogReturned,
|
||||
this, app.GetStringTable(), 0, 0, false);
|
||||
(LPVOID)GetCallbackUniqueId());
|
||||
} else {
|
||||
uiIDA[0] = IDS_CONFIRM_CANCEL;
|
||||
uiIDA[1] = IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2,
|
||||
m_iPad, &IUIScene_PauseMenu::ExitGameDialogReturned,
|
||||
this, app.GetStringTable(), 0, 0, false);
|
||||
(LPVOID)GetCallbackUniqueId());
|
||||
}
|
||||
|
||||
#else
|
||||
if (StorageManager.GetSaveDisabled()) {
|
||||
uiIDA[0] = IDS_CONFIRM_CANCEL;
|
||||
uiIDA[1] = IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_PROGRESS_LOST,
|
||||
uiIDA, 2, m_iPad,
|
||||
&IUIScene_PauseMenu::ExitGameDialogReturned, this,
|
||||
app.GetStringTable(), 0, 0, false);
|
||||
&IUIScene_PauseMenu::ExitGameDialogReturned,
|
||||
(LPVOID)GetCallbackUniqueId());
|
||||
} else {
|
||||
if (g_NetworkManager.IsHost()) {
|
||||
uiIDA[0] = IDS_CONFIRM_CANCEL;
|
||||
uiIDA[1] = IDS_EXIT_GAME_SAVE;
|
||||
uiIDA[2] = IDS_EXIT_GAME_NO_SAVE;
|
||||
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3,
|
||||
m_iPad,
|
||||
&IUIScene_PauseMenu::ExitGameSaveDialogReturned,
|
||||
this, app.GetStringTable(), 0, 0, false);
|
||||
(LPVOID)GetCallbackUniqueId());
|
||||
} else {
|
||||
uiIDA[0] = IDS_CONFIRM_CANCEL;
|
||||
uiIDA[1] = IDS_CONFIRM_OK;
|
||||
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2,
|
||||
m_iPad,
|
||||
&IUIScene_PauseMenu::ExitGameDialogReturned,
|
||||
this, app.GetStringTable(), 0, 0, false);
|
||||
(LPVOID)GetCallbackUniqueId());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
@ -174,11 +174,11 @@ void UIScene_DeathMenu::handlePress(F64 controlId, F64 childId) {
|
|||
unsigned int uiIDA[2];
|
||||
uiIDA[0] = IDS_CONFIRM_CANCEL;
|
||||
uiIDA[1] = IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestAlertMessage(
|
||||
IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_PROGRESS_LOST,
|
||||
uiIDA, 2, m_iPad,
|
||||
&IUIScene_PauseMenu::ExitGameDialogReturned, this,
|
||||
app.GetStringTable(), 0, 0, false);
|
||||
&IUIScene_PauseMenu::ExitGameDialogReturned,
|
||||
(LPVOID)GetCallbackUniqueId());
|
||||
} else {
|
||||
TelemetryManager->RecordLevelExit(
|
||||
m_iPad, eSen_LevelExitStatus_Failed);
|
||||
|
|
|
|||
|
|
@ -14,15 +14,15 @@ const wchar_t*
|
|||
L"Craft Anything",
|
||||
L"Use DPad for debug",
|
||||
L"Mobs don't tick",
|
||||
L"Instant Mine",
|
||||
L"Art tools", // L"Instant Mine",
|
||||
L"Show UI Console",
|
||||
L"Distributable Save",
|
||||
L"Debug Leaderboards",
|
||||
L"Height-Water-Biome Maps",
|
||||
L"Height-Water Maps",
|
||||
L"Superflat Nether",
|
||||
// L"Light/Dark background",
|
||||
L"More lightning when thundering",
|
||||
L"Go To Nether",
|
||||
L"Biome override",
|
||||
// L"Go To End",
|
||||
L"Go To Overworld",
|
||||
L"Unlock All DLC", // L"Toggle Font",
|
||||
|
|
|
|||
|
|
@ -29,8 +29,10 @@ UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void* initData,
|
|||
m_sliderFov.init(TempString, eControl_FOV, 0, 100,
|
||||
(int)pMinecraft->gameRenderer->GetFovVal());
|
||||
|
||||
float currentTime = pMinecraft->level->getLevelData()->getTime() % 24000;
|
||||
swprintf(TempString, 256, L"Set time (unsafe) (%d)", (int)currentTime);
|
||||
float currentTime =
|
||||
pMinecraft->level->getLevelData()->getGameTime() % 24000;
|
||||
swprintf((WCHAR*)TempString, 256, L"Set time (unsafe) (%d)",
|
||||
(int)currentTime);
|
||||
m_sliderTime.init(TempString, eControl_Time, 0, 240, currentTime / 100);
|
||||
|
||||
m_buttonRain.init(L"Toggle Rain", eControl_Rain);
|
||||
|
|
@ -246,7 +248,7 @@ void UIScene_DebugOverlay::handleSliderMove(F64 sliderId, F64 currentValue) {
|
|||
// local level tries to predict the time Only works if we are on the
|
||||
// host machine, but shouldn't break if not
|
||||
MinecraftServer::SetTime(currentValue * 100);
|
||||
pMinecraft->level->getLevelData()->setTime(currentValue * 100);
|
||||
pMinecraft->level->getLevelData()->setGameTime(currentValue * 100);
|
||||
|
||||
wchar_t TempString[256];
|
||||
float currentTime = currentValue * 100;
|
||||
|
|
|
|||
|
|
@ -11,10 +11,10 @@ UIScene_DispenserMenu::UIScene_DispenserMenu(int iPad, void* _initData,
|
|||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
|
||||
m_labelDispenser.init(app.GetString(IDS_DISPENSER));
|
||||
|
||||
TrapScreenInput* initData = (TrapScreenInput*)_initData;
|
||||
|
||||
m_labelDispenser.init(initData->trap->getName());
|
||||
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
if (pMinecraft->localgameModes[initData->iPad] != NULL) {
|
||||
TutorialMode* gameMode =
|
||||
|
|
|
|||
|
|
@ -11,14 +11,15 @@ UIScene_EnchantingMenu::UIScene_EnchantingMenu(int iPad, void* _initData,
|
|||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
|
||||
m_labelEnchant.init(app.GetString(IDS_ENCHANT));
|
||||
|
||||
m_enchantButton[0].init(0);
|
||||
m_enchantButton[1].init(1);
|
||||
m_enchantButton[2].init(2);
|
||||
|
||||
EnchantingScreenInput* initData = (EnchantingScreenInput*)_initData;
|
||||
|
||||
m_labelEnchant.init(initData->name.empty() ? app.GetString(IDS_ENCHANT)
|
||||
: initData->name);
|
||||
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
if (pMinecraft->localgameModes[initData->iPad] != NULL) {
|
||||
TutorialMode* gameMode =
|
||||
|
|
|
|||
|
|
@ -214,8 +214,17 @@ void UIScene_EndPoem::updateNoise() {
|
|||
|
||||
replaceString = L"";
|
||||
for (int i = 0; i < length; ++i) {
|
||||
randomChar = SharedConstants::acceptableLetters[random->nextInt(
|
||||
(int)SharedConstants::acceptableLetters.length())];
|
||||
if (ui.UsingBitmapFont()) {
|
||||
randomChar = SharedConstants::acceptableLetters[random->nextInt(
|
||||
(int)SharedConstants::acceptableLetters.length())];
|
||||
} else {
|
||||
// 4J-JEV: It'd be nice to avoid null characters when using
|
||||
// asian languages.
|
||||
static std::wstring acceptableLetters =
|
||||
L"!\"#$%&'()*+,-./0123456789:;<=>?@[\\]^_'|}~";
|
||||
randomChar = acceptableLetters[random->nextInt(
|
||||
(int)acceptableLetters.length())];
|
||||
}
|
||||
|
||||
std::wstring randomCharStr = L"";
|
||||
randomCharStr.push_back(randomChar);
|
||||
|
|
|
|||
229
Minecraft.Client/Platform/Common/UI/UIScene_FireworksMenu.cpp
Normal file
229
Minecraft.Client/Platform/Common/UI/UIScene_FireworksMenu.cpp
Normal file
|
|
@ -0,0 +1,229 @@
|
|||
#include "../../stdafx.h"
|
||||
#include "UI.h"
|
||||
#include "../../../../Minecraft.World/Headers/net.minecraft.world.level.tile.entity.h"
|
||||
#include "../../../../Minecraft.World/Headers/net.minecraft.world.inventory.h"
|
||||
#include "../../Minecraft.h"
|
||||
#include "../../LocalPlayer.h"
|
||||
#include "UIScene_FireworksMenu.h"
|
||||
|
||||
UIScene_FireworksMenu::UIScene_FireworksMenu(int iPad, void* _initData,
|
||||
UILayer* parentLayer)
|
||||
: UIScene_AbstractContainerMenu(iPad, parentLayer) {
|
||||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
|
||||
FireworksScreenInput* initData = (FireworksScreenInput*)_initData;
|
||||
|
||||
m_labelFireworks.init(app.GetString(IDS_HOW_TO_PLAY_MENU_FIREWORKS));
|
||||
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
if (pMinecraft->localgameModes[initData->iPad] != NULL) {
|
||||
TutorialMode* gameMode =
|
||||
(TutorialMode*)pMinecraft->localgameModes[initData->iPad];
|
||||
m_previousTutorialState = gameMode->getTutorial()->getCurrentState();
|
||||
gameMode->getTutorial()->changeTutorialState(
|
||||
e_Tutorial_State_Fireworks_Menu, this);
|
||||
}
|
||||
|
||||
FireworksMenu* menu =
|
||||
new FireworksMenu(initData->player->inventory, initData->player->level,
|
||||
initData->x, initData->y, initData->z);
|
||||
|
||||
Initialize(initData->iPad, menu, true, FireworksMenu::INV_SLOT_START,
|
||||
eSectionFireworksUsing, eSectionFireworksMax);
|
||||
|
||||
m_slotListResult.addSlots(FireworksMenu::RESULT_SLOT, 1);
|
||||
m_slotList3x3.addSlots(FireworksMenu::CRAFT_SLOT_START, 9);
|
||||
ShowLargeCraftingGrid(true);
|
||||
|
||||
delete initData;
|
||||
}
|
||||
|
||||
std::wstring UIScene_FireworksMenu::getMoviePath() {
|
||||
if (app.GetLocalPlayerCount() > 1) {
|
||||
return L"FireworksMenuSplit";
|
||||
} else {
|
||||
return L"FireworksMenu";
|
||||
}
|
||||
}
|
||||
|
||||
void UIScene_FireworksMenu::handleReload() {
|
||||
Initialize(m_iPad, m_menu, true, FireworksMenu::INV_SLOT_START,
|
||||
eSectionFireworksUsing, eSectionFireworksMax);
|
||||
|
||||
m_slotListResult.addSlots(FireworksMenu::RESULT_SLOT, 1);
|
||||
m_slotList3x3.addSlots(FireworksMenu::CRAFT_SLOT_START, 9);
|
||||
ShowLargeCraftingGrid(true);
|
||||
}
|
||||
|
||||
int UIScene_FireworksMenu::getSectionColumns(ESceneSection eSection) {
|
||||
int cols = 0;
|
||||
switch (eSection) {
|
||||
case eSectionFireworksIngredients:
|
||||
cols = 3;
|
||||
break;
|
||||
case eSectionFireworksResult:
|
||||
cols = 1;
|
||||
break;
|
||||
case eSectionFireworksInventory:
|
||||
cols = 9;
|
||||
break;
|
||||
case eSectionFireworksUsing:
|
||||
cols = 9;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
return cols;
|
||||
}
|
||||
|
||||
int UIScene_FireworksMenu::getSectionRows(ESceneSection eSection) {
|
||||
int rows = 0;
|
||||
switch (eSection) {
|
||||
case eSectionFireworksIngredients:
|
||||
rows = 3;
|
||||
break;
|
||||
case eSectionFireworksResult:
|
||||
rows = 1;
|
||||
break;
|
||||
case eSectionFireworksInventory:
|
||||
rows = 3;
|
||||
break;
|
||||
case eSectionFireworksUsing:
|
||||
rows = 1;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
|
||||
void UIScene_FireworksMenu::GetPositionOfSection(ESceneSection eSection,
|
||||
UIVec2D* pPosition) {
|
||||
switch (eSection) {
|
||||
case eSectionFireworksIngredients:
|
||||
pPosition->x = m_slotList3x3.getXPos();
|
||||
pPosition->y = m_slotList3x3.getYPos();
|
||||
break;
|
||||
case eSectionFireworksResult:
|
||||
pPosition->x = m_slotListResult.getXPos();
|
||||
pPosition->y = m_slotListResult.getYPos();
|
||||
break;
|
||||
case eSectionFireworksInventory:
|
||||
pPosition->x = m_slotListInventory.getXPos();
|
||||
pPosition->y = m_slotListInventory.getYPos();
|
||||
break;
|
||||
case eSectionFireworksUsing:
|
||||
pPosition->x = m_slotListHotbar.getXPos();
|
||||
pPosition->y = m_slotListHotbar.getYPos();
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void UIScene_FireworksMenu::GetItemScreenData(ESceneSection eSection,
|
||||
int iItemIndex,
|
||||
UIVec2D* pPosition,
|
||||
UIVec2D* pSize) {
|
||||
UIVec2D sectionSize;
|
||||
switch (eSection) {
|
||||
case eSectionFireworksIngredients:
|
||||
sectionSize.x = m_slotList3x3.getWidth();
|
||||
sectionSize.y = m_slotList3x3.getHeight();
|
||||
break;
|
||||
case eSectionFireworksResult:
|
||||
sectionSize.x = m_slotListResult.getWidth();
|
||||
sectionSize.y = m_slotListResult.getHeight();
|
||||
break;
|
||||
case eSectionFireworksInventory:
|
||||
sectionSize.x = m_slotListInventory.getWidth();
|
||||
sectionSize.y = m_slotListInventory.getHeight();
|
||||
break;
|
||||
case eSectionFireworksUsing:
|
||||
sectionSize.x = m_slotListHotbar.getWidth();
|
||||
sectionSize.y = m_slotListHotbar.getHeight();
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
int rows = getSectionRows(eSection);
|
||||
int cols = getSectionColumns(eSection);
|
||||
|
||||
pSize->x = sectionSize.x / cols;
|
||||
pSize->y = sectionSize.y / rows;
|
||||
|
||||
int itemCol = iItemIndex % cols;
|
||||
int itemRow = iItemIndex / cols;
|
||||
|
||||
pPosition->x = itemCol * pSize->x;
|
||||
pPosition->y = itemRow * pSize->y;
|
||||
}
|
||||
|
||||
void UIScene_FireworksMenu::setSectionSelectedSlot(ESceneSection eSection,
|
||||
int x, int y) {
|
||||
int cols = getSectionColumns(eSection);
|
||||
|
||||
int index = (y * cols) + x;
|
||||
|
||||
UIControl_SlotList* slotList = NULL;
|
||||
switch (eSection) {
|
||||
case eSectionFireworksIngredients:
|
||||
slotList = &m_slotList3x3;
|
||||
break;
|
||||
case eSectionFireworksResult:
|
||||
slotList = &m_slotListResult;
|
||||
break;
|
||||
case eSectionFireworksInventory:
|
||||
slotList = &m_slotListInventory;
|
||||
break;
|
||||
case eSectionFireworksUsing:
|
||||
slotList = &m_slotListHotbar;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
slotList->setHighlightSlot(index);
|
||||
}
|
||||
|
||||
UIControl* UIScene_FireworksMenu::getSection(ESceneSection eSection) {
|
||||
UIControl* control = NULL;
|
||||
switch (eSection) {
|
||||
case eSectionFireworksIngredients:
|
||||
control = &m_slotList3x3;
|
||||
break;
|
||||
case eSectionFireworksResult:
|
||||
control = &m_slotListResult;
|
||||
break;
|
||||
case eSectionFireworksInventory:
|
||||
control = &m_slotListInventory;
|
||||
break;
|
||||
case eSectionFireworksUsing:
|
||||
control = &m_slotListHotbar;
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
return control;
|
||||
}
|
||||
|
||||
// bShow == true removes the 2x2 crafting grid and bShow == false removes the
|
||||
// 3x3 crafting grid
|
||||
void UIScene_FireworksMenu::ShowLargeCraftingGrid(boolean bShow) {
|
||||
app.DebugPrintf("ShowLargeCraftingGrid to %d\n", bShow);
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = bShow;
|
||||
IggyResult out = IggyPlayerCallMethodRS(
|
||||
getMovie(), &result, IggyPlayerRootPath(getMovie()),
|
||||
m_funcShowLargeCraftingGrid, 1, value);
|
||||
}
|
||||
46
Minecraft.Client/Platform/Common/UI/UIScene_FireworksMenu.h
Normal file
46
Minecraft.Client/Platform/Common/UI/UIScene_FireworksMenu.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#pragma once
|
||||
|
||||
#include "UIScene_AbstractContainerMenu.h"
|
||||
#include "IUIScene_FireworksMenu.h"
|
||||
|
||||
class InventoryMenu;
|
||||
|
||||
class UIScene_FireworksMenu : public UIScene_AbstractContainerMenu,
|
||||
public IUIScene_FireworksMenu {
|
||||
public:
|
||||
UIScene_FireworksMenu(int iPad, void* initData, UILayer* parentLayer);
|
||||
|
||||
virtual EUIScene getSceneType() { return eUIScene_FireworksMenu; }
|
||||
|
||||
protected:
|
||||
UIControl_SlotList m_slotListResult, m_slotList3x3, m_slotList2x2;
|
||||
UIControl_Label m_labelFireworks;
|
||||
IggyName m_funcShowLargeCraftingGrid;
|
||||
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene_AbstractContainerMenu)
|
||||
UI_BEGIN_MAP_CHILD_ELEMENTS(m_controlMainPanel)
|
||||
UI_MAP_ELEMENT(m_slotListResult, "Result")
|
||||
UI_MAP_ELEMENT(m_slotList3x3, "Fireworks3x3")
|
||||
UI_MAP_ELEMENT(m_slotList2x2, "Fireworks2x2")
|
||||
UI_MAP_ELEMENT(m_labelFireworks, "FireworksLabel")
|
||||
|
||||
UI_MAP_NAME(m_funcShowLargeCraftingGrid, L"ShowLargeCraftingGrid")
|
||||
UI_END_MAP_CHILD_ELEMENTS()
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
|
||||
virtual std::wstring getMoviePath();
|
||||
virtual void handleReload();
|
||||
|
||||
virtual int getSectionColumns(ESceneSection eSection);
|
||||
virtual int getSectionRows(ESceneSection eSection);
|
||||
virtual void GetPositionOfSection(ESceneSection eSection,
|
||||
UIVec2D* pPosition);
|
||||
virtual void GetItemScreenData(ESceneSection eSection, int iItemIndex,
|
||||
UIVec2D* pPosition, UIVec2D* pSize);
|
||||
virtual void handleSectionClick(ESceneSection eSection) {}
|
||||
virtual void setSectionSelectedSlot(ESceneSection eSection, int x, int y);
|
||||
|
||||
virtual UIControl* getSection(ESceneSection eSection);
|
||||
|
||||
void ShowLargeCraftingGrid(boolean bShow);
|
||||
};
|
||||
|
|
@ -148,14 +148,7 @@ void UIScene_FullscreenProgress::tick() {
|
|||
}
|
||||
|
||||
int code = thread->GetExitCode();
|
||||
const unsigned int exitcode = static_cast<unsigned int>(code);
|
||||
|
||||
static int s_FPTickCount = 0;
|
||||
if (s_FPTickCount % 60 == 0)
|
||||
app.DebugPrintf("[FP] tick #%d exitcode=%u STILL_ACTIVE=%u\n",
|
||||
s_FPTickCount, exitcode,
|
||||
static_cast<unsigned int>(STILL_ACTIVE));
|
||||
s_FPTickCount++;
|
||||
DWORD exitcode = *((DWORD*)&code);
|
||||
|
||||
// app.DebugPrintf("CScene_FullscreenProgress Timer %d\n",pTimer->nId);
|
||||
|
||||
|
|
@ -189,12 +182,11 @@ void UIScene_FullscreenProgress::tick() {
|
|||
|
||||
unsigned int uiIDA[1];
|
||||
uiIDA[0] = IDS_CONFIRM_OK;
|
||||
ui.RequestMessageBox(
|
||||
ui.RequestErrorMessage(
|
||||
g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_FAILED),
|
||||
g_NetworkManager.CorrectErrorIDS(
|
||||
IDS_CONNECTION_LOST_SERVER),
|
||||
uiIDA, 1, XUSER_INDEX_ANY, NULL, NULL,
|
||||
app.GetStringTable());
|
||||
uiIDA, 1, XUSER_INDEX_ANY);
|
||||
|
||||
ui.NavigateToHomeMenu();
|
||||
ui.UpdatePlayerBasePositions();
|
||||
|
|
@ -204,6 +196,11 @@ void UIScene_FullscreenProgress::tick() {
|
|||
(!m_bWasCancelled)) {
|
||||
m_threadCompleted = true;
|
||||
m_buttonConfirm.setVisible(true);
|
||||
// 4J-TomK - rebuild touch after confirm button made visible
|
||||
// again
|
||||
#ifdef __PSVITA__
|
||||
ui.TouchBoxRebuild(this);
|
||||
#endif
|
||||
updateTooltips();
|
||||
} else {
|
||||
if (m_bWasCancelled) {
|
||||
|
|
@ -380,4 +377,4 @@ bool UIScene_FullscreenProgress::isReadyToDelete() {
|
|||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -11,16 +11,16 @@ UIScene_FurnaceMenu::UIScene_FurnaceMenu(int iPad, void* _initData,
|
|||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
|
||||
m_labelFurnace.init(app.GetString(IDS_FURNACE));
|
||||
FurnaceScreenInput* initData = (FurnaceScreenInput*)_initData;
|
||||
m_furnace = initData->furnace;
|
||||
|
||||
m_labelFurnace.init(m_furnace->getName());
|
||||
m_labelIngredient.init(app.GetString(IDS_INGREDIENT));
|
||||
m_labelFuel.init(app.GetString(IDS_FUEL));
|
||||
|
||||
m_progressFurnaceFire.init(L"", 0, 0, 12, 0);
|
||||
m_progressFurnaceArrow.init(L"", 0, 0, 24, 0);
|
||||
|
||||
FurnaceScreenInput* initData = (FurnaceScreenInput*)_initData;
|
||||
m_furnace = initData->furnace;
|
||||
|
||||
Minecraft* pMinecraft = Minecraft::GetInstance();
|
||||
if (pMinecraft->localgameModes[initData->iPad] != NULL) {
|
||||
TutorialMode* gameMode =
|
||||
|
|
|
|||
|
|
@ -17,32 +17,6 @@ UIScene_HUD::UIScene_HUD(int iPad, void* initData, UILayer* parentLayer)
|
|||
// Setup all the Iggy references we need for this scene
|
||||
initialiseMovie();
|
||||
|
||||
m_lastActiveSlot = 0;
|
||||
m_lastScale = 1;
|
||||
m_bToolTipsVisible = true;
|
||||
m_lastExpProgress = 0.0f;
|
||||
m_lastExpLevel = 0;
|
||||
m_lastMaxHealth = 20;
|
||||
m_lastHealthBlink = false;
|
||||
m_lastHealthPoison = false;
|
||||
m_lastMaxFood = 20;
|
||||
m_lastFoodPoison = false;
|
||||
m_lastAir = 10;
|
||||
m_lastArmour = 0;
|
||||
m_showHealth = true;
|
||||
m_showFood = true;
|
||||
m_showAir = true;
|
||||
m_showArmour = true;
|
||||
m_showExpBar = true;
|
||||
m_lastRegenEffect = false;
|
||||
m_lastSaturation = 0;
|
||||
m_lastDragonHealth = 0.0f;
|
||||
m_showDragonHealth = false;
|
||||
m_ticksWithNoBoss = 0;
|
||||
m_uiSelectedItemOpacityCountDown = 0;
|
||||
m_displayName = L"";
|
||||
m_lastShowDisplayName = true;
|
||||
|
||||
SetDragonLabel(app.GetString(IDS_BOSS_ENDERDRAGON_HEALTH));
|
||||
SetSelectedLabel(L"");
|
||||
|
||||
|
|
@ -139,28 +113,28 @@ void UIScene_HUD::tick() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (pMinecraft->localplayers[m_iPad]->dimension == 1) {
|
||||
if (EnderDragonRenderer::bossInstance == NULL) {
|
||||
// Is boss present?
|
||||
bool noBoss =
|
||||
BossMobGuiInfo::name.empty() || BossMobGuiInfo::displayTicks <= 0;
|
||||
if (noBoss) {
|
||||
if (m_showDragonHealth) {
|
||||
// No boss and health is visible
|
||||
if (m_ticksWithNoBoss <= 20) {
|
||||
++m_ticksWithNoBoss;
|
||||
}
|
||||
if (m_ticksWithNoBoss > 20) {
|
||||
} else {
|
||||
ShowDragonHealth(false);
|
||||
}
|
||||
} else {
|
||||
std::shared_ptr<EnderDragon> boss =
|
||||
EnderDragonRenderer::bossInstance;
|
||||
// 4J Stu - Don't clear this here as it's wiped for other
|
||||
// players
|
||||
// EnderDragonRenderer::bossInstance = nullptr;
|
||||
m_ticksWithNoBoss = 0;
|
||||
|
||||
ShowDragonHealth(true);
|
||||
SetDragonHealth((float)boss->getSynchedHealth() /
|
||||
boss->getMaxHealth());
|
||||
}
|
||||
} else {
|
||||
ShowDragonHealth(false);
|
||||
BossMobGuiInfo::displayTicks--;
|
||||
|
||||
m_ticksWithNoBoss = 0;
|
||||
SetDragonHealth(BossMobGuiInfo::healthProgress);
|
||||
|
||||
if (!m_showDragonHealth) {
|
||||
SetDragonLabel(BossMobGuiInfo::name);
|
||||
ShowDragonHealth(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -209,34 +183,48 @@ void UIScene_HUD::customDraw(IggyCustomDrawCallbackRegion* region) {
|
|||
}
|
||||
|
||||
void UIScene_HUD::handleReload() {
|
||||
m_lastActiveSlot = 0;
|
||||
m_lastScale = 1;
|
||||
m_lastActiveSlot = -1;
|
||||
m_iGuiScale = -1;
|
||||
m_bToolTipsVisible = true;
|
||||
m_lastExpProgress = 0.0f;
|
||||
m_lastExpLevel = 0;
|
||||
m_iCurrentHealth = 0;
|
||||
m_lastMaxHealth = 20;
|
||||
m_lastHealthBlink = false;
|
||||
m_lastHealthPoison = false;
|
||||
m_lastMaxFood = 20;
|
||||
m_iCurrentFood = -1;
|
||||
m_lastFoodPoison = false;
|
||||
m_lastAir = 10;
|
||||
m_currentExtraAir = 0;
|
||||
m_lastArmour = 0;
|
||||
m_showHealth = true;
|
||||
m_showHorseHealth = true;
|
||||
m_showFood = true;
|
||||
m_showAir = true;
|
||||
m_showAir = false; // get's initialised invisible anyways, by setting it to
|
||||
// false we ensure it will remain visible when switching
|
||||
// in and out of split screen!
|
||||
m_showArmour = true;
|
||||
m_showExpBar = true;
|
||||
m_lastRegenEffect = false;
|
||||
m_lastSaturation = 0;
|
||||
m_bRegenEffectEnabled = false;
|
||||
m_iFoodSaturation = 0;
|
||||
m_lastDragonHealth = 0.0f;
|
||||
m_showDragonHealth = false;
|
||||
m_ticksWithNoBoss = 0;
|
||||
m_uiSelectedItemOpacityCountDown = 0;
|
||||
m_displayName = L"";
|
||||
m_lastShowDisplayName = true;
|
||||
m_bRidingHorse = true;
|
||||
m_horseHealth = 1;
|
||||
m_lastHealthWither = true;
|
||||
m_iCurrentHealthAbsorb = -1;
|
||||
m_horseJumpProgress = 1.0f;
|
||||
m_iHeartOffsetIndex = -1;
|
||||
m_bHealthAbsorbActive = false;
|
||||
m_iHorseMaxHealth = -1;
|
||||
|
||||
m_labelDisplayName.setVisible(m_lastShowDisplayName);
|
||||
|
||||
SetDragonLabel(app.GetString(IDS_BOSS_ENDERDRAGON_HEALTH));
|
||||
SetDragonLabel(BossMobGuiInfo::name);
|
||||
SetSelectedLabel(L"");
|
||||
|
||||
for (unsigned int i = 0; i < CHAT_LINES_COUNT; ++i) {
|
||||
|
|
@ -264,9 +252,15 @@ void UIScene_HUD::handleReload() {
|
|||
eGameSetting_Tooltips) != 0)));
|
||||
}
|
||||
|
||||
int UIScene_HUD::getPad() { return m_iPad; }
|
||||
|
||||
void UIScene_HUD::SetOpacity(float opacity) { setOpacity(opacity); }
|
||||
|
||||
void UIScene_HUD::SetVisible(bool visible) { setVisible(visible); }
|
||||
|
||||
void UIScene_HUD::SetHudSize(int scale) {
|
||||
if (scale != m_lastScale) {
|
||||
m_lastScale = scale;
|
||||
if (scale != m_iGuiScale) {
|
||||
m_iGuiScale = scale;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
|
|
@ -278,7 +272,7 @@ void UIScene_HUD::SetHudSize(int scale) {
|
|||
}
|
||||
}
|
||||
|
||||
void UIScene_HUD::SetExpBarProgress(float progress) {
|
||||
void UIScene_HUD::SetExpBarProgress(float progress, int xpNeededForNextLevel) {
|
||||
if (progress != m_lastExpProgress) {
|
||||
m_lastExpProgress = progress;
|
||||
|
||||
|
|
@ -321,33 +315,36 @@ void UIScene_HUD::SetActiveSlot(int slot) {
|
|||
}
|
||||
|
||||
void UIScene_HUD::SetHealth(int iHealth, int iLastHealth, bool bBlink,
|
||||
bool bPoison) {
|
||||
bool bPoison, bool bWither) {
|
||||
int maxHealth = std::max(iHealth, iLastHealth);
|
||||
if (maxHealth != m_lastMaxHealth || bBlink != m_lastHealthBlink ||
|
||||
bPoison != m_lastHealthPoison) {
|
||||
bPoison != m_lastHealthPoison || bWither != m_lastHealthWither) {
|
||||
m_lastMaxHealth = maxHealth;
|
||||
m_lastHealthBlink = bBlink;
|
||||
m_lastHealthPoison = bPoison;
|
||||
m_lastHealthWither = bWither;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
IggyDataValue value[4];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = maxHealth;
|
||||
value[1].type = IGGY_DATATYPE_boolean;
|
||||
value[1].boolval = bBlink;
|
||||
value[2].type = IGGY_DATATYPE_boolean;
|
||||
value[2].boolval = bPoison;
|
||||
value[3].type = IGGY_DATATYPE_boolean;
|
||||
value[3].boolval = bWither;
|
||||
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result,
|
||||
IggyPlayerRootPath(getMovie()),
|
||||
m_funcSetHealth, 3, value);
|
||||
m_funcSetHealth, 4, value);
|
||||
}
|
||||
}
|
||||
|
||||
void UIScene_HUD::SetFood(int iFood, int iLastFood, bool bPoison) {
|
||||
// Ignore iLastFood as food doesn't flash
|
||||
int maxFood = iFood; //, iLastFood);
|
||||
if (maxFood != m_lastMaxFood || bPoison != m_lastFoodPoison) {
|
||||
m_lastMaxFood = maxFood;
|
||||
if (maxFood != m_iCurrentFood || bPoison != m_lastFoodPoison) {
|
||||
m_iCurrentFood = maxFood;
|
||||
m_lastFoodPoison = bPoison;
|
||||
|
||||
IggyDataValue result;
|
||||
|
|
@ -362,7 +359,7 @@ void UIScene_HUD::SetFood(int iFood, int iLastFood, bool bPoison) {
|
|||
}
|
||||
}
|
||||
|
||||
void UIScene_HUD::SetAir(int iAir) {
|
||||
void UIScene_HUD::SetAir(int iAir, int extra) {
|
||||
if (iAir != m_lastAir) {
|
||||
app.DebugPrintf("SetAir to %d\n", iAir);
|
||||
m_lastAir = iAir;
|
||||
|
|
@ -407,6 +404,21 @@ void UIScene_HUD::ShowHealth(bool show) {
|
|||
}
|
||||
}
|
||||
|
||||
void UIScene_HUD::ShowHorseHealth(bool show) {
|
||||
if (show != m_showHorseHealth) {
|
||||
app.DebugPrintf("ShowHorseHealth to %s\n", show ? "TRUE" : "FALSE");
|
||||
m_showHorseHealth = show;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = show;
|
||||
IggyResult out = IggyPlayerCallMethodRS(
|
||||
getMovie(), &result, IggyPlayerRootPath(getMovie()),
|
||||
m_funcShowHorseHealth, 1, value);
|
||||
}
|
||||
}
|
||||
|
||||
void UIScene_HUD::ShowFood(bool show) {
|
||||
if (show != m_showFood) {
|
||||
app.DebugPrintf("ShowFood to %s\n", show ? "TRUE" : "FALSE");
|
||||
|
|
@ -468,10 +480,10 @@ void UIScene_HUD::ShowExpBar(bool show) {
|
|||
}
|
||||
|
||||
void UIScene_HUD::SetRegenerationEffect(bool bEnabled) {
|
||||
if (bEnabled != m_lastRegenEffect) {
|
||||
if (bEnabled != m_bRegenEffectEnabled) {
|
||||
app.DebugPrintf("SetRegenerationEffect to %s\n",
|
||||
bEnabled ? "TRUE" : "FALSE");
|
||||
m_lastRegenEffect = bEnabled;
|
||||
m_bRegenEffectEnabled = bEnabled;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
|
|
@ -484,9 +496,9 @@ void UIScene_HUD::SetRegenerationEffect(bool bEnabled) {
|
|||
}
|
||||
|
||||
void UIScene_HUD::SetFoodSaturationLevel(int iSaturation) {
|
||||
if (iSaturation != m_lastSaturation) {
|
||||
if (iSaturation != m_iFoodSaturation) {
|
||||
app.DebugPrintf("Set saturation to %d\n", iSaturation);
|
||||
m_lastSaturation = iSaturation;
|
||||
m_iFoodSaturation = iSaturation;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
|
|
@ -570,6 +582,78 @@ void UIScene_HUD::HideSelectedLabel() {
|
|||
m_funcHideSelectedLabel, 0, NULL);
|
||||
}
|
||||
|
||||
void UIScene_HUD::SetRidingHorse(bool ridingHorse, bool bIsJumpable,
|
||||
int maxHorseHealth) {
|
||||
if (m_bRidingHorse != ridingHorse || maxHorseHealth != m_iHorseMaxHealth) {
|
||||
app.DebugPrintf("SetRidingHorse to %s\n",
|
||||
ridingHorse ? "TRUE" : "FALSE");
|
||||
m_bRidingHorse = ridingHorse;
|
||||
m_bIsJumpable = bIsJumpable;
|
||||
m_iHorseMaxHealth = maxHorseHealth;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[3];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = ridingHorse;
|
||||
value[1].type = IGGY_DATATYPE_boolean;
|
||||
value[1].boolval = bIsJumpable;
|
||||
value[2].type = IGGY_DATATYPE_number;
|
||||
value[2].number = maxHorseHealth;
|
||||
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result,
|
||||
IggyPlayerRootPath(getMovie()),
|
||||
m_funcSetRidingHorse, 3, value);
|
||||
}
|
||||
}
|
||||
|
||||
void UIScene_HUD::SetHorseHealth(int health, bool blink /*= false*/) {
|
||||
if (m_bRidingHorse && m_horseHealth != health) {
|
||||
app.DebugPrintf("SetHorseHealth to %d\n", health);
|
||||
m_horseHealth = health;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = health;
|
||||
value[1].type = IGGY_DATATYPE_boolean;
|
||||
value[1].boolval = blink;
|
||||
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result,
|
||||
IggyPlayerRootPath(getMovie()),
|
||||
m_funcSetHorseHealth, 2, value);
|
||||
}
|
||||
}
|
||||
|
||||
void UIScene_HUD::SetHorseJumpBarProgress(float progress) {
|
||||
if (m_bRidingHorse && m_horseJumpProgress != progress) {
|
||||
app.DebugPrintf("SetHorseJumpBarProgress to %f\n", progress);
|
||||
m_horseJumpProgress = progress;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[1];
|
||||
value[0].type = IGGY_DATATYPE_number;
|
||||
value[0].number = progress;
|
||||
IggyResult out = IggyPlayerCallMethodRS(
|
||||
getMovie(), &result, IggyPlayerRootPath(getMovie()),
|
||||
m_funcSetHorseJumpBarProgress, 1, value);
|
||||
}
|
||||
}
|
||||
|
||||
void UIScene_HUD::SetHealthAbsorb(int healthAbsorb) {
|
||||
if (m_iCurrentHealthAbsorb != healthAbsorb) {
|
||||
app.DebugPrintf("SetHealthAbsorb to %d\n", healthAbsorb);
|
||||
m_iCurrentHealthAbsorb = healthAbsorb;
|
||||
|
||||
IggyDataValue result;
|
||||
IggyDataValue value[2];
|
||||
value[0].type = IGGY_DATATYPE_boolean;
|
||||
value[0].boolval = healthAbsorb > 0;
|
||||
value[1].type = IGGY_DATATYPE_number;
|
||||
value[1].number = healthAbsorb;
|
||||
IggyResult out = IggyPlayerCallMethodRS(
|
||||
getMovie(), &result, IggyPlayerRootPath(getMovie()),
|
||||
m_funcSetHealthAbsorb, 2, value);
|
||||
}
|
||||
}
|
||||
|
||||
void UIScene_HUD::render(S32 width, S32 height,
|
||||
C4JRender::eViewportType viewport) {
|
||||
if (m_bSplitscreen) {
|
||||
|
|
@ -757,227 +841,6 @@ void UIScene_HUD::handleGameTick() {
|
|||
}
|
||||
m_parentLayer->showComponent(m_iPad, eUIScene_HUD, true);
|
||||
|
||||
int iGuiScale;
|
||||
|
||||
if (pMinecraft->localplayers[m_iPad]->m_iScreenSection ==
|
||||
C4JRender::VIEWPORT_TYPE_FULLSCREEN) {
|
||||
iGuiScale = app.GetGameSettings(m_iPad, eGameSetting_UISize);
|
||||
} else {
|
||||
iGuiScale =
|
||||
app.GetGameSettings(m_iPad, eGameSetting_UISizeSplitscreen);
|
||||
}
|
||||
SetHudSize(iGuiScale);
|
||||
|
||||
SetDisplayName(ProfileManager.GetDisplayName(m_iPad));
|
||||
|
||||
SetTooltipsEnabled(
|
||||
((ui.GetMenuDisplayed(ProfileManager.GetPrimaryPad())) ||
|
||||
(app.GetGameSettings(ProfileManager.GetPrimaryPad(),
|
||||
eGameSetting_Tooltips) != 0)));
|
||||
|
||||
#if TO_BE_IMPLEMENTED
|
||||
// Move the whole hud group if we are not in fullscreen
|
||||
if (pMinecraft->localplayers[m_iPad]->m_iScreenSection !=
|
||||
C4JRender::VIEWPORT_TYPE_FULLSCREEN) {
|
||||
int iTooltipsYOffset = 0;
|
||||
// if tooltips are off, set the y offset to zero
|
||||
if (app.GetGameSettings(m_iPad, eGameSetting_Tooltips) == 0) {
|
||||
switch (iGuiScale) {
|
||||
case 0:
|
||||
iTooltipsYOffset = 28; // screenHeight/10;
|
||||
break;
|
||||
case 2:
|
||||
iTooltipsYOffset = 28; // screenHeight/10;
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
iTooltipsYOffset = 28; // screenHeight/10;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
float fHeight, fWidth;
|
||||
GetBounds(&fWidth, &fHeight);
|
||||
|
||||
int iSafezoneYHalf = 0;
|
||||
switch (pMinecraft->localplayers[m_iPad]->m_iScreenSection) {
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_TOP:
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM:
|
||||
iSafezoneYHalf =
|
||||
-fHeight / 10; // 5% (need to treat the whole screen
|
||||
// is 2x this screen)
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT:
|
||||
iSafezoneYHalf =
|
||||
(fHeight / 2) -
|
||||
(fHeight / 10); // 5% (need to treat the whole screen
|
||||
// is 2x this screen)
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT:
|
||||
iSafezoneYHalf =
|
||||
(fHeight / 2) -
|
||||
(fHeight / 10); // 5% (need to treat the whole screen
|
||||
// is 2x this screen)
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT:
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT:
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT:
|
||||
iSafezoneYHalf =
|
||||
-fHeight /
|
||||
10; // 5% (the whole screen is 2x this screen)
|
||||
break;
|
||||
case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT:
|
||||
iSafezoneYHalf =
|
||||
-fHeight /
|
||||
10; // 5% (the whole screen is 2x this screen)
|
||||
break;
|
||||
};
|
||||
|
||||
D3DXVECTOR3 pos;
|
||||
m_hudGroup.GetPosition(&pos);
|
||||
pos.y = iTooltipsYOffset + iSafezoneYHalf;
|
||||
m_hudGroup.SetPosition(&pos);
|
||||
}
|
||||
#endif
|
||||
SetActiveSlot(pMinecraft->localplayers[m_iPad]->inventory->selected);
|
||||
|
||||
// Update xp progress
|
||||
if (pMinecraft->localgameModes[m_iPad]->canHurtPlayer()) {
|
||||
ShowExpBar(true);
|
||||
int xpNeededForNextLevel =
|
||||
pMinecraft->localplayers[m_iPad]->getXpNeededForNextLevel();
|
||||
int progress =
|
||||
(int)(pMinecraft->localplayers[m_iPad]->experienceProgress *
|
||||
xpNeededForNextLevel);
|
||||
SetExpBarProgress((float)progress / xpNeededForNextLevel);
|
||||
} else {
|
||||
ShowExpBar(false);
|
||||
}
|
||||
|
||||
// Update xp level
|
||||
if (pMinecraft->localgameModes[m_iPad]->hasExperience() &&
|
||||
pMinecraft->localplayers[m_iPad]->experienceLevel > 0) {
|
||||
SetExpLevel(pMinecraft->localplayers[m_iPad]->experienceLevel);
|
||||
} else {
|
||||
SetExpLevel(0);
|
||||
}
|
||||
|
||||
if (pMinecraft->localgameModes[m_iPad]->canHurtPlayer()) {
|
||||
ShowHealth(true);
|
||||
ShowFood(true);
|
||||
|
||||
SetRegenerationEffect(pMinecraft->localplayers[m_iPad]->hasEffect(
|
||||
MobEffect::regeneration));
|
||||
|
||||
// Update health
|
||||
bool blink =
|
||||
pMinecraft->localplayers[m_iPad]->invulnerableTime / 3 % 2 == 1;
|
||||
if (pMinecraft->localplayers[m_iPad]->invulnerableTime < 10)
|
||||
blink = false;
|
||||
int iHealth = pMinecraft->localplayers[m_iPad]->getHealth();
|
||||
int iLastHealth = pMinecraft->localplayers[m_iPad]->lastHealth;
|
||||
bool bHasPoison =
|
||||
pMinecraft->localplayers[m_iPad]->hasEffect(MobEffect::poison);
|
||||
SetHealth(iHealth, iLastHealth, blink, bHasPoison);
|
||||
|
||||
// Update food
|
||||
// bool foodBlink = false;
|
||||
FoodData* foodData =
|
||||
pMinecraft->localplayers[m_iPad]->getFoodData();
|
||||
int food = foodData->getFoodLevel();
|
||||
int oldFood = foodData->getLastFoodLevel();
|
||||
bool hasHungerEffect =
|
||||
pMinecraft->localplayers[m_iPad]->hasEffect(MobEffect::hunger);
|
||||
int saturationLevel = pMinecraft->localplayers[m_iPad]
|
||||
->getFoodData()
|
||||
->getSaturationLevel();
|
||||
SetFood(food, oldFood, hasHungerEffect);
|
||||
SetFoodSaturationLevel(saturationLevel);
|
||||
|
||||
// Update armour
|
||||
int armor = pMinecraft->localplayers[m_iPad]->getArmorValue();
|
||||
if (armor > 0) {
|
||||
ShowArmour(true);
|
||||
SetArmour(armor);
|
||||
} else {
|
||||
ShowArmour(false);
|
||||
}
|
||||
|
||||
// Update air
|
||||
if (pMinecraft->localplayers[m_iPad]->isUnderLiquid(
|
||||
Material::water)) {
|
||||
ShowAir(true);
|
||||
int count = (int)ceil(
|
||||
(pMinecraft->localplayers[m_iPad]->getAirSupply() - 2) *
|
||||
10.0f / Player::TOTAL_AIR_SUPPLY);
|
||||
SetAir(count);
|
||||
} else {
|
||||
ShowAir(false);
|
||||
}
|
||||
} else {
|
||||
ShowHealth(false);
|
||||
ShowFood(false);
|
||||
ShowAir(false);
|
||||
ShowArmour(false);
|
||||
}
|
||||
|
||||
if (m_uiSelectedItemOpacityCountDown > 0) {
|
||||
--m_uiSelectedItemOpacityCountDown;
|
||||
|
||||
// 4J Stu - Timing here is kept the same as on Xbox360, even though
|
||||
// we do it differently now and do the fade out in Flash rather than
|
||||
// directly setting opacity
|
||||
if (m_uiSelectedItemOpacityCountDown <
|
||||
(SharedConstants::TICKS_PER_SECOND * 1)) {
|
||||
HideSelectedLabel();
|
||||
m_uiSelectedItemOpacityCountDown = 0;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char ucAlpha = app.GetGameSettings(
|
||||
ProfileManager.GetPrimaryPad(), eGameSetting_InterfaceOpacity);
|
||||
float fVal;
|
||||
|
||||
if (ucAlpha < 80) {
|
||||
// if we are in a menu, set the minimum opacity for tooltips to 15%
|
||||
if (ui.GetMenuDisplayed(m_iPad) && (ucAlpha < 15)) {
|
||||
ucAlpha = 15;
|
||||
}
|
||||
|
||||
// check if we have the timer running for the opacity
|
||||
unsigned int uiOpacityTimer = app.GetOpacityTimer(m_iPad);
|
||||
if (uiOpacityTimer != 0) {
|
||||
if (uiOpacityTimer < 10) {
|
||||
float fStep = (80.0f - (float)ucAlpha) / 10.0f;
|
||||
fVal = 0.01f *
|
||||
(80.0f - ((10.0f - (float)uiOpacityTimer) * fStep));
|
||||
} else {
|
||||
fVal = 0.01f * 80.0f;
|
||||
}
|
||||
} else {
|
||||
fVal = 0.01f * (float)ucAlpha;
|
||||
}
|
||||
} else {
|
||||
// if we are in a menu, set the minimum opacity for tooltips to 15%
|
||||
if (ui.GetMenuDisplayed(m_iPad) && (ucAlpha < 15)) {
|
||||
ucAlpha = 15;
|
||||
}
|
||||
fVal = 0.01f * (float)ucAlpha;
|
||||
}
|
||||
setOpacity(fVal);
|
||||
|
||||
bool bDisplayGui =
|
||||
app.GetGameStarted() && !ui.GetMenuDisplayed(m_iPad) &&
|
||||
!(app.GetXuiAction(m_iPad) ==
|
||||
eAppAction_AutosaveSaveGameCapturedThumbnail) &&
|
||||
app.GetGameSettings(m_iPad, eGameSetting_DisplayHUD) != 0;
|
||||
if (bDisplayGui && pMinecraft->localplayers[m_iPad] != NULL) {
|
||||
setVisible(true);
|
||||
} else {
|
||||
setVisible(false);
|
||||
}
|
||||
updateFrameTick();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +1,14 @@
|
|||
#pragma once
|
||||
|
||||
#include "UIScene.h"
|
||||
#include "IUIScene_HUD.h"
|
||||
|
||||
#define CHAT_LINES_COUNT 10
|
||||
|
||||
class UIScene_HUD : public UIScene {
|
||||
class UIScene_HUD : public UIScene, public IUIScene_HUD {
|
||||
private:
|
||||
bool m_bSplitscreen;
|
||||
|
||||
int m_lastActiveSlot;
|
||||
int m_lastScale;
|
||||
bool m_bToolTipsVisible;
|
||||
float m_lastExpProgress;
|
||||
int m_lastExpLevel;
|
||||
int m_lastMaxHealth;
|
||||
bool m_lastHealthBlink, m_lastHealthPoison;
|
||||
int m_lastMaxFood;
|
||||
bool m_lastFoodPoison;
|
||||
int m_lastAir;
|
||||
int m_lastArmour;
|
||||
float m_lastDragonHealth;
|
||||
bool m_showDragonHealth;
|
||||
int m_ticksWithNoBoss;
|
||||
bool m_lastShowDisplayName;
|
||||
|
||||
bool m_showHealth, m_showFood, m_showAir, m_showArmour, m_showExpBar;
|
||||
bool m_lastRegenEffect;
|
||||
int m_lastSaturation;
|
||||
|
||||
unsigned int m_uiSelectedItemOpacityCountDown;
|
||||
|
||||
std::wstring m_displayName;
|
||||
|
||||
protected:
|
||||
UIControl_Label m_labelChatText[CHAT_LINES_COUNT];
|
||||
UIControl_Label m_labelJukebox;
|
||||
|
|
@ -41,14 +18,17 @@ protected:
|
|||
IggyName m_funcLoadHud, m_funcSetExpBarProgress, m_funcSetPlayerLevel,
|
||||
m_funcSetActiveSlot;
|
||||
IggyName m_funcSetHealth, m_funcSetFood, m_funcSetAir, m_funcSetArmour;
|
||||
IggyName m_funcShowHealth, m_funcShowFood, m_funcShowAir, m_funcShowArmour,
|
||||
m_funcShowExpbar;
|
||||
IggyName m_funcShowHealth, m_funcShowHorseHealth, m_funcShowFood,
|
||||
m_funcShowAir, m_funcShowArmour, m_funcShowExpbar;
|
||||
IggyName m_funcSetRegenerationEffect, m_funcSetFoodSaturationLevel;
|
||||
IggyName m_funcSetDragonHealth, m_funcSetDragonLabel,
|
||||
m_funcShowDragonHealth;
|
||||
IggyName m_funcSetSelectedLabel, m_funcHideSelectedLabel;
|
||||
IggyName m_funcRepositionHud, m_funcSetDisplayName,
|
||||
m_funcSetTooltipsEnabled;
|
||||
IggyName m_funcSetRidingHorse, m_funcSetHorseHealth,
|
||||
m_funcSetHorseJumpBarProgress;
|
||||
IggyName m_funcSetHealthAbsorb;
|
||||
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
||||
UI_MAP_ELEMENT(m_labelChatText[0], "Label1")
|
||||
UI_MAP_ELEMENT(m_labelChatText[1], "Label2")
|
||||
|
|
@ -87,6 +67,7 @@ protected:
|
|||
UI_MAP_NAME(m_funcSetArmour, L"SetArmour")
|
||||
|
||||
UI_MAP_NAME(m_funcShowHealth, L"ShowHealth")
|
||||
UI_MAP_NAME(m_funcShowHorseHealth, L"ShowHorseHealth")
|
||||
UI_MAP_NAME(m_funcShowFood, L"ShowFood")
|
||||
UI_MAP_NAME(m_funcShowAir, L"ShowAir")
|
||||
UI_MAP_NAME(m_funcShowArmour, L"ShowArmour")
|
||||
|
|
@ -106,6 +87,12 @@ protected:
|
|||
UI_MAP_NAME(m_funcSetDisplayName, L"SetGamertag")
|
||||
|
||||
UI_MAP_NAME(m_funcSetTooltipsEnabled, L"SetTooltipsEnabled")
|
||||
|
||||
UI_MAP_NAME(m_funcSetRidingHorse, L"SetRidingHorse")
|
||||
UI_MAP_NAME(m_funcSetHorseHealth, L"SetHorseHealth")
|
||||
UI_MAP_NAME(m_funcSetHorseJumpBarProgress, L"SetHorseJumpBarProgress")
|
||||
|
||||
UI_MAP_NAME(m_funcSetHealthAbsorb, L"SetHealthAbsorb")
|
||||
UI_END_MAP_ELEMENTS_AND_NAMES()
|
||||
|
||||
public:
|
||||
|
|
@ -137,17 +124,23 @@ public:
|
|||
virtual void handleReload();
|
||||
|
||||
private:
|
||||
virtual int getPad();
|
||||
virtual void SetOpacity(float opacity);
|
||||
virtual void SetVisible(bool visible);
|
||||
|
||||
void SetHudSize(int scale);
|
||||
void SetExpBarProgress(float progress);
|
||||
void SetExpBarProgress(float progress, int xpNeededForNextLevel);
|
||||
void SetExpLevel(int level);
|
||||
void SetActiveSlot(int slot);
|
||||
|
||||
void SetHealth(int iHealth, int iLastHealth, bool bBlink, bool bPoison);
|
||||
void SetHealth(int iHealth, int iLastHealth, bool bBlink, bool bPoison,
|
||||
bool bWither);
|
||||
void SetFood(int iFood, int iLastFood, bool bPoison);
|
||||
void SetAir(int iAir);
|
||||
void SetAir(int iAir, int extra);
|
||||
void SetArmour(int iArmour);
|
||||
|
||||
void ShowHealth(bool show);
|
||||
void ShowHorseHealth(bool show);
|
||||
void ShowFood(bool show);
|
||||
void ShowAir(bool show);
|
||||
void ShowArmour(bool show);
|
||||
|
|
@ -166,6 +159,12 @@ private:
|
|||
|
||||
void SetTooltipsEnabled(bool bEnabled);
|
||||
|
||||
void SetRidingHorse(bool ridingHorse, bool bIsJumpable, int maxHorseHealth);
|
||||
void SetHorseHealth(int health, bool blink = false);
|
||||
void SetHorseJumpBarProgress(float progress);
|
||||
|
||||
void SetHealthAbsorb(int healthAbsorb);
|
||||
|
||||
public:
|
||||
void SetSelectedLabel(const std::wstring& label);
|
||||
void ShowDisplayName(bool show);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue