feat: TU19 (Dec 2014) Features & Content (#155)

* try to resolve merge conflict

* feat: TU19 (Dec 2014) Features & Content (#32)

* December 2014 files

* Working release build

* Fix compilation issues

* Add sound to Windows64Media

* Add DLC content and force Tutorial DLC

* Revert "Add DLC content and force Tutorial DLC"

This reverts commit 97a4399472.

* Disable broken light packing

* Disable breakpoint during DLC texture map load

Allows DLC loading but the DLC textures are still broken

* Fix post build not working

* ...

* fix vs2022 build

* fix cmake build

---------

Co-authored-by: Loki <lokirautio@gmail.com>
This commit is contained in:
daoge
2026-03-03 03:04:10 +08:00
committed by GitHub
parent 84c31a2331
commit b3feddfef3
2069 changed files with 264842 additions and 139522 deletions

View File

@@ -29,7 +29,7 @@ public:
virtual void SetTooltipText( unsigned int iPad, unsigned int tooltip, int iTextID ) = 0;
virtual void SetEnableTooltips( unsigned int iPad, BOOL bVal ) = 0;
virtual void ShowTooltip( unsigned int iPad, unsigned int tooltip, bool show ) = 0;
virtual void SetTooltips( unsigned int iPad, 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) = 0;
virtual void SetTooltips( unsigned int iPad, 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, int iRS=-1, int iBack=-1, bool forceUpdate = false) = 0;
virtual void EnableTooltip( unsigned int iPad, unsigned int tooltip, bool enable ) = 0;
virtual void RefreshTooltips(unsigned int iPad) = 0;

View File

@@ -104,7 +104,7 @@ int IUIScene_AbstractContainerMenu::GetSectionDimensions( ESceneSection eSection
return( ( *piNumRows ) * ( *piNumColumns ) );
}
void IUIScene_AbstractContainerMenu::updateSlotPosition( ESceneSection eSection, ESceneSection newSection, ETapState eTapDirection, int *piTargetX, int *piTargetY, int xOffset )
void IUIScene_AbstractContainerMenu::updateSlotPosition( ESceneSection eSection, ESceneSection newSection, ETapState eTapDirection, int *piTargetX, int *piTargetY, int xOffset, int yOffset )
{
// Update the target slot based on the size of the current section
int columns, rows;
@@ -124,10 +124,19 @@ void IUIScene_AbstractContainerMenu::updateSlotPosition( ESceneSection eSection,
{
(*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
int offsetX = (*piTargetX) - xOffset;
@@ -340,124 +349,124 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
{
// reset the touch flag
m_bFirstTouchStored[iPad]=false;
#endif
// If there is any input on sticks, move the pointer.
if ( ( fabs( fInputX ) >= 0.01f ) || ( fabs( fInputY ) >= 0.01f ) )
// If there is any input on sticks, move the pointer.
if ( ( fabs( fInputX ) >= 0.01f ) || ( fabs( fInputY ) >= 0.01f ) )
{
fInputDirX = ( fInputX > 0.0f ) ? 1.0f : ( fInputX < 0.0f )?-1.0f : 0.0f;
fInputDirY = ( fInputY > 0.0f ) ? 1.0f : ( fInputY < 0.0f )?-1.0f : 0.0f;
#ifdef TAP_DETECTION
// Check for potential tap input to jump slot.
ETapState eNewTapInput = GetTapInputType( fInputX, fInputY );
switch( m_eCurrTapState )
{
fInputDirX = ( fInputX > 0.0f ) ? 1.0f : ( fInputX < 0.0f )?-1.0f : 0.0f;
fInputDirY = ( fInputY > 0.0f ) ? 1.0f : ( fInputY < 0.0f )?-1.0f : 0.0f;
case eTapStateNoInput:
m_eCurrTapState = eNewTapInput;
break;
#ifdef TAP_DETECTION
// Check for potential tap input to jump slot.
ETapState eNewTapInput = GetTapInputType( fInputX, fInputY );
switch( m_eCurrTapState )
{
case eTapStateNoInput:
m_eCurrTapState = eNewTapInput;
break;
case eTapStateUp:
case eTapStateDown:
case eTapStateLeft:
case eTapStateRight:
if ( ( eNewTapInput != m_eCurrTapState ) && ( eNewTapInput != eTapStateNoInput ) )
{
// Input is no longer suitable for tap.
m_eCurrTapState = eTapNone;
}
break;
case eTapNone:
/// Nothing to do, input is not a tap.
break;
}
#endif // TAP_DETECTION
// Square it so we get more precision for small inputs.
fInputX = fInputX * fInputX * fInputDirX * POINTER_SPEED_FACTOR;
fInputY = fInputY * fInputY * fInputDirY * POINTER_SPEED_FACTOR;
//fInputX = fInputX * POINTER_SPEED_FACTOR;
//fInputY = fInputY * POINTER_SPEED_FACTOR;
float fInputScale = 1.0f;
// Ramp up input from zero when new input is recieved over INPUT_TICKS_FOR_SCALING ticks. This is to try to improve tapping stick to move 1 box.
if ( m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_SCALING )
{
++m_iConsectiveInputTicks;
fInputScale = ( (float)( m_iConsectiveInputTicks) / (float)(MAX_INPUT_TICKS_FOR_SCALING) );
}
#ifdef TAP_DETECTION
else if ( m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_TAPPING )
{
++m_iConsectiveInputTicks;
}
else
case eTapStateUp:
case eTapStateDown:
case eTapStateLeft:
case eTapStateRight:
if ( ( eNewTapInput != m_eCurrTapState ) && ( eNewTapInput != eTapStateNoInput ) )
{
// Input is no longer suitable for tap.
m_eCurrTapState = eTapNone;
}
#endif
// 4J Stu - The cursor moves too fast in SD mode
// The SD/splitscreen scenes are approximately 0.6 times the size of the fullscreen on
if(!RenderManager.IsHiDef() || app.GetLocalPlayerCount() > 1) fInputScale *= 0.6f;
break;
fInputX *= fInputScale;
fInputY *= fInputScale;
case eTapNone:
/// Nothing to do, input is not a tap.
break;
}
#endif // TAP_DETECTION
#ifdef USE_POINTER_ACCEL
m_fPointerAccelX += fInputX / 50.0f;
m_fPointerAccelY += fInputY / 50.0f;
// Square it so we get more precision for small inputs.
fInputX = fInputX * fInputX * fInputDirX * POINTER_SPEED_FACTOR;
fInputY = fInputY * fInputY * fInputDirY * POINTER_SPEED_FACTOR;
//fInputX = fInputX * POINTER_SPEED_FACTOR;
//fInputY = fInputY * POINTER_SPEED_FACTOR;
float fInputScale = 1.0f;
if ( fabsf( fInputX ) > fabsf( m_fPointerVelX + m_fPointerAccelX ) )
{
m_fPointerVelX += m_fPointerAccelX;
}
else
{
m_fPointerAccelX = fInputX - m_fPointerVelX;
m_fPointerVelX = fInputX;
}
if ( fabsf( fInputY ) > fabsf( m_fPointerVelY + m_fPointerAccelY ) )
{
m_fPointerVelY += m_fPointerAccelY;
}
else
{
m_fPointerAccelY = fInputY - m_fPointerVelY;
m_fPointerVelY = fInputY;
}
//printf( "IN %.2f VEL %.2f ACC %.2f\n", fInputY, m_fPointerVelY, m_fPointerAccelY );
vPointerPos.x += m_fPointerVelX;
vPointerPos.y -= m_fPointerVelY;
#else
// Add input to pointer position.
vPointerPos.x += fInputX;
vPointerPos.y -= fInputY;
#endif
// Clamp to pointer extents.
if ( vPointerPos.x < m_fPointerMinX ) vPointerPos.x = m_fPointerMinX;
else if ( vPointerPos.x > m_fPointerMaxX ) vPointerPos.x = m_fPointerMaxX;
if ( vPointerPos.y < m_fPointerMinY ) vPointerPos.y = m_fPointerMinY;
else if ( vPointerPos.y > m_fPointerMaxY ) vPointerPos.y = m_fPointerMaxY;
bStickInput = true;
// Ramp up input from zero when new input is recieved over INPUT_TICKS_FOR_SCALING ticks. This is to try to improve tapping stick to move 1 box.
if ( m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_SCALING )
{
++m_iConsectiveInputTicks;
fInputScale = ( (float)( m_iConsectiveInputTicks) / (float)(MAX_INPUT_TICKS_FOR_SCALING) );
}
#ifdef TAP_DETECTION
else if ( m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_TAPPING )
{
++m_iConsectiveInputTicks;
}
else
{
m_iConsectiveInputTicks = 0;
#ifdef USE_POINTER_ACCEL
m_fPointerVelX = 0.0f;
m_fPointerVelY = 0.0f;
m_fPointerAccelX = 0.0f;
m_fPointerAccelY = 0.0f;
#endif
m_eCurrTapState = eTapNone;
}
#endif
// 4J Stu - The cursor moves too fast in SD mode
// The SD/splitscreen scenes are approximately 0.6 times the size of the fullscreen on
if(!RenderManager.IsHiDef() || app.GetLocalPlayerCount() > 1) fInputScale *= 0.6f;
fInputX *= fInputScale;
fInputY *= fInputScale;
#ifdef USE_POINTER_ACCEL
m_fPointerAccelX += fInputX / 50.0f;
m_fPointerAccelY += fInputY / 50.0f;
if ( fabsf( fInputX ) > fabsf( m_fPointerVelX + m_fPointerAccelX ) )
{
m_fPointerVelX += m_fPointerAccelX;
}
else
{
m_fPointerAccelX = fInputX - m_fPointerVelX;
m_fPointerVelX = fInputX;
}
if ( fabsf( fInputY ) > fabsf( m_fPointerVelY + m_fPointerAccelY ) )
{
m_fPointerVelY += m_fPointerAccelY;
}
else
{
m_fPointerAccelY = fInputY - m_fPointerVelY;
m_fPointerVelY = fInputY;
}
//printf( "IN %.2f VEL %.2f ACC %.2f\n", fInputY, m_fPointerVelY, m_fPointerAccelY );
vPointerPos.x += m_fPointerVelX;
vPointerPos.y -= m_fPointerVelY;
#else
// Add input to pointer position.
vPointerPos.x += fInputX;
vPointerPos.y -= fInputY;
#endif
// Clamp to pointer extents.
if ( vPointerPos.x < m_fPointerMinX ) vPointerPos.x = m_fPointerMinX;
else if ( vPointerPos.x > m_fPointerMaxX ) vPointerPos.x = m_fPointerMaxX;
if ( vPointerPos.y < m_fPointerMinY ) vPointerPos.y = m_fPointerMinY;
else if ( vPointerPos.y > m_fPointerMaxY ) vPointerPos.y = m_fPointerMaxY;
bStickInput = true;
}
else
{
m_iConsectiveInputTicks = 0;
#ifdef USE_POINTER_ACCEL
m_fPointerVelX = 0.0f;
m_fPointerVelY = 0.0f;
m_fPointerAccelX = 0.0f;
m_fPointerAccelY = 0.0f;
#endif
}
#ifdef __ORBIS__
}
@@ -589,6 +598,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 )
{
@@ -768,20 +780,26 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
if( bPointerIsOverSlot && bSlotHasItem )
{
vector<wstring> unformattedStrings;
wstring desc = GetItemDescription( slot, unformattedStrings );
SetPointerText(desc, unformattedStrings, slot != m_lastPointerLabelSlot);
vector<HtmlString> *desc = GetItemDescription(slot);
SetPointerText(desc, slot != m_lastPointerLabelSlot);
m_lastPointerLabelSlot = slot;
delete desc;
}
else if (eSectionUnderPointer != eSectionNone && !IsSectionSlotList(eSectionUnderPointer) )
{
vector<HtmlString> *desc = GetSectionHoverText(eSectionUnderPointer);
SetPointerText(desc, false);
m_lastPointerLabelSlot = NULL;
delete desc;
}
else
{
vector<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 );
@@ -865,13 +883,22 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
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;
}
}
@@ -1051,7 +1078,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
bool bValidIngredient=false;
//bool bValidIngredientBottom=false;
if(Item::items[iId]->hasPotionBrewingFormula() || (iId == Item::netherStalkSeeds_Id))
if(Item::items[iId]->hasPotionBrewingFormula() || (iId == Item::netherwart_seeds_Id))
{
bValidIngredient=true;
}
@@ -1124,10 +1151,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:
@@ -1201,13 +1228,13 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
shared_ptr<ItemInstance> item = nullptr;
if(bPointerIsOverSlot && bSlotHasItem) item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
overrideTooltips(eSectionUnderPointer, item, bIsItemCarried, bSlotHasItem, bCarriedIsSameAsSlot, iSlotStackSizeRemaining, buttonA, buttonX, buttonY, buttonRT);
overrideTooltips(eSectionUnderPointer, item, bIsItemCarried, bSlotHasItem, bCarriedIsSameAsSlot, iSlotStackSizeRemaining, buttonA, 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;
@@ -1278,7 +1305,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
BOOL quickKeyHeld=FALSE; // Represents shift key on PC
BOOL validKeyPress = FALSE;
//BOOL itemEditorKeyPress = FALSE;
bool itemEditorKeyPress = false;
// Ignore input from other players
//if(pMinecraft->player->GetXboxPad()!=pInputData->UserIndex) return S_OK;
@@ -1286,11 +1313,9 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
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__
@@ -1419,13 +1444,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
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
{
if( IsSectionSlotList( m_eCurrSection ) )
{
@@ -1491,46 +1510,18 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
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;
initData->slot = pCXuiCtrlSlotItem->getSlot( pCXuiCtrlSlotItem->m_hObj );
if( IsSectionSlotList( m_eCurrSection ) )
{
ItemEditorInput *initData = new ItemEditorInput();
initData->iPad = getPad();
initData->slot = 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
{
@@ -1552,7 +1543,7 @@ void IUIScene_AbstractContainerMenu::handleOutsideClicked(int iPad, int buttonNu
// Drop items.
//pMinecraft->localgameModes[m_iPad]->handleInventoryMouseClick(menu->containerId, AbstractContainerMenu::CLICKED_OUTSIDE, buttonNum, quickKeyHeld?true:false, pMinecraft->localplayers[m_iPad] );
slotClicked(AbstractContainerMenu::CLICKED_OUTSIDE, buttonNum, quickKeyHeld?true:false);
slotClicked(AbstractContainerMenu::SLOT_CLICKED_OUTSIDE, buttonNum, quickKeyHeld?true:false);
}
void IUIScene_AbstractContainerMenu::handleOtherClicked(int iPad, ESceneSection eSection, int buttonNum, bool quickKey)
@@ -1597,8 +1588,7 @@ bool IUIScene_AbstractContainerMenu::IsSameItemAs(shared_ptr<ItemInstance> itemA
{
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)
@@ -1622,38 +1612,27 @@ int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot *slot)
return iResult;
}
wstring IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slot, vector<wstring> &unformattedStrings)
vector<HtmlString> *IUIScene_AbstractContainerMenu::GetItemDescription(Slot *slot)
{
if(slot == NULL) return L"";
if(slot == NULL) return NULL;
wstring desc = L"";
vector<wstring> *strings = slot->getItem()->getHoverText(nullptr, false, unformattedStrings);
bool firstLine = true;
for(AUTO_VAR(it, strings->begin()); it != strings->end(); ++it)
vector<HtmlString> *lines = slot->getItem()->getHoverText(nullptr, false);
// Add rarity to first line
if (lines->size() > 0)
{
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);
lines->at(0).color = slot->getItem()->getRarity()->color;
if(slot->getItem()->hasCustomHoverName())
{
colour = app.GetHTMLColour(eTextColor_RenamedItemTitle);
}
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;
}
vector<HtmlString> *IUIScene_AbstractContainerMenu::GetSectionHoverText(ESceneSection eSection)
{
return NULL;
}

View File

@@ -52,7 +52,6 @@ protected:
eSectionInventoryCreativeUsing,
eSectionInventoryCreativeSelector,
#ifndef _XBOX
eSectionInventoryCreativeTab_0,
eSectionInventoryCreativeTab_1,
eSectionInventoryCreativeTab_2,
@@ -62,7 +61,6 @@ protected:
eSectionInventoryCreativeTab_6,
eSectionInventoryCreativeTab_7,
eSectionInventoryCreativeSlider,
#endif
eSectionInventoryCreativeMax,
eSectionEnchantUsing,
@@ -88,6 +86,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;
@@ -162,13 +191,14 @@ protected:
virtual bool IsSectionSlotList( ESceneSection eSection ) { 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;
virtual int getSectionRows(ESceneSection eSection) = 0;
virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY ) = 0;
virtual void GetPositionOfSection( ESceneSection eSection, UIVec2D* pPosition ) = 0;
virtual void GetItemScreenData( ESceneSection eSection, int iItemIndex, UIVec2D* pPosition, UIVec2D* pSize ) = 0;
void updateSlotPosition( ESceneSection eSection, ESceneSection newSection, ETapState eTapDirection, int *piTargetX, int *piTargetY, int xOffset );
void updateSlotPosition( ESceneSection eSection, ESceneSection newSection, ETapState eTapDirection, int *piTargetX, int *piTargetY, int xOffset = 0, int yOffset = 0 );
#ifdef TAP_DETECTION
ETapState GetTapInputType( float fInputX, float fInputY );
@@ -200,18 +230,32 @@ protected:
virtual void setSectionFocus(ESceneSection eSection, int iPad) = 0;
virtual void setSectionSelectedSlot(ESceneSection eSection, int x, int y) = 0;
virtual void setFocusToPointer(int iPad) = 0;
virtual void SetPointerText(const wstring &description, vector<wstring> &unformattedStrings, bool newSlot) = 0;
virtual void SetPointerText(vector<HtmlString> *description, bool newSlot) = 0;
virtual vector<HtmlString> *GetSectionHoverText(ESceneSection eSection);
virtual 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;
virtual bool overrideTooltips(ESceneSection sectionUnderPointer, shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT) { return false; }
virtual bool overrideTooltips(
ESceneSection sectionUnderPointer,
shared_ptr<ItemInstance> itemUnderPointer,
bool bIsItemCarried,
bool bSlotHasItem,
bool bCarriedIsSameAsSlot,
int iSlotStackSizeRemaining,
EToolTipItem &buttonA,
EToolTipItem &buttonX,
EToolTipItem &buttonY,
EToolTipItem &buttonRT,
EToolTipItem &buttonBack
) { return false; }
private:
bool IsSameItemAs(shared_ptr<ItemInstance> itemA, shared_ptr<ItemInstance> itemB);
int GetEmptyStackSpace(Slot *slot);
wstring GetItemDescription(Slot *slot, vector<wstring> &unformattedStrings);
vector<HtmlString> *GetItemDescription(Slot *slot);
protected:

View File

@@ -206,7 +206,7 @@ void IUIScene_AnvilMenu::handleTick()
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
}
@@ -216,7 +216,7 @@ void IUIScene_AnvilMenu::handleTick()
wchar_t temp[256];
swprintf(temp, 256, costString, m_repairMenu->cost);
m_costString = temp;
if(!m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)->mayPickup(dynamic_pointer_cast<Player>(m_inventory->player->shared_from_this())))
if(!m_repairMenu->getSlot(AnvilMenu::RESULT_SLOT)->mayPickup(dynamic_pointer_cast<Player>(m_inventory->player->shared_from_this())))
{
canAfford = false;
}
@@ -224,13 +224,13 @@ 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();
bool crossVisible = (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)
@@ -250,12 +250,12 @@ void IUIScene_AnvilMenu::updateItemName()
void IUIScene_AnvilMenu::refreshContainer(AbstractContainerMenu *container, vector<shared_ptr<ItemInstance> > *items)
{
slotChanged(container, RepairMenu::INPUT_SLOT, container->getSlot(0)->getItem());
slotChanged(container, AnvilMenu::INPUT_SLOT, container->getSlot(0)->getItem());
}
void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu *container, int slotIndex, shared_ptr<ItemInstance> item)
{
if (slotIndex == RepairMenu::INPUT_SLOT)
if (slotIndex == AnvilMenu::INPUT_SLOT)
{
m_itemName = item == NULL ? L"" : item->getHoverName();
setEditNameValue(m_itemName);

View File

@@ -11,13 +11,13 @@
#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:
shared_ptr<Inventory> m_inventory;
RepairMenu *m_repairMenu;
AnvilMenu *m_repairMenu;
wstring m_itemName;
protected:

View File

@@ -0,0 +1,410 @@
#include "stdafx.h"
#include "..\Minecraft.World\CustomPayloadPacket.h"
#include "..\Minecraft.World\net.minecraft.world.inventory.h"
#include "..\Minecraft.World\net.minecraft.world.level.tile.entity.h"
#include "..\Minecraft.World\net.minecraft.world.effect.h"
#include "..\Minecraft.World\HtmlString.h"
#include "IUIScene_BeaconMenu.h"
#include "Minecraft.h"
#include "MultiPlayerLocalPlayer.h"
#include "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(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;
}
vector<HtmlString> *IUIScene_BeaconMenu::GetSectionHoverText(ESceneSection eSection)
{
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 vector<HtmlString>();
HtmlString string( app.GetString(MobEffect::effects[effectId]->getDescriptionId()), eHTMLColor_White );
desc->push_back( 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;
}

View File

@@ -0,0 +1,31 @@
#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 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;
shared_ptr<BeaconTileEntity> m_beacon;
bool m_initPowerButtons;
};

View File

@@ -0,0 +1,25 @@
#include "stdafx.h"
#include "../../../Minecraft.World/CustomPayloadPacket.h"
#include "MultiPlayerLocalPlayer.h"
#include "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(shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(CustomPayloadPacket::SET_ADVENTURE_COMMAND_PACKET, baos.toByteArray())));
}

View File

@@ -0,0 +1,18 @@
#pragma once
#include "../Minecraft.World/net.minecraft.world.level.tile.entity.h"
class IUIScene_CommandBlockMenu
{
public:
void Initialise(CommandBlockEntity *commandBlock);
protected:
void ConfirmButtonClicked();
virtual wstring GetCommand();
virtual void SetCommand(wstring command);
virtual int GetPad();
private:
CommandBlockEntity *m_commandBlock;
};

View File

@@ -267,65 +267,68 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
//pMinecraft->soundEngine->playUI( 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++)
if(pTempItemInst->id != Item::fireworksCharge_Id && pTempItemInst->id != Item::fireworks_Id)
{
for(int j=0;j<pRecipeIngredientsRequired[iRecipe].iIngValA[i];j++)
// and remove those resources from your inventory
for(int i=0;i<pRecipeIngredientsRequired[iRecipe].iIngC;i++)
{
shared_ptr<ItemInstance> ingItemInst = nullptr;
// do we need to remove a specific aux value?
if(pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i]!=Recipes::ANY_AUX_VALUE)
for(int j=0;j<pRecipeIngredientsRequired[iRecipe].iIngValA[i];j++)
{
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]);
}
else
{
ingItemInst = m_pPlayer->inventory->getResourceItem( 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())
shared_ptr<ItemInstance> ingItemInst = nullptr;
// do we need to remove a specific aux value?
if(pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i]!=Recipes::ANY_AUX_VALUE)
{
// replace item with remaining result
m_pPlayer->inventory->add( shared_ptr<ItemInstance>( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) );
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]);
}
else
{
ingItemInst = m_pPlayer->inventory->getResourceItem( 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( 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
{
@@ -1067,6 +1070,30 @@ void IUIScene_CraftingMenu::DisplayIngredients()
int id=pRecipeIngredientsRequired[iRecipe].iIngIDA[i];
int iAuxVal=pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i];
Item *item = Item::items[id];
shared_ptr<ItemInstance> itemInst= 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 if((pTempItemInst->id==Item::fireworksCharge_Id) && (id==Item::dye_powder_Id))
{
idescID=IDS_ITEM_DYE_POWDER;
iAuxVal = 1;
}
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;
@@ -1076,26 +1103,10 @@ void IUIScene_CraftingMenu::DisplayIngredients()
{
iAuxVal = 0xFF;
}
shared_ptr<ItemInstance> itemInst= 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 one that signals we should use a default texture
@@ -1141,6 +1152,10 @@ void IUIScene_CraftingMenu::DisplayIngredients()
{
iAuxVal = 0xFF;
}
else if( pTempItemInst->id==Item::fireworksCharge_Id && id == Item::dye_powder_Id)
{
iAuxVal = 1;
}
shared_ptr<ItemInstance> itemInst= shared_ptr<ItemInstance>(new ItemInstance(id,1,iAuxVal));
setIngredientSlotItem(getPad(),index,itemInst);
// show the ingredients we don't have if we can't make the recipe
@@ -1368,6 +1383,15 @@ 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;

View File

@@ -86,6 +86,7 @@ protected:
void DisplayIngredients();
void UpdateTooltips();
void UpdateDescriptionText(bool);
void HandleInventoryUpdated();
public:
Recipy::_eGroupType getCurrentGroup() { return m_pGroupA[m_iGroupIndex]; }

View File

@@ -8,6 +8,9 @@
#include "..\..\..\Minecraft.World\net.minecraft.world.level.tile.entity.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.item.enchantment.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.entity.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.entity.animal.h"
#include "..\..\..\Minecraft.World\JavaMath.h"
// 4J JEV - Images for each tab.
IUIScene_CreativeMenu::TabSpec **IUIScene_CreativeMenu::specs = NULL;
@@ -26,14 +29,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)
@@ -59,24 +63,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)
@@ -102,11 +111,28 @@ 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)
@@ -136,8 +162,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 +175,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,11 +210,102 @@ 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)
@@ -197,20 +315,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)
@@ -222,25 +351,49 @@ 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)
@@ -253,27 +406,26 @@ 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)
@@ -305,17 +457,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)
@@ -364,6 +516,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)
{
@@ -372,6 +528,16 @@ void IUIScene_CreativeMenu::staticCtor()
list->push_back(Item::enchantedBook->createForEnchantment(new EnchantmentInstance(enchantment, enchantment->getMaxLevel())));
}
#ifndef _CONTENT_PACKAGE
if(app.DebugSettingsOn())
{
shared_ptr<ItemInstance> debugSword = 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)
@@ -390,7 +556,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)
@@ -403,7 +569,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
@@ -538,22 +704,28 @@ void IUIScene_CreativeMenu::staticCtor()
// Top Row
ECreative_Inventory_Groups blocksGroup[] = {eCreativeInventory_BuildingBlocks};
specs[eCreativeInventoryTab_BuildingBlocks] = new TabSpec(L"Structures", IDS_GROUPNAME_BUILDING_BLOCKS, 1, blocksGroup, 0, NULL);
specs[eCreativeInventoryTab_BuildingBlocks] = new TabSpec(L"Structures", IDS_GROUPNAME_BUILDING_BLOCKS, 1, blocksGroup);
#ifndef _CONTENT_PACKAGE
ECreative_Inventory_Groups decorationsGroup[] = {eCreativeInventory_Decoration};
specs[eCreativeInventoryTab_Decorations] = new TabSpec(L"Decoration", IDS_GROUPNAME_DECORATIONS, 1, decorationsGroup, 0, NULL);
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);
#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);
specs[eCreativeInventoryTab_Food] = 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, eCreativeInventory_Potions_Extended, eCreativeInventory_Potions_Level2, eCreativeInventory_Potions_Basic};
@@ -561,16 +733,21 @@ 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
// {
// specs[eCreativeInventoryTab_Brewing] = new TabSpec(L"icon_brewing.png", IDS_GROUPNAME_POTIONS, 1, brewingGroup, 4, 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()
@@ -600,10 +777,33 @@ void IUIScene_CreativeMenu::switchTab(ECreativeInventoryTabs tab)
specs[tab]->populateMenu(itemPickerMenu,m_tabDynamicPos[m_curTab], 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(LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, ECreative_Inventory_Groups *dynamicGroups)
: m_icon(icon), m_descriptionId(descriptionId), m_staticGroupsCount(staticGroupsCount), m_dynamicGroupsCount(dynamicGroupsCount)
IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, 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_debugGroupsCount(debugGroupsCount)
{
m_pages = 0;
@@ -622,8 +822,20 @@ IUIScene_CreativeMenu::TabSpec::TabSpec(LPCWSTR icon, int descriptionId, int sta
}
}
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)
@@ -641,6 +853,7 @@ 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, int dynamicIndex, unsigned int page)
@@ -659,12 +872,12 @@ void IUIScene_CreativeMenu::TabSpec::populateMenu(AbstractContainerMenu *menu, i
// 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();
@@ -673,27 +886,80 @@ void IUIScene_CreativeMenu::TabSpec::populateMenu(AbstractContainerMenu *menu, i
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())
if(displayStatic)
{
for(; lastSlotIndex < MAX_SIZE;)
{
currentItem = 0;
++currentGroup;
if(currentGroup >= m_staticGroupsCount)
Slot *slot = menu->getSlot(lastSlotIndex++);
slot->set(categoryGroups[m_staticGroupsA[currentGroup]][currentItem]);
++currentItem;
if(currentItem >= categoryGroups[m_staticGroupsA[currentGroup]].size())
{
break;
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);
@@ -703,7 +969,16 @@ void IUIScene_CreativeMenu::TabSpec::populateMenu(AbstractContainerMenu *menu, i
unsigned int IUIScene_CreativeMenu::TabSpec::getPageCount()
{
return m_pages;
#ifndef _CONTENT_PACKAGE
if(app.DebugArtToolsOn())
{
return (int)ceil((float)(m_staticItems + m_debugItems) / m_staticPerPage);
}
else
#endif
{
return m_pages;
}
}
@@ -763,7 +1038,6 @@ IUIScene_AbstractContainerMenu::ESceneSection IUIScene_CreativeMenu::GetSectionA
newSection = eSectionInventoryCreativeSelector;
}
break;
#ifndef _XBOX
case eSectionInventoryCreativeTab_0:
case eSectionInventoryCreativeTab_1:
case eSectionInventoryCreativeTab_2:
@@ -775,7 +1049,6 @@ IUIScene_AbstractContainerMenu::ESceneSection IUIScene_CreativeMenu::GetSectionA
case eSectionInventoryCreativeSlider:
/* do nothing */
break;
#endif
default:
assert( false );
break;
@@ -800,7 +1073,7 @@ bool IUIScene_CreativeMenu::handleValidKeyPress(int iPad, int buttonNum, BOOL qu
{
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 + InventoryMenu::USE_ROW_SLOT_START);
pMinecraft->localgameModes[iPad]->handleCreativeModeItemAdd(nullptr, i - (int)m_menu->slots.size() + 9 + InventoryMenu::USE_ROW_SLOT_START);
}
}
return true;
@@ -930,7 +1203,7 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu
m_menu->clicked(currentIndex, buttonNum, quickKeyHeld?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, pMinecraft->localplayers[getPad()]);
shared_ptr<ItemInstance> newItem = 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 + InventoryMenu::USE_ROW_SLOT_START);
pMinecraft->localgameModes[getPad()]->handleCreativeModeItemAdd(newItem, currentIndex - (int)m_menu->slots.size() + 9 + InventoryMenu::USE_ROW_SLOT_START);
if(m_bCarryingCreativeItem)
{
@@ -978,7 +1251,7 @@ bool IUIScene_CreativeMenu::getEmptyInventorySlot(shared_ptr<ItemInstance> item,
for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i)
{
shared_ptr<ItemInstance> slotItem = m_menu->getSlot(i)->getItem();
if( slotItem != NULL && slotItem->sameItem(item) && (slotItem->GetCount() + item->GetCount() <= item->getMaxStackSize() ))
if( slotItem != NULL && slotItem->sameItemWithTags(item) && (slotItem->GetCount() + item->GetCount() <= item->getMaxStackSize() ))
{
sameItemFound = true;
slotX = i - TabSpec::MAX_SIZE;
@@ -1021,7 +1294,7 @@ int IUIScene_CreativeMenu::getSectionStartOffset(ESceneSection eSection)
}
bool IUIScene_CreativeMenu::overrideTooltips(ESceneSection sectionUnderPointer, shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT)
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT, EToolTipItem &buttonBack)
{
bool _override = false;
@@ -1030,7 +1303,6 @@ bool IUIScene_CreativeMenu::overrideTooltips(ESceneSection sectionUnderPointer,
if(bSlotHasItem)
{
buttonA = eToolTipPickUpGeneric;
buttonRT = eToolTipWhatIsThis;
if(itemUnderPointer->isStackable())
{
@@ -1051,3 +1323,74 @@ bool IUIScene_CreativeMenu::overrideTooltips(ESceneSection sectionUnderPointer,
return _override;
}
void IUIScene_CreativeMenu::BuildFirework(vector<shared_ptr<ItemInstance> > *list, byte type, int color, int sulphur, bool flicker, bool trail, int fadeColor/*= -1*/)
{
/////////////////////////////////
// Create firecharge
/////////////////////////////////
CompoundTag *expTag = new CompoundTag(FireworksItem::TAG_EXPLOSION);
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
////////////////////////////////////
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
/////////////////////////////////
shared_ptr<ItemInstance> firework;
{
firework = 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, (byte) sulphur);
itemTag->put(FireworksItem::TAG_FIREWORKS, fireTag);
firework->setTag(itemTag);
}
list->push_back(firework);
}

View File

@@ -38,6 +38,8 @@ public:
eCreativeInventory_Potions_Extended,
eCreativeInventory_Potions_Level2_Extended,
eCreativeInventory_Misc,
eCreativeInventory_ArtToolsDecorations,
eCreativeInventory_ArtToolsMisc,
eCreativeInventoryGroupsCount
};
@@ -57,14 +59,17 @@ 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;
unsigned int m_staticPerPage;
unsigned int m_staticItems;
unsigned int m_debugItems;
public:
TabSpec( LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount, ECreative_Inventory_Groups *dynamicGroups );
TabSpec( LPCWSTR icon, int descriptionId, int staticGroupsCount, ECreative_Inventory_Groups *staticGroups, int dynamicGroupsCount = 0, ECreative_Inventory_Groups *dynamicGroups = NULL, int debugGroupsCount = 0, ECreative_Inventory_Groups *debugGroups = NULL );
~TabSpec();
void populateMenu(AbstractContainerMenu *menu, int dynamicIndex, unsigned int page);
@@ -104,7 +109,8 @@ protected:
int m_tabDynamicPos[eCreativeInventoryTab_COUNT];
int m_tabPage[eCreativeInventoryTab_COUNT];
void switchTab(ECreativeInventoryTabs tab);
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, ETapState eTapDirection, int *piTargetX, int *piTargetY );
@@ -117,6 +123,19 @@ protected:
virtual bool IsSectionSlotList( ESceneSection eSection );
virtual bool CanHaveFocus( ESceneSection eSection );
virtual bool overrideTooltips(ESceneSection sectionUnderPointer, shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT);
virtual bool overrideTooltips(
ESceneSection sectionUnderPointer,
shared_ptr<ItemInstance> itemUnderPointer,
bool bIsItemCarried,
bool bSlotHasItem,
bool bCarriedIsSameAsSlot,
int iSlotStackSizeRemaining,
EToolTipItem &buttonA,
EToolTipItem &buttonX,
EToolTipItem &buttonY,
EToolTipItem &buttonRT,
EToolTipItem &buttonBack
);
static void BuildFirework(vector<shared_ptr<ItemInstance> > *list, byte type, int color, int sulphur, bool flicker, bool trail, int fadeColor = -1);
};

View File

@@ -0,0 +1,129 @@
#include "stdafx.h"
#include "IUIScene_FireworksMenu.h"
#include "..\..\..\Minecraft.World\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;
}

View File

@@ -0,0 +1,9 @@
#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);
};

