feat(TU31): classic crafting (#48)

credits: comicgab
This commit is contained in:
SevenToaster509 2026-05-01 17:44:30 +01:00 committed by GitHub
parent a51d7ae834
commit 05d7ccb6d4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 819 additions and 186 deletions

View file

@ -107,6 +107,7 @@ enum EGameHostOptionWorldSize
#define GAMESETTING_PSVITANETWORKMODEADHOC 0x00020000
#define GAMESETTING_VSYNC 0x01000000
#define GAMESETTING_EXCLUSIVEFULLSCREEN 0x02000000
#define GAMESETTING_CLASSICCRAFTING 0x04000000
// defines for languages

View file

@ -182,6 +182,8 @@ enum eGameSetting
eGameSetting_VSync,
eGameSetting_ExclusiveFullscreen,
//TU25
eGameSetting_ClassicCrafting,
};

View file

@ -577,16 +577,15 @@ bool CMinecraftApp::LoadCrafting3x3Menu(int iPad,shared_ptr<LocalPlayer> player,
initData->y = y;
initData->z = z;
if(app.GetLocalPlayerCount()>1)
{
initData->bSplitscreen=true;
success = ui.NavigateToScene(iPad,eUIScene_Crafting3x3Menu, initData);
}
if (app.GetLocalPlayerCount() > 1)
initData->bSplitscreen = true;
else
{
initData->bSplitscreen=false;
success = ui.NavigateToScene(iPad,eUIScene_Crafting3x3Menu, initData);
}
initData->bSplitscreen = false;
if (app.GetGameSettings(iPad, eGameSetting_ClassicCrafting))
success = ui.NavigateToScene(iPad, eUIScene_ClassicCraftingMenu, initData);
else
success = ui.NavigateToScene(iPad, eUIScene_Crafting3x3Menu, initData);
return success;
}
@ -1041,6 +1040,9 @@ int CMinecraftApp::SetDefaultOptions(C_4JProfile::PROFILESETTINGS *pSettings,con
app.SetGameHostOption(eGameHostOption_NaturalRegeneration, 1 );
app.SetGameHostOption(eGameHostOption_DoDaylightCycle, 1 );
//TU25
SetGameSettings(iPad, eGameSetting_ClassicCrafting, 0);
// 4J-PB - leave these in, or remove from everywhere they are referenced!
// Although probably best to leave in unless we split the profile settings into platform specific classes - having different meaning per platform for the same bitmask could get confusing
//#ifdef __PS3__
@ -1438,6 +1440,7 @@ int CMinecraftApp::OldProfileVersionCallback(LPVOID pParam,unsigned char *pucDat
pGameSettings->uiBitmaskValues|=(GAMESETTING_UISIZE&0x00000800); // uisize 2
pGameSettings->uiBitmaskValues|=(GAMESETTING_UISIZE_SPLITSCREEN&0x00004000); // splitscreen ui size 3
pGameSettings->uiBitmaskValues|=GAMESETTING_ANIMATEDCHARACTER; //eGameSetting_AnimatedCharacter - on
pGameSettings->uiBitmaskValues |= GAMESETTING_CLASSICCRAFTING; //eGameSetting_ClassicCrafting - off
// TU12
// favorite skins added, but only set in TU12 - set to FFs
for(int i=0;i<MAX_FAVORITE_SKINS;i++)
@ -1497,6 +1500,8 @@ void CMinecraftApp::ApplyGameSettingsChanged(int iPad)
ActionGameSettings(iPad,eGameSetting_PS3_EULA_Read);
ActionGameSettings(iPad,eGameSetting_VSync);
//TU25
ActionGameSettings(iPad, eGameSetting_ClassicCrafting);
}
void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
@ -1747,6 +1752,9 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
}
#endif
break;
case eGameSetting_ClassicCrafting:
//nothing to do here
break;
}
}
@ -2489,7 +2497,21 @@ void CMinecraftApp::SetGameSettings(int iPad,eGameSetting eVal,unsigned char ucV
GameSettingsA[iPad]->bSettingsChanged=true;
}
break;
case eGameSetting_ClassicCrafting:
if ((GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_CLASSICCRAFTING) != (ucVal & 0x01) << 19)
{
if (ucVal == 1)
{
GameSettingsA[iPad]->uiBitmaskValues |= GAMESETTING_CLASSICCRAFTING;
}
else
{
GameSettingsA[iPad]->uiBitmaskValues &= ~GAMESETTING_CLASSICCRAFTING;
}
ActionGameSettings(iPad, eVal);
GameSettingsA[iPad]->bSettingsChanged = true;
}
break;
}
}
@ -2625,6 +2647,9 @@ unsigned char CMinecraftApp::GetGameSettings(int iPad,eGameSetting eVal)
case eGameSetting_PSVita_NetworkModeAdhoc:
return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_PSVITANETWORKMODEADHOC)>>17;
case eGameSetting_ClassicCrafting:
return (GameSettingsA[iPad]->uiBitmaskValues & GAMESETTING_CLASSICCRAFTING) >> 26;
case eGameSetting_VSync:
return (GameSettingsA[iPad]->uiBitmaskValues&GAMESETTING_VSYNC)>>24;

View file

@ -43,6 +43,8 @@ protected:
eSectionInventoryUsing,
eSectionInventoryInventory,
eSectionInventoryArmor,
eSectionInventoryCraftingGrid,
eSectionInventoryCraftingResult,
eSectionInventoryMax,
eSectionTrapUsing,
@ -118,6 +120,12 @@ protected:
eSectionFireworksResult,
eSectionFireworksIngredients,
eSectionFireworksMax,
eSectionClassicCraftingHotbar,
eSectionClassicCraftingInventory,
eSectionClassicCraftingResult,
eSectionClassicCraftingGrid,
eSectionClassicCraftingMax,
};
AbstractContainerMenu* m_menu;

View file

