23 #ifndef M4_GUI_GUI_MENU_ITEMS_H 24 #define M4_GUI_GUI_MENU_ITEMS_H 26 #include "graphics/surface.h" 27 #include "m4/m4_types.h" 28 #include "m4/graphics/gr_buff.h" 29 #include "m4/gui/gui_univ.h" 30 #include "m4/graphics/gr_font.h" 37 enum options_menu_sprites {
64 enum options_menu_sprites {
67 OM_SLIDER_BTN_NORM = 5,
68 OM_SLIDER_BTN_OVER = 6,
69 OM_SLIDER_BTN_PRESS = 7,
71 OM_SCROLLING_ON_BTN_NORM = 8,
72 OM_SCROLLING_ON_BTN_OVER = 9,
73 OM_SCROLLING_ON_BTN_PRESS = 13,
75 OM_SCROLLING_OFF_BTN_NORM = 11,
76 OM_SCROLLING_OFF_BTN_OVER = 12,
77 OM_SCROLLING_OFF_BTN_PRESS = 10,
87 #define _GM(X) ::M4::g_vars->_menu.X 88 #define LockMouseSprite mouse_lock_sprite 89 #define UnlockMouseSprite mouse_unlock_sprite 91 enum save_load_menu_item_tags {
97 SL_TAG_SAVE_TITLE_LABEL,
98 SL_TAG_LOAD_TITLE_LABEL,
106 typedef bool (*ItemHandlerFunction)(menuItem *theItem, int32 eventType, int32 event, int32 x, int32 y,
void **currItem);
107 typedef void (*DrawFunction)(
void *source, guiMenu *dest, int32 x1, int32 y1, int32 x2, int32 y2);
108 typedef void (*DestroyFunction)(menuItem *theItem);
109 typedef M4CALLBACK CALLBACK;
111 typedef M4sprite Sprite;
113 enum game_menu_sprites {
128 TEXT_COLOR_GREY_HILITE = 192,
129 TEXT_COLOR_GREY_FOREGROUND = 210,
130 TEXT_COLOR_GREY_SHADOW = 229,
132 TEXT_COLOR_NORM_HILITE = 3,
133 TEXT_COLOR_NORM_FOREGROUND = 2,
134 TEXT_COLOR_NORM_SHADOW = 1,
136 TEXT_COLOR_OVER_HILITE = 3,
137 TEXT_COLOR_OVER_FOREGROUND = 2,
138 TEXT_COLOR_OVER_SHADOW = 1,
140 TEXT_COLOR_PRESS_HILITE = 3,
141 TEXT_COLOR_PRESS_FOREGROUND = 2,
142 TEXT_COLOR_PRESS_SHADOW = 1,
151 int32 x1 = 0, y1 = 0, x2 = 0, y2 = 0;
153 bool transparent =
false;
154 GrBuff *background =
nullptr;
156 CALLBACK callback =
nullptr;
157 DrawFunction redraw =
nullptr;
158 DestroyFunction destroy =
nullptr;
159 ItemHandlerFunction itemEventHandler =
nullptr;
161 static void destroyItem(
menuItem *theItem);
162 static bool cursorInsideItem(
menuItem *myItem, int32 cursorX, int32 cursorY);
167 static void drawMsg(
menuItemMsg *myItem,
guiMenu *myMenu, int32 x, int32 y, int32, int32);
172 static menuItemMsg *msgAdd(
guiMenu *myMenu, int32 tag, int32 x, int32 y, int32 w, int32 h,
bool transparent =
false);
178 int32 x, int32 y, int32, int32);
200 BTN_TYPE_OM_SCROLLING_ON,
201 BTN_TYPE_OM_SCROLLING_OFF
205 int32 buttonType = 0;
206 const char *prompt =
nullptr;
208 int32 specialTag = 0;
210 static menuItemButton *add(
guiMenu *myMenu, int32 tag, int32 x, int32 y, int32 w, int32 h, CALLBACK callback =
nullptr,
211 int32 buttonType = 0,
bool ghosted =
false,
bool transparent =
false,
212 const char *prompt =
nullptr, ItemHandlerFunction i_handler = (ItemHandlerFunction)handler);
215 static bool handler(
menuItemButton *myItem, int32 eventType, int32 event,
216 int32 x, int32 y,
void **currItem);
222 static bool handler(
menuItemHSlider *myItem, int32 eventType, int32 event, int32 x, int32 y,
void **currItem);
227 int32 thumbW = 0, thumbH = 0;
228 int32 thumbX = 0, maxThumbX = 0;
239 int32 x, int32 y, int32 w, int32 h, int32 initPercent = 0,
240 CALLBACK callback =
nullptr,
bool transparent =
false);
250 int32 thumbW = 0, thumbH = 0;
251 int32 thumbY = 0, minThumbY = 0, maxThumbY = 0;
264 VS_PAGE_DOWN = 0x0040,
266 VS_COMPONENT = 0x00f0
270 int32 initPercent = 0, CALLBACK callback =
nullptr,
bool transparent =
false);
274 static bool handler(
menuItemVSlider *myItem, int32 eventType, int32 event, int32 x, int32 y,
void **currItem);
280 int32 specialTag = 0;
283 char prompt[80] = { 0 };
284 char *promptEnd =
nullptr;
286 char *cursor =
nullptr;
295 const char *prompt =
nullptr, int32 specialtag = 0, CALLBACK callback =
nullptr,
bool transparent =
false);
296 static bool handler(
menuItemTextField *myItem, int32 eventType, int32 event, int32 x, int32 y,
void **currItem);
302 static void show(
void *s,
void *r,
void *b, int32 destX, int32 destY);
303 static bool eventHandler(
guiMenu *theMenu, int32 eventType, int32 parm1, int32 parm2, int32 parm3,
bool *currScreen);
306 GrBuff *menuBuffer =
nullptr;
308 CALLBACK cb_return =
nullptr;
309 CALLBACK cb_esc =
nullptr;
310 EventHandler menuEventHandler =
nullptr;
312 static bool initialize(
RGB8 *myPalette);
313 static void shutdown(
bool fadeToColor);
314 static guiMenu *create(Sprite *backgroundSprite, int32 x1, int32 y1, int32 scrnFlags);
315 static void destroy(
guiMenu *myMenu);
316 static void configure(
guiMenu *myMenu, CALLBACK cb_return, CALLBACK cb_esc);
317 static GrBuff *copyBackground(
guiMenu *myMenu, int32 x, int32 y, int32 w, int32 h);
322 static bool loadSprites(
const char *series, int32 numSprites);
323 static void unloadSprites();
328 bool menuSystemInitialized =
false;
329 bool buttonClosesDialog =
false;
330 bool interfaceWasVisible =
false;
331 RGB8 *menuPalette =
nullptr;
332 bool dumpedCodes =
false;
333 bool dumpedBackground =
false;
343 char *menuSeriesResource =
nullptr;
344 MemHandle menuSeriesHandle =
nullptr;
345 int32 menuSeriesOffset = 0;
346 int32 menuSeriesPalOffset = 0;
348 Font *menuFont =
nullptr;
351 int32 spriteCount = 0;
352 Sprite **menuSprites =
nullptr;
356 char **slotTitles =
nullptr;
357 bool *slotInUse =
nullptr;
358 int32 firstSlotIndex = 0;
359 int32 slotSelected = -1;
360 bool deleteSaveDesc =
false;
362 Sprite **thumbNails =
nullptr;
363 Sprite *saveLoadThumbNail =
nullptr;
365 int32 sizeofThumbData = -1;
366 int32 thumbIndex = 0;
368 bool currMenuIsSave =
true;
369 bool saveLoadFromHotkey =
false;
370 bool gameMenuFromMain =
false;
372 int32 remember_digi_volume = 0;
373 int32 remember_digestability = 0;
380 extern void gui_DrawSprite(Sprite *mySprite,
Buffer *myBuff, int32 x, int32 y);
386 #define MENU_DEPTH 9 // video depth for menu popup boxes 387 #define MAX_SLOTS 99 // number of save games you can have 388 #define MAX_SLOTS_SHOWN 8 // number of slots in the scrolling field
Definition: printman.h:30
Definition: m4_types.h:78
Definition: m4_types.h:54
Definition: database.h:28