static void ModifyGameSpeedIfNeeded(void);
static void DisableVsyncIfNeeded(void);
+static void RedrawScreenMenuGadgets(int);
static void MapScreenMenuGadgets(int);
static void UnmapScreenMenuGadgets(int);
static void MapScreenGadgets(int);
+static void UnmapScreenGadgets(void);
static void MapScreenTreeGadgets(TreeInfo *);
+static void UnmapScreenTreeGadgets(void);
static void UpdateScreenMenuGadgets(int, boolean);
GDI_SCROLLBAR_ITEM_POSITION, item_position, GDI_END);
}
-static void AdjustChooseTreeScrollbar(int id, int first_entry, TreeInfo *ti)
+static void AdjustChooseTreeScrollbar(TreeInfo *ti, int id)
{
AdjustScrollbar(id, numTreeInfoInGroup(ti), NUM_MENU_ENTRIES_ON_SCREEN,
- first_entry);
+ ti->cl_first);
}
static void clearMenuListArea(void)
return MENU_CHOOSE_TREE_FONT(MENU_CHOOSE_TREE_COLOR(node, active));
}
-static void drawChooseTreeText(int y, boolean active, TreeInfo *ti)
+static void drawChooseTreeText(TreeInfo *ti, int y, boolean active)
{
int num_entries = numTreeInfoInGroup(ti);
boolean scrollbar_needed = (num_entries > NUM_MENU_ENTRIES_ON_SCREEN);
drawChooseTreeHeadExt(ti->type, ti->infotext);
}
-static void drawChooseTreeList(int first_entry, int num_page_entries,
- TreeInfo *ti)
+static void drawChooseTreeList(TreeInfo *ti)
{
+ int first_entry = ti->cl_first;
+ int num_entries = numTreeInfoInGroup(ti);
+ int num_page_entries = MIN(num_entries, NUM_MENU_ENTRIES_ON_SCREEN);
int i;
clearMenuListArea();
node_first = getTreeInfoFirstGroupEntry(ti);
node = getTreeInfoFromPos(node_first, entry_pos);
- drawChooseTreeText(i, FALSE, ti);
+ drawChooseTreeText(ti, i, FALSE);
if (node->parent_link)
initCursor(i, IMG_MENU_BUTTON_LEAVE_MENU);
redraw_mask |= REDRAW_FIELD;
}
-static void drawChooseTreeInfo(int entry_pos, TreeInfo *ti)
+static void drawChooseTreeInfo(TreeInfo *ti)
{
- TreeInfo *node, *node_first;
- int x, last_redraw_mask = redraw_mask;
+ int entry_pos = ti->cl_first + ti->cl_cursor;
+ int last_redraw_mask = redraw_mask;
int ypos = MENU_TITLE2_YPOS;
int font_nr = FONT_TITLE_2;
+ int x;
if (ti->type == TREE_TYPE_LEVEL_NR)
DrawTextFCentered(ypos, font_nr, leveldir_current->name);
if (ti->type != TREE_TYPE_LEVEL_DIR)
return;
- node_first = getTreeInfoFirstGroupEntry(ti);
- node = getTreeInfoFromPos(node_first, entry_pos);
+ TreeInfo *node_first = getTreeInfoFirstGroupEntry(ti);
+ TreeInfo *node = getTreeInfoFromPos(node_first, entry_pos);
DrawBackgroundForFont(SX, SY + ypos, SXSIZE, getFontHeight(font_nr), font_nr);
MarkTileDirty(x, 1);
}
-static void drawChooseTreeCursorAndText(int y, boolean active, TreeInfo *ti)
+static void drawChooseTreeCursorAndText(TreeInfo *ti, boolean active)
{
- drawChooseTreeCursor(y, active);
- drawChooseTreeText(y, active, ti);
+ drawChooseTreeCursor(ti->cl_cursor, active);
+ drawChooseTreeText(ti, ti->cl_cursor, active);
}
static void drawChooseTreeScreen(TreeInfo *ti)
{
- int num_entries = numTreeInfoInGroup(ti);
- int num_page_entries = MIN(num_entries, NUM_MENU_ENTRIES_ON_SCREEN);
-
drawChooseTreeHead(ti);
- drawChooseTreeList(ti->cl_first, num_page_entries, ti);
- drawChooseTreeInfo(ti->cl_first + ti->cl_cursor, ti);
- drawChooseTreeCursorAndText(ti->cl_cursor, TRUE, ti);
+ drawChooseTreeList(ti);
+ drawChooseTreeInfo(ti);
+ drawChooseTreeCursorAndText(ti, TRUE);
- AdjustChooseTreeScrollbar(SCREEN_CTRL_ID_SCROLL_VERTICAL, ti->cl_first, ti);
+ AdjustChooseTreeScrollbar(ti, SCREEN_CTRL_ID_SCROLL_VERTICAL);
// scroll bar and buttons may just have been added after reloading scores
if (game_status == GAME_MODE_SCORES)
{
PlaySound(SND_MENU_ITEM_ACTIVATING);
- drawChooseTreeCursorAndText(ti->cl_cursor, FALSE, ti);
- drawChooseTreeCursorAndText(y, TRUE, ti);
- drawChooseTreeInfo(ti->cl_first + y, ti);
+ drawChooseTreeCursorAndText(ti, FALSE);
ti->cl_cursor = y;
+
+ drawChooseTreeCursorAndText(ti, TRUE);
+
+ drawChooseTreeInfo(ti);
}
else if (dx < 0)
{
FreeGadget(screen_gadget[i]);
}
+static void RedrawScreenMenuGadgets(int screen_mask)
+{
+ int i;
+
+ for (i = 0; i < NUM_SCREEN_MENUBUTTONS; i++)
+ if (screen_mask & menubutton_info[i].screen_mask)
+ RedrawGadget(screen_gadget[menubutton_info[i].gadget_id]);
+}
+
static void MapScreenMenuGadgets(int screen_mask)
{
int i;
MapGadget(screen_gadget[scrollbar_info[i].gadget_id]);
}
+static void UnmapScreenGadgets()
+{
+ int i;
+
+ for (i = 0; i < NUM_SCREEN_SCROLLBUTTONS; i++)
+ UnmapGadget(screen_gadget[scrollbutton_info[i].gadget_id]);
+
+ for (i = 0; i < NUM_SCREEN_SCROLLBARS; i++)
+ UnmapGadget(screen_gadget[scrollbar_info[i].gadget_id]);
+}
+
static void MapScreenTreeGadgets(TreeInfo *ti)
{
MapScreenGadgets(numTreeInfoInGroup(ti));
}
+static void UnmapScreenTreeGadgets(void)
+{
+ UnmapScreenGadgets();
+}
+
static void HandleScreenGadgets(struct GadgetInfo *gi)
{
int id = gi->custom_id;