@ -0,0 +1,129 @@
#include "stdafx.h"
#include "IUIScene_ClassicCraftingMenu.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
IUIScene_AbstractContainerMenu::ESceneSection IUIScene_ClassicCraftingMenu::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 eSectionClassicCraftingGrid:
if (eTapDirection == eTapStateDown)
{
newSection = eSectionClassicCraftingInventory;
xOffset = -1;
}
else if (eTapDirection == eTapStateUp)
{
newSection = eSectionClassicCraftingHotbar;
xOffset = -1;
}
else if (eTapDirection == eTapStateLeft)
{
newSection = eSectionClassicCraftingResult;
}
else if (eTapDirection == eTapStateRight)
{
newSection = eSectionClassicCraftingResult;
}
break;
case eSectionClassicCraftingResult:
if (eTapDirection == eTapStateDown)
{
newSection = eSectionClassicCraftingInventory;
xOffset = -7;
}
else if (eTapDirection == eTapStateUp)
{
newSection = eSectionClassicCraftingHotbar;
xOffset = -7;
}
else if (eTapDirection == eTapStateLeft)
{
newSection = eSectionClassicCraftingGrid;
yOffset = -1;
*piTargetX = getSectionColumns(eSectionClassicCraftingGrid);
}
else if (eTapDirection == eTapStateRight)
{
newSection = eSectionClassicCraftingGrid;
yOffset = -1;
*piTargetX = 0;
}
break;
case eSectionClassicCraftingInventory:
if (eTapDirection == eTapStateDown)
{
newSection = eSectionClassicCraftingHotbar;
}
else if (eTapDirection == eTapStateUp)
{
if (*piTargetX < 6)
{
newSection = eSectionClassicCraftingGrid;
xOffset = 1;
}
else
{
newSection = eSectionClassicCraftingResult;
}
}
break;
case eSectionClassicCraftingHotbar:
if (eTapDirection == eTapStateDown)
{
if (*piTargetX < 6)
{
newSection = eSectionClassicCraftingGrid;
xOffset = 1;
}
else
{
newSection = eSectionClassicCraftingResult;
}
}
else if (eTapDirection == eTapStateUp)
{
newSection = eSectionClassicCraftingInventory;
}
break;
default:
assert(false);
break;
}
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, xOffset, yOffset);
return newSection;
}
int IUIScene_ClassicCraftingMenu::getSectionStartOffset(ESceneSection eSection)
{
int offset = 0;
switch (eSection)
{
case eSectionClassicCraftingHotbar:
offset = CraftingMenu::INV_SLOT_START + 27;
break;
case eSectionClassicCraftingInventory:
offset = CraftingMenu::INV_SLOT_START;
break;
case eSectionClassicCraftingGrid:
offset = CraftingMenu::CRAFT_SLOT_START;
break;
case eSectionClassicCraftingResult:
offset = CraftingMenu::RESULT_SLOT;
break;
default:
assert(false);
break;
}
return offset;
}

View file

@ -0,0 +1,10 @@
#pragma once
#include "IUIScene_AbstractContainerMenu.h"
class IUIScene_ClassicCraftingMenu : public virtual IUIScene_AbstractContainerMenu
{
protected:
virtual ESceneSection GetSectionAndSlotInDirection(ESceneSection eSection, ETapState eTapDirection, int* piTargetX, int* piTargetY);
int getSectionStartOffset(ESceneSection eSection);
};

View file

@ -1,72 +1,171 @@
#include "stdafx.h"
#include "IUIScene_InventoryMenu.h"
#include "../../../Minecraft.World/net.minecraft.world.inventory.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
#include "..\..\Minecraft.h"
#include "..\..\MultiPlayerLocalPlayer.h"
IUIScene_AbstractContainerMenu::ESceneSection IUIScene_InventoryMenu::GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY )
IUIScene_AbstractContainerMenu::ESceneSection IUIScene_InventoryMenu::GetSectionAndSlotInDirection(ESceneSection eSection, ETapState eTapDirection, int* piTargetX, int* piTargetY)
{
ESceneSection newSection = eSection;
Minecraft* pMinecraft = Minecraft::GetInstance();
// Find the new section if there is one
switch( eSection )
{
case eSectionInventoryArmor:
if(eTapDirection == eTapStateDown)
{
newSection = eSectionInventoryInventory;
}
else if(eTapDirection == eTapStateUp)
{
newSection = eSectionInventoryUsing;
}
break;
case eSectionInventoryInventory:
if(eTapDirection == eTapStateDown)
{
newSection = eSectionInventoryUsing;
}
else if(eTapDirection == eTapStateUp)
{
newSection = eSectionInventoryArmor;
}
break;
case eSectionInventoryUsing:
if(eTapDirection == eTapStateDown)
{
newSection = eSectionInventoryArmor;
}
else if(eTapDirection == eTapStateUp)
{
newSection = eSectionInventoryInventory;
}
break;
default:
assert( false );
break;
}
ESceneSection newSection = eSection;
int xOffset = 0;
int yOffset = 0;
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, 0);
//auto containerData = this->m_containerData;
return newSection;
switch (eSection)
{
case eSectionInventoryInventory:
if (eTapDirection == eTapStateDown)
{
newSection = eSectionInventoryUsing;
}
else if (eTapDirection == eTapStateUp)
{
if (app.GetGameSettings(getPad(), eGameSetting_ClassicCrafting) && *piTargetX >= 3)
{
if (*piTargetX < 7) {
newSection = eSectionInventoryCraftingGrid;
xOffset = 5;
}
else {
newSection = eSectionInventoryCraftingResult;
}
}
else
{
newSection = eSectionInventoryArmor;
}
}
break;
case eSectionInventoryUsing:
if (eTapDirection == eTapStateUp)
{
newSection = eSectionInventoryInventory;
}
else if (eTapDirection == eTapStateDown)
{
if (app.GetGameSettings(getPad(), eGameSetting_ClassicCrafting) && *piTargetX >= 3)
{
if (*piTargetX < 7) {
newSection = eSectionInventoryCraftingGrid;
xOffset = 5;
}
else {
newSection = eSectionInventoryCraftingResult;
}
}
else
{
newSection = eSectionInventoryArmor;
}
}
break;
case eSectionInventoryArmor:
if (eTapDirection == eTapStateDown)
{
newSection = eSectionInventoryInventory;
}
else if (eTapDirection == eTapStateUp)
{
newSection = eSectionInventoryUsing;
}
else if (eTapDirection == eTapStateLeft && app.GetGameSettings(getPad(), eGameSetting_ClassicCrafting))
{
newSection = eSectionInventoryCraftingResult;
}
else if (eTapDirection == eTapStateRight && app.GetGameSettings(getPad(), eGameSetting_ClassicCrafting))
{
newSection = eSectionInventoryCraftingGrid;
xOffset = 1;
yOffset = 1;
}
break;
case eSectionInventoryCraftingGrid:
if (app.GetGameSettings(getPad(), eGameSetting_ClassicCrafting))
{
if (eTapDirection == eTapStateUp)
{
newSection = eSectionInventoryUsing;
xOffset = -5;
}
else if (eTapDirection == eTapStateDown)
{
newSection = eSectionInventoryInventory;
xOffset = -5;
}
else if (eTapDirection == eTapStateLeft)
{
newSection = eSectionInventoryArmor;
yOffset = -1;
}
else if (eTapDirection == eTapStateRight)
{
newSection = eSectionInventoryCraftingResult;
}
}
break;
case eSectionInventoryCraftingResult:
if (app.GetGameSettings(getPad(), eGameSetting_ClassicCrafting))
{
if (eTapDirection == eTapStateUp)
{
newSection = eSectionInventoryUsing;
xOffset = -8;
}
else if (eTapDirection == eTapStateDown)
{
newSection = eSectionInventoryInventory;
xOffset = -8;
}
else if (eTapDirection == eTapStateLeft)
{
newSection = eSectionInventoryCraftingGrid;
//*piTargetX = containerData->getSectionColumns(eSectionInventoryCraftingGrid);
}
else if (eTapDirection == eTapStateRight)
{
newSection = eSectionInventoryArmor;
}
}
break;
default:
assert(false);
break;
}
IUIScene_AbstractContainerMenu::updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, xOffset, yOffset);
return newSection;
}
int IUIScene_InventoryMenu::getSectionStartOffset(ESceneSection eSection)
{
int offset = 0;
switch( eSection )
{
case eSectionInventoryArmor:
offset = InventoryMenu::ARMOR_SLOT_START;
break;
case eSectionInventoryInventory:
offset = InventoryMenu::INV_SLOT_START;
break;
case eSectionInventoryUsing:
offset = InventoryMenu::INV_SLOT_START + 27;
break;
default:
assert( false );
break;
}
return offset;
int offset = 0;
switch (eSection)
{
case eSectionInventoryArmor:
offset = InventoryMenu::ARMOR_SLOT_START;
break;
case eSectionInventoryInventory:
offset = InventoryMenu::INV_SLOT_START;
break;
case eSectionInventoryUsing:
offset = InventoryMenu::INV_SLOT_START + 27;
break;
case eSectionInventoryCraftingGrid:
offset = InventoryMenu::CRAFT_SLOT_START;
break;
case eSectionInventoryCraftingResult:
offset = InventoryMenu::RESULT_SLOT;
break;
default:
assert(false);
break;
}
return offset;
}