View File

@@ -0,0 +1,264 @@
#include "stdafx.h"
#include "..\..\Minecraft.h"
#include "..\..\MultiPlayerLocalPlayer.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.effect.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.entity.ai.attributes.h"
#include "..\..\..\Minecraft.World\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);
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);
}
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) )
{
shared_ptr<LivingEntity> living = 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);
}
}

View File

@@ -0,0 +1,85 @@
#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;
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 wstring &label) = 0;
virtual void ShowDragonHealth(bool show) = 0;
virtual void HideSelectedLabel() = 0;
virtual void SetDisplayName(const 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 wstring &label) = 0;
virtual void ShowDisplayName(bool show) = 0;
public:
void updateFrameTick();
void renderPlayerHealth();
};

View File

@@ -0,0 +1,77 @@
#include "stdafx.h"
#include "IUIScene_HopperMenu.h"
#include "../Minecraft.World/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;
}

View File

@@ -0,0 +1,12 @@
#pragma once
#include "IUIScene_AbstractContainerMenu.h"
#include "../../../Minecraft.World/Container.h"
#include "../../../Minecraft.World/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);
};

View File

@@ -0,0 +1,251 @@
#include "stdafx.h"
#include "IUIScene_HorseInventoryMenu.h"
#include "..\..\..\Minecraft.World\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;
}

