the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
1#pragma once
2
3#include "UIScene.h"
4#include "IUIScene_HUD.h"
5
6#define CHAT_LINES_COUNT 10
7
8class UIScene_HUD : public UIScene, public IUIScene_HUD
9{
10private:
11 bool m_bSplitscreen;
12
13protected:
14 UIControl_Label m_labelChatText[CHAT_LINES_COUNT];
15 UIControl_Label m_labelJukebox;
16 UIControl m_controlLabelBackground[CHAT_LINES_COUNT];
17 UIControl_Label m_labelDisplayName;
18
19 IggyName m_funcLoadHud, m_funcSetExpBarProgress, m_funcSetPlayerLevel, m_funcSetActiveSlot;
20 IggyName m_funcSetHealth, m_funcSetFood, m_funcSetAir, m_funcSetArmour;
21 IggyName m_funcShowHealth, m_funcShowHorseHealth, m_funcShowFood, m_funcShowAir, m_funcShowArmour, m_funcShowExpbar;
22 IggyName m_funcSetRegenerationEffect, m_funcSetFoodSaturationLevel;
23 IggyName m_funcSetDragonHealth, m_funcSetDragonLabel, m_funcShowDragonHealth;
24 IggyName m_funcSetSelectedLabel, m_funcHideSelectedLabel;
25 IggyName m_funcRepositionHud, m_funcSetDisplayName, m_funcSetTooltipsEnabled;
26 IggyName m_funcSetRidingHorse, m_funcSetHorseHealth, m_funcSetHorseJumpBarProgress;
27 IggyName m_funcSetHealthAbsorb;
28 UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
29 UI_MAP_ELEMENT(m_labelChatText[0],"Label1")
30 UI_MAP_ELEMENT(m_labelChatText[1],"Label2")
31 UI_MAP_ELEMENT(m_labelChatText[2],"Label3")
32 UI_MAP_ELEMENT(m_labelChatText[3],"Label4")
33 UI_MAP_ELEMENT(m_labelChatText[4],"Label5")
34 UI_MAP_ELEMENT(m_labelChatText[5],"Label6")
35 UI_MAP_ELEMENT(m_labelChatText[6],"Label7")
36 UI_MAP_ELEMENT(m_labelChatText[7],"Label8")
37 UI_MAP_ELEMENT(m_labelChatText[8],"Label9")
38 UI_MAP_ELEMENT(m_labelChatText[9],"Label10")
39
40 UI_MAP_ELEMENT(m_controlLabelBackground[0],"Label1Background")
41 UI_MAP_ELEMENT(m_controlLabelBackground[1],"Label2Background")
42 UI_MAP_ELEMENT(m_controlLabelBackground[2],"Label3Background")
43 UI_MAP_ELEMENT(m_controlLabelBackground[3],"Label4Background")
44 UI_MAP_ELEMENT(m_controlLabelBackground[4],"Label5Background")
45 UI_MAP_ELEMENT(m_controlLabelBackground[5],"Label6Background")
46 UI_MAP_ELEMENT(m_controlLabelBackground[6],"Label7Background")
47 UI_MAP_ELEMENT(m_controlLabelBackground[7],"Label8Background")
48 UI_MAP_ELEMENT(m_controlLabelBackground[8],"Label9Background")
49 UI_MAP_ELEMENT(m_controlLabelBackground[9],"Label10Background")
50
51 UI_MAP_ELEMENT(m_labelJukebox,"Jukebox")
52
53 UI_MAP_ELEMENT(m_labelDisplayName,"LabelGamertag")
54
55 UI_MAP_NAME(m_funcLoadHud, L"LoadHud")
56 UI_MAP_NAME(m_funcSetExpBarProgress, L"SetExpBarProgress")
57 UI_MAP_NAME(m_funcSetPlayerLevel, L"SetPlayerLevel")
58 UI_MAP_NAME(m_funcSetActiveSlot, L"SetActiveSlot")
59
60 UI_MAP_NAME(m_funcSetHealth, L"SetHealth")
61 UI_MAP_NAME(m_funcSetFood, L"SetFood")
62 UI_MAP_NAME(m_funcSetAir, L"SetAir")
63 UI_MAP_NAME(m_funcSetArmour, L"SetArmour")
64
65 UI_MAP_NAME(m_funcShowHealth, L"ShowHealth")
66 UI_MAP_NAME(m_funcShowHorseHealth, L"ShowHorseHealth")
67 UI_MAP_NAME(m_funcShowFood, L"ShowFood")
68 UI_MAP_NAME(m_funcShowAir, L"ShowAir")
69 UI_MAP_NAME(m_funcShowArmour, L"ShowArmour")
70 UI_MAP_NAME(m_funcShowExpbar, L"ShowExpBar")
71
72 UI_MAP_NAME(m_funcSetRegenerationEffect, L"SetRegenerationEffect")
73 UI_MAP_NAME(m_funcSetFoodSaturationLevel, L"SetFoodSaturationLevel")
74
75 UI_MAP_NAME(m_funcSetDragonHealth, L"SetDragonHealth")
76 UI_MAP_NAME(m_funcSetDragonLabel, L"SetDragonLabel")
77 UI_MAP_NAME(m_funcShowDragonHealth, L"ShowDragonHealthBar")
78
79 UI_MAP_NAME(m_funcSetSelectedLabel, L"SetSelectedLabel")
80 UI_MAP_NAME(m_funcHideSelectedLabel, L"HideSelectedLabel")
81
82 UI_MAP_NAME(m_funcRepositionHud, L"RepositionHud")
83 UI_MAP_NAME(m_funcSetDisplayName, L"SetGamertag")
84
85 UI_MAP_NAME(m_funcSetTooltipsEnabled, L"SetTooltipsEnabled")
86
87 UI_MAP_NAME(m_funcSetRidingHorse, L"SetRidingHorse")
88 UI_MAP_NAME(m_funcSetHorseHealth, L"SetHorseHealth")
89 UI_MAP_NAME(m_funcSetHorseJumpBarProgress, L"SetHorseJumpBarProgress")
90
91 UI_MAP_NAME(m_funcSetHealthAbsorb, L"SetHealthAbsorb")
92 UI_END_MAP_ELEMENTS_AND_NAMES()
93
94public:
95 UIScene_HUD(int iPad, void *initData, UILayer *parentLayer);
96
97 virtual void tick();
98
99 virtual void updateSafeZone();
100
101protected:
102 // TODO: This should be pure virtual in this class
103 virtual wstring getMoviePath();
104
105public:
106 virtual EUIScene getSceneType() { return eUIScene_HUD;}
107
108 // Returns true if this scene handles input
109 virtual bool stealsFocus() { return false; }
110
111 // Returns true if this scene has focus for the pad passed in
112 virtual bool hasFocus(int iPad) { return false; }
113
114 // Returns true if lower scenes in this scenes layer, or in any layer below this scenes layers should be hidden
115 virtual bool hidesLowerScenes() { return false; }
116
117 virtual void customDraw(IggyCustomDrawCallbackRegion *region);
118
119 virtual void handleReload();
120
121private:
122 virtual int getPad();
123 virtual void SetOpacity(float opacity);
124 virtual void SetVisible(bool visible);
125
126 void SetHudSize(int scale);
127 void SetExpBarProgress(float progress, int xpNeededForNextLevel);
128 void SetExpLevel(int level);
129 void SetActiveSlot(int slot);
130
131 void SetHealth(int iHealth, int iLastHealth, bool bBlink, bool bPoison, bool bWither);
132 void SetFood(int iFood, int iLastFood, bool bPoison);
133 void SetAir(int iAir, int extra);
134 void SetArmour(int iArmour);
135
136 void ShowHealth(bool show);
137 void ShowHorseHealth(bool show);
138 void ShowFood(bool show);
139 void ShowAir(bool show);
140 void ShowArmour(bool show);
141 void ShowExpBar(bool show);
142
143 void SetRegenerationEffect(bool bEnabled);
144 void SetFoodSaturationLevel(int iSaturation);
145
146 void SetDragonHealth(float health);
147 void SetDragonLabel(const wstring &label);
148 void ShowDragonHealth(bool show);
149
150 void HideSelectedLabel();
151
152 void SetDisplayName(const wstring &displayName);
153
154 void SetTooltipsEnabled(bool bEnabled);
155
156 void SetRidingHorse(bool ridingHorse, bool bIsJumpable, int maxHorseHealth);
157 void SetHorseHealth(int health, bool blink = false);
158 void SetHorseJumpBarProgress(float progress);
159
160 void SetHealthAbsorb(int healthAbsorb);
161
162public:
163 void SetSelectedLabel(const wstring &label);
164 void ShowDisplayName(bool show);
165
166 void handleGameTick();
167
168 // RENDERING
169 virtual void render(S32 width, S32 height, C4JRender::eViewportType viewport);
170
171protected:
172 void handleTimerComplete(int id);
173
174#ifdef _DURANGO
175 virtual long long getDefaultGtcButtons() { return _360_GTC_PAUSE | _360_GTC_MENU | _360_GTC_VIEW; }
176#endif
177
178private:
179 void repositionHud();
180};