-
-
-#define DEBUG_JOYSTICKS 0
-
-
-/* screens on the info screen */
-#define INFO_MODE_MAIN 0
-#define INFO_MODE_TITLE 1
-#define INFO_MODE_ELEMENTS 2
-#define INFO_MODE_MUSIC 3
-#define INFO_MODE_CREDITS 4
-#define INFO_MODE_PROGRAM 5
-#define INFO_MODE_VERSION 6
-#define INFO_MODE_LEVELSET 7
-
-#define MAX_INFO_MODES 8
-
-/* screens on the setup screen */
-/* (must match GFX_SPECIAL_ARG_SETUP_* values as defined in src/main.h) */
-/* (should also match corresponding entries in src/conf_gfx.c) */
-#define SETUP_MODE_MAIN 0
-#define SETUP_MODE_GAME 1
-#define SETUP_MODE_EDITOR 2
-#define SETUP_MODE_GRAPHICS 3
-#define SETUP_MODE_SOUND 4
-#define SETUP_MODE_ARTWORK 5
-#define SETUP_MODE_INPUT 6
-#define SETUP_MODE_TOUCH 7
-#define SETUP_MODE_SHORTCUTS 8
-#define SETUP_MODE_SHORTCUTS_1 9
-#define SETUP_MODE_SHORTCUTS_2 10
-#define SETUP_MODE_SHORTCUTS_3 11
-#define SETUP_MODE_SHORTCUTS_4 12
-#define SETUP_MODE_SHORTCUTS_5 13
-
-/* sub-screens on the setup screen (generic) */
-#define SETUP_MODE_CHOOSE_ARTWORK 14
-#define SETUP_MODE_CHOOSE_OTHER 15
-
-/* sub-screens on the setup screen (specific) */
-#define SETUP_MODE_CHOOSE_GAME_SPEED 16
-#define SETUP_MODE_CHOOSE_SCROLL_DELAY 17
-#define SETUP_MODE_CHOOSE_SNAPSHOT_MODE 18
-#define SETUP_MODE_CHOOSE_WINDOW_SIZE 19
-#define SETUP_MODE_CHOOSE_SCALING_TYPE 20
-#define SETUP_MODE_CHOOSE_RENDERING 21
-#define SETUP_MODE_CHOOSE_GRAPHICS 22
-#define SETUP_MODE_CHOOSE_SOUNDS 23
-#define SETUP_MODE_CHOOSE_MUSIC 24
-#define SETUP_MODE_CHOOSE_VOLUME_SIMPLE 25
-#define SETUP_MODE_CHOOSE_VOLUME_LOOPS 26
-#define SETUP_MODE_CHOOSE_VOLUME_MUSIC 27
-#define SETUP_MODE_CHOOSE_TOUCH_CONTROL 28
-#define SETUP_MODE_CHOOSE_MOVE_DISTANCE 29
-#define SETUP_MODE_CHOOSE_DROP_DISTANCE 30
-#define SETUP_MODE_CHOOSE_TRANSPARENCY 31
-
-#define MAX_SETUP_MODES 32
-
-#define MAX_MENU_MODES MAX(MAX_INFO_MODES, MAX_SETUP_MODES)
-
-/* setup screen titles */
-#define STR_SETUP_MAIN "Setup"
-#define STR_SETUP_GAME "Game & Menu"
-#define STR_SETUP_EDITOR "Editor"
-#define STR_SETUP_GRAPHICS "Graphics"
-#define STR_SETUP_SOUND "Sound & Music"
-#define STR_SETUP_ARTWORK "Custom Artwork"
-#define STR_SETUP_INPUT "Input Devices"
-#define STR_SETUP_TOUCH "Touch Controls"
-#define STR_SETUP_SHORTCUTS "Key Shortcuts"
-#define STR_SETUP_EXIT "Exit"
-#define STR_SETUP_SAVE_AND_EXIT "Save and Exit"
-
-#define STR_SETUP_CHOOSE_GAME_SPEED "Game Speed"
-#define STR_SETUP_CHOOSE_SCROLL_DELAY "Scroll Delay"
-#define STR_SETUP_CHOOSE_SNAPSHOT_MODE "Snapshot Mode"
-#define STR_SETUP_CHOOSE_WINDOW_SIZE "Window Scaling"
-#define STR_SETUP_CHOOSE_SCALING_TYPE "Anti-Aliasing"
-#define STR_SETUP_CHOOSE_RENDERING "Rendering Mode"
-#define STR_SETUP_CHOOSE_VOLUME_SIMPLE "Sound Volume"
-#define STR_SETUP_CHOOSE_VOLUME_LOOPS "Loops Volume"
-#define STR_SETUP_CHOOSE_VOLUME_MUSIC "Music Volume"
-#define STR_SETUP_CHOOSE_TOUCH_CONTROL "Control Type"
-#define STR_SETUP_CHOOSE_MOVE_DISTANCE "Move Distance"
-#define STR_SETUP_CHOOSE_DROP_DISTANCE "Drop Distance"
-#define STR_SETUP_CHOOSE_TRANSPARENCY "Transparency"
-
-/* for input setup functions */
-#define SETUPINPUT_SCREEN_POS_START 0
-#define SETUPINPUT_SCREEN_POS_EMPTY1 3
-#define SETUPINPUT_SCREEN_POS_EMPTY2 12
-#define SETUPINPUT_SCREEN_POS_END 13
-
-#define MENU_SETUP_FONT_TITLE FONT_TEXT_1
-#define MENU_SETUP_FONT_TEXT FONT_TITLE_2
-
-/* for various menu stuff */
-#define MENU_SCREEN_START_XPOS 1
-#define MENU_SCREEN_START_YPOS 2
-#define MENU_SCREEN_VALUE_XPOS (SCR_FIELDX - 3)
-#define MENU_SCREEN_MAX_XPOS (SCR_FIELDX - 1)
-#define MENU_TITLE1_YPOS 8
-#define MENU_TITLE2_YPOS 46
-#define MENU_INFO_FONT_TITLE FONT_TEXT_1
-#define MENU_INFO_FONT_HEAD FONT_TEXT_2
-#define MENU_INFO_FONT_TEXT FONT_TEXT_3
-#define MENU_INFO_FONT_FOOT FONT_TEXT_4
-#define MENU_INFO_SPACE_HEAD (menu.headline2_spacing_info[info_mode])
-#define MENU_SCREEN_INFO_SPACE_LEFT (menu.left_spacing_info[info_mode])
-#define MENU_SCREEN_INFO_SPACE_RIGHT (menu.right_spacing_info[info_mode])
-#define MENU_SCREEN_INFO_SPACE_TOP (menu.top_spacing_info[info_mode])
-#define MENU_SCREEN_INFO_SPACE_BOTTOM (menu.bottom_spacing_info[info_mode])
-#define MENU_SCREEN_INFO_YSTART1 MENU_SCREEN_INFO_SPACE_TOP
-#define MENU_SCREEN_INFO_YSTART2 (MENU_SCREEN_INFO_YSTART1 + \
- getMenuTextStep(MENU_INFO_SPACE_HEAD, \
- MENU_INFO_FONT_TITLE))
-#define MENU_SCREEN_INFO_YSTEP (TILEY + 4)
-#define MENU_SCREEN_INFO_YBOTTOM (SYSIZE - MENU_SCREEN_INFO_SPACE_BOTTOM)
-#define MENU_SCREEN_INFO_YSIZE (MENU_SCREEN_INFO_YBOTTOM - \
- MENU_SCREEN_INFO_YSTART2 - \
- TILEY / 2)
-#define MAX_INFO_ELEMENTS_ON_SCREEN 128
-#define STD_INFO_ELEMENTS_ON_SCREEN (MENU_SCREEN_INFO_YSIZE / \
- MENU_SCREEN_INFO_YSTEP)
-#define NUM_INFO_ELEMENTS_FROM_CONF \
- (menu.list_size_info[GFX_SPECIAL_ARG_INFO_ELEMENTS] > 0 ? \
- menu.list_size_info[GFX_SPECIAL_ARG_INFO_ELEMENTS] : \
- MAX_MENU_ENTRIES_ON_SCREEN)
-#define NUM_INFO_ELEMENTS_ON_SCREEN MIN(MIN(STD_INFO_ELEMENTS_ON_SCREEN, \
- MAX_INFO_ELEMENTS_ON_SCREEN), \
- NUM_INFO_ELEMENTS_FROM_CONF)
-#define MAX_MENU_ENTRIES_ON_SCREEN (SCR_FIELDY - MENU_SCREEN_START_YPOS)
-#define MAX_MENU_TEXT_LENGTH_BIG 13
-#define MAX_MENU_TEXT_LENGTH_MEDIUM (MAX_MENU_TEXT_LENGTH_BIG * 2)
-
-/* buttons and scrollbars identifiers */
-#define SCREEN_CTRL_ID_PREV_LEVEL 0
-#define SCREEN_CTRL_ID_NEXT_LEVEL 1
-#define SCREEN_CTRL_ID_PREV_PLAYER 2
-#define SCREEN_CTRL_ID_NEXT_PLAYER 3
-#define SCREEN_CTRL_ID_SCROLL_UP 4
-#define SCREEN_CTRL_ID_SCROLL_DOWN 5
-#define SCREEN_CTRL_ID_SCROLL_VERTICAL 6
-
-#define NUM_SCREEN_GADGETS 7
-
-#define NUM_SCREEN_MENUBUTTONS 4
-#define NUM_SCREEN_SCROLLBUTTONS 2
-#define NUM_SCREEN_SCROLLBARS 1
-
-#define SCREEN_MASK_MAIN (1 << 0)
-#define SCREEN_MASK_INPUT (1 << 1)
-
-/* graphic position and size values for buttons and scrollbars */
-#define SC_MENUBUTTON_XSIZE TILEX
-#define SC_MENUBUTTON_YSIZE TILEY
-
-#define SC_SCROLLBUTTON_XSIZE TILEX
-#define SC_SCROLLBUTTON_YSIZE TILEY
-
-#define SC_SCROLLBAR_XPOS (SXSIZE - SC_SCROLLBUTTON_XSIZE)
-
-#define SC_SCROLL_VERTICAL_XSIZE SC_SCROLLBUTTON_XSIZE
-#define SC_SCROLL_VERTICAL_YSIZE ((MAX_MENU_ENTRIES_ON_SCREEN - 2) * \
- SC_SCROLLBUTTON_YSIZE)
-
-#define SC_SCROLL_UP_XPOS SC_SCROLLBAR_XPOS
-#define SC_SCROLL_UP_YPOS (2 * SC_SCROLLBUTTON_YSIZE)
-
-#define SC_SCROLL_VERTICAL_XPOS SC_SCROLLBAR_XPOS
-#define SC_SCROLL_VERTICAL_YPOS (SC_SCROLL_UP_YPOS + \
- SC_SCROLLBUTTON_YSIZE)
-
-#define SC_SCROLL_DOWN_XPOS SC_SCROLLBAR_XPOS
-#define SC_SCROLL_DOWN_YPOS (SC_SCROLL_VERTICAL_YPOS + \
- SC_SCROLL_VERTICAL_YSIZE)
-
-#define SC_BORDER_SIZE 14
-
-
-/* forward declarations of internal functions */
+#include "api.h"
+
+
+#define DEBUG_JOYSTICKS 0
+
+
+// screens on the info screen
+#define INFO_MODE_MAIN 0
+#define INFO_MODE_TITLE 1
+#define INFO_MODE_ELEMENTS 2
+#define INFO_MODE_MUSIC 3
+#define INFO_MODE_CREDITS 4
+#define INFO_MODE_PROGRAM 5
+#define INFO_MODE_VERSION 6
+#define INFO_MODE_LEVELSET 7
+
+#define MAX_INFO_MODES 8
+
+// screens on the setup screen
+// (must match GFX_SPECIAL_ARG_SETUP_* values as defined in src/main.h)
+// (should also match corresponding entries in src/conf_gfx.c)
+#define SETUP_MODE_MAIN 0
+#define SETUP_MODE_GAME 1
+#define SETUP_MODE_ENGINES 2
+#define SETUP_MODE_EDITOR 3
+#define SETUP_MODE_GRAPHICS 4
+#define SETUP_MODE_SOUND 5
+#define SETUP_MODE_ARTWORK 6
+#define SETUP_MODE_INPUT 7
+#define SETUP_MODE_TOUCH 8
+#define SETUP_MODE_SHORTCUTS 9
+#define SETUP_MODE_SHORTCUTS_1 10
+#define SETUP_MODE_SHORTCUTS_2 11
+#define SETUP_MODE_SHORTCUTS_3 12
+#define SETUP_MODE_SHORTCUTS_4 13
+#define SETUP_MODE_SHORTCUTS_5 14
+
+// sub-screens on the setup screen (generic)
+#define SETUP_MODE_CHOOSE_ARTWORK 15
+#define SETUP_MODE_CHOOSE_OTHER 16
+
+// sub-screens on the setup screen (specific)
+#define SETUP_MODE_CHOOSE_SCORES_TYPE 17
+#define SETUP_MODE_CHOOSE_GAME_SPEED 18
+#define SETUP_MODE_CHOOSE_SCROLL_DELAY 19
+#define SETUP_MODE_CHOOSE_SNAPSHOT_MODE 20
+#define SETUP_MODE_CHOOSE_WINDOW_SIZE 21
+#define SETUP_MODE_CHOOSE_SCALING_TYPE 22
+#define SETUP_MODE_CHOOSE_RENDERING 23
+#define SETUP_MODE_CHOOSE_VSYNC 24
+#define SETUP_MODE_CHOOSE_GRAPHICS 25
+#define SETUP_MODE_CHOOSE_SOUNDS 26
+#define SETUP_MODE_CHOOSE_MUSIC 27
+#define SETUP_MODE_CHOOSE_VOLUME_SIMPLE 28
+#define SETUP_MODE_CHOOSE_VOLUME_LOOPS 29
+#define SETUP_MODE_CHOOSE_VOLUME_MUSIC 30
+#define SETUP_MODE_CHOOSE_TOUCH_CONTROL 31
+#define SETUP_MODE_CHOOSE_MOVE_DISTANCE 32
+#define SETUP_MODE_CHOOSE_DROP_DISTANCE 33
+#define SETUP_MODE_CHOOSE_TRANSPARENCY 34
+#define SETUP_MODE_CHOOSE_GRID_XSIZE_0 35
+#define SETUP_MODE_CHOOSE_GRID_YSIZE_0 36
+#define SETUP_MODE_CHOOSE_GRID_XSIZE_1 37
+#define SETUP_MODE_CHOOSE_GRID_YSIZE_1 38
+#define SETUP_MODE_CONFIG_VIRT_BUTTONS 39
+
+#define MAX_SETUP_MODES 40
+
+#define MAX_MENU_MODES MAX(MAX_INFO_MODES, MAX_SETUP_MODES)
+
+// info screen titles
+#define STR_INFO_MAIN "Info Screen"
+#define STR_INFO_TITLE "Title Screen"
+#define STR_INFO_ELEMENTS "Game Elements"
+#define STR_INFO_MUSIC "Music Info"
+#define STR_INFO_CREDITS "Credits"
+#define STR_INFO_PROGRAM "Program Info"
+#define STR_INFO_VERSION "Version Info"
+#define STR_INFO_LEVELSET "Level Set Info"
+#define STR_INFO_EXIT "Exit"
+
+// setup screen titles
+#define STR_SETUP_MAIN "Setup"
+#define STR_SETUP_GAME "Game & Menu"
+#define STR_SETUP_ENGINES "Game Engines"
+#define STR_SETUP_EDITOR "Editor"
+#define STR_SETUP_GRAPHICS "Graphics"
+#define STR_SETUP_SOUND "Sound & Music"
+#define STR_SETUP_ARTWORK "Custom Artwork"
+#define STR_SETUP_INPUT "Input Devices"
+#define STR_SETUP_TOUCH "Touch Controls"
+#define STR_SETUP_SHORTCUTS "Key Shortcuts"
+#define STR_SETUP_EXIT "Exit"
+#define STR_SETUP_SAVE_AND_EXIT "Save and Exit"
+
+#define STR_SETUP_CHOOSE_SCORES_TYPE "Scores Type"
+#define STR_SETUP_CHOOSE_GAME_SPEED "Game Speed"
+#define STR_SETUP_CHOOSE_SCROLL_DELAY "Scroll Delay"
+#define STR_SETUP_CHOOSE_SNAPSHOT_MODE "Snapshot Mode"
+#define STR_SETUP_CHOOSE_WINDOW_SIZE "Window Scaling"
+#define STR_SETUP_CHOOSE_SCALING_TYPE "Anti-Aliasing"
+#define STR_SETUP_CHOOSE_RENDERING "Rendering Mode"
+#define STR_SETUP_CHOOSE_VSYNC "VSync Mode"
+#define STR_SETUP_CHOOSE_VOLUME_SIMPLE "Sound Volume"
+#define STR_SETUP_CHOOSE_VOLUME_LOOPS "Loops Volume"
+#define STR_SETUP_CHOOSE_VOLUME_MUSIC "Music Volume"
+#define STR_SETUP_CHOOSE_TOUCH_CONTROL "Control Type"
+#define STR_SETUP_CHOOSE_MOVE_DISTANCE "Move Distance"
+#define STR_SETUP_CHOOSE_DROP_DISTANCE "Drop Distance"
+#define STR_SETUP_CHOOSE_TRANSPARENCY "Transparency"
+#define STR_SETUP_CHOOSE_GRID_XSIZE_0 "Horiz. Buttons"
+#define STR_SETUP_CHOOSE_GRID_YSIZE_0 "Vert. Buttons"
+#define STR_SETUP_CHOOSE_GRID_XSIZE_1 "Horiz. Buttons"
+#define STR_SETUP_CHOOSE_GRID_YSIZE_1 "Vert. Buttons"
+
+// other screen text constants
+#define STR_CHOOSE_TREE_EDIT "Edit"
+#define MENU_CHOOSE_TREE_FONT(x) (FONT_TEXT_1 + (x))
+#define MENU_CHOOSE_TREE_COLOR(ti, a) TREE_COLOR(ti, a)
+
+#define TEXT_MAIN_MENU "Press any key or button for main menu"
+#define TEXT_INFO_MENU "Press any key or button for info menu"
+#define TEXT_NEXT_PAGE "Press any key or button for next page"
+#define TEXT_NEXT_MENU (info_screens_from_main ? \
+ TEXT_MAIN_MENU : TEXT_INFO_MENU)
+
+// for input setup functions
+#define SETUPINPUT_SCREEN_POS_START 0
+#define SETUPINPUT_SCREEN_POS_EMPTY1 3
+#define SETUPINPUT_SCREEN_POS_EMPTY2 12
+#define SETUPINPUT_SCREEN_POS_END 13
+
+#define MENU_SETUP_FONT_TITLE FONT_TEXT_1
+#define MENU_SETUP_FONT_TEXT FONT_TITLE_2
+
+#define MAX_SETUP_TEXT_INPUT_LEN 28
+
+// for various menu stuff
+#define MENU_SCREEN_START_XPOS 1
+#define MENU_SCREEN_START_YPOS 2
+#define MENU_SCREEN_VALUE_XPOS (SCR_FIELDX - 3)
+#define MENU_SCREEN_TEXT2_XPOS (SCR_FIELDX - 2)
+#define MENU_SCREEN_MAX_XPOS (SCR_FIELDX - 1)
+#define MENU_TITLE1_YPOS 8
+#define MENU_TITLE2_YPOS 46
+#define MENU_INFO_FONT_TITLE FONT_TEXT_1
+#define MENU_INFO_FONT_HEAD FONT_TEXT_2
+#define MENU_INFO_FONT_TEXT FONT_TEXT_3
+#define MENU_INFO_FONT_FOOT FONT_TEXT_4
+#define MENU_INFO_SPACE_HEAD (menu.headline2_spacing_info[info_mode])
+#define MENU_SCREEN_INFO_SPACE_LEFT (menu.left_spacing_info[info_mode])
+#define MENU_SCREEN_INFO_SPACE_MIDDLE (menu.middle_spacing_info[info_mode])
+#define MENU_SCREEN_INFO_SPACE_RIGHT (menu.right_spacing_info[info_mode])
+#define MENU_SCREEN_INFO_SPACE_TOP (menu.top_spacing_info[info_mode])
+#define MENU_SCREEN_INFO_SPACE_BOTTOM (menu.bottom_spacing_info[info_mode])
+#define MENU_SCREEN_INFO_SPACE_LINE (menu.line_spacing_info[info_mode])
+#define MENU_SCREEN_INFO_SPACE_EXTRA (menu.extra_spacing_info[info_mode])
+#define MENU_SCREEN_INFO_TILE_SIZE_RAW (menu.tile_size_info[info_mode])
+#define MENU_SCREEN_INFO_TILE_SIZE (MENU_SCREEN_INFO_TILE_SIZE_RAW > 0 ? \
+ MENU_SCREEN_INFO_TILE_SIZE_RAW : TILEY)
+#define MENU_SCREEN_INFO_ENTRY_SIZE_RAW (menu.list_entry_size_info[info_mode])
+#define MENU_SCREEN_INFO_ENTRY_SIZE (MAX(MENU_SCREEN_INFO_ENTRY_SIZE_RAW, \
+ MENU_SCREEN_INFO_TILE_SIZE))
+#define MENU_SCREEN_INFO_YSTART MENU_SCREEN_INFO_SPACE_TOP
+#define MENU_SCREEN_INFO_YSTEP (MENU_SCREEN_INFO_ENTRY_SIZE + \
+ MENU_SCREEN_INFO_SPACE_EXTRA)
+#define MENU_SCREEN_INFO_YBOTTOM (SYSIZE - MENU_SCREEN_INFO_SPACE_BOTTOM)
+#define MENU_SCREEN_INFO_YSIZE (MENU_SCREEN_INFO_YBOTTOM - \
+ MENU_SCREEN_INFO_YSTART - TILEY / 2)
+#define MAX_INFO_ELEMENTS_IN_ARRAY 128
+#define MAX_INFO_ELEMENTS_ON_SCREEN (SYSIZE / TILEY)
+#define MAX_INFO_ELEMENTS MIN(MAX_INFO_ELEMENTS_IN_ARRAY, \
+ MAX_INFO_ELEMENTS_ON_SCREEN)
+#define STD_INFO_ELEMENTS_ON_SCREEN 10
+#define DYN_INFO_ELEMENTS_ON_SCREEN (MENU_SCREEN_INFO_YSIZE / MENU_SCREEN_INFO_YSTEP)
+#define DEFAULT_INFO_ELEMENTS MIN(STD_INFO_ELEMENTS_ON_SCREEN, \
+ DYN_INFO_ELEMENTS_ON_SCREEN)
+#define NUM_INFO_ELEMENTS_FROM_CONF \
+ (menu.list_size_info[GFX_SPECIAL_ARG_INFO_ELEMENTS] > 0 ? \
+ menu.list_size_info[GFX_SPECIAL_ARG_INFO_ELEMENTS] : \
+ DEFAULT_INFO_ELEMENTS)
+#define NUM_INFO_ELEMENTS_ON_SCREEN MIN(NUM_INFO_ELEMENTS_FROM_CONF, MAX_INFO_ELEMENTS)
+#define MAX_MENU_ENTRIES_ON_SCREEN (SCR_FIELDY - MENU_SCREEN_START_YPOS)
+#define MAX_MENU_TEXT_LENGTH_BIG 13
+#define MAX_MENU_TEXT_LENGTH_MEDIUM (MAX_MENU_TEXT_LENGTH_BIG * 2)
+
+// screen gadget identifiers
+#define SCREEN_CTRL_ID_PREV_LEVEL 0
+#define SCREEN_CTRL_ID_NEXT_LEVEL 1
+#define SCREEN_CTRL_ID_PREV_LEVEL2 2
+#define SCREEN_CTRL_ID_NEXT_LEVEL2 3
+#define SCREEN_CTRL_ID_PREV_SCORE 4
+#define SCREEN_CTRL_ID_NEXT_SCORE 5
+#define SCREEN_CTRL_ID_PLAY_TAPE 6
+#define SCREEN_CTRL_ID_FIRST_LEVEL 7
+#define SCREEN_CTRL_ID_LAST_LEVEL 8
+#define SCREEN_CTRL_ID_LEVEL_NUMBER 9
+#define SCREEN_CTRL_ID_PREV_PLAYER 10
+#define SCREEN_CTRL_ID_NEXT_PLAYER 11
+#define SCREEN_CTRL_ID_INSERT_SOLUTION 12
+#define SCREEN_CTRL_ID_PLAY_SOLUTION 13
+#define SCREEN_CTRL_ID_LEVELSET_INFO 14
+#define SCREEN_CTRL_ID_SWITCH_ECS_AGA 15
+#define SCREEN_CTRL_ID_TOUCH_PREV_PAGE 16
+#define SCREEN_CTRL_ID_TOUCH_NEXT_PAGE 17
+#define SCREEN_CTRL_ID_TOUCH_PREV_PAGE2 18
+#define SCREEN_CTRL_ID_TOUCH_NEXT_PAGE2 19
+
+#define NUM_SCREEN_MENUBUTTONS 20
+
+#define SCREEN_CTRL_ID_SCROLL_UP 20
+#define SCREEN_CTRL_ID_SCROLL_DOWN 21
+#define SCREEN_CTRL_ID_SCROLL_VERTICAL 22
+#define SCREEN_CTRL_ID_NETWORK_SERVER 23
+
+#define NUM_SCREEN_GADGETS 24
+
+#define NUM_SCREEN_SCROLLBUTTONS 2
+#define NUM_SCREEN_SCROLLBARS 1
+#define NUM_SCREEN_TEXTINPUT 1
+
+#define SCREEN_MASK_MAIN (1 << 0)
+#define SCREEN_MASK_MAIN_HAS_SOLUTION (1 << 1)
+#define SCREEN_MASK_MAIN_HAS_SET_INFO (1 << 2)
+#define SCREEN_MASK_INPUT (1 << 3)
+#define SCREEN_MASK_TOUCH (1 << 4)
+#define SCREEN_MASK_TOUCH2 (1 << 5)
+#define SCREEN_MASK_SCORES (1 << 6)
+#define SCREEN_MASK_SCORES_INFO (1 << 7)
+
+// graphic position and size values for buttons and scrollbars
+#define SC_MENUBUTTON_XSIZE TILEX
+#define SC_MENUBUTTON_YSIZE TILEY
+
+#define SC_SCROLLBUTTON_XSIZE TILEX
+#define SC_SCROLLBUTTON_YSIZE TILEY
+
+#define SC_SCROLLBAR_XPOS (SXSIZE - SC_SCROLLBUTTON_XSIZE)
+
+#define SC_SCROLL_VERTICAL_XSIZE SC_SCROLLBUTTON_XSIZE
+#define SC_SCROLL_VERTICAL_YSIZE ((MAX_MENU_ENTRIES_ON_SCREEN - 2) * \
+ SC_SCROLLBUTTON_YSIZE)
+
+#define SC_SCROLL_UP_XPOS SC_SCROLLBAR_XPOS
+#define SC_SCROLL_UP_YPOS (2 * SC_SCROLLBUTTON_YSIZE)
+
+#define SC_SCROLL_VERTICAL_XPOS SC_SCROLLBAR_XPOS
+#define SC_SCROLL_VERTICAL_YPOS (SC_SCROLL_UP_YPOS + \
+ SC_SCROLLBUTTON_YSIZE)
+
+#define SC_SCROLL_DOWN_XPOS SC_SCROLLBAR_XPOS
+#define SC_SCROLL_DOWN_YPOS (SC_SCROLL_VERTICAL_YPOS + \
+ SC_SCROLL_VERTICAL_YSIZE)
+
+#define SC_BORDER_SIZE 14
+
+
+// forward declarations of internal functions