View file

@ -113,6 +113,7 @@
#include "UIScene_BookAndQuillMenu.h"
#include "UIScene_CraftingMenu.h"
#include "UIScene_ClassicCraftingMenu.h"
#include "UIScene_SignEntryMenu.h"
#include "UIScene_ConnectingProgress.h"

View file

@ -46,6 +46,7 @@ enum EUIScene
eUIScene_PauseMenu,
eUIScene_Crafting2x2Menu,
eUIScene_Crafting3x3Menu,
eUIScene_ClassicCraftingMenu,
eUIScene_FurnaceMenu,
eUIScene_ContainerMenu,
eUIScene_LargeContainerMenu,// for splitscreen

View file

@ -246,6 +246,9 @@ bool UILayer::NavigateToScene(int iPad, EUIScene scene, void *initData)
case eUIScene_Crafting3x3Menu:
newScene = new UIScene_CraftingMenu(iPad, initData, this);
break;
case eUIScene_ClassicCraftingMenu:
newScene = new UIScene_ClassicCraftingMenu(iPad, initData, this);
break;
case eUIScene_TradingMenu:
newScene = new UIScene_TradingMenu(iPad, initData, this);
break;

View file

@ -1,5 +1,7 @@
#pragma once
#include "UIControl_SlotList.h"
#include "UIControl_Cursor.h"
#include "UIControl_Label.h"
#include "UIScene.h"
#include "IUIScene_AbstractContainerMenu.h"

View file

@ -0,0 +1,222 @@
#include "stdafx.h"
#include "UI.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.level.tile.entity.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
#include "..\..\Minecraft.h"
#include "..\..\LocalPlayer.h"
#include "UIScene_ClassicCraftingMenu.h"
UIScene_ClassicCraftingMenu::UIScene_ClassicCraftingMenu(int iPad, void* _initData, UILayer* parentLayer) : UIScene_AbstractContainerMenu(iPad, parentLayer)
{
// Setup all the Iggy references we need for this scene
initialiseMovie();
CraftingPanelScreenInput* initData = static_cast<CraftingPanelScreenInput*>(_initData);
m_labelTitle.init(app.GetString(IDS_HOW_TO_PLAY_MENU_CRAFTING));
Minecraft* pMinecraft = Minecraft::GetInstance();
if (pMinecraft->localgameModes[m_iPad] != nullptr)
{
TutorialMode* gameMode = static_cast<TutorialMode*>(pMinecraft->localgameModes[m_iPad]);
m_previousTutorialState = gameMode->getTutorial()->getCurrentState();
gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_3x3Crafting_Menu, this);
}
//TODO: Add Fireworks check
// m_labelTitle.init(app.GetString(IDS_HOW_TO_PLAY_MENU_FIREWORKS));
// FireworksMenu *m_menu = new FireworksMenu(initData->player->inventory, initData->player->level, initData->x, initData->y, initData->z);
CraftingMenu* m_menu = new CraftingMenu(initData->player->inventory, initData->player->level, initData->x, initData->y, initData->z);
Initialize(initData->iPad, m_menu, true, CraftingMenu::INV_SLOT_START, eSectionClassicCraftingHotbar, eSectionClassicCraftingMax);
m_slotListResult.addSlots(CraftingMenu::RESULT_SLOT, 1);
m_slotListCrafting.addSlots(CraftingMenu::CRAFT_SLOT_START, 9);
app.SetRichPresenceContext(m_iPad, CONTEXT_GAME_STATE_CRAFTING);
delete initData;
}
wstring UIScene_ClassicCraftingMenu::getMoviePath()
{
if (app.GetLocalPlayerCount() > 1)
return L"ClassicCraftingMenuSplit";
else
return L"ClassicCraftingMenu";
}
void UIScene_ClassicCraftingMenu::handleReload()
{
Initialize(m_iPad, m_menu, true, CraftingMenu::INV_SLOT_START, eSectionClassicCraftingHotbar, eSectionClassicCraftingMax);
m_slotListResult.addSlots(CraftingMenu::RESULT_SLOT, 1);
m_slotListCrafting.addSlots(CraftingMenu::CRAFT_SLOT_START, 9);
}
int UIScene_ClassicCraftingMenu::getSectionColumns(ESceneSection eSection)
{
int cols = 0;
switch (eSection)
{
case eSectionClassicCraftingHotbar:
cols = 9;
break;
case eSectionClassicCraftingInventory:
cols = 9;
break;
case eSectionClassicCraftingGrid:
cols = 3;
break;
case eSectionClassicCraftingResult:
cols = 1;
break;
default:
assert(false);
break;
}
return cols;
}
int UIScene_ClassicCraftingMenu::getSectionRows(ESceneSection eSection)
{
int rows = 0;
switch (eSection)
{
case eSectionClassicCraftingHotbar:
rows = 1;
break;
case eSectionClassicCraftingInventory:
rows = 3;
break;
case eSectionClassicCraftingGrid:
rows = 3;
break;
case eSectionClassicCraftingResult:
rows = 1;
break;
default:
assert(false);
break;
}
return rows;
}
void UIScene_ClassicCraftingMenu::GetPositionOfSection(ESceneSection eSection, UIVec2D* pPosition)
{
switch (eSection)
{
case eSectionClassicCraftingHotbar:
pPosition->x = m_slotListHotbar.getXPos();
pPosition->y = m_slotListHotbar.getYPos();
break;
case eSectionClassicCraftingInventory:
pPosition->x = m_slotListInventory.getXPos();
pPosition->y = m_slotListInventory.getYPos();
break;
case eSectionClassicCraftingGrid:
pPosition->x = m_slotListCrafting.getXPos();
pPosition->y = m_slotListCrafting.getYPos();
break;
case eSectionClassicCraftingResult:
pPosition->x = m_slotListResult.getXPos();
pPosition->y = m_slotListResult.getYPos();
break;
default:
assert(false);
break;
}
}
void UIScene_ClassicCraftingMenu::GetItemScreenData(ESceneSection eSection, int iItemIndex, UIVec2D* pPosition, UIVec2D* pSize)
{
UIVec2D sectionSize;
switch (eSection)
{
case eSectionClassicCraftingHotbar:
sectionSize.x = m_slotListHotbar.getWidth();
sectionSize.y = m_slotListHotbar.getHeight();
break;
case eSectionClassicCraftingInventory:
sectionSize.x = m_slotListInventory.getWidth();
sectionSize.y = m_slotListInventory.getHeight();
break;
case eSectionClassicCraftingGrid:
sectionSize.x = m_slotListCrafting.getWidth();
sectionSize.y = m_slotListCrafting.getHeight();
break;
case eSectionClassicCraftingResult:
sectionSize.x = m_slotListResult.getWidth();
sectionSize.y = m_slotListResult.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_ClassicCraftingMenu::setSectionSelectedSlot(ESceneSection eSection, int x, int y)
{
int cols = getSectionColumns(eSection);
int index = (y * cols) + x;
UIControl_SlotList* slotList = nullptr;
switch (eSection)
{
case eSectionClassicCraftingHotbar:
slotList = &m_slotListHotbar;
break;
case eSectionClassicCraftingInventory:
slotList = &m_slotListInventory;
break;
case eSectionClassicCraftingGrid:
slotList = &m_slotListCrafting;
break;
case eSectionClassicCraftingResult:
slotList = &m_slotListResult;
break;
default:
assert(false);
break;
}
slotList->setHighlightSlot(index);
}
UIControl* UIScene_ClassicCraftingMenu::getSection(ESceneSection eSection)
{
UIControl* control = nullptr;
switch (eSection)
{
case eSectionClassicCraftingHotbar:
control = &m_slotListHotbar;
break;
case eSectionClassicCraftingInventory:
control = &m_slotListInventory;
break;
case eSectionClassicCraftingGrid:
control = &m_slotListCrafting;
break;
case eSectionClassicCraftingResult:
control = &m_slotListResult;
break;
default:
assert(false);
break;
}
return control;
}

View file

@ -0,0 +1,38 @@
#pragma once
#include "UIScene_AbstractContainerMenu.h"
#include "IUIScene_ClassicCraftingMenu.h"
class InventoryMenu;
class UIScene_ClassicCraftingMenu : public UIScene_AbstractContainerMenu, public IUIScene_ClassicCraftingMenu
{
public:
UIScene_ClassicCraftingMenu(int iPad, void* initData, UILayer* parentLayer);
virtual EUIScene getSceneType() { return eUIScene_ClassicCraftingMenu; }
protected:
UIControl_SlotList m_slotListCrafting, m_slotListResult;
UIControl_Label m_labelTitle, m_labelInventory;
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene_AbstractContainerMenu)
UI_BEGIN_MAP_CHILD_ELEMENTS(m_controlMainPanel)
UI_MAP_ELEMENT(m_slotListCrafting, "CraftingList")
UI_MAP_ELEMENT(m_slotListResult, "Result")
UI_MAP_ELEMENT(m_labelTitle, "TitleLabel")
UI_END_MAP_CHILD_ELEMENTS()
UI_END_MAP_ELEMENTS_AND_NAMES()
virtual 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);
};