View File

@@ -0,0 +1,20 @@
#pragma once
#include "IUIScene_AbstractContainerMenu.h"
#include "../../../Minecraft.World/Container.h"
#include "../../../Minecraft.World/Inventory.h"
#include "../../../Minecraft.World/EntityHorse.h"
class IUIScene_HorseInventoryMenu : public virtual IUIScene_AbstractContainerMenu
{
protected:
shared_ptr<Inventory> m_inventory;
shared_ptr<Container> m_container;
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 );
};

View File

@@ -11,15 +11,23 @@
#include "..\..\DLCTexturePack.h"
#include "..\..\..\Minecraft.World\StringHelpers.h"
#ifndef _XBOX
#include "UI.h"
#endif
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((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;
@@ -28,7 +36,11 @@ int IUIScene_PauseMenu::ExitGameDialogReturned(void *pParam,int iPad,C4JStorage:
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((size_t)pParam));
#endif
// Exit with or without saving
// Decline means save in this dialog
@@ -62,7 +74,7 @@ int IUIScene_PauseMenu::ExitGameSaveDialogReturned(void *pParam,int iPad,C4JStor
uiIDA[1]=IDS_CONFIRM_CANCEL;
// Give the player a warning about the trial version of the texture pack
ui.RequestMessageBox(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad() , &IUIScene_PauseMenu::WarningTrialTexturePackReturned, scene,app.GetStringTable(), NULL, 0, false);
ui.RequestAlertMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad() , &IUIScene_PauseMenu::WarningTrialTexturePackReturned, pParam);
return S_OK;
}
@@ -78,7 +90,7 @@ int IUIScene_PauseMenu::ExitGameSaveDialogReturned(void *pParam,int iPad,C4JStor
UINT uiIDA[2];
uiIDA[0]=IDS_CONFIRM_CANCEL;
uiIDA[1]=IDS_CONFIRM_OK;
ui.RequestMessageBox(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(), &IUIScene_PauseMenu::ExitGameAndSaveReturned, scene, app.GetStringTable(), NULL, 0, false);
ui.RequestAlertMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(), &IUIScene_PauseMenu::ExitGameAndSaveReturned, pParam);
return 0;
}
else
@@ -95,11 +107,11 @@ int IUIScene_PauseMenu::ExitGameSaveDialogReturned(void *pParam,int iPad,C4JStor
UINT uiIDA[2];
uiIDA[0]=IDS_CONFIRM_CANCEL;
uiIDA[1]=IDS_CONFIRM_OK;
ui.RequestMessageBox(IDS_TITLE_DECLINE_SAVE_GAME, IDS_CONFIRM_DECLINE_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(), &IUIScene_PauseMenu::ExitGameDeclineSaveReturned, scene, app.GetStringTable(), NULL, 0, false);
ui.RequestAlertMessage(IDS_TITLE_DECLINE_SAVE_GAME, IDS_CONFIRM_DECLINE_SAVE_GAME, uiIDA, 2, ProfileManager.GetPrimaryPad(), &IUIScene_PauseMenu::ExitGameDeclineSaveReturned, pParam);
return 0;
}
scene->SetIgnoreInput(true);
if(pScene) pScene->SetIgnoreInput(true);
app.SetAction(iPad,eAppAction_ExitWorld);
}
@@ -110,7 +122,11 @@ int IUIScene_PauseMenu::ExitGameSaveDialogReturned(void *pParam,int iPad,C4JStor
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((size_t)pParam));
#endif
// results switched for this dialog
if(result==C4JStorage::EMessage_ResultDecline)
@@ -121,7 +137,7 @@ int IUIScene_PauseMenu::ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage
#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);
@@ -139,11 +155,11 @@ int IUIScene_PauseMenu::ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage
if(g_NetworkManager.GetPlayerCount()>1)
{
ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_CONFIRM_DISCONNECT_SAVE, uiIDA, 3, ProfileManager.GetPrimaryPad(), &IUIScene_PauseMenu::ExitGameSaveDialogReturned, scene, app.GetStringTable(), NULL, 0, false);
ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_CONFIRM_DISCONNECT_SAVE, uiIDA, 3, ProfileManager.GetPrimaryPad(), &IUIScene_PauseMenu::ExitGameSaveDialogReturned, pParam);
}
else
{
ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3, ProfileManager.GetPrimaryPad(), &IUIScene_PauseMenu::ExitGameSaveDialogReturned, scene, app.GetStringTable(), NULL, 0, false);
ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3, ProfileManager.GetPrimaryPad(), &IUIScene_PauseMenu::ExitGameSaveDialogReturned, pParam);
}
}
}
@@ -154,7 +170,11 @@ int IUIScene_PauseMenu::ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage
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((size_t)pParam));
#endif
// results switched for this dialog
if(result==C4JStorage::EMessage_ResultDecline)
@@ -163,7 +183,7 @@ int IUIScene_PauseMenu::ExitGameDeclineSaveReturned(void *pParam,int iPad,C4JSto
// Don't do this here, as it will still try and save some things even 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);
@@ -181,11 +201,11 @@ int IUIScene_PauseMenu::ExitGameDeclineSaveReturned(void *pParam,int iPad,C4JSto
if(g_NetworkManager.GetPlayerCount()>1)
{
ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_CONFIRM_DISCONNECT_SAVE, uiIDA, 3, ProfileManager.GetPrimaryPad(),&IUIScene_PauseMenu::ExitGameSaveDialogReturned, scene, app.GetStringTable(), NULL, 0, false);
ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_CONFIRM_DISCONNECT_SAVE, uiIDA, 3, ProfileManager.GetPrimaryPad(),&IUIScene_PauseMenu::ExitGameSaveDialogReturned, pParam);
}
else
{
ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3, ProfileManager.GetPrimaryPad(),&IUIScene_PauseMenu::ExitGameSaveDialogReturned, scene, app.GetStringTable(), NULL, 0, false);
ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3, ProfileManager.GetPrimaryPad(),&IUIScene_PauseMenu::ExitGameSaveDialogReturned, pParam);
}
}
@@ -214,7 +234,7 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4
{
UINT 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
{
@@ -288,7 +308,7 @@ int IUIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4
{
// 4J-JEV: Fix for XB1: #165863 - XR-074: Compliance: With no active network connection user is unable to convert from Trial to Full texture pack and is not messaged why.
UINT 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);
}
}
}
@@ -498,7 +518,7 @@ void IUIScene_PauseMenu::_ExitWorld(LPVOID lpParameter)
uiIDA[0]=IDS_CONFIRM_OK;
// 4J Stu - Fix for #48669 - TU5: Code: Compliance: TCR #15: Incorrect/misleading messages after signing out a profile during online game session.
// If the primary player is signed out, then that is most likely the cause of the disconnection so don't 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());
if( ProfileManager.IsSignedIn(ProfileManager.GetPrimaryPad())) ui.RequestErrorMessage( exitReasonTitleId, exitReasonStringId, uiIDA,1,ProfileManager.GetPrimaryPad());
exitReasonStringId = -1;
// 4J - Force a disconnection, this handles the situation that the server has already disconnected
@@ -596,7 +616,7 @@ void IUIScene_PauseMenu::_ExitWorld(LPVOID lpParameter)
UINT 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;
}
}
@@ -644,7 +664,7 @@ int IUIScene_PauseMenu::SaveGameDialogReturned(void *pParam,int iPad,C4JStorage:
UINT 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);

View File

@@ -239,7 +239,7 @@ void IUIScene_StartGame::UpdateCurrentTexturePack(int iSlot)
// 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
m_MoreOptionsParams.dwTexturePack = ListItem.iData;
@@ -368,7 +368,7 @@ int IUIScene_StartGame::TexturePackDialogReturned(void *pParam,int iPad,C4JStora
{
// 4J-JEV: Fix for XB1: #165863 - XR-074: Compliance: With no active network connection user is unable to convert from Trial to Full texture pack and is not messaged why.
UINT 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);
}
}
}

View File

