the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#pragma once
2#include "IUIScene_AbstractContainerMenu.h"
3#include "..\..\..\Minecraft.World\AbstractContainerMenu.h"
4// 4J Stu - This class is for code that is common between XUI and Iggy
5
6class SimpleContainer;
7
8class IUIScene_CreativeMenu : public virtual IUIScene_AbstractContainerMenu
9{
10public:
11 // 4J Stu - These map directly to the tabs seenon the screen
12 enum ECreativeInventoryTabs
13 {
14 eCreativeInventoryTab_BuildingBlocks = 0,
15 eCreativeInventoryTab_Decorations,
16 eCreativeInventoryTab_RedstoneAndTransport,
17 eCreativeInventoryTab_Materials,
18 eCreativeInventoryTab_Food,
19 eCreativeInventoryTab_ToolsWeaponsArmor,
20 eCreativeInventoryTab_Brewing,
21 eCreativeInventoryTab_Misc,
22 eCreativeInventoryTab_COUNT,
23 };
24
25 // 4J Stu - These are logical groupings of items, and be be combined for tabs on-screen
26 enum ECreative_Inventory_Groups
27 {
28 eCreativeInventory_BuildingBlocks,
29 eCreativeInventory_Decoration,
30 eCreativeInventory_Redstone,
31 eCreativeInventory_Transport,
32 eCreativeInventory_Materials,
33 eCreativeInventory_Food,
34 eCreativeInventory_ToolsArmourWeapons,
35 eCreativeInventory_Brewing,
36 eCreativeInventory_Potions_Basic,
37 eCreativeInventory_Potions_Level2,
38 eCreativeInventory_Potions_Extended,
39 eCreativeInventory_Potions_Level2_Extended,
40 eCreativeInventory_Misc,
41 eCreativeInventory_ArtToolsDecorations,
42 eCreativeInventory_ArtToolsMisc,
43 eCreativeInventoryGroupsCount
44 };
45
46 // 4J JEV - Keeping all the tab specifications in one place.
47 struct TabSpec
48 {
49 public:
50 // 4J JEV - Layout
51 static const int rows = 5;
52 static const int columns = 10;
53 static const int MAX_SIZE = rows * columns;
54
55 // 4J JEV - Images
56 const LPCWSTR m_icon;
57 const int m_descriptionId;
58 const int m_staticGroupsCount;
59 ECreative_Inventory_Groups *m_staticGroupsA;
60 const int m_dynamicGroupsCount;
61 ECreative_Inventory_Groups *m_dynamicGroupsA;
62 const int m_debugGroupsCount;
63 ECreative_Inventory_Groups *m_debugGroupsA;
64
65 private:
66 unsigned int m_pages;
67 unsigned int m_staticPerPage;
68 unsigned int m_staticItems;
69 unsigned int m_debugItems;
70
71 public:
72 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 );
73 ~TabSpec();
74
75 void populateMenu(AbstractContainerMenu *menu, int dynamicIndex, unsigned int page);
76 unsigned int getPageCount();
77 };
78
79 class ItemPickerMenu : public AbstractContainerMenu
80 {
81 protected:
82 shared_ptr<SimpleContainer> creativeContainer;
83 shared_ptr<Inventory> inventory;
84
85 public:
86 ItemPickerMenu( shared_ptr<SimpleContainer> creativeContainer, shared_ptr<Inventory> inventory );
87
88 virtual bool stillValid(shared_ptr<Player> player);
89 bool isOverrideResultClick(int slotNum, int buttonNum);
90 protected:
91 // 4J Stu - Brought forward from 1.2 to fix infinite recursion bug in creative
92 virtual void loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, shared_ptr<Player> player) { } // do nothing
93 } *itemPickerMenu;
94
95protected:
96 static vector< shared_ptr<ItemInstance> > categoryGroups[eCreativeInventoryGroupsCount];
97 // 4J JEV - Tabs
98 static TabSpec **specs;
99
100 bool m_bCarryingCreativeItem;
101 int m_creativeSlotX, m_creativeSlotY, m_inventorySlotX, m_inventorySlotY;
102
103public:
104 static void staticCtor();
105 IUIScene_CreativeMenu();
106
107protected:
108 ECreativeInventoryTabs m_curTab;
109 int m_tabDynamicPos[eCreativeInventoryTab_COUNT];
110 int m_tabPage[eCreativeInventoryTab_COUNT];
111
112 void switchTab(ECreativeInventoryTabs tab);
113 void ScrollBar(UIVec2D pointerPos);
114 virtual void updateTabHighlightAndText(ECreativeInventoryTabs tab) = 0;
115 virtual void updateScrollCurrentPage(int currentPage, int pageCount) = 0;
116 virtual ESceneSection GetSectionAndSlotInDirection( ESceneSection eSection, ETapState eTapDirection, int *piTargetX, int *piTargetY );
117 virtual bool handleValidKeyPress(int iUserIndex, int buttonNum, BOOL quickKeyHeld);
118 virtual void handleOutsideClicked(int iPad, int buttonNum, BOOL quickKeyHeld);
119 virtual void handleAdditionalKeyPress(int iAction);
120 virtual void handleSlotListClicked(ESceneSection eSection, int buttonNum, BOOL quickKeyHeld);
121 bool getEmptyInventorySlot(shared_ptr<ItemInstance> item, int &slotX);
122 int getSectionStartOffset(ESceneSection eSection);
123 virtual bool IsSectionSlotList( ESceneSection eSection );
124 virtual bool CanHaveFocus( ESceneSection eSection );
125
126 virtual bool overrideTooltips(
127 ESceneSection sectionUnderPointer,
128 shared_ptr<ItemInstance> itemUnderPointer,
129 bool bIsItemCarried,
130 bool bSlotHasItem,
131 bool bCarriedIsSameAsSlot,
132 int iSlotStackSizeRemaining,
133 EToolTipItem &buttonA,
134 EToolTipItem &buttonX,
135 EToolTipItem &buttonY,
136 EToolTipItem &buttonRT,
137 EToolTipItem &buttonBack
138 );
139
140 static void BuildFirework(vector<shared_ptr<ItemInstance> > *list, byte type, int color, int sulphur, bool flicker, bool trail, int fadeColor = -1);
141};