View file

@ -2,84 +2,100 @@
#include "UI.h"
#include "UIScene_InventoryMenu.h"
#include "../../../Minecraft.World/net.minecraft.world.inventory.h"
#include "../../../Minecraft.World/net.minecraft.world.item.h"
#include "../../../Minecraft.World/net.minecraft.stats.h"
#include "../../../Minecraft.World/net.minecraft.world.effect.h"
#include "../../MultiPlayerLocalPlayer.h"
#include "../../Minecraft.h"
#include "../../Options.h"
#include "../../EntityRenderDispatcher.h"
#include "../../Lighting.h"
#include "../Tutorial/Tutorial.h"
#include "../Tutorial/TutorialMode.h"
#include "../Tutorial/TutorialEnum.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
#include "..\..\..\Minecraft.World\net.minecraft.stats.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.effect.h"
#include "..\..\MultiplayerLocalPlayer.h"
#include "..\..\Minecraft.h"
#include "..\..\Options.h"
#include "..\..\EntityRenderDispatcher.h"
#include "..\..\Lighting.h"
#include "..\Tutorial\Tutorial.h"
#include "..\Tutorial\TutorialMode.h"
#include "..\Tutorial\TutorialEnum.h"
#define INVENTORY_UPDATE_EFFECTS_TIMER_ID (10)
#define INVENTORY_UPDATE_EFFECTS_TIMER_TIME (1000) // 1 second
UIScene_InventoryMenu::UIScene_InventoryMenu(int iPad, void *_initData, UILayer *parentLayer) : UIScene_AbstractContainerMenu(iPad, parentLayer)
UIScene_InventoryMenu::UIScene_InventoryMenu(int iPad, void* _initData, UILayer* parentLayer) : UIScene_AbstractContainerMenu(iPad, parentLayer)
{
// Setup all the Iggy references we need for this scene
initialiseMovie();
InventoryScreenInput *initData = static_cast<InventoryScreenInput *>(_initData);
InventoryScreenInput* initData = static_cast<InventoryScreenInput*>(_initData);
Minecraft *pMinecraft = Minecraft::GetInstance();
if( pMinecraft->localgameModes[initData->iPad] != nullptr )
if (app.GetGameSettings(iPad, eGameSetting_ClassicCrafting))
{
TutorialMode *gameMode = static_cast<TutorialMode *>(pMinecraft->localgameModes[initData->iPad]);
m_slotListCrafting.addSlots(InventoryMenu::CRAFT_SLOT_START, 4);
m_slotListResult.addSlots(InventoryMenu::RESULT_SLOT, 1);
m_labelCrafting.init(L"Crafting");
this->m_bIsClassicCrafting = true;
}
else
this->m_bIsClassicCrafting = false;
SetClassicCrafting(this->m_bIsClassicCrafting);
Minecraft* pMinecraft = Minecraft::GetInstance();
if (pMinecraft->localgameModes[initData->iPad] != nullptr)
{
TutorialMode* gameMode = static_cast<TutorialMode*>(pMinecraft->localgameModes[initData->iPad]);
m_previousTutorialState = gameMode->getTutorial()->getCurrentState();
gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Inventory_Menu, this);
}
InventoryMenu *menu = static_cast<InventoryMenu *>(initData->player->inventoryMenu);
InventoryMenu* menu = static_cast<InventoryMenu*>(initData->player->inventoryMenu);
initData->player->awardStat(GenericStats::openInventory(),GenericStats::param_openInventory());
initData->player->awardStat(GenericStats::openInventory(), GenericStats::param_openInventory());
Initialize( initData->iPad, menu, false, InventoryMenu::INV_SLOT_START, eSectionInventoryUsing, eSectionInventoryMax, initData->bNavigateBack );
if (this->m_bIsClassicCrafting)
Initialize(initData->iPad, menu, false, InventoryMenu::INV_SLOT_START, eSectionInventoryUsing, eSectionInventoryMax, initData->bNavigateBack);
else
Initialize(initData->iPad, menu, false, InventoryMenu::INV_SLOT_START, eSectionInventoryUsing, eSectionInventoryCraftingGrid, initData->bNavigateBack);
m_slotListArmor.addSlots(InventoryMenu::ARMOR_SLOT_START, InventoryMenu::ARMOR_SLOT_END - InventoryMenu::ARMOR_SLOT_START);
if(initData) delete initData;
if (initData) delete initData;
for(unsigned int i = 0; i < MobEffect::NUM_EFFECTS; ++i)
{
for (unsigned int i = 0; i < MobEffect::NUM_EFFECTS; ++i)
m_bEffectTime[i] = 0;
}
updateEffectsDisplay();
addTimer(INVENTORY_UPDATE_EFFECTS_TIMER_ID,INVENTORY_UPDATE_EFFECTS_TIMER_TIME);
addTimer(INVENTORY_UPDATE_EFFECTS_TIMER_ID, INVENTORY_UPDATE_EFFECTS_TIMER_TIME);
}
wstring UIScene_InventoryMenu::getMoviePath()
{
if(app.GetLocalPlayerCount() > 1)
{
if (app.GetLocalPlayerCount() > 1)
return L"InventoryMenuSplit";
}
else
{
return L"InventoryMenu";
}
}
void UIScene_InventoryMenu::handleReload()
{
Initialize( m_iPad, m_menu, false, InventoryMenu::INV_SLOT_START, eSectionInventoryUsing, eSectionInventoryMax, m_bNavigateBack );
Initialize(m_iPad, m_menu, false, InventoryMenu::INV_SLOT_START, eSectionInventoryUsing, eSectionInventoryMax, m_bNavigateBack);
SetClassicCrafting(this->m_bIsClassicCrafting);
m_slotListArmor.addSlots(InventoryMenu::ARMOR_SLOT_START, InventoryMenu::ARMOR_SLOT_END - InventoryMenu::ARMOR_SLOT_START);
for(unsigned int i = 0; i < MobEffect::NUM_EFFECTS; ++i)
if (this->m_bIsClassicCrafting)
{
m_bEffectTime[i] = 0;
m_slotListCrafting.addSlots(InventoryMenu::CRAFT_SLOT_START, 4);
m_slotListResult.addSlots(InventoryMenu::RESULT_SLOT, 1);
}
for (unsigned int i = 0; i < MobEffect::NUM_EFFECTS; ++i)
m_bEffectTime[i] = 0;
}
int UIScene_InventoryMenu::getSectionColumns(ESceneSection eSection)
{
int cols = 0;
switch( eSection )
switch (eSection)
{
case eSectionInventoryArmor:
cols = 1;
@ -90,8 +106,14 @@ int UIScene_InventoryMenu::getSectionColumns(ESceneSection eSection)
case eSectionInventoryUsing:
cols = 9;
break;
case eSectionInventoryCraftingGrid:
cols = 2;
break;
case eSectionInventoryCraftingResult:
cols = 1;
break;
default:
assert( false );
assert(false);
break;
}
return cols;
@ -100,7 +122,7 @@ int UIScene_InventoryMenu::getSectionColumns(ESceneSection eSection)
int UIScene_InventoryMenu::getSectionRows(ESceneSection eSection)
{
int rows = 0;
switch( eSection )
switch (eSection)
{
case eSectionInventoryArmor:
rows = 4;
@ -111,16 +133,22 @@ int UIScene_InventoryMenu::getSectionRows(ESceneSection eSection)
case eSectionInventoryUsing:
rows = 1;
break;
case eSectionInventoryCraftingGrid:
rows = 2;
break;
case eSectionInventoryCraftingResult:
rows = 1;
break;
default:
assert( false );
assert(false);
break;
}
return rows;
}
void UIScene_InventoryMenu::GetPositionOfSection( ESceneSection eSection, UIVec2D* pPosition )
void UIScene_InventoryMenu::GetPositionOfSection(ESceneSection eSection, UIVec2D* pPosition)
{
switch( eSection )
switch (eSection)
{
case eSectionInventoryArmor:
pPosition->x = m_slotListArmor.getXPos();
@ -134,17 +162,25 @@ void UIScene_InventoryMenu::GetPositionOfSection( ESceneSection eSection, UIVec2
pPosition->x = m_slotListHotbar.getXPos();
pPosition->y = m_slotListHotbar.getYPos();
break;
case eSectionInventoryCraftingGrid:
pPosition->x = m_slotListCrafting.getXPos();
pPosition->y = m_slotListCrafting.getYPos();
break;
case eSectionInventoryCraftingResult:
pPosition->x = m_slotListResult.getXPos();
pPosition->y = m_slotListResult.getYPos();
break;
default:
assert( false );
assert(false);
break;
}
}
void UIScene_InventoryMenu::GetItemScreenData( ESceneSection eSection, int iItemIndex, UIVec2D* pPosition, UIVec2D* pSize )
void UIScene_InventoryMenu::GetItemScreenData(ESceneSection eSection, int iItemIndex, UIVec2D* pPosition, UIVec2D* pSize)
{
UIVec2D sectionSize;
switch( eSection )
switch (eSection)
{
case eSectionInventoryArmor:
sectionSize.x = m_slotListArmor.getWidth();
@ -158,19 +194,27 @@ void UIScene_InventoryMenu::GetItemScreenData( ESceneSection eSection, int iItem
sectionSize.x = m_slotListHotbar.getWidth();
sectionSize.y = m_slotListHotbar.getHeight();
break;
case eSectionInventoryCraftingGrid:
sectionSize.x = m_slotListCrafting.getWidth();
sectionSize.y = m_slotListCrafting.getHeight();
break;
case eSectionInventoryCraftingResult:
sectionSize.x = m_slotListResult.getWidth();
sectionSize.y = m_slotListResult.getHeight();
break;
default:
assert( false );
assert(false);
break;
}
int rows = getSectionRows(eSection);
int cols = getSectionColumns(eSection);
pSize->x = sectionSize.x/cols;
pSize->y = sectionSize.y/rows;
pSize->x = sectionSize.x / cols;
pSize->y = sectionSize.y / rows;
int itemCol = iItemIndex % cols;
int itemRow = iItemIndex/cols;
int itemRow = iItemIndex / cols;
pPosition->x = itemCol * pSize->x;
pPosition->y = itemRow * pSize->y;
@ -182,8 +226,8 @@ void UIScene_InventoryMenu::setSectionSelectedSlot(ESceneSection eSection, int x
int index = (y * cols) + x;
UIControl_SlotList *slotList = nullptr;
switch( eSection )
UIControl_SlotList* slotList = nullptr;
switch (eSection)
{
case eSectionInventoryArmor:
slotList = &m_slotListArmor;
@ -194,15 +238,24 @@ void UIScene_InventoryMenu::setSectionSelectedSlot(ESceneSection eSection, int x
case eSectionInventoryUsing:
slotList = &m_slotListHotbar;
break;
case eSectionInventoryCraftingGrid:
slotList = &m_slotListCrafting;
break;
case eSectionInventoryCraftingResult:
slotList = &m_slotListResult;
break;
default:
assert(false);
break;
}
slotList->setHighlightSlot(index);
}
UIControl *UIScene_InventoryMenu::getSection(ESceneSection eSection)
UIControl* UIScene_InventoryMenu::getSection(ESceneSection eSection)
{
UIControl *control = nullptr;
switch( eSection )
UIControl* control = nullptr;
switch (eSection)
{
case eSectionInventoryArmor:
control = &m_slotListArmor;
@ -213,19 +266,28 @@ UIControl *UIScene_InventoryMenu::getSection(ESceneSection eSection)
case eSectionInventoryUsing:
control = &m_slotListHotbar;
break;
case eSectionInventoryCraftingGrid:
control = &m_slotListCrafting;
break;
case eSectionInventoryCraftingResult:
control = &m_slotListResult;
break;
default:
assert(false);
break;
}
return control;
}
void UIScene_InventoryMenu::customDraw(IggyCustomDrawCallbackRegion *region)
void UIScene_InventoryMenu::customDraw(IggyCustomDrawCallbackRegion* region)
{
Minecraft *pMinecraft = Minecraft::GetInstance();
if(pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return;
Minecraft* pMinecraft = Minecraft::GetInstance();
if (pMinecraft->localplayers[m_iPad] == nullptr || pMinecraft->localgameModes[m_iPad] == nullptr) return;
if(wcscmp((wchar_t *)region->name,L"player")==0)
if (wcscmp((wchar_t*)region->name, L"player") == 0)
{
// Setup GDraw, normal game render states and matrices
CustomDrawData *customDrawRegion = ui.setupCustomDraw(this,region);
CustomDrawData* customDrawRegion = ui.setupCustomDraw(this, region);
delete customDrawRegion;
m_playerPreview.render(region);
@ -234,14 +296,12 @@ void UIScene_InventoryMenu::customDraw(IggyCustomDrawCallbackRegion *region)
ui.endCustomDraw(region);
}
else
{
UIScene_AbstractContainerMenu::customDraw(region);
}
}
void UIScene_InventoryMenu::handleTimerComplete(int id)
{
if(id == INVENTORY_UPDATE_EFFECTS_TIMER_ID)
if (id == INVENTORY_UPDATE_EFFECTS_TIMER_ID)
{
updateEffectsDisplay();
}
@ -250,51 +310,51 @@ void UIScene_InventoryMenu::handleTimerComplete(int id)
void UIScene_InventoryMenu::updateEffectsDisplay()
{
// Update with the current effects
Minecraft *pMinecraft = Minecraft::GetInstance();
Minecraft* pMinecraft = Minecraft::GetInstance();
shared_ptr<MultiplayerLocalPlayer> player = pMinecraft->localplayers[m_iPad];
if(player == nullptr) return;
if (player == nullptr) return;
vector<MobEffectInstance *> *activeEffects = player->getActiveEffects();
vector<MobEffectInstance*>* activeEffects = player->getActiveEffects();
// 4J - TomK setup time update value array size to update the active effects
int iValue = 0;
IggyDataValue *UpdateValue = new IggyDataValue[activeEffects->size()*2];
IggyDataValue* UpdateValue = new IggyDataValue[activeEffects->size() * 2];
for(auto& effect : *activeEffects)
for (auto& effect : *activeEffects)
{
if(effect->getDuration() >= m_bEffectTime[effect->getId()])
if (effect->getDuration() >= m_bEffectTime[effect->getId()])
{
wstring effectString = app.GetString( effect->getDescriptionId() );//I18n.get(effect.getDescriptionId()).trim();
wstring effectString = app.GetString(effect->getDescriptionId());//I18n.get(effect.getDescriptionId()).trim();
if (effect->getAmplifier() > 0)
{
wstring potencyString = L"";
switch(effect->getAmplifier())
switch (effect->getAmplifier())
{
case 1:
potencyString = L" ";
potencyString += app.GetString( IDS_POTION_POTENCY_1 );
potencyString += app.GetString(IDS_POTION_POTENCY_1);
break;
case 2:
potencyString = L" ";
potencyString += app.GetString( IDS_POTION_POTENCY_2 );
potencyString += app.GetString(IDS_POTION_POTENCY_2);
break;
case 3:
potencyString = L" ";
potencyString += app.GetString( IDS_POTION_POTENCY_3 );
potencyString += app.GetString(IDS_POTION_POTENCY_3);
break;
default:
potencyString = app.GetString( IDS_POTION_POTENCY_0 );
potencyString = app.GetString(IDS_POTION_POTENCY_0);
break;
}
effectString += potencyString;
}
int icon = 0;
MobEffect *mobEffect = MobEffect::effects[effect->getId()];
MobEffect* mobEffect = MobEffect::effects[effect->getId()];
if (mobEffect->hasIcon())
{
icon = mobEffect->getIcon();
}
}
IggyDataValue result;
IggyDataValue value[3];
value[0].type = IGGY_DATATYPE_number;
@ -309,24 +369,40 @@ void UIScene_InventoryMenu::updateEffectsDisplay()
int seconds = effect->getDuration() / SharedConstants::TICKS_PER_SECOND;
value[2].type = IGGY_DATATYPE_number;
value[2].number = seconds;
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAddEffect , 3 , value );
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result, IggyPlayerRootPath(getMovie()), m_funcAddEffect, 3, value);
}
if(MobEffect::effects[effect->getId()]->hasIcon())
if (MobEffect::effects[effect->getId()]->hasIcon())
{
// 4J - TomK set ids and remaining duration so we can update the timers accurately in one call! (this prevents performance related timer sync issues, especially on PSVita)
UpdateValue[iValue].type = IGGY_DATATYPE_number;
UpdateValue[iValue].number = MobEffect::effects[effect->getId()]->getIcon();
UpdateValue[iValue + 1].type = IGGY_DATATYPE_number;
UpdateValue[iValue + 1].number = (int)(effect->getDuration() / SharedConstants::TICKS_PER_SECOND);
iValue+=2;
iValue += 2;
}
m_bEffectTime[effect->getId()] = effect->getDuration();
}
IggyDataValue result;
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcUpdateEffects , activeEffects->size()*2 , UpdateValue );
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result, IggyPlayerRootPath(getMovie()), m_funcUpdateEffects, activeEffects->size() * 2, UpdateValue);
delete activeEffects;
}
void UIScene_InventoryMenu::SetClassicCrafting(bool m_bIsClassicCrafting)
{
IggyDataValue result;
IggyDataValue arg;
arg.type = IGGY_DATATYPE_boolean;
arg.boolval = m_bIsClassicCrafting;
IggyResult out = IggyPlayerCallMethodRS(getMovie(), &result, IggyPlayerRootPath(getMovie()), m_funcSetClassicCrafting, 1, &arg);
if (!m_bIsClassicCrafting)
{
m_slotListArmor.UpdateControl();
m_playerPreview.UpdateControl();
}
}

View file

@ -3,7 +3,7 @@
#include "UIScene_AbstractContainerMenu.h"
#include "IUIScene_InventoryMenu.h"
#include "../../../Minecraft.World/MobEffect.h"
#include "..\..\..\Minecraft.World\MobEffect.h"
class InventoryMenu;
@ -12,40 +12,49 @@ class UIScene_InventoryMenu : public UIScene_AbstractContainerMenu, public IUISc
friend class UIControl_MinecraftPlayer;
private:
int m_bEffectTime[MobEffect::NUM_EFFECTS];
public:
UIScene_InventoryMenu(int iPad, void *initData, UILayer *parentLayer);
int m_bIsClassicCrafting;
virtual EUIScene getSceneType() { return eUIScene_InventoryMenu;}
void updateEffectsDisplay();
void SetClassicCrafting(bool m_bIsClassicCrafting);
public:
UIScene_InventoryMenu(int iPad, void* initData, UILayer* parentLayer);
virtual EUIScene getSceneType() { return eUIScene_InventoryMenu; }
protected:
UIControl_SlotList m_slotListArmor;
UIControl_SlotList m_slotListArmor, m_slotListCrafting, m_slotListResult;
UIControl_MinecraftPlayer m_playerPreview;
IggyName m_funcUpdateEffects, m_funcAddEffect;
UIControl_Label m_labelCrafting;
IggyName m_funcSetClassicCrafting, m_funcUpdateEffects, m_funcAddEffect;
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene_AbstractContainerMenu)
UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlMainPanel )
UI_MAP_ELEMENT( m_slotListArmor, "armorList")
UI_MAP_ELEMENT( m_playerPreview, "iggy_player")
UI_BEGIN_MAP_CHILD_ELEMENTS(m_controlMainPanel)
UI_MAP_ELEMENT(m_slotListArmor, "armorList")
UI_MAP_ELEMENT(m_playerPreview, "iggy_player")
UI_MAP_ELEMENT(m_slotListCrafting, "craftingList")
UI_MAP_ELEMENT(m_slotListResult, "Result")
UI_MAP_ELEMENT(m_labelCrafting, "craftingLabel")
UI_MAP_NAME( m_funcUpdateEffects, L"UpdateEffects")
UI_MAP_NAME( m_funcAddEffect, L"AddEffect")
UI_MAP_NAME(m_funcSetClassicCrafting, L"SetClassicCrafting")
UI_MAP_NAME(m_funcUpdateEffects, L"UpdateEffects")
UI_MAP_NAME(m_funcAddEffect, L"AddEffect")
UI_END_MAP_CHILD_ELEMENTS()
UI_END_MAP_ELEMENTS_AND_NAMES()
UI_END_MAP_ELEMENTS_AND_NAMES()
virtual wstring getMoviePath();
virtual 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 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 UIControl* getSection(ESceneSection eSection);
virtual void customDraw(IggyCustomDrawCallbackRegion *region);
virtual void customDraw(IggyCustomDrawCallbackRegion* region);
virtual void handleTimerComplete(int id);
private:
void updateEffectsDisplay();
};