@@ -1,6 +1,7 @@
#include "stdafx.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.item.trading.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.item.h"
#include "..\..\..\Minecraft.World\net.minecraft.network.packet.h"
#include "..\..\Minecraft.h"
#include "..\..\MultiPlayerLocalPlayer.h"
@@ -77,6 +78,9 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
int buyBMatches = player->inventory->countMatches(buyBItem);
if( (buyAItem != NULL && 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,7 +95,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( shared_ptr<TradeItemPacket>( new TradeItemPacket(m_menu->containerId, actualShopItem) ) );
updateDisplay();
@@ -238,15 +241,14 @@ 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()));
wsTemp = replaceAll(wsTemp,L"{*VILLAGER_TYPE*}",m_merchant->getDisplayName());
int iPos=wsTemp.find(L"%s");
wsTemp.replace(iPos,2,activeRecipe->getSellItem()->getHoverName());
setTitle(wsTemp.c_str());
vector<wstring> unformattedStrings;
wstring offerDescription = GetItemDescription(activeRecipe->getSellItem(), unformattedStrings);
setOfferDescription(offerDescription, unformattedStrings);
vector<HtmlString> *offerDescription = GetItemDescription(activeRecipe->getSellItem());
setOfferDescription(offerDescription);
shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
@@ -299,13 +301,15 @@ void IUIScene_TradingMenu::updateDisplay()
}
else
{
setTitle(app.GetString(m_merchant->getDisplayName()));
setTitle(m_merchant->getDisplayName());
setRequest1Name(L"");
setRequest2Name(L"");
setRequest1RedBox(false);
setRequest2RedBox(false);
setRequest1Item(nullptr);
setRequest2Item(nullptr);
setRequest2Item(nullptr);
vector<HtmlString> offerDescription;
setOfferDescription(&offerDescription);
}
m_bHasUpdatedOnce = true;
@@ -361,27 +365,20 @@ void IUIScene_TradingMenu::setTradeItem(int index, shared_ptr<ItemInstance> item
{
}
wstring IUIScene_TradingMenu::GetItemDescription(shared_ptr<ItemInstance> item, vector<wstring> &unformattedStrings)
vector<HtmlString> *IUIScene_TradingMenu::GetItemDescription(shared_ptr<ItemInstance> item)
{
if(item == NULL) return L"";
vector<HtmlString> *lines = item->getHoverText(nullptr, false);
wstring desc = L"";
vector<wstring> *strings = item->getHoverTextOnly(nullptr, false, unformattedStrings);
bool firstLine = true;
for(AUTO_VAR(it, strings->begin()); it != strings->end(); ++it)
// Add rarity to first line
if (lines->size() > 0)
{
wstring thisString = *it;
if(!firstLine)
{
desc.append( L"<br />" );
}
else
{
firstLine = false;
}
desc.append( thisString );
lines->at(0).color = item->getRarity()->color;
}
strings->clear();
delete strings;
return desc;
return lines;
}
void IUIScene_TradingMenu::HandleInventoryUpdated()
{
updateDisplay();
}

View File

@@ -40,16 +40,19 @@ protected:
virtual void setRequest2RedBox(bool show) = 0;
virtual void setTradeRedBox(int index, bool show) = 0;
virtual void setOfferDescription(const wstring &name, vector<wstring> &unformattedStrings) = 0;
virtual void setOfferDescription(vector<HtmlString> *description) = 0;
virtual void setRequest1Item(shared_ptr<ItemInstance> item);
virtual void setRequest2Item(shared_ptr<ItemInstance> item);
virtual void setTradeItem(int index, shared_ptr<ItemInstance> item);
private:
void updateDisplay();
void HandleInventoryUpdated();
private:
bool canMake(MerchantRecipe *recipe);
wstring GetItemDescription(shared_ptr<ItemInstance> item, vector<wstring> &unformattedStrings);
vector<HtmlString> *GetItemDescription(shared_ptr<ItemInstance> item);
public:
shared_ptr<Merchant> getMerchant();

View File

@@ -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"

View File

@@ -39,16 +39,16 @@ UIAbstractBitmapFont::UIAbstractBitmapFont(const string &fontname)
void UIAbstractBitmapFont::registerFont()
{
if(m_registered)
if (!m_registered)
{
return;
// 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 );
IggyFontSetIndirectUTF8( m_fontname.c_str(),-1 ,IGGY_FONTFLAG_all ,m_fontname.c_str() ,-1 ,IGGY_FONTFLAG_none );
m_registered = true;
// 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 );
}
IggyFontMetrics * RADLINK UIAbstractBitmapFont::GetFontMetrics_Callback(void *user_context,IggyFontMetrics *metrics)
@@ -357,7 +357,7 @@ rrbool UIBitmapFont::GetGlyphBitmap(S32 glyph,F32 pixel_scale,IggyBitmapCharacte
}
//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);

View File

@@ -51,7 +51,7 @@ 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)

View File

@@ -21,18 +21,15 @@ UIComponent_PressStartToPlay::UIComponent_PressStartToPlay(int iPad, void *initD
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__
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
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);

View File

@@ -177,6 +177,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, C4JRender::eViewportType viewport)
@@ -272,7 +284,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)
void UIComponent_Tooltips::SetTooltips( int iA, int iB, int iX, int iY , int iLT, int iRT, int iLB, int iRB, int iLS, int iRS, int iBack, bool forceUpdate)
{
bool needsRelayout = false;
needsRelayout = _SetTooltip( eToolTipButtonA, iA ) || needsRelayout;
@@ -284,8 +296,10 @@ 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;
if(needsRelayout)_Relayout();
needsRelayout = _SetTooltip( eToolTipButtonRS, iRS ) || needsRelayout;
needsRelayout = _SetTooltip( eToolTipButtonRS, iRS ) || needsRelayout;
needsRelayout = _SetTooltip( eToolTipButtonBack, iBack ) || needsRelayout;
if (needsRelayout) _Relayout();
}
void UIComponent_Tooltips::EnableTooltip( unsigned int tooltip, bool enable )
@@ -299,20 +313,21 @@ 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);
else if(iTextID == -2) _SetTooltip(iToolTip, L"", true);
else _SetTooltip(iToolTip, L"", false);
if(iTextID > -1) _SetTooltip(iToolTip, iTextID, true);
else if(iTextID == -2) _SetTooltip(iToolTip, L"", true);
else _SetTooltip(iToolTip, L"", false);
}
return changed;
}
void UIComponent_Tooltips::_SetTooltip(unsigned int iToolTipId, const 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];
@@ -330,7 +345,7 @@ void UIComponent_Tooltips::_SetTooltip(unsigned int iToolTipId, const wstring &l
value[2].boolval = show;
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetTooltip , 3 , value );
app.DebugPrintf("Actual tooltip update!\n");
//app.DebugPrintf("Actual tooltip update!\n");
}
void UIComponent_Tooltips::_Relayout()
@@ -350,6 +365,10 @@ void UIComponent_Tooltips::handleTouchInput(unsigned int iPad, S32 x, S32 y, int
//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)
{
@@ -357,11 +376,17 @@ void UIComponent_Tooltips::handleTouchInput(unsigned int iPad, S32 x, S32 y, int
{
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", iId);
@@ -376,8 +401,8 @@ void UIComponent_Tooltips::handleTouchInput(unsigned int iPad, S32 x, S32 y, int
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", iId);
@@ -391,6 +416,14 @@ void UIComponent_Tooltips::handleTouchInput(unsigned int iPad, S32 x, S32 y, int
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;
}
}
}
@@ -413,14 +446,14 @@ void UIComponent_Tooltips::handleReload()
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();
}
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)

View File

@@ -13,6 +13,8 @@ protected:
bool show;
int iString;
UIString label;
_TooltipValues()
{
show = false;
@@ -23,7 +25,7 @@ protected:
TooltipValues m_tooltipValues[eToolTipNumButtons];
IggyName m_funcSetTooltip, m_funcSetOpacity, m_funcSetABSwap, m_funcUpdateLayout;
#ifdef __PSVITA__
enum ETouchInput
{
@@ -36,6 +38,8 @@ protected:
ETouchInput_Touch_LeftBumper,
ETouchInput_Touch_RightBumper,
ETouchInput_Touch_LeftStick,
ETouchInput_Touch_RightStick,
ETouchInput_Touch_Select,
ETouchInput_Count,
};
@@ -53,6 +57,8 @@ protected:
UI_MAP_ELEMENT( m_TouchController[ETouchInput_Touch_LeftBumper], "Touch_LeftBumper")
UI_MAP_ELEMENT( m_TouchController[ETouchInput_Touch_RightBumper], "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")
@@ -88,7 +94,7 @@ public:
virtual void SetTooltipText( unsigned int tooltip, int iTextID );
virtual void SetEnableTooltips( bool bVal );
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);
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, int iRS=-1, int iBack=-1, bool forceUpdate = false);
virtual void EnableTooltip( unsigned int tooltip, bool enable );
virtual void handleReload();
@@ -99,7 +105,7 @@ public:
private:
bool _SetTooltip(unsigned int iToolTip, int iTextID);
void _SetTooltip(unsigned int iToolTipId, const 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];

View File

@@ -21,6 +21,7 @@ UIComponent_TutorialPopup::UIComponent_TutorialPopup(int iPad, void *initData, U
m_bContainerMenuVisible = false;
m_bSplitscreenGamertagVisible = false;
m_iconType = e_ICON_TYPE_IGGY;
m_labelDescription.init(L"");
}
@@ -63,6 +64,8 @@ void UIComponent_TutorialPopup::handleReload()
value[0].type = IGGY_DATATYPE_boolean;
value[0].boolval = (bool)((app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplaySplitscreenGamertags)!=0) && !m_bContainerMenuVisible); // 4J - TomK - Offset for splitscreen gamertag?
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcAdjustLayout, 1 , value );
setupIconHolder(m_iconType);
}
void UIComponent_TutorialPopup::SetTutorialDescription(TutorialPopupInfo *info)
@@ -317,7 +320,7 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil,
}
else if(temp.find(L"{*StoneIcon*}")!=wstring::npos)
{
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::rock_Id,1,0));
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::stone_Id,1,0));
}
else
{
@@ -428,6 +431,7 @@ void UIComponent_TutorialPopup::UpdateInteractScenePosition(bool visible)
bool bAllowAnim=false;
bool isCraftingScene = (m_interactScene->getSceneType() == eUIScene_Crafting2x2Menu) || (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:
@@ -437,7 +441,7 @@ void UIComponent_TutorialPopup::UpdateInteractScenePosition(bool visible)
break;
default:
// anim allowed for everything except the crafting 2x2 and 3x3, and the creative menu
if(!isCraftingScene && !isCreativeScene)
if(!isCraftingScene && !isCreativeScene && !isTradingScene)
{
bAllowAnim=true;
}
@@ -536,4 +540,6 @@ void UIComponent_TutorialPopup::setupIconHolder(EIcons icon)
value[0].type = IGGY_DATATYPE_number;
value[0].number = (F64)icon;
IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetupIconHolder , 1 , value );
m_iconType = icon;
}

View File

@@ -39,6 +39,8 @@ private:
e_ICON_TYPE_TRANSPORT = 11,
};
EIcons m_iconType;
public:
UIComponent_TutorialPopup(int iPad, void *initData, UILayer *parentLayer);

View File

@@ -20,6 +20,7 @@ public:
eLabel,
eLeaderboardList,
eMinecraftPlayer,
eMinecraftHorse,
ePlayerList,
ePlayerSkinPreview,
eProgress,

View File

@@ -7,7 +7,7 @@
UIControl_Base::UIControl_Base()
{
m_bLabelChanged = false;
m_label = L"";
m_label;
m_id = 0;
}
@@ -27,7 +27,7 @@ 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;
@@ -37,15 +37,17 @@ void UIControl_Base::tick()
value[0].type = IGGY_DATATYPE_string_UTF16;
IggyStringUTF16 stringVal;
stringVal.string = (IggyUTF16*)m_label.c_str();
stringVal.string = (IggyUTF16*) m_label.c_str();
stringVal.length = m_label.length();
value[0].string16 = stringVal;
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_setLabelFunc , 1 , value );
m_label.setUpdated();
}
}
void UIControl_Base::setLabel(const 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;
m_label = label;
@@ -67,20 +69,14 @@ void UIControl_Base::setLabel(const wstring &label, bool instant, bool force)
}
}
void UIControl_Base::setLabel(const string &label)
{
wstring wlabel = convStringToWstring(label);
setLabel(wlabel);
}
const wchar_t* UIControl_Base::getLabel()
{
IggyDataValue result;
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_funcGetLabel , 0 , NULL );
IggyResult out = IggyPlayerCallMethodRS(m_parentScene->getMovie(), &result, getIggyValuePath(), m_funcGetLabel, 0, NULL);
if(result.type == IGGY_DATATYPE_string_UTF16)
{
m_label = wstring( (wchar_t *)result.string16.string, result.string16.length);
m_label = wstring((wchar_t *)result.string16.string, result.string16.length);
}
return m_label.c_str();

View File

@@ -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
@@ -12,7 +13,8 @@ protected:
IggyName m_funcCheckLabelWidths;
bool m_bLabelChanged;
wstring m_label;
UIString m_label;
public:
UIControl_Base();
@@ -20,8 +22,9 @@ public:
virtual void tick();
virtual void setLabel(const wstring &label, bool instant = false, bool force = false);
virtual void setLabel(const string &label);
virtual void setLabel(UIString label, bool instant = false, bool force = false);
//virtual void setLabel(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; }

View File

@@ -0,0 +1,121 @@
#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 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;
}
}

View File

@@ -0,0 +1,49 @@
#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 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();
};

View File

@@ -17,7 +17,7 @@ bool UIControl_Button::setupControl(UIScene *scene, IggyValuePath *parent, const
return success;
}
void UIControl_Button::init(const wstring &label, int id)
void UIControl_Button::init(UIString label, int id)
{
m_label = label;
m_id = id;

View File

@@ -12,7 +12,9 @@ public:
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName);
void init(const wstring &label, int id);
void init(UIString label, int id);
//void init(const wstring &label, int id) { init(UIString::CONSTANT(label), id); }
virtual void ReInit();
void setEnable(bool enable);

View File

@@ -195,3 +195,47 @@ bool UIControl_ButtonList::CanTouchTrigger(S32 iX, S32 iY)
return bCanTouchTrigger;
}
#endif
void UIControl_DynamicButtonList::tick()
{
UIControl_ButtonList::tick();
int buttonIndex = 0;
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);
}

View File

@@ -41,4 +41,18 @@ public:
void SetTouchFocus(S32 iX, S32 iY, bool bRepeat);
bool CanTouchTrigger(S32 iX, S32 iY);
#endif
};
class UIControl_DynamicButtonList : public UIControl_ButtonList
{
protected:
vector<UIString> m_labels;
public:
virtual void tick();
virtual void addItem(UIString label, int data = -1);
virtual void removeItem(int index);
};

View File

@@ -21,7 +21,7 @@ bool UIControl_CheckBox::setupControl(UIScene *scene, IggyValuePath *parent, con
return success;
}
void UIControl_CheckBox::init(const wstring &label, int id, bool checked)
void UIControl_CheckBox::init(UIString label, int id, bool checked)
{
m_label = label;
m_id = id;

View File

@@ -14,7 +14,7 @@ public:
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName);
void init(const wstring &label, int id, bool checked);
void init(UIString label, int id, bool checked);
bool IsChecked();
bool IsEnabled();

View File

@@ -34,9 +34,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();

View File

@@ -35,6 +35,18 @@ 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();

View File

@@ -46,7 +46,7 @@ public:
virtual void tick();
void init(int index);
virtual void ReInit();
void render(IggyCustomDrawCallbackRegion *region);
void updateState();

View File

@@ -5,6 +5,7 @@
UIControl_Label::UIControl_Label()
{
m_reinitEnabled = true;
}
bool UIControl_Label::setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName)
@@ -17,7 +18,7 @@ bool UIControl_Label::setupControl(UIScene *scene, IggyValuePath *parent, const
return success;
}
void UIControl_Label::init(const wstring &label)
void UIControl_Label::init(UIString label)
{
m_label = label;
@@ -32,22 +33,13 @@ void UIControl_Label::init(const wstring &label)
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_initFunc , 1 , value );
}
void UIControl_Label::init(const 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.length = label.length();
value[0].string8 = stringVal;
IggyResult out = IggyPlayerCallMethodRS ( m_parentScene->getMovie() , &result, getIggyValuePath() , m_initFunc , 1 , value );
}
void UIControl_Label::ReInit()
{
UIControl_Base::ReInit();
init(m_label);
// 4J-JEV: This can't be reinitialised.
if (m_reinitEnabled)
{
init(m_label);
}
}

View File

@@ -4,12 +4,16 @@
class UIControl_Label : public UIControl_Base
{
private:
bool m_reinitEnabled;
public:
UIControl_Label();
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName);
void init(const wstring &label);
void init(const string &label);
void init(UIString label);
virtual void ReInit();
void disableReinitialisation() { m_reinitEnabled = false; }
};

View File

@@ -0,0 +1,103 @@
#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\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;
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);
}

View File

@@ -0,0 +1,15 @@
#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);
};

View File

@@ -37,7 +37,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;

View File

