diff options
Diffstat (limited to 'Minecraft.Client/Common/UI')
156 files changed, 7959 insertions, 2300 deletions
diff --git a/Minecraft.Client/Common/UI/IUIController.h b/Minecraft.Client/Common/UI/IUIController.h index 319185d8..3040c2cc 100644 --- a/Minecraft.Client/Common/UI/IUIController.h +++ b/Minecraft.Client/Common/UI/IUIController.h @@ -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; diff --git a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp index cc1c1b82..ffe83081 100644 --- a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.cpp @@ -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 ) ) - { - 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; + // 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 ); + // Check for potential tap input to jump slot. + ETapState eNewTapInput = GetTapInputType( fInputX, fInputY ); - switch( m_eCurrTapState ) + switch( m_eCurrTapState ) + { + case eTapStateNoInput: + m_eCurrTapState = eNewTapInput; + break; + + case eTapStateUp: + case eTapStateDown: + case eTapStateLeft: + case eTapStateRight: + if ( ( eNewTapInput != m_eCurrTapState ) && ( eNewTapInput != eTapStateNoInput ) ) { - 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; + // 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; + // 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) ); - } + // 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_eCurrTapState = eTapNone; - } + else if ( m_iConsectiveInputTicks < MAX_INPUT_TICKS_FOR_TAPPING ) + { + ++m_iConsectiveInputTicks; + } + else + { + 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; + // 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; - } + fInputX *= fInputScale; + fInputY *= fInputScale; - 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 ); +#ifdef USE_POINTER_ACCEL + m_fPointerAccelX += fInputX / 50.0f; + m_fPointerAccelY += fInputY / 50.0f; - 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; + if ( fabsf( fInputX ) > fabsf( m_fPointerVelX + m_fPointerAccelX ) ) + { + m_fPointerVelX += m_fPointerAccelX; + } + else + { + m_fPointerAccelX = fInputX - m_fPointerVelX; + m_fPointerVelX = fInputX; + } - bStickInput = true; + if ( fabsf( fInputY ) > fabsf( m_fPointerVelY + m_fPointerAccelY ) ) + { + m_fPointerVelY += m_fPointerAccelY; } 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_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,12 +1313,10 @@ 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__ case ACTION_MENU_TOUCHPAD_PRESS: @@ -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,47 +1510,19 @@ 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 { handleAdditionalKeyPress(iAction); @@ -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; + + vector<HtmlString> *lines = slot->getItem()->getHoverText(nullptr, false); - 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) + // Add rarity to first line + if (lines->size() > 0) { - wstring thisString = *it; - if(!firstLine) + lines->at(0).color = slot->getItem()->getRarity()->color; + + if(slot->getItem()->hasCustomHoverName()) { - desc.append( L"<br />" ); + lines->at(0).color = eTextColor_RenamedItemTitle; } - else - { - firstLine = false; - wchar_t formatted[256]; - eMinecraftColour rarityColour = slot->getItem()->getRarity()->color; - int colour = app.GetHTMLColour(rarityColour); + } - if(slot->getItem()->hasCustomHoverName()) - { - colour = app.GetHTMLColour(eTextColor_RenamedItemTitle); - } + return lines; +} - swprintf(formatted, 256, L"<font color=\"#%08x\">%ls</font>",colour,thisString.c_str()); - thisString = formatted; - } - desc.append( thisString ); - } - strings->clear(); - delete strings; - return desc; +vector<HtmlString> *IUIScene_AbstractContainerMenu::GetSectionHoverText(ESceneSection eSection) +{ + return NULL; } diff --git a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h index bdb8bb4c..7d16f522 100644 --- a/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h +++ b/Minecraft.Client/Common/UI/IUIScene_AbstractContainerMenu.h @@ -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: diff --git a/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.cpp index 81451c7a..10d1bcc4 100644 --- a/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.cpp @@ -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); diff --git a/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.h b/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.h index 6c4348f2..4e9e3aa7 100644 --- a/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.h +++ b/Minecraft.Client/Common/UI/IUIScene_AnvilMenu.h @@ -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: diff --git a/Minecraft.Client/Common/UI/IUIScene_BeaconMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_BeaconMenu.cpp new file mode 100644 index 00000000..76d21406 --- /dev/null +++ b/Minecraft.Client/Common/UI/IUIScene_BeaconMenu.cpp @@ -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; +}
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/IUIScene_BeaconMenu.h b/Minecraft.Client/Common/UI/IUIScene_BeaconMenu.h new file mode 100644 index 00000000..1f5f7340 --- /dev/null +++ b/Minecraft.Client/Common/UI/IUIScene_BeaconMenu.h @@ -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; +}; + diff --git a/Minecraft.Client/Common/UI/IUIScene_CommandBlockMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CommandBlockMenu.cpp new file mode 100644 index 00000000..4371b4e5 --- /dev/null +++ b/Minecraft.Client/Common/UI/IUIScene_CommandBlockMenu.cpp @@ -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()))); +} + diff --git a/Minecraft.Client/Common/UI/IUIScene_CommandBlockMenu.h b/Minecraft.Client/Common/UI/IUIScene_CommandBlockMenu.h new file mode 100644 index 00000000..db0aff82 --- /dev/null +++ b/Minecraft.Client/Common/UI/IUIScene_CommandBlockMenu.h @@ -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; +};
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp index f158b174..05a44202 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.cpp @@ -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) + { + 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 { - // 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] ); + 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,35 +1070,43 @@ void IUIScene_CraftingMenu::DisplayIngredients() int id=pRecipeIngredientsRequired[iRecipe].iIngIDA[i]; int iAuxVal=pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i]; Item *item = Item::items[id]; - if( (iAuxVal & 0xFF) == 0xFF) // 4J Stu - If the aux value is set to match any - iAuxVal = 0; - - // 4J Stu - For clocks and compasses we set the aux value to a special one that signals we should use a default texture - // rather than the dynamic one for the player - if( id == Item::clock_Id || id == Item::compass_Id ) - { - iAuxVal = 0xFF; - } shared_ptr<ItemInstance> itemInst= shared_ptr<ItemInstance>(new ItemInstance(item,pRecipeIngredientsRequired[iRecipe].iIngValA[i],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)) ) + 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; + + // 4J Stu - For clocks and compasses we set the aux value to a special one that signals we should use a default texture + // rather than the dynamic one for the player + if( id == Item::clock_Id || id == Item::compass_Id ) + { + iAuxVal = 0xFF; + } + itemInst->setAuxValue(iAuxVal); + + setIngredientDescriptionItem(getPad(),i,itemInst); + setIngredientDescriptionRedBox(i,false); } // 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; diff --git a/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.h b/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.h index 05227fff..03a58378 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.h +++ b/Minecraft.Client/Common/UI/IUIScene_CraftingMenu.h @@ -86,6 +86,7 @@ protected: void DisplayIngredients(); void UpdateTooltips(); void UpdateDescriptionText(bool); + void HandleInventoryUpdated(); public: Recipy::_eGroupType getCurrentGroup() { return m_pGroupA[m_iGroupIndex]; } diff --git a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp index 7ce33234..c3348e58 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.cpp @@ -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}; + ECreative_Inventory_Groups debugDecorationsGroup[] = {eCreativeInventory_ArtToolsDecorations}; + specs[eCreativeInventoryTab_Decorations] = new TabSpec(L"Decoration", IDS_GROUPNAME_DECORATIONS, 1, decorationsGroup, 0, NULL, 1, debugDecorationsGroup); +#else ECreative_Inventory_Groups decorationsGroup[] = {eCreativeInventory_Decoration}; - specs[eCreativeInventoryTab_Decorations] = new TabSpec(L"Decoration", IDS_GROUPNAME_DECORATIONS, 1, decorationsGroup, 0, NULL); + 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,26 +886,79 @@ void IUIScene_CreativeMenu::TabSpec::populateMenu(AbstractContainerMenu *menu, i currentIndex += size; continue; } + displayStatic = true; currentItem = size - ((currentIndex + size) - startIndex); break; } - for(; lastSlotIndex < MAX_SIZE;) + int lastStaticPageCount = currentIndex; + while(lastStaticPageCount > m_staticPerPage) lastStaticPageCount -= m_staticPerPage; + + if(displayStatic) { - Slot *slot = menu->getSlot(lastSlotIndex++); - slot->set(categoryGroups[m_staticGroupsA[currentGroup]][currentItem]); + for(; lastSlotIndex < MAX_SIZE;) + { + Slot *slot = menu->getSlot(lastSlotIndex++); + slot->set(categoryGroups[m_staticGroupsA[currentGroup]][currentItem]); + + ++currentItem; + if(currentItem >= categoryGroups[m_staticGroupsA[currentGroup]].size()) + { + currentItem = 0; + ++currentGroup; + if(currentGroup >= m_staticGroupsCount) + { + break; + } + } + } + } - ++currentItem; - if(currentItem >= categoryGroups[m_staticGroupsA[currentGroup]].size()) +#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; - ++currentGroup; - if(currentGroup >= m_staticGroupsCount) + 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) { @@ -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); +} diff --git a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.h b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.h index 7ab3ff7e..64b78029 100644 --- a/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.h +++ b/Minecraft.Client/Common/UI/IUIScene_CreativeMenu.h @@ -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); };
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/IUIScene_FireworksMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_FireworksMenu.cpp new file mode 100644 index 00000000..7f90fe8f --- /dev/null +++ b/Minecraft.Client/Common/UI/IUIScene_FireworksMenu.cpp @@ -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; +}
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/IUIScene_FireworksMenu.h b/Minecraft.Client/Common/UI/IUIScene_FireworksMenu.h new file mode 100644 index 00000000..4764d72c --- /dev/null +++ b/Minecraft.Client/Common/UI/IUIScene_FireworksMenu.h @@ -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); +};
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/IUIScene_HUD.cpp b/Minecraft.Client/Common/UI/IUIScene_HUD.cpp new file mode 100644 index 00000000..03adbd2c --- /dev/null +++ b/Minecraft.Client/Common/UI/IUIScene_HUD.cpp @@ -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); + } +}
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/IUIScene_HUD.h b/Minecraft.Client/Common/UI/IUIScene_HUD.h new file mode 100644 index 00000000..0f643dd3 --- /dev/null +++ b/Minecraft.Client/Common/UI/IUIScene_HUD.h @@ -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(); +};
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/IUIScene_HopperMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_HopperMenu.cpp new file mode 100644 index 00000000..392c12d4 --- /dev/null +++ b/Minecraft.Client/Common/UI/IUIScene_HopperMenu.cpp @@ -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; +}
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/IUIScene_HopperMenu.h b/Minecraft.Client/Common/UI/IUIScene_HopperMenu.h new file mode 100644 index 00000000..ef6d8d25 --- /dev/null +++ b/Minecraft.Client/Common/UI/IUIScene_HopperMenu.h @@ -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); +}; diff --git a/Minecraft.Client/Common/UI/IUIScene_HorseInventoryMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_HorseInventoryMenu.cpp new file mode 100644 index 00000000..8f1caab8 --- /dev/null +++ b/Minecraft.Client/Common/UI/IUIScene_HorseInventoryMenu.cpp @@ -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; +}
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/IUIScene_HorseInventoryMenu.h b/Minecraft.Client/Common/UI/IUIScene_HorseInventoryMenu.h new file mode 100644 index 00000000..6df2001e --- /dev/null +++ b/Minecraft.Client/Common/UI/IUIScene_HorseInventoryMenu.h @@ -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 ); +}; diff --git a/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp index 79203e7c..ab1767d4 100644 --- a/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_PauseMenu.cpp @@ -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); diff --git a/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp b/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp index be611778..d3a9e8f0 100644 --- a/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_StartGame.cpp @@ -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); } } } diff --git a/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp b/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp index 658bcdfb..8cc04940 100644 --- a/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp +++ b/Minecraft.Client/Common/UI/IUIScene_TradingMenu.cpp @@ -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 ‘Enchanted Books’ 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(); +}
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/IUIScene_TradingMenu.h b/Minecraft.Client/Common/UI/IUIScene_TradingMenu.h index c8edda67..726f13c7 100644 --- a/Minecraft.Client/Common/UI/IUIScene_TradingMenu.h +++ b/Minecraft.Client/Common/UI/IUIScene_TradingMenu.h @@ -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(); diff --git a/Minecraft.Client/Common/UI/UI.h b/Minecraft.Client/Common/UI/UI.h index 622ccf84..428b3b90 100644 --- a/Minecraft.Client/Common/UI/UI.h +++ b/Minecraft.Client/Common/UI/UI.h @@ -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"
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIBitmapFont.cpp b/Minecraft.Client/Common/UI/UIBitmapFont.cpp index ec49eea3..afc2b139 100644 --- a/Minecraft.Client/Common/UI/UIBitmapFont.cpp +++ b/Minecraft.Client/Common/UI/UIBitmapFont.cpp @@ -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); diff --git a/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp b/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp index a418fcda..cb6443a1 100644 --- a/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_Panorama.cpp @@ -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) diff --git a/Minecraft.Client/Common/UI/UIComponent_PressStartToPlay.cpp b/Minecraft.Client/Common/UI/UIComponent_PressStartToPlay.cpp index 2feb94c1..9af43df4 100644 --- a/Minecraft.Client/Common/UI/UIComponent_PressStartToPlay.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_PressStartToPlay.cpp @@ -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); diff --git a/Minecraft.Client/Common/UI/UIComponent_Tooltips.cpp b/Minecraft.Client/Common/UI/UIComponent_Tooltips.cpp index 63eba1a5..255740c9 100644 --- a/Minecraft.Client/Common/UI/UIComponent_Tooltips.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_Tooltips.cpp @@ -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) diff --git a/Minecraft.Client/Common/UI/UIComponent_Tooltips.h b/Minecraft.Client/Common/UI/UIComponent_Tooltips.h index 4b4c8268..f8db9439 100644 --- a/Minecraft.Client/Common/UI/UIComponent_Tooltips.h +++ b/Minecraft.Client/Common/UI/UIComponent_Tooltips.h @@ -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]; diff --git a/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp b/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp index 858a8b43..3b4eb097 100644 --- a/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp +++ b/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.cpp @@ -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; } diff --git a/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.h b/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.h index 36f78300..4e5f4285 100644 --- a/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.h +++ b/Minecraft.Client/Common/UI/UIComponent_TutorialPopup.h @@ -39,6 +39,8 @@ private: e_ICON_TYPE_TRANSPORT = 11, }; + EIcons m_iconType; + public: UIComponent_TutorialPopup(int iPad, void *initData, UILayer *parentLayer); diff --git a/Minecraft.Client/Common/UI/UIControl.h b/Minecraft.Client/Common/UI/UIControl.h index 3b4ef050..e37f04de 100644 --- a/Minecraft.Client/Common/UI/UIControl.h +++ b/Minecraft.Client/Common/UI/UIControl.h @@ -20,6 +20,7 @@ public: eLabel, eLeaderboardList, eMinecraftPlayer, + eMinecraftHorse, ePlayerList, ePlayerSkinPreview, eProgress, diff --git a/Minecraft.Client/Common/UI/UIControl_Base.cpp b/Minecraft.Client/Common/UI/UIControl_Base.cpp index 18af2f63..7a4a24e5 100644 --- a/Minecraft.Client/Common/UI/UIControl_Base.cpp +++ b/Minecraft.Client/Common/UI/UIControl_Base.cpp @@ -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(); diff --git a/Minecraft.Client/Common/UI/UIControl_Base.h b/Minecraft.Client/Common/UI/UIControl_Base.h index e70997c3..73ecac5a 100644 --- a/Minecraft.Client/Common/UI/UIControl_Base.h +++ b/Minecraft.Client/Common/UI/UIControl_Base.h @@ -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; } diff --git a/Minecraft.Client/Common/UI/UIControl_BeaconEffectButton.cpp b/Minecraft.Client/Common/UI/UIControl_BeaconEffectButton.cpp new file mode 100644 index 00000000..7ee79307 --- /dev/null +++ b/Minecraft.Client/Common/UI/UIControl_BeaconEffectButton.cpp @@ -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; + } +}
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIControl_BeaconEffectButton.h b/Minecraft.Client/Common/UI/UIControl_BeaconEffectButton.h new file mode 100644 index 00000000..788213da --- /dev/null +++ b/Minecraft.Client/Common/UI/UIControl_BeaconEffectButton.h @@ -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(); +};
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIControl_Button.cpp b/Minecraft.Client/Common/UI/UIControl_Button.cpp index 96ddb8eb..70adb6b1 100644 --- a/Minecraft.Client/Common/UI/UIControl_Button.cpp +++ b/Minecraft.Client/Common/UI/UIControl_Button.cpp @@ -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; diff --git a/Minecraft.Client/Common/UI/UIControl_Button.h b/Minecraft.Client/Common/UI/UIControl_Button.h index 367a48d7..7369e8a0 100644 --- a/Minecraft.Client/Common/UI/UIControl_Button.h +++ b/Minecraft.Client/Common/UI/UIControl_Button.h @@ -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); diff --git a/Minecraft.Client/Common/UI/UIControl_ButtonList.cpp b/Minecraft.Client/Common/UI/UIControl_ButtonList.cpp index 32db4843..68a3d655 100644 --- a/Minecraft.Client/Common/UI/UIControl_ButtonList.cpp +++ b/Minecraft.Client/Common/UI/UIControl_ButtonList.cpp @@ -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); +}
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIControl_ButtonList.h b/Minecraft.Client/Common/UI/UIControl_ButtonList.h index a3c5da3a..44484ac3 100644 --- a/Minecraft.Client/Common/UI/UIControl_ButtonList.h +++ b/Minecraft.Client/Common/UI/UIControl_ButtonList.h @@ -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); +};
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIControl_CheckBox.cpp b/Minecraft.Client/Common/UI/UIControl_CheckBox.cpp index d3bdf758..1c3e8afe 100644 --- a/Minecraft.Client/Common/UI/UIControl_CheckBox.cpp +++ b/Minecraft.Client/Common/UI/UIControl_CheckBox.cpp @@ -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; diff --git a/Minecraft.Client/Common/UI/UIControl_CheckBox.h b/Minecraft.Client/Common/UI/UIControl_CheckBox.h index 924e9c68..f8c0284b 100644 --- a/Minecraft.Client/Common/UI/UIControl_CheckBox.h +++ b/Minecraft.Client/Common/UI/UIControl_CheckBox.h @@ -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(); diff --git a/Minecraft.Client/Common/UI/UIControl_EnchantmentBook.cpp b/Minecraft.Client/Common/UI/UIControl_EnchantmentBook.cpp index ef7c0e94..9664dbf4 100644 --- a/Minecraft.Client/Common/UI/UIControl_EnchantmentBook.cpp +++ b/Minecraft.Client/Common/UI/UIControl_EnchantmentBook.cpp @@ -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(); diff --git a/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.cpp b/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.cpp index e1490e0b..37f8fcf6 100644 --- a/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.cpp +++ b/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.cpp @@ -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(); diff --git a/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.h b/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.h index 9b8a3c8f..f7a703b3 100644 --- a/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.h +++ b/Minecraft.Client/Common/UI/UIControl_EnchantmentButton.h @@ -46,7 +46,7 @@ public: virtual void tick(); void init(int index); - + virtual void ReInit(); void render(IggyCustomDrawCallbackRegion *region); void updateState(); diff --git a/Minecraft.Client/Common/UI/UIControl_Label.cpp b/Minecraft.Client/Common/UI/UIControl_Label.cpp index 1481fea1..47374d21 100644 --- a/Minecraft.Client/Common/UI/UIControl_Label.cpp +++ b/Minecraft.Client/Common/UI/UIControl_Label.cpp @@ -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); + } } diff --git a/Minecraft.Client/Common/UI/UIControl_Label.h b/Minecraft.Client/Common/UI/UIControl_Label.h index aa0f3f14..21eb35a6 100644 --- a/Minecraft.Client/Common/UI/UIControl_Label.h +++ b/Minecraft.Client/Common/UI/UIControl_Label.h @@ -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; } };
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIControl_MinecraftHorse.cpp b/Minecraft.Client/Common/UI/UIControl_MinecraftHorse.cpp new file mode 100644 index 00000000..457e2028 --- /dev/null +++ b/Minecraft.Client/Common/UI/UIControl_MinecraftHorse.cpp @@ -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); +} diff --git a/Minecraft.Client/Common/UI/UIControl_MinecraftHorse.h b/Minecraft.Client/Common/UI/UIControl_MinecraftHorse.h new file mode 100644 index 00000000..ec355527 --- /dev/null +++ b/Minecraft.Client/Common/UI/UIControl_MinecraftHorse.h @@ -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); +};
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIControl_MinecraftPlayer.cpp b/Minecraft.Client/Common/UI/UIControl_MinecraftPlayer.cpp index 3a18ed53..d0625bce 100644 --- a/Minecraft.Client/Common/UI/UIControl_MinecraftPlayer.cpp +++ b/Minecraft.Client/Common/UI/UIControl_MinecraftPlayer.cpp @@ -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; diff --git a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp index 544b4da1..2d7c0224 100644 --- a/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp +++ b/Minecraft.Client/Common/UI/UIControl_PlayerSkinPreview.cpp @@ -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; diff --git a/Minecraft.Client/Common/UI/UIControl_Progress.cpp b/Minecraft.Client/Common/UI/UIControl_Progress.cpp index e2ab817d..78e7c1d0 100644 --- a/Minecraft.Client/Common/UI/UIControl_Progress.cpp +++ b/Minecraft.Client/Common/UI/UIControl_Progress.cpp @@ -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; diff --git a/Minecraft.Client/Common/UI/UIControl_Progress.h b/Minecraft.Client/Common/UI/UIControl_Progress.h index 8398a188..10601237 100644 --- a/Minecraft.Client/Common/UI/UIControl_Progress.h +++ b/Minecraft.Client/Common/UI/UIControl_Progress.h @@ -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); diff --git a/Minecraft.Client/Common/UI/UIControl_Slider.cpp b/Minecraft.Client/Common/UI/UIControl_Slider.cpp index bd3b1ada..c2168002 100644 --- a/Minecraft.Client/Common/UI/UIControl_Slider.cpp +++ b/Minecraft.Client/Common/UI/UIControl_Slider.cpp @@ -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]); diff --git a/Minecraft.Client/Common/UI/UIControl_Slider.h b/Minecraft.Client/Common/UI/UIControl_Slider.h index 0b57c2f1..505f6dd2 100644 --- a/Minecraft.Client/Common/UI/UIControl_Slider.h +++ b/Minecraft.Client/Common/UI/UIControl_Slider.h @@ -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); diff --git a/Minecraft.Client/Common/UI/UIControl_SlotList.cpp b/Minecraft.Client/Common/UI/UIControl_SlotList.cpp index e2130431..01d7b9e5 100644 --- a/Minecraft.Client/Common/UI/UIControl_SlotList.cpp +++ b/Minecraft.Client/Common/UI/UIControl_SlotList.cpp @@ -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; diff --git a/Minecraft.Client/Common/UI/UIControl_SlotList.h b/Minecraft.Client/Common/UI/UIControl_SlotList.h index ee741c4d..5bc1dc9a 100644 --- a/Minecraft.Client/Common/UI/UIControl_SlotList.h +++ b/Minecraft.Client/Common/UI/UIControl_SlotList.h @@ -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); diff --git a/Minecraft.Client/Common/UI/UIControl_SpaceIndicatorBar.cpp b/Minecraft.Client/Common/UI/UIControl_SpaceIndicatorBar.cpp index dfdea93e..74683a62 100644 --- a/Minecraft.Client/Common/UI/UIControl_SpaceIndicatorBar.cpp +++ b/Minecraft.Client/Common/UI/UIControl_SpaceIndicatorBar.cpp @@ -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; diff --git a/Minecraft.Client/Common/UI/UIControl_SpaceIndicatorBar.h b/Minecraft.Client/Common/UI/UIControl_SpaceIndicatorBar.h index 39f9a746..8eed3944 100644 --- a/Minecraft.Client/Common/UI/UIControl_SpaceIndicatorBar.h +++ b/Minecraft.Client/Common/UI/UIControl_SpaceIndicatorBar.h @@ -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(); diff --git a/Minecraft.Client/Common/UI/UIControl_TextInput.cpp b/Minecraft.Client/Common/UI/UIControl_TextInput.cpp index 4cb78d50..dc7bc532 100644 --- a/Minecraft.Client/Common/UI/UIControl_TextInput.cpp +++ b/Minecraft.Client/Common/UI/UIControl_TextInput.cpp @@ -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; diff --git a/Minecraft.Client/Common/UI/UIControl_TextInput.h b/Minecraft.Client/Common/UI/UIControl_TextInput.h index d4023884..98032d85 100644 --- a/Minecraft.Client/Common/UI/UIControl_TextInput.h +++ b/Minecraft.Client/Common/UI/UIControl_TextInput.h @@ -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); diff --git a/Minecraft.Client/Common/UI/UIController.cpp b/Minecraft.Client/Common/UI/UIController.cpp index 87c495d2..8b38bbb3 100644 --- a/Minecraft.Client/Common/UI/UIController.cpp +++ b/Minecraft.Client/Common/UI/UIController.cpp @@ -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 (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(bBitmapFont) + 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::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::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, 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; diff --git a/Minecraft.Client/Common/UI/UIController.h b/Minecraft.Client/Common/UI/UIController.h index ef064f80..49c78032 100644 --- a/Minecraft.Client/Common/UI/UIController.h +++ b/Minecraft.Client/Common/UI/UIController.h @@ -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); diff --git a/Minecraft.Client/Common/UI/UIEnums.h b/Minecraft.Client/Common/UI/UIEnums.h index c68b6740..45aff87d 100644 --- a/Minecraft.Client/Common/UI/UIEnums.h +++ b/Minecraft.Client/Common/UI/UIEnums.h @@ -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 diff --git a/Minecraft.Client/Common/UI/UIGroup.cpp b/Minecraft.Client/Common/UI/UIGroup.cpp index 1899d05b..e8bb9fe6 100644 --- a/Minecraft.Client/Common/UI/UIGroup.cpp +++ b/Minecraft.Client/Common/UI/UIGroup.cpp @@ -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; diff --git a/Minecraft.Client/Common/UI/UIGroup.h b/Minecraft.Client/Common/UI/UIGroup.h index e20fbb02..0ffee0ca 100644 --- a/Minecraft.Client/Common/UI/UIGroup.h +++ b/Minecraft.Client/Common/UI/UIGroup.h @@ -96,6 +96,8 @@ public: #ifdef _XBOX_ONE virtual void HandleDLCLicenseChange(); #endif + virtual void HandleMessage(EUIMessage message, void *data); + bool IsFullscreenGroup(); void handleUnlockFullVersion(); diff --git a/Minecraft.Client/Common/UI/UILayer.cpp b/Minecraft.Client/Common/UI/UILayer.cpp index 15bde2fa..13b26c84 100644 --- a/Minecraft.Client/Common/UI/UILayer.cpp +++ b/Minecraft.Client/Common/UI/UILayer.cpp @@ -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(); diff --git a/Minecraft.Client/Common/UI/UILayer.h b/Minecraft.Client/Common/UI/UILayer.h index 2840f23f..47c776ab 100644 --- a/Minecraft.Client/Common/UI/UILayer.h +++ b/Minecraft.Client/Common/UI/UILayer.h @@ -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); diff --git a/Minecraft.Client/Common/UI/UIScene.cpp b/Minecraft.Client/Common/UI/UIScene.cpp index e7d907ec..ba253643 100644 --- a/Minecraft.Client/Common/UI/UIScene.cpp +++ b/Minecraft.Client/Common/UI/UIScene.cpp @@ -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) diff --git a/Minecraft.Client/Common/UI/UIScene.h b/Minecraft.Client/Common/UI/UIScene.h index 823c510c..8c20aaae 100644 --- a/Minecraft.Client/Common/UI/UIScene.h +++ b/Minecraft.Client/Common/UI/UIScene.h @@ -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 diff --git a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp index 7823fb4e..0ee92eef 100644 --- a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.cpp @@ -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 ); diff --git a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.h b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.h index 26688dc5..8afa44f7 100644 --- a/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_AbstractContainerMenu.h @@ -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); diff --git a/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp b/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp index 7b9886bc..c810ad45 100644 --- a/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_AnvilMenu.cpp @@ -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() diff --git a/Minecraft.Client/Common/UI/UIScene_BeaconMenu.cpp b/Minecraft.Client/Common/UI/UIScene_BeaconMenu.cpp new file mode 100644 index 00000000..e70397d6 --- /dev/null +++ b/Minecraft.Client/Common/UI/UIScene_BeaconMenu.cpp @@ -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; + }; +}
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_BeaconMenu.h b/Minecraft.Client/Common/UI/UIScene_BeaconMenu.h new file mode 100644 index 00000000..ccd9366f --- /dev/null +++ b/Minecraft.Client/Common/UI/UIScene_BeaconMenu.h @@ -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); +};
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp b/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp index cd56bd84..8563054c 100644 --- a/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_BrewingStandMenu.cpp @@ -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 ) { diff --git a/Minecraft.Client/Common/UI/UIScene_ConnectingProgress.cpp b/Minecraft.Client/Common/UI/UIScene_ConnectingProgress.cpp index 0ea99a36..968072a8 100644 --- a/Minecraft.Client/Common/UI/UIScene_ConnectingProgress.cpp +++ b/Minecraft.Client/Common/UI/UIScene_ConnectingProgress.cpp @@ -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(); diff --git a/Minecraft.Client/Common/UI/UIScene_ContainerMenu.cpp b/Minecraft.Client/Common/UI/UIScene_ContainerMenu.cpp index a0b25d18..9e48a57b 100644 --- a/Minecraft.Client/Common/UI/UIScene_ContainerMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_ContainerMenu.cpp @@ -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 ); diff --git a/Minecraft.Client/Common/UI/UIScene_ControlsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_ControlsMenu.cpp index c05b502e..57567248 100644 --- a/Minecraft.Client/Common/UI/UIScene_ControlsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_ControlsMenu.cpp @@ -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; diff --git a/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp index 5b729069..66d8c41e 100644 --- a/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CraftingMenu.cpp @@ -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 diff --git a/Minecraft.Client/Common/UI/UIScene_CraftingMenu.h b/Minecraft.Client/Common/UI/UIScene_CraftingMenu.h index 44a39d61..84c9ba65 100644 --- a/Minecraft.Client/Common/UI/UIScene_CraftingMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_CraftingMenu.h @@ -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(); } }; diff --git a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp index 6be67bed..f7cca84b 100644 --- a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.cpp @@ -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) - { - m_checkboxOnline.SetEnable(false); - } + // Set up online game checkbox + bool bOnlineGame = m_MoreOptionsParams.bOnlineGame; + m_checkboxOnline.SetEnable(true); - if(m_MoreOptionsParams.bOnlineSettingChangedBySystem) - { - m_checkboxOnline.SetEnable(false); - bOnlineGame = false; - } + // 4J-PB - to stop an offline game being able to select the online flag + if(ProfileManager.IsSignedInLive(m_iPad) == false) + { + m_checkboxOnline.SetEnable(false); + } - m_checkboxOnline.init(app.GetString(IDS_ONLINE_GAME), eControl_OnlineGame, bOnlineGame); + if(m_MoreOptionsParams.bOnlineSettingChangedBySystem) + { + m_checkboxOnline.SetEnable(false); + bOnlineGame = false; } -#endif + + 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 { diff --git a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.h b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.h index ebb383e8..d6ae1c04 100644 --- a/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_CreateWorldMenu.h @@ -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); diff --git a/Minecraft.Client/Common/UI/UIScene_CreativeMenu.cpp b/Minecraft.Client/Common/UI/UIScene_CreativeMenu.cpp index 569cc8ba..0895cdff 100644 --- a/Minecraft.Client/Common/UI/UIScene_CreativeMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_CreativeMenu.cpp @@ -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) diff --git a/Minecraft.Client/Common/UI/UIScene_CreativeMenu.h b/Minecraft.Client/Common/UI/UIScene_CreativeMenu.h index 6fbec2ba..530a7512 100644 --- a/Minecraft.Client/Common/UI/UIScene_CreativeMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_CreativeMenu.h @@ -80,7 +80,6 @@ public: virtual void handleTouchBoxRebuild(); virtual void handleTimerComplete(int id); #endif - virtual void ScrollBar(UIVec2D pointerPos); private: // IUIScene_CreativeMenu diff --git a/Minecraft.Client/Common/UI/UIScene_Credits.cpp b/Minecraft.Client/Common/UI/UIScene_Credits.cpp index 11558598..75ddf92f 100644 --- a/Minecraft.Client/Common/UI/UIScene_Credits.cpp +++ b/Minecraft.Client/Common/UI/UIScene_Credits.cpp @@ -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. { + 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() ) + { + sanitisedString = replaceAll(sanitisedString, L"\u00A9", L"(C)"); + sanitisedString = replaceAll(sanitisedString, L"\u00AE", L"(R)"); + sanitisedString = replaceAll(sanitisedString, L"\u2013", L"-"); + } + LPWSTR creditsString = new wchar_t[ 128 ]; - if(pDef->m_iStringID[1]!=NO_TRANSLATED_STRING) + 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, pDef->m_Text, app.GetString( pDef->m_iStringID[0] ), app.GetString( pDef->m_iStringID[1] ) ); + 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; } diff --git a/Minecraft.Client/Common/UI/UIScene_Credits.h b/Minecraft.Client/Common/UI/UIScene_Credits.h index 4116628d..ccb62831 100644 --- a/Minecraft.Client/Common/UI/UIScene_Credits.h +++ b/Minecraft.Client/Common/UI/UIScene_Credits.h @@ -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) diff --git a/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.cpp index 0d36dcdf..77ffdffd 100644 --- a/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.cpp @@ -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(); diff --git a/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.h b/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.h index 15272fe1..f23ee4b0 100644 --- a/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_DLCMainMenu.h @@ -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) diff --git a/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp index 9dbdc3d4..65c1b6fc 100644 --- a/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DLCOffersMenu.cpp @@ -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 diff --git a/Minecraft.Client/Common/UI/UIScene_DeathMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DeathMenu.cpp index 2026bfca..8f0f4c11 100644 --- a/Minecraft.Client/Common/UI/UIScene_DeathMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DeathMenu.cpp @@ -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 { diff --git a/Minecraft.Client/Common/UI/UIScene_DebugOptions.cpp b/Minecraft.Client/Common/UI/UIScene_DebugOptions.cpp index 658a8517..c7db8db9 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugOptions.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DebugOptions.cpp @@ -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", diff --git a/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp b/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp index 44a7e6c5..8e45c324 100644 --- a/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DebugOverlay.cpp @@ -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; diff --git a/Minecraft.Client/Common/UI/UIScene_DispenserMenu.cpp b/Minecraft.Client/Common/UI/UIScene_DispenserMenu.cpp index 1eda1660..97cf842a 100644 --- a/Minecraft.Client/Common/UI/UIScene_DispenserMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_DispenserMenu.cpp @@ -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 ) { diff --git a/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp b/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp index 8a4f1c6d..27459ccc 100644 --- a/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_EnchantingMenu.cpp @@ -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 ) diff --git a/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp b/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp index f825efd0..c5a8e61a 100644 --- a/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp +++ b/Minecraft.Client/Common/UI/UIScene_EndPoem.cpp @@ -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); diff --git a/Minecraft.Client/Common/UI/UIScene_FireworksMenu.cpp b/Minecraft.Client/Common/UI/UIScene_FireworksMenu.cpp new file mode 100644 index 00000000..1d24f989 --- /dev/null +++ b/Minecraft.Client/Common/UI/UIScene_FireworksMenu.cpp @@ -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 ); +}
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_FireworksMenu.h b/Minecraft.Client/Common/UI/UIScene_FireworksMenu.h new file mode 100644 index 00000000..b56443b9 --- /dev/null +++ b/Minecraft.Client/Common/UI/UIScene_FireworksMenu.h @@ -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); +};
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp b/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp index ed31cfaf..fb17bda4 100644 --- a/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp +++ b/Minecraft.Client/Common/UI/UIScene_FullscreenProgress.cpp @@ -187,7 +187,7 @@ void UIScene_FullscreenProgress::tick() UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox( g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_FAILED), g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_SERVER), uiIDA,1, XUSER_INDEX_ANY,NULL,NULL, app.GetStringTable()); + ui.RequestErrorMessage( g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_FAILED), g_NetworkManager.CorrectErrorIDS(IDS_CONNECTION_LOST_SERVER), uiIDA,1, XUSER_INDEX_ANY); ui.NavigateToHomeMenu(); ui.UpdatePlayerBasePositions(); @@ -199,6 +199,10 @@ void UIScene_FullscreenProgress::tick() { m_threadCompleted = true; m_buttonConfirm.setVisible( true ); + // 4J-TomK - rebuild touch after confirm button made visible again +#ifdef __PSVITA__ + ui.TouchBoxRebuild(this); +#endif updateTooltips(); } else diff --git a/Minecraft.Client/Common/UI/UIScene_FurnaceMenu.cpp b/Minecraft.Client/Common/UI/UIScene_FurnaceMenu.cpp index 1ba4053d..392221a6 100644 --- a/Minecraft.Client/Common/UI/UIScene_FurnaceMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_FurnaceMenu.cpp @@ -10,16 +10,16 @@ UIScene_FurnaceMenu::UIScene_FurnaceMenu(int iPad, void *_initData, UILayer *par // Setup all the Iggy references we need for this scene initialiseMovie(); - m_labelFurnace.init(app.GetString(IDS_FURNACE)); + FurnaceScreenInput *initData = (FurnaceScreenInput *)_initData; + m_furnace = initData->furnace; + + m_labelFurnace.init(m_furnace->getName()); m_labelIngredient.init(app.GetString(IDS_INGREDIENT)); m_labelFuel.init(app.GetString(IDS_FUEL)); m_progressFurnaceFire.init(L"",0,0,12,0); m_progressFurnaceArrow.init(L"",0,0,24,0); - FurnaceScreenInput *initData = (FurnaceScreenInput *)_initData; - m_furnace = initData->furnace; - Minecraft *pMinecraft = Minecraft::GetInstance(); if( pMinecraft->localgameModes[initData->iPad] != NULL ) { diff --git a/Minecraft.Client/Common/UI/UIScene_HUD.cpp b/Minecraft.Client/Common/UI/UIScene_HUD.cpp index 27eeb76b..c3d52cf9 100644 --- a/Minecraft.Client/Common/UI/UIScene_HUD.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HUD.cpp @@ -1,13 +1,12 @@ #include "stdafx.h" #include "UI.h" #include "UIScene_HUD.h" +#include "BossMobGuiInfo.h" #include "..\..\Minecraft.h" #include "..\..\MultiplayerLocalPlayer.h" #include "..\..\..\Minecraft.World\net.minecraft.world.entity.boss.enderdragon.h" #include "..\..\EnderDragonRenderer.h" #include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h" -#include "..\..\..\Minecraft.World\net.minecraft.world.item.h" -#include "..\..\..\Minecraft.World\net.minecraft.world.effect.h" #include "..\..\..\Minecraft.World\StringHelpers.h" UIScene_HUD::UIScene_HUD(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) @@ -17,32 +16,6 @@ UIScene_HUD::UIScene_HUD(int iPad, void *initData, UILayer *parentLayer) : UISce // Setup all the Iggy references we need for this scene initialiseMovie(); - m_lastActiveSlot = 0; - m_lastScale = 1; - m_bToolTipsVisible = true; - m_lastExpProgress = 0.0f; - m_lastExpLevel = 0; - m_lastMaxHealth = 20; - m_lastHealthBlink = false; - m_lastHealthPoison = false; - m_lastMaxFood = 20; - m_lastFoodPoison = false; - m_lastAir = 10; - m_lastArmour = 0; - m_showHealth = true; - m_showFood = true; - m_showAir = true; - m_showArmour = true; - m_showExpBar = true; - m_lastRegenEffect = false; - m_lastSaturation = 0; - m_lastDragonHealth = 0.0f; - m_showDragonHealth = false; - m_ticksWithNoBoss = 0; - m_uiSelectedItemOpacityCountDown = 0; - m_displayName = L""; - m_lastShowDisplayName = true; - SetDragonLabel( app.GetString( IDS_BOSS_ENDERDRAGON_HEALTH ) ); SetSelectedLabel(L""); @@ -146,33 +119,35 @@ void UIScene_HUD::tick() return; } - if(pMinecraft->localplayers[m_iPad]->dimension == 1) + // Is boss present? + bool noBoss = BossMobGuiInfo::name.empty() || BossMobGuiInfo::displayTicks <= 0; + if (noBoss) { - if (EnderDragonRenderer::bossInstance == NULL) + if (m_showDragonHealth) { - if(m_ticksWithNoBoss<=20) + // No boss and health is visible + if(m_ticksWithNoBoss <= 20) { ++m_ticksWithNoBoss; } - if( m_ticksWithNoBoss > 20 ) + else { ShowDragonHealth(false); } } - else - { - shared_ptr<EnderDragon> boss = EnderDragonRenderer::bossInstance; - // 4J Stu - Don't clear this here as it's wiped for other players - //EnderDragonRenderer::bossInstance = nullptr; - m_ticksWithNoBoss = 0; - - ShowDragonHealth(true); - SetDragonHealth( (float)boss->getSynchedHealth()/boss->getMaxHealth()); - } } else { - ShowDragonHealth(false); + BossMobGuiInfo::displayTicks--; + + m_ticksWithNoBoss = 0; + SetDragonHealth(BossMobGuiInfo::healthProgress); + + if (!m_showDragonHealth) + { + SetDragonLabel(BossMobGuiInfo::name); + ShowDragonHealth(true); + } } } } @@ -229,34 +204,46 @@ void UIScene_HUD::customDraw(IggyCustomDrawCallbackRegion *region) void UIScene_HUD::handleReload() { - m_lastActiveSlot = 0; - m_lastScale = 1; + m_lastActiveSlot = -1; + m_iGuiScale = -1; m_bToolTipsVisible = true; m_lastExpProgress = 0.0f; m_lastExpLevel = 0; + m_iCurrentHealth = 0; m_lastMaxHealth = 20; m_lastHealthBlink = false; m_lastHealthPoison = false; - m_lastMaxFood = 20; + m_iCurrentFood = -1; m_lastFoodPoison = false; m_lastAir = 10; + m_currentExtraAir = 0; m_lastArmour = 0; m_showHealth = true; + m_showHorseHealth = true; m_showFood = true; - m_showAir = true; + m_showAir = false; // get's initialised invisible anyways, by setting it to false we ensure it will remain visible when switching in and out of split screen! m_showArmour = true; m_showExpBar = true; - m_lastRegenEffect = false; - m_lastSaturation = 0; + m_bRegenEffectEnabled = false; + m_iFoodSaturation = 0; m_lastDragonHealth = 0.0f; m_showDragonHealth = false; m_ticksWithNoBoss = 0; m_uiSelectedItemOpacityCountDown = 0; m_displayName = L""; + m_lastShowDisplayName = true; + m_bRidingHorse = true; + m_horseHealth = 1; + m_lastHealthWither = true; + m_iCurrentHealthAbsorb = -1; + m_horseJumpProgress = 1.0f; + m_iHeartOffsetIndex = -1; + m_bHealthAbsorbActive = false; + m_iHorseMaxHealth = -1; m_labelDisplayName.setVisible(m_lastShowDisplayName); - SetDragonLabel( app.GetString( IDS_BOSS_ENDERDRAGON_HEALTH ) ); + SetDragonLabel(BossMobGuiInfo::name); SetSelectedLabel(L""); for(unsigned int i = 0; i < CHAT_LINES_COUNT; ++i) @@ -284,11 +271,26 @@ void UIScene_HUD::handleReload() SetTooltipsEnabled(((ui.GetMenuDisplayed(ProfileManager.GetPrimaryPad())) || (app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_Tooltips) != 0))); } +int UIScene_HUD::getPad() +{ + return m_iPad; +} + +void UIScene_HUD::SetOpacity(float opacity) +{ + setOpacity(opacity); +} + +void UIScene_HUD::SetVisible(bool visible) +{ + setVisible(visible); +} + void UIScene_HUD::SetHudSize(int scale) { - if(scale != m_lastScale) + if(scale != m_iGuiScale) { - m_lastScale = scale; + m_iGuiScale = scale; IggyDataValue result; IggyDataValue value[1]; @@ -298,7 +300,7 @@ void UIScene_HUD::SetHudSize(int scale) } } -void UIScene_HUD::SetExpBarProgress(float progress) +void UIScene_HUD::SetExpBarProgress(float progress, int xpNeededForNextLevel) { if(progress != m_lastExpProgress) { @@ -340,24 +342,27 @@ void UIScene_HUD::SetActiveSlot(int slot) } } -void UIScene_HUD::SetHealth(int iHealth, int iLastHealth, bool bBlink, bool bPoison) +void UIScene_HUD::SetHealth(int iHealth, int iLastHealth, bool bBlink, bool bPoison, bool bWither) { int maxHealth = max(iHealth, iLastHealth); - if(maxHealth != m_lastMaxHealth || bBlink != m_lastHealthBlink || bPoison != m_lastHealthPoison) + if(maxHealth != m_lastMaxHealth || bBlink != m_lastHealthBlink || bPoison != m_lastHealthPoison || bWither != m_lastHealthWither) { m_lastMaxHealth = maxHealth; m_lastHealthBlink = bBlink; m_lastHealthPoison = bPoison; + m_lastHealthWither = bWither; IggyDataValue result; - IggyDataValue value[3]; + IggyDataValue value[4]; value[0].type = IGGY_DATATYPE_number; value[0].number = maxHealth; value[1].type = IGGY_DATATYPE_boolean; value[1].boolval = bBlink; value[2].type = IGGY_DATATYPE_boolean; value[2].boolval = bPoison; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetHealth , 3 , value ); + value[3].type = IGGY_DATATYPE_boolean; + value[3].boolval = bWither; + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetHealth , 4 , value ); } } @@ -365,9 +370,9 @@ void UIScene_HUD::SetFood(int iFood, int iLastFood, bool bPoison) { // Ignore iLastFood as food doesn't flash int maxFood = iFood; //, iLastFood); - if(maxFood != m_lastMaxFood || bPoison != m_lastFoodPoison) + if(maxFood != m_iCurrentFood || bPoison != m_lastFoodPoison) { - m_lastMaxFood = maxFood; + m_iCurrentFood = maxFood; m_lastFoodPoison = bPoison; IggyDataValue result; @@ -380,7 +385,7 @@ void UIScene_HUD::SetFood(int iFood, int iLastFood, bool bPoison) } } -void UIScene_HUD::SetAir(int iAir) +void UIScene_HUD::SetAir(int iAir, int extra) { if(iAir != m_lastAir) { @@ -425,6 +430,21 @@ void UIScene_HUD::ShowHealth(bool show) } } +void UIScene_HUD::ShowHorseHealth(bool show) +{ + if(show != m_showHorseHealth) + { + app.DebugPrintf("ShowHorseHealth to %s\n", show?"TRUE":"FALSE"); + m_showHorseHealth = show; + + IggyDataValue result; + IggyDataValue value[1]; + value[0].type = IGGY_DATATYPE_boolean; + value[0].boolval = show; + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcShowHorseHealth , 1 , value ); + } +} + void UIScene_HUD::ShowFood(bool show) { if(show != m_showFood) @@ -487,10 +507,10 @@ void UIScene_HUD::ShowExpBar(bool show) void UIScene_HUD::SetRegenerationEffect(bool bEnabled) { - if(bEnabled != m_lastRegenEffect) + if(bEnabled != m_bRegenEffectEnabled) { app.DebugPrintf("SetRegenerationEffect to %s\n", bEnabled?"TRUE":"FALSE"); - m_lastRegenEffect = bEnabled; + m_bRegenEffectEnabled = bEnabled; IggyDataValue result; IggyDataValue value[1]; @@ -502,10 +522,10 @@ void UIScene_HUD::SetRegenerationEffect(bool bEnabled) void UIScene_HUD::SetFoodSaturationLevel(int iSaturation) { - if(iSaturation != m_lastSaturation) + if(iSaturation != m_iFoodSaturation) { app.DebugPrintf("Set saturation to %d\n", iSaturation); - m_lastSaturation = iSaturation; + m_iFoodSaturation = iSaturation; IggyDataValue result; IggyDataValue value[1]; @@ -578,6 +598,77 @@ void UIScene_HUD::HideSelectedLabel() IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcHideSelectedLabel , 0 , NULL ); } + +void UIScene_HUD::SetRidingHorse(bool ridingHorse, bool bIsJumpable, int maxHorseHealth) +{ + if(m_bRidingHorse != ridingHorse || maxHorseHealth != m_iHorseMaxHealth) + { + app.DebugPrintf("SetRidingHorse to %s\n", ridingHorse?"TRUE":"FALSE"); + m_bRidingHorse = ridingHorse; + m_bIsJumpable = bIsJumpable; + m_iHorseMaxHealth = maxHorseHealth; + + IggyDataValue result; + IggyDataValue value[3]; + value[0].type = IGGY_DATATYPE_boolean; + value[0].boolval = ridingHorse; + value[1].type = IGGY_DATATYPE_boolean; + value[1].boolval = bIsJumpable; + value[2].type = IGGY_DATATYPE_number; + value[2].number = maxHorseHealth; + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetRidingHorse , 3 , value ); + } +} + +void UIScene_HUD::SetHorseHealth(int health, bool blink /*= false*/) +{ + if(m_bRidingHorse && m_horseHealth != health) + { + app.DebugPrintf("SetHorseHealth to %d\n", health); + m_horseHealth = health; + + IggyDataValue result; + IggyDataValue value[2]; + value[0].type = IGGY_DATATYPE_number; + value[0].number = health; + value[1].type = IGGY_DATATYPE_boolean; + value[1].boolval = blink; + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetHorseHealth , 2 , value ); + } +} + +void UIScene_HUD::SetHorseJumpBarProgress(float progress) +{ + if(m_bRidingHorse && m_horseJumpProgress != progress) + { + app.DebugPrintf("SetHorseJumpBarProgress to %f\n", progress); + m_horseJumpProgress = progress; + + IggyDataValue result; + IggyDataValue value[1]; + value[0].type = IGGY_DATATYPE_number; + value[0].number = progress; + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetHorseJumpBarProgress , 1 , value ); + } +} + +void UIScene_HUD::SetHealthAbsorb(int healthAbsorb) +{ + if(m_iCurrentHealthAbsorb != healthAbsorb) + { + app.DebugPrintf("SetHealthAbsorb to %d\n", healthAbsorb); + m_iCurrentHealthAbsorb = healthAbsorb; + + IggyDataValue result; + IggyDataValue value[2]; + value[0].type = IGGY_DATATYPE_boolean; + value[0].boolval = healthAbsorb > 0; + value[1].type = IGGY_DATATYPE_number; + value[1].number = healthAbsorb; + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetHealthAbsorb , 2 , value ); + } +} + void UIScene_HUD::render(S32 width, S32 height, C4JRender::eViewportType viewport) { if(m_bSplitscreen) @@ -775,223 +866,6 @@ void UIScene_HUD::handleGameTick() } m_parentLayer->showComponent(m_iPad, eUIScene_HUD,true); - int iGuiScale; - - if(pMinecraft->localplayers[m_iPad]->m_iScreenSection == C4JRender::VIEWPORT_TYPE_FULLSCREEN) - { - iGuiScale=app.GetGameSettings(m_iPad,eGameSetting_UISize); - } - else - { - iGuiScale=app.GetGameSettings(m_iPad,eGameSetting_UISizeSplitscreen); - } - SetHudSize(iGuiScale); - - SetDisplayName(ProfileManager.GetDisplayName(m_iPad)); - - SetTooltipsEnabled(((ui.GetMenuDisplayed(ProfileManager.GetPrimaryPad())) || (app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_Tooltips) != 0))); - -#if TO_BE_IMPLEMENTED - // Move the whole hud group if we are not in fullscreen - if(pMinecraft->localplayers[m_iPad]->m_iScreenSection != C4JRender::VIEWPORT_TYPE_FULLSCREEN) - { - int iTooltipsYOffset = 0; - // if tooltips are off, set the y offset to zero - if(app.GetGameSettings(m_iPad,eGameSetting_Tooltips)==0) - { - switch(iGuiScale) - { - case 0: - iTooltipsYOffset=28;//screenHeight/10; - break; - case 2: - iTooltipsYOffset=28;//screenHeight/10; - break; - case 1: - default: - iTooltipsYOffset=28;//screenHeight/10; - break; - } - } - - float fHeight, fWidth; - GetBounds(&fWidth, &fHeight); - - int iSafezoneYHalf = 0; - switch(pMinecraft->localplayers[m_iPad]->m_iScreenSection) - { - case C4JRender::VIEWPORT_TYPE_SPLIT_TOP: - break; - case C4JRender::VIEWPORT_TYPE_SPLIT_BOTTOM: - iSafezoneYHalf = -fHeight/10;// 5% (need to treat the whole screen is 2x this screen) - break; - case C4JRender::VIEWPORT_TYPE_SPLIT_LEFT: - iSafezoneYHalf = (fHeight/2)-(fHeight/10);// 5% (need to treat the whole screen is 2x this screen) - break; - case C4JRender::VIEWPORT_TYPE_SPLIT_RIGHT: - iSafezoneYHalf = (fHeight/2)-(fHeight/10);// 5% (need to treat the whole screen is 2x this screen) - break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_LEFT: - break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_TOP_RIGHT: - break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_LEFT: - iSafezoneYHalf = -fHeight/10; // 5% (the whole screen is 2x this screen) - break; - case C4JRender::VIEWPORT_TYPE_QUADRANT_BOTTOM_RIGHT: - iSafezoneYHalf = -fHeight/10; // 5% (the whole screen is 2x this screen) - break; - }; - - D3DXVECTOR3 pos; - m_hudGroup.GetPosition(&pos); - pos.y = iTooltipsYOffset + iSafezoneYHalf; - m_hudGroup.SetPosition(&pos); - } -#endif - SetActiveSlot(pMinecraft->localplayers[m_iPad]->inventory->selected); - - // Update xp progress - if (pMinecraft->localgameModes[m_iPad]->canHurtPlayer()) - { - ShowExpBar(true); - int xpNeededForNextLevel = pMinecraft->localplayers[m_iPad]->getXpNeededForNextLevel(); - int progress = (int)(pMinecraft->localplayers[m_iPad]->experienceProgress *xpNeededForNextLevel); - SetExpBarProgress((float)progress/xpNeededForNextLevel); - } - else - { - ShowExpBar(false); - } - - // Update xp level - if (pMinecraft->localgameModes[m_iPad]->hasExperience() && pMinecraft->localplayers[m_iPad]->experienceLevel > 0) - { - SetExpLevel(pMinecraft->localplayers[m_iPad]->experienceLevel); - } - else - { - SetExpLevel(0); - } - - if (pMinecraft->localgameModes[m_iPad]->canHurtPlayer()) - { - ShowHealth(true); - ShowFood(true); - - SetRegenerationEffect(pMinecraft->localplayers[m_iPad]->hasEffect(MobEffect::regeneration)); - - // Update health - bool blink = pMinecraft->localplayers[m_iPad]->invulnerableTime / 3 % 2 == 1; - if (pMinecraft->localplayers[m_iPad]->invulnerableTime < 10) blink = false; - int iHealth = pMinecraft->localplayers[m_iPad]->getHealth(); - int iLastHealth = pMinecraft->localplayers[m_iPad]->lastHealth; - bool bHasPoison = pMinecraft->localplayers[m_iPad]->hasEffect(MobEffect::poison); - SetHealth(iHealth, iLastHealth, blink, bHasPoison); - - // Update food - //bool foodBlink = false; - FoodData *foodData = pMinecraft->localplayers[m_iPad]->getFoodData(); - int food = foodData->getFoodLevel(); - int oldFood = foodData->getLastFoodLevel(); - bool hasHungerEffect = pMinecraft->localplayers[m_iPad]->hasEffect(MobEffect::hunger); - int saturationLevel = pMinecraft->localplayers[m_iPad]->getFoodData()->getSaturationLevel(); - SetFood(food, oldFood, hasHungerEffect); - SetFoodSaturationLevel(saturationLevel); - - // Update armour - int armor = pMinecraft->localplayers[m_iPad]->getArmorValue(); - if(armor > 0) - { - ShowArmour(true); - SetArmour(armor); - } - else - { - ShowArmour(false); - } - - // Update air - if (pMinecraft->localplayers[m_iPad]->isUnderLiquid(Material::water)) - { - ShowAir(true); - int count = (int) ceil((pMinecraft->localplayers[m_iPad]->getAirSupply() - 2) * 10.0f / Player::TOTAL_AIR_SUPPLY); - SetAir(count); - } - else - { - ShowAir(false); - } - } - else - { - ShowHealth(false); - ShowFood(false); - ShowAir(false); - ShowArmour(false); - } - - if(m_uiSelectedItemOpacityCountDown>0) - { - --m_uiSelectedItemOpacityCountDown; - - // 4J Stu - Timing here is kept the same as on Xbox360, even though we do it differently now and do the fade out in Flash rather than directly setting opacity - if(m_uiSelectedItemOpacityCountDown < (SharedConstants::TICKS_PER_SECOND * 1) ) - { - HideSelectedLabel(); - m_uiSelectedItemOpacityCountDown = 0; - } - } - - unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity); - float fVal; - - if(ucAlpha<80) - { - // if we are in a menu, set the minimum opacity for tooltips to 15% - if(ui.GetMenuDisplayed(m_iPad) && (ucAlpha<15)) - { - ucAlpha=15; - } - - // check if we have the timer running for the opacity - unsigned int uiOpacityTimer=app.GetOpacityTimer(m_iPad); - if(uiOpacityTimer!=0) - { - if(uiOpacityTimer<10) - { - float fStep=(80.0f-(float)ucAlpha)/10.0f; - fVal=0.01f*(80.0f-((10.0f-(float)uiOpacityTimer)*fStep)); - } - else - { - fVal=0.01f*80.0f; - } - } - else - { - fVal=0.01f*(float)ucAlpha; - } - } - else - { - // if we are in a menu, set the minimum opacity for tooltips to 15% - if(ui.GetMenuDisplayed(m_iPad) && (ucAlpha<15)) - { - ucAlpha=15; - } - fVal=0.01f*(float)ucAlpha; - } - setOpacity(fVal); - - bool bDisplayGui=app.GetGameStarted() && !ui.GetMenuDisplayed(m_iPad) && !(app.GetXuiAction(m_iPad)==eAppAction_AutosaveSaveGameCapturedThumbnail) && app.GetGameSettings(m_iPad,eGameSetting_DisplayHUD)!=0; - if(bDisplayGui && pMinecraft->localplayers[m_iPad] != NULL) - { - setVisible(true); - } - else - { - setVisible(false); - } + updateFrameTick(); } -} +}
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_HUD.h b/Minecraft.Client/Common/UI/UIScene_HUD.h index cd0d8806..9d58ba4b 100644 --- a/Minecraft.Client/Common/UI/UIScene_HUD.h +++ b/Minecraft.Client/Common/UI/UIScene_HUD.h @@ -1,38 +1,15 @@ #pragma once #include "UIScene.h" +#include "IUIScene_HUD.h" #define CHAT_LINES_COUNT 10 -class UIScene_HUD : public UIScene +class UIScene_HUD : public UIScene, public IUIScene_HUD { private: bool m_bSplitscreen; - int m_lastActiveSlot; - int m_lastScale; - bool m_bToolTipsVisible; - float m_lastExpProgress; - int m_lastExpLevel; - int m_lastMaxHealth; - bool m_lastHealthBlink, m_lastHealthPoison; - int m_lastMaxFood; - bool m_lastFoodPoison; - int m_lastAir; - int m_lastArmour; - float m_lastDragonHealth; - bool m_showDragonHealth; - int m_ticksWithNoBoss; - bool m_lastShowDisplayName; - - bool m_showHealth, m_showFood, m_showAir, m_showArmour, m_showExpBar; - bool m_lastRegenEffect; - int m_lastSaturation; - - unsigned int m_uiSelectedItemOpacityCountDown; - - wstring m_displayName; - protected: UIControl_Label m_labelChatText[CHAT_LINES_COUNT]; UIControl_Label m_labelJukebox; @@ -41,11 +18,13 @@ protected: IggyName m_funcLoadHud, m_funcSetExpBarProgress, m_funcSetPlayerLevel, m_funcSetActiveSlot; IggyName m_funcSetHealth, m_funcSetFood, m_funcSetAir, m_funcSetArmour; - IggyName m_funcShowHealth, m_funcShowFood, m_funcShowAir, m_funcShowArmour, m_funcShowExpbar; + IggyName m_funcShowHealth, m_funcShowHorseHealth, m_funcShowFood, m_funcShowAir, m_funcShowArmour, m_funcShowExpbar; IggyName m_funcSetRegenerationEffect, m_funcSetFoodSaturationLevel; IggyName m_funcSetDragonHealth, m_funcSetDragonLabel, m_funcShowDragonHealth; IggyName m_funcSetSelectedLabel, m_funcHideSelectedLabel; IggyName m_funcRepositionHud, m_funcSetDisplayName, m_funcSetTooltipsEnabled; + IggyName m_funcSetRidingHorse, m_funcSetHorseHealth, m_funcSetHorseJumpBarProgress; + IggyName m_funcSetHealthAbsorb; UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) UI_MAP_ELEMENT(m_labelChatText[0],"Label1") UI_MAP_ELEMENT(m_labelChatText[1],"Label2") @@ -84,6 +63,7 @@ protected: UI_MAP_NAME(m_funcSetArmour, L"SetArmour") UI_MAP_NAME(m_funcShowHealth, L"ShowHealth") + UI_MAP_NAME(m_funcShowHorseHealth, L"ShowHorseHealth") UI_MAP_NAME(m_funcShowFood, L"ShowFood") UI_MAP_NAME(m_funcShowAir, L"ShowAir") UI_MAP_NAME(m_funcShowArmour, L"ShowArmour") @@ -103,6 +83,12 @@ protected: UI_MAP_NAME(m_funcSetDisplayName, L"SetGamertag") UI_MAP_NAME(m_funcSetTooltipsEnabled, L"SetTooltipsEnabled") + + UI_MAP_NAME(m_funcSetRidingHorse, L"SetRidingHorse") + UI_MAP_NAME(m_funcSetHorseHealth, L"SetHorseHealth") + UI_MAP_NAME(m_funcSetHorseJumpBarProgress, L"SetHorseJumpBarProgress") + + UI_MAP_NAME(m_funcSetHealthAbsorb, L"SetHealthAbsorb") UI_END_MAP_ELEMENTS_AND_NAMES() public: @@ -133,17 +119,22 @@ public: virtual void handleReload(); private: + virtual int getPad(); + virtual void SetOpacity(float opacity); + virtual void SetVisible(bool visible); + void SetHudSize(int scale); - void SetExpBarProgress(float progress); + void SetExpBarProgress(float progress, int xpNeededForNextLevel); void SetExpLevel(int level); void SetActiveSlot(int slot); - void SetHealth(int iHealth, int iLastHealth, bool bBlink, bool bPoison); + void SetHealth(int iHealth, int iLastHealth, bool bBlink, bool bPoison, bool bWither); void SetFood(int iFood, int iLastFood, bool bPoison); - void SetAir(int iAir); + void SetAir(int iAir, int extra); void SetArmour(int iArmour); void ShowHealth(bool show); + void ShowHorseHealth(bool show); void ShowFood(bool show); void ShowAir(bool show); void ShowArmour(bool show); @@ -162,6 +153,12 @@ private: void SetTooltipsEnabled(bool bEnabled); + void SetRidingHorse(bool ridingHorse, bool bIsJumpable, int maxHorseHealth); + void SetHorseHealth(int health, bool blink = false); + void SetHorseJumpBarProgress(float progress); + + void SetHealthAbsorb(int healthAbsorb); + public: void SetSelectedLabel(const wstring &label); void ShowDisplayName(bool show); diff --git a/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp index 3fe03325..a0d63172 100644 --- a/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HelpAndOptionsMenu.cpp @@ -10,21 +10,19 @@ UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void *initData, m_bNotInGame=(Minecraft::GetInstance()->level==NULL); - m_buttons[BUTTON_HAO_CHANGESKIN].init(app.GetString(IDS_CHANGE_SKIN),BUTTON_HAO_CHANGESKIN); - m_buttons[BUTTON_HAO_HOWTOPLAY].init(app.GetString(IDS_HOW_TO_PLAY),BUTTON_HAO_HOWTOPLAY); - m_buttons[BUTTON_HAO_CONTROLS].init(app.GetString(IDS_CONTROLS),BUTTON_HAO_CONTROLS); - m_buttons[BUTTON_HAO_SETTINGS].init(app.GetString(IDS_SETTINGS),BUTTON_HAO_SETTINGS); - m_buttons[BUTTON_HAO_CREDITS].init(app.GetString(IDS_CREDITS),BUTTON_HAO_CREDITS); + m_buttons[BUTTON_HAO_CHANGESKIN].init(IDS_CHANGE_SKIN,BUTTON_HAO_CHANGESKIN); + m_buttons[BUTTON_HAO_HOWTOPLAY].init(IDS_HOW_TO_PLAY,BUTTON_HAO_HOWTOPLAY); + m_buttons[BUTTON_HAO_CONTROLS].init(IDS_CONTROLS,BUTTON_HAO_CONTROLS); + m_buttons[BUTTON_HAO_SETTINGS].init(IDS_SETTINGS,BUTTON_HAO_SETTINGS); + m_buttons[BUTTON_HAO_CREDITS].init(IDS_CREDITS,BUTTON_HAO_CREDITS); //m_buttons[BUTTON_HAO_REINSTALL].init(app.GetString(IDS_REINSTALL_CONTENT),BUTTON_HAO_REINSTALL); - m_buttons[BUTTON_HAO_DEBUG].init(app.GetString(IDS_DEBUG_SETTINGS),BUTTON_HAO_DEBUG); + m_buttons[BUTTON_HAO_DEBUG].init(IDS_DEBUG_SETTINGS,BUTTON_HAO_DEBUG); /* 4J-TomK - we should never remove a control before the other buttons controls are initialised! (because vita touchboxes are rebuilt on remove since the remaining positions might change) */ // We don't have a reinstall content, so remove the button removeControl( &m_buttons[BUTTON_HAO_REINSTALL], false ); - doHorizontalResizeCheck(); - #ifdef _FINAL_BUILD removeControl( &m_buttons[BUTTON_HAO_DEBUG], false); #else @@ -75,6 +73,9 @@ UIScene_HelpAndOptionsMenu::UIScene_HelpAndOptionsMenu(int iPad, void *initData, removeControl( &m_buttons[BUTTON_HAO_CHANGESKIN], false); } + // 4J-TomK Moved horizontal resize check to the end to prevent horizontal scaling for buttons that might get removed anyways (debug options for example) + doHorizontalResizeCheck(); + //StorageManager.TMSPP_GetUserQuotaInfo(C4JStorage::eGlobalStorage_TitleUser,iPad); //StorageManager.WebServiceRequestGetFriends(iPad); } diff --git a/Minecraft.Client/Common/UI/UIScene_HopperMenu.cpp b/Minecraft.Client/Common/UI/UIScene_HopperMenu.cpp new file mode 100644 index 00000000..f0f6db18 --- /dev/null +++ b/Minecraft.Client/Common/UI/UIScene_HopperMenu.cpp @@ -0,0 +1,197 @@ +#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_HopperMenu.h" + +UIScene_HopperMenu::UIScene_HopperMenu(int iPad, void *_initData, UILayer *parentLayer) : UIScene_AbstractContainerMenu(iPad, parentLayer) +{ + // Setup all the Iggy references we need for this scene + initialiseMovie(); + + HopperScreenInput *initData = (HopperScreenInput *)_initData; + + m_labelDispenser.init(initData->hopper->getName()); + + 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_Hopper_Menu, this); + } + + HopperMenu* menu = new HopperMenu( initData->inventory, initData->hopper ); + + m_containerSize = initData->hopper->getContainerSize(); + Initialize( initData->iPad, menu, true, m_containerSize, eSectionHopperUsing, eSectionHopperMax ); + + m_slotListTrap.addSlots(0, 9); + + delete initData; +} + +wstring UIScene_HopperMenu::getMoviePath() +{ + if(app.GetLocalPlayerCount() > 1) + { + return L"HopperMenuSplit"; + } + else + { + return L"HopperMenu"; + } +} + +void UIScene_HopperMenu::handleReload() +{ + Initialize( m_iPad, m_menu, true, m_containerSize, eSectionHopperUsing, eSectionHopperMax ); + + m_slotListTrap.addSlots(0, 9); +} + +int UIScene_HopperMenu::getSectionColumns(ESceneSection eSection) +{ + int cols = 0; + switch( eSection ) + { + case eSectionHopperContents: + cols = 5; + break; + case eSectionHopperInventory: + cols = 9; + break; + case eSectionHopperUsing: + cols = 9; + break; + default: + assert( false ); + break; + } + return cols; +} + +int UIScene_HopperMenu::getSectionRows(ESceneSection eSection) +{ + int rows = 0; + switch( eSection ) + { + case eSectionHopperContents: + rows = 1; + break; + case eSectionHopperInventory: + rows = 3; + break; + case eSectionHopperUsing: + rows = 1; + break; + default: + assert( false ); + break; + } + return rows; +} + +void UIScene_HopperMenu::GetPositionOfSection( ESceneSection eSection, UIVec2D* pPosition ) +{ + switch( eSection ) + { + case eSectionHopperContents: + pPosition->x = m_slotListTrap.getXPos(); + pPosition->y = m_slotListTrap.getYPos(); + break; + case eSectionHopperInventory: + pPosition->x = m_slotListInventory.getXPos(); + pPosition->y = m_slotListInventory.getYPos(); + break; + case eSectionHopperUsing: + pPosition->x = m_slotListHotbar.getXPos(); + pPosition->y = m_slotListHotbar.getYPos(); + break; + default: + assert( false ); + break; + } +} + +void UIScene_HopperMenu::GetItemScreenData( ESceneSection eSection, int iItemIndex, UIVec2D* pPosition, UIVec2D* pSize ) +{ + UIVec2D sectionSize; + switch( eSection ) + { + case eSectionHopperContents: + sectionSize.x = m_slotListTrap.getWidth(); + sectionSize.y = m_slotListTrap.getHeight(); + break; + case eSectionHopperInventory: + sectionSize.x = m_slotListInventory.getWidth(); + sectionSize.y = m_slotListInventory.getHeight(); + break; + case eSectionHopperUsing: + 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_HopperMenu::setSectionSelectedSlot(ESceneSection eSection, int x, int y) +{ + int cols = getSectionColumns(eSection); + + int index = (y * cols) + x; + + UIControl_SlotList *slotList = NULL; + switch( eSection ) + { + case eSectionHopperContents: + slotList = &m_slotListTrap; + break; + case eSectionHopperInventory: + slotList = &m_slotListInventory; + break; + case eSectionHopperUsing: + slotList = &m_slotListHotbar; + break; + default: + assert( false ); + break; + } + slotList->setHighlightSlot(index); +} + +UIControl *UIScene_HopperMenu::getSection(ESceneSection eSection) +{ + UIControl *control = NULL; + switch( eSection ) + { + case eSectionHopperContents: + control = &m_slotListTrap; + break; + case eSectionHopperInventory: + control = &m_slotListInventory; + break; + case eSectionHopperUsing: + control = &m_slotListHotbar; + break; + default: + assert( false ); + break; + } + return control; +}
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_HopperMenu.h b/Minecraft.Client/Common/UI/UIScene_HopperMenu.h new file mode 100644 index 00000000..ff058fe8 --- /dev/null +++ b/Minecraft.Client/Common/UI/UIScene_HopperMenu.h @@ -0,0 +1,40 @@ +#pragma once + +#include "UIScene_AbstractContainerMenu.h" +#include "IUIScene_HopperMenu.h" + +class InventoryMenu; + +class UIScene_HopperMenu : public UIScene_AbstractContainerMenu, public IUIScene_HopperMenu +{ +private: + int m_containerSize; + +public: + UIScene_HopperMenu(int iPad, void *initData, UILayer *parentLayer); + + virtual EUIScene getSceneType() { return eUIScene_HopperMenu;} + +protected: + UIControl_SlotList m_slotListTrap; + UIControl_Label m_labelDispenser; + + UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene_AbstractContainerMenu) + UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlMainPanel ) + UI_MAP_ELEMENT( m_slotListTrap, "Trap") + UI_MAP_ELEMENT( m_labelDispenser, "dispenserLabel") + 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); +};
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_HorseInventoryMenu.cpp b/Minecraft.Client/Common/UI/UIScene_HorseInventoryMenu.cpp new file mode 100644 index 00000000..ab98e30f --- /dev/null +++ b/Minecraft.Client/Common/UI/UIScene_HorseInventoryMenu.cpp @@ -0,0 +1,338 @@ +#include "stdafx.h" +#include "UI.h" +#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h" +#include "..\..\..\Minecraft.World\net.minecraft.world.entity.animal.h" +#include "MultiPlayerLocalPlayer.h" +#include "..\..\Minecraft.h" +#include "UIScene_HorseInventoryMenu.h" + +UIScene_HorseInventoryMenu::UIScene_HorseInventoryMenu(int iPad, void *_initData, UILayer *parentLayer) : UIScene_AbstractContainerMenu(iPad, parentLayer) +{ + // Setup all the Iggy references we need for this scene + initialiseMovie(); + + HorseScreenInput *initData = (HorseScreenInput *)_initData; + + m_labelHorse.init( initData->container->getName() ); + m_inventory = initData->inventory; + m_horse = initData->horse; + + Minecraft *pMinecraft = Minecraft::GetInstance(); + if( pMinecraft->localgameModes[iPad] != NULL ) + { + TutorialMode *gameMode = (TutorialMode *)pMinecraft->localgameModes[iPad]; + m_previousTutorialState = gameMode->getTutorial()->getCurrentState(); + gameMode->getTutorial()->changeTutorialState(e_Tutorial_State_Horse_Menu, this); + } + + HorseInventoryMenu *horseMenu = new HorseInventoryMenu(initData->inventory, initData->container, initData->horse); + + int startSlot = EntityHorse::INV_BASE_COUNT; + if(m_horse->isChestedHorse()) + { + startSlot += EntityHorse::INV_DONKEY_CHEST_COUNT; + } + Initialize( iPad, horseMenu, true, startSlot, eSectionHorseUsing, eSectionHorseMax ); + + m_slotSaddle.addSlots(EntityHorse::INV_SLOT_SADDLE,1); + m_slotArmor.addSlots(EntityHorse::INV_SLOT_ARMOR,1); + + if(m_horse->isChestedHorse()) + { + // also starts at one, because a donkey can't wear armor! + m_slotListChest.addSlots(EntityHorse::INV_BASE_COUNT, EntityHorse::INV_DONKEY_CHEST_COUNT); + } + + // remove horse inventory + if(!m_horse->isChestedHorse()) + SetHasInventory(false); + + // cannot wear armor? remove armor slot! + if(!m_horse->canWearArmor()) + SetIsDonkey(true); + + if(initData) delete initData; + + setIgnoreInput(false); + + //app.SetRichPresenceContext(iPad, CONTEXT_GAME_STATE_HORSE); +} + +wstring UIScene_HorseInventoryMenu::getMoviePath() +{ + if(app.GetLocalPlayerCount() > 1) + { + return L"HorseInventoryMenuSplit"; + } + else + { + return L"HorseInventoryMenu"; + } +} + +void UIScene_HorseInventoryMenu::handleReload() +{ + int startSlot = EntityHorse::INV_BASE_COUNT; + if(m_horse->isChestedHorse()) + { + startSlot += EntityHorse::INV_DONKEY_CHEST_COUNT; + } + Initialize( m_iPad, m_menu, true, startSlot, eSectionHorseUsing, eSectionHorseMax ); + + m_slotSaddle.addSlots(EntityHorse::INV_SLOT_SADDLE,1); + m_slotArmor.addSlots(EntityHorse::INV_SLOT_ARMOR,1); + + if(m_horse->isChestedHorse()) + { + // also starts at one, because a donkey can't wear armor! + m_slotListChest.addSlots(EntityHorse::INV_BASE_COUNT, EntityHorse::INV_DONKEY_CHEST_COUNT); + } + + // remove horse inventory + if(!m_horse->isChestedHorse()) + SetHasInventory(false); + + // cannot wear armor? remove armor slot! + if(!m_horse->canWearArmor()) + SetIsDonkey(true); +} + +int UIScene_HorseInventoryMenu::getSectionColumns(ESceneSection eSection) +{ + int cols = 0; + switch( eSection ) + { + case eSectionHorseArmor: + cols = 1; + break; + case eSectionHorseSaddle: + cols = 1; + break; + case eSectionHorseChest: + cols = 5; + break; + case eSectionHorseInventory: + cols = 9; + break; + case eSectionHorseUsing: + cols = 9; + break; + default: + assert( false ); + break; + } + return cols; +} + +int UIScene_HorseInventoryMenu::getSectionRows(ESceneSection eSection) +{ + int rows = 0; + switch( eSection ) + { + case eSectionHorseArmor: + rows = 1; + break; + case eSectionHorseSaddle: + rows = 1; + break; + case eSectionHorseChest: + rows = 3; + break; + case eSectionHorseInventory: + rows = 3; + break; + case eSectionHorseUsing: + rows = 1; + break; + default: + assert( false ); + break; + } + return rows; +} + +void UIScene_HorseInventoryMenu::GetPositionOfSection( ESceneSection eSection, UIVec2D* pPosition ) +{ + switch( eSection ) + { + case eSectionHorseArmor: + pPosition->x = m_slotArmor.getXPos(); + pPosition->y = m_slotArmor.getYPos(); + break; + case eSectionHorseSaddle: + pPosition->x = m_slotSaddle.getXPos(); + pPosition->y = m_slotSaddle.getYPos(); + break; + case eSectionHorseChest: + pPosition->x = m_slotListChest.getXPos(); + pPosition->y = m_slotListChest.getYPos(); + break; + case eSectionHorseInventory: + pPosition->x = m_slotListInventory.getXPos(); + pPosition->y = m_slotListInventory.getYPos(); + break; + case eSectionHorseUsing: + pPosition->x = m_slotListHotbar.getXPos(); + pPosition->y = m_slotListHotbar.getYPos(); + break; + default: + assert( false ); + break; + } +} + +void UIScene_HorseInventoryMenu::GetItemScreenData( ESceneSection eSection, int iItemIndex, UIVec2D* pPosition, UIVec2D* pSize ) +{ + UIVec2D sectionSize; + + switch( eSection ) + { + case eSectionHorseArmor: + sectionSize.x = m_slotArmor.getWidth(); + sectionSize.y = m_slotArmor.getHeight(); + break; + case eSectionHorseSaddle: + sectionSize.x = m_slotSaddle.getWidth(); + sectionSize.y = m_slotSaddle.getHeight(); + break; + case eSectionHorseChest: + sectionSize.x = m_slotListChest.getWidth(); + sectionSize.y = m_slotListChest.getHeight(); + break; + case eSectionHorseInventory: + sectionSize.x = m_slotListInventory.getWidth(); + sectionSize.y = m_slotListInventory.getHeight(); + break; + case eSectionHorseUsing: + sectionSize.x = m_slotListHotbar.getWidth(); + sectionSize.y = m_slotListHotbar.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_HorseInventoryMenu::setSectionSelectedSlot(ESceneSection eSection, int x, int y) +{ + int cols = getSectionColumns(eSection); + + int index = (y * cols) + x; + + UIControl_SlotList *slotList = NULL; + switch( eSection ) + { + case eSectionHorseArmor: + slotList = &m_slotArmor; + break; + case eSectionHorseSaddle: + slotList = &m_slotSaddle; + break; + case eSectionHorseChest: + slotList = &m_slotListChest; + break; + case eSectionHorseInventory: + slotList = &m_slotListInventory; + break; + case eSectionHorseUsing: + slotList = &m_slotListHotbar; + break; + default: + assert( false ); + break; + } + + slotList->setHighlightSlot(index); +} + +UIControl *UIScene_HorseInventoryMenu::getSection(ESceneSection eSection) +{ + UIControl *control = NULL; + switch( eSection ) + { + case eSectionHorseArmor: + control = &m_slotArmor; + break; + case eSectionHorseSaddle: + control = &m_slotSaddle; + break; + case eSectionHorseChest: + control = &m_slotListChest; + break; + case eSectionHorseInventory: + control = &m_slotListInventory; + break; + case eSectionHorseUsing: + control = &m_slotListHotbar; + break; + default: + assert( false ); + break; + } + return control; +} + +void UIScene_HorseInventoryMenu::customDraw(IggyCustomDrawCallbackRegion *region) +{ + Minecraft *pMinecraft = Minecraft::GetInstance(); + if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return; + + if(wcscmp((wchar_t *)region->name,L"horse")==0) + { + // Setup GDraw, normal game render states and matrices + CustomDrawData *customDrawRegion = ui.setupCustomDraw(this,region); + delete customDrawRegion; + + m_horsePreview.render(region); + + // Finish GDraw and anything else that needs to be finalised + ui.endCustomDraw(region); + } + else + { + UIScene_AbstractContainerMenu::customDraw(region); + } +} + +void UIScene_HorseInventoryMenu::SetHasInventory(bool bHasInventory) +{ + app.DebugPrintf("SetHasInventory to %d\n", bHasInventory); + + IggyDataValue result; + IggyDataValue value[1]; + value[0].type = IGGY_DATATYPE_boolean; + value[0].boolval = bHasInventory; + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetHasInventory , 1 , value ); +} + +void UIScene_HorseInventoryMenu::SetIsDonkey(bool bSetIsDonkey) +{ + app.DebugPrintf("SetIsDonkey to %d\n", bSetIsDonkey); + + IggyDataValue result; + IggyDataValue value[1]; + value[0].type = IGGY_DATATYPE_boolean; + value[0].boolval = bSetIsDonkey; + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetIsDonkey , 1 , value ); +}
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_HorseInventoryMenu.h b/Minecraft.Client/Common/UI/UIScene_HorseInventoryMenu.h new file mode 100644 index 00000000..063e1128 --- /dev/null +++ b/Minecraft.Client/Common/UI/UIScene_HorseInventoryMenu.h @@ -0,0 +1,54 @@ +#pragma once + +#include "UIScene_AbstractContainerMenu.h" +#include "IUIScene_HorseInventoryMenu.h" + +class InventoryMenu; + +class UIScene_HorseInventoryMenu : public UIScene_AbstractContainerMenu, public IUIScene_HorseInventoryMenu +{ + friend class UIControl_MinecraftHorse; +public: + UIScene_HorseInventoryMenu(int iPad, void *initData, UILayer *parentLayer); + + virtual EUIScene getSceneType() { return eUIScene_HorseMenu;} + +protected: + UIControl_SlotList m_slotSaddle, m_slotArmor, m_slotListChest; + UIControl_Label m_labelHorse; + + IggyName m_funcSetIsDonkey, m_funcSetHasInventory; + + UIControl_MinecraftHorse m_horsePreview; + + UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene_AbstractContainerMenu) + UI_BEGIN_MAP_CHILD_ELEMENTS( m_controlMainPanel ) + UI_MAP_ELEMENT( m_slotSaddle, "SlotSaddle") + UI_MAP_ELEMENT( m_slotArmor, "SlotArmor") + UI_MAP_ELEMENT( m_slotListChest, "DonkeyInventoryList") + UI_MAP_ELEMENT( m_labelHorse, "horseinventoryText") + + UI_MAP_ELEMENT( m_horsePreview, "iggy_horse") + UI_END_MAP_CHILD_ELEMENTS() + + UI_MAP_NAME(m_funcSetIsDonkey, L"SetIsDonkey") + UI_MAP_NAME(m_funcSetHasInventory, L"SetHasInventory") + 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); + + virtual void customDraw(IggyCustomDrawCallbackRegion *region); + + void SetHasInventory(bool bHasInventory); + void SetIsDonkey(bool bSetIsDonkey); +};
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp b/Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp index 68c7591f..e33e24fe 100644 --- a/Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HowToPlay.cpp @@ -24,6 +24,11 @@ static UIScene_HowToPlay::SHowToPlayPageDef gs_aPageDefs[ eHowToPlay_NumPages ] { IDS_HOW_TO_PLAY_FARMANIMALS, 0, 0}, // eHowToPlay_Breeding { IDS_HOW_TO_PLAY_BREEDANIMALS, 0, 0}, // eHowToPlay_Breeding { IDS_HOW_TO_PLAY_TRADING, UIScene_HowToPlay::eHowToPlay_LabelTrading_Inventory, 5}, // eHowToPlay_Trading + { IDS_HOW_TO_PLAY_HORSES, 0, 0}, // eHowToPlay_Horses + { IDS_HOW_TO_PLAY_BEACONS, 0, 0}, // eHowToPlay_Beacons + { IDS_HOW_TO_PLAY_FIREWORKS, 0, 0}, // eHowToPlay_Fireworks + { IDS_HOW_TO_PLAY_HOPPERS, 0, 0}, // eHowToPlay_Hoppers + { IDS_HOW_TO_PLAY_DROPPERS, 0, 0}, // eHowToPlay_Droppers { IDS_HOW_TO_PLAY_NETHERPORTAL, 0, 0}, // eHowToPlay_NetherPortal { IDS_HOW_TO_PLAY_THEEND, 0, 0}, // eHowToPlay_NetherPortal #ifdef _XBOX @@ -56,6 +61,12 @@ int gs_pageToFlashMapping[eHowToPlay_NumPages] = 15, //eHowToPlay_Breeding, 22, //eHowToPlay_Trading, + 24, //eHowToPlay_Horses + 25, //eHowToPlay_Beacons + 26, //eHowToPlay_Fireworks + 27, //eHowToPlay_Hoppers + 28, //eHowToPlay_Droppers + 16, //eHowToPlay_NetherPortal, 17, //eHowToPlay_TheEnd, #ifdef _XBOX @@ -83,7 +94,7 @@ UIScene_HowToPlay::UIScene_HowToPlay(int iPad, void *initData, UILayer *parentLa m_labels[ eHowToPlay_LabelFChest].init(app.GetString(IDS_FURNACE)); m_labels[ eHowToPlay_LabelLCInventory].init(inventoryString); m_labels[ eHowToPlay_LabelCreativeInventory].init(app.GetString(IDS_GROUPNAME_BUILDING_BLOCKS)); - m_labels[ eHowToPlay_LabelLCChest].init(app.GetString(IDS_CHEST)); + m_labels[ eHowToPlay_LabelLCChest].init(app.GetString(IDS_CHEST_LARGE)); m_labels[ eHowToPlay_LabelSCInventory].init(inventoryString); m_labels[ eHowToPlay_LabelSCChest].init(app.GetString(IDS_CHEST)); m_labels[ eHowToPlay_LabelIInventory].init(inventoryString); @@ -105,6 +116,18 @@ UIScene_HowToPlay::UIScene_HowToPlay(int iPad, void *initData, UILayer *parentLa m_labels[ eHowToPlay_LabelTrading_Offer1].init(app.GetString(IDS_ITEM_EMERALD)); m_labels[ eHowToPlay_LabelTrading_NeededForTrade].init(app.GetString(IDS_REQUIRED_ITEMS_FOR_TRADE)); + m_labels[ eHowToPlay_LabelBeacon_PrimaryPower].init(app.GetString(IDS_CONTAINER_BEACON_PRIMARY_POWER)); + m_labels[ eHowToPlay_LabelBeacon_SecondaryPower].init(app.GetString(IDS_CONTAINER_BEACON_SECONDARY_POWER)); + + m_labels[ eHowToPlay_LabelFireworksText].init(app.GetString(IDS_HOW_TO_PLAY_MENU_FIREWORKS)); + m_labels[ eHowToPlay_LabelFireworksInventory].init(inventoryString.c_str()); + + m_labels[ eHowToPlay_LabelHopperText].init(app.GetString(IDS_TILE_HOPPER)); + m_labels[ eHowToPlay_LabelHopperInventory].init(inventoryString.c_str()); + + m_labels[ eHowToPlay_LabelDropperText].init(app.GetString(IDS_TILE_DROPPER)); + m_labels[ eHowToPlay_LabelDropperInventory].init(inventoryString.c_str()); + wsTemp = app.GetString(IDS_VILLAGER_OFFERS_ITEM); wsTemp = replaceAll(wsTemp,L"{*VILLAGER_TYPE*}",app.GetString(IDS_VILLAGER_PRIEST)); wsTemp.replace(wsTemp.find(L"%s"),2, app.GetString(IDS_TILE_LIGHT_GEM)); @@ -138,13 +161,9 @@ void UIScene_HowToPlay::updateTooltips() int iPage = ( int )( m_eCurrPage ); int firstPage = eHowToPlay_WhatsNew; -#ifdef __PS3__ - // If it's the blu ray, or the first Japanese digital game, there's no What's New until the first patch, which will take this line out - if(StorageManager.GetBootTypeDisc() || (app.GetProductSKU()==e_sku_SCEJ)) - { - ++firstPage; - } -#elif defined(__ORBIS__) || defined(_DURANGO) || defined(__PSVITA__) + + // 4J Stu - Add back for future platforms +#if 0 // No What's New for the first PS4 and Xbox One builds if(true) { @@ -212,18 +231,8 @@ void UIScene_HowToPlay::handleInput(int iPad, int key, bool repeat, bool pressed // Previous page int iPrevPage = ( int )( m_eCurrPage ) - 1; -#ifdef __PS3__ - // If it's the blu ray, or the first Japanese digital game, there's no What's New until the first patch, which will take this line out - if(StorageManager.GetBootTypeDisc() || (app.GetProductSKU()==e_sku_SCEJ)) - { - if ( iPrevPage >= 0 && !((iPrevPage==eHowToPlay_WhatsNew))) - { - StartPage( ( EHowToPlayPage )( iPrevPage ) ); - ui.PlayUISFX(eSFX_Press); - } - } - else -#elif defined(__ORBIS__) || defined(_DURANGO) || defined(__PSVITA__) + // 4J Stu - Add back for future platforms +#if 0 // No What's New for the first PS4 and Xbox One builds if(true) { @@ -266,15 +275,21 @@ void UIScene_HowToPlay::StartPage( EHowToPlayPage ePage ) wstring replacedText = app.FormatHTMLString(m_iPad, app.GetString( pDef->m_iTextStringID )); // 4J-PB - replace the title with the platform specific title, and the platform name // replacedText = replaceAll(replacedText,L"{*TITLE_UPDATE_NAME*}",app.GetString(IDS_TITLE_UPDATE_NAME)); -#ifndef _WINDOWS64 replacedText = replaceAll(replacedText,L"{*KICK_PLAYER_DESCRIPTION*}",app.GetString(IDS_KICK_PLAYER_DESCRIPTION)); -#endif #ifdef _XBOX_ONE replacedText = replaceAll(replacedText,L"{*PLATFORM_NAME*}",app.GetString(IDS_PLATFORM_NAME)); #endif replacedText = replaceAll(replacedText,L"{*BACK_BUTTON*}",app.GetString(IDS_BACK_BUTTON)); replacedText = replaceAll(replacedText,L"{*DISABLES_ACHIEVEMENTS*}",app.GetString(IDS_HOST_OPTION_DISABLES_ACHIEVEMENTS)); + // 4J-JEV: Temporary fix: LOC: Minecraft: XB1: KO: Font: Uncategorized: Squares appear instead of hyphens in FIREWORKS description + if (!ui.UsingBitmapFont()) + { + replacedText = replaceAll(replacedText, L"\u00A9", L"(C)"); + replacedText = replaceAll(replacedText, L"\u00AE", L"(R)"); + replacedText = replaceAll(replacedText, L"\u2013", L"-"); + } + // strip out any tab characters and repeated spaces stripWhitespaceForHtml( replacedText, true ); diff --git a/Minecraft.Client/Common/UI/UIScene_HowToPlay.h b/Minecraft.Client/Common/UI/UIScene_HowToPlay.h index cff07256..fe845896 100644 --- a/Minecraft.Client/Common/UI/UIScene_HowToPlay.h +++ b/Minecraft.Client/Common/UI/UIScene_HowToPlay.h @@ -39,6 +39,14 @@ public: eHowToPlay_LabelTrading_Offer1, eHowToPlay_LabelTrading_NeededForTrade, eHowToPlay_LabelTrading_VillagerOffers, + eHowToPlay_LabelBeacon_PrimaryPower, + eHowToPlay_LabelBeacon_SecondaryPower, + eHowToPlay_LabelFireworksText, + eHowToPlay_LabelFireworksInventory, + eHowToPlay_LabelHopperText, + eHowToPlay_LabelHopperInventory, + eHowToPlay_LabelDropperText, + eHowToPlay_LabelDropperInventory, eHowToPlay_NumLabels }; @@ -99,6 +107,18 @@ private: UI_MAP_ELEMENT( m_labels[ eHowToPlay_LabelAnvil_ARepairAndName ] , "Label1_21" ) UI_MAP_ELEMENT( m_labels[ eHowToPlay_LabelAnvil_Cost ] , "Label2_21" ) UI_MAP_ELEMENT( m_labels[ eHowToPlay_LabelAnvil_Inventory ] , "Label3_21" ) + + UI_MAP_ELEMENT( m_labels[ eHowToPlay_LabelBeacon_PrimaryPower ] , "Label1_25" ) + UI_MAP_ELEMENT( m_labels[ eHowToPlay_LabelBeacon_SecondaryPower ] , "Label2_25" ) + + UI_MAP_ELEMENT( m_labels[ eHowToPlay_LabelFireworksText ] , "Label1_26" ) + UI_MAP_ELEMENT( m_labels[ eHowToPlay_LabelFireworksInventory ] , "Label2_26" ) + + UI_MAP_ELEMENT( m_labels[ eHowToPlay_LabelHopperText ] , "Label1_27" ) + UI_MAP_ELEMENT( m_labels[ eHowToPlay_LabelHopperInventory ] , "Label2_27" ) + + UI_MAP_ELEMENT( m_labels[ eHowToPlay_LabelDropperText ] , "Label1_28" ) + UI_MAP_ELEMENT( m_labels[ eHowToPlay_LabelDropperInventory ] , "Label2_28" ) UI_MAP_NAME(m_funcLoadPage, L"LoadHowToPlayPage") UI_END_MAP_ELEMENTS_AND_NAMES() diff --git a/Minecraft.Client/Common/UI/UIScene_HowToPlayMenu.cpp b/Minecraft.Client/Common/UI/UIScene_HowToPlayMenu.cpp index 5fc6e02b..92e8bdef 100644 --- a/Minecraft.Client/Common/UI/UIScene_HowToPlayMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_HowToPlayMenu.cpp @@ -23,6 +23,12 @@ unsigned int UIScene_HowToPlayMenu::m_uiHTPButtonNameA[]= IDS_HOW_TO_PLAY_MENU_BREEDANIMALS, // eHTPButton_Breeding, IDS_HOW_TO_PLAY_MENU_TRADING, + IDS_HOW_TO_PLAY_MENU_HORSES, + IDS_HOW_TO_PLAY_MENU_BEACONS, + IDS_HOW_TO_PLAY_MENU_FIREWORKS, + IDS_HOW_TO_PLAY_MENU_HOPPERS, + IDS_HOW_TO_PLAY_MENU_DROPPERS, + IDS_HOW_TO_PLAY_MENU_NETHERPORTAL, // eHTPButton_NetherPortal, IDS_HOW_TO_PLAY_MENU_THEEND, // eHTPButton_TheEnd, #ifdef _XBOX @@ -53,6 +59,12 @@ unsigned int UIScene_HowToPlayMenu::m_uiHTPSceneA[]= eHowToPlay_Breeding, eHowToPlay_Trading, + eHowToPlay_Horses, + eHowToPlay_Beacons, + eHowToPlay_Fireworks, + eHowToPlay_Hoppers, + eHowToPlay_Droppers, + eHowToPlay_NetherPortal, eHowToPlay_TheEnd, #ifdef _XBOX @@ -71,18 +83,9 @@ UIScene_HowToPlayMenu::UIScene_HowToPlayMenu(int iPad, void *initData, UILayer * for(unsigned int i = 0; i < eHTPButton_Max; ++i) { -#ifdef __PS3__ - // If it's the blu ray, or the first Japanese digital game, there's no What's New until the first patch, which will take this line out - if(StorageManager.GetBootTypeDisc() || (app.GetProductSKU()==e_sku_SCEJ)) - { - if(!(i==eHTPButton_WhatsNew) ) - { - m_buttonListHowTo.addItem( app.GetString(m_uiHTPButtonNameA[i]) , i);//iCount++); - } - } - else -#elif defined(__ORBIS__) || defined(_DURANGO) || defined(__PSVITA__) - // No What's New for the first PS4 and Xbox One builds + // 4J Stu - Re-add for future platforms +#if 0 + // No What's New if(true) { if(!(i==eHTPButton_WhatsNew) ) @@ -96,6 +99,8 @@ UIScene_HowToPlayMenu::UIScene_HowToPlayMenu(int iPad, void *initData, UILayer * m_buttonListHowTo.addItem( app.GetString(m_uiHTPButtonNameA[i]) , i);//iCount++); } } + + doHorizontalResizeCheck(); } wstring UIScene_HowToPlayMenu::getMoviePath() @@ -136,18 +141,9 @@ void UIScene_HowToPlayMenu::handleReload() { for(unsigned int i = 0; i < eHTPButton_Max; ++i) { -#ifdef __PS3__ - // If it's the blu ray, or the first Japanese digital game, there's no What's New until the first patch, which will take this line out - if(StorageManager.GetBootTypeDisc() || (app.GetProductSKU()==e_sku_SCEJ)) - { - if(!(i==eHTPButton_WhatsNew) ) - { - m_buttonListHowTo.addItem( app.GetString(m_uiHTPButtonNameA[i]) , i); - } - } - else -#elif defined(__ORBIS__) || defined(_DURANGO) || defined(__PSVITA__) - // No What's New for the first PS4 and Xbox One builds + // 4J Stu - Re-add for future platforms +#if 0 + // No What's New if(true) { if(!(i==eHTPButton_WhatsNew) ) @@ -161,6 +157,8 @@ void UIScene_HowToPlayMenu::handleReload() m_buttonListHowTo.addItem( app.GetString(m_uiHTPButtonNameA[i]) , i); } } + + doHorizontalResizeCheck(); } void UIScene_HowToPlayMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) diff --git a/Minecraft.Client/Common/UI/UIScene_HowToPlayMenu.h b/Minecraft.Client/Common/UI/UIScene_HowToPlayMenu.h index 5a60cdd0..1afcec38 100644 --- a/Minecraft.Client/Common/UI/UIScene_HowToPlayMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_HowToPlayMenu.h @@ -28,6 +28,11 @@ private: eHTPButton_FarmingAnimals, eHTPButton_Breeding, eHTPButton_Trading, + eHTPButton_Horses, + eHTPButton_Beacons, + eHTPButton_Fireworks, + eHTPButton_Hoppers, + eHTPButton_Droppers, eHTPButton_NetherPortal, eHTPButton_TheEnd, #ifdef _XBOX diff --git a/Minecraft.Client/Common/UI/UIScene_InGameHostOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGameHostOptionsMenu.cpp index de8af0ac..68ac537e 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameHostOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGameHostOptionsMenu.cpp @@ -15,6 +15,24 @@ UIScene_InGameHostOptionsMenu::UIScene_InGameHostOptionsMenu(int iPad, void *ini m_checkboxFireSpreads.init(app.GetString(IDS_FIRE_SPREADS), eControl_FireSpreads, app.GetGameHostOption(eGameHostOption_FireSpreads)!=0); m_checkboxTNT.init(app.GetString(IDS_TNT_EXPLODES), eControl_TNT, app.GetGameHostOption(eGameHostOption_TNT)!=0); + m_checkboxDoMobLoot.init(app.GetString(IDS_MOB_LOOT), eControl_DoMobLoot, app.GetGameHostOption(eGameHostOption_DoMobLoot)); + m_checkboxDoTileDrops.init(app.GetString(IDS_TILE_DROPS), eControl_DoTileDrops, app.GetGameHostOption(eGameHostOption_DoTileDrops)); + m_checkboxNaturalRegeneration.init(app.GetString(IDS_NATURAL_REGEN), eControl_NaturalRegeneration, app.GetGameHostOption(eGameHostOption_NaturalRegeneration)); + + // If cheats are disabled, remove checkboxes + if (!app.GetGameHostOption(eGameHostOption_CheatsEnabled)) + { + removeControl(&m_checkboxMobGriefing, true); + removeControl(&m_checkboxKeepInventory, true); + removeControl(&m_checkboxDoMobSpawning, true); + removeControl(&m_checkboxDoDaylightCycle, true); + } + + m_checkboxMobGriefing.init(app.GetString(IDS_MOB_GRIEFING), eControl_MobGriefing, app.GetGameHostOption(eGameHostOption_MobGriefing)); + m_checkboxKeepInventory.init(app.GetString(IDS_KEEP_INVENTORY), eControl_KeepInventory, app.GetGameHostOption(eGameHostOption_KeepInventory)); + m_checkboxDoMobSpawning.init(app.GetString(IDS_MOB_SPAWNING), eControl_DoMobSpawning, app.GetGameHostOption(eGameHostOption_DoMobSpawning)); + m_checkboxDoDaylightCycle.init(app.GetString(IDS_DAYLIGHT_CYCLE), eControl_DoDaylightCycle, app.GetGameHostOption(eGameHostOption_DoDaylightCycle)); + INetworkPlayer *localPlayer = g_NetworkManager.GetLocalPlayerByUserIndex( m_iPad ); unsigned int privs = app.GetPlayerPrivileges(localPlayer->GetSmallId()); if(app.GetGameHostOption(eGameHostOption_CheatsEnabled) @@ -48,6 +66,33 @@ void UIScene_InGameHostOptionsMenu::updateTooltips() ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK); } +void UIScene_InGameHostOptionsMenu::handleReload() +{ + UIScene::handleReload(); + + // If cheats are disabled, remove checkboxes + if (!app.GetGameHostOption(eGameHostOption_CheatsEnabled)) + { + removeControl(&m_checkboxMobGriefing, true); + removeControl(&m_checkboxKeepInventory, true); + removeControl(&m_checkboxDoMobSpawning, true); + removeControl(&m_checkboxDoDaylightCycle, true); + } + + INetworkPlayer *localPlayer = g_NetworkManager.GetLocalPlayerByUserIndex( m_iPad ); + unsigned int privs = app.GetPlayerPrivileges(localPlayer->GetSmallId()); + if(app.GetGameHostOption(eGameHostOption_CheatsEnabled) + && Player::getPlayerGamePrivilege(privs,Player::ePlayerGamePrivilege_CanTeleport) + && g_NetworkManager.GetPlayerCount() > 1) + { + } + else + { + removeControl(&m_buttonTeleportToPlayer, true); + removeControl(&m_buttonTeleportToMe, true); + } +} + void UIScene_InGameHostOptionsMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) { //app.DebugPrintf("UIScene_DebugOverlay handling input for pad %d, key %d, down- %s, pressed- %s, released- %s\n", iPad, key, down?"TRUE":"FALSE", pressed?"TRUE":"FALSE", released?"TRUE":"FALSE"); @@ -59,8 +104,20 @@ void UIScene_InGameHostOptionsMenu::handleInput(int iPad, int key, bool repeat, if(pressed) { unsigned int hostOptions = app.GetGameHostOption(eGameHostOption_All); - app.SetGameHostOption(hostOptions,eGameHostOption_FireSpreads,m_checkboxFireSpreads.IsChecked()); - app.SetGameHostOption(hostOptions,eGameHostOption_TNT,m_checkboxTNT.IsChecked()); + app.SetGameHostOption(hostOptions, eGameHostOption_FireSpreads, m_checkboxFireSpreads.IsChecked()); + app.SetGameHostOption(hostOptions, eGameHostOption_TNT, m_checkboxTNT.IsChecked()); + app.SetGameHostOption(hostOptions, eGameHostOption_DoMobLoot, m_checkboxDoMobLoot.IsChecked()); + app.SetGameHostOption(hostOptions, eGameHostOption_DoTileDrops, m_checkboxDoTileDrops.IsChecked()); + app.SetGameHostOption(hostOptions, eGameHostOption_NaturalRegeneration, m_checkboxNaturalRegeneration.IsChecked()); + + // If cheats are enabled, set cheat values + if (app.GetGameHostOption(eGameHostOption_CheatsEnabled)) + { + app.SetGameHostOption(hostOptions, eGameHostOption_MobGriefing, m_checkboxMobGriefing.IsChecked()); + app.SetGameHostOption(hostOptions, eGameHostOption_KeepInventory, m_checkboxKeepInventory.IsChecked()); + app.SetGameHostOption(hostOptions, eGameHostOption_DoMobSpawning, m_checkboxDoMobSpawning.IsChecked()); + app.SetGameHostOption(hostOptions, eGameHostOption_DoDaylightCycle, m_checkboxDoDaylightCycle.IsChecked()); + } // Send update settings packet to server if(hostOptions != app.GetGameHostOption(eGameHostOption_All) ) diff --git a/Minecraft.Client/Common/UI/UIScene_InGameHostOptionsMenu.h b/Minecraft.Client/Common/UI/UIScene_InGameHostOptionsMenu.h index 24711412..b198974f 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameHostOptionsMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_InGameHostOptionsMenu.h @@ -9,15 +9,29 @@ private: { eControl_FireSpreads, eControl_TNT, + eControl_MobGriefing, + eControl_KeepInventory, + eControl_DoMobSpawning, + eControl_DoMobLoot, + eControl_DoTileDrops, + eControl_NaturalRegeneration, + eControl_DoDaylightCycle, eControl_TeleportToPlayer, eControl_TeleportToMe, }; - UIControl_CheckBox m_checkboxFireSpreads, m_checkboxTNT; + UIControl_CheckBox m_checkboxFireSpreads, m_checkboxTNT, m_checkboxMobGriefing, m_checkboxKeepInventory, m_checkboxDoMobSpawning, m_checkboxDoMobLoot, m_checkboxDoTileDrops, m_checkboxNaturalRegeneration, m_checkboxDoDaylightCycle; UIControl_Button m_buttonTeleportToPlayer, m_buttonTeleportToMe; UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) UI_MAP_ELEMENT( m_checkboxFireSpreads, "CheckboxFireSpreads") UI_MAP_ELEMENT( m_checkboxTNT, "CheckboxTNT") + UI_MAP_ELEMENT( m_checkboxMobGriefing, "CheckboxMobGriefing") + UI_MAP_ELEMENT( m_checkboxKeepInventory, "CheckboxKeepInventory") + UI_MAP_ELEMENT( m_checkboxDoMobSpawning, "CheckboxMobSpawning") + UI_MAP_ELEMENT( m_checkboxDoMobLoot, "CheckboxMobLoot") + UI_MAP_ELEMENT( m_checkboxDoTileDrops, "CheckboxTileDrops") + UI_MAP_ELEMENT( m_checkboxNaturalRegeneration, "CheckboxNaturalRegeneration") + UI_MAP_ELEMENT( m_checkboxDoDaylightCycle, "CheckboxDayLightCycle") UI_MAP_ELEMENT( m_buttonTeleportToPlayer, "TeleportToPlayer") UI_MAP_ELEMENT( m_buttonTeleportToMe, "TeleportPlayerToMe") UI_END_MAP_ELEMENTS_AND_NAMES() @@ -27,6 +41,8 @@ public: virtual EUIScene getSceneType() { return eUIScene_InGameHostOptionsMenu;} virtual void updateTooltips(); + virtual void handleReload(); + protected: // TODO: This should be pure virtual in this class virtual wstring getMoviePath(); diff --git a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp index 5c3f73f6..57acf345 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.cpp @@ -15,59 +15,20 @@ UIScene_InGameInfoMenu::UIScene_InGameInfoMenu(int iPad, void *initData, UILayer m_labelTitle.init(app.GetString(IDS_PLAYERS_INVITE)); m_playerList.init(eControl_GamePlayers); - for(unsigned int i = 0; i < MINECRAFT_NET_MAX_PLAYERS; ++i) - { - m_playerNames[i] = L""; - } + m_players = vector<PlayerInfo *>(); DWORD playerCount = g_NetworkManager.GetPlayerCount(); - m_playersCount = 0; for(DWORD i = 0; i < playerCount; ++i) { INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i ); if( player != NULL ) { - m_players[i] = player->GetSmallId(); - ++m_playersCount; - - wstring playerName = L""; -#ifndef _CONTENT_PACKAGE - if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L<<eDebugSetting_DebugLeaderboards))) - { - playerName = L"WWWWWWWWWWWWWWWW"; - } - else -#endif - { - playerName = player->GetDisplayName(); - } + PlayerInfo *info = BuildPlayerInfo(player); - int voiceStatus = 0; - if(player != NULL && player->HasVoice() ) - { - if( player->IsMutedByLocalUser(m_iPad) ) - { - // Muted image - voiceStatus = 3; - } - else if( player->IsTalking() ) - { - // Talking image - voiceStatus = 2; - } - else - { - // Not talking image - voiceStatus = 1; - } - } - - m_playersVoiceState[i] = voiceStatus; - m_playersColourState[i] = app.GetPlayerColour( m_players[i] ); - m_playerNames[i] = playerName; - m_playerList.addItem( playerName, app.GetPlayerColour( m_players[i] ), voiceStatus); + m_players.push_back(info); + m_playerList.addItem(info->m_name, info->m_colorState, info->m_voiceStatus); } } @@ -98,6 +59,12 @@ UIScene_InGameInfoMenu::UIScene_InGameInfoMenu(int iPad, void *initData, UILayer #endif } +UIScene_InGameInfoMenu::~UIScene_InGameInfoMenu() +{ + // Delete player infos + for (int i = 0; i < m_players.size(); i++) { delete m_players[i]; } +} + wstring UIScene_InGameInfoMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) @@ -126,8 +93,7 @@ void UIScene_InGameInfoMenu::updateTooltips() if(CGameNetworkManager::usingAdhocMode()) keyX = -1; #endif - - INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId( m_players[ m_playerList.getCurrentSelection() ] ); + INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId(m_players[m_playerList.getCurrentSelection()]->m_smallId); int keyA = -1; Minecraft *pMinecraft = Minecraft::GetInstance(); @@ -198,52 +164,20 @@ void UIScene_InGameInfoMenu::handleReload() { DWORD playerCount = g_NetworkManager.GetPlayerCount(); - m_playersCount = 0; + // Remove all player info + for (int i = 0; i < m_players.size(); i++) { delete m_players[i]; } + m_players.clear(); + for(DWORD i = 0; i < playerCount; ++i) { INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i ); if( player != NULL ) { - m_players[i] = player->GetSmallId(); - ++m_playersCount; - - wstring playerName = L""; -#ifndef _CONTENT_PACKAGE - if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L<<eDebugSetting_DebugLeaderboards))) - { - playerName = L"WWWWWWWWWWWWWWWW"; - } - else -#endif - { - playerName = player->GetDisplayName(); - } - - int voiceStatus = 0; - if(player != NULL && player->HasVoice() ) - { - if( player->IsMutedByLocalUser(m_iPad) ) - { - // Muted image - voiceStatus = 3; - } - else if( player->IsTalking() ) - { - // Talking image - voiceStatus = 2; - } - else - { - // Not talking image - voiceStatus = 1; - } - } + PlayerInfo *info = BuildPlayerInfo(player); - m_playersVoiceState[i] = voiceStatus; - m_playersColourState[i] = app.GetPlayerColour( m_players[i] ); - m_playerNames[i] = playerName; - m_playerList.addItem( playerName, app.GetPlayerColour( m_players[i] ), voiceStatus); + m_players.push_back(info); + m_playerList.addItem(info->m_name, info->m_colorState, info->m_voiceStatus); } } @@ -270,63 +204,36 @@ void UIScene_InGameInfoMenu::tick() { UIScene::tick(); - for(DWORD i = 0; i < m_playersCount; ++i) + // Update players by index + for(DWORD i = 0; i < m_players.size(); ++i) { INetworkPlayer *player = g_NetworkManager.GetPlayerByIndex( i ); - if( player != NULL ) + if(player != NULL) { - m_players[i] = player->GetSmallId(); - int voiceStatus = 0; - if(player != NULL && player->HasVoice() ) - { - if( player->IsMutedByLocalUser(m_iPad) ) - { - // Muted image - voiceStatus = 3; - } - else if( player->IsTalking() ) - { - // Talking image - voiceStatus = 2; - } - else - { - // Not talking image - voiceStatus = 1; - } - } - - if(voiceStatus != m_playersVoiceState[i]) - { - m_playersVoiceState[i] = voiceStatus; - m_playerList.setVOIPIcon( i, voiceStatus ); - } + PlayerInfo *info = BuildPlayerInfo(player); - short icon = app.GetPlayerColour( m_players[i] ); + m_players[i]->m_smallId = info->m_smallId; - if(icon != m_playersColourState[i]) + if(info->m_voiceStatus != m_players[i]->m_voiceStatus) { - m_playersColourState[i] = icon; - m_playerList.setPlayerIcon( i, (int)app.GetPlayerColour( m_players[i] ) ); + m_players[i]->m_voiceStatus = info->m_voiceStatus; + m_playerList.setVOIPIcon(i, info->m_voiceStatus); } - - wstring playerName = L""; -#ifndef _CONTENT_PACKAGE - if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L<<eDebugSetting_DebugLeaderboards))) + + if(info->m_colorState != m_players[i]->m_colorState) { - playerName = L"WWWWWWWWWWWWWWWW"; + m_players[i]->m_colorState = info->m_colorState; + m_playerList.setPlayerIcon(i, info->m_colorState); } - else -#endif - { - playerName = player->GetDisplayName(); - } - if(playerName.compare( m_playerNames[i] ) != 0 ) + + if(info->m_name.compare( m_players[i]->m_name ) != 0 ) { - m_playerList.setButtonLabel(i, playerName); - m_playerNames[i] = playerName; + m_playerList.setButtonLabel(i, info->m_name); + m_players[i]->m_name = info->m_name; } + + delete info; } } } @@ -357,7 +264,7 @@ void UIScene_InGameInfoMenu::handleInput(int iPad, int key, bool repeat, bool pr UINT uiIDA[2]; uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_InGameInfoMenu::MustSignInReturnedPSN,this, app.GetStringTable()); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_InGameInfoMenu::MustSignInReturnedPSN,this); } else #endif @@ -373,9 +280,9 @@ void UIScene_InGameInfoMenu::handleInput(int iPad, int key, bool repeat, bool pr #else - if(pressed && m_playerList.hasFocus() && (m_playerList.getItemCount() > 0) && (m_playerList.getCurrentSelection() < m_playersCount) ) + if(pressed && m_playerList.hasFocus() && (m_playerList.getItemCount() > 0) && (m_playerList.getCurrentSelection() < m_players.size()) ) { - INetworkPlayer *player = g_NetworkManager.GetPlayerBySmallId(m_players[m_playerList.getCurrentSelection()]); + INetworkPlayer *player = g_NetworkManager.GetPlayerBySmallId(m_players[m_playerList.getCurrentSelection()]->m_smallId); if( player != NULL ) { PlayerUID uid = player->GetUID(); @@ -428,7 +335,7 @@ void UIScene_InGameInfoMenu::handlePress(F64 controlId, F64 childId) break; case eControl_GamePlayers: int currentSelection = (int)childId; - INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId( m_players[ currentSelection ] ); + INetworkPlayer *selectedPlayer = g_NetworkManager.GetPlayerBySmallId(m_players[currentSelection]->m_smallId); Minecraft *pMinecraft = Minecraft::GetInstance(); shared_ptr<MultiplayerLocalPlayer> localPlayer = pMinecraft->localplayers[m_iPad]; @@ -448,20 +355,20 @@ void UIScene_InGameInfoMenu::handlePress(F64 controlId, F64 childId) { InGamePlayerOptionsInitData *pInitData = new InGamePlayerOptionsInitData(); pInitData->iPad = m_iPad; - pInitData->networkSmallId = m_players[ currentSelection ]; - pInitData->playerPrivileges = app.GetPlayerPrivileges(m_players[ currentSelection ] ); + pInitData->networkSmallId = m_players[currentSelection]->m_smallId; + pInitData->playerPrivileges = app.GetPlayerPrivileges(m_players[currentSelection]->m_smallId); ui.NavigateToScene(m_iPad,eUIScene_InGamePlayerOptionsMenu,pInitData); } else if(selectedPlayer->IsLocal() != TRUE && selectedPlayer->IsSameSystem(g_NetworkManager.GetHostPlayer()) != TRUE) { // Only ops will hit this, can kick anyone not local and not local to the host BYTE *smallId = new BYTE(); - *smallId = m_players[currentSelection]; + *smallId = m_players[currentSelection]->m_smallId; UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; uiIDA[1]=IDS_CONFIRM_CANCEL; - ui.RequestMessageBox(IDS_UNLOCK_KICK_PLAYER_TITLE, IDS_UNLOCK_KICK_PLAYER, uiIDA, 2, m_iPad,&UIScene_InGameInfoMenu::KickPlayerReturned,smallId,app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_UNLOCK_KICK_PLAYER_TITLE, IDS_UNLOCK_KICK_PLAYER, uiIDA, 2, m_iPad,&UIScene_InGameInfoMenu::KickPlayerReturned,smallId); } } break; @@ -480,71 +387,53 @@ void UIScene_InGameInfoMenu::handleFocusChange(F64 controlId, F64 childId) void UIScene_InGameInfoMenu::OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving) { + app.DebugPrintf("<UIScene_InGameInfoMenu::OnPlayerChanged> Player \"%ls\" %s (smallId: %d)\n", pPlayer->GetOnlineName(), leaving ? "leaving" : "joining", pPlayer->GetSmallId()); + UIScene_InGameInfoMenu *scene = (UIScene_InGameInfoMenu *)callbackParam; bool playerFound = false; int foundIndex = 0; - for(int i = 0; i < scene->m_playersCount; ++i) + for(int i = 0; i < scene->m_players.size(); ++i) { - if(!playerFound && scene->m_players[i] == pPlayer->GetSmallId() ) + if(!playerFound && scene->m_players[i]->m_smallId == pPlayer->GetSmallId() ) { if( scene->m_playerList.getCurrentSelection() == scene->m_playerList.getItemCount() - 1 ) { scene->m_playerList.setCurrentSelection( scene->m_playerList.getItemCount() - 2 ); } - // Player removed + + // Player found playerFound = true; foundIndex = i; } } - if( playerFound ) - { - --scene->m_playersCount; - scene->m_playersVoiceState[scene->m_playersCount] = 0; - scene->m_playersColourState[scene->m_playersCount] = 0; - scene->m_playerNames[scene->m_playersCount] = L""; - scene->m_playerList.removeItem(scene->m_playersCount); - } + if (leaving && !playerFound) app.DebugPrintf("<UIScene_InGameInfoMenu::OnPlayerChanged> Error: Player \"%ls\" leaving but not found in list\n", pPlayer->GetOnlineName()); + if (!leaving && playerFound) app.DebugPrintf("<UIScene_InGameInfoMenu::OnPlayerChanged> Error: Player \"%ls\" joining but already in list\n", pPlayer->GetOnlineName()); - if( !playerFound ) + // If the player was found remove them (even if they're joining, they'll be added again later) + if(playerFound) { - // Player added - scene->m_players[scene->m_playersCount] = pPlayer->GetSmallId(); - ++scene->m_playersCount; + app.DebugPrintf("<UIScene_InGameInfoMenu::OnPlayerChanged> Player \"%ls\" found, removing\n", pPlayer->GetOnlineName()); - wstring playerName = L""; -#ifndef _CONTENT_PACKAGE - if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L<<eDebugSetting_DebugLeaderboards))) - { - playerName = L"WWWWWWWWWWWWWWWW"; - } - else -#endif - { - playerName = pPlayer->GetDisplayName(); - } + // Remove player info + delete scene->m_players[foundIndex]; + scene->m_players.erase(scene->m_players.begin() + foundIndex); - int voiceStatus = 0; - if(pPlayer != NULL && pPlayer->HasVoice() ) - { - if( pPlayer->IsMutedByLocalUser(scene->m_iPad) ) - { - // Muted image - voiceStatus = 3; - } - else if( pPlayer->IsTalking() ) - { - // Talking image - voiceStatus = 2; - } - else - { - // Not talking image - voiceStatus = 1; - } - } + // Remove player from list + scene->m_playerList.removeItem(foundIndex); + } - scene->m_playerList.addItem( playerName, app.GetPlayerColour( scene->m_players[scene->m_playersCount - 1] ), voiceStatus); + // If the player is joining + if(!leaving) + { + app.DebugPrintf("<UIScene_InGameInfoMenu::OnPlayerChanged> Player \"%ls\" not found, adding\n", pPlayer->GetOnlineName()); + + PlayerInfo *info = scene->BuildPlayerInfo(pPlayer); + scene->m_players.push_back(info); + + // Note that the tick updates buttons every tick so it's only really important that we + // add the button (not the order or content) + scene->m_playerList.addItem(info->m_name, info->m_colorState, info->m_voiceStatus); } } @@ -566,6 +455,50 @@ int UIScene_InGameInfoMenu::KickPlayerReturned(void *pParam,int iPad,C4JStorage: return 0; } +UIScene_InGameInfoMenu::PlayerInfo *UIScene_InGameInfoMenu::BuildPlayerInfo(INetworkPlayer *player) +{ + PlayerInfo *info = new PlayerInfo(); + info->m_smallId = player->GetSmallId(); + + wstring playerName = L""; +#ifndef _CONTENT_PACKAGE + if(app.DebugSettingsOn() && (app.GetGameSettingsDebugMask()&(1L<<eDebugSetting_DebugLeaderboards))) + { + playerName = L"WWWWWWWWWWWWWWWW"; + } + else +#endif + { + playerName = player->GetDisplayName(); + } + + int voiceStatus = 0; + if(player != NULL && player->HasVoice() ) + { + if( player->IsMutedByLocalUser(m_iPad) ) + { + // Muted image + voiceStatus = 3; + } + else if( player->IsTalking() ) + { + // Talking image + voiceStatus = 2; + } + else + { + // Not talking image + voiceStatus = 1; + } + } + + info->m_voiceStatus = voiceStatus; + info->m_colorState = app.GetPlayerColour(info->m_smallId); + info->m_name = playerName; + + return info; +} + #if defined __PS3__ || defined __PSVITA__ int UIScene_InGameInfoMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result) { @@ -596,10 +529,10 @@ int UIScene_InGameInfoMenu::ViewInvites_SignInReturned(void *pParam,bool bContin int ret = sceNpBasicRecvMessageCustom(SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE, SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_INCLUDE_BOOTABLE, SYS_MEMORY_CONTAINER_ID_INVALID); app.DebugPrintf("sceNpBasicRecvMessageCustom return %d ( %08x )\n", ret, ret); #else // __PSVITA__ - PSVITA_STUBBED; + SQRNetworkManager_Vita::RecvInviteGUI(); #endif } } return 0; } -#endif +#endif
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.h b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.h index 94966fa3..464c83a0 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_InGameInfoMenu.h @@ -10,13 +10,22 @@ private: eControl_GameOptions, eControl_GamePlayers, }; + + typedef struct _PlayerInfo + { + byte m_smallId; + char m_voiceStatus; + short m_colorState; + wstring m_name; + + } PlayerInfo; bool m_isHostPlayer; - int m_playersCount; - BYTE m_players[MINECRAFT_NET_MAX_PLAYERS]; // An array of QNet small-id's - char m_playersVoiceState[MINECRAFT_NET_MAX_PLAYERS]; - short m_playersColourState[MINECRAFT_NET_MAX_PLAYERS]; - wstring m_playerNames[MINECRAFT_NET_MAX_PLAYERS]; + //int m_playersCount; + vector<PlayerInfo *> m_players; // A vector of player info structs + //char m_playersVoiceState[MINECRAFT_NET_MAX_PLAYERS]; + //short m_playersColourState[MINECRAFT_NET_MAX_PLAYERS]; + //wstring m_playerNames[MINECRAFT_NET_MAX_PLAYERS]; UIControl_Button m_buttonGameOptions; UIControl_PlayerList m_playerList; @@ -28,6 +37,7 @@ private: UI_END_MAP_ELEMENTS_AND_NAMES() public: UIScene_InGameInfoMenu(int iPad, void *initData, UILayer *parentLayer); + virtual ~UIScene_InGameInfoMenu(); virtual EUIScene getSceneType() { return eUIScene_InGameInfoMenu;} virtual void updateTooltips(); @@ -55,6 +65,8 @@ public: static void OnPlayerChanged(void *callbackParam, INetworkPlayer *pPlayer, bool leaving); private: + PlayerInfo *BuildPlayerInfo(INetworkPlayer *player); + #if defined(__PS3__) || defined (__PSVITA__) || defined(__ORBIS__) static int MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result); static int ViewInvites_SignInReturned(void *pParam,bool bContinue, int iPad); diff --git a/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp index 6eb22b09..d7196849 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.cpp @@ -232,6 +232,92 @@ void UIScene_InGamePlayerOptionsMenu::updateTooltips() ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT,IDS_TOOLTIPS_BACK); } +void UIScene_InGamePlayerOptionsMenu::handleReload() +{ + UIScene::handleReload(); + + INetworkPlayer *localPlayer = g_NetworkManager.GetLocalPlayerByUserIndex( m_iPad ); + INetworkPlayer *editingPlayer = g_NetworkManager.GetPlayerBySmallId(m_networkSmallId); + + bool trustPlayers = app.GetGameHostOption(eGameHostOption_TrustPlayers) != 0; + bool cheats = app.GetGameHostOption(eGameHostOption_CheatsEnabled) != 0; + m_editingSelf = (localPlayer != NULL && localPlayer == editingPlayer); + + if( m_editingSelf || trustPlayers || editingPlayer->IsHost()) + { + removeControl( &m_checkboxes[eControl_BuildAndMine], true ); + removeControl( &m_checkboxes[eControl_UseDoorsAndSwitches], true ); + removeControl( &m_checkboxes[eControl_UseContainers], true ); + removeControl( &m_checkboxes[eControl_AttackPlayers], true ); + removeControl( &m_checkboxes[eControl_AttackAnimals], true ); + } + + if(m_editingSelf) + { +#if (defined(_CONTENT_PACKAGE) || defined(_FINAL_BUILD) && !defined(_DEBUG_MENUS_ENABLED)) + removeControl( &m_checkboxes[eControl_Op], true ); +#endif + + removeControl( &m_buttonKick, true ); + removeControl( &m_checkboxes[eControl_CheatTeleport], true ); + + if(cheats) + { + bool inCreativeMode = Player::getPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CreativeMode) != 0; + if(inCreativeMode) + { + removeControl( &m_checkboxes[eControl_HostFly], true ); + removeControl( &m_checkboxes[eControl_HostHunger], true ); + } + } + else + { + removeControl( &m_checkboxes[eControl_HostInvisible], true ); + removeControl( &m_checkboxes[eControl_HostFly], true ); + removeControl( &m_checkboxes[eControl_HostHunger], true ); + } + } + else + { + if(!localPlayer->IsHost()) + { + removeControl( &m_checkboxes[eControl_Op], true ); + } + + if(localPlayer->IsHost() && cheats ) + { + + bool inCreativeMode = Player::getPlayerGamePrivilege(m_playerPrivileges,Player::ePlayerGamePrivilege_CreativeMode) != 0; + if(inCreativeMode) + { + removeControl( &m_checkboxes[eControl_HostFly], true ); + removeControl( &m_checkboxes[eControl_HostHunger], true ); + } + } + else + { + removeControl( &m_checkboxes[eControl_HostInvisible], true ); + removeControl( &m_checkboxes[eControl_HostFly], true ); + removeControl( &m_checkboxes[eControl_HostHunger], true ); + removeControl( &m_checkboxes[eControl_CheatTeleport], true ); + } + + + // Can only kick people if they are not local, and not local to the host + if(editingPlayer->IsLocal() == TRUE || editingPlayer->IsSameSystem(g_NetworkManager.GetHostPlayer()) == TRUE) + { + removeControl( &m_buttonKick, true ); + } + } + + short colourIndex = app.GetPlayerColour( m_networkSmallId ); + IggyDataValue result; + IggyDataValue value[1]; + value[0].type = IGGY_DATATYPE_number; + value[0].number = colourIndex; + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetPlayerIcon , 1 , value ); +} + void UIScene_InGamePlayerOptionsMenu::tick() { UIScene::tick(); @@ -352,7 +438,7 @@ void UIScene_InGamePlayerOptionsMenu::handlePress(F64 controlId, F64 childId) uiIDA[0]=IDS_CONFIRM_OK; uiIDA[1]=IDS_CONFIRM_CANCEL; - ui.RequestMessageBox(IDS_UNLOCK_KICK_PLAYER_TITLE, IDS_UNLOCK_KICK_PLAYER, uiIDA, 2, m_iPad,&UIScene_InGamePlayerOptionsMenu::KickPlayerReturned,smallId,app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_UNLOCK_KICK_PLAYER_TITLE, IDS_UNLOCK_KICK_PLAYER, uiIDA, 2, m_iPad,&UIScene_InGamePlayerOptionsMenu::KickPlayerReturned,smallId); } break; }; diff --git a/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.h b/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.h index 78e30f6e..e78b6748 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_InGamePlayerOptionsMenu.h @@ -62,6 +62,8 @@ public: virtual EUIScene getSceneType() { return eUIScene_InGamePlayerOptionsMenu;} virtual void updateTooltips(); + virtual void handleReload(); + protected: // TODO: This should be pure virtual in this class virtual wstring getMoviePath(); diff --git a/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp b/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp index b0dbc59f..fa2c7e61 100644 --- a/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_InGameSaveManagementMenu.cpp @@ -442,7 +442,7 @@ void UIScene_InGameSaveManagementMenu::handlePress(F64 controlId, F64 childId) UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2,m_iPad,&UIScene_InGameSaveManagementMenu::DeleteSaveDialogReturned,this, app.GetStringTable(),NULL,0,true); + ui.RequestErrorMessage(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2,m_iPad,&UIScene_InGameSaveManagementMenu::DeleteSaveDialogReturned,this); ui.PlayUISFX(eSFX_Press); break; diff --git a/Minecraft.Client/Common/UI/UIScene_Intro.cpp b/Minecraft.Client/Common/UI/UIScene_Intro.cpp index 2c50612f..7fc435b2 100644 --- a/Minecraft.Client/Common/UI/UIScene_Intro.cpp +++ b/Minecraft.Client/Common/UI/UIScene_Intro.cpp @@ -11,12 +11,16 @@ UIScene_Intro::UIScene_Intro(int iPad, void *initData, UILayer *parentLayer) : U m_bAnimationEnded = false; bool bSkipESRB = false; + bool bChina = false; #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) bSkipESRB = app.GetProductSKU() != e_sku_SCEA; #elif defined(_XBOX) || defined(_DURANGO) bSkipESRB = !ProfileManager.LocaleIsUSorCanada(); #endif +#ifdef _DURANGO + bChina = ProfileManager.LocaleIsChina(); +#endif // 4J Stu - These map to values in the Actionscript #ifdef _WINDOWS64 int platformIdx = 0; @@ -33,13 +37,17 @@ UIScene_Intro::UIScene_Intro(int iPad, void *initData, UILayer *parentLayer) : U #endif IggyDataValue result; - IggyDataValue value[2]; + IggyDataValue value[3]; value[0].type = IGGY_DATATYPE_number; value[0].number = platformIdx; value[1].type = IGGY_DATATYPE_boolean; - value[1].boolval = bSkipESRB; - IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetIntroPlatform , 2 , value ); + value[1].boolval = bChina?true:bSkipESRB; + + value[2].type = IGGY_DATATYPE_boolean; + value[2].boolval = bChina; + + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetIntroPlatform , 3 , value ); #ifdef __PSVITA__ // initialise vita touch controls with ids diff --git a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp index cad86dce..c036f7bf 100644 --- a/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_JoinMenu.cpp @@ -140,6 +140,10 @@ void UIScene_JoinMenu::tick() { m_labelValues[eLabel_GameType].init( app.GetString(IDS_CREATIVE) ); } + else if(option == GameType::ADVENTURE->getId()) + { + m_labelValues[eLabel_GameType].init( app.GetString(IDS_ADVENTURE) ); + } else { m_labelValues[eLabel_GameType].init( app.GetString(IDS_SURVIVAL) ); @@ -209,9 +213,9 @@ void UIScene_JoinMenu::tick() UINT uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; #ifdef _XBOX_ONE - ui.RequestMessageBox( IDS_CONNECTION_FAILED, IDS_DISCONNECTED_SERVER_QUIT, uiIDA,1,m_iPad,ErrorDialogReturned,this, app.GetStringTable()); + ui.RequestErrorMessage( IDS_CONNECTION_FAILED, IDS_DISCONNECTED_SERVER_QUIT, uiIDA,1,m_iPad,ErrorDialogReturned,this); #else - ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA,1,m_iPad,ErrorDialogReturned,this, app.GetStringTable()); + ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA,1,m_iPad,ErrorDialogReturned,this); #endif } @@ -307,7 +311,7 @@ void UIScene_JoinMenu::handlePress(F64 controlId, F64 childId) ui.PlayUISFX(eSFX_Press); #ifdef _DURANGO - ProfileManager.CheckMultiplayerPrivileges(m_iPad, true, &checkPrivilegeCallback, this); + ProfileManager.CheckMultiplayerPrivileges(m_iPad, true, &checkPrivilegeCallback, (LPVOID)GetCallbackUniqueId()); #else StartSharedLaunchFlow(); #endif @@ -331,15 +335,18 @@ void UIScene_JoinMenu::handleFocusChange(F64 controlId, F64 childId) #ifdef _DURANGO void UIScene_JoinMenu::checkPrivilegeCallback(LPVOID lpParam, bool hasPrivilege, int iPad) { - UIScene_JoinMenu* pClass = (UIScene_JoinMenu*)lpParam; + UIScene_JoinMenu* pClass = (UIScene_JoinMenu*)ui.GetSceneFromCallbackId((size_t)lpParam); - if(hasPrivilege) - { - pClass->StartSharedLaunchFlow(); -} - else + if(pClass) { - pClass->m_bIgnoreInput = false; + if(hasPrivilege) + { + pClass->StartSharedLaunchFlow(); + } + else + { + pClass->m_bIgnoreInput = false; + } } } #endif @@ -355,7 +362,7 @@ void UIScene_JoinMenu::StartSharedLaunchFlow() //ProfileManager.RequestSignInUI(false, false, false, true, false,&UIScene_JoinMenu::StartGame_SignInReturned, this,ProfileManager.GetPrimaryPad()); SignInInfo info; info.Func = &UIScene_JoinMenu::StartGame_SignInReturned; - info.lpParam = this; + info.lpParam = (LPVOID)GetCallbackUniqueId(); info.requireOnline = true; ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_QuadrantSignin,&info); } @@ -363,24 +370,27 @@ void UIScene_JoinMenu::StartSharedLaunchFlow() int UIScene_JoinMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int iPad) { - UIScene_JoinMenu* pClass = (UIScene_JoinMenu*)pParam; + UIScene_JoinMenu* pClass = (UIScene_JoinMenu*)ui.GetSceneFromCallbackId((size_t)pParam); - if(bContinue==true) + if(pClass) { - // It's possible that the player has not signed in - they can back out - if(ProfileManager.IsSignedIn(iPad)) + if(bContinue==true) { - JoinGame(pClass); + // It's possible that the player has not signed in - they can back out + if(ProfileManager.IsSignedIn(iPad)) + { + JoinGame(pClass); + } + else + { + pClass->m_bIgnoreInput=false; + } } else { pClass->m_bIgnoreInput=false; } } - else - { - pClass->m_bIgnoreInput=false; - } return 0; } @@ -442,7 +452,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) // 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 #endif @@ -450,7 +460,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) 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()); + ui.RequestErrorMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad()); } return; } @@ -495,7 +505,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) pClass->m_bIgnoreInput=false; UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); + ui.RequestErrorMessage( IDS_NO_MULTIPLAYER_PRIVILEGE_TITLE, IDS_NO_MULTIPLAYER_PRIVILEGE_JOIN_TEXT, uiIDA,1,ProfileManager.GetPrimaryPad()); } else { @@ -530,7 +540,7 @@ void UIScene_JoinMenu::JoinGame(UIScene_JoinMenu* pClass) { 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; ui.NavigateToHomeMenu(); diff --git a/Minecraft.Client/Common/UI/UIScene_LanguageSelector.cpp b/Minecraft.Client/Common/UI/UIScene_LanguageSelector.cpp new file mode 100644 index 00000000..e9dc7eb9 --- /dev/null +++ b/Minecraft.Client/Common/UI/UIScene_LanguageSelector.cpp @@ -0,0 +1,129 @@ +#include "stdafx.h" +#include "UI.h" +#include "UIScene_LanguageSelector.h" + +// strings for buttons in the list +const unsigned int UIScene_LanguageSelector::m_uiHTPButtonNameA[]= +{ + HAS_LANGUAGE_SYSTEM(IDS_LANG_SYSTEM) + HAS_LANGUAGE_EN_US(IDS_LANG_ENGLISH) + HAS_LANGUAGE_DE_DE(IDS_LANG_GERMAN) + HAS_LANGUAGE_ES_ES(IDS_LANG_SPANISH_SPAIN) + HAS_LANGUAGE_ES_MX(IDS_LANG_SPANISH_LATIN_AMERICA) + HAS_LANGUAGE_FR_FR(IDS_LANG_FRENCH) + HAS_LANGUAGE_IT_IT(IDS_LANG_ITALIAN) + HAS_LANGUAGE_PT_PT(IDS_LANG_PORTUGUESE_PORTUGAL) + HAS_LANGUAGE_PT_BR(IDS_LANG_PORTUGUESE_BRAZIL) + HAS_LANGUAGE_JA_JP(IDS_LANG_JAPANESE) + HAS_LANGUAGE_KO_KR(IDS_LANG_KOREAN) + HAS_LANGUAGE_CN_TW(IDS_LANG_CHINESE_TRADITIONAL) + HAS_LANGUAGE_CN_CN(IDS_LANG_CHINESE_SIMPLIFIED) + HAS_LANGUAGE_DA_DK(IDS_LANG_DANISH) + HAS_LANGUAGE_FI_FI(IDS_LANG_FINISH) + HAS_LANGUAGE_NL_NL(IDS_LANG_DUTCH) + HAS_LANGUAGE_PL_PL(IDS_LANG_POLISH) + HAS_LANGUAGE_RU_RU(IDS_LANG_RUSSIAN) + HAS_LANGUAGE_SV_SE(IDS_LANG_SWEDISH) + HAS_LANGUAGE_NB_NO(IDS_LANG_NORWEGIAN) + HAS_LANGUAGE_SK_SK(IDS_LANG_SLOVAK) + HAS_LANGUAGE_CZ_CZ(IDS_LANG_CZECH) + HAS_LANGUAGE_EL_GR(IDS_LANG_GREEK) + HAS_LANGUAGE_TR_TR(IDS_LANG_TURKISH) +}; + + +UIScene_LanguageSelector::UIScene_LanguageSelector(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) +{ + // Setup all the Iggy references we need for this scene + initialiseMovie(); + + m_buttonListHowTo.init(eControl_Buttons); + + for(unsigned int i = 0; i < eLanguageSelector_MAX; ++i) + { + m_buttonListHowTo.addItem( m_uiHTPButtonNameA[i] , i); + } +} + +wstring UIScene_LanguageSelector::getMoviePath() +{ + if (app.GetLocalPlayerCount() > 1) return L"LanguagesMenuSplit"; + else return L"LanguagesMenu"; +} + +void UIScene_LanguageSelector::updateTooltips() +{ + ui.SetTooltips( m_iPad, IDS_TOOLTIPS_SELECT, IDS_TOOLTIPS_BACK); +} + +void UIScene_LanguageSelector::updateComponents() +{ + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + if(bNotInGame) + { + m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); + m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true); + } + else + { + m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,false); + + if( app.GetLocalPlayerCount() == 1 ) m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true); + else m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,false); + } +} + +void UIScene_LanguageSelector::handleReload() +{ + for (unsigned int i = 0; i < eLanguageSelector_MAX; ++i) + { + m_buttonListHowTo.addItem( m_uiHTPButtonNameA[i], i); + } +} + +void UIScene_LanguageSelector::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) +{ + //app.DebugPrintf("UIScene_DebugOverlay handling input for pad %d, key %d, down- %s, pressed- %s, released- %s\n", iPad, key, down?"TRUE":"FALSE", pressed?"TRUE":"FALSE", released?"TRUE":"FALSE"); + ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released); + + switch(key) + { + case ACTION_MENU_CANCEL: + if(pressed) + { + navigateBack(); + //ui.NavigateToScene(m_iPad, eUIScene_SettingsOptionsMenu); + } + break; + case ACTION_MENU_OK: +#ifdef __ORBIS__ + case ACTION_MENU_TOUCHPAD_PRESS: +#endif + sendInputToMovie(key, repeat, pressed, released); + break; + case ACTION_MENU_UP: + case ACTION_MENU_DOWN: + case ACTION_MENU_PAGEUP: + case ACTION_MENU_PAGEDOWN: + sendInputToMovie(key, repeat, pressed, released); + break; + } +} + +void UIScene_LanguageSelector::handlePress(F64 controlId, F64 childId) +{ + if( (int)controlId == eControl_Buttons ) + { + //CD - Added for audio + ui.PlayUISFX(eSFX_Press); + + int newLanguage, newLocale; + newLanguage = uiLangMap[(int)childId]; + newLocale = uiLocaleMap[(int)childId]; + + app.SetMinecraftLanguage(m_iPad, newLanguage); + app.SetMinecraftLocale(m_iPad, newLocale); + + app.CheckGameSettingsChanged(true, m_iPad); + } +} diff --git a/Minecraft.Client/Common/UI/UIScene_LanguageSelector.h b/Minecraft.Client/Common/UI/UIScene_LanguageSelector.h new file mode 100644 index 00000000..b5c3d4c6 --- /dev/null +++ b/Minecraft.Client/Common/UI/UIScene_LanguageSelector.h @@ -0,0 +1,165 @@ +#pragma once + +#include "UIScene.h" + +#define HAS_LANGUAGE_SYSTEM(exp) exp, + +#define HAS_LANGUAGE_EN_US(exp) exp, +#define HAS_LANGUAGE_DE_DE(exp) exp, +#define HAS_LANGUAGE_ES_ES(exp) exp, +#define HAS_LANGUAGE_ES_MX(exp) exp, +#define HAS_LANGUAGE_FR_FR(exp) exp, +#define HAS_LANGUAGE_IT_IT(exp) exp, +#define HAS_LANGUAGE_PT_PT(exp) exp, +#define HAS_LANGUAGE_PT_BR(exp) exp, +#define HAS_LANGUAGE_JA_JP(exp) exp, +#define HAS_LANGUAGE_KO_KR(exp) exp, +#define HAS_LANGUAGE_CN_TW(exp) exp, + +#ifdef _DURANGO +#define HAS_LANGUAGE_CN_CN(exp) exp, +#define HAS_LANGUAGE_SK_SK(exp) exp, +#define HAS_LANGUAGE_CZ_CZ(exp) exp, +#else +#define HAS_LANGUAGE_CN_CN(exp) +#define HAS_LANGUAGE_SK_SK(exp) +#define HAS_LANGUAGE_CZ_CZ(exp) +#endif + +#define HAS_LANGUAGE_DA_DK(exp) exp, +#define HAS_LANGUAGE_FI_FI(exp) exp, +#define HAS_LANGUAGE_NL_NL(exp) exp, +#define HAS_LANGUAGE_PL_PL(exp) exp, +#define HAS_LANGUAGE_RU_RU(exp) exp, +#define HAS_LANGUAGE_SV_SE(exp) exp, +#define HAS_LANGUAGE_NB_NO(exp) exp, +#define HAS_LANGUAGE_EL_GR(exp) exp, + +#if defined(__ORBIS__) || defined(__PS3__) || defined(__PSVITA__) +#define HAS_LANGUAGE_TR_TR(exp) exp, +#else +#define HAS_LANGUAGE_TR_TR(exp) +#endif + +class UIScene_LanguageSelector : public UIScene +{ +public: + enum ELangButtons + { + eLanguageSelector_LabelNone = -1, + HAS_LANGUAGE_SYSTEM(eLanguageSelector_system) + HAS_LANGUAGE_EN_US(eLanguageSelector_EN_US) + HAS_LANGUAGE_DE_DE(eLanguageSelector_DE_DE) + HAS_LANGUAGE_ES_ES(eLanguageSelector_ES_ES) + HAS_LANGUAGE_ES_MX(eLanguageSelector_ES_MX) + HAS_LANGUAGE_FR_FR(eLanguageSelector_FR_FR) + HAS_LANGUAGE_IT_IT(eLanguageSelector_IT_IT) + HAS_LANGUAGE_PT_PT(eLanguageSelector_PT_PT) + HAS_LANGUAGE_PT_BR(eLanguageSelector_PT_BR) + HAS_LANGUAGE_JA_JP(eLanguageSelector_JA_JP) + HAS_LANGUAGE_KO_KR(eLanguageSelector_KO_KR) + HAS_LANGUAGE_CN_TW(eLanguageSelector_CN_TW) + HAS_LANGUAGE_CN_CN(eLanguageSelector_CN_CN) + HAS_LANGUAGE_DA_DK(eLanguageSelector_DA_DK) + HAS_LANGUAGE_FI_FI(eLanguageSelector_FI_FI) + HAS_LANGUAGE_NL_NL(eLanguageSelector_NL_NL) + HAS_LANGUAGE_PL_PL(eLanguageSelector_PL_PL) + HAS_LANGUAGE_RU_RU(eLanguageSelector_RU_RU) + HAS_LANGUAGE_SV_SE(eLanguageSelector_SV_SE) + HAS_LANGUAGE_NB_NO(eLanguageSelector_NB_NO) + HAS_LANGUAGE_SK_SK(eLanguageSelector_SK_SK) + HAS_LANGUAGE_CZ_CZ(eLanguageSelector_CZ_CZ) + HAS_LANGUAGE_EL_GR(eLanguageSelector_EL_GR) + HAS_LANGUAGE_TR_TR(eLanguageSelector_TR_TR) + eLanguageSelector_MAX + }; + +private: + enum EControls + { + eControl_Buttons, + }; + + static const unsigned int m_uiHTPButtonNameA[eLanguageSelector_MAX]; + + UIControl_DynamicButtonList m_buttonListHowTo; + UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) + UI_MAP_ELEMENT( m_buttonListHowTo, "HowToList") + UI_END_MAP_ELEMENTS_AND_NAMES() + +public: + UIScene_LanguageSelector(int iPad, void *initData, UILayer *parentLayer); + + virtual EUIScene getSceneType() { return eUIScene_LanguageSelector; } + + virtual void updateTooltips(); + virtual void updateComponents(); + + virtual void handleReload(); +protected: + // TODO: This should be pure virtual in this class + virtual wstring getMoviePath(); + +public: + // INPUT + virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); + +protected: + void handlePress(F64 controlId, F64 childId); +}; + +const int uiLangMap[UIScene_LanguageSelector::eLanguageSelector_MAX] = +{ + HAS_LANGUAGE_SYSTEM(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_EN_US(XC_LANGUAGE_ENGLISH) + HAS_LANGUAGE_DE_DE(XC_LANGUAGE_GERMAN) + HAS_LANGUAGE_ES_ES(XC_LANGUAGE_SPANISH) + HAS_LANGUAGE_ES_MX(XC_LANGUAGE_SPANISH) + HAS_LANGUAGE_FR_FR(XC_LANGUAGE_FRENCH) + HAS_LANGUAGE_IT_IT(XC_LANGUAGE_ITALIAN) + HAS_LANGUAGE_PT_PT(XC_LANGUAGE_PORTUGUESE) + HAS_LANGUAGE_PT_BR(XC_LANGUAGE_PORTUGUESE) + HAS_LANGUAGE_JA_JP(XC_LANGUAGE_JAPANESE) + HAS_LANGUAGE_KO_KR(XC_LANGUAGE_KOREAN) + HAS_LANGUAGE_CN_TW(XC_LANGUAGE_TCHINESE) + HAS_LANGUAGE_CN_CN(XC_LANGUAGE_SCHINESE) + HAS_LANGUAGE_DA_DK(XC_LANGUAGE_DANISH) + HAS_LANGUAGE_FI_FI(XC_LANGUAGE_FINISH) + HAS_LANGUAGE_NL_NL(XC_LANGUAGE_DUTCH) + HAS_LANGUAGE_PL_PL(XC_LANGUAGE_POLISH) + HAS_LANGUAGE_RU_RU(XC_LANGUAGE_RUSSIAN) + HAS_LANGUAGE_SV_SE(XC_LANGUAGE_SWEDISH) + HAS_LANGUAGE_NB_NO(XC_LANGUAGE_BNORWEGIAN) + HAS_LANGUAGE_SK_SK(XC_LANGUAGE_SLOVAK) + HAS_LANGUAGE_CZ_CZ(XC_LANGUAGE_CZECH) + HAS_LANGUAGE_EL_GR(XC_LANGUAGE_GREEK) + HAS_LANGUAGE_TR_TR(XC_LANGUAGE_TURKISH) +}; + +const int uiLocaleMap[UIScene_LanguageSelector::eLanguageSelector_MAX] = +{ + HAS_LANGUAGE_SYSTEM(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_EN_US(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_DE_DE(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_ES_ES(XC_LOCALE_SPAIN) + HAS_LANGUAGE_ES_MX(XC_LOCALE_LATIN_AMERICA) + HAS_LANGUAGE_FR_FR(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_IT_IT(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_PT_PT(XC_LOCALE_PORTUGAL) + HAS_LANGUAGE_PT_BR(XC_LOCALE_BRAZIL) + HAS_LANGUAGE_JA_JP(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_KO_KR(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_CN_TW(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_CN_CN(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_DA_DK(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_FI_FI(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_NL_NL(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_PL_PL(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_RU_RU(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_SV_SE(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_NB_NO(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_SK_SK(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_CZ_CZ(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_EL_GR(MINECRAFT_LANGUAGE_DEFAULT) + HAS_LANGUAGE_TR_TR(MINECRAFT_LANGUAGE_DEFAULT) +};
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp index 6d472b50..d6f89832 100644 --- a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.cpp @@ -25,10 +25,28 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu(int iPad, void *ini m_labelWorldOptions.init(app.GetString(IDS_WORLD_OPTIONS)); IggyDataValue result; + +#ifdef _LARGE_WORLDS + IggyDataValue value[2]; + value[0].type = IGGY_DATATYPE_number; + value[0].number = m_params->bGenerateOptions ? 0 : 1; + value[1].type = IGGY_DATATYPE_boolean; + value[1].boolval = false; + if(m_params->currentWorldSize == e_worldSize_Classic || + m_params->currentWorldSize == e_worldSize_Small || + m_params->currentWorldSize == e_worldSize_Medium ) + { + // don't show the increase world size stuff if we're already large, or the size is unknown. + value[1].boolval = true; + } + + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetMenuType , 2 , value ); +#else IggyDataValue value[1]; value[0].type = IGGY_DATATYPE_number; - value[0].number = m_params->bGenerateOptions?0:1; + value[0].number = m_params->bGenerateOptions ? 0 : 1; IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetMenuType , 1 , value ); +#endif m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_params->iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_params->iPad); @@ -54,11 +72,15 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu(int iPad, void *ini } else if(!m_params->bOnlineGame) { - m_checkboxes[eLaunchCheckbox_InviteOnly].SetEnable(false); m_checkboxes[eLaunchCheckbox_AllowFoF].SetEnable(false); } + // Init cheats + m_bUpdateCheats = false; + // Update cheat checkboxes + UpdateCheats(); + m_checkboxes[eLaunchCheckbox_Online].init(app.GetString(IDS_ONLINE_GAME),eLaunchCheckbox_Online,bOnlineGame); m_checkboxes[eLaunchCheckbox_InviteOnly].init(app.GetString(IDS_INVITE_ONLY),eLaunchCheckbox_InviteOnly,bInviteOnly); m_checkboxes[eLaunchCheckbox_AllowFoF].init(app.GetString(IDS_ALLOWFRIENDSOFFRIENDS),eLaunchCheckbox_AllowFoF,bAllowFriendsOfFriends); @@ -72,19 +94,35 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu(int iPad, void *ini m_checkboxes[eLaunchCheckbox_FlatWorld].init(app.GetString(IDS_SUPERFLAT_WORLD),eLaunchCheckbox_FlatWorld,m_params->bFlatWorld); m_checkboxes[eLaunchCheckbox_BonusChest].init(app.GetString(IDS_BONUS_CHEST),eLaunchCheckbox_BonusChest,m_params->bBonusChest); - if(m_loadedResolution == eSceneResolution_1080) - { + m_checkboxes[eLaunchCheckbox_KeepInventory].init(app.GetString(IDS_KEEP_INVENTORY), eLaunchCheckbox_KeepInventory, m_params->bKeepInventory); + m_checkboxes[eLaunchCheckbox_MobSpawning].init(app.GetString(IDS_MOB_SPAWNING), eLaunchCheckbox_MobSpawning, m_params->bDoMobSpawning); + m_checkboxes[eLaunchCheckbox_MobLoot].init(app.GetString(IDS_MOB_LOOT), eLaunchCheckbox_MobLoot, m_params->bDoMobLoot); + m_checkboxes[eLaunchCheckbox_MobGriefing].init(app.GetString(IDS_MOB_GRIEFING), eLaunchCheckbox_MobGriefing, m_params->bMobGriefing); + m_checkboxes[eLaunchCheckbox_TileDrops].init(app.GetString(IDS_TILE_DROPS), eLaunchCheckbox_TileDrops, m_params->bDoTileDrops); + m_checkboxes[eLaunchCheckbox_NaturalRegeneration].init(app.GetString(IDS_NATURAL_REGEN), eLaunchCheckbox_NaturalRegeneration, m_params->bNaturalRegeneration); + m_checkboxes[eLaunchCheckbox_DayLightCycle].init(app.GetString(IDS_DAYLIGHT_CYCLE), eLaunchCheckbox_DayLightCycle, m_params->bDoDaylightCycle); + + m_labelGameOptions.init( app.GetString(IDS_GAME_OPTIONS) ); + m_labelSeed.init(app.GetString(IDS_CREATE_NEW_WORLD_SEED)); + m_labelRandomSeed.init(app.GetString(IDS_CREATE_NEW_WORLD_RANDOM_SEED)); + m_editSeed.init(m_params->seed, eControl_EditSeed); + #ifdef _LARGE_WORLDS - m_labelGameOptions.init( app.GetString(IDS_GAME_OPTIONS) ); - m_labelSeed.init(app.GetString(IDS_CREATE_NEW_WORLD_SEED)); - m_labelRandomSeed.init(app.GetString(IDS_CREATE_NEW_WORLD_RANDOM_SEED)); - m_editSeed.init(m_params->seed, eControl_EditSeed); - m_labelWorldSize.init(app.GetString(IDS_WORLD_SIZE)); - m_sliderWorldSize.init(app.GetString(m_iWorldSizeTitleA[m_params->worldSize]),eControl_WorldSize,0,3,m_params->worldSize); - - m_checkboxes[eLaunchCheckbox_DisableSaving].init( app.GetString(IDS_DISABLE_SAVING), eLaunchCheckbox_DisableSaving, m_params->bDisableSaving ); -#endif + m_labelWorldSize.init(app.GetString(IDS_WORLD_SIZE)); + m_sliderWorldSize.init(app.GetString(m_iWorldSizeTitleA[m_params->worldSize]),eControl_WorldSize,0,3,m_params->worldSize); + + m_checkboxes[eLaunchCheckbox_DisableSaving].init( app.GetString(IDS_DISABLE_SAVING), eLaunchCheckbox_DisableSaving, m_params->bDisableSaving ); + + if(m_params->currentWorldSize != e_worldSize_Unknown) + { + m_labelWorldResize.init(app.GetString(IDS_INCREASE_WORLD_SIZE)); + int min= int(m_params->currentWorldSize)-1; + int max=3; + int curr = int(m_params->newWorldSize)-1; + m_sliderWorldResize.init(app.GetString(m_iWorldSizeTitleA[curr]),eControl_WorldResize,min,max,curr); + m_checkboxes[eLaunchCheckbox_WorldResizeType].init(app.GetString(IDS_INCREASE_WORLD_SIZE_OVERWRITE_EDGES),eLaunchCheckbox_WorldResizeType,m_params->newWorldSizeOverwriteEdges); } +#endif // Only the Xbox 360 needs a reset nether // 4J-PB - PS3 needs it now @@ -92,6 +130,8 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu(int iPad, void *ini // if(!m_params->bGenerateOptions) removeControl( &m_checkboxes[eLaunchCheckbox_ResetNether], false ); // #endif + m_tabIndex = m_params->bGenerateOptions ? TAB_WORLD_OPTIONS : TAB_GAME_OPTIONS; + // set the default text #ifdef _LARGE_WORLDS wstring wsText=L""; @@ -114,36 +154,37 @@ UIScene_LaunchMoreOptionsMenu::UIScene_LaunchMoreOptionsMenu(int iPad, void *ini wchar_t startTags[64]; swprintf(startTags,64,L"<font color=\"#%08x\">",app.GetHTMLColour(eHTMLColor_White)); wsText= startTags + wsText; - m_labelDescription.init(wsText); + if (m_tabIndex == TAB_WORLD_OPTIONS) + m_labelDescription_WorldOptions.setLabel(wsText); + else + m_labelDescription_GameOptions.setLabel(wsText); addTimer(GAME_CREATE_ONLINE_TIMER_ID,GAME_CREATE_ONLINE_TIMER_TIME); #ifdef __PSVITA__ + // initialise vita tab controls with ids + m_TouchTabWorld.init(ETouchInput_TabWorld); + m_TouchTabGame.init(ETouchInput_TabGame); + ui.TouchBoxRebuild(this); #endif m_bIgnoreInput = false; - m_tabIndex = 0; } void UIScene_LaunchMoreOptionsMenu::updateTooltips() { int changeTabTooltip = -1; -#ifdef _LARGE_WORLDS - if (m_loadedResolution == eSceneResolution_1080 && m_params->bGenerateOptions) + // Set tooltip for change tab (only two tabs) + if (m_tabIndex == TAB_GAME_OPTIONS) { - // Set tooltip for change tab (only two tabs) - if (m_tabIndex == 0) - { - changeTabTooltip = IDS_GAME_OPTIONS; - } - else - { - changeTabTooltip = IDS_WORLD_OPTIONS; - } + changeTabTooltip = IDS_WORLD_OPTIONS; + } + else + { + changeTabTooltip = IDS_GAME_OPTIONS; } -#endif // If there's a change tab tooltip, left bumper symbol should show but not the text (-2) int lb = changeTabTooltip == -1 ? -1 : -2; @@ -154,11 +195,11 @@ void UIScene_LaunchMoreOptionsMenu::updateTooltips() void UIScene_LaunchMoreOptionsMenu::updateComponents() { m_parentLayer->showComponent(m_iPad,eUIComponent_Panorama,true); -#ifdef _LARGE_WORLDS - m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true); -#else +//#ifdef _LARGE_WORLDS +// m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,true); +//#else m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,false); -#endif +//#endif } wstring UIScene_LaunchMoreOptionsMenu::getMoviePath() @@ -186,6 +227,19 @@ void UIScene_LaunchMoreOptionsMenu::tick() m_bMultiplayerAllowed = bMultiplayerAllowed; } + + // Check cheats + if (m_bUpdateCheats) + { + UpdateCheats(); + m_bUpdateCheats = false; + } + // check online + if(m_bUpdateOnline) + { + UpdateOnline(); + m_bUpdateOnline = false; + } } void UIScene_LaunchMoreOptionsMenu::handleDestroy() @@ -227,7 +281,7 @@ void UIScene_LaunchMoreOptionsMenu::handleInput(int iPad, int key, bool repeat, if ( pressed && controlHasFocus( checkboxOnline->getId()) && !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 @@ -245,7 +299,7 @@ void UIScene_LaunchMoreOptionsMenu::handleInput(int iPad, int key, bool repeat, break; case ACTION_MENU_LEFT_SCROLL: case ACTION_MENU_RIGHT_SCROLL: - if(pressed && m_loadedResolution == eSceneResolution_1080) + if(pressed) { // Toggle tab index m_tabIndex = m_tabIndex == 0 ? 1 : 0; @@ -257,6 +311,39 @@ void UIScene_LaunchMoreOptionsMenu::handleInput(int iPad, int key, bool repeat, } } +#ifdef __PSVITA__ +void UIScene_LaunchMoreOptionsMenu::handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased) +{ + if(bPressed) + { + switch(iId) + { + case ETouchInput_TabWorld: + case ETouchInput_TabGame: + // Toggle tab index + int iNewTabIndex = (iId == ETouchInput_TabWorld) ? 0 : 1; + if(m_tabIndex != iNewTabIndex) + { + m_tabIndex = iNewTabIndex; + updateTooltips(); + IggyDataValue result; + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcChangeTab , 0 , NULL ); + } + ui.TouchBoxRebuild(this); + break; + } + } +} + +UIControl* UIScene_LaunchMoreOptionsMenu::GetMainPanel() +{ + if(m_tabIndex == 0) + return &m_worldOptions; + else + return &m_gameOptions; +} +#endif + void UIScene_LaunchMoreOptionsMenu::handleCheckboxToggled(F64 controlId, bool selected) { //CD - Added for audio @@ -266,6 +353,7 @@ void UIScene_LaunchMoreOptionsMenu::handleCheckboxToggled(F64 controlId, bool se { case eLaunchCheckbox_Online: m_params->bOnlineGame = selected; + m_bUpdateOnline = true; break; case eLaunchCheckbox_InviteOnly: m_params->bInviteOnly = selected; @@ -287,6 +375,7 @@ void UIScene_LaunchMoreOptionsMenu::handleCheckboxToggled(F64 controlId, bool se break; case eLaunchCheckbox_HostPrivileges: m_params->bHostPrivileges = selected; + m_bUpdateCheats = true; break; case eLaunchCheckbox_ResetNether: m_params->bResetNether = selected; @@ -300,9 +389,34 @@ void UIScene_LaunchMoreOptionsMenu::handleCheckboxToggled(F64 controlId, bool se case eLaunchCheckbox_BonusChest: m_params->bBonusChest = selected; break; +#ifdef _LARGE_WORLDS case eLaunchCheckbox_DisableSaving: m_params->bDisableSaving = selected; break; + case eLaunchCheckbox_WorldResizeType: + m_params->newWorldSizeOverwriteEdges = selected; + break; +#endif + case eLaunchCheckbox_KeepInventory: + m_params->bKeepInventory = selected; + break; + case eLaunchCheckbox_MobSpawning: + m_params->bDoMobSpawning = selected; + break; + case eLaunchCheckbox_MobLoot: + m_params->bDoMobLoot = selected; + case eLaunchCheckbox_MobGriefing: + m_params->bMobGriefing = selected; + break; + case eLaunchCheckbox_TileDrops: + m_params->bDoTileDrops = selected; + break; + case eLaunchCheckbox_NaturalRegeneration: + m_params->bNaturalRegeneration = selected; + break; + case eLaunchCheckbox_DayLightCycle: + m_params->bDoDaylightCycle = selected; + break; }; } @@ -347,16 +461,43 @@ void UIScene_LaunchMoreOptionsMenu::handleFocusChange(F64 controlId, F64 childId case eLaunchCheckbox_BonusChest: stringId = IDS_GAMEOPTION_BONUS_CHEST; break; -#ifdef _LARGE_WORLDS + case eLaunchCheckbox_KeepInventory: + stringId = IDS_GAMEOPTION_KEEP_INVENTORY; + break; + case eLaunchCheckbox_MobSpawning: + stringId = IDS_GAMEOPTION_MOB_SPAWNING; + break; + case eLaunchCheckbox_MobLoot: + stringId = IDS_GAMEOPTION_MOB_LOOT; // PLACEHOLDER + break; + case eLaunchCheckbox_MobGriefing: + stringId = IDS_GAMEOPTION_MOB_GRIEFING; // PLACEHOLDER + break; + case eLaunchCheckbox_TileDrops: + stringId = IDS_GAMEOPTION_TILE_DROPS; + break; + case eLaunchCheckbox_NaturalRegeneration: + stringId = IDS_GAMEOPTION_NATURAL_REGEN; + break; + case eLaunchCheckbox_DayLightCycle: + stringId = IDS_GAMEOPTION_DAYLIGHT_CYCLE; + break; case eControl_EditSeed: stringId = IDS_GAMEOPTION_SEED; break; +#ifdef _LARGE_WORLDS case eControl_WorldSize: stringId = IDS_GAMEOPTION_WORLD_SIZE; break; + case eControl_WorldResize: + stringId = IDS_GAMEOPTION_INCREASE_WORLD_SIZE; + break; case eLaunchCheckbox_DisableSaving: stringId = IDS_GAMEOPTION_DISABLE_SAVING; break; + case eLaunchCheckbox_WorldResizeType: + stringId = IDS_GAMEOPTION_INCREASE_WORLD_SIZE_OVERWRITE_EDGES; + break; #endif }; @@ -368,9 +509,12 @@ void UIScene_LaunchMoreOptionsMenu::handleFocusChange(F64 controlId, F64 childId } wchar_t startTags[64]; swprintf(startTags,64,L"<font color=\"#%08x\">",app.GetHTMLColour(eHTMLColor_White)); - wsText= startTags + wsText; + wsText = startTags + wsText; - m_labelDescription.setLabel(wsText); + if (m_tabIndex == TAB_WORLD_OPTIONS) + m_labelDescription_WorldOptions.setLabel(wsText); + else + m_labelDescription_GameOptions.setLabel(wsText); } void UIScene_LaunchMoreOptionsMenu::handleTimerComplete(int id) @@ -405,8 +549,14 @@ int UIScene_LaunchMoreOptionsMenu::KeyboardCompleteSeedCallback(LPVOID lpParam,b // 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_params->seed = (wchar_t *)pchText; @@ -458,5 +608,48 @@ void UIScene_LaunchMoreOptionsMenu::handleSliderMove(F64 sliderId, F64 currentVa m_sliderWorldSize.setLabel(app.GetString(m_iWorldSizeTitleA[value])); #endif break; + case eControl_WorldResize: +#ifdef _LARGE_WORLDS + EGameHostOptionWorldSize changedSize = EGameHostOptionWorldSize(value+1); + if(changedSize >= m_params->currentWorldSize) + { + m_sliderWorldResize.handleSliderMove(value); + m_params->newWorldSize = EGameHostOptionWorldSize(value+1); + m_sliderWorldResize.setLabel(app.GetString(m_iWorldSizeTitleA[value])); + } +#endif + break; } } + +void UIScene_LaunchMoreOptionsMenu::UpdateCheats() +{ + bool cheatsOn = m_params->bHostPrivileges; + + m_checkboxes[eLaunchCheckbox_KeepInventory].SetEnable(cheatsOn); + m_checkboxes[eLaunchCheckbox_MobSpawning].SetEnable(cheatsOn); + m_checkboxes[eLaunchCheckbox_MobGriefing].SetEnable(cheatsOn); + m_checkboxes[eLaunchCheckbox_DayLightCycle].SetEnable(cheatsOn); + + if (!cheatsOn) + { + // Set defaults + m_params->bMobGriefing = true; + m_params->bKeepInventory = false; + m_params->bDoMobSpawning = true; + m_params->bDoDaylightCycle = true; + + m_checkboxes[eLaunchCheckbox_KeepInventory].setChecked(m_params->bKeepInventory); + m_checkboxes[eLaunchCheckbox_MobSpawning].setChecked(m_params->bDoMobSpawning); + m_checkboxes[eLaunchCheckbox_MobGriefing].setChecked(m_params->bMobGriefing); + m_checkboxes[eLaunchCheckbox_DayLightCycle].setChecked(m_params->bDoDaylightCycle); + } +} + +void UIScene_LaunchMoreOptionsMenu::UpdateOnline() +{ + bool bOnline = m_params->bOnlineGame; + + m_checkboxes[eLaunchCheckbox_InviteOnly].SetEnable(bOnline); + m_checkboxes[eLaunchCheckbox_AllowFoF].SetEnable(bOnline); +}
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.h b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.h index 62d75115..367db10d 100644 --- a/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_LaunchMoreOptionsMenu.h @@ -5,6 +5,9 @@ class UIScene_LaunchMoreOptionsMenu : public UIScene { private: + static const int TAB_WORLD_OPTIONS = 0; + static const int TAB_GAME_OPTIONS = 1; + enum EControls { // Add all checkboxes at the start as they also index into a checkboxes array @@ -21,81 +24,106 @@ private: eLaunchCheckbox_FlatWorld, eLaunchCheckbox_BonusChest, eLaunchCheckbox_DisableSaving, + eLaunchCheckbox_WorldResizeType, + eLaunchCheckbox_KeepInventory, + eLaunchCheckbox_MobSpawning, + eLaunchCheckbox_MobLoot, + eLaunchCheckbox_MobGriefing, + eLaunchCheckbox_TileDrops, + eLaunchCheckbox_NaturalRegeneration, + eLaunchCheckbox_DayLightCycle, eLaunchCheckboxes_Count, eControl_EditSeed, eControl_WorldSize, + eControl_WorldResize, + + eControl_Count }; +#ifdef __PSVITA__ + enum ETouchInput + { + ETouchInput_TabWorld = eControl_Count, + ETouchInput_TabGame, + + ETouchInput_Count + }; + UIControl_Touch m_TouchTabWorld, m_TouchTabGame; + UIControl m_controlWorldPanel, m_controlGamePanel; +#endif UIControl m_gameOptions, m_worldOptions; UIControl_CheckBox m_checkboxes[eLaunchCheckboxes_Count]; UIControl_Label m_labelWorldOptions, m_labelGameOptions, m_labelDescription; - UIControl_Label m_labelSeed, m_labelRandomSeed, m_labelWorldSize; + UIControl_HTMLLabel m_labelDescription_GameOptions, m_labelDescription_WorldOptions; + UIControl_Label m_labelSeed, m_labelRandomSeed, m_labelWorldSize, m_labelWorldResize; UIControl_TextInput m_editSeed; UIControl_Slider m_sliderWorldSize; - IggyName m_funcSetMenuType, m_funcChangeTab; + UIControl_Slider m_sliderWorldResize; + IggyName m_funcSetMenuType, m_funcChangeTab, m_funcSetDescription; UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) - if(m_loadedResolution == eSceneResolution_1080) - { - UI_MAP_ELEMENT( m_labelGameOptions, "LabelGame") - UI_MAP_ELEMENT( m_labelWorldOptions, "LabelWorld") - - UI_MAP_ELEMENT( m_gameOptions, "GameOptions") - UI_BEGIN_MAP_CHILD_ELEMENTS(m_gameOptions) - UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_Online], "CheckboxOnline") - UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_InviteOnly], "CheckboxInviteOnly") - UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_AllowFoF], "CheckboxAllowFoF") - UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_PVP], "CheckboxPVP") - UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_TrustSystem], "CheckboxTrustSystem") - UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_FireSpreads], "CheckboxFireSpreads") - UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_TNT], "CheckboxTNT") - UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_HostPrivileges], "CheckboxHostPrivileges") - UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_ResetNether], "CheckboxResetNether") - UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_DisableSaving], "CheckboxDisableSaving") - UI_END_MAP_CHILD_ELEMENTS() - - UI_MAP_ELEMENT(m_worldOptions, "WorldOptions") - UI_BEGIN_MAP_CHILD_ELEMENTS(m_worldOptions) - UI_MAP_ELEMENT( m_labelSeed, "Seed") - UI_MAP_ELEMENT( m_editSeed, "EditSeed") - UI_MAP_ELEMENT( m_labelRandomSeed, "RandomSeed") - UI_MAP_ELEMENT( m_labelWorldSize, "WorldSize") - UI_MAP_ELEMENT( m_sliderWorldSize, "WorldSizeSlider") - UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_Structures], "CheckboxStructures") - UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_BonusChest], "CheckboxBonusChest") - UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_FlatWorld], "CheckboxFlatWorld") - UI_END_MAP_CHILD_ELEMENTS() - - UI_MAP_NAME( m_funcChangeTab, L"ChangeTab") - } - else - { + UI_MAP_ELEMENT( m_labelGameOptions, "LabelGame") + UI_MAP_ELEMENT( m_labelWorldOptions, "LabelWorld") + + UI_MAP_ELEMENT( m_gameOptions, "GameOptions") + UI_BEGIN_MAP_CHILD_ELEMENTS(m_gameOptions) +#ifdef __PSVITA__ + UI_MAP_ELEMENT( m_TouchTabGame, "TouchTabGame" ) +#endif + UI_MAP_ELEMENT( m_labelDescription_GameOptions, "Description_GameOptions") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_Online], "CheckboxOnline") UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_InviteOnly], "CheckboxInviteOnly") UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_AllowFoF], "CheckboxAllowFoF") UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_PVP], "CheckboxPVP") - UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_TrustSystem], "CheckboxTrustSystem") - UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_FireSpreads], "CheckboxFireSpreads") - UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_TNT], "CheckboxTNT") UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_HostPrivileges], "CheckboxHostPrivileges") - UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_ResetNether], "CheckboxResetNether") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_DayLightCycle], "CheckboxDayLightCycle") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_KeepInventory], "CheckboxKeepInventory") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_MobSpawning], "CheckboxMobSpawning") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_MobGriefing], "CheckboxMobGriefing") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_MobLoot], "CheckboxMobLoot") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_TileDrops], "CheckboxTileDrops") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_NaturalRegeneration], "CheckboxNaturalRegeneration") + UI_END_MAP_CHILD_ELEMENTS() + + UI_MAP_ELEMENT(m_worldOptions, "WorldOptions") + UI_BEGIN_MAP_CHILD_ELEMENTS(m_worldOptions) +#ifdef __PSVITA__ + UI_MAP_ELEMENT( m_TouchTabWorld, "TouchTabWorld" ) +#endif + UI_MAP_ELEMENT( m_labelDescription_WorldOptions, "Description_WorldOptions") + + UI_MAP_ELEMENT( m_labelSeed, "Seed") + UI_MAP_ELEMENT( m_editSeed, "EditSeed") + UI_MAP_ELEMENT( m_labelRandomSeed, "RandomSeed") + UI_MAP_ELEMENT( m_labelWorldSize, "WorldSize") + UI_MAP_ELEMENT( m_sliderWorldSize, "WorldSizeSlider") - UI_MAP_ELEMENT( m_labelWorldOptions, "WorldOptions") UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_Structures], "CheckboxStructures") - UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_FlatWorld], "CheckboxFlatWorld") UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_BonusChest], "CheckboxBonusChest") - } + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_FlatWorld], "CheckboxFlatWorld") + + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_ResetNether], "CheckboxResetNether") + + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_DisableSaving], "CheckboxDisableSaving") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_TrustSystem], "CheckboxTrustSystem") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_FireSpreads], "CheckboxFireSpreads") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_TNT], "CheckboxTNT") - UI_MAP_ELEMENT( m_labelDescription, "Description") + UI_MAP_ELEMENT( m_labelWorldResize, "ResizeLabel") + UI_MAP_ELEMENT( m_sliderWorldResize, "ChangeWorldSizeSlider") + UI_MAP_ELEMENT( m_checkboxes[eLaunchCheckbox_WorldResizeType], "CheckboxResizeType") + UI_END_MAP_CHILD_ELEMENTS() + UI_MAP_NAME( m_funcChangeTab, L"ChangeTab") UI_MAP_NAME( m_funcSetMenuType, L"SetMenuType") UI_END_MAP_ELEMENTS_AND_NAMES() LaunchMoreOptionsMenuInitData *m_params; bool m_bMultiplayerAllowed; bool m_bIgnoreInput; - bool m_tabIndex; + int m_tabIndex; public: UIScene_LaunchMoreOptionsMenu(int iPad, void *initData, UILayer *parentLayer); @@ -122,4 +150,16 @@ public: protected: void handleCheckboxToggled(F64 controlId, bool selected); + +private: + bool m_bUpdateCheats; // If true, update cheats on next tick + void UpdateCheats(); + + bool m_bUpdateOnline; // If true, update online settings on next tick + void UpdateOnline(); + +#ifdef __PSVITA__ + virtual void handleTouchInput(unsigned int iPad, S32 x, S32 y, int iId, bool bPressed, bool bRepeat, bool bReleased); + virtual UIControl* GetMainPanel(); +#endif //__PSVITA__ }; diff --git a/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp index 80db57f8..12b21905 100644 --- a/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.cpp @@ -12,8 +12,8 @@ const int UIScene_LeaderboardsMenu::TitleIcons[UIScene_LeaderboardsMenu::NUM_LEADERBOARDS][7] = { { UIControl_LeaderboardList::e_ICON_TYPE_WALKED, UIControl_LeaderboardList::e_ICON_TYPE_FALLEN, Item::minecart_Id, Item::boat_Id, NULL }, - { Tile::dirt_Id, Tile::stoneBrick_Id, Tile::sand_Id, Tile::rock_Id, Tile::gravel_Id, Tile::clay_Id, Tile::obsidian_Id }, - { Item::egg_Id, Item::wheat_Id, Tile::mushroom1_Id, Tile::reeds_Id, Item::milk_Id, Tile::pumpkin_Id, NULL }, + { Tile::dirt_Id, Tile::cobblestone_Id, Tile::sand_Id, Tile::stone_Id, Tile::gravel_Id, Tile::clay_Id, Tile::obsidian_Id }, + { Item::egg_Id, Item::wheat_Id, Tile::mushroom_brown_Id, Tile::reeds_Id, Item::bucket_milk_Id, Tile::pumpkin_Id, NULL }, { UIControl_LeaderboardList::e_ICON_TYPE_ZOMBIE, UIControl_LeaderboardList::e_ICON_TYPE_SKELETON, UIControl_LeaderboardList::e_ICON_TYPE_CREEPER, UIControl_LeaderboardList::e_ICON_TYPE_SPIDER, UIControl_LeaderboardList::e_ICON_TYPE_SPIDERJOKEY, UIControl_LeaderboardList::e_ICON_TYPE_ZOMBIEPIGMAN, UIControl_LeaderboardList::e_ICON_TYPE_SLIME }, }; const UIScene_LeaderboardsMenu::LeaderboardDescriptor UIScene_LeaderboardsMenu::LEADERBOARD_DESCRIPTORS[UIScene_LeaderboardsMenu::NUM_LEADERBOARDS][4] = { @@ -43,7 +43,8 @@ const UIScene_LeaderboardsMenu::LeaderboardDescriptor UIScene_LeaderboardsMenu:: }, }; -UIScene_LeaderboardsMenu::UIScene_LeaderboardsMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) +UIScene_LeaderboardsMenu::UIScene_LeaderboardsMenu(int iPad, void *initData, UILayer *parentLayer) + : UIScene(iPad, parentLayer), m_interface(LeaderboardManager::Instance()) { // Setup all the Iggy references we need for this scene initialiseMovie(); @@ -60,8 +61,6 @@ UIScene_LeaderboardsMenu::UIScene_LeaderboardsMenu(int iPad, void *initData, UIL // Alert the app the we want to be informed of ethernet connections app.SetLiveLinkRequired( true ); - LeaderboardManager::Instance()->OpenSession(); - //GetFriends(); m_currentLeaderboard = 0; @@ -86,9 +85,6 @@ UIScene_LeaderboardsMenu::UIScene_LeaderboardsMenu(int iPad, void *initData, UIL UIScene_LeaderboardsMenu::~UIScene_LeaderboardsMenu() { - LeaderboardManager::Instance()->CancelOperation(); - LeaderboardManager::Instance()->CloseSession(); - // Alert the app the we no longer want to be informed of ethernet connections app.SetLiveLinkRequired( false ); } @@ -159,6 +155,12 @@ wstring UIScene_LeaderboardsMenu::getMoviePath() return L"LeaderboardMenu"; } +void UIScene_LeaderboardsMenu::tick() +{ + UIScene::tick(); + m_interface.tick(); +} + void UIScene_LeaderboardsMenu::handleReload() { // We don't allow this in splitscreen, so just go back @@ -457,16 +459,19 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) switch (filtermode) { case LeaderboardManager::eFM_TopRank: - LeaderboardManager::Instance()->ReadStats_TopRank( this, - m_currentDifficulty, (LeaderboardManager::EStatsType) m_currentLeaderboard, - m_newEntryIndex, m_newReadSize - ); + { + m_interface.ReadStats_TopRank( + this, + m_currentDifficulty, (LeaderboardManager::EStatsType) m_currentLeaderboard, + m_newEntryIndex, m_newReadSize + ); + } break; case LeaderboardManager::eFM_MyScore: { PlayerUID uid; ProfileManager.GetXUID(ProfileManager.GetPrimaryPad(),&uid, true); - LeaderboardManager::Instance()->ReadStats_MyScore( this, + m_interface.ReadStats_MyScore( this, m_currentDifficulty, (LeaderboardManager::EStatsType) m_currentLeaderboard, uid /*ignored on PS3*/, m_newReadSize @@ -477,7 +482,7 @@ void UIScene_LeaderboardsMenu::ReadStats(int startIndex) { PlayerUID uid; ProfileManager.GetXUID(ProfileManager.GetPrimaryPad(),&uid, true); - LeaderboardManager::Instance()->ReadStats_Friends( this, + m_interface.ReadStats_Friends( this, m_currentDifficulty, (LeaderboardManager::EStatsType) m_currentLeaderboard, uid /*ignored on PS3*/, m_newEntryIndex, m_newReadSize @@ -501,14 +506,11 @@ bool UIScene_LeaderboardsMenu::OnStatsReadComplete(LeaderboardManager::eStatsRet bool ret; //app.DebugPrintf("Leaderboards read %d stats\n", numResults); - if (retIn == LeaderboardManager::eStatsReturn_Success) - { - m_numStats = numResults; - m_stats = results; - ret = RetrieveStats(); - } - else ret = true; - + + m_numStats = numResults; + m_stats = results; + ret = RetrieveStats(); + //else LeaderboardManager::Instance()->SetStatsRetrieved(false); PopulateLeaderboard(retIn); @@ -632,7 +634,7 @@ bool UIScene_LeaderboardsMenu::RetrieveStats() } break; } - } + } } // If not set, default to start index @@ -1021,7 +1023,7 @@ void UIScene_LeaderboardsMenu::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_LeaderboardsMenu::ExitLeaderboards,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_LeaderboardsMenu::ExitLeaderboards,this); } #endif break; diff --git a/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.h b/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.h index 20bf0002..bcd4fe87 100644 --- a/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_LeaderboardsMenu.h @@ -1,7 +1,8 @@ #pragma once #include "UIScene.h" -#include "..\Leaderboards\LeaderboardManager.h" +// #include "..\Leaderboards\LeaderboardManager.h" +#include "..\Leaderboards\LeaderboardInterface.h" class UIScene_LeaderboardsMenu : public UIScene, public LeaderboardReadListener { @@ -72,6 +73,8 @@ private: bool m_bPopulatedOnce; bool m_bReady; + LeaderboardInterface m_interface; + UIControl_LeaderboardList m_listEntries; UIControl_Label m_labelFilter, m_labelLeaderboard, m_labelEntries, m_labelInfo; UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) @@ -105,7 +108,8 @@ protected: virtual wstring getMoviePath(); public: - void handleReload(); + virtual void tick(); + virtual void handleReload(); // INPUT virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); diff --git a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp index 1c07e540..d4d83228 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadMenu.cpp @@ -33,24 +33,27 @@ int UIScene_LoadMenu::m_iDifficultyTitleSettingA[4]= int UIScene_LoadMenu::LoadSaveDataThumbnailReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes) { - UIScene_LoadMenu *pClass= (UIScene_LoadMenu *)lpParam; + UIScene_LoadMenu *pClass= (UIScene_LoadMenu *)ui.GetSceneFromCallbackId((size_t)lpParam); - app.DebugPrintf("Received data for a thumbnail\n"); - - if(pbThumbnail && dwThumbnailBytes) + if(pClass) { - pClass->registerSubstitutionTexture(pClass->m_thumbnailName,pbThumbnail,dwThumbnailBytes); + app.DebugPrintf("Received data for a thumbnail\n"); - pClass->m_pbThumbnailData = pbThumbnail; - pClass->m_uiThumbnailSize = dwThumbnailBytes; - pClass->m_bSaveThumbnailReady = true; - } - else - { - app.DebugPrintf("Thumbnail data is NULL, or has size 0\n"); - pClass->m_bThumbnailGetFailed = true; + if(pbThumbnail && dwThumbnailBytes) + { + pClass->registerSubstitutionTexture(pClass->m_thumbnailName,pbThumbnail,dwThumbnailBytes); + + pClass->m_pbThumbnailData = pbThumbnail; + pClass->m_uiThumbnailSize = dwThumbnailBytes; + pClass->m_bSaveThumbnailReady = true; + } + else + { + app.DebugPrintf("Thumbnail data is NULL, or has size 0\n"); + pClass->m_bThumbnailGetFailed = true; + } + pClass->m_bRetrievingSaveThumbnail = false; } - pClass->m_bRetrievingSaveThumbnail = false; return 0; } @@ -90,8 +93,10 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye m_iSaveGameInfoIndex=params->iSaveGameInfoIndex; m_levelGen = params->levelGen; - m_bGameModeSurvival=true; + m_bGameModeCreative = false; + m_iGameModeId = GameType::SURVIVAL->getId(); m_bHasBeenInCreative = false; + m_bIsSaveOwner = true; m_bSaveThumbnailReady = false; m_bRetrievingSaveThumbnail = true; @@ -103,6 +108,7 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye m_bRebuildTouchBoxes = false; m_bThumbnailGetFailed = false; m_seed = 0; + m_bIsCorrupt = false; m_bMultiplayerAllowed = ProfileManager.IsSignedInLive( m_iPad ) && ProfileManager.AllowedToPlayMultiplayer(m_iPad); // 4J-PB - read the settings for the online flag. We'll only save this setting if the user changed it. @@ -136,29 +142,23 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye } } - -#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64 - if(getSceneResolution() == eSceneResolution_1080) - { - // Set up online game checkbox - bool bOnlineGame = m_MoreOptionsParams.bOnlineGame; - m_checkboxOnline.SetEnable(true); + // Set up online game checkbox + bool bOnlineGame = m_MoreOptionsParams.bOnlineGame; + m_checkboxOnline.SetEnable(true); - // 4J-PB - to stop an offline game being able to select the online flag - if(ProfileManager.IsSignedInLive(m_iPad) == false) - { - m_checkboxOnline.SetEnable(false); - } - - if(m_MoreOptionsParams.bOnlineSettingChangedBySystem) - { - m_checkboxOnline.SetEnable(false); - bOnlineGame = false; - } + // 4J-PB - to stop an offline game being able to select the online flag + if(ProfileManager.IsSignedInLive(m_iPad) == false) + { + m_checkboxOnline.SetEnable(false); + } - m_checkboxOnline.init(app.GetString(IDS_ONLINE_GAME), eControl_OnlineGame, bOnlineGame); + if(m_MoreOptionsParams.bOnlineSettingChangedBySystem) + { + m_checkboxOnline.SetEnable(false); + bOnlineGame = false; } -#endif + + m_checkboxOnline.init(app.GetString(IDS_ONLINE_GAME), eControl_OnlineGame, bOnlineGame); // Level gen if(m_levelGen) @@ -185,8 +185,15 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye } } // Set this level as created in creative mode, so that people can't use the themed worlds as an easy way to get achievements - m_bHasBeenInCreative = true; - m_labelCreatedMode.setLabel( app.GetString(IDS_CREATED_IN_CREATIVE) ); + m_bHasBeenInCreative = m_levelGen->getLevelHasBeenInCreative(); + if(m_bHasBeenInCreative) + { + m_labelCreatedMode.setLabel( app.GetString(IDS_CREATED_IN_CREATIVE) ); + } + else + { + m_labelCreatedMode.setLabel( app.GetString(IDS_CREATED_IN_SURVIVAL) ); + } } else { @@ -225,17 +232,19 @@ UIScene_LoadMenu::UIScene_LoadMenu(int iPad, void *initData, UILayer *parentLaye #ifdef _DURANGO // On Durango, we have an extra flag possible with LoadSaveDataThumbnail, which if true will force the loading of this thumbnail even if the save data isn't sync'd from // the cloud at this stage. This could mean that there could be a pretty large delay before the callback happens, in this case. - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex],&LoadSaveDataThumbnailReturned,this,true); + C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex],&LoadSaveDataThumbnailReturned,(LPVOID)GetCallbackUniqueId(),true); #else - C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex],&LoadSaveDataThumbnailReturned,this); + C4JStorage::ESaveGameState eLoadStatus=StorageManager.LoadSaveDataThumbnail(&pSaveDetails->SaveInfoA[(int)m_iSaveGameInfoIndex],&LoadSaveDataThumbnailReturned,(LPVOID)GetCallbackUniqueId()); #endif m_bShowTimer = true; } #if defined(_DURANGO) m_labelGameName.init(params->saveDetails->UTF16SaveName); #else - - m_labelGameName.init(params->saveDetails->UTF8SaveName); + wchar_t wSaveName[128]; + ZeroMemory(wSaveName, 128 * sizeof(wchar_t) ); + mbstowcs(wSaveName, params->saveDetails->UTF8SaveName, strlen(params->saveDetails->UTF8SaveName)+1); // plus null + m_labelGameName.init(wSaveName); #endif #endif } @@ -457,6 +466,26 @@ void UIScene_LoadMenu::tick() m_MoreOptionsParams.bTNT = app.GetGameHostOption(uiHostOptions,eGameHostOption_TNT)>0?TRUE:FALSE; m_MoreOptionsParams.bHostPrivileges = app.GetGameHostOption(uiHostOptions,eGameHostOption_CheatsEnabled)>0?TRUE:FALSE; m_MoreOptionsParams.bDisableSaving = app.GetGameHostOption(uiHostOptions,eGameHostOption_DisableSaving)>0?TRUE:FALSE; + m_MoreOptionsParams.currentWorldSize = (EGameHostOptionWorldSize)app.GetGameHostOption(uiHostOptions,eGameHostOption_WorldSize); + m_MoreOptionsParams.newWorldSize = m_MoreOptionsParams.currentWorldSize; + + m_MoreOptionsParams.bMobGriefing = app.GetGameHostOption(uiHostOptions, eGameHostOption_MobGriefing); + m_MoreOptionsParams.bKeepInventory = app.GetGameHostOption(uiHostOptions, eGameHostOption_KeepInventory); + m_MoreOptionsParams.bDoMobSpawning = app.GetGameHostOption(uiHostOptions, eGameHostOption_DoMobSpawning); + m_MoreOptionsParams.bDoMobLoot = app.GetGameHostOption(uiHostOptions, eGameHostOption_DoMobLoot); + m_MoreOptionsParams.bDoTileDrops = app.GetGameHostOption(uiHostOptions, eGameHostOption_DoTileDrops); + m_MoreOptionsParams.bNaturalRegeneration = app.GetGameHostOption(uiHostOptions, eGameHostOption_NaturalRegeneration); + m_MoreOptionsParams.bDoDaylightCycle = app.GetGameHostOption(uiHostOptions, eGameHostOption_DoDaylightCycle); + + bool cheatsOn = m_MoreOptionsParams.bHostPrivileges; + if (!cheatsOn) + { + // Set defaults + m_MoreOptionsParams.bMobGriefing = true; + m_MoreOptionsParams.bKeepInventory = false; + m_MoreOptionsParams.bDoMobSpawning = true; + m_MoreOptionsParams.bDoDaylightCycle = true; + } // turn off creative mode on the save // #ifdef _DEBUG @@ -464,6 +493,11 @@ void UIScene_LoadMenu::tick() // app.SetGameHostOption(eGameHostOption_HasBeenInCreative, 0); // #endif + if(app.GetGameHostOption(uiHostOptions,eGameHostOption_WasntSaveOwner)>0) + { + m_bIsSaveOwner = false; + } + m_bHasBeenInCreative = app.GetGameHostOption(uiHostOptions,eGameHostOption_HasBeenInCreative)>0; if(app.GetGameHostOption(uiHostOptions,eGameHostOption_HasBeenInCreative)>0) { @@ -474,11 +508,27 @@ void UIScene_LoadMenu::tick() m_labelCreatedMode.setLabel( app.GetString(IDS_CREATED_IN_SURVIVAL) ); } - if(app.GetGameHostOption(uiHostOptions,eGameHostOption_GameType)>0) - { + switch(app.GetGameHostOption(uiHostOptions,eGameHostOption_GameType)) + { + case 1: // Creative m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_CREATIVE)); - m_bGameModeSurvival=false; - } + m_bGameModeCreative=true; + m_iGameModeId = GameType::CREATIVE->getId(); + break; +#ifdef _ADVENTURE_MODE_ENABLED + case 2: // Adventure + m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_ADVENTURE)); + m_bGameModeCreative=false; + m_iGameModeId = GameType::ADVENTURE->getId(); + break; +#endif + case 0: // Survival + default: + m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_SURVIVAL)); + m_bGameModeCreative=false; + m_iGameModeId = GameType::SURVIVAL->getId(); + break; + }; bool bGameSetting_Online=(app.GetGameSettings(m_iPad,eGameSetting_Online)!=0); if(app.GetGameHostOption(uiHostOptions,eGameHostOption_FriendsOfFriends) && !(m_bMultiplayerAllowed && bGameSetting_Online)) @@ -545,7 +595,7 @@ void UIScene_LoadMenu::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_LoadMenu::ContinueOffline,this,app.GetStringTable(), 0, 0, false); + ui.RequestAlertMessage(IDS_PLAY_OFFLINE,IDS_NO_PLAYSTATIONPLUS, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_LoadMenu::ContinueOffline,this); } } break; @@ -599,7 +649,7 @@ void UIScene_LoadMenu::handleInput(int iPad, int key, bool repeat, bool pressed, 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 @@ -610,23 +660,19 @@ void UIScene_LoadMenu::handleInput(int iPad, int key, bool repeat, bool pressed, case ACTION_MENU_OTHER_STICK_UP: 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; } @@ -642,16 +688,26 @@ void UIScene_LoadMenu::handlePress(F64 controlId, F64 childId) switch((int)controlId) { case eControl_GameMode: - 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 +#ifdef _ADVENTURE_MODE_ENABLED + m_buttonGamemode.setLabel(app.GetString(IDS_GAMEMODE_ADVENTURE)); + m_iGameModeId = GameType::ADVENTURE->getId(); + m_bGameModeCreative = false; + break; + case 2: // Adventure +#endif 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); @@ -729,7 +785,7 @@ void UIScene_LoadMenu::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; } } @@ -799,13 +855,13 @@ void UIScene_LoadMenu::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__ @@ -815,11 +871,45 @@ void UIScene_LoadMenu::StartSharedLaunchFlow() } } } + app.SetGameHostOption(eGameHostOption_WasntSaveOwner, (!m_bIsSaveOwner)); #if defined _XBOX_ONE || defined __ORBIS__ app.SetGameHostOption(eGameHostOption_DisableSaving, m_MoreOptionsParams.bDisableSaving?1:0); - StorageManager.SetSaveDisabled(m_MoreOptionsParams.bDisableSaving); + + int newWorldSize = 0; + int newHellScale = 0; + switch(m_MoreOptionsParams.newWorldSize) + { + case e_worldSize_Unknown: + newWorldSize = 0; + newHellScale = 0; + break; + case e_worldSize_Classic: + newWorldSize = LEVEL_WIDTH_CLASSIC; + newHellScale = HELL_LEVEL_SCALE_CLASSIC; + break; + case e_worldSize_Small: + newWorldSize = LEVEL_WIDTH_SMALL; + newHellScale = HELL_LEVEL_SCALE_SMALL; + break; + case e_worldSize_Medium: + newWorldSize = LEVEL_WIDTH_MEDIUM; + newHellScale = HELL_LEVEL_SCALE_MEDIUM; + break; + case e_worldSize_Large: + newWorldSize = LEVEL_WIDTH_LARGE; + newHellScale = HELL_LEVEL_SCALE_LARGE; + break; + default: + assert(0); + break; + } + bool bUseMoat = !m_MoreOptionsParams.newWorldSizeOverwriteEdges; + app.SetGameNewWorldSize(newWorldSize, bUseMoat); + app.SetGameNewHellScale(newHellScale); + app.SetGameHostOption(eGameHostOption_WorldSize, m_MoreOptionsParams.newWorldSize); + #endif #if TO_BE_IMPLEMENTED @@ -834,7 +924,7 @@ void UIScene_LoadMenu::StartSharedLaunchFlow() uiIDA[0]=IDS_DONT_RESET_NETHER; uiIDA[1]=IDS_RESET_NETHER; - ui.RequestMessageBox(IDS_RESETNETHER_TITLE, IDS_RESETNETHER_TEXT, uiIDA, 2, m_iPad,&UIScene_LoadMenu::CheckResetNetherReturned,this,app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_RESETNETHER_TITLE, IDS_RESETNETHER_TEXT, uiIDA, 2, m_iPad,&UIScene_LoadMenu::CheckResetNetherReturned,this); } else { @@ -905,13 +995,9 @@ void UIScene_LoadMenu::handleTimerComplete(int id) m_MoreOptionsParams.bInviteOnly = FALSE; 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; } @@ -988,17 +1074,17 @@ void UIScene_LoadMenu::LaunchGame(void) killTimer(CHECKFORAVAILABLETEXTUREPACKS_TIMER_ID); #endif - if( (m_bGameModeSurvival != true || m_bHasBeenInCreative) || m_MoreOptionsParams.bHostPrivileges == TRUE) + if( (m_bGameModeCreative == true || m_bHasBeenInCreative) || m_MoreOptionsParams.bHostPrivileges == TRUE) { UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; uiIDA[1]=IDS_CONFIRM_CANCEL; - if(m_bGameModeSurvival != true || m_bHasBeenInCreative) + if(m_bGameModeCreative == true || m_bHasBeenInCreative) { // 4J-PB - Need different text for Survival mode with a level that has been saved in Creative - if(m_bGameModeSurvival) + if(!m_bGameModeCreative) { - ui.RequestMessageBox(IDS_TITLE_START_GAME, IDS_CONFIRM_START_SAVEDINCREATIVE, uiIDA, 2, m_iPad,&UIScene_LoadMenu::ConfirmLoadReturned,this,app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_TITLE_START_GAME, IDS_CONFIRM_START_SAVEDINCREATIVE, uiIDA, 2, m_iPad,&UIScene_LoadMenu::ConfirmLoadReturned,this); } else // it's creative mode { @@ -1012,7 +1098,8 @@ void UIScene_LoadMenu::LaunchGame(void) if(m_levelGen != NULL) { - LoadLevelGen(m_levelGen); + m_bIsCorrupt = false; + LoadDataComplete(this); } else { @@ -1032,7 +1119,7 @@ void UIScene_LoadMenu::LaunchGame(void) StorageManager.SetSaveDeviceSelected(m_iPad,false); UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestMessageBox(IDS_STORAGEDEVICEPROBLEM_TITLE, IDS_FAILED_TO_LOADSAVE_TEXT, uiIDA, 1, m_iPad,&CScene_LoadGameSettings::DeviceRemovedDialogReturned,this); + ui.RequestErrorMessage(IDS_STORAGEDEVICEPROBLEM_TITLE, IDS_FAILED_TO_LOADSAVE_TEXT, uiIDA, 1, m_iPad,&CScene_LoadGameSettings::DeviceRemovedDialogReturned,this); } #endif @@ -1041,20 +1128,21 @@ void UIScene_LoadMenu::LaunchGame(void) else { // ask if they're sure they want to turn this into a creative map - ui.RequestMessageBox(IDS_TITLE_START_GAME, IDS_CONFIRM_START_CREATIVE, uiIDA, 2, m_iPad,&UIScene_LoadMenu::ConfirmLoadReturned,this,app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_TITLE_START_GAME, IDS_CONFIRM_START_CREATIVE, uiIDA, 2, m_iPad,&UIScene_LoadMenu::ConfirmLoadReturned,this); } } } else { - ui.RequestMessageBox(IDS_TITLE_START_GAME, IDS_CONFIRM_START_HOST_PRIVILEGES, uiIDA, 2, m_iPad,&UIScene_LoadMenu::ConfirmLoadReturned,this,app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_TITLE_START_GAME, IDS_CONFIRM_START_HOST_PRIVILEGES, uiIDA, 2, m_iPad,&UIScene_LoadMenu::ConfirmLoadReturned,this); } } else { if(m_levelGen != NULL) { - LoadLevelGen(m_levelGen); + m_bIsCorrupt = false; + LoadDataComplete(this); } else { @@ -1073,7 +1161,7 @@ void UIScene_LoadMenu::LaunchGame(void) StorageManager.SetSaveDeviceSelected(m_iPad,false); UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestMessageBox(IDS_STORAGEDEVICEPROBLEM_TITLE, IDS_FAILED_TO_LOADSAVE_TEXT, uiIDA, 1, m_iPad,&CScene_LoadGameSettings::DeviceRemovedDialogReturned,this); + ui.RequestErrorMessage(IDS_STORAGEDEVICEPROBLEM_TITLE, IDS_FAILED_TO_LOADSAVE_TEXT, uiIDA, 1, m_iPad,&CScene_LoadGameSettings::DeviceRemovedDialogReturned,this); } #endif } @@ -1113,7 +1201,8 @@ int UIScene_LoadMenu::ConfirmLoadReturned(void *pParam,int iPad,C4JStorage::EMes { if(pClass->m_levelGen != NULL) { - pClass->LoadLevelGen(pClass->m_levelGen); + pClass->m_bIsCorrupt = false; + pClass->LoadDataComplete(pClass); } else { @@ -1132,9 +1221,9 @@ int UIScene_LoadMenu::ConfirmLoadReturned(void *pParam,int iPad,C4JStorage::EMes StorageManager.SetSaveDeviceSelected(m_iPad,false); UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestMessageBox(IDS_STORAGEDEVICEPROBLEM_TITLE, IDS_FAILED_TO_LOADSAVE_TEXT, uiIDA, 1, m_iPad,&CScene_LoadGameSettings::DeviceRemovedDialogReturned,this); + ui.RequestErrorMessage(IDS_STORAGEDEVICEPROBLEM_TITLE, IDS_FAILED_TO_LOADSAVE_TEXT, uiIDA, 1, m_iPad,&CScene_LoadGameSettings::DeviceRemovedDialogReturned,this); } -#endif +#endif } } else @@ -1183,7 +1272,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) // 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 { @@ -1191,14 +1280,14 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) 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_LoadMenu::MustSignInReturnedPSN, pClass, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, iPadNotSignedInLive, &UIScene_LoadMenu::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 } @@ -1257,6 +1346,15 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) pClass->setVisible( true ); pClass->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 0; + } + // 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(); @@ -1317,6 +1415,15 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) pClass->setVisible( true ); pClass->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 0; + } + // 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(); @@ -1357,7 +1464,7 @@ int UIScene_LoadMenu::LoadDataComplete(void *pParam) UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_CORRUPT_OR_DAMAGED_SAVE_TITLE, IDS_CORRUPT_OR_DAMAGED_SAVE_TEXT, uiIDA, 2, pClass->m_iPad,&UIScene_LoadMenu::DeleteSaveDialogReturned,pClass, app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_CORRUPT_OR_DAMAGED_SAVE_TITLE, IDS_CORRUPT_OR_DAMAGED_SAVE_TEXT, uiIDA, 2, pClass->m_iPad,&UIScene_LoadMenu::DeleteSaveDialogReturned,pClass); } @@ -1369,6 +1476,14 @@ int UIScene_LoadMenu::LoadSaveDataReturned(void *pParam,bool bIsCorrupt, bool bI UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; pClass->m_bIsCorrupt=bIsCorrupt; + +#if defined(__PS3__) || defined(__ORBIS__) || defined (__PSVITA__) + if(app.GetGameHostOption(eGameHostOption_WasntSaveOwner)) + { + bIsOwner = false; + } +#endif + if(bIsOwner) { LoadDataComplete(pClass); @@ -1382,8 +1497,9 @@ int UIScene_LoadMenu::LoadSaveDataReturned(void *pParam,bool bIsCorrupt, bool bI // show the message that trophies are disabled UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_SAVEDATA_COPIED_TITLE, IDS_SAVEDATA_COPIED_TEXT, uiIDA, 1, - pClass->m_iPad,&UIScene_LoadMenu::TrophyDialogReturned,pClass, app.GetStringTable()); + ui.RequestErrorMessage(IDS_SAVEDATA_COPIED_TITLE, IDS_SAVEDATA_COPIED_TEXT, uiIDA, 1, + pClass->m_iPad,&UIScene_LoadMenu::TrophyDialogReturned,pClass); + app.SetGameHostOption(eGameHostOption_WasntSaveOwner, true); #endif } @@ -1427,9 +1543,18 @@ int UIScene_LoadMenu::DeleteSaveDataReturned(void *pParam,bool bSuccess) // 4J Stu - Shared functionality that is the same whether we needed a quadrant sign-in or not void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocalUsersMask) { - INT saveOrCheckpointId = 0; - bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); - TelemetryManager->RecordLevelResume(pClass->m_iPad, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, app.GetGameSettings(pClass->m_iPad,eGameSetting_Difficulty), app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount(), saveOrCheckpointId); + if(pClass->m_levelGen == NULL) + { + INT saveOrCheckpointId = 0; + bool validSave = StorageManager.GetSaveUniqueNumber(&saveOrCheckpointId); + TelemetryManager->RecordLevelResume(pClass->m_iPad, eSen_FriendOrMatch_Playing_With_Invited_Friends, eSen_CompeteOrCoop_Coop_and_Competitive, app.GetGameSettings(pClass->m_iPad,eGameSetting_Difficulty), app.GetLocalPlayerCount(), g_NetworkManager.GetOnlinePlayerCount(), saveOrCheckpointId); + } + else + { + StorageManager.ResetSaveData(); + // Make our next save default to the name of the level + StorageManager.SetSaveTitle(pClass->m_levelGen->getDefaultSaveName().c_str()); + } bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && pClass->m_MoreOptionsParams.bOnlineGame; #ifdef __PSVITA__ @@ -1446,7 +1571,8 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocal NetworkGameInitData *param = new NetworkGameInitData(); param->seed = pClass->m_seed; - param->saveData = NULL; + param->saveData = NULL; + param->levelGen = pClass->m_levelGen; param->texturePackId = pClass->m_MoreOptionsParams.dwTexturePack; Minecraft *pMinecraft = Minecraft::GetInstance(); @@ -1467,12 +1593,26 @@ void UIScene_LoadMenu::StartGameFromSave(UIScene_LoadMenu* pClass, DWORD dwLocal 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); + +#ifdef _LARGE_WORLDS + app.SetGameHostOption(eGameHostOption_WorldSize, pClass->m_MoreOptionsParams.worldSize+1 ); // 0 is GAME_HOST_OPTION_WORLDSIZE_UNKNOWN +#endif +// app.SetGameNewWorldSize(64, true ); +// app.SetGameNewWorldSize(0, false ); + // flag if the user wants to reset the Nether to force a Fortress with netherwart etc. app.SetResetNether((pClass->m_MoreOptionsParams.bResetNether==TRUE)?true:false); // clear out the app's terrain features list app.ClearTerrainFeaturePosition(); - app.SetGameHostOption(eGameHostOption_GameType,pClass->m_bGameModeSurvival?GameType::SURVIVAL->getId():GameType::CREATIVE->getId() ); + app.SetGameHostOption(eGameHostOption_GameType,pClass->m_iGameModeId ); g_NetworkManager.HostGame(dwLocalUsersMask,isClientSide,isPrivate,MINECRAFT_NET_MAX_PLAYERS,0); @@ -1508,7 +1648,7 @@ void UIScene_LoadMenu::checkStateAndStartGame() uiIDA[0]=IDS_DONT_RESET_NETHER; uiIDA[1]=IDS_RESET_NETHER; - ui.RequestMessageBox(IDS_RESETNETHER_TITLE, IDS_RESETNETHER_TEXT, uiIDA, 2, m_iPad,&UIScene_LoadMenu::CheckResetNetherReturned,this,app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_RESETNETHER_TITLE, IDS_RESETNETHER_TEXT, uiIDA, 2, m_iPad,&UIScene_LoadMenu::CheckResetNetherReturned,this); } else { @@ -1516,113 +1656,6 @@ void UIScene_LoadMenu::checkStateAndStartGame() } } -void UIScene_LoadMenu::LoadLevelGen(LevelGenerationOptions *levelGen) -{ - bool isClientSide = ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && m_MoreOptionsParams.bOnlineGame; - - // 4J Stu - If we only have one controller connected, then don't show the sign-in UI again - DWORD connectedControllers = 0; - for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) - { - if( InputManager.IsPadConnected(i) || ProfileManager.IsSignedIn(i) ) ++connectedControllers; - } - - if(!isClientSide || connectedControllers == 1 || !RenderManager.IsHiDef()) - { - - // Check if user-created content is allowed, as we cannot play multiplayer if it's not - bool noUGC = false; - BOOL pccAllowed = TRUE; - BOOL pccFriendsAllowed = TRUE; - - ProfileManager.AllowedPlayerCreatedContent(ProfileManager.GetPrimaryPad(),false,&pccAllowed,&pccFriendsAllowed); - if(!pccAllowed && !pccFriendsAllowed) noUGC = true; - - if(isClientSide && noUGC ) - { - 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); - return; - } - - } - - DWORD dwLocalUsersMask = 0; - - dwLocalUsersMask |= CGameNetworkManager::GetLocalPlayerMask(ProfileManager.GetPrimaryPad()); - // Load data from disc - //File saveFile( L"Tutorial\\Tutorial" ); - //LoadSaveFromDisk(&saveFile); - - StorageManager.ResetSaveData(); - // Make our next save default to the name of the level - StorageManager.SetSaveTitle(levelGen->getDefaultSaveName().c_str()); - - bool isPrivate = (app.GetGameSettings(m_iPad,eGameSetting_InviteOnly)>0)?true:false; - - g_NetworkManager.HostGame(dwLocalUsersMask,isClientSide,isPrivate,MINECRAFT_NET_MAX_PLAYERS,0); - - NetworkGameInitData *param = new NetworkGameInitData(); - param->seed = 0; - param->saveData = NULL; - param->levelGen = levelGen; - - if(levelGen->requiresTexturePack()) - { - param->texturePackId = levelGen->getRequiredTexturePackId(); - - Minecraft *pMinecraft = Minecraft::GetInstance(); - pMinecraft->skins->selectTexturePackById(param->texturePackId); - //pMinecraft->skins->updateUI(); - } - - - app.SetGameHostOption(eGameHostOption_Difficulty,Minecraft::GetInstance()->options->difficulty); - app.SetGameHostOption(eGameHostOption_FriendsOfFriends,app.GetGameSettings(m_iPad,eGameSetting_FriendsOfFriends)); - app.SetGameHostOption(eGameHostOption_Gamertags,app.GetGameSettings(m_iPad,eGameSetting_GamertagsVisible)); - - app.SetGameHostOption(eGameHostOption_BedrockFog,app.GetGameSettings(m_iPad,eGameSetting_BedrockFog)?1:0); - - app.SetGameHostOption(eGameHostOption_PvP,m_MoreOptionsParams.bPVP); - app.SetGameHostOption(eGameHostOption_TrustPlayers,m_MoreOptionsParams.bTrust ); - app.SetGameHostOption(eGameHostOption_FireSpreads,m_MoreOptionsParams.bFireSpreads ); - app.SetGameHostOption(eGameHostOption_TNT,m_MoreOptionsParams.bTNT ); - app.SetGameHostOption(eGameHostOption_HostCanFly,m_MoreOptionsParams.bHostPrivileges); - app.SetGameHostOption(eGameHostOption_HostCanChangeHunger,m_MoreOptionsParams.bHostPrivileges); - app.SetGameHostOption(eGameHostOption_HostCanBeInvisible,m_MoreOptionsParams.bHostPrivileges ); - - // flag if the user wants to reset the Nether to force a Fortress with netherwart etc. - app.SetResetNether((m_MoreOptionsParams.bResetNether==TRUE)?true:false); - // clear out the app's terrain features list - app.ClearTerrainFeaturePosition(); - - app.SetGameHostOption(eGameHostOption_GameType,m_bGameModeSurvival?GameType::SURVIVAL->getId():GameType::CREATIVE->getId() ); - - param->settings = app.GetGameHostOption( eGameHostOption_All ); - -#ifndef _XBOX - g_NetworkManager.FakeLocalPlayerJoined(); -#endif - - LoadingInputParams *loadingParams = new LoadingInputParams(); - loadingParams->func = &CGameNetworkManager::RunNetworkGameThreadProc; - loadingParams->lpParam = (LPVOID)param; - - // Reset the autosave time - app.SetAutosaveTimerTime(); - - UIFullscreenProgressCompletionData *completionData = new UIFullscreenProgressCompletionData(); - completionData->bShowBackground=TRUE; - completionData->bShowLogo=TRUE; - completionData->type = e_ProgressCompletion_CloseAllPlayersUIScenes; - completionData->iPad = DEFAULT_XUI_MENU_USER; - loadingParams->completionData = completionData; - - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_FullscreenProgress, loadingParams); -} - int UIScene_LoadMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int iPad) { UIScene_LoadMenu* pClass = (UIScene_LoadMenu*)pParam; @@ -1670,7 +1703,7 @@ int UIScene_LoadMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int // 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 { @@ -1678,14 +1711,14 @@ int UIScene_LoadMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int 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_LoadMenu::MustSignInReturnedPSN, pClass, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, iPadNotSignedInLive, &UIScene_LoadMenu::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 } @@ -1706,7 +1739,7 @@ int UIScene_LoadMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int pClass->setVisible( true ); 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 { @@ -1714,7 +1747,7 @@ int UIScene_LoadMenu::StartGame_SignInReturned(void *pParam,bool bContinue, int pClass->setVisible( true ); 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 @@ -1754,13 +1787,7 @@ void UIScene_LoadMenu::handleGainFocus(bool navBack) { if(navBack) { - -#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64 - if(getSceneResolution() == eSceneResolution_1080) - { - m_checkboxOnline.setChecked(m_MoreOptionsParams.bOnlineGame == TRUE); - } -#endif + m_checkboxOnline.setChecked(m_MoreOptionsParams.bOnlineGame == TRUE); } } diff --git a/Minecraft.Client/Common/UI/UIScene_LoadMenu.h b/Minecraft.Client/Common/UI/UIScene_LoadMenu.h index e45fa09c..12955151 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_LoadMenu.h @@ -22,10 +22,8 @@ private: UIControl_Button m_buttonGamemode, m_buttonMoreOptions, m_buttonLoadWorld; UIControl_Slider m_sliderDifficulty; UIControl_BitmapIcon m_bitmapIcon; - -#if defined _XBOX_ONE || defined __ORBIS__ || defined _WINDOWS64 + UIControl_CheckBox m_checkboxOnline; -#endif UI_BEGIN_MAP_ELEMENTS_AND_NAMES(IUIScene_StartGame) UI_MAP_ELEMENT( m_controlMainPanel, "MainPanel" ) @@ -35,10 +33,7 @@ private: UI_MAP_ELEMENT( m_labelSeed, "Seed") 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_buttonLoadWorld, "LoadSettings") UI_MAP_ELEMENT( m_sliderDifficulty, "Difficulty") @@ -51,8 +46,10 @@ private: int m_iSaveGameInfoIndex; int m_CurrentDifficulty; - bool m_bGameModeSurvival; + bool m_bGameModeCreative; + int m_iGameModeId; bool m_bHasBeenInCreative; + bool m_bIsSaveOwner; bool m_bRetrievingSaveThumbnail; bool m_bSaveThumbnailReady; bool m_bMultiplayerAllowed; @@ -104,7 +101,6 @@ protected: private: void StartSharedLaunchFlow(); virtual void checkStateAndStartGame(); - void LoadLevelGen(LevelGenerationOptions *levelGen); void LaunchGame(void); #ifdef _DURANGO diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp index 1d90da77..4e48e395 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.cpp @@ -8,7 +8,6 @@ #include "..\..\..\Minecraft.World\net.minecraft.world.level.chunk.storage.h" #include "..\..\..\Minecraft.World\ConsoleSaveFile.h" #include "..\..\..\Minecraft.World\ConsoleSaveFileOriginal.h" -#include "..\..\..\Minecraft.World\ConsoleSaveFileSplit.h" #include "..\..\ProgressRenderer.h" #include "..\..\MinecraftServer.h" #include "..\..\TexturePackRepository.h" @@ -17,6 +16,7 @@ #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) #include "Common\Network\Sony\SonyHttp.h" #include "Common\Network\Sony\SonyRemoteStorage.h" +#include "DLCTexturePack.h" #endif #if defined(__ORBIS__) || defined(__PSVITA__) #include <ces.h> @@ -29,6 +29,7 @@ #ifdef SONY_REMOTE_STORAGE_DOWNLOAD unsigned long UIScene_LoadOrJoinMenu::m_ulFileSize=0L; wstring UIScene_LoadOrJoinMenu::m_wstrStageText=L""; +bool UIScene_LoadOrJoinMenu::m_bSaveTransferRunning = false; #endif @@ -103,9 +104,9 @@ UIScene_LoadOrJoinMenu::UIScene_LoadOrJoinMenu(int iPad, void *initData, UILayer m_buttonListSaves.init(eControl_SavesList); m_buttonListGames.init(eControl_GamesList); - m_labelSavesListTitle.init( app.GetString(IDS_START_GAME) ); - m_labelJoinListTitle.init( app.GetString(IDS_JOIN_GAME) ); - m_labelNoGames.init( app.GetString(IDS_NO_GAMES_FOUND) ); + m_labelSavesListTitle.init( IDS_START_GAME ); + m_labelJoinListTitle.init( IDS_JOIN_GAME ); + m_labelNoGames.init( IDS_NO_GAMES_FOUND ); m_labelNoGames.setVisible( false ); m_controlSavesTimer.setVisible( true ); m_controlJoinTimer.setVisible( true ); @@ -308,6 +309,14 @@ UIScene_LoadOrJoinMenu::~UIScene_LoadOrJoinMenu() void UIScene_LoadOrJoinMenu::updateTooltips() { +#if defined __PS3__ || defined __ORBIS__ || defined __PSVITA__ + if(m_eSaveTransferState!=eSaveTransfer_Idle) + { + // we're in a full screen progress for the save download here, so don't change the tooltips + return; + } +#endif + // update the tooltips // if the saves list has focus, then we should show the Delete Save tooltip // if the games list has focus, then we should the the View Gamercard tooltip @@ -548,6 +557,8 @@ void UIScene_LoadOrJoinMenu::tick() { UIScene::tick(); + + #if (defined __PS3__ || defined __ORBIS__ || defined _DURANGO || defined _WINDOWS64 || defined __PSVITA__) if(m_bExitScene) // navigate forward or back { @@ -560,6 +571,11 @@ void UIScene_LoadOrJoinMenu::tick() // Stop loading thumbnails if we navigate forwards if(hasFocus(m_iPad)) { +#ifdef SONY_REMOTE_STORAGE_DOWNLOAD + // if the loadOrJoin menu has focus again, we can clear the saveTransfer flag now. Added so we can delay the ehternet disconnect till it's cleaned up + if(m_eSaveTransferState == eSaveTransfer_Idle) + m_bSaveTransferRunning = false; +#endif #if defined(_XBOX_ONE) || defined(__ORBIS__) if(m_bUpdateSaveSize) { @@ -775,7 +791,7 @@ void UIScene_LoadOrJoinMenu::tick() { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox( IDS_CONNECTION_FAILED, IDS_IN_PARTY_SESSION_FULL, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); + ui.RequestErrorMessage( IDS_CONNECTION_FAILED, IDS_IN_PARTY_SESSION_FULL, uiIDA,1,ProfileManager.GetPrimaryPad()); } #endif @@ -896,7 +912,7 @@ void UIScene_LoadOrJoinMenu::AddDefaultButtons() m_iMashUpButtonsC=0; m_generators.clear(); - m_buttonListSaves.addItem(app.GetString(IDS_CREATE_NEW_WORLD)); + m_buttonListSaves.addItem(app.GetString(IDS_CREATE_NEW_WORLD)); m_iDefaultButtonsC++; int i = 0; @@ -919,8 +935,10 @@ void UIScene_LoadOrJoinMenu::AddDefaultButtons() } } + // 4J-JEV: For debug. Ignore worlds with no name. + LPCWSTR wstr = levelGen->getWorldName(); + m_buttonListSaves.addItem( wstr ); m_generators.push_back(levelGen); - m_buttonListSaves.addItem(levelGen->getWorldName()); if(uiTexturePackID!=0) { @@ -1005,7 +1023,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr { UINT uiIDA[1]; uiIDA[0] = IDS_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad, NULL, NULL, app.GetStringTable()); + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad); break; } @@ -1018,7 +1036,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr UINT uiIDA[2]; uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(), &UIScene_LoadOrJoinMenu::MustSignInReturnedPSN, this, app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(), &UIScene_LoadOrJoinMenu::MustSignInReturnedPSN, this); } else { @@ -1061,7 +1079,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2, iPad,&UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned,this, app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2, iPad,&UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned,this); } else { @@ -1083,7 +1101,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr numOptions = 4; uiIDA[3]=IDS_COPYSAVE; #endif - ui.RequestMessageBox(IDS_TOOLTIPS_SAVEOPTIONS, IDS_TEXT_SAVEOPTIONS, uiIDA, numOptions, iPad,&UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned,this, app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_TOOLTIPS_SAVEOPTIONS, IDS_TEXT_SAVEOPTIONS, uiIDA, numOptions, iPad,&UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned,this); } else { @@ -1092,7 +1110,7 @@ void UIScene_LoadOrJoinMenu::handleInput(int iPad, int key, bool repeat, bool pr UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2,iPad,&UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned,this, app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2,iPad,&UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned,this); } } ui.PlayUISFX(eSFX_Press); @@ -1293,7 +1311,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_CORRUPT_OR_DAMAGED_SAVE_TITLE, IDS_CORRUPT_OR_DAMAGED_SAVE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned,this, app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_CORRUPT_OR_DAMAGED_SAVE_TITLE, IDS_CORRUPT_OR_DAMAGED_SAVE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned,this); } else @@ -1324,7 +1342,7 @@ void UIScene_LoadOrJoinMenu::handlePress(F64 controlId, F64 childId) uiIDA[1]=IDS_CONFIRM_CANCEL; m_loadMenuInitData = params; - ui.RequestMessageBox(IDS_LOAD_SAVED_WORLD, IDS_CONFIRM_SYNC_REQUIRED, uiIDA, 2, ProfileManager.GetPrimaryPad(),&NeedSyncMessageReturned,this,app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_LOAD_SAVED_WORLD, IDS_CONFIRM_SYNC_REQUIRED, uiIDA, 2, ProfileManager.GetPrimaryPad(),&NeedSyncMessageReturned,this); } else #endif @@ -1411,7 +1429,7 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; // Not allowed to play online - ui.RequestMessageBox(IDS_ONLINE_GAME, IDS_CHAT_RESTRICTION_UGC, uiIDA, 1, m_iPad,NULL,this,app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_ONLINE_GAME, IDS_CHAT_RESTRICTION_UGC, uiIDA, 1, m_iPad,NULL,this); #else // Not allowed to play online ProfileManager.ShowSystemMessage( SCE_MSG_DIALOG_SYSMSG_TYPE_TRC_PSN_CHAT_RESTRICTION, 0 ); @@ -1440,16 +1458,26 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) { m_bIgnoreInput = false; // 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 - 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 { - ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA,1,iPadNotSignedInLive, &UIScene_LoadOrJoinMenu::MustSignInReturnedPSN, this, app.GetStringTable()); + ui.RequestErrorMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA,1,iPadNotSignedInLive, &UIScene_LoadOrJoinMenu::MustSignInReturnedPSN, this); } return; } else if(bPlayStationPlus==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; + } + // PS Plus upsell // 4J-PB - we're not allowed to show the text Playstation Plus - have to call the upsell all the time! // upsell psplus @@ -1514,10 +1542,19 @@ void UIScene_LoadOrJoinMenu::CheckAndJoinGame(int gameIndex) // 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, m_iPad,&UIScene_LoadOrJoinMenu::TexturePackDialogReturned,this,app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_DLC_TEXTUREPACK_NOT_PRESENT_TITLE, IDS_DLC_TEXTUREPACK_NOT_PRESENT, uiIDA, 2, m_iPad,&UIScene_LoadOrJoinMenu::TexturePackDialogReturned,this); return; } + +#ifdef __PSVITA__ + if(CGameNetworkManager::usingAdhocMode() && !SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) + { + // not connected to adhoc anymore, must have connected back to PSN to buy texture pack so sign in again + SQRNetworkManager_AdHoc_Vita::AttemptAdhocSignIn(&UIScene_LoadOrJoinMenu::SignInAdhocReturned, this); + return; + } +#endif } m_controlJoinTimer.setVisible( false ); @@ -2125,7 +2162,7 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JS UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2, iPad,&UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned,pClass, app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_TOOLTIPS_DELETESAVE, IDS_TEXT_DELETE_SAVE, uiIDA, 2, iPad,&UIScene_LoadOrJoinMenu::DeleteSaveDialogReturned,pClass); } break; @@ -2136,7 +2173,7 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JS uiIDA[0]=IDS_CONFIRM_OK; uiIDA[1]=IDS_CONFIRM_CANCEL; - ui.RequestMessageBox(IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_TEXT, uiIDA, 2, iPad,&UIScene_LoadOrJoinMenu::SaveTransferDialogReturned,pClass, app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_TEXT, uiIDA, 2, iPad,&UIScene_LoadOrJoinMenu::SaveTransferDialogReturned,pClass); } break; #endif // SONY_REMOTE_STORAGE_UPLOAD @@ -2147,7 +2184,7 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JS uiIDA[0]=IDS_CONFIRM_OK; uiIDA[1]=IDS_CONFIRM_CANCEL; - ui.RequestMessageBox(IDS_COPYSAVE, IDS_TEXT_COPY_SAVE, uiIDA, 2, iPad,&UIScene_LoadOrJoinMenu::CopySaveDialogReturned,pClass, app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_COPYSAVE, IDS_TEXT_COPY_SAVE, uiIDA, 2, iPad,&UIScene_LoadOrJoinMenu::CopySaveDialogReturned,pClass); } break; #endif @@ -2164,6 +2201,91 @@ int UIScene_LoadOrJoinMenu::SaveOptionsDialogReturned(void *pParam,int iPad,C4JS return 0; } + +#if defined (__PSVITA__) + +int UIScene_LoadOrJoinMenu::SignInAdhocReturned(void *pParam,bool bContinue, int iPad) +{ + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; + pClass->m_bIgnoreInput = false; + return 0; + +} + + + +int UIScene_LoadOrJoinMenu::MustSignInTexturePack(void *pParam,int iPad,C4JStorage::EMessageResult result) +{ + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; + + if(result==C4JStorage::EMessage_ResultAccept) + { + SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack, pClass); + } + else + { + pClass->m_bIgnoreInput = false; + } + + return 0; +} + + +int UIScene_LoadOrJoinMenu::MustSignInReturnedTexturePack(void *pParam,bool bContinue, int iPad) +{ + UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu*)pParam; + + int commerceState = app.GetCommerceState(); + while( commerceState != CConsoleMinecraftApp::eCommerce_State_Offline && + commerceState != CConsoleMinecraftApp::eCommerce_State_Online && + commerceState != CConsoleMinecraftApp::eCommerce_State_Error) + { + Sleep(10); + commerceState = app.GetCommerceState(); + } + + if(bContinue==true) + { + SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); + if(pSONYDLCInfo!=NULL) + { + char chName[42]; + char chKeyName[20]; + char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; + + memset(chSkuID,0,SCE_NP_COMMERCE2_SKU_ID_LEN); + // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. + // So we assume the first sku for the product is the one we want + // MGH - keyname in the DLC file is 16 chars long, but there's no space for a NULL terminating char + memset(chKeyName, 0, sizeof(chKeyName)); + strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); + +#ifdef __ORBIS__ + strcpy(chName, chKeyName); +#else + sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); +#endif + app.GetDLCSkuIDFromProductList(chName,chSkuID); + // 4J-PB - need to check for an empty store + if(app.CheckForEmptyStore(iPad)==false) + { + if(app.DLCAlreadyPurchased(chSkuID)) + { + app.DownloadAlreadyPurchased(chSkuID); + } + else + { + app.Checkout(chSkuID); + } + } + } + } + pClass->m_bIgnoreInput = false; + return 0; +} + +#endif + int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { UIScene_LoadOrJoinMenu *pClass = (UIScene_LoadOrJoinMenu *)pParam; @@ -2173,24 +2295,53 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS { // we need to enable background downloading for the DLC XBackgroundDownloadSetMode(XBACKGROUND_DOWNLOAD_MODE_ALWAYS_ALLOW); -#if TO_BE_IMPLEMENTED - ULONGLONG ullOfferID_Full; - ULONGLONG ullIndexA[1]; - app.GetDLCFullOfferIDForPackID(pClass->m_initData->selectedSession->data.texturePackParentId,&ullOfferID_Full); +#if defined __PSVITA__ || defined __PS3__ || defined __ORBIS__ +#ifdef __PSVITA__ + if(!ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad()) && CGameNetworkManager::usingAdhocMode()) + { + // get them to sign in to online + UINT uiIDA[2]; + uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; + uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; + ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_LoadOrJoinMenu::MustSignInTexturePack,pClass); + return; + } +#endif - if( result==C4JStorage::EMessage_ResultAccept ) // Full version - { - ullIndexA[0]=ullOfferID_Full; - StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); + SONYDLC *pSONYDLCInfo=app.GetSONYDLCInfo(pClass->m_initData->selectedSession->data.texturePackParentId); + if(pSONYDLCInfo!=NULL) + { + char chName[42]; + char chKeyName[20]; + char chSkuID[SCE_NP_COMMERCE2_SKU_ID_LEN]; - } - else // trial version - { - DLC_INFO *pDLCInfo=app.GetDLCInfoForFullOfferID(ullOfferID_Full); - ullIndexA[0]=pDLCInfo->ullOfferID_Trial; - StorageManager.InstallOffer(1,ullIndexA,NULL,NULL); - } + memset(chSkuID,0,SCE_NP_COMMERCE2_SKU_ID_LEN); + // we have to retrieve the skuid from the store info, it can't be hardcoded since Sony may change it. + // So we assume the first sku for the product is the one we want + // MGH - keyname in the DLC file is 16 chars long, but there's no space for a NULL terminating char + memset(chKeyName, 0, sizeof(chKeyName)); + strncpy(chKeyName, pSONYDLCInfo->chDLCKeyname, 16); + +#ifdef __ORBIS__ + strcpy(chName, chKeyName); +#else + sprintf(chName,"%s-%s",app.GetCommerceCategory(),chKeyName); +#endif + app.GetDLCSkuIDFromProductList(chName,chSkuID); + // 4J-PB - need to check for an empty store + if(app.CheckForEmptyStore(iPad)==false) + { + if(app.DLCAlreadyPurchased(chSkuID)) + { + app.DownloadAlreadyPurchased(chSkuID); + } + else + { + app.Checkout(chSkuID); + } + } + } #endif @@ -2208,7 +2359,7 @@ int UIScene_LoadOrJoinMenu::TexturePackDialogReturned(void *pParam,int iPad,C4JS { // 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); } } #endif @@ -2256,8 +2407,7 @@ int UIScene_LoadOrJoinMenu::PSN_SignInReturned(void *pParam,bool bContinue, int int ret = sceNpBasicRecvMessageCustom(SCE_NP_BASIC_MESSAGE_MAIN_TYPE_INVITE, SCE_NP_BASIC_RECV_MESSAGE_OPTIONS_INCLUDE_BOOTABLE, SYS_MEMORY_CONTAINER_ID_INVALID); app.DebugPrintf("sceNpBasicRecvMessageCustom return %d ( %08x )\n", ret, ret); #elif defined __PSVITA__ - // TO BE IMPLEMENTED FOR VITA - PSVITA_STUBBED; + SQRNetworkManager_Vita::RecvInviteGUI(); #else SQRNetworkManager_Orbis::RecvInviteGUI(); #endif @@ -2377,9 +2527,14 @@ bool g_bForceVitaSaveWipe = false; int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter ) { + m_bSaveTransferRunning = true; +#ifdef __PS3__ + StorageManager.SetSaveTransferInProgress(true); +#endif Compression::UseDefaultThreadStorage(); UIScene_LoadOrJoinMenu* pClass = (UIScene_LoadOrJoinMenu *) lpParameter; pClass->m_saveTransferDownloadCancelled = false; + m_bSaveTransferRunning = true; bool bAbortCalled = false; Minecraft *pMinecraft=Minecraft::GetInstance(); bool bSaveFileCreated = false; @@ -2416,14 +2571,24 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter { if(app.getRemoteStorage()->saveIsAvailable()) { - pClass->m_eSaveTransferState = eSaveTransfer_CreateDummyFile; + if(app.getRemoteStorage()->saveVersionSupported()) + { + pClass->m_eSaveTransferState = eSaveTransfer_CreateDummyFile; + } + else + { + // must be a newer version of the save in the cloud that we don't support yet + UINT uiIDA[1]; + uiIDA[0]=IDS_CONFIRM_OK; + ui.RequestAlertMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_WRONG_VERSION, uiIDA, 1, ProfileManager.GetPrimaryPad(),RemoteSaveNotFoundCallback,pClass); + } } - else + else { // no save available, inform the user about the functionality UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_NOT_AVAILABLE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),RemoteSaveNotFoundCallback,pClass, app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_NOT_AVAILABLE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),RemoteSaveNotFoundCallback,pClass); } } break; @@ -2446,7 +2611,11 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter BYTE bTextMetadata[88]; ZeroMemory(bTextMetadata,88); - int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, app.getRemoteStorage()->getSaveSeed(), true, app.getRemoteStorage()->getSaveHostOptions(), app.getRemoteStorage()->getSaveTexturePack() ); + unsigned int hostOptions = app.getRemoteStorage()->getSaveHostOptions(); +#ifdef __ORBIS__ + app.SetGameHostOption(hostOptions, eGameHostOption_WorldSize, e_worldSize_Classic); // force the classic world size on, otherwise it's unknown and we can't expand +#endif + int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, app.getRemoteStorage()->getSaveSeed(), true, hostOptions, app.getRemoteStorage()->getSaveTexturePack() ); // set the icon and save image StorageManager.SetSaveImages(pbThumbnailData,dwThumbnailDataSize,pbDataSaveImage,dwDataSizeSaveImage,bTextMetadata,iTextMetadataBytes); @@ -2606,7 +2775,9 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter BYTE bTextMetadata[88]; ZeroMemory(bTextMetadata,88); - int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, app.getRemoteStorage()->getSaveSeed(), true, app.getRemoteStorage()->getSaveHostOptions(), app.getRemoteStorage()->getSaveTexturePack() ); + unsigned int remoteHostOptions = app.getRemoteStorage()->getSaveHostOptions(); + app.SetGameHostOption(eGameHostOption_All, remoteHostOptions ); + int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, app.getRemoteStorage()->getSaveSeed(), true, remoteHostOptions, app.getRemoteStorage()->getSaveTexturePack() ); // set the icon and save image StorageManager.SetSaveImages(pbThumbnailData,dwThumbnailDataSize,pbDataSaveImage,dwDataSizeSaveImage,bTextMetadata,iTextMetadataBytes); @@ -2668,7 +2839,7 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; app.getRemoteStorage()->waitForStorageManagerIdle(); // wait for everything to complete before we hand control back to the player - ui.RequestMessageBox( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_DOWNLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass, app.GetStringTable()); + ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_DOWNLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass); pClass->m_eSaveTransferState = eSaveTransfer_Finished; } break; @@ -2709,20 +2880,20 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter } else { - // delete the save file - app.getRemoteStorage()->waitForStorageManagerIdle(); - C4JStorage::ESaveGameState eDeleteStatus = StorageManager.DeleteSaveData(&pSaveDetails->SaveInfoA[saveInfoIndex],UIScene_LoadOrJoinMenu::CrossSaveDeleteOnErrorReturned,pClass); - if(eDeleteStatus == C4JStorage::ESaveGame_Delete) - { - pClass->m_eSaveTransferState = eSaveTransfer_ErrorDeletingSave; - } - else - { - app.DebugPrintf("StorageManager.DeleteSaveData failed!!\n"); - pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; + // delete the save file + app.getRemoteStorage()->waitForStorageManagerIdle(); + C4JStorage::ESaveGameState eDeleteStatus = StorageManager.DeleteSaveData(&pSaveDetails->SaveInfoA[saveInfoIndex],UIScene_LoadOrJoinMenu::CrossSaveDeleteOnErrorReturned,pClass); + if(eDeleteStatus == C4JStorage::ESaveGame_Delete) + { + pClass->m_eSaveTransferState = eSaveTransfer_ErrorDeletingSave; + } + else + { + app.DebugPrintf("StorageManager.DeleteSaveData failed!!\n"); + pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; + } } } - } else { pClass->m_eSaveTransferState = eSaveTransfer_ErrorMesssage; @@ -2743,7 +2914,25 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, IDS_SAVE_TRANSFER_DOWNLOADFAILED, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass, app.GetStringTable()); + UINT errorMessage = IDS_SAVE_TRANSFER_DOWNLOADFAILED; + if(!ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) + { + errorMessage = IDS_ERROR_NETWORK; // show "A network error has occurred." +#ifdef __ORBIS__ + if(!ProfileManager.isSignedInPSN(ProfileManager.GetPrimaryPad())) + { + errorMessage = IDS_PRO_NOTONLINE_TEXT; // show "not signed into PSN" + } +#endif +#ifdef __VITA__ + if(!ProfileManager.IsSignedInPSN(ProfileManager.GetPrimaryPad())) + { + errorMessage = IDS_PRO_NOTONLINE_TEXT; // show "not signed into PSN" + } +#endif + + } + ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_DOWNLOAD, errorMessage, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveFinishedCallback,pClass); pClass->m_eSaveTransferState = eSaveTransfer_Finished; } if(bSaveFileCreated) // save file has been created, then deleted. @@ -2755,14 +2944,16 @@ int UIScene_LoadOrJoinMenu::DownloadSonyCrossSaveThreadProc( LPVOID lpParameter break; case eSaveTransfer_Finished: { - } // waiting to dismiss the dialog break; } Sleep(50); } - + m_bSaveTransferRunning = false; +#ifdef __PS3__ + StorageManager.SetSaveTransferInProgress(false); +#endif return 0; } @@ -2887,7 +3078,7 @@ int UIScene_LoadOrJoinMenu::UploadSonyCrossSaveThreadProc( LPVOID lpParameter ) { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass, app.GetStringTable()); + ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADCOMPLETE, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass); pClass->m_eSaveUploadState = esaveUpload_Finished; } break; @@ -2904,7 +3095,7 @@ int UIScene_LoadOrJoinMenu::UploadSonyCrossSaveThreadProc( LPVOID lpParameter ) { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADFAILED, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass, app.GetStringTable()); + ui.RequestErrorMessage( IDS_TOOLTIPS_SAVETRANSFER_UPLOAD, IDS_SAVE_TRANSFER_UPLOADFAILED, uiIDA,1,ProfileManager.GetPrimaryPad(),CrossSaveUploadFinishedCallback,pClass); pClass->m_eSaveUploadState = esaveUpload_Finished; } } @@ -2927,7 +3118,7 @@ void UIScene_LoadOrJoinMenu::SaveUploadReturned(LPVOID lpParam, SonyRemoteStorag if(pClass->m_saveTransferUploadCancelled) { UINT uiIDA[1] = { IDS_CONFIRM_OK }; - ui.RequestMessageBox( IDS_CANCEL_UPLOAD_TITLE, IDS_CANCEL_UPLOAD_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), CrossSaveUploadFinishedCallback, pClass, app.GetStringTable() ); + ui.RequestErrorMessage( IDS_CANCEL_UPLOAD_TITLE, IDS_CANCEL_UPLOAD_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), CrossSaveUploadFinishedCallback, pClass ); pClass->m_eSaveUploadState=esaveUpload_Finished; } else @@ -3054,8 +3245,18 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) switch(UIScene_LoadOrJoinMenu::s_eSaveTransferFile) { case eSaveTransferFile_Marker: - UIScene_LoadOrJoinMenu::s_eSaveTransferFile = eSaveTransferFile_Metadata; - RequestFileSize( pStateContainer, L"metadata" ); + // MGH - the marker file now contains the save file version number + // if the version is higher than we handle, cancel the download. + if(UIScene_LoadOrJoinMenu::s_transferData[0] > SAVE_FILE_VERSION_NUMBER) + { + pMinecraft->progressRenderer->progressStage(IDS_SAVETRANSFER_NONE_FOUND); + pStateContainer->m_eSaveTransferState=C4JStorage::eSaveTransfer_Idle; + } + else + { + UIScene_LoadOrJoinMenu::s_eSaveTransferFile = eSaveTransferFile_Metadata; + RequestFileSize( pStateContainer, L"metadata" ); + } break; case eSaveTransferFile_Metadata: { @@ -3078,7 +3279,28 @@ int UIScene_LoadOrJoinMenu::DownloadXbox360SaveThreadProc( LPVOID lpParameter ) byteArray ba(thumbnailSize); dis.readFully(ba); - StorageManager.SetSaveImages(ba.data, ba.length, NULL, 0, NULL, 0); + + + // retrieve the seed value from the image metadata, we need to change to host options, then set it back again + bool bHostOptionsRead = false; + unsigned int uiHostOptions = 0; + DWORD dwTexturePack; + __int64 seedVal; + + char szSeed[50]; + ZeroMemory(szSeed,50); + app.GetImageTextData(ba.data,ba.length,(unsigned char *)&szSeed,uiHostOptions,bHostOptionsRead,dwTexturePack); + sscanf_s(szSeed, "%I64d", &seedVal); + + app.SetGameHostOption(uiHostOptions, eGameHostOption_WorldSize, e_worldSize_Classic); // force the classic world size on, otherwise it's unknown and we can't expand + + + BYTE bTextMetadata[88]; + ZeroMemory(bTextMetadata,88); + + int iTextMetadataBytes = app.CreateImageTextData(bTextMetadata, seedVal, true, uiHostOptions, dwTexturePack); + // set the icon and save image + StorageManager.SetSaveImages(ba.data, ba.length, NULL, 0, bTextMetadata, iTextMetadataBytes); delete ba.data; } @@ -3468,12 +3690,12 @@ int UIScene_LoadOrJoinMenu::CopySaveDataReturned(LPVOID lpParam, bool success, C if( stat == C4JStorage::ESaveGame_CopyCompleteFailLocalStorage ) { ui.LeaveCallbackIdCriticalSection(); - ui.RequestMessageBox(IDS_COPYSAVE_FAILED_TITLE, IDS_COPYSAVE_FAILED_LOCAL, uiIDA, 1, ProfileManager.GetPrimaryPad(), CopySaveErrorDialogFinishedCallback, lpParam, app.GetStringTable()); + ui.RequestErrorMessage(IDS_COPYSAVE_FAILED_TITLE, IDS_COPYSAVE_FAILED_LOCAL, uiIDA, 1, ProfileManager.GetPrimaryPad(), CopySaveErrorDialogFinishedCallback, lpParam); } else if( stat == C4JStorage::ESaveGame_CopyCompleteFailQuota ) { ui.LeaveCallbackIdCriticalSection(); - ui.RequestMessageBox(IDS_COPYSAVE_FAILED_TITLE, IDS_COPYSAVE_FAILED_QUOTA, uiIDA, 1, ProfileManager.GetPrimaryPad(), CopySaveErrorDialogFinishedCallback, lpParam, app.GetStringTable()); + ui.RequestErrorMessage(IDS_COPYSAVE_FAILED_TITLE, IDS_COPYSAVE_FAILED_QUOTA, uiIDA, 1, ProfileManager.GetPrimaryPad(), CopySaveErrorDialogFinishedCallback, lpParam); } else { diff --git a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h index 01d94b05..3599aa37 100644 --- a/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_LoadOrJoinMenu.h @@ -153,6 +153,12 @@ public: static int DeleteSaveDataReturned(LPVOID lpParam,bool bRes); static int RenameSaveDataReturned(LPVOID lpParam,bool bRes); static int KeyboardCompleteWorldNameCallback(LPVOID lpParam,bool bRes); +#ifdef __PSVITA__ + static int MustSignInTexturePack(void *pParam,int iPad,C4JStorage::EMessageResult result); + static int MustSignInReturnedTexturePack(void *pParam,bool bContinue, int iPad); + static int SignInAdhocReturned(void *pParam,bool bContinue, int iPad); +#endif + protected: void handlePress(F64 controlId, F64 childId); void LoadLevelGen(LevelGenerationOptions *levelGen); @@ -250,6 +256,7 @@ private: eSaveTransferState m_eSaveTransferState; static unsigned long m_ulFileSize; static wstring m_wstrStageText; + static bool m_bSaveTransferRunning; int m_iProgress; char m_downloadedUniqueFilename[64];//SCE_SAVE_DATA_DIRNAME_DATA_MAXSIZE]; bool m_saveTransferDownloadCancelled; @@ -265,6 +272,9 @@ private: static ConsoleSaveFile* SonyCrossSaveConvert(); static void CancelSaveTransferCallback(LPVOID lpParam); +public: + static bool isSaveTransferRunning() { return m_bSaveTransferRunning; } +private: #endif #ifdef SONY_REMOTE_STORAGE_UPLOAD diff --git a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp index e05b6df8..fe743adc 100644 --- a/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_MainMenu.cpp @@ -12,6 +12,8 @@ Random *UIScene_MainMenu::random = new Random(); +EUIScene UIScene_MainMenu::eNavigateWhenReady = (EUIScene) -1; + UIScene_MainMenu::UIScene_MainMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) { #ifdef __ORBIS @@ -31,31 +33,31 @@ UIScene_MainMenu::UIScene_MainMenu(int iPad, void *initData, UILayer *parentLaye m_bIgnorePress=false; - m_buttons[(int)eControl_PlayGame].init(app.GetString(IDS_PLAY_GAME),eControl_PlayGame); + m_buttons[(int)eControl_PlayGame].init(IDS_PLAY_GAME,eControl_PlayGame); #ifdef _XBOX_ONE - if(!ProfileManager.IsFullVersion()) m_buttons[(int)eControl_PlayGame].setLabel(app.GetString(IDS_PLAY_TRIAL_GAME)); + if(!ProfileManager.IsFullVersion()) m_buttons[(int)eControl_PlayGame].setLabel(IDS_PLAY_TRIAL_GAME); app.SetReachedMainMenu(); #endif - m_buttons[(int)eControl_Leaderboards].init(app.GetString(IDS_LEADERBOARDS),eControl_Leaderboards); - m_buttons[(int)eControl_Achievements].init(app.GetString(IDS_ACHIEVEMENTS),eControl_Achievements); - m_buttons[(int)eControl_HelpAndOptions].init(app.GetString(IDS_HELP_AND_OPTIONS),eControl_HelpAndOptions); + m_buttons[(int)eControl_Leaderboards].init(IDS_LEADERBOARDS,eControl_Leaderboards); + m_buttons[(int)eControl_Achievements].init( (UIString)IDS_ACHIEVEMENTS,eControl_Achievements); + m_buttons[(int)eControl_HelpAndOptions].init(IDS_HELP_AND_OPTIONS,eControl_HelpAndOptions); if(ProfileManager.IsFullVersion()) { m_bTrialVersion=false; - m_buttons[(int)eControl_UnlockOrDLC].init(app.GetString(IDS_DOWNLOADABLECONTENT),eControl_UnlockOrDLC); + m_buttons[(int)eControl_UnlockOrDLC].init(IDS_DOWNLOADABLECONTENT,eControl_UnlockOrDLC); } else { m_bTrialVersion=true; - m_buttons[(int)eControl_UnlockOrDLC].init(app.GetString(IDS_UNLOCK_FULL_GAME),eControl_UnlockOrDLC); + m_buttons[(int)eControl_UnlockOrDLC].init(IDS_UNLOCK_FULL_GAME,eControl_UnlockOrDLC); } #ifndef _DURANGO m_buttons[(int)eControl_Exit].init(app.GetString(IDS_EXIT_GAME),eControl_Exit); #else - m_buttons[(int)eControl_XboxHelp].init(app.GetString(IDS_XBOX_HELP_APP), eControl_XboxHelp); + m_buttons[(int)eControl_XboxHelp].init(IDS_XBOX_HELP_APP, eControl_XboxHelp); #endif #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) @@ -151,6 +153,11 @@ void UIScene_MainMenu::handleGainFocus(bool navBack) ui.ShowPlayerDisplayname(false); m_bIgnorePress=false; + if (eNavigateWhenReady >= 0) + { + return; + } + // 4J-JEV: This needs to come before SetLockedProfile(-1) as it wipes the XbLive contexts. if (!navBack) { @@ -175,7 +182,7 @@ void UIScene_MainMenu::handleGainFocus(bool navBack) if(navBack && ProfileManager.IsFullVersion()) { // Replace the Unlock Full Game with Downloadable Content - m_buttons[(int)eControl_UnlockOrDLC].setLabel(app.GetString(IDS_DOWNLOADABLECONTENT)); + m_buttons[(int)eControl_UnlockOrDLC].setLabel(IDS_DOWNLOADABLECONTENT); } #if TO_BE_IMPLEMENTED @@ -223,11 +230,25 @@ wstring UIScene_MainMenu::getMoviePath() return L"MainMenu"; } +void UIScene_MainMenu::handleReload() +{ +#if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) + // Not allowed to exit from a PS3 game from the game - have to use the PS button + removeControl( &m_buttons[(int)eControl_Exit], false ); + // We don't have a way to display trophies/achievements, so remove the button + removeControl( &m_buttons[(int)eControl_Achievements], false ); +#endif +#ifdef _DURANGO + // Allowed to not have achievements in the menu + removeControl( &m_buttons[(int)eControl_Achievements], false ); +#endif +} + void UIScene_MainMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) { //app.DebugPrintf("UIScene_DebugOverlay handling input for pad %d, key %d, down- %s, pressed- %s, released- %s\n", iPad, key, down?"TRUE":"FALSE", pressed?"TRUE":"FALSE", released?"TRUE":"FALSE"); - if(m_bIgnorePress) return; + if ( m_bIgnorePress || (eNavigateWhenReady >= 0) ) return; #if defined (__ORBIS__) || defined (__PSVITA__) // ignore all players except player 0 - it's their profile that is currently being used @@ -265,7 +286,7 @@ void UIScene_MainMenu::handleInput(int iPad, int key, bool repeat, bool pressed, UINT uiIDA[2]; uiIDA[0]=IDS__NETWORK_PSN; uiIDA[1]=IDS_NETWORK_ADHOC; - ui.RequestMessageBox(IDS_SELECT_NETWORK_MODE_TITLE, IDS_SELECT_NETWORK_MODE_TEXT, uiIDA, 2, XUSER_INDEX_ANY, &UIScene_MainMenu::SelectNetworkModeReturned,this); + ui.RequestErrorMessage(IDS_SELECT_NETWORK_MODE_TITLE, IDS_SELECT_NETWORK_MODE_TEXT, uiIDA, 2, XUSER_INDEX_ANY, &UIScene_MainMenu::SelectNetworkModeReturned,this); } break; #endif @@ -281,7 +302,11 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) { int primaryPad = ProfileManager.GetPrimaryPad(); +#ifdef _XBOX_ONE + int (*signInReturnedFunc) (LPVOID,const bool, const int iPad, const int iController) = NULL; +#else int (*signInReturnedFunc) (LPVOID,const bool, const int iPad) = NULL; +#endif switch((int)controlId) { @@ -343,7 +368,7 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) UINT uiIDA[2]; uiIDA[0]=IDS_CANCEL; uiIDA[1]=IDS_OK; - ui.RequestMessageBox(IDS_WARNING_ARCADE_TITLE, IDS_WARNING_ARCADE_TEXT, uiIDA, 2, XUSER_INDEX_ANY,&UIScene_MainMenu::ExitGameReturned,this); + ui.RequestErrorMessage(IDS_WARNING_ARCADE_TITLE, IDS_WARNING_ARCADE_TEXT, uiIDA, 2, XUSER_INDEX_ANY,&UIScene_MainMenu::ExitGameReturned,this); } else { @@ -390,7 +415,7 @@ void UIScene_MainMenu::handlePress(F64 controlId, F64 childId) UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; uiIDA[1]=IDS_CONFIRM_CANCEL; - ui.RequestMessageBox(IDS_MUST_SIGN_IN_TITLE, IDS_MUST_SIGN_IN_TEXT, uiIDA, 2, primaryPad, &UIScene_MainMenu::MustSignInReturned, this, app.GetStringTable()); + ui.RequestErrorMessage(IDS_MUST_SIGN_IN_TITLE, IDS_MUST_SIGN_IN_TEXT, uiIDA, 2, primaryPad, &UIScene_MainMenu::MustSignInReturned, this); } } } @@ -557,7 +582,15 @@ int UIScene_MainMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EM SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_MainMenu::Leaderboards_SignInReturned, pClass); break; case eAction_RunGamePSN: - SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_MainMenu::CreateLoad_SignInReturned, pClass); + if(CGameNetworkManager::usingAdhocMode()) + { + SQRNetworkManager_AdHoc_Vita::AttemptAdhocSignIn(&UIScene_MainMenu::CreateLoad_SignInReturned, pClass); + } + else + { + SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_MainMenu::CreateLoad_SignInReturned, pClass); + + } break; case eAction_RunUnlockOrDLCPSN: //CD - Must force Ad-Hoc off if they want commerce PSN sign-in @@ -604,7 +637,11 @@ int UIScene_MainMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EM } #endif +#ifdef _XBOX_ONE +int UIScene_MainMenu::HelpAndOptions_SignInReturned(void *pParam,bool bContinue,int iPad, int iController) +#else int UIScene_MainMenu::HelpAndOptions_SignInReturned(void *pParam,bool bContinue,int iPad) +#endif { UIScene_MainMenu *pClass = (UIScene_MainMenu *)pParam; @@ -621,7 +658,7 @@ int UIScene_MainMenu::HelpAndOptions_SignInReturned(void *pParam,bool bContinue, #ifdef _XBOX_ONE ui.ShowPlayerDisplayname(true); #endif - ui.NavigateToScene(iPad,eUIScene_HelpAndOptionsMenu); + proceedToScene(iPad, eUIScene_HelpAndOptionsMenu); } #if TO_BE_IMPLEMENTED else @@ -662,16 +699,20 @@ int UIScene_MainMenu::HelpAndOptions_SignInReturned(void *pParam,bool bContinue, } #ifdef _XBOX_ONE -int UIScene_MainMenu::ChooseUser_SignInReturned(void *pParam, bool bContinue, int iPad) +int UIScene_MainMenu::ChooseUser_SignInReturned(void *pParam, bool bContinue, int iPad, int iController) { UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; pClass->m_bIgnorePress = false; - + pClass->updateTooltips(); return 0; } #endif +#ifdef _XBOX_ONE +int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, int iPad, int iController) +#else int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, int iPad) +#endif { UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; @@ -685,7 +726,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, in if(ProfileManager.IsGuest(ProfileManager.GetPrimaryPad())) { pClass->m_bIgnorePress=false; - ui.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); + ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); } else { @@ -723,7 +764,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, in if(ProfileManager.IsGuest(iPad)) { pClass->m_bIgnorePress=false; - ui.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); + ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); } else { @@ -741,7 +782,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, in #ifdef _XBOX_ONE ui.ShowPlayerDisplayname(true); #endif - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); + proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); } else { @@ -804,7 +845,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, in #ifdef _XBOX_ONE ui.ShowPlayerDisplayname(true); #endif - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); + proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); #endif } } @@ -818,7 +859,7 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, in #ifdef _XBOX_ONE ui.ShowPlayerDisplayname(true); #endif - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); + proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); #endif } } @@ -869,7 +910,11 @@ int UIScene_MainMenu::CreateLoad_SignInReturned(void *pParam, bool bContinue, in return 0; } +#ifdef _XBOX_ONE +int UIScene_MainMenu::Leaderboards_SignInReturned(void *pParam,bool bContinue,int iPad,int iController) +#else int UIScene_MainMenu::Leaderboards_SignInReturned(void *pParam,bool bContinue,int iPad) +#endif { UIScene_MainMenu *pClass = (UIScene_MainMenu *)pParam; @@ -884,12 +929,12 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void *pParam,bool bContinue,in if(ProfileManager.IsGuest(ProfileManager.GetPrimaryPad())) { pClass->m_bIgnorePress=false; - ui.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); + ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); } else if(!ProfileManager.IsSignedInLive(ProfileManager.GetPrimaryPad())) { pClass->m_bIgnorePress=false; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1); } else { @@ -900,11 +945,11 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void *pParam,bool bContinue,in if(bContentRestricted) { pClass->m_bIgnorePress=false; -#if !(defined(_XBOX) || defined(_WIN64)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms +#if !(defined(_XBOX) || defined(_WINDOWS64) || defined(_XBOX_ONE) ) // 4J Stu - Temp to get the win build running, but so we check this for other platforms // you can't see leaderboards UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad()); #endif } else @@ -913,7 +958,7 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void *pParam,bool bContinue,in #ifdef _XBOX_ONE ui.ShowPlayerDisplayname(true); #endif - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_LeaderboardsMenu); + proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LeaderboardsMenu); } } } @@ -935,7 +980,11 @@ int UIScene_MainMenu::Leaderboards_SignInReturned(void *pParam,bool bContinue,in return 0; } +#ifdef _XBOX_ONE +int UIScene_MainMenu::Achievements_SignInReturned(void *pParam,bool bContinue,int iPad,int iController) +#else int UIScene_MainMenu::Achievements_SignInReturned(void *pParam,bool bContinue,int iPad) +#endif { UIScene_MainMenu *pClass = (UIScene_MainMenu *)pParam; @@ -965,7 +1014,11 @@ int UIScene_MainMenu::Achievements_SignInReturned(void *pParam,bool bContinue,in return 0; } +#ifdef _XBOX_ONE +int UIScene_MainMenu::UnlockFullGame_SignInReturned(void *pParam,bool bContinue,int iPad,int iController) +#else int UIScene_MainMenu::UnlockFullGame_SignInReturned(void *pParam,bool bContinue,int iPad) +#endif { UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; @@ -995,8 +1048,8 @@ int UIScene_MainMenu::UnlockFullGame_SignInReturned(void *pParam,bool bContinue, return 0; } -#ifdef _DURANGO -int UIScene_MainMenu::XboxHelp_SignInReturned(void *pParam, bool bContinue, int iPad) +#ifdef _XBOX_ONE +int UIScene_MainMenu::XboxHelp_SignInReturned(void *pParam, bool bContinue, int iPad, int iController) { UIScene_MainMenu* pClass = (UIScene_MainMenu*)pParam; @@ -1096,7 +1149,7 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_PlayGame(void * { UINT uiIDA[1]; uiIDA[0]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::PlayOfflineReturned, pClass, app.GetStringTable()); + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::PlayOfflineReturned, pClass); return; } @@ -1123,7 +1176,7 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_PlayGame(void * UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; uiIDA[1]=IDS_CONFIRM_CANCEL; - ui.RequestMessageBox(IDS_MUST_SIGN_IN_TITLE, IDS_MUST_SIGN_IN_TEXT, uiIDA, 2, primaryPad, &UIScene_MainMenu::MustSignInReturned, pClass, app.GetStringTable()); + ui.RequestErrorMessage(IDS_MUST_SIGN_IN_TITLE, IDS_MUST_SIGN_IN_TEXT, uiIDA, 2, primaryPad, &UIScene_MainMenu::MustSignInReturned, pClass); } } } @@ -1188,7 +1241,7 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_Leaderboards(vo { UINT uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, pClass, app.GetStringTable()); + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, pClass); return; } @@ -1213,7 +1266,7 @@ void UIScene_MainMenu::RefreshChatAndContentRestrictionsReturned_Leaderboards(vo UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; uiIDA[1]=IDS_CONFIRM_CANCEL; - ui.RequestMessageBox(IDS_MUST_SIGN_IN_TITLE, IDS_MUST_SIGN_IN_TEXT, uiIDA, 2, primaryPad, &UIScene_MainMenu::MustSignInReturned, pClass, app.GetStringTable()); + ui.RequestErrorMessage(IDS_MUST_SIGN_IN_TITLE, IDS_MUST_SIGN_IN_TEXT, uiIDA, 2, primaryPad, &UIScene_MainMenu::MustSignInReturned, pClass); } } } @@ -1257,7 +1310,7 @@ void UIScene_MainMenu::RunPlayGame(int iPad) uiIDA[0]=IDS_OK; m_bIgnorePress=false; - ui.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); + ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); } else { @@ -1308,7 +1361,7 @@ void UIScene_MainMenu::RunPlayGame(int iPad) { uiIDA[0]=IDS_NETWORK_ADHOC; // this should be "Connect to adhoc network" - ui.RequestMessageBox(IDS_PRO_NOTADHOCONLINE_TITLE, IDS_PRO_NOTADHOCONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this, app.GetStringTable()); + ui.RequestErrorMessage(IDS_PRO_NOTADHOCONLINE_TITLE, IDS_PRO_NOTADHOCONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this); } else { @@ -1330,12 +1383,12 @@ void UIScene_MainMenu::RunPlayGame(int iPad) ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, iPad, &UIScene_MainMenu::MustSignInReturnedPSN, this, app.GetStringTable()); return; } */ - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this, app.GetStringTable()); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this); } #else - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, iPad, &UIScene_MainMenu::MustSignInReturnedPSN, this, app.GetStringTable()); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, iPad, &UIScene_MainMenu::MustSignInReturnedPSN, this); #endif #elif defined __ORBIS__ @@ -1349,7 +1402,7 @@ void UIScene_MainMenu::RunPlayGame(int iPad) UINT uiIDA[1]; uiIDA[0] = IDS_PRO_NOTONLINE_DECLINE; - ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad, UIScene_MainMenu::PlayOfflineReturned, this, app.GetStringTable()); + ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad, UIScene_MainMenu::PlayOfflineReturned, this); } else { @@ -1358,7 +1411,7 @@ void UIScene_MainMenu::RunPlayGame(int iPad) UINT uiIDA[2]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; uiIDA[1] = IDS_PRO_NOTONLINE_DECLINE; - ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, iPad, &UIScene_MainMenu::MustSignInReturnedPSN, this, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, iPad, &UIScene_MainMenu::MustSignInReturnedPSN, this); return; } #else @@ -1366,7 +1419,7 @@ void UIScene_MainMenu::RunPlayGame(int iPad) #ifdef _XBOX_ONE ui.ShowPlayerDisplayname(true); #endif - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); + proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); #endif } else @@ -1438,7 +1491,7 @@ void UIScene_MainMenu::RunPlayGame(int iPad) #ifdef _XBOX_ONE ui.ShowPlayerDisplayname(true); #endif - ui.NavigateToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); + proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_LoadOrJoinMenu); #endif } } @@ -1482,7 +1535,7 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) // guests can't look at leaderboards if(ProfileManager.IsGuest(iPad)) { - ui.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); + ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); } else if(!ProfileManager.IsSignedInLive(iPad)) { @@ -1491,7 +1544,7 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) // get them to sign in to online UINT uiIDA[1]; uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this, app.GetStringTable()); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this); /* 4J-PB - Add this after release #elif defined __PSVITA__ @@ -1522,18 +1575,18 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) UINT uiIDA[1]; uiIDA[0] = IDS_OK; - ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad, NULL, NULL, app.GetStringTable()); + ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad); } else { // Not signed in to PSN UINT uiIDA[1]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::MustSignInReturnedPSN, this, app.GetStringTable()); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::MustSignInReturnedPSN, this); return; } #else - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1); #endif } else @@ -1551,11 +1604,11 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) #endif if(bContentRestricted) { -#if !(defined(_XBOX) || defined(_WIN64)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms +#if !(defined(_XBOX) || defined(_WINDOWS64) || defined(_XBOX_ONE)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms // you can't see leaderboards UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,this, app.GetStringTable()); + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,this); #endif } else @@ -1567,7 +1620,7 @@ void UIScene_MainMenu::RunLeaderboards(int iPad) #ifdef _XBOX_ONE ui.ShowPlayerDisplayname(true); #endif - ui.NavigateToScene(iPad, eUIScene_LeaderboardsMenu); + proceedToScene(iPad, eUIScene_LeaderboardsMenu); } } } @@ -1626,7 +1679,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) m_bIgnorePress=false; UINT uiIDA[1]; uiIDA[0] = IDS_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, this, app.GetStringTable()); + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(), nullptr, this); return; } @@ -1637,7 +1690,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) if(ProfileManager.IsGuest(iPad)) { m_bIgnorePress=false; - ui.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); + ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); } else { @@ -1656,11 +1709,11 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) if(bContentRestricted) { m_bIgnorePress=false; -#if !(defined(_XBOX) || defined(_WIN64)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms +#if !(defined(_XBOX) || defined(_WINDOWS64) || defined(_XBOX_ONE)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms // you can't see the store UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,this, app.GetStringTable()); + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,this); #endif } else @@ -1669,7 +1722,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) #ifdef _XBOX_ONE ui.ShowPlayerDisplayname(true); #endif - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DLCMainMenu); + proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_DLCMainMenu); } } #if defined _XBOX_ONE @@ -1710,7 +1763,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) UINT uiIDA[1]; uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; //uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this, app.GetStringTable()); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this); #elif defined __ORBIS__ m_eAction=eAction_RunUnlockOrDLCPSN; // Determine why they're not "signed in live" @@ -1722,20 +1775,20 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) UINT uiIDA[1]; uiIDA[0] = IDS_OK; - ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad, NULL, NULL, app.GetStringTable()); + ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad); } else { // Not signed in to PSN UINT uiIDA[1]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::MustSignInReturnedPSN, this, app.GetStringTable()); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::MustSignInReturnedPSN, this); return; } #else UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1); #endif } } @@ -1745,7 +1798,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) if(ProfileManager.IsGuest(iPad)) { m_bIgnorePress=false; - ui.RequestMessageBox(IDS_UNLOCK_TITLE, IDS_UNLOCK_GUEST_TEXT, uiIDA, 1,iPad); + ui.RequestErrorMessage(IDS_UNLOCK_TITLE, IDS_UNLOCK_GUEST_TEXT, uiIDA, 1,iPad); } else if(!ProfileManager.IsSignedInLive(iPad)) { @@ -1754,7 +1807,7 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) // get them to sign in to online UINT uiIDA[1]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this, app.GetStringTable()); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_MainMenu::MustSignInReturnedPSN,this); #elif defined __ORBIS__ m_eAction=eAction_RunUnlockOrDLCPSN; // Determine why they're not "signed in live" @@ -1766,20 +1819,20 @@ void UIScene_MainMenu::RunUnlockOrDLC(int iPad) UINT uiIDA[1]; uiIDA[0] = IDS_OK; - ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad, NULL, NULL, app.GetStringTable()); + ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad); } else { // Not signed in to PSN UINT uiIDA[1]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::MustSignInReturnedPSN, this, app.GetStringTable()); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::MustSignInReturnedPSN, this); return; } #else UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1); #endif } @@ -1805,6 +1858,60 @@ void UIScene_MainMenu::tick() { UIScene::tick(); + if ( (eNavigateWhenReady >= 0) ) + { + + int lockedProfile = ProfileManager.GetLockedProfile(); + +#ifdef _DURANGO + // 4J-JEV: DLC menu contains text localised to system language which we can't change. + // We need to switch to this language in-case it uses a different font. + if (eNavigateWhenReady == eUIScene_DLCMainMenu) setLanguageOverride(false); + + bool isSignedIn; + C4JStorage::eOptionsCallback status; + bool pendingFontChange; + if (lockedProfile >= 0) + { + isSignedIn = ProfileManager.IsSignedIn(lockedProfile); + status = app.GetOptionsCallbackStatus(lockedProfile); + pendingFontChange = ui.PendingFontChange(); + + if(status == C4JStorage::eOptions_Callback_Idle) + { + // make sure the TMS banned list data is ditched - the player may have gone in to help & options, backed out, and signed out + app.InvalidateBannedList(lockedProfile); + + // need to ditch any DLCOffers info + StorageManager.ClearDLCOffers(); + app.ClearAndResetDLCDownloadQueue(); + app.ClearDLCInstalled(); + } + } + + if ( (lockedProfile >= 0) + && isSignedIn + && ((status == C4JStorage::eOptions_Callback_Read)||(status == C4JStorage::eOptions_Callback_Write)) + && !pendingFontChange + ) +#endif + { + app.DebugPrintf("[MainMenu] Navigating away from MainMenu.\n"); + ui.NavigateToScene(lockedProfile, eNavigateWhenReady); + eNavigateWhenReady = (EUIScene) -1; + } +#ifdef _DURANGO + else + { + app.DebugPrintf("[MainMenu] Delaying navigation: lockedProfile=%i, %s, status=%ls, %s.\n", + lockedProfile, + isSignedIn ? "SignedIn" : "SignedOut", + app.toStringOptionsStatus(status).c_str(), + pendingFontChange ? "Pending font change" : "font OK"); + } +#endif + } + #if defined(__PS3__) || defined (__ORBIS__) || defined(__PSVITA__) if(m_bLaunchFullVersionPurchase) { @@ -1823,7 +1930,7 @@ void UIScene_MainMenu::tick() { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,this, app.GetStringTable()); + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad()); } else { @@ -1851,7 +1958,7 @@ void UIScene_MainMenu::tick() { m_bWaitingForDLCInfo=false; ProfileManager.SetLockedProfile(m_iPad); - ui.NavigateToScene(ProfileManager.GetPrimaryPad(),eUIScene_DLCMainMenu); + proceedToScene(ProfileManager.GetPrimaryPad(), eUIScene_DLCMainMenu); } } @@ -1859,7 +1966,7 @@ void UIScene_MainMenu::tick() { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox( IDS_CONNECTION_FAILED, IDS_IN_PARTY_SESSION_FULL, uiIDA,1,ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable()); + ui.RequestErrorMessage( IDS_CONNECTION_FAILED, IDS_IN_PARTY_SESSION_FULL, uiIDA,1,ProfileManager.GetPrimaryPad()); } #endif @@ -1882,7 +1989,7 @@ void UIScene_MainMenu::tick() // give the option of continuing offline UINT uiIDA[1]; uiIDA[0]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION_PATCH_AVAILABLE, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::PlayOfflineReturned, this, app.GetStringTable()); + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION_PATCH_AVAILABLE, uiIDA, 1, ProfileManager.GetPrimaryPad(), &UIScene_MainMenu::PlayOfflineReturned, this); } m_bErrorDialogRunning=false; @@ -1907,7 +2014,7 @@ void UIScene_MainMenu::RunAchievements(int iPad) // guests can't look at achievements if(ProfileManager.IsGuest(iPad)) { - ui.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); + ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); } else { @@ -1922,7 +2029,7 @@ void UIScene_MainMenu::RunHelpAndOptions(int iPad) { UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); + ui.RequestErrorMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1); } else { @@ -1938,7 +2045,7 @@ void UIScene_MainMenu::RunHelpAndOptions(int iPad) #ifdef _XBOX_ONE ui.ShowPlayerDisplayname(true); #endif - ui.NavigateToScene(iPad,eUIScene_HelpAndOptionsMenu); + proceedToScene(iPad, eUIScene_HelpAndOptionsMenu); } #if TO_BE_IMPLEMENTED else @@ -1976,6 +2083,7 @@ void UIScene_MainMenu::LoadTrial(void) // No saving in the trial StorageManager.SetSaveDisabled(true); + app.SetGameHostOption(eGameHostOption_WasntSaveOwner, false); // Set the global flag, so that we don't disable saving again once the save is complete app.SetGameHostOption(eGameHostOption_DisableSaving, 1); @@ -2021,7 +2129,7 @@ void UIScene_MainMenu::LoadTrial(void) void UIScene_MainMenu::handleUnlockFullVersion() { - m_buttons[(int)eControl_UnlockOrDLC].setLabel(app.GetString(IDS_DOWNLOADABLECONTENT),true); + m_buttons[(int)eControl_UnlockOrDLC].setLabel(IDS_DOWNLOADABLECONTENT,true); } diff --git a/Minecraft.Client/Common/UI/UIScene_MainMenu.h b/Minecraft.Client/Common/UI/UIScene_MainMenu.h index f1b358da..2b49a44b 100644 --- a/Minecraft.Client/Common/UI/UIScene_MainMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_MainMenu.h @@ -90,10 +90,20 @@ private: }; eActions m_eAction; + +private: + // 4J-JEV: Delay navigation until font changes. + static EUIScene eNavigateWhenReady; + + static void proceedToScene(int iPad, EUIScene eScene) + { + eNavigateWhenReady = eScene; + } + public: UIScene_MainMenu(int iPad, void *initData, UILayer *parentLayer); virtual ~UIScene_MainMenu(); - + // Returns true if this scene has focus for the pad passed in #ifndef __PS3__ virtual bool hasFocus(int iPad) { return bHasFocus; } @@ -113,6 +123,7 @@ protected: public: virtual void tick(); + virtual void handleReload(); // INPUT virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); @@ -137,8 +148,20 @@ private: static void LoadTrial(); #ifdef _XBOX_ONE - static int ChooseUser_SignInReturned(void *pParam,bool bContinue, int iPad); -#endif + static int ChooseUser_SignInReturned(void *pParam,bool bContinue, int iPad, int iController); + static int CreateLoad_SignInReturned(void *pParam,bool bContinue, int iPad, int iController); + static int HelpAndOptions_SignInReturned(void *pParam,bool bContinue,int iPad, int iController); + static int Achievements_SignInReturned(void *pParam,bool bContinue,int iPad, int iController); + static int MustSignInReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); + + static int Leaderboards_SignInReturned(void* pParam, bool bContinue, int iPad, int iController); + static int UnlockFullGame_SignInReturned(void *pParam,bool bContinue,int iPad, int iController); + static int ExitGameReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); + + + static int XboxHelp_SignInReturned(void *pParam, bool bContinue, int iPad, int iController); +#else + static int CreateLoad_SignInReturned(void *pParam,bool bContinue, int iPad); static int HelpAndOptions_SignInReturned(void *pParam,bool bContinue,int iPad); static int Achievements_SignInReturned(void *pParam,bool bContinue,int iPad); @@ -157,9 +180,6 @@ private: static int PlayOfflineReturned(void *pParam, int iPad, C4JStorage::EMessageResult result); #endif - -#ifdef _DURANGO - static int XboxHelp_SignInReturned(void *pParam, bool bContinue, int iPad); #endif #ifdef __PSVITA__ diff --git a/Minecraft.Client/Common/UI/UIScene_MessageBox.h b/Minecraft.Client/Common/UI/UIScene_MessageBox.h index 3c349dea..c10f6ab8 100644 --- a/Minecraft.Client/Common/UI/UIScene_MessageBox.h +++ b/Minecraft.Client/Common/UI/UIScene_MessageBox.h @@ -41,7 +41,8 @@ public: virtual EUIScene getSceneType() { return eUIScene_MessageBox;} // Returns true if lower scenes in this scenes layer, or in any layer below this scenes layers should be hidden - virtual bool hidesLowerScenes() { return false; } + virtual bool hidesLowerScenes() { return false; } + virtual bool blocksInput() { return true; } protected: // TODO: This should be pure virtual in this class diff --git a/Minecraft.Client/Common/UI/UIScene_NewUpdateMessage.cpp b/Minecraft.Client/Common/UI/UIScene_NewUpdateMessage.cpp new file mode 100644 index 00000000..998679ca --- /dev/null +++ b/Minecraft.Client/Common/UI/UIScene_NewUpdateMessage.cpp @@ -0,0 +1,121 @@ +#include "stdafx.h" +#include "UI.h" +#include "UIScene_NewUpdateMessage.h" +#include "..\..\..\Minecraft.World\StringHelpers.h" + +UIScene_NewUpdateMessage::UIScene_NewUpdateMessage(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) +{ + // Setup all the Iggy references we need for this scene + initialiseMovie(); + + parentLayer->addComponent(iPad,eUIComponent_Panorama); + parentLayer->addComponent(iPad,eUIComponent_Logo); + + m_buttonConfirm.init(app.GetString(IDS_TOOLTIPS_ACCEPT),eControl_Confirm); + + wstring message = app.GetString(IDS_TITLEUPDATE); + message.append(L"\r\n"); + + message=app.FormatHTMLString(m_iPad,message); + + vector<wstring> paragraphs; + int lastIndex = 0; + for ( int index = message.find(L"\r\n", lastIndex, 2); + index != wstring::npos; + index = message.find(L"\r\n", lastIndex, 2) + ) + { + paragraphs.push_back( message.substr(lastIndex, index-lastIndex) + L" " ); + lastIndex = index + 2; + } + paragraphs.push_back( message.substr( lastIndex, message.length() - lastIndex ) ); + + for(unsigned int i = 0; i < paragraphs.size(); ++i) + { + m_labelDescription.addText(paragraphs[i],i == (paragraphs.size() - 1) ); + } + + m_bIgnoreInput=false; + +#ifdef __PSVITA__ + ui.TouchBoxRebuild(this); +#endif +} + +UIScene_NewUpdateMessage::~UIScene_NewUpdateMessage() +{ + m_parentLayer->removeComponent(eUIComponent_Panorama); + m_parentLayer->removeComponent(eUIComponent_Logo); +} + +wstring UIScene_NewUpdateMessage::getMoviePath() +{ + return L"EULA"; +} + +void UIScene_NewUpdateMessage::updateTooltips() +{ + ui.SetTooltips( DEFAULT_XUI_MENU_USER, IDS_TOOLTIPS_SELECT ); +} + +void UIScene_NewUpdateMessage::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled) +{ + if(m_bIgnoreInput) return; + +#ifdef __ORBIS__ + // ignore all players except player 0 - it's their profile that is currently being used + if(iPad!=0) return; +#endif + + ui.AnimateKeyPress(m_iPad, key, repeat, pressed, released); + + switch(key) + { + case ACTION_MENU_B: + { + int iVal=app.GetGameSettings(m_iPad,eGameSetting_DisplayUpdateMessage); + if(iVal>0) iVal--; + + // set the update text as seen, by clearing the flag + app.SetGameSettings(m_iPad,eGameSetting_DisplayUpdateMessage,iVal); + // force a profile write + app.CheckGameSettingsChanged(true,m_iPad); + ui.NavigateBack(m_iPad); + } + break; +#ifdef __ORBIS__ + case ACTION_MENU_TOUCHPAD_PRESS: +#endif + case ACTION_MENU_OK: + case ACTION_MENU_DOWN: + case ACTION_MENU_UP: + case ACTION_MENU_PAGEUP: + case ACTION_MENU_PAGEDOWN: + case ACTION_MENU_OTHER_STICK_DOWN: + case ACTION_MENU_OTHER_STICK_UP: + sendInputToMovie(key, repeat, pressed, released); + break; + } +} + +void UIScene_NewUpdateMessage::handlePress(F64 controlId, F64 childId) +{ + switch((int)controlId) + { + case eControl_Confirm: + { + //CD - Added for audio + ui.PlayUISFX(eSFX_Press); + + int iVal=app.GetGameSettings(m_iPad,eGameSetting_DisplayUpdateMessage); + if(iVal>0) iVal--; + + // set the update text as seen, by clearing the flag + app.SetGameSettings(m_iPad,eGameSetting_DisplayUpdateMessage,iVal); + // force a profile write + app.CheckGameSettingsChanged(true,m_iPad); + ui.NavigateBack(m_iPad); + } + break; + }; +} diff --git a/Minecraft.Client/Common/UI/UIScene_NewUpdateMessage.h b/Minecraft.Client/Common/UI/UIScene_NewUpdateMessage.h new file mode 100644 index 00000000..1529187f --- /dev/null +++ b/Minecraft.Client/Common/UI/UIScene_NewUpdateMessage.h @@ -0,0 +1,45 @@ +#pragma once + +#include "UIScene.h" + +class UIScene_NewUpdateMessage : public UIScene +{ +private: + enum EControls + { + eControl_Confirm, + }; + + bool m_bIgnoreInput; + + UIControl_Button m_buttonConfirm; + UIControl_DynamicLabel m_labelDescription; + UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) + UI_MAP_ELEMENT(m_buttonConfirm, "AcceptButton") + UI_MAP_ELEMENT(m_labelDescription, "EULAtext") + UI_END_MAP_ELEMENTS_AND_NAMES() + +public: + UIScene_NewUpdateMessage(int iPad, void *initData, UILayer *parentLayer); + ~UIScene_NewUpdateMessage(); + + virtual EUIScene getSceneType() { return eUIScene_EULA;} + + // Returns true if this scene has focus for the pad passed in +#ifndef __PS3__ + virtual bool hasFocus(int iPad) { return bHasFocus; } +#endif + virtual void updateTooltips(); + +protected: + virtual wstring getMoviePath(); + +public: + // INPUT + virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); + +protected: + void handlePress(F64 controlId, F64 childId); + + virtual long long getDefaultGtcButtons() { return 0; } +}; diff --git a/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp b/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp index d9569cc9..6f502db8 100644 --- a/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_PauseMenu.cpp @@ -428,7 +428,7 @@ void UIScene_PauseMenu::handleInput(int iPad, int key, bool repeat, bool pressed // 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive is the npAvailability isn't SCE_OK UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad, NULL, NULL, app.GetStringTable()); + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad); } else // Determine why they're not "signed in live" @@ -439,20 +439,20 @@ void UIScene_PauseMenu::handleInput(int iPad, int key, bool repeat, bool pressed UINT uiIDA[1]; uiIDA[0] = IDS_OK; - ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad, NULL, NULL, app.GetStringTable()); + ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad); } else { // Not signed in to PSN UINT uiIDA[1]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, iPad, &UIScene_PauseMenu::MustSignInReturnedPSN, this, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, iPad, &UIScene_PauseMenu::MustSignInReturnedPSN, (LPVOID)GetCallbackUniqueId() ); } #else // __PS3__ // get them to sign in to online UINT uiIDA[1]; uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, iPad, &UIScene_PauseMenu::MustSignInReturnedPSN, this, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, iPad, &UIScene_PauseMenu::MustSignInReturnedPSN, (LPVOID)GetCallbackUniqueId() ); #endif } else @@ -493,7 +493,7 @@ void UIScene_PauseMenu::handleInput(int iPad, int key, bool repeat, bool pressed UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_ACTION_BAN_LEVEL_TITLE, IDS_ACTION_BAN_LEVEL_DESCRIPTION, uiIDA, 2, iPad,&UIScene_PauseMenu::BanGameDialogReturned,this, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_ACTION_BAN_LEVEL_TITLE, IDS_ACTION_BAN_LEVEL_DESCRIPTION, uiIDA, 2, iPad,&UIScene_PauseMenu::BanGameDialogReturned,(LPVOID)GetCallbackUniqueId() ); //rfHandled = TRUE; } @@ -524,7 +524,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) // guests can't look at leaderboards if(ProfileManager.IsGuest(m_iPad)) { - ui.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad()); } else if(!ProfileManager.IsSignedInLive(m_iPad)) { @@ -541,7 +541,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) { UINT uiIDA[1]; uiIDA[0] = IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, m_iPad, NULL, NULL, app.GetStringTable()); + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, m_iPad); break;; } @@ -553,7 +553,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) m_eAction=eAction_ViewLeaderboardsPSN; UINT uiIDA[1]; uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_PauseMenu::MustSignInReturnedPSN,this, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, ProfileManager.GetPrimaryPad(),&UIScene_PauseMenu::MustSignInReturnedPSN,(LPVOID)GetCallbackUniqueId() ); #elif defined(__ORBIS__) m_eAction=eAction_ViewLeaderboardsPSN; int npAvailability = ProfileManager.getNPAvailability(m_iPad); @@ -562,7 +562,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) // 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive is the npAvailability isn't SCE_OK UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, m_iPad, NULL, NULL, app.GetStringTable()); + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, m_iPad); } else // Determine why they're not "signed in live" @@ -575,18 +575,18 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) UINT uiIDA[1]; uiIDA[0] = IDS_OK; - ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, m_iPad, NULL, NULL, app.GetStringTable()); + ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, m_iPad); } else { // Not signed in to PSN UINT uiIDA[1]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, m_iPad, &UIScene_PauseMenu::MustSignInReturnedPSN, this, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, m_iPad, &UIScene_PauseMenu::MustSignInReturnedPSN, (LPVOID)GetCallbackUniqueId() ); } #else UINT uiIDA[1] = { IDS_OK }; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, m_iPad); + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 1, m_iPad); #endif } else @@ -597,11 +597,11 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) #endif if(bContentRestricted) { -#if !(defined(_XBOX) || defined(_WIN64)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms +#if !(defined(_XBOX) || defined(_WINDOWS64) || defined(_XBOX_ONE)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms // you can't see leaderboards UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, m_iPad,NULL,this, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, m_iPad); #endif } else @@ -627,7 +627,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) { UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad()); } else { @@ -671,27 +671,27 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) if(g_NetworkManager.GetPlayerCount()>1) { - ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_CONFIRM_DISCONNECT_SAVE, uiIDA, 3, m_iPad,&UIScene_PauseMenu::ExitGameSaveDialogReturned,this, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_CONFIRM_DISCONNECT_SAVE, uiIDA, 3, m_iPad,&UIScene_PauseMenu::ExitGameSaveDialogReturned, (LPVOID)GetCallbackUniqueId()); } else { - ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3, m_iPad,&UIScene_PauseMenu::ExitGameSaveDialogReturned,this, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3, m_iPad,&UIScene_PauseMenu::ExitGameSaveDialogReturned, (LPVOID)GetCallbackUniqueId()); } } else if(g_NetworkManager.IsHost() && g_NetworkManager.GetPlayerCount()>1) { - ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_CONFIRM_DISCONNECT, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned, dynamic_cast<IUIScene_PauseMenu*>(this), app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_CONFIRM_DISCONNECT, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned, (LPVOID)GetCallbackUniqueId()); } else { - ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned, dynamic_cast<IUIScene_PauseMenu*>(this), app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned, (LPVOID)GetCallbackUniqueId()); } #else if(StorageManager.GetSaveDisabled()) { 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(), NULL, 0, false); + ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_PROGRESS_LOST, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned, (LPVOID)GetCallbackUniqueId()); } else { @@ -703,11 +703,11 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) if(g_NetworkManager.GetPlayerCount()>1) { - ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_CONFIRM_DISCONNECT_SAVE, uiIDA, 3, m_iPad,&UIScene_PauseMenu::ExitGameSaveDialogReturned,this, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_CONFIRM_DISCONNECT_SAVE, uiIDA, 3, m_iPad,&UIScene_PauseMenu::ExitGameSaveDialogReturned, (LPVOID)GetCallbackUniqueId()); } else { - ui.RequestMessageBox(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3, m_iPad,&UIScene_PauseMenu::ExitGameSaveDialogReturned,this, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 3, m_iPad,&UIScene_PauseMenu::ExitGameSaveDialogReturned, (LPVOID)GetCallbackUniqueId()); } } else @@ -715,7 +715,7 @@ void UIScene_PauseMenu::handlePress(F64 controlId, F64 childId) 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(), NULL, 0, false); + ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned, (LPVOID)GetCallbackUniqueId()); } } #endif @@ -753,7 +753,7 @@ void UIScene_PauseMenu::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, dynamic_cast<IUIScene_PauseMenu*>(this), app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_EXIT_GAME, IDS_CONFIRM_EXIT_GAME_PROGRESS_LOST, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::ExitGameDialogReturned, (LPVOID)GetCallbackUniqueId()); } else @@ -788,12 +788,12 @@ void UIScene_PauseMenu::PerformActionSaveGame() // Unlock the full version? if(!ProfileManager.IsSignedInLive(m_iPad)) { -#if defined(__PS3__) +#if defined(__PS3__) || defined (__PSVITA__) m_eAction=eAction_SaveGamePSN; UINT uiIDA[2]; uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_PauseMenu::MustSignInReturnedPSN,this, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_PauseMenu::MustSignInReturnedPSN,(LPVOID)GetCallbackUniqueId()); #elif defined(__ORBIS__) m_eAction=eAction_SaveGamePSN; int npAvailability = ProfileManager.getNPAvailability(m_iPad); @@ -802,7 +802,7 @@ void UIScene_PauseMenu::PerformActionSaveGame() // 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive is the npAvailability isn't SCE_OK UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, m_iPad, NULL, NULL, app.GetStringTable()); + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, m_iPad); } else // Determine why they're not "signed in live" @@ -813,14 +813,14 @@ void UIScene_PauseMenu::PerformActionSaveGame() UINT uiIDA[1]; uiIDA[0] = IDS_OK; - ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, m_iPad, NULL, NULL, app.GetStringTable()); + ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, m_iPad); } else { // Not signed in to PSN UINT uiIDA[1]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, m_iPad, &UIScene_PauseMenu::MustSignInReturnedPSN, this, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, m_iPad, &UIScene_PauseMenu::MustSignInReturnedPSN, (LPVOID)GetCallbackUniqueId()); } #endif } @@ -829,7 +829,7 @@ void UIScene_PauseMenu::PerformActionSaveGame() UINT uiIDA[2]; uiIDA[0]=IDS_CONFIRM_OK; uiIDA[1]=IDS_CONFIRM_CANCEL; - ui.RequestMessageBox(IDS_UNLOCK_TITLE, IDS_UNLOCK_TOSAVE_TEXT, uiIDA, 2,m_iPad,&UIScene_PauseMenu::UnlockFullSaveReturned,this,app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_UNLOCK_TITLE, IDS_UNLOCK_TOSAVE_TEXT, uiIDA, 2,m_iPad,&UIScene_PauseMenu::UnlockFullSaveReturned,(LPVOID)GetCallbackUniqueId()); } return; @@ -865,7 +865,7 @@ void UIScene_PauseMenu::PerformActionSaveGame() if(app.DLCInstallProcessCompleted() && !SonyCommerce_Vita::getDLCUpgradePending()) // MGH - devtrack #5861 On vita it can take a bit after the install has finished to register the purchase, so make sure we don't end up asking to purchase again #endif { - ui.RequestMessageBox(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, m_iPad,&UIScene_PauseMenu::WarningTrialTexturePackReturned,this,app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, m_iPad,&UIScene_PauseMenu::WarningTrialTexturePackReturned,(LPVOID)GetCallbackUniqueId()); } return; @@ -888,7 +888,7 @@ void UIScene_PauseMenu::PerformActionSaveGame() uiIDA[0]=IDS_SELECTANEWDEVICE; uiIDA[1]=IDS_NODEVICE_DECLINE; - ui.RequestMessageBox(IDS_STORAGEDEVICEPROBLEM_TITLE, IDS_FAILED_TO_LOADSAVE_TEXT, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::DeviceRemovedDialogReturned,this, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_STORAGEDEVICEPROBLEM_TITLE, IDS_FAILED_TO_LOADSAVE_TEXT, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::DeviceRemovedDialogReturned,(LPVOID)GetCallbackUniqueId()); } else #endif @@ -899,7 +899,7 @@ void UIScene_PauseMenu::PerformActionSaveGame() UINT uiIDA[2]; uiIDA[0]=IDS_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_TITLE_DISABLE_AUTOSAVE, IDS_CONFIRM_DISABLE_AUTOSAVE, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::DisableAutosaveDialogReturned,this, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_TITLE_DISABLE_AUTOSAVE, IDS_CONFIRM_DISABLE_AUTOSAVE, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::DisableAutosaveDialogReturned,(LPVOID)GetCallbackUniqueId()); } else #endif @@ -909,7 +909,7 @@ void UIScene_PauseMenu::PerformActionSaveGame() 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, m_iPad,&IUIScene_PauseMenu::SaveGameDialogReturned,this, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_TITLE_SAVE_GAME, IDS_CONFIRM_SAVE_GAME, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::SaveGameDialogReturned,(LPVOID)GetCallbackUniqueId()); } else { @@ -917,7 +917,7 @@ void UIScene_PauseMenu::PerformActionSaveGame() 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, m_iPad,&IUIScene_PauseMenu::EnableAutosaveDialogReturned,this, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_TITLE_ENABLE_AUTOSAVE, IDS_CONFIRM_ENABLE_AUTOSAVE, uiIDA, 2, m_iPad,&IUIScene_PauseMenu::EnableAutosaveDialogReturned,(LPVOID)GetCallbackUniqueId()); #else // flag a app action of save game app.SetAction(m_iPad,eAppAction_SaveGame); @@ -970,7 +970,6 @@ void UIScene_PauseMenu::HandleDLCMountingComplete() int UIScene_PauseMenu::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)pParam; Minecraft *pMinecraft=Minecraft::GetInstance(); if(result==C4JStorage::EMessage_ResultAccept) @@ -985,7 +984,7 @@ int UIScene_PauseMenu::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage:: { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,pClass, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad()); } else #endif @@ -1004,11 +1003,12 @@ int UIScene_PauseMenu::UnlockFullSaveReturned(void *pParam,int iPad,C4JStorage:: int UIScene_PauseMenu::SaveGame_SignInReturned(void *pParam,bool bContinue, int iPad) { - UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)pParam; + UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)ui.GetSceneFromCallbackId((size_t)pParam); + if(pClass) pClass->SetIgnoreInput(false); if(bContinue==true) { - pClass->PerformActionSaveGame(); + if(pClass) pClass->PerformActionSaveGame(); } return 0; @@ -1029,24 +1029,23 @@ int UIScene_PauseMenu::BanGameDialogReturned(void *pParam,int iPad,C4JStorage::E #if defined(__PS3__) || defined (__PSVITA__) || defined(__ORBIS__) int UIScene_PauseMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)pParam; - - if(result==C4JStorage::EMessage_ResultAccept) + UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)ui.GetSceneFromCallbackId((size_t)pParam); + if(result==C4JStorage::EMessage_ResultAccept && pClass) { #ifdef __PS3__ switch(pClass->m_eAction) { case eAction_ViewLeaderboardsPSN: - SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_PauseMenu::ViewLeaderboards_SignInReturned, pClass); + SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_PauseMenu::ViewLeaderboards_SignInReturned, pParam); break; case eAction_ViewInvitesPSN: - SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_PauseMenu::ViewInvites_SignInReturned, pClass); + SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_PauseMenu::ViewInvites_SignInReturned, pParam); break; case eAction_SaveGamePSN: - SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_PauseMenu::SaveGame_SignInReturned, pClass); + SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_PauseMenu::SaveGame_SignInReturned, pParam); break; case eAction_BuyTexturePackPSN: - SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_PauseMenu::BuyTexturePack_SignInReturned, pClass); + SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_PauseMenu::BuyTexturePack_SignInReturned, pParam); break; } #elif defined __PSVITA__ @@ -1059,16 +1058,17 @@ int UIScene_PauseMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::E //Force off CGameNetworkManager::setAdhocMode(false); //Now Sign-in - SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_PauseMenu::ViewLeaderboards_SignInReturned, pClass); + SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_PauseMenu::ViewLeaderboards_SignInReturned, pParam); break; case eAction_ViewInvitesPSN: - SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_PauseMenu::ViewInvites_SignInReturned, pClass); + SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_PauseMenu::ViewInvites_SignInReturned, pParam); break; case eAction_SaveGamePSN: - SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_PauseMenu::SaveGame_SignInReturned, pClass); + pClass->SetIgnoreInput(true); + SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_PauseMenu::SaveGame_SignInReturned, pParam, true); break; case eAction_BuyTexturePackPSN: - SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_PauseMenu::BuyTexturePack_SignInReturned, pClass); + SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_PauseMenu::BuyTexturePack_SignInReturned, pParam); break; } #else @@ -1095,7 +1095,8 @@ int UIScene_PauseMenu::MustSignInReturnedPSN(void *pParam,int iPad,C4JStorage::E int UIScene_PauseMenu::ViewLeaderboards_SignInReturned(void *pParam,bool bContinue, int iPad) { - UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)pParam; + UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)ui.GetSceneFromCallbackId((size_t)pParam); + if(!pClass) return 0; if(bContinue==true) { @@ -1105,7 +1106,7 @@ int UIScene_PauseMenu::ViewLeaderboards_SignInReturned(void *pParam,bool bContin // guests can't look at leaderboards if(ProfileManager.IsGuest(pClass->m_iPad)) { - ui.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,NULL, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1, ProfileManager.GetPrimaryPad()); } else if(ProfileManager.IsSignedInLive(iPad)) { @@ -1115,7 +1116,7 @@ int UIScene_PauseMenu::ViewLeaderboards_SignInReturned(void *pParam,bool bContin if(bContentRestricted) { // you can't see leaderboards - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,pClass, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad()); } else #endif @@ -1130,11 +1131,11 @@ int UIScene_PauseMenu::ViewLeaderboards_SignInReturned(void *pParam,bool bContin int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)pParam; + UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)ui.GetSceneFromCallbackId((size_t)pParam); #ifdef __ORBIS__ // If a patch is available, can't proceed - if (pClass->CheckForPatch()) return 0; + if (!pClass || pClass->CheckForPatch()) return 0; #endif #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) @@ -1142,7 +1143,7 @@ int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4J { if(!ProfileManager.IsSignedInLive(iPad)) { - pClass->m_eAction=eAction_SaveGamePSN; + if(pClass) pClass->m_eAction=eAction_SaveGamePSN; #ifdef __ORBIS__// Check if PSN is unavailable because of age restriction int npAvailability = ProfileManager.getNPAvailability(iPad); if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) @@ -1150,7 +1151,7 @@ int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4J // 4J Stu - This is a bit messy and is due to the library incorrectly returning false for IsSignedInLive is the npAvailability isn't SCE_OK UINT uiIDA[1]; uiIDA[0]=IDS_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad, NULL, NULL, app.GetStringTable()); + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad); } else // Determine why they're not "signed in live" @@ -1161,20 +1162,20 @@ int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4J UINT uiIDA[1]; uiIDA[0] = IDS_OK; - ui.RequestMessageBox( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad, NULL, NULL, app.GetStringTable()); + ui.RequestErrorMessage( IDS_ERROR_NETWORK_TITLE, IDS_ERROR_NETWORK, uiIDA, 1, iPad); } else { UINT uiIDA[1]; uiIDA[0] = IDS_PRO_NOTONLINE_ACCEPT; - ui.RequestMessageBox( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, iPad, &UIScene_PauseMenu::MustSignInReturnedPSN, pClass, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage( IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 1, iPad, &UIScene_PauseMenu::MustSignInReturnedPSN, pParam); } #else // __PS3__ // You're not signed in to PSN! UINT uiIDA[2]; uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; uiIDA[1]=IDS_PRO_NOTONLINE_DECLINE; - ui.RequestMessageBox(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 2, iPad,&UIScene_PauseMenu::MustSignInReturnedPSN,pClass, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_XBOXLIVE_NOTIFICATION, uiIDA, 2, iPad,&UIScene_PauseMenu::MustSignInReturnedPSN,pParam); #endif } else @@ -1187,7 +1188,7 @@ int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4J { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad,NULL,pClass, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad); } else #endif @@ -1249,8 +1250,6 @@ int UIScene_PauseMenu::WarningTrialTexturePackReturned(void *pParam,int iPad,C4J int UIScene_PauseMenu::BuyTexturePack_SignInReturned(void *pParam,bool bContinue, int iPad) { - UIScene_PauseMenu* pClass = (UIScene_PauseMenu*)pParam; - if(bContinue==true) { // Check if we're signed in to LIVE @@ -1266,7 +1265,7 @@ int UIScene_PauseMenu::BuyTexturePack_SignInReturned(void *pParam,bool bContinue { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad,NULL,pClass, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad); } else #endif @@ -1350,7 +1349,6 @@ int UIScene_PauseMenu::ViewInvites_SignInReturned(void *pParam,bool bContinue, i int UIScene_PauseMenu::ExitGameSaveDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { - UIScene_PauseMenu *pClass = (UIScene_PauseMenu *)pParam; // Exit with or without saving // Decline means save in this dialog if(result==C4JStorage::EMessage_ResultDecline || result==C4JStorage::EMessage_ResultThirdOption) @@ -1383,7 +1381,7 @@ int UIScene_PauseMenu::ExitGameSaveDialogReturned(void *pParam,int iPad,C4JStora 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() ,&UIScene_PauseMenu::WarningTrialTexturePackReturned, dynamic_cast<IUIScene_PauseMenu*>(pClass),app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_WARNING_DLC_TRIALTEXTUREPACK_TITLE, IDS_WARNING_DLC_TRIALTEXTUREPACK_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad() ,&UIScene_PauseMenu::WarningTrialTexturePackReturned, pParam); return S_OK; } @@ -1399,7 +1397,7 @@ int UIScene_PauseMenu::ExitGameSaveDialogReturned(void *pParam,int iPad,C4JStora 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, dynamic_cast<IUIScene_PauseMenu*>(pClass), 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 @@ -1416,7 +1414,7 @@ int UIScene_PauseMenu::ExitGameSaveDialogReturned(void *pParam,int iPad,C4JStora 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, dynamic_cast<IUIScene_PauseMenu*>(pClass), 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; } diff --git a/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.cpp b/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.cpp index 4f1b9742..0cb6cf2b 100644 --- a/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.cpp +++ b/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.cpp @@ -16,41 +16,8 @@ UIScene_QuadrantSignin::UIScene_QuadrantSignin(int iPad, void *_initData, UILaye m_bIgnoreInput = false; m_lastRequestedAvatar = -1; - for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) - { - m_iconRequested[i] = false; - - m_labelPressToJoin[i].init(app.GetString(IDS_MUST_SIGN_IN_TITLE)); - m_labelConnectController[i].init(L""); - m_labelAccountType[i].init(L""); - - //wchar_t num[2]; - //swprintf(num,2,L"%d",i+1); - //m_labelPlayerNumber[i].init(num); - - m_controllerStatus[i] = eControllerStatus_ConnectController; - - if(ProfileManager.IsSignedIn(i)) - { - app.DebugPrintf("Index %d is signed in\n", i); - - setControllerState(i, eControllerStatus_PlayerDetails); - m_labelDisplayName[i].init(ProfileManager.GetDisplayName(i)); - } - else if(InputManager.IsPadConnected(i)) - { - app.DebugPrintf("Index %d is not signed in\n", i); - - setControllerState(i, eControllerStatus_PressToJoin); - m_labelDisplayName[i].init(L""); - } - else - { - app.DebugPrintf("Index %d is not connected\n", i); - - setControllerState(i, eControllerStatus_ConnectController); - } - } + + _initQuadrants(); #if defined(__PS3__) || defined(__ORBIS__) || defined(__PSVITA__) if(InputManager.IsCircleCrossSwapped()) @@ -96,6 +63,8 @@ bool UIScene_QuadrantSignin::hidesLowerScenes() void UIScene_QuadrantSignin::tick() { + if(!getMovie()) return; + UIScene::tick(); updateState(); @@ -115,7 +84,7 @@ void UIScene_QuadrantSignin::handleInput(int iPad, int key, bool repeat, bool pr { if(pressed) { -#ifdef _DURANGO +#ifdef _XBOX_ONE if(InputManager.IsPadLocked(iPad)) { if(iPad != ProfileManager.GetPrimaryPad()) @@ -132,7 +101,7 @@ void UIScene_QuadrantSignin::handleInput(int iPad, int key, bool repeat, bool pr navigateBack(); } } -#ifdef _DURANGO +#ifdef _XBOX_ONE } #endif } @@ -144,12 +113,16 @@ void UIScene_QuadrantSignin::handleInput(int iPad, int key, bool repeat, bool pr if(pressed) { m_bIgnoreInput = true; +#ifdef _XBOX_ONE + if(ProfileManager.IsSignedIn(iPad)&&InputManager.IsPadLocked(iPad)) +#else if(ProfileManager.IsSignedIn(iPad)) +#endif { app.DebugPrintf("Signed in pad pressed\n"); ProfileManager.CancelProfileAvatarRequest(); -#ifdef _DURANGO +#ifdef _XBOX_ONE // On Durango, if we don't navigate forward here, then when we are on the main menu, it (re)gains focus & that causes our users to get cleared ui.NavigateToScene(m_iPad, eUIScene_Timer); #endif @@ -158,8 +131,18 @@ void UIScene_QuadrantSignin::handleInput(int iPad, int key, bool repeat, bool pr } else { - app.DebugPrintf("Non-signed in pad pressed\n"); - ProfileManager.RequestSignInUI(false, false, false, true, true,&UIScene_QuadrantSignin::SignInReturned, this, iPad); +#ifdef _XBOX_ONE + if(ProfileManager.IsSignedIn(0)&&!InputManager.IsPadLocked(0)) + { + app.DebugPrintf("Signed in pad with no controller bound pressed\n"); + ProfileManager.RequestSignInUI(false, false, false, true, false,&UIScene_QuadrantSignin::SignInReturned, this, iPad); + } + else +#endif + { + app.DebugPrintf("Non-signed in pad pressed\n"); + ProfileManager.RequestSignInUI(false, false, false, true, true,&UIScene_QuadrantSignin::SignInReturned, this, iPad); + } } } break; @@ -176,15 +159,23 @@ void UIScene_QuadrantSignin::handleInput(int iPad, int key, bool repeat, bool pr handled = true; } +#ifdef _XBOX_ONE +int UIScene_QuadrantSignin::SignInReturned(void *pParam,bool bContinue, int iPad, int iController) +#else int UIScene_QuadrantSignin::SignInReturned(void *pParam,bool bContinue, int iPad) +#endif { app.DebugPrintf("SignInReturned for pad %d\n", iPad); UIScene_QuadrantSignin *pClass = (UIScene_QuadrantSignin *)pParam; -#ifdef _DURANGO +#ifdef _XBOX_ONE if(bContinue && pClass->m_signInInfo.requireOnline && ProfileManager.IsSignedIn(iPad)) { + if( !InputManager.IsPadLocked(iPad) ) + { + ProfileManager.ForcePrimaryPadController(iController); + } ProfileManager.CheckMultiplayerPrivileges(iPad, true, &checkAllPrivilegesCallback, pClass); } else @@ -197,7 +188,7 @@ int UIScene_QuadrantSignin::SignInReturned(void *pParam,bool bContinue, int iPad return 0; } -#ifdef _DURANGO +#ifdef _XBOX_ONE void UIScene_QuadrantSignin::checkAllPrivilegesCallback(LPVOID lpParam, bool hasPrivileges, int iPad) { UIScene_QuadrantSignin* pClass = (UIScene_QuadrantSignin*)lpParam; @@ -219,7 +210,17 @@ void UIScene_QuadrantSignin::updateState() { //app.DebugPrintf("Index %d is signed in, display name - '%s'\n", i, ProfileManager.GetDisplayName(i).data()); - setControllerState(i, eControllerStatus_PlayerDetails); +#ifdef _XBOX_ONE + if(!InputManager.IsPadLocked(i)) + { + setControllerState(i, eControllerStatus_PressToJoin_LoggedIn); + } + else +#endif + { + setControllerState(i, eControllerStatus_PlayerDetails); + } + m_labelDisplayName[i].setLabel(ProfileManager.GetDisplayName(i)); //m_buttonControllers[i].setLabel(app.GetString(IDS_TOOLTIPS_CONTINUE),i); @@ -289,3 +290,53 @@ int UIScene_QuadrantSignin::AvatarReturned(LPVOID lpParam,PBYTE pbThumbnail,DWOR return 0; } + +void UIScene_QuadrantSignin::_initQuadrants() +{ + for(unsigned int i = 0; i < XUSER_MAX_COUNT; ++i) + { + m_iconRequested[i] = false; + + m_labelPressToJoin[i].init(IDS_MUST_SIGN_IN_TITLE); + m_labelConnectController[i].init(L""); + m_labelAccountType[i].init(L""); + + m_controllerStatus[i] = eControllerStatus_ConnectController; + + if(ProfileManager.IsSignedIn(i)) + { + app.DebugPrintf("Index %d is signed in\n", i); + +#ifdef _XBOX_ONE + if(!InputManager.IsPadLocked(i)) + { + setControllerState(i, eControllerStatus_PressToJoin_LoggedIn); + } + else +#endif + { + setControllerState(i, eControllerStatus_PlayerDetails); + } + + m_labelDisplayName[i].init(ProfileManager.GetDisplayName(i)); + } + else if(InputManager.IsPadConnected(i)) + { + app.DebugPrintf("Index %d is not signed in\n", i); + + setControllerState(i, eControllerStatus_PressToJoin); + m_labelDisplayName[i].init(L""); + } + else + { + app.DebugPrintf("Index %d is not connected\n", i); + + setControllerState(i, eControllerStatus_ConnectController); + } + } +} + +void UIScene_QuadrantSignin::handleReload() +{ + _initQuadrants(); +}
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.h b/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.h index b500fcc3..691bb199 100644 --- a/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.h +++ b/Minecraft.Client/Common/UI/UIScene_QuadrantSignin.h @@ -9,7 +9,9 @@ private: { eControllerStatus_ConnectController, eControllerStatus_PressToJoin, - eControllerStatus_PlayerDetails + eControllerStatus_PlayerDetails, + eControllerStatus_PressToJoin_LoggedIn, + eControllerStatus_PressToJoin_NoController, }; bool m_bIgnoreInput; @@ -98,7 +100,11 @@ public: virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); private: +#ifdef _XBOX_ONE + static int SignInReturned(void *pParam,bool bContinue, int iPad, int iController); +#else static int SignInReturned(void *pParam,bool bContinue, int iPad); +#endif static int AvatarReturned(LPVOID lpParam,PBYTE pbThumbnail,DWORD dwThumbnailBytes); void updateState(); @@ -107,4 +113,9 @@ private: #ifdef _DURANGO static void checkAllPrivilegesCallback(LPVOID lpParam, bool hasPrivileges, int iPad); #endif + +protected: + void _initQuadrants(); + + virtual void handleReload(); }; diff --git a/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp b/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp index a91d5aa8..b58f86fd 100644 --- a/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SaveMessage.cpp @@ -156,10 +156,10 @@ void UIScene_SaveMessage::handleTimerComplete(int id) app.SetOptionsCallbackStatus(0,C4JStorage::eOptions_Callback_Read_CorruptDeletePending); m_bIgnoreInput=false; // give the option to delete the save - UINT uiIDA[1]; - uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_CORRUPT_FILE, IDS_CORRUPT_OPTIONS, uiIDA, 1, - 0,&UIScene_SaveMessage::DeleteOptionsDialogReturned,this, app.GetStringTable()); + UINT uiIDA[2]; + uiIDA[0]=IDS_CORRUPT_OPTIONS_RETRY; + uiIDA[1]=IDS_CORRUPT_OPTIONS_DELETE; + ui.RequestErrorMessage(IDS_CORRUPT_FILE, IDS_CORRUPT_OPTIONS, uiIDA, 2, 0,&UIScene_SaveMessage::DeleteOptionsDialogReturned,this); break; } #endif @@ -173,10 +173,16 @@ void UIScene_SaveMessage::handleTimerComplete(int id) int UIScene_SaveMessage::DeleteOptionsDialogReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) { //UIScene_SaveMessage* pClass = (UIScene_SaveMessage*)pParam; - - // kick off the delete - StorageManager.DeleteOptionsData(iPad); - + if(result == C4JStorage::EMessage_ResultAccept) + { + // retry loading the options file + StorageManager.ReadFromProfile(iPad); + } + else // result == EMessage_ResultDecline + { + // kick off the delete + StorageManager.DeleteOptionsData(iPad); + } return 0; } #endif diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp index 4ef7eb5d..39a0b7c6 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsMenu.cpp @@ -10,17 +10,17 @@ UIScene_SettingsMenu::UIScene_SettingsMenu(int iPad, void *initData, UILayer *pa bool bNotInGame=(Minecraft::GetInstance()->level==NULL); - m_buttons[BUTTON_ALL_OPTIONS].init(app.GetString(IDS_OPTIONS),BUTTON_ALL_OPTIONS); - m_buttons[BUTTON_ALL_AUDIO].init(app.GetString(IDS_AUDIO),BUTTON_ALL_AUDIO); - m_buttons[BUTTON_ALL_CONTROL].init(app.GetString(IDS_CONTROL),BUTTON_ALL_CONTROL); - m_buttons[BUTTON_ALL_GRAPHICS].init(app.GetString(IDS_GRAPHICS),BUTTON_ALL_GRAPHICS); - m_buttons[BUTTON_ALL_UI].init(app.GetString(IDS_USER_INTERFACE),BUTTON_ALL_UI); - m_buttons[BUTTON_ALL_RESETTODEFAULTS].init(app.GetString(IDS_RESET_TO_DEFAULTS),BUTTON_ALL_RESETTODEFAULTS); + m_buttons[BUTTON_ALL_OPTIONS].init(IDS_OPTIONS,BUTTON_ALL_OPTIONS); + m_buttons[BUTTON_ALL_AUDIO].init(IDS_AUDIO,BUTTON_ALL_AUDIO); + m_buttons[BUTTON_ALL_CONTROL].init(IDS_CONTROL,BUTTON_ALL_CONTROL); + m_buttons[BUTTON_ALL_GRAPHICS].init(IDS_GRAPHICS,BUTTON_ALL_GRAPHICS); + m_buttons[BUTTON_ALL_UI].init(IDS_USER_INTERFACE,BUTTON_ALL_UI); + m_buttons[BUTTON_ALL_RESETTODEFAULTS].init(IDS_RESET_TO_DEFAULTS,BUTTON_ALL_RESETTODEFAULTS); if(ProfileManager.GetPrimaryPad()!=m_iPad) { - removeControl( &m_buttons[BUTTON_ALL_AUDIO], true); - removeControl( &m_buttons[BUTTON_ALL_GRAPHICS], true); + removeControl( &m_buttons[BUTTON_ALL_AUDIO], bNotInGame); + removeControl( &m_buttons[BUTTON_ALL_GRAPHICS], bNotInGame); } doHorizontalResizeCheck(); @@ -51,10 +51,11 @@ wstring UIScene_SettingsMenu::getMoviePath() void UIScene_SettingsMenu::handleReload() { + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); if(ProfileManager.GetPrimaryPad()!=m_iPad) { - removeControl( &m_buttons[BUTTON_ALL_AUDIO], true); - removeControl( &m_buttons[BUTTON_ALL_GRAPHICS], true); + removeControl( &m_buttons[BUTTON_ALL_AUDIO], bNotInGame); + removeControl( &m_buttons[BUTTON_ALL_GRAPHICS], bNotInGame); } doHorizontalResizeCheck(); @@ -142,7 +143,7 @@ void UIScene_SettingsMenu::handlePress(F64 controlId, F64 childId) uiIDA[0]=IDS_CONFIRM_CANCEL; uiIDA[1]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_DEFAULTS_TITLE, IDS_DEFAULTS_TEXT, uiIDA, 2, m_iPad,&UIScene_SettingsMenu::ResetDefaultsDialogReturned,this, app.GetStringTable(), NULL, 0, false); + ui.RequestAlertMessage(IDS_DEFAULTS_TITLE, IDS_DEFAULTS_TEXT, uiIDA, 2, m_iPad,&UIScene_SettingsMenu::ResetDefaultsDialogReturned,this); } break; } diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp index 72576ded..6898d489 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.cpp @@ -2,6 +2,10 @@ #include "UI.h" #include "UIScene_SettingsOptionsMenu.h" +#if defined(_XBOX_ONE) +#define _ENABLE_LANGUAGE_SELECT +#endif + int UIScene_SettingsOptionsMenu::m_iDifficultySettingA[4]= { IDS_DIFFICULTY_PEACEFUL, @@ -20,22 +24,24 @@ int UIScene_SettingsOptionsMenu::m_iDifficultyTitleSettingA[4]= UIScene_SettingsOptionsMenu::UIScene_SettingsOptionsMenu(int iPad, void *initData, UILayer *parentLayer) : UIScene(iPad, parentLayer) { + m_bNavigateToLanguageSelector = false; + // Setup all the Iggy references we need for this scene initialiseMovie(); m_bNotInGame=(Minecraft::GetInstance()->level==NULL); - m_checkboxViewBob.init(app.GetString(IDS_VIEW_BOBBING),eControl_ViewBob,(app.GetGameSettings(m_iPad,eGameSetting_ViewBob)!=0)); - m_checkboxShowHints.init(app.GetString(IDS_HINTS),eControl_ShowHints,(app.GetGameSettings(m_iPad,eGameSetting_Hints)!=0)); - m_checkboxShowTooltips.init(app.GetString(IDS_IN_GAME_TOOLTIPS),eControl_ShowTooltips,(app.GetGameSettings(m_iPad,eGameSetting_Tooltips)!=0)); - m_checkboxInGameGamertags.init(app.GetString(IDS_IN_GAME_GAMERTAGS),eControl_InGameGamertags,(app.GetGameSettings(m_iPad,eGameSetting_GamertagsVisible)!=0)); + m_checkboxViewBob.init(IDS_VIEW_BOBBING,eControl_ViewBob,(app.GetGameSettings(m_iPad,eGameSetting_ViewBob)!=0)); + m_checkboxShowHints.init(IDS_HINTS,eControl_ShowHints,(app.GetGameSettings(m_iPad,eGameSetting_Hints)!=0)); + m_checkboxShowTooltips.init(IDS_IN_GAME_TOOLTIPS,eControl_ShowTooltips,(app.GetGameSettings(m_iPad,eGameSetting_Tooltips)!=0)); + m_checkboxInGameGamertags.init(IDS_IN_GAME_GAMERTAGS,eControl_InGameGamertags,(app.GetGameSettings(m_iPad,eGameSetting_GamertagsVisible)!=0)); // check if we should display the mash-up option if(m_bNotInGame && app.GetMashupPackWorlds(m_iPad)!=0xFFFFFFFF) { // the mash-up option is needed m_bMashUpWorldsUnhideOption=true; - m_checkboxMashupWorlds.init(app.GetString(IDS_UNHIDE_MASHUP_WORLDS),eControl_ShowMashUpWorlds,false); + m_checkboxMashupWorlds.init(IDS_UNHIDE_MASHUP_WORLDS,eControl_ShowMashUpWorlds,false); } else { @@ -92,7 +98,6 @@ UIScene_SettingsOptionsMenu::UIScene_SettingsOptionsMenu(int iPad, void *initDat bool bRemoveDifficulty=false; bool bRemoveAutosave=false; bool bRemoveInGameGamertags=false; - float fRemoveHeight=0.0f,fWidth,fHeight; bool bNotInGame=(Minecraft::GetInstance()->level==NULL); bool bPrimaryPlayer = ProfileManager.GetPrimaryPad()==m_iPad; @@ -128,6 +133,22 @@ UIScene_SettingsOptionsMenu::UIScene_SettingsOptionsMenu(int iPad, void *initDat removeControl(&m_checkboxInGameGamertags, true); } + // 4J-JEV: Changing languages in-game will produce many a bug. + // MGH - disabled the language select for the patch build, we'll re-enable afterwards + // 4J Stu - Removed it with a preprocessor def as we turn this off in various places +#ifdef _ENABLE_LANGUAGE_SELECT + if (app.GetGameStarted()) + { + removeControl( &m_buttonLanguageSelect, false ); + } + else + { + m_buttonLanguageSelect.init(IDS_LANGUAGE_SELECTOR, eControl_Languages); + } +#else + removeControl( &m_buttonLanguageSelect, false ); +#endif + doHorizontalResizeCheck(); if(app.GetLocalPlayerCount()>1) @@ -136,12 +157,26 @@ UIScene_SettingsOptionsMenu::UIScene_SettingsOptionsMenu(int iPad, void *initDat app.AdjustSplitscreenScene(m_hObj,&m_OriginalPosition,m_iPad); #endif } + + m_labelDifficultyText.disableReinitialisation(); } UIScene_SettingsOptionsMenu::~UIScene_SettingsOptionsMenu() { } +void UIScene_SettingsOptionsMenu::tick() +{ + UIScene::tick(); + + if (m_bNavigateToLanguageSelector) + { + m_bNavigateToLanguageSelector = false; + setGameSettings(); + ui.NavigateToScene(m_iPad, eUIScene_LanguageSelector); + } +} + wstring UIScene_SettingsOptionsMenu::getMoviePath() { if(app.GetLocalPlayerCount() > 1) @@ -173,7 +208,6 @@ void UIScene_SettingsOptionsMenu::updateComponents() if( app.GetLocalPlayerCount() == 1 ) m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,RenderManager.IsHiDef()); else m_parentLayer->showComponent(m_iPad,eUIComponent_Logo,false); - } } @@ -185,22 +219,7 @@ void UIScene_SettingsOptionsMenu::handleInput(int iPad, int key, bool repeat, bo case ACTION_MENU_CANCEL: if(pressed) { - // check the checkboxes - app.SetGameSettings(m_iPad,eGameSetting_ViewBob,m_checkboxViewBob.IsChecked()?1:0); - app.SetGameSettings(m_iPad,eGameSetting_GamertagsVisible,m_checkboxInGameGamertags.IsChecked()?1:0); - app.SetGameSettings(m_iPad,eGameSetting_Hints,m_checkboxShowHints.IsChecked()?1:0); - app.SetGameSettings(m_iPad,eGameSetting_Tooltips,m_checkboxShowTooltips.IsChecked()?1:0); - - // the mashup option will only be shown if some worlds have been previously hidden - if(m_bMashUpWorldsUnhideOption && m_checkboxMashupWorlds.IsChecked()) - { - // unhide all worlds - app.EnableMashupPackWorlds(m_iPad); - } - - // 4J-PB - don't action changes here or we might write to the profile on backing out here and then get a change in the settings all, and write again on backing out there - //app.CheckGameSettingsChanged(true,pInputData->UserIndex); - + setGameSettings(); navigateBack(); } break; @@ -219,9 +238,146 @@ void UIScene_SettingsOptionsMenu::handleInput(int iPad, int key, bool repeat, bo } } +void UIScene_SettingsOptionsMenu::handlePress(F64 controlId, F64 childId) +{ + //CD - Added for audio + ui.PlayUISFX(eSFX_Press); + + switch((int)controlId) + { + case eControl_Languages: + m_bNavigateToLanguageSelector = true; + break; + } +} + +void UIScene_SettingsOptionsMenu::handleReload() +{ + m_bNavigateToLanguageSelector = false; + + m_checkboxViewBob.init(IDS_VIEW_BOBBING,eControl_ViewBob,(app.GetGameSettings(m_iPad,eGameSetting_ViewBob)!=0)); + m_checkboxShowHints.init(IDS_HINTS,eControl_ShowHints,(app.GetGameSettings(m_iPad,eGameSetting_Hints)!=0)); + m_checkboxShowTooltips.init(IDS_IN_GAME_TOOLTIPS,eControl_ShowTooltips,(app.GetGameSettings(m_iPad,eGameSetting_Tooltips)!=0)); + m_checkboxInGameGamertags.init(IDS_IN_GAME_GAMERTAGS,eControl_InGameGamertags,(app.GetGameSettings(m_iPad,eGameSetting_GamertagsVisible)!=0)); + + // check if we should display the mash-up option + if(m_bNotInGame && app.GetMashupPackWorlds(m_iPad)!=0xFFFFFFFF) + { + // the mash-up option is needed + m_bMashUpWorldsUnhideOption=true; + } + else + { + //m_checkboxMashupWorlds.init(L"",eControl_ShowMashUpWorlds,false); + removeControl(&m_checkboxMashupWorlds, true); + m_bMashUpWorldsUnhideOption=false; + } + + unsigned char ucValue=app.GetGameSettings(m_iPad,eGameSetting_Autosave); + + wchar_t autosaveLabels[9][256]; + for(unsigned int i = 0; i < 9; ++i) + { + if(i==0) + { + swprintf( autosaveLabels[i], 256, L"%ls", app.GetString( IDS_SLIDER_AUTOSAVE_OFF )); + } + else + { + swprintf( autosaveLabels[i], 256, L"%ls: %d %ls", app.GetString( IDS_SLIDER_AUTOSAVE ),i*15, app.GetString( IDS_MINUTES )); + } + + } + m_sliderAutosave.setAllPossibleLabels(9,autosaveLabels); + m_sliderAutosave.init(autosaveLabels[ucValue],eControl_Autosave,0,8,ucValue); + +#if defined(_XBOX_ONE) || defined(__ORBIS__) + removeControl(&m_sliderAutosave,true); +#endif + + ucValue = app.GetGameSettings(m_iPad,eGameSetting_Difficulty); + + wchar_t difficultyLabels[4][256]; + for(unsigned int i = 0; i < 4; ++i) + { + swprintf( difficultyLabels[i], 256, L"%ls: %ls", app.GetString( IDS_SLIDER_DIFFICULTY ),app.GetString(m_iDifficultyTitleSettingA[i])); + } + m_sliderDifficulty.setAllPossibleLabels(4,difficultyLabels); + m_sliderDifficulty.init(difficultyLabels[ucValue],eControl_Difficulty,0,3,ucValue); + + wstring wsText=app.GetString(m_iDifficultySettingA[app.GetGameSettings(m_iPad,eGameSetting_Difficulty)]); + EHTMLFontSize size = eHTMLSize_Normal; + if(!RenderManager.IsHiDef() && !RenderManager.IsWidescreen()) + { + size = eHTMLSize_Splitscreen; + } + wchar_t startTags[64]; + swprintf(startTags,64,L"<font color=\"#%08x\">",app.GetHTMLColour(eHTMLColor_White)); + wsText= startTags + wsText; + + m_labelDifficultyText.init(wsText); + + + // If you are in-game, only the game host can change in-game gamertags, and you can't change difficulty + // only the primary player gets to change the autosave and difficulty settings + bool bRemoveDifficulty=false; + bool bRemoveAutosave=false; + bool bRemoveInGameGamertags=false; + + bool bNotInGame=(Minecraft::GetInstance()->level==NULL); + bool bPrimaryPlayer = ProfileManager.GetPrimaryPad()==m_iPad; + if(!bPrimaryPlayer) + { + bRemoveDifficulty=true; + bRemoveAutosave=true; + bRemoveInGameGamertags=true; + } + + if(!bNotInGame) // in the game + { + bRemoveDifficulty=true; + if(!g_NetworkManager.IsHost()) + { + bRemoveAutosave=true; + bRemoveInGameGamertags=true; + } + } + if(bRemoveDifficulty) + { + m_labelDifficultyText.setVisible( false ); + removeControl(&m_sliderDifficulty, true); + } + + if(bRemoveAutosave) + { + removeControl(&m_sliderAutosave, true); + } + + if(bRemoveInGameGamertags) + { + removeControl(&m_checkboxInGameGamertags, true); + } + + // MGH - disabled the language select for the patch build, we'll re-enable afterwards + // 4J Stu - Removed it with a preprocessor def as we turn this off in various places +#ifdef _ENABLE_LANGUAGE_SELECT + // 4J-JEV: Changing languages in-game will produce many a bug. + if (app.GetGameStarted()) + { + removeControl( &m_buttonLanguageSelect, false ); + } + else + { + } +#else + removeControl( &m_buttonLanguageSelect, false ); +#endif + + doHorizontalResizeCheck(); +} + void UIScene_SettingsOptionsMenu::handleSliderMove(F64 sliderId, F64 currentValue) { - WCHAR TempString[256]; int value = (int)currentValue; switch((int)sliderId) { @@ -251,3 +407,22 @@ void UIScene_SettingsOptionsMenu::handleSliderMove(F64 sliderId, F64 currentValu break; } } + +void UIScene_SettingsOptionsMenu::setGameSettings() +{ + // check the checkboxes + app.SetGameSettings(m_iPad,eGameSetting_ViewBob,m_checkboxViewBob.IsChecked()?1:0); + app.SetGameSettings(m_iPad,eGameSetting_GamertagsVisible,m_checkboxInGameGamertags.IsChecked()?1:0); + app.SetGameSettings(m_iPad,eGameSetting_Hints,m_checkboxShowHints.IsChecked()?1:0); + app.SetGameSettings(m_iPad,eGameSetting_Tooltips,m_checkboxShowTooltips.IsChecked()?1:0); + + // the mashup option will only be shown if some worlds have been previously hidden + if(m_bMashUpWorldsUnhideOption && m_checkboxMashupWorlds.IsChecked()) + { + // unhide all worlds + app.EnableMashupPackWorlds(m_iPad); + } + + // 4J-PB - don't action changes here or we might write to the profile on backing out here and then get a change in the settings all, and write again on backing out there + //app.CheckGameSettingsChanged(true,pInputData->UserIndex); +}
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.h b/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.h index 265a0790..e9abb0a9 100644 --- a/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_SettingsOptionsMenu.h @@ -13,6 +13,7 @@ private: eControl_InGameGamertags, eControl_ShowMashUpWorlds, eControl_Autosave, + eControl_Languages, eControl_Difficulty }; protected: @@ -23,6 +24,8 @@ private: UIControl_CheckBox m_checkboxViewBob, m_checkboxShowHints, m_checkboxShowTooltips, m_checkboxInGameGamertags, m_checkboxMashupWorlds; // Checkboxes UIControl_Slider m_sliderAutosave, m_sliderDifficulty; // Sliders UIControl_Label m_labelDifficultyText; //Text + UIControl_Button m_buttonLanguageSelect; + UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) UI_MAP_ELEMENT( m_checkboxViewBob, "ViewBob") UI_MAP_ELEMENT( m_checkboxShowHints, "ShowHints") @@ -32,16 +35,21 @@ private: UI_MAP_ELEMENT( m_sliderAutosave, "Autosave") UI_MAP_ELEMENT( m_sliderDifficulty, "Difficulty") UI_MAP_ELEMENT( m_labelDifficultyText, "DifficultyText") + UI_MAP_ELEMENT( m_buttonLanguageSelect, "Languages") UI_END_MAP_ELEMENTS_AND_NAMES() bool m_bNotInGame; bool m_bMashUpWorldsUnhideOption; + bool m_bNavigateToLanguageSelector; + public: UIScene_SettingsOptionsMenu(int iPad, void *initData, UILayer *parentLayer); virtual ~UIScene_SettingsOptionsMenu(); virtual EUIScene getSceneType() { return eUIScene_SettingsOptionsMenu;} + virtual void tick(); + virtual void updateTooltips(); virtual void updateComponents(); @@ -52,6 +60,13 @@ protected: public: // INPUT virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled); + virtual void handlePress(F64 controlId, F64 childId); + + virtual void handleReload(); virtual void handleSliderMove(F64 sliderId, F64 currentValue); + +protected: + void setGameSettings(); + };
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp index 33f41994..d4f26ae7 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.cpp @@ -222,170 +222,7 @@ void UIScene_SkinSelectMenu::handleInput(int iPad, int key, bool repeat, bool pr #endif if(pressed) { - ui.AnimateKeyPress(iPad, key, repeat, pressed, released); - // if the profile data has been changed, then force a profile write - // It seems we're allowed to break the 5 minute rule if it's the result of a user action - switch(m_packIndex) - { - case SKIN_SELECT_PACK_DEFAULT: - app.SetPlayerSkin(iPad, m_skinIndex); - app.SetPlayerCape(iPad, 0); - m_currentSkinPath = app.GetPlayerSkinName(iPad); - m_originalSkinId = app.GetPlayerSkinId(iPad); - setCharacterSelected(true); - ui.PlayUISFX(eSFX_Press); - break; - case SKIN_SELECT_PACK_FAVORITES: - if(app.GetPlayerFavoriteSkinsCount(iPad)>0) - { - // get the pack number from the skin id - wchar_t chars[256]; - swprintf(chars, 256, L"dlcskin%08d.png", app.GetPlayerFavoriteSkin(iPad,m_skinIndex)); - - DLCPack *Pack=app.m_dlcManager.getPackContainingSkin(chars); - - if(Pack) - { - DLCSkinFile *skinFile = Pack->getSkinFile(chars); - app.SetPlayerSkin(iPad, skinFile->getPath()); - app.SetPlayerCape(iPad, skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape)); - setCharacterSelected(true); - m_currentSkinPath = app.GetPlayerSkinName(iPad); - m_originalSkinId = app.GetPlayerSkinId(iPad); - app.SetPlayerFavoriteSkinsPos(iPad,m_skinIndex); - } - } - break; - default: - if( m_currentPack != NULL ) - { - DLCSkinFile *skinFile = m_currentPack->getSkinFile(m_skinIndex); - - if ( !skinFile->getParameterAsBool( DLCManager::e_DLCParamType_Free ) // Is this a free skin? - && !m_currentPack->hasPurchasedFile( DLCManager::e_DLCType_Skin, skinFile->getPath() ) // do we have a license? - ) - { - // 4J-PB - check for a patch -#ifdef __ORBIS__ - // 4J-PB - Check if there is a patch for the game - int errorCode = ProfileManager.getNPAvailability(ProfileManager.GetPrimaryPad()); - - bool bPatchAvailable; - switch(errorCode) - { - case SCE_NP_ERROR_LATEST_PATCH_PKG_EXIST: - case SCE_NP_ERROR_LATEST_PATCH_PKG_DOWNLOADED: - bPatchAvailable=true; - break; - default: - bPatchAvailable=false; - break; - } - - if(bPatchAvailable) - { - int32_t ret=sceErrorDialogInitialize(); - m_bErrorDialogRunning=true; - if ( ret==SCE_OK ) - { - SceErrorDialogParam param; - sceErrorDialogParamInitialize( ¶m ); - // 4J-PB - We want to display the option to get the patch now - param.errorCode = SCE_NP_ERROR_LATEST_PATCH_PKG_DOWNLOADED;//pClass->m_errorCode; - ret = sceUserServiceGetInitialUser( ¶m.userId ); - if ( ret == SCE_OK ) - { - ret=sceErrorDialogOpen( ¶m ); - break; - } - } - } -#endif - - // no - UINT uiIDA[1] = { IDS_OK }; -#ifdef __ORBIS__ - // Check if PSN is unavailable because of age restriction - int npAvailability = ProfileManager.getNPAvailability(iPad); - if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) - { - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad, NULL, NULL, app.GetStringTable()); - } - else -#endif - // We need to upsell the full version - if(ProfileManager.IsGuest(iPad)) - { - // can't buy - ui.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1,iPad,NULL,NULL,app.GetStringTable(),NULL,0,false); - } - // are we online? - else if(!ProfileManager.IsSignedInLive(iPad)) - { - showNotOnlineDialog(iPad); - } - else - { - // upsell -#ifdef _XBOX - DLC_INFO *pDLCInfo = app.GetDLCInfoForTrialOfferID(m_currentPack->getPurchaseOfferId()); - ULONGLONG ullOfferID_Full; - - if(pDLCInfo!=NULL) - { - ullOfferID_Full=pDLCInfo->ullOfferID_Full; - } - else - { - ullOfferID_Full=m_currentPack->getPurchaseOfferId(); - } - - // tell sentient about the upsell of the full version of the skin pack - TelemetryManager->RecordUpsellPresented(iPad, eSet_UpsellID_Skin_DLC, ullOfferID_Full & 0xFFFFFFFF); -#endif - bool bContentRestricted=false; -#if defined(__PS3__) || defined(__PSVITA__) - ProfileManager.GetChatAndContentRestrictions(m_iPad,true,NULL,&bContentRestricted,NULL); -#endif - if(bContentRestricted) - { -#if !(defined(_XBOX) || defined(_WIN64)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms - // you can't see the store - UINT uiIDA[1] = { IDS_CONFIRM_OK }; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad,NULL,this, app.GetStringTable(),NULL,0,false); -#endif - } - else - { - // 4J-PB - need to check for an empty store -#if defined __ORBIS__ || defined __PSVITA__ || defined __PS3__ - if(app.CheckForEmptyStore(iPad)==false) -#endif - { - this->m_bIgnoreInput = true; - - UINT uiIDA[2] = { IDS_CONFIRM_OK, IDS_CONFIRM_CANCEL }; - ui.RequestMessageBox(IDS_UNLOCK_DLC_TITLE, IDS_UNLOCK_DLC_SKIN, uiIDA, 2, iPad,&UIScene_SkinSelectMenu::UnlockSkinReturned,this,app.GetStringTable(),NULL,0,false); - } - } - } - } - else - { - app.SetPlayerSkin(iPad, skinFile->getPath()); - app.SetPlayerCape(iPad, skinFile->getParameterAsString(DLCManager::e_DLCParamType_Cape)); - setCharacterSelected(true); - m_currentSkinPath = app.GetPlayerSkinName(iPad); - m_originalSkinId = app.GetPlayerSkinId(iPad); - - // push this onto the favorite list - AddFavoriteSkin(iPad,GET_DLC_SKIN_ID_FROM_BITMASK(m_originalSkinId)); - } - } - - ui.PlayUISFX(eSFX_Press); - break; - } + InputActionOK(iPad); } break; case ACTION_MENU_UP: @@ -614,17 +451,62 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) //if(true) if(!m_currentPack->hasPurchasedFile( DLCManager::e_DLCType_Skin, skinFile->getPath() )) { +#ifdef __ORBIS__ + // 4J-PB - Check if there is a patch for the game + int errorCode = ProfileManager.getNPAvailability(ProfileManager.GetPrimaryPad()); + + bool bPatchAvailable; + switch(errorCode) + { + case SCE_NP_ERROR_LATEST_PATCH_PKG_EXIST: + case SCE_NP_ERROR_LATEST_PATCH_PKG_DOWNLOADED: + bPatchAvailable=true; + break; + default: + bPatchAvailable=false; + break; + } + + if(bPatchAvailable) + { + int32_t ret=sceErrorDialogInitialize(); + m_bErrorDialogRunning=true; + if ( ret==SCE_OK ) + { + SceErrorDialogParam param; + sceErrorDialogParamInitialize( ¶m ); + // 4J-PB - We want to display the option to get the patch now + param.errorCode = SCE_NP_ERROR_LATEST_PATCH_PKG_DOWNLOADED;//pClass->m_errorCode; + ret = sceUserServiceGetInitialUser( ¶m.userId ); + if ( ret == SCE_OK ) + { + ret=sceErrorDialogOpen( ¶m ); + break; + } + } + } +#endif + // no UINT uiIDA[1]; uiIDA[0]=IDS_OK; +#ifdef __ORBIS__ + // Check if PSN is unavailable because of age restriction + int npAvailability = ProfileManager.getNPAvailability(iPad); + if (npAvailability == SCE_NP_ERROR_AGE_RESTRICTION) + { + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad); + } + else +#endif // We need to upsell the full version if(ProfileManager.IsGuest(iPad)) { // can't buy - ui.RequestMessageBox(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1,iPad,NULL,NULL,app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_PRO_GUESTPROFILE_TITLE, IDS_PRO_GUESTPROFILE_TEXT, uiIDA, 1,iPad); } -#if defined(__PS3__) || defined(__ORBIS__) +#if defined(__PS3__) || defined(__ORBIS__) || defined __PSVITA__ // are we online? else if(!ProfileManager.IsSignedInLive(iPad)) { @@ -656,11 +538,11 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) #endif if(bContentRestricted) { -#if !(defined(_XBOX) || defined(_WIN64)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms +#if !(defined(_XBOX) || defined(_WINDOWS64) || defined(_XBOX_ONE)) // 4J Stu - Temp to get the win build running, but so we check this for other platforms // you can't see the store UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,this, app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, iPad); #endif } else @@ -674,7 +556,7 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) renableInputAfterOperation = false; UINT uiIDA[2] = { IDS_CONFIRM_OK, IDS_CONFIRM_CANCEL }; - ui.RequestMessageBox(IDS_UNLOCK_DLC_TITLE, IDS_UNLOCK_DLC_SKIN, uiIDA, 2, iPad,&UIScene_SkinSelectMenu::UnlockSkinReturned,this,app.GetStringTable(),NULL,0,false); + ui.RequestAlertMessage(IDS_UNLOCK_DLC_TITLE, IDS_UNLOCK_DLC_SKIN, uiIDA, 2, iPad,&UIScene_SkinSelectMenu::UnlockSkinReturned,this); } } } @@ -703,7 +585,10 @@ void UIScene_SkinSelectMenu::InputActionOK(unsigned int iPad) AddFavoriteSkin(iPad,GET_DLC_SKIN_ID_FROM_BITMASK(m_originalSkinId)); } - if (renableInputAfterOperation) m_bIgnoreInput = false; + if (renableInputAfterOperation) + { + m_bIgnoreInput = false; + } } ui.PlayUISFX(eSFX_Press); @@ -1652,7 +1537,18 @@ void UIScene_SkinSelectMenu::showNotOnlineDialog(int iPad) SQRNetworkManager_PS3::AttemptPSNSignIn(NULL, this); #elif defined(__PSVITA__) - SQRNetworkManager_Vita::AttemptPSNSignIn(NULL, this); + if(CGameNetworkManager::usingAdhocMode() && SQRNetworkManager_AdHoc_Vita::GetAdhocStatus()) + { + // we're in adhoc mode, we really need to ask before disconnecting + UINT uiIDA[2]; + uiIDA[0]=IDS_PRO_NOTONLINE_ACCEPT; + uiIDA[1]=IDS_CANCEL; + ui.RequestErrorMessage(IDS_PRO_NOTONLINE_TITLE, IDS_PRO_NOTONLINE_TEXT, uiIDA, 2, ProfileManager.GetPrimaryPad(),&UIScene_SkinSelectMenu::MustSignInReturned,NULL); + } + else + { + SQRNetworkManager_Vita::AttemptPSNSignIn(NULL, this); + } #elif defined(__ORBIS__) SQRNetworkManager_Orbis::AttemptPSNSignIn(NULL, this, false, iPad); @@ -1660,7 +1556,7 @@ void UIScene_SkinSelectMenu::showNotOnlineDialog(int iPad) #elif defined(_DURANGO) 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 } @@ -1723,9 +1619,9 @@ int UIScene_SkinSelectMenu::UnlockSkinReturned(void *pParam,int iPad,C4JStorage: app.Checkout(chSkuID); } } - // need to re-enable input because the user can back out of the store purchase, and we'll be stuck - pScene->m_bIgnoreInput = false; } + // need to re-enable input because the user can back out of the store purchase, and we'll be stuck + pScene->m_bIgnoreInput = false; // MGH - moved this to outside the pSONYDLCInfo, so we don't get stuck #elif defined _XBOX_ONE StorageManager.InstallOffer(1,(WCHAR *)(pScene->m_currentPack->getPurchaseOfferId().c_str()), &RenableInput, pScene, NULL); #endif @@ -1810,4 +1706,32 @@ void UIScene_SkinSelectMenu::HandleDLCLicenseChange() // update the lock flag handleSkinIndexChanged(); } -#endif
\ No newline at end of file +#endif + + + + +#ifdef __PSVITA__ +int UIScene_SkinSelectMenu::MustSignInReturned(void *pParam,int iPad,C4JStorage::EMessageResult result) +{ + if(result==C4JStorage::EMessage_ResultAccept) + { +#ifdef __PS3__ + SQRNetworkManager_PS3::AttemptPSNSignIn(&UIScene_SkinSelectMenu::PSNSignInReturned, pParam,true); +#elif defined __PSVITA__ + SQRNetworkManager_Vita::AttemptPSNSignIn(&UIScene_SkinSelectMenu::PSNSignInReturned, pParam,true); +#elif defined __ORBIS__ + SQRNetworkManager_Orbis::AttemptPSNSignIn(&UIScene_SkinSelectMenu::PSNSignInReturned, pParam,true); +#endif + } + return 0; +} + +int UIScene_SkinSelectMenu::PSNSignInReturned(void* pParam, bool bContinue, int iPad) +{ + if( bContinue ) + { + } + return 0; +} +#endif // __PSVITA__
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.h b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.h index c9ed6691..e8d76096 100644 --- a/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_SkinSelectMenu.h @@ -184,6 +184,12 @@ private: #endif #ifdef __PSVITA__ + static int MustSignInReturned(void *pParam,int iPad,C4JStorage::EMessageResult result); + static int PSNSignInReturned(void* pParam, bool bContinue, int iPad); +#endif + + +#ifdef __PSVITA__ CRITICAL_SECTION m_DLCInstallCS; // to prevent a race condition between the install and the mounted callback #endif }; diff --git a/Minecraft.Client/Common/UI/UIScene_Timer.cpp b/Minecraft.Client/Common/UI/UIScene_Timer.cpp index 61586e87..3dec20a3 100644 --- a/Minecraft.Client/Common/UI/UIScene_Timer.cpp +++ b/Minecraft.Client/Common/UI/UIScene_Timer.cpp @@ -20,7 +20,7 @@ wstring UIScene_Timer::getMoviePath() return L"Timer"; } -void UIScene_Timer::reloadMovie() +void UIScene_Timer::reloadMovie(bool force) { // Never needs reloaded } diff --git a/Minecraft.Client/Common/UI/UIScene_Timer.h b/Minecraft.Client/Common/UI/UIScene_Timer.h index 5a75103a..ef6aae94 100644 --- a/Minecraft.Client/Common/UI/UIScene_Timer.h +++ b/Minecraft.Client/Common/UI/UIScene_Timer.h @@ -20,7 +20,7 @@ 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 true; } - virtual void reloadMovie(); + virtual void reloadMovie(bool force); virtual bool needsReloaded(); protected: diff --git a/Minecraft.Client/Common/UI/UIScene_TradingMenu.cpp b/Minecraft.Client/Common/UI/UIScene_TradingMenu.cpp index dc2bac48..0a35c8e5 100644 --- a/Minecraft.Client/Common/UI/UIScene_TradingMenu.cpp +++ b/Minecraft.Client/Common/UI/UIScene_TradingMenu.cpp @@ -1,6 +1,7 @@ #include "stdafx.h" #include "UI.h" #include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h" +#include "..\..\..\Minecraft.World\net.minecraft.world.item.h" #include "..\..\..\Minecraft.World\net.minecraft.world.item.trading.h" #include "..\..\..\Minecraft.World\net.minecraft.world.level.tile.entity.h" #include "MultiPlayerLocalPlayer.h" @@ -118,6 +119,15 @@ void UIScene_TradingMenu::handleReload() m_slotListInventory.addSlots(MerchantMenu::INV_SLOT_START, 27); m_slotListHotbar.addSlots(MerchantMenu::USE_ROW_SLOT_START, 9); + + updateDisplay(); + + IggyDataValue result; + IggyDataValue value[1]; + + value[0].type = IGGY_DATATYPE_number; + value[0].number = m_selectedSlot; + IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetActiveSlot , 1 , value ); } void UIScene_TradingMenu::tick() @@ -253,16 +263,33 @@ void UIScene_TradingMenu::setTradeRedBox(int index, bool show) m_slotListTrades.showSlotRedBox(index,show); } -void UIScene_TradingMenu::setOfferDescription(const wstring &name, vector<wstring> &unformattedStrings) +void UIScene_TradingMenu::setOfferDescription(vector<HtmlString> *description) { + wstring descriptionStr = HtmlString::Compose(description); + IggyDataValue result; IggyDataValue value[1]; IggyStringUTF16 stringVal; - stringVal.string = (IggyUTF16*)name.c_str(); - stringVal.length = name.length(); + stringVal.string = (IggyUTF16*)descriptionStr.c_str(); + stringVal.length = descriptionStr.length(); value[0].type = IGGY_DATATYPE_string_UTF16; value[0].string16 = stringVal; IggyResult out = IggyPlayerCallMethodRS ( getMovie() , &result, IggyPlayerRootPath( getMovie() ), m_funcSetOfferDescription , 1 , value ); } + +void UIScene_TradingMenu::HandleMessage(EUIMessage message, void *data) +{ + switch(message) + { + case eUIMessage_InventoryUpdated: + handleInventoryUpdated(data); + break; + }; +} + +void UIScene_TradingMenu::handleInventoryUpdated(LPVOID data) +{ + HandleInventoryUpdated(); +}
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_TradingMenu.h b/Minecraft.Client/Common/UI/UIScene_TradingMenu.h index 08263a1c..a22ba0cf 100644 --- a/Minecraft.Client/Common/UI/UIScene_TradingMenu.h +++ b/Minecraft.Client/Common/UI/UIScene_TradingMenu.h @@ -23,7 +23,7 @@ protected: UIControl_Label m_labelTrading, m_labelRequired; UIControl_Label m_labelRequest1, m_labelRequest2; - IggyName m_funcMoveSelector, m_funcShowScrollRightArrow, m_funcShowScrollLeftArrow, m_funcSetOfferDescription; + IggyName m_funcMoveSelector, m_funcShowScrollRightArrow, m_funcShowScrollLeftArrow, m_funcSetOfferDescription, m_funcSetActiveSlot; UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene) UI_MAP_ELEMENT( m_controlMainPanel, "MainPanel" ) @@ -48,6 +48,7 @@ protected: UI_MAP_NAME(m_funcShowScrollRightArrow, L"ShowScrollRightArrow") UI_MAP_NAME(m_funcShowScrollLeftArrow, L"ShowScrollLeftArrow") UI_MAP_NAME(m_funcSetOfferDescription, L"SetOfferDescription") + UI_MAP_NAME(m_funcSetActiveSlot, L"SetSelectorSlot") UI_END_MAP_ELEMENTS_AND_NAMES() virtual wstring getMoviePath(); @@ -72,7 +73,10 @@ protected: virtual void setRequest2RedBox(bool show); virtual void setTradeRedBox(int index, bool show); - virtual void setOfferDescription(const wstring &name, vector<wstring> &unformattedStrings); + virtual void setOfferDescription(vector<HtmlString> *description); + + virtual void HandleMessage(EUIMessage message, void *data); + void handleInventoryUpdated(LPVOID data); int getPad() { return m_iPad; } };
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIScene_TrialExitUpsell.cpp b/Minecraft.Client/Common/UI/UIScene_TrialExitUpsell.cpp index b395bc4c..9ef8f189 100644 --- a/Minecraft.Client/Common/UI/UIScene_TrialExitUpsell.cpp +++ b/Minecraft.Client/Common/UI/UIScene_TrialExitUpsell.cpp @@ -55,7 +55,7 @@ void UIScene_TrialExitUpsell::handleInput(int iPad, int key, bool repeat, bool p { UINT uiIDA[1]; uiIDA[0]=IDS_CONFIRM_OK; - ui.RequestMessageBox(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad(),NULL,this, app.GetStringTable()); + ui.RequestErrorMessage(IDS_ONLINE_SERVICE_TITLE, IDS_CONTENT_RESTRICTION, uiIDA, 1, ProfileManager.GetPrimaryPad()); } else #endif diff --git a/Minecraft.Client/Common/UI/UIString.cpp b/Minecraft.Client/Common/UI/UIString.cpp new file mode 100644 index 00000000..288fa87a --- /dev/null +++ b/Minecraft.Client/Common/UI/UIString.cpp @@ -0,0 +1,176 @@ +#include "stdafx.h" + +#include "..\..\..\Minecraft.World\StringHelpers.h" + +#include "UIString.h" + +bool UIString::setCurrentLanguage() +{ + int nextLanguage, nextLocale; + nextLanguage = XGetLanguage(); + nextLocale = XGetLocale(); + + if ( (nextLanguage != s_currentLanguage) || (nextLocale != s_currentLocale) ) + { + s_currentLanguage = nextLanguage; + s_currentLocale = nextLocale; + return true; + } + + return false; +} + +int UIString::getCurrentLanguage() +{ + return s_currentLanguage; +} + +UIString::UIStringCore::UIStringCore(StringBuilder wstrBuilder) +{ + m_bIsConstant = false; + + m_lastSetLanguage = m_lastSetLocale = -1; + m_lastUpdatedLanguage = m_lastUpdatedLocale = -1; + + m_fStringBuilder = wstrBuilder; + + m_wstrCache = L""; + update(true); +} + +UIString::UIStringCore::UIStringCore(const wstring &str) +{ + m_bIsConstant = true; + + m_lastSetLanguage = m_lastSetLocale = -1; + m_lastUpdatedLanguage = m_lastUpdatedLocale = -1; + + m_wstrCache = str; +} + +wstring &UIString::UIStringCore::getString() +{ + if (hasNewString()) update(true); + return m_wstrCache; +} + +bool UIString::UIStringCore::hasNewString() +{ + if (m_bIsConstant) return false; + return (m_lastSetLanguage != s_currentLanguage) || (m_lastSetLocale != s_currentLocale); +} + +bool UIString::UIStringCore::update(bool force) +{ + if ( !m_bIsConstant && (force || hasNewString()) ) + { + m_wstrCache = m_fStringBuilder(); + m_lastSetLanguage = s_currentLanguage; + m_lastSetLocale = s_currentLocale; + return true; + } + return false; +} + +bool UIString::UIStringCore::needsUpdating() +{ + if (m_bIsConstant) return false; + return (m_lastSetLanguage != s_currentLanguage) || (m_lastUpdatedLanguage != m_lastSetLanguage) + || (m_lastSetLocale != s_currentLocale) || (m_lastUpdatedLocale != m_lastSetLocale); +} + +void UIString::UIStringCore::setUpdated() +{ + m_lastUpdatedLanguage = m_lastSetLanguage; + m_lastUpdatedLocale = m_lastSetLocale; +} + +int UIString::s_currentLanguage = -1; +int UIString::s_currentLocale = -1; + +UIString::UIString() +{ + m_core = shared_ptr<UIStringCore>(); +} + +UIString::UIString(int ids) +{ +#ifdef __PS3__ + StringBuilder builder = StringBuilder( new IdsStringBuilder(ids) ); +#else + StringBuilder builder = [ids](){ return app.GetString(ids); }; +#endif + UIStringCore *core = new UIStringCore( builder ); + m_core = shared_ptr<UIStringCore>(core); +} + +UIString::UIString(StringBuilder wstrBuilder) +{ + UIStringCore *core = new UIStringCore(wstrBuilder); + m_core = shared_ptr<UIStringCore>(core); +} + +UIString::UIString(const string &constant) +{ + wstring wstr = convStringToWstring(constant); + UIStringCore *core = new UIStringCore( wstr ); + m_core = shared_ptr<UIStringCore>(core); +} + +UIString::UIString(const wstring &constant) +{ + UIStringCore *core = new UIStringCore(constant); + m_core = shared_ptr<UIStringCore>(core); +} + +UIString::UIString(const wchar_t *constant) +{ + wstring str = wstring(constant); + UIStringCore *core = new UIStringCore(str); + m_core = shared_ptr<UIStringCore>(core); +} + +UIString::~UIString() +{ +#ifndef __PS3__ + m_core = nullptr; +#endif +} + +bool UIString::empty() +{ + return m_core.get() == NULL; +} + +bool UIString::compare(const UIString &uiString) +{ + return m_core.get() != uiString.m_core.get(); +} + +bool UIString::needsUpdating() +{ + if (m_core != NULL) return m_core->needsUpdating(); + else return false; +} + +void UIString::setUpdated() +{ + if (m_core != NULL) m_core->setUpdated(); +} + +wstring &UIString::getString() +{ + static wstring blank(L""); + if (m_core != NULL) return m_core->getString(); + else return blank; +} + +const wchar_t *UIString::c_str() +{ + return getString().c_str(); +} + +unsigned int UIString::length() +{ + return getString().length(); +}
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIString.h b/Minecraft.Client/Common/UI/UIString.h new file mode 100644 index 00000000..29e5a068 --- /dev/null +++ b/Minecraft.Client/Common/UI/UIString.h @@ -0,0 +1,103 @@ +#pragma once + +#include <set> +#include <functional> + + +#ifndef __PS3__ + +typedef function<wstring(void)> StringBuilder; + +#else + +class StringBuilderCore +{ +public: + virtual wstring getString() = 0; +}; + +struct StringBuilder +{ + shared_ptr<StringBuilderCore> m_coreBuilder; + virtual wstring operator()() { return m_coreBuilder->getString(); } + StringBuilder() {} + StringBuilder(StringBuilderCore *core) { m_coreBuilder = shared_ptr<StringBuilderCore>(core); } +}; + +class IdsStringBuilder : public StringBuilderCore +{ + const int m_ids; +public: + IdsStringBuilder(int ids) : m_ids(ids) {} + virtual wstring getString(void) { return app.GetString(m_ids); } +}; +#endif + +using namespace std; + +class UIString +{ +protected: + static int s_currentLanguage; + static int s_currentLocale; + +public: + static bool setCurrentLanguage(); + static int getCurrentLanguage(); + +protected: + class UIStringCore : public enable_shared_from_this<UIStringCore> + { + private: + int m_lastSetLanguage; + int m_lastSetLocale; + + int m_lastUpdatedLanguage; + int m_lastUpdatedLocale; + + wstring m_wstrCache; + + bool m_bIsConstant; + + StringBuilder m_fStringBuilder; + + public: + UIStringCore(StringBuilder wstrBuilder); + UIStringCore(const wstring &str); + + wstring &getString(); + + bool hasNewString(); + bool update(bool force); + + bool needsUpdating(); + void setUpdated(); + }; + + shared_ptr<UIStringCore> m_core; + +public: + UIString(); + + UIString(int ids); // Create a dynamic UI string from a string id value. + + UIString(StringBuilder wstrBuilder); // Create a dynamic UI string with a custom update function. + + // Create a UIString with a constant value. + UIString(const string &constant); + UIString(const wstring &constant); + UIString(const wchar_t *constant); + + ~UIString(); + + bool empty(); + bool compare(const UIString &uiString); + + bool needsUpdating(); // Language has been change since the last time setUpdated was called. + void setUpdated(); // The new text has been used. + + wstring &getString(); + + const wchar_t *c_str(); + unsigned int length(); +};
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UIStructs.h b/Minecraft.Client/Common/UI/UIStructs.h index 2dd03c8c..c41f2276 100644 --- a/Minecraft.Client/Common/UI/UIStructs.h +++ b/Minecraft.Client/Common/UI/UIStructs.h @@ -13,6 +13,10 @@ class SignTileEntity; class LevelGenerationOptions; class LocalPlayer; class Merchant; +class EntityHorse; +class BeaconTileEntity; +class Slot; +class AbstractContainerMenu; // 4J Stu - Structs shared by Iggy and Xui scenes. typedef struct _UIVec2D @@ -74,7 +78,9 @@ typedef struct _EnchantingScreenInput int z; int iPad; bool bSplitscreen; -} EnchantingScreenInput; + wstring name; +} +EnchantingScreenInput; // Furnace typedef struct _FurnaceScreenInput @@ -98,6 +104,18 @@ typedef struct _CraftingPanelScreenInput } CraftingPanelScreenInput; +// Fireworks +typedef struct _FireworksScreenInput +{ + shared_ptr<LocalPlayer> player; + bool bSplitscreen; + int iPad; + int x; + int y; + int z; +} +FireworksScreenInput; + // Trading typedef struct _TradingScreenInput { @@ -122,6 +140,37 @@ typedef struct _AnvilScreenInput } AnvilScreenInput; +// Hopper +typedef struct _HopperScreenInput +{ + shared_ptr<Inventory> inventory; + shared_ptr<Container> hopper; + int iPad; + bool bSplitscreen; +} +HopperScreenInput; + +// Horse +typedef struct _HorseScreenInput +{ + shared_ptr<Inventory> inventory; + shared_ptr<Container> container; + shared_ptr<EntityHorse> horse; + int iPad; + bool bSplitscreen; +} +HorseScreenInput; + +// Beacon +typedef struct _BeaconScreenInput +{ + shared_ptr<Inventory> inventory; + shared_ptr<BeaconTileEntity> beacon; + int iPad; + bool bSplitscreen; +} +BeaconScreenInput; + // Sign typedef struct _SignEntryScreenInput { @@ -236,24 +285,32 @@ typedef struct _JoinMenuInitData // More Options typedef struct _LaunchMoreOptionsMenuInitData { - BOOL bOnlineGame; - BOOL bInviteOnly; - BOOL bAllowFriendsOfFriends; + bool bOnlineGame; + bool bInviteOnly; + bool bAllowFriendsOfFriends; + + bool bGenerateOptions; + bool bStructures; + bool bFlatWorld; + bool bBonusChest; - BOOL bGenerateOptions; - BOOL bStructures; - BOOL bFlatWorld; - BOOL bBonusChest; + bool bPVP; + bool bTrust; + bool bFireSpreads; + bool bTNT; - BOOL bPVP; - BOOL bTrust; - BOOL bFireSpreads; - BOOL bTNT; + bool bHostPrivileges; + bool bResetNether; - BOOL bHostPrivileges; - BOOL bResetNether; + bool bMobGriefing; + bool bKeepInventory; + bool bDoMobSpawning; + bool bDoMobLoot; + bool bDoTileDrops; + bool bNaturalRegeneration; + bool bDoDaylightCycle; - BOOL bOnlineSettingChangedBySystem; + bool bOnlineSettingChangedBySystem; int iPad; @@ -263,18 +320,32 @@ typedef struct _LaunchMoreOptionsMenuInitData int worldSize; bool bDisableSaving; + EGameHostOptionWorldSize currentWorldSize; + EGameHostOptionWorldSize newWorldSize; + bool newWorldSizeOverwriteEdges; + _LaunchMoreOptionsMenuInitData() { memset(this,0,sizeof(_LaunchMoreOptionsMenuInitData)); - bOnlineGame = TRUE; - bAllowFriendsOfFriends = TRUE; - bPVP = TRUE; - bFireSpreads = TRUE; - bTNT = TRUE; + bOnlineGame = true; + bAllowFriendsOfFriends = true; + bPVP = true; + bFireSpreads = true; + bTNT = true; iPad = -1; worldSize = 3; seed = L""; bDisableSaving = false; + newWorldSize = e_worldSize_Unknown; + newWorldSizeOverwriteEdges = false; + + bMobGriefing = true; + bKeepInventory = false; + bDoMobSpawning = true; + bDoMobLoot = true; + bDoTileDrops = true; + bNaturalRegeneration = true; + bDoDaylightCycle = true; } } LaunchMoreOptionsMenuInitData; @@ -407,3 +478,10 @@ typedef struct _CustomDrawData float x0, y0, x1, y1; // the bounding box of the original DisplayObject, in object space float mat[16]; } CustomDrawData; + +typedef struct _ItemEditorInput +{ + int iPad; + Slot *slot; + AbstractContainerMenu *menu; +} ItemEditorInput;
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UITTFFont.cpp b/Minecraft.Client/Common/UI/UITTFFont.cpp index eb343382..5d72ed97 100644 --- a/Minecraft.Client/Common/UI/UITTFFont.cpp +++ b/Minecraft.Client/Common/UI/UITTFFont.cpp @@ -4,7 +4,8 @@ #include "..\..\..\Minecraft.World\File.h" #include "UITTFFont.h" -UITTFFont::UITTFFont(const string &path, S32 fallbackCharacter) +UITTFFont::UITTFFont(const string &name, const string &path, S32 fallbackCharacter) + : m_strFontName(name) { app.DebugPrintf("UITTFFont opening %s\n",path.c_str()); @@ -36,9 +37,9 @@ UITTFFont::UITTFFont(const string &path, S32 fallbackCharacter) } CloseHandle(file); - IggyFontInstallTruetypeUTF8 ( (void *)pbData, IGGY_TTC_INDEX_none, "Mojangles_TTF", -1, IGGY_FONTFLAG_none ); + IggyFontInstallTruetypeUTF8 ( (void *)pbData, IGGY_TTC_INDEX_none, m_strFontName.c_str(), -1, IGGY_FONTFLAG_none ); - IggyFontInstallTruetypeFallbackCodepointUTF8( "Mojangles_TTF", -1, IGGY_FONTFLAG_none, fallbackCharacter ); + IggyFontInstallTruetypeFallbackCodepointUTF8( m_strFontName.c_str(), -1, IGGY_FONTFLAG_none, fallbackCharacter ); // 4J Stu - These are so we can use the default flash controls IggyFontInstallTruetypeUTF8 ( (void *)pbData, IGGY_TTC_INDEX_none, "Times New Roman", -1, IGGY_FONTFLAG_none ); @@ -48,4 +49,10 @@ UITTFFont::UITTFFont(const string &path, S32 fallbackCharacter) UITTFFont::~UITTFFont() { +} + + +string UITTFFont::getFontName() +{ + return m_strFontName; }
\ No newline at end of file diff --git a/Minecraft.Client/Common/UI/UITTFFont.h b/Minecraft.Client/Common/UI/UITTFFont.h index 0de7c4e0..023bd51b 100644 --- a/Minecraft.Client/Common/UI/UITTFFont.h +++ b/Minecraft.Client/Common/UI/UITTFFont.h @@ -3,10 +3,14 @@ class UITTFFont { private: + const string m_strFontName; + PBYTE pbData; //DWORD dwDataSize; public: - UITTFFont(const string &path, S32 fallbackCharacter); + UITTFFont(const string &name, const string &path, S32 fallbackCharacter); ~UITTFFont(); + + string getFontName(); }; |
