25 #include "twine/twine.h" 26 #include "twine/text.h" 30 #define MAX_BUTTONS 10 31 #define PLASMA_WIDTH 320 32 #define PLASMA_HEIGHT 50 33 #define kDemoMenu 9999 34 #define kQuitEngine 9998 41 enum MenuSettingsType {
43 MenuSettings_CurrentLoadedButton = 0,
45 MenuSettings_NumberOfButtons = 1,
46 MenuSettings_ButtonsBoxHeight = 2,
47 MenuSettings_TextBankId = 3,
49 MenuSettings_FirstButtonState,
50 MenuSettings_FirstButton
53 int16 _settings[4 + MAX_BUTTONS * 2] {0};
55 int8 _activeButtonIdx = 0;
58 TextId getButtonTextId(
int buttonIndex)
const {
59 return (TextId)_settings[MenuSettings_FirstButton + buttonIndex * 2];
63 for (int32 i = 0; i < MAX_BUTTONS; ++i) {
66 _settings[MenuSettings_NumberOfButtons] = 0;
67 setButtonsBoxHeight(0);
72 void setButtonsBoxHeight(int16 height) {
73 _settings[MenuSettings_ButtonsBoxHeight] = height;
76 void setActiveButton(int16 buttonIdx) {
77 _activeButtonIdx = buttonIdx;
78 _settings[MenuSettings_CurrentLoadedButton] = buttonIdx;
81 void setActiveButtonTextId(TextId textIndex) {
82 setButtonTextId(getActiveButton(), textIndex);
85 void setButtonTextId(int16 buttonIdx, TextId textIndex) {
86 _settings[MenuSettings_FirstButton + buttonIdx * 2] = (int16)textIndex;
87 _buttonTexts[buttonIdx].
clear();
90 TextId getActiveButtonTextId()
const {
91 return getButtonTextId(getActiveButton());
94 int16 getActiveButtonState()
const {
95 return getButtonState(getActiveButton());
98 int16 getButtonState(
int buttonIndex)
const {
99 return _settings[MenuSettings_FirstButtonState + buttonIndex * 2];
102 const char *getButtonText(
Text *text,
int buttonIndex);
104 int16 getActiveButton()
const {
105 return _activeButtonIdx;
108 int16 getButtonBoxHeight()
const {
109 return _settings[MenuSettings_ButtonsBoxHeight];
112 int16 getButtonCount()
const {
113 return _settings[MenuSettings_NumberOfButtons];
116 void setTextBankId(TextBankId textBankIndex) {
117 _settings[MenuSettings_TextBankId] = (int16)textBankIndex;
120 void addButton(TextId textId, int16 state = 0) {
121 const int16 i = _settings[MenuSettings_NumberOfButtons];
122 _settings[i * 2 + MenuSettings_FirstButtonState] = state;
123 _settings[i * 2 + MenuSettings_FirstButton] = (int16)textId;
124 ++_settings[MenuSettings_NumberOfButtons];
127 void addButton(
const char *text, int16 state = 0) {
128 const int16 i = _settings[MenuSettings_NumberOfButtons];
129 _settings[i * 2 + MenuSettings_FirstButtonState] = state;
131 _settings[i * 2 + MenuSettings_FirstButton] = i;
132 _buttonTexts[i] = text;
133 ++_settings[MenuSettings_NumberOfButtons];
141 BodyData *_behaviourEntity =
nullptr;
143 uint _behaviourAnimState[4];
147 int32 _inventorySelectedColor = COLOR_BLACK;
148 int32 _inventorySelectedItem = 0;
151 uint8 *_plasmaEffectPtr =
nullptr;
164 int16 _itemAngle[NUM_INVENTORY_ITEMS];
174 void drawButtonGfx(
const MenuSettings *menuSettings,
const Common::Rect &rect, int32 buttonId,
const char *dialText,
bool hover);
175 void plasmaEffectRenderFrame();
181 int16 drawButtons(
MenuSettings *menuSettings,
bool hover);
183 int32 advoptionsMenu();
185 int32 volumeOptions();
186 int32 languageMenu();
188 int32 savemanageMenu();
189 void drawInfoMenu(int16 left, int16 top, int16 width);
190 Common::Rect calcBehaviourRect(int32 left, int32 top, HeroBehaviourType behaviour)
const;
191 bool isBehaviourHovered(int32 left, int32 top, HeroBehaviourType behaviour)
const;
192 void drawBehaviour(int32 left, int32 top, HeroBehaviourType behaviour, int32 angle,
bool cantDrawBox);
193 void drawListInventory(int32 left, int32 top);
194 void prepareAndDrawBehaviour(int32 left, int32 top, int32 angle, HeroBehaviourType behaviour);
195 void drawBehaviourMenu(int32 left, int32 top, int32 angle);
196 Common::Rect calcItemRect(int32 left, int32 top, int32 item, int32 *centerX =
nullptr, int32 *centerY =
nullptr)
const;
198 void drawOneInventory(int32 left, int32 top, int32 item);
200 void drawSpriteAndString(int32 left, int32 top,
const SpriteData &spriteData,
const Common::String &str, int32 color = COLOR_GOLD);
210 void processPlasmaEffect(
const Common::Rect &rect, int32 color);
212 void drawHealthBar(int32 left, int32 right, int32 top, int32 barLeftPadding, int32 barHeight);
213 void drawCloverLeafs(int32 newBoxLeft, int32 boxRight, int32 top);
214 void drawMagicPointsBar(int32 left, int32 right, int32 top, int32 barLeftPadding, int32 barHeight);
215 void drawCoins(int32 left, int32 top);
216 void drawKeys(int32 left, int32 top);
225 void drawRectBorders(int32 left, int32 top, int32 right, int32 bottom, int32 colorLeftTop = COLOR_79, int32 colorRightBottom = COLOR_73);
226 void drawRectBorders(
const Common::Rect &rect, int32 colorLeftTop = COLOR_79, int32 colorRightBottom = COLOR_73);
243 void inGameOptionsMenu();
249 void processBehaviourMenu(
bool behaviourMenu);
251 int32 newGameClassicMenu();
Definition: achievements_tables.h:27