@@ -217,7 +217,7 @@ void UIControl_PlayerSkinPreview::render(IggyCustomDrawCallbackRegion *region)
pMinecraft->options->hideGui = true;
//EntityRenderDispatcher::instance->render(pMinecraft->localplayers[0], 0, 0, 0, 0, 1);
EntityRenderer *renderer = EntityRenderDispatcher::instance->getRenderer(eTYPE_PLAYER);
EntityRenderer *renderer = EntityRenderDispatcher::instance->getRenderer(eTYPE_LOCALPLAYER);
if (renderer != NULL)
{
// 4J-PB - any additional parts to turn on for this player (skin dependent)
@@ -335,7 +335,12 @@ void UIControl_PlayerSkinPreview::render(EntityRenderer *renderer, double x, dou
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;

View File

@@ -23,7 +23,7 @@ bool UIControl_Progress::setupControl(UIScene *scene, IggyValuePath *parent, con
return success;
}
void UIControl_Progress::init(const 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;

View File

@@ -17,7 +17,7 @@ public:
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName);
void init(const 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);

View File

@@ -22,7 +22,7 @@ bool UIControl_Slider::setupControl(UIScene *scene, IggyValuePath *parent, const
return success;
}
void UIControl_Slider::init(const wstring &label, int id, int min, int max, int current)
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]);

View File

@@ -21,7 +21,7 @@ public:
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName);
void init(const 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);

View File

@@ -22,6 +22,13 @@ bool UIControl_SlotList::setupControl(UIScene *scene, IggyValuePath *parent, con
return success;
}
void UIControl_SlotList::ReInit()
{
UIControl_Base::ReInit();
m_lastHighlighted = -1;
}
void UIControl_SlotList::addSlot(int id)
{
IggyDataValue result;

View File

@@ -14,6 +14,8 @@ public:
UIControl_SlotList();
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName);
virtual void ReInit();
void addSlot(int id);
void addSlots(int iStartValue, int iCount);

View File

@@ -24,7 +24,7 @@ bool UIControl_SpaceIndicatorBar::setupControl(UIScene *scene, IggyValuePath *pa
return success;
}
void UIControl_SpaceIndicatorBar::init(const wstring &label, int id, __int64 min, __int64 max)
void UIControl_SpaceIndicatorBar::init(UIString label, int id, __int64 min, __int64 max)
{
m_label = label;
m_id = id;

View File

@@ -18,7 +18,7 @@ public:
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName);
void init(const wstring &label, int id, __int64 min, __int64 max);
void init(UIString label, int id, __int64 min, __int64 max);
virtual void ReInit();
void reset();

View File

