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);
180 int32 x, int32 y, int32, int32);
202 BTN_TYPE_OM_SCROLLING_ON,
203 BTN_TYPE_OM_SCROLLING_OFF
207 int32 buttonType = 0;
208 const char *prompt =
nullptr;
210 int32 specialTag = 0;
212 static menuItemButton *add(
guiMenu *myMenu, int32 tag, int32 x, int32 y, int32 w, int32 h, CALLBACK callback =
nullptr,
213 int32 buttonType = 0,
bool ghosted =
false,
bool transparent =
false,
214 const char *prompt =
nullptr, ItemHandlerFunction i_handler = (ItemHandlerFunction)handler);
217 static bool handler(
menuItemButton *theItem, int32 eventType, int32 event,
218 int32 x, int32 y,
void **currItem);
224 static bool handler(
menuItemHSlider *myItem, int32 eventType, int32 event, int32 x, int32 y,
void **currItem);
229 int32 thumbW = 0, thumbH = 0;
230 int32 thumbX = 0, maxThumbX = 0;
241 int32 x, int32 y, int32 w, int32 h, int32 initPercent = 0,
242 CALLBACK callback =
nullptr,
bool transparent =
false);
252 int32 thumbW = 0, thumbH = 0;
253 int32 thumbY = 0, minThumbY = 0, maxThumbY = 0;
266 VS_PAGE_DOWN = 0x0040,
268 VS_COMPONENT = 0x00f0
272 int32 initPercent = 0, CALLBACK callback =
nullptr,
bool transparent =
false);
276 static bool handler(
menuItemVSlider *myItem, int32 eventType, int32 event, int32 x, int32 y,
void **currItem);
282 int32 specialTag = 0;
285 char prompt[80] = { 0 };
286 char *promptEnd =
nullptr;
288 char *cursor =
nullptr;
297 const char *prompt =
nullptr, int32 specialtag = 0, CALLBACK callback =
nullptr,
bool transparent =
false);
298 static bool handler(
menuItemTextField *myItem, int32 eventType, int32 event, int32 x, int32 y,
void **currItem);
304 static void show(
void *s,
void *r,
void *b, int32 destX, int32 destY);
305 static bool eventHandler(
guiMenu *theMenu, int32 eventType, int32 parm1, int32 parm2, int32 parm3,
bool *currScreen);
308 GrBuff *menuBuffer =
nullptr;
310 CALLBACK cb_return =
nullptr;
311 CALLBACK cb_esc =
nullptr;
312 EventHandler menuEventHandler =
nullptr;
314 static bool initialize(
RGB8 *myPalette);
315 static void shutdown(
bool fadeToColor);
316 static guiMenu *create(Sprite *backgroundSprite, int32 x1, int32 y1, int32 scrnFlags);
317 static void destroy(
guiMenu *myMenu);
318 static void configure(
guiMenu *myMenu, CALLBACK cb_return, CALLBACK cb_esc);
319 static GrBuff *copyBackground(
guiMenu *myMenu, int32 x, int32 y, int32 w, int32 h);
324 static bool loadSprites(
const char *series, int32 numSprites);
325 static void unloadSprites();
330 bool menuSystemInitialized =
false;
331 bool buttonClosesDialog =
false;
332 bool interfaceWasVisible =
false;
333 RGB8 *menuPalette =
nullptr;
334 bool dumpedCodes =
false;
335 bool dumpedBackground =
false;
345 char *menuSeriesResource =
nullptr;
346 MemHandle menuSeriesHandle =
nullptr;
347 int32 menuSeriesOffset = 0;
348 int32 menuSeriesPalOffset = 0;
350 Font *menuFont =
nullptr;
353 int32 spriteCount = 0;
354 Sprite **menuSprites =
nullptr;
358 char **slotTitles =
nullptr;
359 bool *slotInUse =
nullptr;
360 int32 firstSlotIndex = 0;
361 int32 slotSelected = -1;
362 bool deleteSaveDesc =
false;
364 Sprite **thumbNails =
nullptr;
365 Sprite *saveLoadThumbNail =
nullptr;
367 int32 sizeofThumbData = -1;
368 int32 thumbIndex = 0;
370 bool currMenuIsSave =
true;
371 bool saveLoadFromHotkey =
false;
372 bool gameMenuFromMain =
false;
374 int32 remember_digi_volume = 0;
375 int32 remember_digestability = 0;
382 extern void gui_DrawSprite(Sprite *mySprite,
Buffer *myBuff, int32 x, int32 y);
388 #define MENU_DEPTH 9 // video depth for menu popup boxes 389 #define MAX_SLOTS 99 // number of save games you can have 390 #define MAX_SLOTS_SHOWN 8 // number of slots in the scrolling field
Definition: m4_types.h:88
Definition: m4_types.h:67
Definition: database.h:28