blob: 44bbdc44b8b1c60e08aadd8bbb55d0eca21d5bff (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
|
#include "stdafx.h"
#include "IUIScene_BrewingMenu.h"
#include "..\..\..\Minecraft.World\net.minecraft.world.inventory.h"
IUIScene_AbstractContainerMenu::ESceneSection IUIScene_BrewingMenu::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 eSectionBrewingBottle1:
if(eTapDirection == eTapStateUp)
{
newSection = eSectionBrewingIngredient;
}
else if(eTapDirection == eTapStateDown)
{
newSection = eSectionBrewingInventory;
xOffset = BREWING_SCENE_BOTTLE1_SLOT_DOWN_OFFSET;
}
else if(eTapDirection == eTapStateLeft)
{
newSection = eSectionBrewingBottle3;
}
else if(eTapDirection == eTapStateRight)
{
newSection = eSectionBrewingBottle2;
}
break;
case eSectionBrewingBottle2:
if(eTapDirection == eTapStateUp)
{
newSection = eSectionBrewingIngredient;
}
else if(eTapDirection == eTapStateDown)
{
newSection = eSectionBrewingInventory;
xOffset = BREWING_SCENE_BOTTLE2_SLOT_DOWN_OFFSET;
}
else if(eTapDirection == eTapStateLeft)
{
newSection = eSectionBrewingBottle1;
}
else if(eTapDirection == eTapStateRight)
{
newSection = eSectionBrewingBottle3;
}
break;
case eSectionBrewingBottle3:
if(eTapDirection == eTapStateUp)
{
newSection = eSectionBrewingIngredient;
}
else if(eTapDirection == eTapStateDown)
{
newSection = eSectionBrewingInventory;
xOffset = BREWING_SCENE_BOTTLE3_SLOT_DOWN_OFFSET;
}
else if(eTapDirection == eTapStateLeft)
{
newSection = eSectionBrewingBottle2;
}
else if(eTapDirection == eTapStateRight)
{
newSection = eSectionBrewingBottle1;
}
break;
case eSectionBrewingIngredient:
if(eTapDirection == eTapStateUp)
{
newSection = eSectionBrewingUsing;
xOffset = BREWING_SCENE_INGREDIENT_SLOT_DOWN_OFFSET;
}
else if(eTapDirection == eTapStateDown)
{
newSection = eSectionBrewingBottle2;
}
break;
case eSectionBrewingInventory:
if(eTapDirection == eTapStateDown)
{
newSection = eSectionBrewingUsing;
}
else if(eTapDirection == eTapStateUp)
{
if( *piTargetX <= BREWING_SCENE_BOTTLE1_SLOT_UP_OFFSET)
{
newSection = eSectionBrewingBottle1;
}
else if( *piTargetX <= BREWING_SCENE_BOTTLE2_SLOT_UP_OFFSET)
{
newSection = eSectionBrewingBottle2;
}
else if( *piTargetX >= BREWING_SCENE_BOTTLE3_SLOT_UP_OFFSET)
{
newSection = eSectionBrewingBottle3;
}
}
break;
case eSectionBrewingUsing:
if(eTapDirection == eTapStateUp)
{
newSection = eSectionBrewingInventory;
}
else if(eTapDirection == eTapStateDown)
{
newSection = eSectionBrewingIngredient;
}
break;
default:
assert( false );
break;
}
updateSlotPosition(eSection, newSection, eTapDirection, piTargetX, piTargetY, xOffset);
return newSection;
}
int IUIScene_BrewingMenu::getSectionStartOffset(ESceneSection eSection)
{
int offset = 0;
switch( eSection )
{
case eSectionBrewingBottle1:
offset = BrewingStandMenu::BOTTLE_SLOT_START;
break;
case eSectionBrewingBottle2:
offset = BrewingStandMenu::BOTTLE_SLOT_START + 1;
break;
case eSectionBrewingBottle3:
offset = BrewingStandMenu::BOTTLE_SLOT_START + 2;
break;
case eSectionBrewingIngredient:
offset = BrewingStandMenu::INGREDIENT_SLOT;
break;
case eSectionBrewingInventory:
offset = BrewingStandMenu::INV_SLOT_START;
break;
case eSectionBrewingUsing:
offset = BrewingStandMenu::INV_SLOT_START + 27;
break;
default:
assert( false );
break;
}
return offset;
}
|