@@ -20,7 +20,7 @@ bool UIControl_TextInput::setupControl(UIScene *scene, IggyValuePath *parent, co
return success;
}
void UIControl_TextInput::init(const wstring &label, int id)
void UIControl_TextInput::init(UIString label, int id)
{
m_label = label;
m_id = id;

View File

@@ -13,7 +13,7 @@ public:
virtual bool setupControl(UIScene *scene, IggyValuePath *parent, const string &controlName);
void init(const wstring &label, int id);
void init(UIString label, int id);
void ReInit();
virtual void setFocus(bool focus);

View File

@@ -163,11 +163,17 @@ UIController::UIController()
{
m_uiDebugConsole = NULL;
m_reloadSkinThread = NULL;
m_navigateToHomeOnReload = false;
m_mcTTFFont= NULL;
m_bCleanupOnReload = false;
m_mcTTFFont = NULL;
m_moj7 = NULL;
m_moj11 = NULL;
// 4J-JEV: It's important that these remain the same, unless updateCurrentLanguage is going to be called.
m_eCurrentFont = m_eTargetFont = eFont_NotLoaded;
#ifdef ENABLE_IGGY_ALLOCATOR
InitializeCriticalSection(&m_Allocatorlock);
#endif
@@ -211,6 +217,7 @@ UIController::UIController()
m_bCustomRenderPosition = false;
m_winUserIndex = 0;
m_accumulatedTicks = 0;
m_lastUiSfx = 0;
InitializeCriticalSection(&m_navigationLock);
InitializeCriticalSection(&m_registeredCallbackScenesCS);
@@ -303,79 +310,149 @@ void UIController::postInit()
NavigateToScene(0, eUIScene_Intro);
}
void UIController::SetupFont()
{
bool bBitmapFont=false;
if(m_mcTTFFont!=NULL)
UIController::EFont UIController::getFontForLanguage(int language)
{
delete m_mcTTFFont;
switch(language)
{
case XC_LANGUAGE_JAPANESE: return eFont_Japanese;
#ifdef _DURANGO
case XC_LANGUAGE_SCHINESE: return eFont_SimpChinese;
#endif
case XC_LANGUAGE_TCHINESE: return eFont_TradChinese;
case XC_LANGUAGE_KOREAN: return eFont_Korean;
default: return eFont_Bitmap;
}
}
switch(XGetLanguage())
UITTFFont *UIController::createFont(EFont fontLanguage)
{
switch(fontLanguage)
{
#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__)
case XC_LANGUAGE_JAPANESE:
m_mcTTFFont = new UITTFFont("Common/Media/font/JPN/DF-DotDotGothic16.ttf", 0x203B); // JPN
break;
case XC_LANGUAGE_SCHINESE: //TODO
case XC_LANGUAGE_TCHINESE:
m_mcTTFFont = new UITTFFont("Common/Media/font/CHT/DFTT_R5.TTC", 0x203B); // CHT
break;
case XC_LANGUAGE_KOREAN:
m_mcTTFFont = new UITTFFont("Common/Media/font/KOR/candadite2.ttf", 0x203B); // KOR
break;
// 4J-JEV, Cyrillic characters have been added to this font now, (4/July/14)
//case XC_LANGUAGE_RUSSIAN:
//case XC_LANGUAGE_GREEK:
case eFont_Japanese: return new UITTFFont("Mojangles_TTF_jaJP", "Common/Media/font/JPN/DF-DotDotGothic16.ttf", 0x203B); // JPN
// case eFont_SimpChinese: Simplified Chinese is unsupported.
case eFont_TradChinese: return new UITTFFont("Mojangles_TTF_cnTD", "Common/Media/font/CHT/DFTT_R5.TTC", 0x203B); // CHT
case eFont_Korean: return new UITTFFont("Mojangles_TTF_koKR", "Common/Media/font/KOR/candadite2.ttf", 0x203B); // KOR
#else
case XC_LANGUAGE_JAPANESE:
m_mcTTFFont = new UITTFFont("Common/Media/font/JPN/DFGMaruGothic-Md.ttf", 0x2022); // JPN
break;
case XC_LANGUAGE_SCHINESE: //TODO
case XC_LANGUAGE_TCHINESE:
m_mcTTFFont = new UITTFFont("Common/Media/font/CHT/DFHeiMedium-B5.ttf", 0x2022); // CHT
break;
case XC_LANGUAGE_KOREAN:
m_mcTTFFont = new UITTFFont("Common/Media/font/KOR/BOKMSD.ttf", 0x2022); // KOR
break;
case eFont_Japanese: return new UITTFFont("Mojangles_TTF_jaJP", "Common/Media/font/JPN/DFGMaruGothic-Md.ttf", 0x2022); // JPN
#ifdef _DURANGO
case eFont_SimpChinese: return new UITTFFont("Mojangled_TTF_cnCN", "Common/Media/font/CHS/MSYH.ttf", 0x2022); // CHS
#endif
default:
bBitmapFont=true;
// m_mcTTFFont = new UITTFFont("Common/Media/font/Mojangles.ttf", 0x2022); // 4J-JEV: Shouldn't be using this.
break;
case eFont_TradChinese: return new UITTFFont("Mojangles_TTF_cnTD", "Common/Media/font/CHT/DFHeiMedium-B5.ttf", 0x2022); // CHT
case eFont_Korean: return new UITTFFont("Mojangles_TTF_koKR", "Common/Media/font/KOR/BOKMSD.ttf", 0x2022); // KOR
#endif
// 4J-JEV, Cyrillic characters have been added to this font now, (4/July/14)
// XC_LANGUAGE_RUSSIAN and XC_LANGUAGE_GREEK:
default: return NULL;
}
}
void UIController::SetupFont()
{
// 4J-JEV: Language hasn't changed or is already changing.
if ( (m_eCurrentFont != m_eTargetFont) || !UIString::setCurrentLanguage() ) return;
DWORD nextLanguage = UIString::getCurrentLanguage();
m_eTargetFont = getFontForLanguage(nextLanguage);
// flag a language change to reload the string tables in the DLC
app.m_dlcManager.LanguageChanged();
app.loadStringTable(); // Switch to use new string table,
if (m_eTargetFont == m_eCurrentFont)
{
// 4J-JEV: If we're ingame, reload the font to update all the text.
if (app.GetGameStarted()) app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_ReloadFont);
return;
}
if(bBitmapFont)
if (m_eCurrentFont != eFont_NotLoaded) app.DebugPrintf("[UIController] Font switch required for language transition to %i.\n", nextLanguage);
else app.DebugPrintf("[UIController] Initialising font for language %i.\n", nextLanguage);
if (m_mcTTFFont != NULL)
{
delete m_mcTTFFont;
m_mcTTFFont = NULL;
}
if(m_eTargetFont == eFont_Bitmap)
{
// these may have been set up by a previous language being chosen
if(m_moj7==NULL)
{
m_moj7 = new UIBitmapFont(SFontData::Mojangles_7);
m_moj7->registerFont();
}
if(m_moj11==NULL)
{
m_moj11 = new UIBitmapFont(SFontData::Mojangles_11);
m_moj11->registerFont();
}
if (m_moj7 == NULL) m_moj7 = new UIBitmapFont(SFontData::Mojangles_7);
if (m_moj11 == NULL) m_moj11 = new UIBitmapFont(SFontData::Mojangles_11);
// 4J-JEV: Ensure we redirect to them correctly, even if the objects were previously initialised.
m_moj7->registerFont();
m_moj11->registerFont();
}
else if (m_eTargetFont != eFont_NotLoaded)
{
m_mcTTFFont = createFont(m_eTargetFont);
app.DebugPrintf("[Iggy] Set font indirect to '%hs'.\n", m_mcTTFFont->getFontName().c_str());
IggyFontSetIndirectUTF8( "Mojangles7", -1, IGGY_FONTFLAG_all, m_mcTTFFont->getFontName().c_str(), -1, IGGY_FONTFLAG_none );
IggyFontSetIndirectUTF8( "Mojangles11", -1, IGGY_FONTFLAG_all, m_mcTTFFont->getFontName().c_str(), -1, IGGY_FONTFLAG_none );
}
else
{
app.DebugPrintf("IggyFontSetIndirectUTF8\n");
IggyFontSetIndirectUTF8( "Mojangles7", -1, IGGY_FONTFLAG_all, "Mojangles_TTF",-1 ,IGGY_FONTFLAG_none );
IggyFontSetIndirectUTF8( "Mojangles11", -1, IGGY_FONTFLAG_all, "Mojangles_TTF",-1 ,IGGY_FONTFLAG_none );
assert(false);
}
// Reload ui to set new font.
if (m_eCurrentFont != eFont_NotLoaded)
{
app.SetAction(ProfileManager.GetPrimaryPad(), eAppAction_ReloadFont);
}
else
{
updateCurrentFont();
}
}
bool UIController::PendingFontChange()
{
return getFontForLanguage( XGetLanguage() ) != m_eCurrentFont;
}
void UIController::setCleanupOnReload()
{
m_bCleanupOnReload = true;
}
void UIController::updateCurrentFont()
{
m_eCurrentFont = m_eTargetFont;
}
bool UIController::UsingBitmapFont()
{
return m_eCurrentFont == eFont_Bitmap;
}
// TICKING
void UIController::tick()
{
if(m_navigateToHomeOnReload && !ui.IsReloadingSkin())
SetupFont(); // If necessary, change font.
if ( (m_navigateToHomeOnReload || m_bCleanupOnReload) && !ui.IsReloadingSkin() )
{
ui.CleanUpSkinReload();
if (m_navigateToHomeOnReload || !g_NetworkManager.IsInSession())
{
ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MainMenu);
}
else
{
ui.CloseAllPlayersScenes();
}
updateCurrentFont();
m_navigateToHomeOnReload = false;
ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_MainMenu);
m_bCleanupOnReload = false;
}
for(unsigned int i = 0; i < eUIGroup_COUNT; ++i)
@@ -398,9 +475,6 @@ void UIController::tick()
// TODO: May wish to skip ticking other groups here
}
// Fix for HUD ticks so that they all tick before this reference is cleared
EnderDragonRenderer::bossInstance = nullptr;
// Clear out the cached movie file data
__int64 currentTime = System::currentTimeMillis();
for(AUTO_VAR(it, m_cachedMovieData.begin()); it != m_cachedMovieData.end();)
@@ -562,11 +636,12 @@ void UIController::ReloadSkin()
// 4J Stu - Don't load on a thread on windows. I haven't investigated this in detail, so a quick fix
reloadSkinThreadProc(this);
#else
// Navigate to the timer scene so that we can display something while the loading is happening
ui.NavigateToScene(0,eUIScene_Timer,(void *)1,eUILayer_Tooltips,eUIGroup_Fullscreen);
m_reloadSkinThread = new C4JThread(reloadSkinThreadProc, (void*)this, "Reload skin thread");
m_reloadSkinThread->SetProcessor(CPU_CORE_UI_SCENE);
// Navigate to the timer scene so that we can display something while the loading is happening
ui.NavigateToScene(0,eUIScene_Timer,(void *)1,eUILayer_Tooltips,eUIGroup_Fullscreen);
//m_reloadSkinThread->Run();
//// Load new skin
@@ -620,7 +695,7 @@ bool UIController::IsReloadingSkin()
bool UIController::IsExpectingOrReloadingSkin()
{
return Minecraft::GetInstance()->skins->getSelected()->isLoadingData() || Minecraft::GetInstance()->skins->needsUIUpdate() || IsReloadingSkin();
return Minecraft::GetInstance()->skins->getSelected()->isLoadingData() || Minecraft::GetInstance()->skins->needsUIUpdate() || IsReloadingSkin() || PendingFontChange();
}
void UIController::CleanUpSkinReload()
@@ -1431,6 +1506,15 @@ void UIController::unregisterSubstitutionTexture(const wstring &textureName, boo
// NAVIGATION
bool UIController::NavigateToScene(int iPad, EUIScene scene, void *initData, EUILayer layer, EUIGroup group)
{
static bool bSeenUpdateTextThisSession = false;
// If you're navigating to the multigamejoinload, and the player hasn't seen the updates message yet, display it now
// display this message the first 3 times
if((scene==eUIScene_LoadOrJoinMenu) && (bSeenUpdateTextThisSession==false) && ( app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_DisplayUpdateMessage)!=0))
{
scene=eUIScene_NewUpdateMessage;
bSeenUpdateTextThisSession=true;
}
// if you're trying to navigate to the inventory,the crafting, pause or game info or any of the trigger scenes and there's already a menu up (because you were pressing a few buttons at the same time) then ignore the navigate
if(GetMenuDisplayed(iPad))
{
@@ -1451,6 +1535,8 @@ bool UIController::NavigateToScene(int iPad, EUIScene scene, void *initData, EUI
case eUIScene_BrewingStandMenu:
case eUIScene_AnvilMenu:
case eUIScene_TradingMenu:
case eUIScene_BeaconMenu:
case eUIScene_HorseMenu:
app.DebugPrintf("IGNORING NAVIGATE - we're trying to navigate to a user selected scene when there's already a scene up: pad:%d, scene:%d\n", iPad, scene);
return false;
break;
@@ -1941,7 +2027,7 @@ void UIController::ShowTooltip( unsigned int iPad, unsigned int tooltip, bool sh
if(m_groups[(int)group]->getTooltips()) m_groups[(int)group]->getTooltips()->ShowTooltip(tooltip,show);
}
void UIController::SetTooltips( unsigned int iPad, int iA, int iB, int iX, int iY, int iLT, int iRT, int iLB, int iRB, int iLS, bool forceUpdate)
void UIController::SetTooltips( unsigned int iPad, int iA, int iB, int iX, int iY, int iLT, int iRT, int iLB, int iRB, int iLS, int iRS, int iBack, bool forceUpdate)
{
EUIGroup group;
@@ -1967,7 +2053,7 @@ void UIController::SetTooltips( unsigned int iPad, int iA, int iB, int iX, int i
{
group = eUIGroup_Fullscreen;
}
if(m_groups[(int)group]->getTooltips()) m_groups[(int)group]->getTooltips()->SetTooltips(iA, iB, iX, iY, iLT, iRT, iLB, iRB, iLS, forceUpdate);
if(m_groups[(int)group]->getTooltips()) m_groups[(int)group]->getTooltips()->SetTooltips(iA, iB, iX, iY, iLT, iRT, iLB, iRB, iLS, iRS, iBack, forceUpdate);
}
void UIController::EnableTooltip( unsigned int iPad, unsigned int tooltip, bool enable )
@@ -2033,6 +2119,13 @@ void UIController::OverrideSFX(int iPad, int iAction,bool bVal)
void UIController::PlayUISFX(ESoundEffect eSound)
{
__uint64 time = System::currentTimeMillis();
// Don't play multiple SFX on the same tick
// (prevents horrible sounds when programmatically setting multiple checkboxes)
if (time - m_lastUiSfx < 10) { return; }
m_lastUiSfx = time;
Minecraft::GetInstance()->soundEngine->playUI(eSound,1.0f,1.0f);
}
@@ -2118,7 +2211,13 @@ void UIController::HandleTMSBanFileRetrieved(int iPad)
void UIController::HandleInventoryUpdated(int iPad)
{
app.DebugPrintf(app.USER_SR, "UIController::HandleInventoryUpdated not implemented\n");
EUIGroup group = eUIGroup_Fullscreen;
if( app.GetGameStarted() && ( iPad != 255 ) && ( iPad >= 0 ) )
{
group = (EUIGroup)(iPad+1);
}
m_groups[group]->HandleMessage(eUIMessage_InventoryUpdated, NULL);
}
void UIController::HandleGameTick()
@@ -2173,16 +2272,8 @@ void UIController::SetTutorialDescription(int iPad, TutorialPopupInfo *info)
void UIController::RemoveInteractSceneReference(int iPad, UIScene *scene)
{
EUIGroup group;
if( app.GetGameStarted() )
{
// If the game isn't running treat as user 0, otherwise map index directly from pad
if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = (EUIGroup)(iPad+1);
else group = eUIGroup_Fullscreen;
}
else
{
group = eUIGroup_Fullscreen;
}
if( ( iPad != 255 ) && ( iPad >= 0 ) ) group = (EUIGroup)(iPad+1);
else group = eUIGroup_Fullscreen;
if(m_groups[(int)group]->getTutorialPopup()) m_groups[(int)group]->getTutorialPopup()->RemoveInteractSceneReference(scene);
}
#endif
@@ -2438,14 +2529,19 @@ void UIController::ClearPressStart()
m_iPressStartQuadrantsMask = 0;
}
// 4J Stu - For the different StringTable classes. Should really fix the libraries.
#ifndef __PS3__
C4JStorage::EMessageResult UIController::RequestAlertMessage(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult),LPVOID lpParam, WCHAR *pwchFormatString)
{
return RequestMessageBox(uiTitle, uiText, uiOptionA, uiOptionC, dwPad, Func, lpParam, pwchFormatString, 0, false);
}
C4JStorage::EMessageResult UIController::RequestErrorMessage(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult),LPVOID lpParam, WCHAR *pwchFormatString)
{
return RequestMessageBox(uiTitle, uiText, uiOptionA, uiOptionC, dwPad, Func, lpParam, pwchFormatString, 0, true);
}
C4JStorage::EMessageResult UIController::RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad,
int( *Func)(LPVOID,int,const C4JStorage::EMessageResult),LPVOID lpParam, C4JStringTable *pStringTable, WCHAR *pwchFormatString,DWORD dwFocusButton, bool bIsError)
#else
C4JStorage::EMessageResult UIController::RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad,
int( *Func)(LPVOID,int,const C4JStorage::EMessageResult),LPVOID lpParam, StringTable *pStringTable, WCHAR *pwchFormatString,DWORD dwFocusButton, bool bIsError)
#endif
int( *Func)(LPVOID,int,const C4JStorage::EMessageResult),LPVOID lpParam, WCHAR *pwchFormatString,DWORD dwFocusButton, bool bIsError)
{
MessageBoxInfo param;
param.uiTitle = uiTitle;
@@ -2453,7 +2549,7 @@ C4JStorage::EMessageResult UIController::RequestMessageBox(UINT uiTitle, UINT ui
param.uiOptionA = uiOptionA;
param.uiOptionC = uiOptionC;
param.dwPad = dwPad;
param.Func = Func;\
param.Func = Func;
param.lpParam = lpParam;
param.pwchFormatString = pwchFormatString;
param.dwFocusButton = dwFocusButton;
@@ -2512,11 +2608,11 @@ C4JStorage::EMessageResult UIController::RequestUGCMessageBox(UINT title/* = -1
ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, iPad );
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
return ui.RequestMessageBox( title, IDS_CHAT_RESTRICTION_UGC, uiIDA, 1, iPad, Func, lpParam, app.GetStringTable(), NULL, 0, false);
return ui.RequestAlertMessage( title, IDS_CHAT_RESTRICTION_UGC, uiIDA, 1, iPad, Func, lpParam);
#else
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
return ui.RequestMessageBox( title, message, uiIDA, 1, iPad, Func, lpParam, app.GetStringTable(), NULL, 0, false);
return ui.RequestAlertMessage( title, message, uiIDA, 1, iPad, Func, lpParam);
#endif
}
@@ -2551,7 +2647,7 @@ C4JStorage::EMessageResult UIController::RequestContentRestrictedMessageBox(UINT
#else
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
return ui.RequestMessageBox( title, message, uiIDA, 1, iPad, Func, lpParam, app.GetStringTable(), NULL, 0, false);
return ui.RequestAlertMessage( title, message, uiIDA, 1, iPad, Func, lpParam);
#endif
}
@@ -2705,10 +2801,13 @@ void UIController::TouchBoxRebuild(UIScene *pUIScene)
control->getControlType() == UIControl::eLeaderboardList ||
control->getControlType() == UIControl::eTouchControl)
{
// 4J-TomK update the control (it might have been moved by flash / AS)
control->UpdateControl();
if(control->getVisible())
{
// 4J-TomK update the control (it might have been moved by flash / AS)
control->UpdateControl();
ui.TouchBoxAdd(control,eUIGroup,eUILayer,eUIscene, pUIScene->GetMainPanel());
ui.TouchBoxAdd(control,eUIGroup,eUILayer,eUIscene, pUIScene->GetMainPanel());
}
}
}
}
@@ -2960,7 +3059,8 @@ void UIController::HandleTouchInput(unsigned int iPad, unsigned int key, bool bP
if(m_HighlightedUIElement && m_ActiveUIElement->pControl == m_HighlightedUIElement->pControl)
{
UIControl_CheckBox *pCheckbox=(UIControl_CheckBox *)m_ActiveUIElement->pControl;
pCheckbox->TouchSetCheckbox(!pCheckbox->IsChecked());
if(pCheckbox->IsEnabled()) // only proceed if checkbox is enabled!
pCheckbox->TouchSetCheckbox(!pCheckbox->IsChecked());
}
bReleased = false;
break;

View File

@@ -38,10 +38,37 @@ private:
S32 m_tileOriginX, m_tileOriginY;
enum EFont
{
eFont_NotLoaded = 0,
eFont_Bitmap,
eFont_Japanese,
eFont_SimpChinese,
eFont_TradChinese,
eFont_Korean,
};
// 4J-JEV: It's important that currentFont == targetFont, unless updateCurrentLanguage is going to be called.
EFont m_eCurrentFont, m_eTargetFont;
// 4J-JEV: Behaves like navigateToHome when not ingame. When in-game, it closes all player scenes instead.
bool m_bCleanupOnReload;
EFont getFontForLanguage(int language);
UITTFFont *createFont(EFont fontLanguage);
UIAbstractBitmapFont *m_mcBitmapFont;
UITTFFont *m_mcTTFFont;
UIBitmapFont *m_moj7, *m_moj11;
public:
void setCleanupOnReload();
void updateCurrentFont();
private:
// 4J-PB - ui element type for PSVita touch control
#ifdef __PSVITA__
@@ -136,6 +163,7 @@ private:
C4JThread *m_reloadSkinThread;
bool m_navigateToHomeOnReload;
int m_accumulatedTicks;
__uint64 m_lastUiSfx; // Tracks time (ms) of last UI sound effect
D3D11_RECT m_customRenderingClearRect;
@@ -182,6 +210,9 @@ protected:
public:
CRITICAL_SECTION m_Allocatorlock;
void SetupFont();
bool PendingFontChange();
bool UsingBitmapFont();
public:
// TICKING
virtual void tick();
@@ -295,7 +326,7 @@ public:
virtual void SetTooltipText( unsigned int iPad, unsigned int tooltip, int iTextID );
virtual void SetEnableTooltips( unsigned int iPad, BOOL bVal );
virtual void ShowTooltip( unsigned int iPad, unsigned int tooltip, bool show );
virtual void SetTooltips( unsigned int iPad, 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);
virtual void SetTooltips( unsigned int iPad, 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, int iRS=-1, int iBack=-1, bool forceUpdate = false);
virtual void EnableTooltip( unsigned int iPad, unsigned int tooltip, bool enable );
virtual void RefreshTooltips(unsigned int iPad);
@@ -341,15 +372,12 @@ public:
virtual void HidePressStart();
void ClearPressStart();
// 4J Stu - Only because of the different StringTable type, should really fix the libraries
#ifndef __PS3__
virtual C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY,
int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, C4JStringTable *pStringTable=NULL, WCHAR *pwchFormatString=NULL,DWORD dwFocusButton=0, bool bIsError = true);
#else
virtual C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY,
int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, StringTable *pStringTable=NULL, WCHAR *pwchFormatString=NULL,DWORD dwFocusButton=0, bool bIsError = true);
#endif
virtual C4JStorage::EMessageResult RequestAlertMessage(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, WCHAR *pwchFormatString=NULL);
virtual C4JStorage::EMessageResult RequestErrorMessage(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad=XUSER_INDEX_ANY, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult)=NULL,LPVOID lpParam=NULL, WCHAR *pwchFormatString=NULL);
private:
virtual C4JStorage::EMessageResult RequestMessageBox(UINT uiTitle, UINT uiText, UINT *uiOptionA,UINT uiOptionC, DWORD dwPad,int( *Func)(LPVOID,int,const C4JStorage::EMessageResult),LPVOID lpParam, WCHAR *pwchFormatString,DWORD dwFocusButton, bool bIsError);
public:
C4JStorage::EMessageResult RequestUGCMessageBox(UINT title = -1, UINT message = -1, int iPad = -1, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult) = NULL, LPVOID lpParam = NULL);
C4JStorage::EMessageResult RequestContentRestrictedMessageBox(UINT title = -1, UINT message = -1, int iPad = -1, int( *Func)(LPVOID,int,const C4JStorage::EMessageResult) = NULL, LPVOID lpParam = NULL);

View File

@@ -54,7 +54,7 @@ enum EUIScene
eUIScene_DebugOptions,
eUIScene_DebugTips,
eUIScene_HelpAndOptionsMenu,
eUIScene_HowToPlay,
eUIScene_HowToPlay,
eUIScene_HowToPlayMenu,
eUIScene_ControlsMenu,
eUIScene_SettingsOptionsMenu,
@@ -94,13 +94,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
// Also update UILayer::updateFocusState
#ifndef _XBOX
// Anything non-xbox should be added here. The ordering of scenes above is required for sentient reporting on xbox 360 to continue to be accurate
@@ -117,6 +127,7 @@ enum EUIScene
eUIScene_Timer,
eUIScene_EULA,
eUIScene_InGameSaveManagementMenu,
eUIScene_LanguageSelector,
#endif // ndef _XBOX
#ifdef _DEBUG_MENUS_ENABLED
@@ -154,6 +165,8 @@ enum EToolTipButton
eToolTipButtonLB,
eToolTipButtonRB,
eToolTipButtonLS,
eToolTipButtonRS,
eToolTipButtonBack,
eToolTipNumButtons
};
@@ -209,6 +222,12 @@ enum EHowToPlayPage
eHowToPlay_Breeding,
eHowToPlay_Trading,
eHowToPlay_Horses,
eHowToPlay_Beacons,
eHowToPlay_Fireworks,
eHowToPlay_Hoppers,
eHowToPlay_Droppers,
eHowToPlay_NetherPortal,
eHowToPlay_TheEnd,
#ifdef _XBOX
@@ -229,6 +248,13 @@ 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.
#define CONNECTING_PROGRESS_CHECK_TIME 500

View File

@@ -13,6 +13,8 @@ UIGroup::UIGroup(EUIGroup group, int iPad)
m_updateFocusStateCountdown = 0;
m_viewportType = C4JRender::VIEWPORT_TYPE_FULLSCREEN;
for(unsigned int i = 0; i < eUILayer_COUNT; ++i)
{
m_layers[i] = new UILayer(this);
@@ -39,8 +41,6 @@ UIGroup::UIGroup(EUIGroup group, int iPad)
m_pressStartToPlay = (UIComponent_PressStartToPlay *)m_layers[(int)eUILayer_Tooltips]->addComponent(0, eUIComponent_PressStartToPlay);
}
m_viewportType = C4JRender::VIEWPORT_TYPE_FULLSCREEN;
// 4J Stu - Pre-allocate this for cached rendering in scenes. It's horribly slow to do dynamically, but we should only need one
// per group as we will only be displaying one of these types of scenes at a time
m_commandBufferList = MemoryTracker::genLists(1);
@@ -318,6 +318,16 @@ 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;

View File

@@ -96,6 +96,8 @@ public:
#ifdef _XBOX_ONE
virtual void HandleDLCLicenseChange();
#endif
virtual void HandleMessage(EUIMessage message, void *data);
bool IsFullscreenGroup();
void handleUnlockFullVersion();

View File

@@ -189,7 +189,7 @@ void UILayer::ReloadAll(bool force)
int lowestRenderable = 0;
for(;lowestRenderable < m_sceneStack.size(); ++lowestRenderable)
{
m_sceneStack[lowestRenderable]->reloadMovie();
m_sceneStack[lowestRenderable]->reloadMovie(force);
}
}
}
@@ -253,6 +253,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:
@@ -282,6 +294,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;
@@ -386,6 +401,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:
@@ -700,6 +718,12 @@ 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
@@ -723,6 +747,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
@@ -786,7 +816,7 @@ void UILayer::handleInput(int iPad, int key, bool repeat, bool pressed, bool rel
}
// 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;
}
@@ -823,6 +853,15 @@ 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();

View File

@@ -83,6 +83,8 @@ public:
#ifdef _XBOX_ONE
virtual void HandleDLCLicenseChange();
#endif
virtual void HandleMessage(EUIMessage message, void *data);
void handleUnlockFullVersion();
UIScene *FindScene(EUIScene sceneType);

View File

@@ -93,6 +93,7 @@ void UIScene::reloadMovie(bool force)
(*it)->ReInit();
}
updateComponents();
handleReload();
IggyDataValue result;
@@ -740,6 +741,9 @@ void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_pt
PIXBeginNamedEvent(0,"Render and decorate");
if(m_pItemRenderer == NULL) m_pItemRenderer = new ItemRenderer();
RenderManager.StateSetBlendEnable(true);
RenderManager.StateSetBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
RenderManager.StateSetBlendFactor(0xffffffff);
m_pItemRenderer->renderAndDecorateItem(pMinecraft->font, pMinecraft->textures, item, x, y,scaleX,scaleY,fAlpha,isFoil,false, !usingCommandBuffer);
PIXEndNamedEvent();
@@ -827,7 +831,7 @@ void UIScene::gainFocus()
app.DebugPrintf("Sent gain focus event to scene\n");
*/
bHasFocus = true;
if(app.GetGameStarted() && needsReloaded())
if(needsReloaded())
{
reloadMovie();
}
@@ -882,7 +886,8 @@ void UIScene::handleGainFocus(bool navBack)
void UIScene::updateTooltips()
{
ui.SetTooltips(m_iPad, -1);
if(!ui.IsReloadingSkin())
ui.SetTooltips(m_iPad, -1);
}
void UIScene::sendInputToMovie(int key, bool repeat, bool pressed, bool released)
@@ -906,6 +911,7 @@ void UIScene::sendInputToMovie(int key, bool repeat, bool pressed, bool released
int UIScene::convertGameActionToIggyKeycode(int action)
{
// TODO: This action to key mapping should probably use the control mapping
int keycode = -1;
switch(action)
{
@@ -946,7 +952,16 @@ 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;
@@ -957,6 +972,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;
@@ -1233,6 +1249,10 @@ void UIScene::UpdateSceneControls()
}
#endif
void UIScene::HandleMessage(EUIMessage message, void *data)
{
}
size_t UIScene::GetCallbackUniqueId()
{
if( m_callbackUniqueId == 0)

View File

@@ -169,6 +169,9 @@ public:
// Returns true if lower scenes in this scenes layer, or in any layer below 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();
@@ -251,6 +254,9 @@ public:
#ifdef _XBOX_ONE
virtual void HandleDLCLicenseChange() {}
#endif
virtual void HandleMessage(EUIMessage message, void *data);
void registerSubstitutionTexture(const wstring &textureName, PBYTE pbData, DWORD dwLength, bool deleteData = false);
bool hasRegisteredSubstitutionTexture(const wstring &textureName);
@@ -260,6 +266,7 @@ public:
protected:
#ifdef _DURANGO
virtual long long getDefaultGtcButtons() { return _360_GTC_BACK; }
#endif

View File

@@ -50,7 +50,10 @@ void UIScene_AbstractContainerMenu::handleDestroy()
// 4J Stu - Fix for #11302 - TCR 001: Network Connectivity: Host crashed after being killed by the client while accessing a chest during burst 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) pMinecraft->localplayers[m_iPad]->closeContainer();
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);
@@ -311,7 +314,7 @@ void UIScene_AbstractContainerMenu::render(S32 width, S32 height, C4JRender::eVi
if(m_needsCacheRendered)
{
m_expectedCachedSlotCount = 0;
m_expectedCachedSlotCount = GetBaseSlotCount();
unsigned int count = m_menu->getSize();
for(unsigned int i = 0; i < count; ++i)
{
@@ -333,6 +336,7 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg
if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return;
shared_ptr<ItemInstance> item = nullptr;
int slotId = -1;
if(wcscmp((wchar_t *)region->name,L"pointerIcon")==0)
{
m_cacheSlotRenders = false;
@@ -340,7 +344,6 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg
}
else
{
int slotId = -1;
swscanf((wchar_t*)region->name,L"slot_%d",&slotId);
if (slotId == -1)
{
@@ -354,7 +357,7 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg
}
}
if(item != NULL) customDrawSlotControl(region,m_iPad,item,1.0f,item->isFoil(),true);
if(item != NULL) 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, bool pressed, bool released, bool &handled)
@@ -370,21 +373,24 @@ void UIScene_AbstractContainerMenu::handleInput(int iPad, int key, bool repeat,
}
}
void UIScene_AbstractContainerMenu::SetPointerText(const wstring &description, vector<wstring> &unformattedStrings, bool newSlot)
void UIScene_AbstractContainerMenu::SetPointerText(vector<HtmlString> *description, bool newSlot)
{
//app.DebugPrintf("Setting pointer text\n");
m_cursorPath.setLabel(description,false,newSlot);
m_cursorPath.setLabel(HtmlString::Compose(description), false, newSlot);
}
void UIScene_AbstractContainerMenu::setSectionFocus(ESceneSection eSection, int iPad)
{
UIControl *newFocus = getSection(eSection);
if(newFocus) newFocus->setFocus(true);
if(m_focusSection != eSectionNone)
{
UIControl *currentFocus = getSection(m_focusSection);
if(currentFocus) currentFocus->setFocus(false);
// 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);
}
UIControl *newFocus = getSection(eSection);
if(newFocus) newFocus->setFocus(true);
m_focusSection = eSection;
}
@@ -405,6 +411,13 @@ shared_ptr<ItemInstance> UIScene_AbstractContainerMenu::getSlotItem(ESceneSectio
else 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 );

View File

@@ -48,15 +48,20 @@ protected:
virtual bool doesSectionTreeHaveFocus(ESceneSection eSection) { return false; }
virtual void setSectionFocus(ESceneSection eSection, int iPad);
void setFocusToPointer(int iPad);
void SetPointerText(const wstring &description, vector<wstring> &unformattedStrings, bool newSlot);
void SetPointerText(vector<HtmlString> *description, bool newSlot);
virtual 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);

View File

@@ -27,14 +27,14 @@ UIScene_AnvilMenu::UIScene_AnvilMenu(int iPad, void *_initData, UILayer *parentL
gameMode->getTutorial()->changeTutorialState(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, eSectionAnvilUsing, eSectionAnvilMax );
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;
wstring m_costString = L"";
@@ -46,7 +46,7 @@ UIScene_AnvilMenu::UIScene_AnvilMenu(int iPad, void *_initData, UILayer *parentL
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
}
@@ -56,7 +56,7 @@ UIScene_AnvilMenu::UIScene_AnvilMenu(int iPad, void *_initData, UILayer *parentL
wchar_t temp[256];
swprintf(temp, 256, costString, m_repairMenu->cost);
m_costString = temp;
if(!m_repairMenu->getSlot(RepairMenu::RESULT_SLOT)->mayPickup(dynamic_pointer_cast<Player>(m_inventory->player->shared_from_this())))
if(!m_repairMenu->getSlot(AnvilMenu::RESULT_SLOT)->mayPickup(dynamic_pointer_cast<Player>(m_inventory->player->shared_from_this())))
{
expensive = true;
}
@@ -85,11 +85,11 @@ wstring UIScene_AnvilMenu::getMoviePath()
void UIScene_AnvilMenu::handleReload()
{
Initialize( m_iPad, m_menu, true, RepairMenu::INV_SLOT_START, eSectionAnvilUsing, eSectionAnvilMax );
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()

View File

@@ -0,0 +1,519 @@
#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 "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;
}
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;
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 = shared_ptr<ItemInstance>(new ItemInstance(Item::emerald) );
break;
case 1:
item = shared_ptr<ItemInstance>(new ItemInstance(Item::diamond) );
break;
case 2:
item = shared_ptr<ItemInstance>(new ItemInstance(Item::goldIngot) );
break;
case 3:
item = 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;
};
}

View File

@@ -0,0 +1,71 @@
#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 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);
};

View File

@@ -14,11 +14,11 @@ UIScene_BrewingStandMenu::UIScene_BrewingStandMenu(int iPad, void *_initData, UI
m_progressBrewingArrow.init(L"",0,0,PotionBrewing::BREWING_TIME_SECONDS * SharedConstants::TICKS_PER_SECOND,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 )
{

View File

@@ -188,7 +188,7 @@ void UIScene_ConnectingProgress::handleTimerComplete(int id)
{
UINT 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();

View File

@@ -19,7 +19,7 @@ UIScene_ContainerMenu::UIScene_ContainerMenu(int iPad, void *_initData, UILayer
// 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 );

View File

@@ -37,7 +37,7 @@ UIScene_ControlsMenu::UIScene_ControlsMenu(int iPad, void *initData, UILayer *pa
// 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] && Minecraft::GetInstance()->localplayers[m_iPad]->abilities.mayfly;

View File

@@ -197,7 +197,10 @@ 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) Minecraft::GetInstance()->localplayers[m_iPad]->closeContainer();
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);
@@ -763,6 +766,21 @@ 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

View File

@@ -202,4 +202,10 @@ 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(); }
};

View File

@@ -45,11 +45,8 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay
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);
m_buttonMoreOptions.init(app.GetString(IDS_MORE_OPTIONS),eControl_MoreOptions);
@@ -75,7 +72,16 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay
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;
@@ -121,28 +127,23 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay
}
}
#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);
// 4J-PB - to stop an offline game being able to select the online flag
if(ProfileManager.IsSignedInLive(m_iPad) == false)
{
// 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);
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 +177,7 @@ UIScene_CreateWorldMenu::UIScene_CreateWorldMenu(int iPad, void *initData, UILay
swprintf(imageName,64,L"tpack%08x",tp->getId());
registerSubstitutionTexture(imageName, pbImageData, dwImageBytes);
m_texturePackList.addPack(i,imageName);
app.DebugPrintf("Adding texture pack %ls at %d\n",imageName,i);
}
}
@@ -323,7 +325,7 @@ void UIScene_CreateWorldMenu::tick()
uiIDA[0]=IDS_PRO_NOTONLINE_DECLINE;
// Give the player a warning about the texture pack missing
ui.RequestMessageBox(IDS_PLAY_OFFLINE,IDS_NO_PLAYSTATIONPLUS, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_CreateWorldMenu::ContinueOffline,dynamic_cast<UIScene_CreateWorldMenu*>(this),app.GetStringTable(), 0, 0, false);
ui.RequestAlertMessage(IDS_PLAY_OFFLINE,IDS_NO_PLAYSTATIONPLUS, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_CreateWorldMenu::ContinueOffline,dynamic_cast<UIScene_CreateWorldMenu*>(this));
}
}
break;
@@ -374,7 +376,7 @@ void UIScene_CreateWorldMenu::handleInput(int iPad, int key, bool repeat, bool p
if ( pressed && controlHasFocus(m_checkboxOnline.getId()) && !m_checkboxOnline.IsEnabled() )
{
UINT 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
@@ -386,22 +388,17 @@ void UIScene_CreateWorldMenu::handleInput(int iPad, int key, bool repeat, bool p
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)
{
bool bOnlineGame = m_checkboxOnline.IsChecked();
if (m_MoreOptionsParams.bOnlineGame != bOnlineGame)
{
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
handled = true;
break;
@@ -423,39 +420,20 @@ void UIScene_CreateWorldMenu::handlePress(F64 controlId, F64 childId)
InputManager.RequestKeyboard(app.GetString(IDS_CREATE_NEW_WORLD),m_editWorldName.getLabel(),(DWORD)0,25,&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(),(DWORD)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(),(DWORD)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(),(DWORD)0,60,&UIScene_CreateWorldMenu::KeyboardCompleteSeedCallback,this,C_4JInput::EKeyboardMode_Default);
#endif
}
break;
case eControl_GameModeToggle:
if(m_bGameModeSurvival)
switch(m_iGameModeId)
{
case 0: // Survival
m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_CREATIVE));
m_bGameModeSurvival=false;
}
else
{
m_iGameModeId = GameType::CREATIVE->getId();
m_bGameModeCreative = true;
break;
case 1: // Creative
m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_SURVIVAL));
m_bGameModeSurvival=true;
}
m_iGameModeId = GameType::SURVIVAL->getId();
m_bGameModeCreative = false;
break;
};
break;
case eControl_MoreOptions:
ui.NavigateToScene(m_iPad, eUIScene_LaunchMoreOptionsMenu, &m_MoreOptionsParams);
@@ -533,7 +511,7 @@ 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;
}
}
@@ -603,13 +581,13 @@ void UIScene_CreateWorldMenu::StartSharedLaunchFlow()
// trial pack warning
UINT 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
UINT 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__
@@ -684,13 +662,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;
}
}
@@ -742,13 +716,7 @@ 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);
}
}
@@ -774,28 +742,6 @@ int UIScene_CreateWorldMenu::KeyboardCompleteWorldNameCallback(LPVOID lpParam,bo
return 0;
}
int UIScene_CreateWorldMenu::KeyboardCompleteSeedCallback(LPVOID lpParam,bool bRes)
{
UIScene_CreateWorldMenu *pClass=(UIScene_CreateWorldMenu *)lpParam;
pClass->m_bIgnoreInput=false;
// 4J HEG - No reason to set value if keyboard was cancelled
if (bRes)
{
#ifdef __PSVITA__
//CD - Changed to 2048 [SCE_IME_MAX_TEXT_LENGTH]
uint16_t pchText[2048];
ZeroMemory(pchText, 2048 * sizeof(uint16_t) );
#else
uint16_t pchText[128];
ZeroMemory(pchText, 128 * sizeof(uint16_t) );
#endif
InputManager.GetText(pchText);
pClass->m_editSeed.setLabel((wchar_t *)pchText);
pClass->m_MoreOptionsParams.seed = (wchar_t *)pchText;
}
return 0;
}
void UIScene_CreateWorldMenu::checkStateAndStartGame()
{
int primaryPad = ProfileManager.GetPrimaryPad();
@@ -832,7 +778,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
// 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive if the npAvailability isn't SCE_OK
UINT 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
{
@@ -840,7 +786,7 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
UINT uiIDA[2];
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT;
uiIDA[1] = IDS_CANCEL;
ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, iPadNotSignedInLive, &UIScene_CreateWorldMenu::MustSignInReturnedPSN, this, app.GetStringTable(), NULL, 0, false);
ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, iPadNotSignedInLive, &UIScene_CreateWorldMenu::MustSignInReturnedPSN, this);
}
return;
/* 4J-PB - Add this after release
@@ -852,21 +798,21 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
// Signed in to PSN but not connected (no internet access)
UINT 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());
ui.RequestErrorMessage(IDS_PRO_CURRENTLY_NOT_ONLINE_TITLE, IDS_PRO_PSNOFFLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad());
}
else
{
// Not signed in to PSN
UINT 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());
ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad());
return;
}*/
#else
m_bIgnoreInput=false;
UINT 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
}
@@ -894,6 +840,16 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
{
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
int32_t iResult=sceNpCommerceDialogInitialize();
@@ -915,18 +871,18 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
}
#endif
if(m_bGameModeSurvival != true || m_MoreOptionsParams.bHostPrivileges == TRUE)
if(m_bGameModeCreative == true || m_MoreOptionsParams.bHostPrivileges == TRUE)
{
UINT uiIDA[2];
uiIDA[0]=IDS_CONFIRM_OK;
uiIDA[1]=IDS_CONFIRM_CANCEL;
if(m_bGameModeSurvival != true)
if(m_bGameModeCreative == true)
{
ui.RequestMessageBox(IDS_TITLE_START_GAME, IDS_CONFIRM_START_CREATIVE, uiIDA, 2, m_iPad,&UIScene_CreateWorldMenu::ConfirmCreateReturned,this,app.GetStringTable(),NULL,0,false);
ui.RequestAlertMessage(IDS_TITLE_START_GAME, IDS_CONFIRM_START_CREATIVE, uiIDA, 2, m_iPad,&UIScene_CreateWorldMenu::ConfirmCreateReturned,this);
}
else
{
ui.RequestMessageBox(IDS_TITLE_START_GAME, IDS_CONFIRM_START_HOST_PRIVILEGES, uiIDA, 2, m_iPad,&UIScene_CreateWorldMenu::ConfirmCreateReturned,this,app.GetStringTable(),NULL,0,false);
ui.RequestAlertMessage(IDS_TITLE_START_GAME, IDS_CONFIRM_START_HOST_PRIVILEGES, uiIDA, 2, m_iPad,&UIScene_CreateWorldMenu::ConfirmCreateReturned,this);
}
}
else
@@ -973,6 +929,15 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
{
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
int32_t iResult=sceNpCommerceDialogInitialize();
@@ -1024,6 +989,16 @@ void UIScene_CreateWorldMenu::checkStateAndStartGame()
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 - have to call the upsell all the time!
@@ -1164,7 +1139,7 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD
app.SetGameHostOption(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,pClass->m_MoreOptionsParams.bStructures );
app.SetGameHostOption(eGameHostOption_BonusChest,pClass->m_MoreOptionsParams.bBonusChest );
@@ -1176,6 +1151,21 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD
app.SetGameHostOption(eGameHostOption_HostCanFly,pClass->m_MoreOptionsParams.bHostPrivileges);
app.SetGameHostOption(eGameHostOption_HostCanChangeHunger,pClass->m_MoreOptionsParams.bHostPrivileges);
app.SetGameHostOption(eGameHostOption_HostCanBeInvisible,pClass->m_MoreOptionsParams.bHostPrivileges );
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);
@@ -1186,26 +1176,23 @@ void UIScene_CreateWorldMenu::CreateGame(UIScene_CreateWorldMenu* pClass, DWORD
{
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
@@ -1283,7 +1270,7 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void *pParam,bool bContinu
// 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive if the npAvailability isn't SCE_OK
UINT 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
{
@@ -1291,14 +1278,14 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void *pParam,bool bContinu
UINT uiIDA[2];
uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT;
uiIDA[1] = IDS_CANCEL;
ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, iPadNotSignedInLive, &UIScene_CreateWorldMenu::MustSignInReturnedPSN, pClass, app.GetStringTable(), NULL, 0, false);
ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, iPadNotSignedInLive, &UIScene_CreateWorldMenu::MustSignInReturnedPSN, pClass);
}
return 0;
#else
pClass->m_bIgnoreInput=false;
UINT 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
}
@@ -1318,14 +1305,14 @@ int UIScene_CreateWorldMenu::StartGame_SignInReturned(void *pParam,bool bContinu
pClass->m_bIgnoreInput = false;
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable(),NULL,0,false);
ui.RequestAlertMessage( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad());
}
else
{
pClass->m_bIgnoreInput = false;
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
ui.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_HOST_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable(),NULL,0,false);
ui.RequestAlertMessage( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_HOST_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad());
}
}
else
@@ -1389,7 +1376,7 @@ int UIScene_CreateWorldMenu::ConfirmCreateReturned(void *pParam,int iPad,C4JStor
pClass->m_bIgnoreInput = false;
UINT uiIDA[1];
uiIDA[0]=IDS_CONFIRM_OK;
ui.RequestMessageBox( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable(),NULL,0,false);
ui.RequestAlertMessage( IDS_FAILED_TO_CREATE_GAME_TITLE, IDS_NO_USER_CREATED_CONTENT_PRIVILEGE_CREATE, uiIDA,1,ProfileManager.GetPrimaryPad());
}
else
{

View File

@@ -8,7 +8,6 @@ private:
enum EControls
{
eControl_EditWorldName,
eControl_EditSeed,
eControl_TexturePackList,
eControl_GameModeToggle,
eControl_Difficulty,
@@ -24,14 +23,11 @@ private:
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;
@@ -40,22 +36,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,7 +88,6 @@ private:
protected:
static int KeyboardCompleteWorldNameCallback(LPVOID lpParam,const bool bRes);
static int KeyboardCompleteSeedCallback(LPVOID lpParam,const bool bRes);
void handlePress(F64 controlId, F64 childId);
void handleSliderMove(F64 sliderId, F64 currentValue);

View File

@@ -21,7 +21,7 @@ UIScene_CreativeMenu::UIScene_CreativeMenu(int iPad, void *_initData, UILayer *p
InventoryScreenInput *initData = (InventoryScreenInput *)_initData;
shared_ptr<SimpleContainer> creativeContainer = shared_ptr<SimpleContainer>(new SimpleContainer( 0, TabSpec::MAX_SIZE ));
shared_ptr<SimpleContainer> creativeContainer = shared_ptr<SimpleContainer>(new SimpleContainer( 0, L"", false, TabSpec::MAX_SIZE ));
itemPickerMenu = new ItemPickerMenu(creativeContainer, initData->player->inventory);
Initialize( initData->iPad, itemPickerMenu, false, -1, eSectionInventoryCreativeUsing, eSectionInventoryCreativeMax, initData->bNavigateBack);
@@ -158,26 +158,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 );
@@ -191,6 +171,10 @@ void UIScene_CreativeMenu::handleReload()
{
m_slotListHotbar.addSlot(i);
}
ECreativeInventoryTabs lastTab = m_curTab;
m_curTab = eCreativeInventoryTab_COUNT;
switchTab(lastTab);
}
void UIScene_CreativeMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)

