From 14b5ed161164a42c7513700fe101c4bd2e3b63e3 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Wed, 5 Mar 2014 02:28:53 +0100 Subject: [PATCH] rnd-20140305-1-src --- src/conf_gfx.c | 27 ++++++++ src/conf_gfx.h | 151 +++++++++++++++++++++--------------------- src/conf_var.c | 40 +++++++++++ src/conftime.h | 2 +- src/editor.c | 36 +++++++++- src/game.c | 4 +- src/libgame/gadgets.c | 5 +- src/libgame/gadgets.h | 4 ++ src/libgame/system.h | 5 +- src/main.c | 1 + src/main.h | 15 +++++ src/screens.c | 53 +++++++++++---- src/tools.c | 10 +-- 13 files changed, 254 insertions(+), 99 deletions(-) diff --git a/src/conf_gfx.c b/src/conf_gfx.c index d503d1b8..66f823c2 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -5226,6 +5226,11 @@ struct ConfigInfo image_config[] = { "editor.cascade_list.active.ypos", "8" }, { "editor.cascade_list.active.frames", "1" }, + { "editor.palette_button", "RocksDoor.png" }, + { "editor.palette_button.x", "525" }, + { "editor.palette_button.y", "30" }, + { "editor.palette_button.pressed_xoffset", "-20" }, + { "background", UNDEFINED_FILENAME }, { "background.TITLE_INITIAL", UNDEFINED_FILENAME }, { "background.TITLE", UNDEFINED_FILENAME }, @@ -5254,6 +5259,16 @@ struct ConfigInfo image_config[] = { "background.PANEL.y", "0" }, { "background.PANEL.width", "100" }, { "background.PANEL.height", "280" }, + { "background.PALETTE", "RocksDoor.png" }, + { "background.PALETTE.x", "500" }, + { "background.PALETTE.y", "0" }, + { "background.PALETTE.width", "100" }, + { "background.PALETTE.height", "280" }, + { "background.TOOLBOX", "RocksDoor.png" }, + { "background.TOOLBOX.x", "700" }, + { "background.TOOLBOX.y", "236" }, + { "background.TOOLBOX.width", "100" }, + { "background.TOOLBOX.height", "144" }, { "background.titlescreen_initial_1", UNDEFINED_FILENAME }, { "background.titlescreen_initial_2", UNDEFINED_FILENAME }, @@ -6985,6 +7000,18 @@ struct ConfigInfo image_config[] = { "tape.text.time.digits", "-1" }, { "tape.text.time.font", "font.tape_recorder" }, + { "editor.palette.x", "5" }, + { "editor.palette.y", "30" }, + { "editor.palette.cols", "4" }, + { "editor.palette.rows", "11" }, + + { "editor.element_left.x", "6" }, + { "editor.element_left.y", "258" }, + { "editor.element_middle.x", "42" }, + { "editor.element_middle.y", "258" }, + { "editor.element_right.x", "78" }, + { "editor.element_right.y", "258" }, + { "request.button.yes.x", "2" }, { "request.button.yes.y", "250" }, { "request.button.no.x", "52" }, diff --git a/src/conf_gfx.h b/src/conf_gfx.h index cbe2796b..f5c59256 100644 --- a/src/conf_gfx.h +++ b/src/conf_gfx.h @@ -1813,80 +1813,83 @@ #define IMG_EDITOR_ELEMENT_BORDER_INPUT 1792 #define IMG_EDITOR_CASCADE_LIST 1793 #define IMG_EDITOR_CASCADE_LIST_ACTIVE 1794 -#define IMG_BACKGROUND 1795 -#define IMG_BACKGROUND_TITLE_INITIAL 1796 -#define IMG_BACKGROUND_TITLE 1797 -#define IMG_BACKGROUND_MAIN 1798 -#define IMG_BACKGROUND_LEVELS 1799 -#define IMG_BACKGROUND_LEVELNR 1800 -#define IMG_BACKGROUND_SCORES 1801 -#define IMG_BACKGROUND_EDITOR 1802 -#define IMG_BACKGROUND_INFO 1803 -#define IMG_BACKGROUND_INFO_ELEMENTS 1804 -#define IMG_BACKGROUND_INFO_MUSIC 1805 -#define IMG_BACKGROUND_INFO_CREDITS 1806 -#define IMG_BACKGROUND_INFO_PROGRAM 1807 -#define IMG_BACKGROUND_INFO_VERSION 1808 -#define IMG_BACKGROUND_INFO_LEVELSET 1809 -#define IMG_BACKGROUND_SETUP 1810 -#define IMG_BACKGROUND_PLAYING 1811 -#define IMG_BACKGROUND_DOOR 1812 -#define IMG_BACKGROUND_TAPE 1813 -#define IMG_BACKGROUND_PANEL 1814 -#define IMG_BACKGROUND_TITLESCREEN_INITIAL_1 1815 -#define IMG_BACKGROUND_TITLESCREEN_INITIAL_2 1816 -#define IMG_BACKGROUND_TITLESCREEN_INITIAL_3 1817 -#define IMG_BACKGROUND_TITLESCREEN_INITIAL_4 1818 -#define IMG_BACKGROUND_TITLESCREEN_INITIAL_5 1819 -#define IMG_BACKGROUND_TITLESCREEN_1 1820 -#define IMG_BACKGROUND_TITLESCREEN_2 1821 -#define IMG_BACKGROUND_TITLESCREEN_3 1822 -#define IMG_BACKGROUND_TITLESCREEN_4 1823 -#define IMG_BACKGROUND_TITLESCREEN_5 1824 -#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_1 1825 -#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_2 1826 -#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_3 1827 -#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_4 1828 -#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_5 1829 -#define IMG_BACKGROUND_TITLEMESSAGE_1 1830 -#define IMG_BACKGROUND_TITLEMESSAGE_2 1831 -#define IMG_BACKGROUND_TITLEMESSAGE_3 1832 -#define IMG_BACKGROUND_TITLEMESSAGE_4 1833 -#define IMG_BACKGROUND_TITLEMESSAGE_5 1834 -#define IMG_BACKGROUND_ENVELOPE_1 1835 -#define IMG_BACKGROUND_ENVELOPE_2 1836 -#define IMG_BACKGROUND_ENVELOPE_3 1837 -#define IMG_BACKGROUND_ENVELOPE_4 1838 -#define IMG_BACKGROUND_REQUEST 1839 -#define IMG_TITLESCREEN_INITIAL_1 1840 -#define IMG_TITLESCREEN_INITIAL_2 1841 -#define IMG_TITLESCREEN_INITIAL_3 1842 -#define IMG_TITLESCREEN_INITIAL_4 1843 -#define IMG_TITLESCREEN_INITIAL_5 1844 -#define IMG_TITLESCREEN_1 1845 -#define IMG_TITLESCREEN_2 1846 -#define IMG_TITLESCREEN_3 1847 -#define IMG_TITLESCREEN_4 1848 -#define IMG_TITLESCREEN_5 1849 -#define IMG_DOOR_1_GFX_PART_1 1850 -#define IMG_DOOR_1_GFX_PART_2 1851 -#define IMG_DOOR_1_GFX_PART_3 1852 -#define IMG_DOOR_1_GFX_PART_4 1853 -#define IMG_DOOR_1_GFX_PART_5 1854 -#define IMG_DOOR_1_GFX_PART_6 1855 -#define IMG_DOOR_1_GFX_PART_7 1856 -#define IMG_DOOR_1_GFX_PART_8 1857 -#define IMG_DOOR_2_GFX_PART_1 1858 -#define IMG_DOOR_2_GFX_PART_2 1859 -#define IMG_DOOR_2_GFX_PART_3 1860 -#define IMG_DOOR_2_GFX_PART_4 1861 -#define IMG_DOOR_2_GFX_PART_5 1862 -#define IMG_DOOR_2_GFX_PART_6 1863 -#define IMG_DOOR_2_GFX_PART_7 1864 -#define IMG_DOOR_2_GFX_PART_8 1865 -#define IMG_DOOR_2_TOP_BORDER_CORRECTION 1866 -#define IMG_LAST_IMAGE_ENTRY_BUG 1867 +#define IMG_EDITOR_PALETTE_BUTTON 1795 +#define IMG_BACKGROUND 1796 +#define IMG_BACKGROUND_TITLE_INITIAL 1797 +#define IMG_BACKGROUND_TITLE 1798 +#define IMG_BACKGROUND_MAIN 1799 +#define IMG_BACKGROUND_LEVELS 1800 +#define IMG_BACKGROUND_LEVELNR 1801 +#define IMG_BACKGROUND_SCORES 1802 +#define IMG_BACKGROUND_EDITOR 1803 +#define IMG_BACKGROUND_INFO 1804 +#define IMG_BACKGROUND_INFO_ELEMENTS 1805 +#define IMG_BACKGROUND_INFO_MUSIC 1806 +#define IMG_BACKGROUND_INFO_CREDITS 1807 +#define IMG_BACKGROUND_INFO_PROGRAM 1808 +#define IMG_BACKGROUND_INFO_VERSION 1809 +#define IMG_BACKGROUND_INFO_LEVELSET 1810 +#define IMG_BACKGROUND_SETUP 1811 +#define IMG_BACKGROUND_PLAYING 1812 +#define IMG_BACKGROUND_DOOR 1813 +#define IMG_BACKGROUND_TAPE 1814 +#define IMG_BACKGROUND_PANEL 1815 +#define IMG_BACKGROUND_PALETTE 1816 +#define IMG_BACKGROUND_TOOLBOX 1817 +#define IMG_BACKGROUND_TITLESCREEN_INITIAL_1 1818 +#define IMG_BACKGROUND_TITLESCREEN_INITIAL_2 1819 +#define IMG_BACKGROUND_TITLESCREEN_INITIAL_3 1820 +#define IMG_BACKGROUND_TITLESCREEN_INITIAL_4 1821 +#define IMG_BACKGROUND_TITLESCREEN_INITIAL_5 1822 +#define IMG_BACKGROUND_TITLESCREEN_1 1823 +#define IMG_BACKGROUND_TITLESCREEN_2 1824 +#define IMG_BACKGROUND_TITLESCREEN_3 1825 +#define IMG_BACKGROUND_TITLESCREEN_4 1826 +#define IMG_BACKGROUND_TITLESCREEN_5 1827 +#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_1 1828 +#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_2 1829 +#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_3 1830 +#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_4 1831 +#define IMG_BACKGROUND_TITLEMESSAGE_INITIAL_5 1832 +#define IMG_BACKGROUND_TITLEMESSAGE_1 1833 +#define IMG_BACKGROUND_TITLEMESSAGE_2 1834 +#define IMG_BACKGROUND_TITLEMESSAGE_3 1835 +#define IMG_BACKGROUND_TITLEMESSAGE_4 1836 +#define IMG_BACKGROUND_TITLEMESSAGE_5 1837 +#define IMG_BACKGROUND_ENVELOPE_1 1838 +#define IMG_BACKGROUND_ENVELOPE_2 1839 +#define IMG_BACKGROUND_ENVELOPE_3 1840 +#define IMG_BACKGROUND_ENVELOPE_4 1841 +#define IMG_BACKGROUND_REQUEST 1842 +#define IMG_TITLESCREEN_INITIAL_1 1843 +#define IMG_TITLESCREEN_INITIAL_2 1844 +#define IMG_TITLESCREEN_INITIAL_3 1845 +#define IMG_TITLESCREEN_INITIAL_4 1846 +#define IMG_TITLESCREEN_INITIAL_5 1847 +#define IMG_TITLESCREEN_1 1848 +#define IMG_TITLESCREEN_2 1849 +#define IMG_TITLESCREEN_3 1850 +#define IMG_TITLESCREEN_4 1851 +#define IMG_TITLESCREEN_5 1852 +#define IMG_DOOR_1_GFX_PART_1 1853 +#define IMG_DOOR_1_GFX_PART_2 1854 +#define IMG_DOOR_1_GFX_PART_3 1855 +#define IMG_DOOR_1_GFX_PART_4 1856 +#define IMG_DOOR_1_GFX_PART_5 1857 +#define IMG_DOOR_1_GFX_PART_6 1858 +#define IMG_DOOR_1_GFX_PART_7 1859 +#define IMG_DOOR_1_GFX_PART_8 1860 +#define IMG_DOOR_2_GFX_PART_1 1861 +#define IMG_DOOR_2_GFX_PART_2 1862 +#define IMG_DOOR_2_GFX_PART_3 1863 +#define IMG_DOOR_2_GFX_PART_4 1864 +#define IMG_DOOR_2_GFX_PART_5 1865 +#define IMG_DOOR_2_GFX_PART_6 1866 +#define IMG_DOOR_2_GFX_PART_7 1867 +#define IMG_DOOR_2_GFX_PART_8 1868 +#define IMG_DOOR_2_TOP_BORDER_CORRECTION 1869 +#define IMG_LAST_IMAGE_ENTRY_BUG 1870 -#define NUM_IMAGE_FILES 1868 +#define NUM_IMAGE_FILES 1871 #endif /* CONF_GFX_H */ diff --git a/src/conf_var.c b/src/conf_var.c index af5915b5..239c6030 100644 --- a/src/conf_var.c +++ b/src/conf_var.c @@ -6068,6 +6068,46 @@ struct TokenIntPtrInfo image_config_vars[] = "tape.text.time.font", &tape.text.time.font }, + { + "editor.palette.x", + &editor.palette.x + }, + { + "editor.palette.y", + &editor.palette.y + }, + { + "editor.palette.cols", + &editor.palette.cols + }, + { + "editor.palette.rows", + &editor.palette.rows + }, + { + "editor.element_left.x", + &editor.element_left.x + }, + { + "editor.element_left.y", + &editor.element_left.y + }, + { + "editor.element_middle.x", + &editor.element_middle.x + }, + { + "editor.element_middle.y", + &editor.element_middle.y + }, + { + "editor.element_right.x", + &editor.element_right.x + }, + { + "editor.element_right.y", + &editor.element_right.y + }, { "request.button.yes.x", &request.button.yes.x diff --git a/src/conftime.h b/src/conftime.h index 76d3e1a6..aa86d326 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2014-03-04 14:51" +#define COMPILE_DATE_STRING "2014-03-05 02:22" diff --git a/src/editor.c b/src/editor.c index 15b71a09..1b8f0c4b 100644 --- a/src/editor.c +++ b/src/editor.c @@ -34,12 +34,21 @@ */ /* positions in the level editor */ +#if 1 +#define ED_WIN_MB_LEFT_XPOS (editor.element_left.x) +#define ED_WIN_MB_LEFT_YPOS (editor.element_left.y) +#define ED_WIN_MB_MIDDLE_XPOS (editor.element_middle.x) +#define ED_WIN_MB_MIDDLE_YPOS (editor.element_middle.y) +#define ED_WIN_MB_RIGHT_XPOS (editor.element_right.x) +#define ED_WIN_MB_RIGHT_YPOS (editor.element_right.y) +#else #define ED_WIN_MB_LEFT_XPOS 6 #define ED_WIN_MB_LEFT_YPOS 258 #define ED_WIN_MB_MIDDLE_XPOS 42 #define ED_WIN_MB_MIDDLE_YPOS ED_WIN_MB_LEFT_YPOS #define ED_WIN_MB_RIGHT_XPOS 78 #define ED_WIN_MB_RIGHT_YPOS ED_WIN_MB_LEFT_YPOS +#endif /* values for the control window */ #define ED_CTRL_NO_BUTTONS_GFX_XPOS 6 @@ -90,12 +99,21 @@ ED_NUM_CTRL4_BUTTONS) /* values for the element list */ +#if 1 +#define ED_ELEMENTLIST_XPOS (editor.palette.x) +#define ED_ELEMENTLIST_YPOS (editor.palette.y) +#else #define ED_ELEMENTLIST_XPOS 5 #define ED_ELEMENTLIST_YPOS 30 +#endif #define ED_ELEMENTLIST_XSIZE 20 #define ED_ELEMENTLIST_YSIZE 20 #define ED_ELEMENTLIST_BUTTONS_HORIZ 4 +#if 1 +#define ED_ELEMENTLIST_BUTTONS_VERT 9 +#else #define ED_ELEMENTLIST_BUTTONS_VERT 11 +#endif #define ED_NUM_ELEMENTLIST_BUTTONS (ED_ELEMENTLIST_BUTTONS_HORIZ * \ ED_ELEMENTLIST_BUTTONS_VERT) @@ -5437,6 +5455,7 @@ static void CreateControlButtons() /* create buttons for element list */ for (i = 0; i < ED_NUM_ELEMENTLIST_BUTTONS; i++) { + struct GraphicInfo *gd = &graphic_info[IMG_EDITOR_PALETTE_BUTTON]; Bitmap *deco_bitmap; int deco_x, deco_y, deco_xpos, deco_ypos; int gd_xoffset, gd_yoffset; @@ -5451,9 +5470,15 @@ static void CreateControlButtons() gd_xoffset = ED_ELEMENTLIST_XPOS + x * ED_ELEMENTLIST_XSIZE; gd_yoffset = ED_ELEMENTLIST_YPOS + y * ED_ELEMENTLIST_YSIZE; +#if 1 + gd_x1 = gd->src_x; + gd_x2 = gd->src_x + gd->pressed_xoffset; + gd_y = gd->src_y; +#else gd_x1 = DOOR_GFX_PAGEX6 + ED_ELEMENTLIST_XPOS + ED_ELEMENTLIST_XSIZE; gd_x2 = DOOR_GFX_PAGEX6 + ED_ELEMENTLIST_XPOS; gd_y = DOOR_GFX_PAGEY1 + ED_ELEMENTLIST_YPOS; +#endif getMiniGraphicSource(el2edimg(element), &deco_bitmap, &deco_x, &deco_y); deco_xpos = (ED_ELEMENTLIST_XSIZE - MINI_TILEX) / 2; @@ -5468,8 +5493,8 @@ static void CreateControlButtons() GDI_HEIGHT, ED_ELEMENTLIST_YSIZE, GDI_TYPE, GD_TYPE_NORMAL_BUTTON, GDI_STATE, GD_BUTTON_UNPRESSED, - GDI_DESIGN_UNPRESSED, gd_bitmap, gd_x1, gd_y, - GDI_DESIGN_PRESSED, gd_bitmap, gd_x2, gd_y, + GDI_DESIGN_UNPRESSED, gd->bitmap, gd_x1, gd_y, + GDI_DESIGN_PRESSED, gd->bitmap, gd_x2, gd_y, GDI_DECORATION_DESIGN, deco_bitmap, deco_x, deco_y, GDI_DECORATION_POSITION, deco_xpos, deco_ypos, GDI_DECORATION_SIZE, MINI_TILEX, MINI_TILEY, @@ -7455,8 +7480,15 @@ void DrawLevelEd() } /* copy default editor door content to main double buffer */ +#if 1 + BlitBitmap(graphic_info[IMG_BACKGROUND_PALETTE].bitmap, drawto, + graphic_info[IMG_BACKGROUND_PALETTE].src_x, + graphic_info[IMG_BACKGROUND_PALETTE].src_y, + DXSIZE, DYSIZE, DX, DY); +#else BlitBitmap(graphic_info[IMG_GLOBAL_DOOR].bitmap, drawto, DOOR_GFX_PAGEX6, DOOR_GFX_PAGEY1, DXSIZE, DYSIZE, DX, DY); +#endif #if 0 printf("::: %d, %d / %d, %d\n", VX, VY, EX, EY); diff --git a/src/game.c b/src/game.c index 7d57f3f7..cc32a2f4 100644 --- a/src/game.c +++ b/src/game.c @@ -16848,8 +16848,8 @@ void CreateGameButtons() gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_INFO_TEXT, gamebutton_info[i].infotext, - GDI_X, DX + pos->x, - GDI_Y, DY + pos->y, + GDI_X, DX + GDI_ACTIVE_POS(pos->x), + GDI_Y, DY + GDI_ACTIVE_POS(pos->y), GDI_WIDTH, gfx->width, GDI_HEIGHT, gfx->height, GDI_TYPE, button_type, diff --git a/src/libgame/gadgets.c b/src/libgame/gadgets.c index 26454d47..3781aeb4 100644 --- a/src/libgame/gadgets.c +++ b/src/libgame/gadgets.c @@ -26,6 +26,9 @@ #define DG_BUFFERED 0 #define DG_DIRECT 1 +#define GADGET_DEACTIVATED(g) ((g)->x < 0 || (g)->y < 0) + + static struct GadgetInfo *gadget_list_first_entry = NULL; static struct GadgetInfo *gadget_list_last_entry = NULL; static struct GadgetInfo *last_info_gi = NULL; @@ -1304,7 +1307,7 @@ static struct GadgetInfo *last_gi = NULL; static void MapGadgetExt(struct GadgetInfo *gi, boolean redraw) { - if (gi == NULL || gi->mapped) + if (gi == NULL || gi->mapped || GADGET_DEACTIVATED(gi)) return; gi->mapped = TRUE; diff --git a/src/libgame/gadgets.h b/src/libgame/gadgets.h index 7b8ce7f5..a11709ab 100644 --- a/src/libgame/gadgets.h +++ b/src/libgame/gadgets.h @@ -110,6 +110,10 @@ #define GDI_ACTIVE 45 #define GDI_DIRECT_DRAW 46 +/* gadget deactivation hack */ +#define GDI_ACTIVE_POS(a) ((a) < 0 ? POS_OFFSCREEN : (a)) + + typedef void (*gadget_function)(void *); struct GadgetBorder diff --git a/src/libgame/system.h b/src/libgame/system.h index b74b6fae..1475ab69 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -378,7 +378,10 @@ /* default values for undefined configuration file parameters */ #define ARG_UNDEFINED "-1000000" -#define ARG_UNDEFINED_VALUE (atoi(ARG_UNDEFINED)) +#define ARG_UNDEFINED_VALUE (-1000000) + +/* default value for off-screen positions */ +#define POS_OFFSCREEN (-1000000) /* definitions for game sub-directories */ #ifndef RO_GAME_DIR diff --git a/src/main.c b/src/main.c index dcd5075e..c1762fe8 100644 --- a/src/main.c +++ b/src/main.c @@ -165,6 +165,7 @@ struct MenuInfo menu; struct DoorInfo door_1, door_2; struct RequestInfo request; struct PreviewInfo preview; +struct EditorInfo editor; struct GraphicInfo *graphic_info = NULL; struct SoundInfo *sound_info = NULL; diff --git a/src/main.h b/src/main.h index 385cc498..5db3c88f 100644 --- a/src/main.h +++ b/src/main.h @@ -2345,6 +2345,20 @@ struct PreviewInfo int anim_mode; }; +struct EditorPaletteInfo +{ + int x, y; + int cols, rows; +}; + +struct EditorInfo +{ + struct EditorPaletteInfo palette; + struct XY element_left; + struct XY element_middle; + struct XY element_right; +}; + struct ViewportInfo { struct RectWithBorder window; @@ -3017,6 +3031,7 @@ extern struct MenuInfo menu; extern struct DoorInfo door_1, door_2; extern struct RequestInfo request; extern struct PreviewInfo preview; +extern struct EditorInfo editor; extern struct ElementInfo element_info[]; extern struct ElementNameInfo element_name_info[]; extern struct ElementActionInfo element_action_info[]; diff --git a/src/screens.c b/src/screens.c index 43ad44de..5bcaa1d5 100644 --- a/src/screens.c +++ b/src/screens.c @@ -86,7 +86,22 @@ #define MENU_SCREEN_MAX_XPOS (SCR_FIELDX - 1) #define MENU_TITLE1_YPOS 8 #define MENU_TITLE2_YPOS 46 -#define MAX_INFO_ELEMENTS_ON_SCREEN 10 +#define MENU_SCREEN_INFO_XSTART 16 +#define MENU_SCREEN_INFO_YSTART1 100 +#define MENU_SCREEN_INFO_YSTART2 128 +#define MENU_SCREEN_INFO_YSTEP (TILEY + 4) +#define MENU_SCREEN_INFO_YBOTTOM (SYSIZE - 20) +#define MENU_SCREEN_INFO_YSIZE (MENU_SCREEN_INFO_YBOTTOM - \ + MENU_SCREEN_INFO_YSTART2 - \ + TILEY / 2) +#define MAX_INFO_ELEMENTS_ON_SCREEN 128 +#if 1 +#define NUM_INFO_ELEMENTS_ON_SCREEN MIN(MENU_SCREEN_INFO_YSIZE / \ + MENU_SCREEN_INFO_YSTEP, \ + MAX_INFO_ELEMENTS_ON_SCREEN) +#else +#define NUM_INFO_ELEMENTS_ON_SCREEN 10 +#endif #define MAX_MENU_ENTRIES_ON_SCREEN (SCR_FIELDY - MENU_SCREEN_START_YPOS) #define MAX_MENU_TEXT_LENGTH_BIG (MENU_SCREEN_VALUE_XPOS - \ MENU_SCREEN_START_XPOS) @@ -2242,11 +2257,11 @@ void DrawInfoScreen_HelpAnim(int start, int max_anims, boolean init) { static int infoscreen_step[MAX_INFO_ELEMENTS_ON_SCREEN]; static int infoscreen_frame[MAX_INFO_ELEMENTS_ON_SCREEN]; - int xstart = mSX + 16; - int ystart1 = mSY - SY + 100; - int ystart2 = mSY + 64 + 2 * 32; - int ybottom = mSY - SY + SYSIZE - 20; - int ystep = TILEY + 4; + int xstart = mSX + MENU_SCREEN_INFO_XSTART; + int ystart1 = mSY - SY + MENU_SCREEN_INFO_YSTART1; + int ystart2 = mSY + MENU_SCREEN_INFO_YSTART2; + int ybottom = mSY - SY + MENU_SCREEN_INFO_YBOTTOM; + int ystep = MENU_SCREEN_INFO_YSTEP; int element, action, direction; int graphic; int delay; @@ -2255,7 +2270,7 @@ void DrawInfoScreen_HelpAnim(int start, int max_anims, boolean init) if (init) { - for (i = 0; i < MAX_INFO_ELEMENTS_ON_SCREEN; i++) + for (i = 0; i < NUM_INFO_ELEMENTS_ON_SCREEN; i++) infoscreen_step[i] = infoscreen_frame[i] = 0; ClearField(); @@ -2272,7 +2287,7 @@ void DrawInfoScreen_HelpAnim(int start, int max_anims, boolean init) i = j = 0; while (helpanim_info[j].element != HELPANIM_LIST_END) { - if (i >= start + MAX_INFO_ELEMENTS_ON_SCREEN || + if (i >= start + NUM_INFO_ELEMENTS_ON_SCREEN || i >= max_anims) break; else if (i < start) @@ -2433,7 +2448,7 @@ void HandleInfoScreen_Elements(int button) static int num_anims; static int num_pages; static int page; - int anims_per_page = MAX_INFO_ELEMENTS_ON_SCREEN; + int anims_per_page = NUM_INFO_ELEMENTS_ON_SCREEN; int i; if (button == MB_MENU_INITIALIZE) @@ -4003,7 +4018,7 @@ void DrawHallOfFame(int highlight_position) static void drawHallOfFameList(int first_entry, int highlight_position) { - int i; + int i, j; SetMainBackgroundImage(IMG_BACKGROUND_SCORES); ClearField(); @@ -4022,12 +4037,22 @@ static void drawHallOfFameList(int first_entry, int highlight_position) int font_nr4 = (active ? FONT_TEXT_4_ACTIVE : FONT_TEXT_4); int dx1 = 3 * getFontWidth(font_nr1); int dx2 = dx1 + getFontWidth(font_nr1); +#if 1 + int dx3 = SXSIZE - 5 * getFontWidth(font_nr4); + int num_dots = (dx3 - dx2) / getFontWidth(font_nr3); +#else int dx3 = dx2 + 25 * getFontWidth(font_nr3); +#endif int sy = mSY + 64 + i * 32; DrawText(mSX, sy, int2str(entry + 1, 3), font_nr1); DrawText(mSX + dx1, sy, ".", font_nr1); +#if 1 + for (j = 0; j < num_dots; j++) + DrawText(mSX + dx2 + j * getFontWidth(font_nr3), sy, ".", font_nr3); +#else DrawText(mSX + dx2, sy, ".........................", font_nr3); +#endif if (!strEqual(highscore[entry].Name, EMPTY_PLAYER_NAME)) DrawText(mSX + dx2, sy, highscore[entry].Name, font_nr2); @@ -6348,13 +6373,13 @@ static void getScreenMenuButtonPos(int *x, int *y, int gadget_id) { #if 1 case SCREEN_CTRL_ID_PREV_LEVEL: - *x = mSX + menu.main.button.prev_level.x; - *y = mSY + menu.main.button.prev_level.y; + *x = mSX + GDI_ACTIVE_POS(menu.main.button.prev_level.x); + *y = mSY + GDI_ACTIVE_POS(menu.main.button.prev_level.y); break; case SCREEN_CTRL_ID_NEXT_LEVEL: - *x = mSX + menu.main.button.next_level.x; - *y = mSY + menu.main.button.next_level.y; + *x = mSX + GDI_ACTIVE_POS(menu.main.button.next_level.x); + *y = mSY + GDI_ACTIVE_POS(menu.main.button.next_level.y); break; #else case SCREEN_CTRL_ID_PREV_LEVEL: diff --git a/src/tools.c b/src/tools.c index 2dd6d5bb..c0009b40 100644 --- a/src/tools.c +++ b/src/tools.c @@ -6748,8 +6748,8 @@ void CreateToolButtons() gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_INFO_TEXT, toolbutton_info[i].infotext, - GDI_X, dx + pos->x, - GDI_Y, dy + pos->y, + GDI_X, dx + GDI_ACTIVE_POS(pos->x), + GDI_Y, dy + GDI_ACTIVE_POS(pos->y), GDI_WIDTH, gfx->width, GDI_HEIGHT, gfx->height, GDI_TYPE, GD_TYPE_NORMAL_BUTTON, @@ -6908,8 +6908,8 @@ void CreateToolButtons() gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_INFO_TEXT, toolbutton_info[i].infotext, - GDI_X, DX + toolbutton_info[i].x, - GDI_Y, DY + toolbutton_info[i].y, + GDI_X, DX + GDI_ACTIVE_POS(toolbutton_info[i].x), + GDI_Y, DY + GDI_ACTIVE_POS(toolbutton_info[i].y), GDI_WIDTH, toolbutton_info[i].width, GDI_HEIGHT, toolbutton_info[i].height, GDI_TYPE, GD_TYPE_NORMAL_BUTTON, @@ -11382,7 +11382,9 @@ void ChangeViewportPropertiesIfNeeded() InitGfxBuffers(); #endif +#if 0 if (gfx_game_mode == GAME_MODE_MAIN) +#endif { #if 1 init_gadgets_and_toons = TRUE; -- 2.34.1