#include "stdafx.h" #include "IUIScene_FurnaceMenu.h" #include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h" IUIScene_AbstractContainerMenu::ESceneSection IUIScene_ClassicCraftingMenu::GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY ) { ESceneSection newSection = eSection; int xOffset = 0; // Find the new section if there is one switch( eSection ) { case eSectionFurnaceResult: if(eTapDirection == eTapStateUp) { newSection = eSectionFurnaceUsing; xOffset = FURNACE_SCENE_RESULT_SLOT_DOWN_OFFSET; } else if(eTapDirection == eTapStateDown) { newSection = eSectionFurnaceInventory; xOffset = FURNACE_SCENE_RESULT_SLOT_DOWN_OFFSET; } else if(eTapDirection == eTapStateLeft) { newSection = eSectionFurnaceIngredient; } else if(eTapDirection == eTapStateRight) { newSection = eSectionFurnaceIngredient; } break; case eSectionFurnaceIngredient: if(eTapDirection == eTapStateUp) { newSection = eSectionFurnaceUsing; xOffset = FURNACE_SCENE_FUEL_SLOT_DOWN_OFFSET; } else if(eTapDirection == eTapStateDown) { newSection = eSectionFurnaceFuel; } else if(eTapDirection == eTapStateLeft) { newSection = eSectionFurnaceResult; } else if(eTapDirection == eTapStateRight) { newSection = eSectionFurnaceResult; } break; case eSectionFurnaceFuel: if(eTapDirection == eTapStateDown) { newSection = eSectionFurnaceInventory; xOffset = FURNACE_SCENE_FUEL_SLOT_DOWN_OFFSET; } else if(eTapDirection == eTapStateUp) { newSection = eSectionFurnaceIngredient; } else if(eTapDirection == eTapStateLeft) { newSection = eSectionFurnaceResult; } else if(eTapDirection == eTapStateRight) { newSection = eSectionFurnaceResult; } break; case eSectionFurnaceInventory: if(eTapDirection == eTapStateDown) { newSection = eSectionFurnaceUsing; } else if(eTapDirection == eTapStateUp) { if( *piTargetX >= FURNACE_SCENE_RESULT_SLOT_UP_OFFSET) { newSection = eSectionFurnaceResult; } else { newSection = eSectionFurnaceFuel; } } break; case eSectionFurnaceUsing: if(eTapDirection == eTapStateUp) { newSection = eSectionFurnaceInventory; } else if(eTapDirection == eTapStateDown) { if( *piTargetX >= FURNACE_SCENE_RESULT_SLOT_UP_OFFSET) { newSection = eSectionFurnaceResult; } else { newSection = eSectionFurnaceIngredient; } } break; default: assert( false ); break; } /* if ( a2 < 0x4B ) goto LABEL_30; if ( a2 == 75 ) { if ( a3 != 2 ) { if ( a3 == 1 ) v8 = 76; goto LABEL_30; } goto LABEL_26; } if ( a2 < 0x4D ) { if ( a3 == 2 ) { v8 = 75; IUIScene_AbstractContainerMenu::updateSlotPosition(*(a1 + 4), a2, 75, 2, a4, a5, 0, 0); return v8; } if ( a3 != 1 ) goto LABEL_30; LABEL_26: if ( *a4 < 6 ) { v8 = 78; IUIScene_AbstractContainerMenu::updateSlotPosition(*(a1 + 4), a2, 78, a3, a4, a5, 1, 0); return v8; } goto LABEL_12; } if ( a2 == 77 ) { switch ( a3 ) { case 2: v8 = 76; IUIScene_AbstractContainerMenu::updateSlotPosition(*(a1 + 4), 77, 76, 2, a4, a5, -7, 0); return v8; case 1: v8 = 75; IUIScene_AbstractContainerMenu::updateSlotPosition(*(a1 + 4), 77, 75, 1, a4, a5, -7, 0); return v8; case 3: v8 = 78; *a4 = (*(*(*(a1 + 4) + 144) + 36))(); IUIScene_AbstractContainerMenu::updateSlotPosition(*(a1 + 4), 77, 78, 3, a4, a5, 0, -1); return v8; case 4: v8 = 78; v9 = *(a1 + 4); *a4 = 0; IUIScene_AbstractContainerMenu::updateSlotPosition(v9, 77, 78, 4, a4, a5, 0, -1); return v8; } goto LABEL_30; } if ( a2 != 78 ) goto LABEL_30; if ( a3 != 2 ) { if ( a3 == 1 ) { v8 = 75; IUIScene_AbstractContainerMenu::updateSlotPosition(*(a1 + 4), 78, 75, 1, a4, a5, -1, 0); return v8; } if ( a3 == 3 || a3 == 4 ) { LABEL_12: v8 = 77; IUIScene_AbstractContainerMenu::updateSlotPosition(*(a1 + 4), a2, 77, a3, a4, a5, 0, 0); return v8; } LABEL_30: IUIScene_AbstractContainerMenu::updateSlotPosition(*(a1 + 4), a2, v8, a3, a4, a5, 0, 0); return v8; } v8 = 76; IUIScene_AbstractContainerMenu::updateSlotPosition(*(a1 + 4), 78, 76, 2, a4, a5, -1, 0); return v8; */ updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, xOffset); return newSection; } int IUIScene_ClassicCraftingMenu::getSectionStartOffset(ESceneSection eSection) { int offset = 0; switch( eSection ) { case eSectionFurnaceResult: offset = FurnaceMenu::RESULT_SLOT; break; case eSectionFurnaceFuel: offset = FurnaceMenu::FUEL_SLOT; break; case eSectionFurnaceIngredient: offset = FurnaceMenu::INGREDIENT_SLOT; break; case eSectionFurnaceInventory: offset = FurnaceMenu::INV_SLOT_START; break; case eSectionFurnaceUsing: offset = FurnaceMenu::INV_SLOT_START + 27; break; default: assert( false ); break; } /* if ( a2 >= 0x4B && a2 <= 0x4E ) return *(a2 + 269120465); */ return offset; }