View file

@ -15,6 +15,7 @@ UIScene_SettingsUIMenu::UIScene_SettingsUIMenu(int iPad, void *initData, UILayer
m_checkboxDisplayAnimatedCharacter.init(app.GetString(IDS_CHECKBOX_ANIMATED_CHARACTER),eControl_DisplayAnimatedCharacter,(app.GetGameSettings(m_iPad,eGameSetting_AnimatedCharacter)!=0));
m_checkboxSplitscreen.init(app.GetString(IDS_CHECKBOX_VERTICAL_SPLIT_SCREEN),eControl_Splitscreen,(app.GetGameSettings(m_iPad,eGameSetting_SplitScreenVertical)!=0));
m_checkboxShowSplitscreenGamertags.init(app.GetString(IDS_CHECKBOX_DISPLAY_SPLITSCREENGAMERTAGS),eControl_ShowSplitscreenGamertags,(app.GetGameSettings(m_iPad,eGameSetting_DisplaySplitscreenGamertags)!=0));
m_checkboxShowClassicCrafting.init(app.GetString(IDS_CHECKBOX_CLASSICCRAFTING), eControl_ShowClassicCrafting, (app.GetGameSettings(m_iPad, eGameSetting_ClassicCrafting) != 0));
WCHAR TempString[256];
@ -104,6 +105,8 @@ void UIScene_SettingsUIMenu::handleInput(int iPad, int key, bool repeat, bool pr
app.SetGameSettings(m_iPad,eGameSetting_DisplaySplitscreenGamertags,m_checkboxShowSplitscreenGamertags.IsChecked()?1:0);
app.SetGameSettings(m_iPad,eGameSetting_DeathMessages,m_checkboxDisplayDeathMessages.IsChecked()?1:0);
app.SetGameSettings(m_iPad,eGameSetting_AnimatedCharacter,m_checkboxDisplayAnimatedCharacter.IsChecked()?1:0);
app.SetGameSettings(m_iPad, eGameSetting_ClassicCrafting, m_checkboxShowClassicCrafting.IsChecked() ? 1 : 0);
// if the splitscreen vertical/horizontal has changed, need to update the scenes
if(app.GetGameSettings(m_iPad,eGameSetting_SplitScreenVertical)!=(m_checkboxSplitscreen.IsChecked()?1:0))

View file

@ -13,11 +13,12 @@ private:
eControl_DisplayAnimatedCharacter,
eControl_Splitscreen,
eControl_ShowSplitscreenGamertags,
eControl_ShowClassicCrafting,
eControl_UISize,
eControl_UISizeSplitscreen
};
UIControl_CheckBox m_checkboxDisplayHUD, m_checkboxDisplayHand, m_checkboxDisplayDeathMessages, m_checkboxDisplayAnimatedCharacter, m_checkboxSplitscreen, m_checkboxShowSplitscreenGamertags; // Checkboxes
UIControl_CheckBox m_checkboxDisplayHUD, m_checkboxDisplayHand, m_checkboxDisplayDeathMessages, m_checkboxDisplayAnimatedCharacter, m_checkboxSplitscreen, m_checkboxShowSplitscreenGamertags, m_checkboxShowClassicCrafting; // Checkboxes
UIControl_Slider m_sliderUISize, m_sliderUISizeSplitscreen; // Sliders
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
UI_MAP_ELEMENT( m_checkboxDisplayHUD, "DisplayHUD")
@ -26,6 +27,7 @@ private:
UI_MAP_ELEMENT( m_checkboxDisplayAnimatedCharacter, "DisplayAnimatedCharacter")
UI_MAP_ELEMENT( m_checkboxSplitscreen, "Splitscreen")
UI_MAP_ELEMENT( m_checkboxShowSplitscreenGamertags, "ShowSplitscreenGamertags")
UI_MAP_ELEMENT(m_checkboxShowClassicCrafting, "ShowClassicCrafting")
UI_MAP_ELEMENT( m_sliderUISize, "UISize")
UI_MAP_ELEMENT( m_sliderUISizeSplitscreen, "UISizeSplitscreen")

View file

@ -1520,7 +1520,7 @@ void Minecraft::run_middle()
if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_CRAFTING) || g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_CRAFTING_ALT))
{
if((ui.IsSceneInStack(i, eUIScene_Crafting2x2Menu) || ui.IsSceneInStack(i, eUIScene_Crafting3x3Menu) || ui.IsSceneInStack(i, eUIScene_CreativeMenu) || isClosableByEitherKey) && !isEditing)
if ((ui.IsSceneInStack(i, eUIScene_Crafting2x2Menu) || ui.IsSceneInStack(i, eUIScene_Crafting3x3Menu) || ui.IsSceneInStack(i, eUIScene_CreativeMenu) || ui.IsSceneInStack(i, eUIScene_ClassicCraftingMenu) || isClosableByEitherKey) && !isEditing)
{
ui.CloseUIScenes(i);
}
@ -3900,7 +3900,10 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
else
{
ui.PlayUISFX(eSFX_Press);
app.LoadCrafting2x2Menu(iPad, player);
if (app.GetGameSettings(iPad, eGameSetting_ClassicCrafting))
app.LoadInventoryMenu(iPad, player);
else
app.LoadCrafting2x2Menu(iPad, player);
}
}

