Files
MinecraftConsoles/Minecraft.Client/Common/UI/IUIScene_HorseInventoryMenu.cpp
daoge b3feddfef3 feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict

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

* December 2014 files

* Working release build

* Fix compilation issues

* Add sound to Windows64Media

* Add DLC content and force Tutorial DLC

* Revert "Add DLC content and force Tutorial DLC"

This reverts commit 97a4399472.

* Disable broken light packing

* Disable breakpoint during DLC texture map load

Allows DLC loading but the DLC textures are still broken

* Fix post build not working

* ...

* fix vs2022 build

* fix cmake build

---------

Co-authored-by: Loki <lokirautio@gmail.com>
2026-03-03 03:04:10 +08:00

251 lines
5.1 KiB
C++

#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;
}