View File

@@ -80,7 +80,6 @@ public:
virtual void handleTouchBoxRebuild();
virtual void handleTimerComplete(int id);
#endif
virtual void ScrollBar(UIVec2D pointerPos);
private:
// IUIScene_CreativeMenu

View File

@@ -1,5 +1,6 @@
#include "stdafx.h"
#include "UI.h"
#include "..\Minecraft.World\StringHelpers.h"
#include "UIScene_Credits.h"
#define CREDIT_ICON -2
@@ -50,7 +51,16 @@ SCreditTextItemDef UIScene_Credits::gs_aCreditDefs[MAX_CREDIT_STRINGS] =
{ L"Patrick Geuder", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
{ L"%ls", IDS_CREDITS_MUSICANDSOUNDS, NO_TRANSLATED_STRING,eLargeText },
{ L"Daniel Rosenfeld (C418)", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
{ L"", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText }, // extra blank line
{ 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 },
{ L"Paddy Burns", NO_TRANSLATED_STRING, NO_TRANSLATED_STRING,eSmallText },
@@ -584,27 +594,38 @@ void UIScene_Credits::tick()
// Set up the new text element.
if(pDef->m_Text!=NULL) // 4J-PB - think the RAD logo ones aren't set up yet and are coming is as null
{
{
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.
{
LPWSTR creditsString = new wchar_t[ 128 ];
if(pDef->m_iStringID[1]!=NO_TRANSLATED_STRING)
wstring sanitisedString = wstring(pDef->m_Text);
// 4J-JEV: Some DLC credits contain copyright or registered symbols that are not rendered in some fonts.
if ( !ui.UsingBitmapFont() )
{
swprintf( creditsString, 128, pDef->m_Text, app.GetString( pDef->m_iStringID[0] ), app.GetString( pDef->m_iStringID[1] ) );
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[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, app.GetString( pDef->m_iStringID[0] ) );
swprintf( creditsString, 128, sanitisedString.c_str(), app.GetString( pDef->m_iStringID[0] ) );
}
setNextLabel(creditsString,pDef->m_eType);
delete [] creditsString;
}

View File

@@ -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
@@ -15,7 +15,7 @@
#define MAX_CREDIT_STRINGS (PS3_CREDITS_COUNT + MILES_AND_IGGY_CREDITS_COUNT + DYNAMODE_FONT_CREDITS_COUNT + PS3_DOLBY_CREDIT)
#elif defined(__ORBIS__)
#define MAX_CREDIT_STRINGS (PS4_CREDITS_COUNT + MILES_AND_IGGY_CREDITS_COUNT + DYNAMODE_FONT_CREDITS_COUNT)
#elif defined(_DURANGO) || defined _WIN64
#elif defined(_DURANGO) || defined _WINDOWS64
#define MAX_CREDIT_STRINGS (XBOXONE_CREDITS_COUNT + MILES_AND_IGGY_CREDITS_COUNT)
#elif defined(__PSVITA__)
#define MAX_CREDIT_STRINGS (PSVITA_CREDITS_COUNT + MILES_AND_IGGY_CREDITS_COUNT + DYNAMODE_FONT_CREDITS_COUNT)

View File

@@ -15,7 +15,7 @@ UIScene_DLCMainMenu::UIScene_DLCMainMenu(int iPad, void *initData, UILayer *pare
// 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, UILayer *pare
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,9 +42,9 @@ UIScene_DLCMainMenu::UIScene_DLCMainMenu(int iPad, void *initData, UILayer *pare
#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
// we also need to mount the local DLC so we can tell what's been purchased
@@ -53,10 +53,8 @@ UIScene_DLCMainMenu::UIScene_DLCMainMenu(int iPad, void *initData, UILayer *pare
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__ )
@@ -71,6 +69,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
}
wstring UIScene_DLCMainMenu::getMoviePath()
@@ -93,10 +96,8 @@ void UIScene_DLCMainMenu::handleInput(int iPad, int key, bool repeat, bool press
case ACTION_MENU_CANCEL:
if(pressed)
{
#ifdef __ORBIS__
sceNpCommerceHidePsStoreIcon();
#elif defined __PSVITA__
sceNpCommerce2HidePsStoreIcon();
#if defined __ORBIS__ || defined __PSVITA__
app.GetCommerce()->HidePsStoreIcon();
#endif
navigateBack();
}
@@ -155,7 +156,7 @@ void UIScene_DLCMainMenu::handleTimerComplete(int id)
// If they have, bring up the PSN warning and exit from the leaderboards
unsigned int uiIDA[1];
uiIDA[0]=IDS_OK;
C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_CONNECTION_LOST, g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT), uiIDA,1,ProfileManager.GetPrimaryPad(),UIScene_DLCMainMenu::ExitDLCMainMenu,this, app.GetStringTable());
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);
}
#endif
break;
@@ -167,10 +168,8 @@ int UIScene_DLCMainMenu::ExitDLCMainMenu(void *pParam,int iPad,C4JStorage::EMess
{
UIScene_DLCMainMenu* pClass = (UIScene_DLCMainMenu*)pParam;
#ifdef __ORBIS__
sceNpCommerceHidePsStoreIcon();
#elif defined __PSVITA__
sceNpCommerce2HidePsStoreIcon();
#if defined __ORBIS__ || defined __PSVITA__
app.GetCommerce()->HidePsStoreIcon();
#endif
pClass->navigateBack();

View File

@@ -10,7 +10,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)

View File

@@ -34,8 +34,8 @@ UIScene_DLCOffersMenu::UIScene_DLCOffersMenu(int iPad, void *initData, UILayer *
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;
@@ -93,7 +93,7 @@ void UIScene_DLCOffersMenu::handleTimerComplete(int id)
// If they have, bring up the PSN warning and exit from the DLC menu
unsigned int uiIDA[1];
uiIDA[0]=IDS_OK;
C4JStorage::EMessageResult result = ui.RequestMessageBox( IDS_CONNECTION_LOST, g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_LIVE_NO_EXIT), uiIDA,1,ProfileManager.GetPrimaryPad(),UIScene_DLCOffersMenu::ExitDLCOffersMenu,this, app.GetStringTable());
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);
}
#endif
break;
@@ -105,10 +105,8 @@ int UIScene_DLCOffersMenu::ExitDLCOffersMenu(void *pParam,int iPad,C4JStorage::E
{
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);
@@ -446,7 +444,7 @@ void UIScene_DLCOffersMenu::tick()
SONYDLC *pSONYDLCInfo=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;
@@ -645,6 +643,16 @@ void UIScene_DLCOffersMenu::tick()
int iIndex = getControlChildFocus();
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

View File

@@ -117,13 +117,13 @@ void UIScene_DeathMenu::handlePress(F64 controlId, F64 childId)
uiIDA[1]=IDS_EXIT_GAME_SAVE;
uiIDA[2]=IDS_EXIT_GAME_NO_SAVE;
ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3, m_iPad,&IUIScene_PauseMenu::ExitGameSaveDialogReturned,this, app.GetStringTable(), 0, 0, false);
ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3, m_iPad,&IUIScene_PauseMenu::ExitGameSaveDialogReturned,(LPVOID)GetCallbackUniqueId());
}
else
{
uiIDA[0]=IDS_CONFIRM_CANCEL;
uiIDA[1]=IDS_CONFIRM_OK;
ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned,this, app.GetStringTable(), 0, 0, false);
ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned,(LPVOID)GetCallbackUniqueId());
}
#else
@@ -131,7 +131,7 @@ void UIScene_DeathMenu::handlePress(F64 controlId, F64 childId)
{
uiIDA[0]=IDS_CONFIRM_CANCEL;
uiIDA[1]=IDS_CONFIRM_OK;
ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_PROGRESS_LOST, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned,this, app.GetStringTable(), 0, 0, false);
ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_PROGRESS_LOST, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned,(LPVOID)GetCallbackUniqueId());
}
else
{
@@ -141,14 +141,14 @@ void UIScene_DeathMenu::handlePress(F64 controlId, F64 childId)
uiIDA[1]=IDS_EXIT_GAME_SAVE;
uiIDA[2]=IDS_EXIT_GAME_NO_SAVE;
ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3, m_iPad,&IUIScene_PauseMenu::ExitGameSaveDialogReturned,this, app.GetStringTable(), 0, 0, false);
ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3, m_iPad,&IUIScene_PauseMenu::ExitGameSaveDialogReturned,(LPVOID)GetCallbackUniqueId());
}
else
{
uiIDA[0]=IDS_CONFIRM_CANCEL;
uiIDA[1]=IDS_CONFIRM_OK;
ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned,this, app.GetStringTable(), 0, 0, false);
ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned,(LPVOID)GetCallbackUniqueId());
}
}
#endif
@@ -175,7 +175,7 @@ void UIScene_DeathMenu::handlePress(F64 controlId, F64 childId)
UINT uiIDA[2];
uiIDA[0]=IDS_CONFIRM_CANCEL;
uiIDA[1]=IDS_CONFIRM_OK;
ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_PROGRESS_LOST, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned,this, app.GetStringTable(), 0, 0, false);
ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_PROGRESS_LOST, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned,(LPVOID)GetCallbackUniqueId());
}
else
{

View File

@@ -14,15 +14,15 @@ LPCWSTR UIScene_DebugOptionsMenu::m_DebugCheckboxTextA[eDebugSetting_Max+1]=
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",

View File

@@ -26,7 +26,7 @@ UIScene_DebugOverlay::UIScene_DebugOverlay(int iPad, void *initData, UILayer *pa
swprintf( (WCHAR *)TempString, 256, L"Set fov (%d)", (int)pMinecraft->gameRenderer->GetFovVal());
m_sliderFov.init(TempString,eControl_FOV,0,100,(int)pMinecraft->gameRenderer->GetFovVal());
float currentTime = pMinecraft->level->getLevelData()->getTime() % 24000;
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);
@@ -242,7 +242,7 @@ void UIScene_DebugOverlay::handleSliderMove(F64 sliderId, F64 currentValue)
// 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 TempString[256];
float currentTime = currentValue * 100;

View File

@@ -10,10 +10,10 @@ UIScene_DispenserMenu::UIScene_DispenserMenu(int iPad, void *_initData, UILayer
// 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 )
{

View File

@@ -10,13 +10,13 @@ UIScene_EnchantingMenu::UIScene_EnchantingMenu(int iPad, void *_initData, UILaye
// 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 )

View File

@@ -219,7 +219,16 @@ 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 wstring acceptableLetters = L"!\"#$%&'()*+,-./0123456789:;<=>?@[\\]^_'|}~";
randomChar = acceptableLetters[ random->nextInt((int)acceptableLetters.length()) ];
}
wstring randomCharStr = L"";
randomCharStr.push_back(randomChar);

View File

@@ -0,0 +1,233 @@
#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_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;
}
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 );
}

View File

@@ -0,0 +1,44 @@
#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 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);
};

Some files were not shown because too many files have changed in this diff Show More