View file

@ -9568,4 +9568,6 @@ All Ender Chests in a world are linked. Items placed into an Ender Chest are acc
<data name="IDS_ACHIEVE_DESC_LION_TAMER"><value>Tame an ocelot.</value></data>
<data name="IDS_ACHIEVEMENT_VIEW"><value>Hold {*CONTROLLER_VK_Y*} to view</value></data>
<data name="IDS_CHECKBOX_CLASSICCRAFTING"><value>Classic Crafting</value></data>
</root>

View file

@ -293,6 +293,8 @@ set(_MINECRAFT_CLIENT_COMMON_COMMON_UI_ALL_PLATFORMS
"${BASE_DIR}/UI/IUIScene_ContainerMenu.h"
"${BASE_DIR}/UI/IUIScene_CraftingMenu.cpp"
"${BASE_DIR}/UI/IUIScene_CraftingMenu.h"
"${BASE_DIR}/UI/IUIScene_ClassicCraftingMenu.cpp"
"${BASE_DIR}/UI/IUIScene_ClassicCraftingMenu.h"
"${BASE_DIR}/UI/IUIScene_CreativeMenu.cpp"
"${BASE_DIR}/UI/IUIScene_CreativeMenu.h"
"${BASE_DIR}/UI/IUIScene_DispenserMenu.cpp"

View file

@ -219,6 +219,8 @@ source_group("Common/UI/Scenes/Help & Options" FILES ${_MINECRAFT_CLIENT_WINDOWS
set(_MINECRAFT_CLIENT_WINDOWS_COMMON_UI_SCENES_INGAME_MENU_SCREENS
"${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_CraftingMenu.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_CraftingMenu.h"
"${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_ClassicCraftingMenu.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_ClassicCraftingMenu.h"
"${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_DeathMenu.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_DeathMenu.h"
"${CMAKE_CURRENT_SOURCE_DIR}/Common/UI/UIScene_EndPoem.cpp"

View file

@ -9,14 +9,6 @@
#include "ResultSlot.h"
#include "CraftingMenu.h"
const int CraftingMenu::RESULT_SLOT = 0;
const int CraftingMenu::CRAFT_SLOT_START = 1;
const int CraftingMenu::CRAFT_SLOT_END = CraftingMenu::CRAFT_SLOT_START + 9;
const int CraftingMenu::INV_SLOT_START = CraftingMenu::CRAFT_SLOT_END;
const int CraftingMenu::INV_SLOT_END = CraftingMenu::INV_SLOT_START + 9 * 3;
const int CraftingMenu::USE_ROW_SLOT_START = CraftingMenu::INV_SLOT_END;
const int CraftingMenu::USE_ROW_SLOT_END = CraftingMenu::USE_ROW_SLOT_START + 9;
CraftingMenu::CraftingMenu(shared_ptr<Inventory> inventory, Level *level, int xt, int yt, int zt) : AbstractContainerMenu()
{
craftSlots = std::make_shared<CraftingContainer>(this, 3, 3);

View file

@ -9,13 +9,13 @@ class CraftingMenu : public AbstractContainerMenu
{
// 4J Stu Made these public for UI menus, perhaps should make friend class?
public:
static const int RESULT_SLOT;
static const int CRAFT_SLOT_START;
static const int CRAFT_SLOT_END;
static const int INV_SLOT_START;
static const int INV_SLOT_END;
static const int USE_ROW_SLOT_START;
static const int USE_ROW_SLOT_END;
static const int RESULT_SLOT = 0;
static const int CRAFT_SLOT_START = 1;
static const int CRAFT_SLOT_END = CRAFT_SLOT_START + 9;
static const int INV_SLOT_START = CRAFT_SLOT_END;
static const int INV_SLOT_END = INV_SLOT_START + (9 * 3);
static const int USE_ROW_SLOT_START = INV_SLOT_END;
static const int USE_ROW_SLOT_END = USE_ROW_SLOT_START + 9;
public:
shared_ptr<CraftingContainer> craftSlots;

View file

@ -22,6 +22,7 @@ Huge thanks to the following projects:
- [Patoke/LCERenewed](https://github.com/Patoke/LCERenewed) - for some of the patches that required deep decompilation
- [itsRevela/LCE-Revelations](https://github.com/itsRevela/LCE-Revelations) - for providing a stable project for neoLegacy to continue with
- [GabsPuNs/MinecraftConsoles](https://github.com/GabsPuNs/MinecraftConsoles) - for providing Classic Crafting
# Build & Run