X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=c1ad55de96dd55fb92d90688b256210209f314bd;hb=48542a06103232c408ce6250f5bc2d9add00f233;hp=3bf0c3005ca5fafb315e44c6fff9449a67c52fe9;hpb=78943068787ee6d63e1045df9d286d98b5a2912c;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index 3bf0c300..c1ad55de 100644 --- a/src/screens.c +++ b/src/screens.c @@ -28,18 +28,18 @@ /* for DrawSetupScreen(), HandleSetupScreen() */ #define SETUP_SCREEN_POS_START 2 -#define SETUP_SCREEN_POS_END 16 +#define SETUP_SCREEN_POS_END (SCR_FIELDY - 1) #define SETUP_SCREEN_POS_EMPTY1 (SETUP_SCREEN_POS_END - 2) #define SETUP_SCREEN_POS_EMPTY2 (SETUP_SCREEN_POS_END - 2) /* for HandleSetupInputScreen() */ #define SETUPINPUT_SCREEN_POS_START 2 -#define SETUPINPUT_SCREEN_POS_END 15 +#define SETUPINPUT_SCREEN_POS_END (SCR_FIELDY - 2) #define SETUPINPUT_SCREEN_POS_EMPTY1 (SETUPINPUT_SCREEN_POS_START + 3) #define SETUPINPUT_SCREEN_POS_EMPTY2 (SETUPINPUT_SCREEN_POS_END - 1) /* for HandleChooseLevel() */ -#define MAX_LEVEL_SERIES_ON_SCREEN 15 +#define MAX_LEVEL_SERIES_ON_SCREEN (SCR_FIELDY - 2) #ifdef MSDOS extern unsigned char get_ascii(KeySym); @@ -70,6 +70,9 @@ void DrawMainMenu() return; } + /* needed if last screen was the editor screen */ + UndrawSpecialEditorDoor(); + /* map gadgets for main menu screen */ MapTapeButtons(); @@ -130,7 +133,10 @@ void DrawMainMenu() OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2); +#if 0 ClearEventQueue(); +#endif + } void HandleMainMenu(int mx, int my, int dx, int dy, int button) @@ -757,7 +763,7 @@ void HandleTypeName(int newxpos, KeySym key) } if (((key >= XK_A && key <= XK_Z) || (key >= XK_a && key <= XK_z)) && - xpos < MAX_NAMELEN - 1) + xpos < MAX_PLAYER_NAME_LEN) { char ascii; @@ -814,7 +820,7 @@ static void drawChooseLevelList(int first_entry, int num_page_entries) for(i=0; i num_page_entries + 2) + if (first_entry == -1) { - choice = num_page_entries + 2; - first_entry = num_leveldirs - num_page_entries; + first_entry = leveldir_nr - num_page_entries + 1; + choice = leveldir_nr - first_entry + 3; } drawChooseLevelList(first_entry, num_page_entries); drawChooseLevelInfo(leveldir_nr); + redraw = TRUE; } if (redraw) @@ -890,7 +894,15 @@ void HandleChooseLevel(int mx, int my, int dx, int dy, int button) y = choice + dy; } else - x = y = 0; + x = y = 0; /* no action */ + + if (ABS(dy) == SCR_FIELDY) /* handle XK_Page_Up, XK_Page_Down */ + { + dy = SIGN(dy); + step = num_page_entries - 1; + x = 1; + y = (dy < 0 ? 2 : num_page_entries + 3); + } } if (x == 1 && y == 2) @@ -898,13 +910,10 @@ void HandleChooseLevel(int mx, int my, int dx, int dy, int button) if (first_entry > 0 && (dy || DelayReached(&choose_delay, GADGET_FRAME_DELAY))) { -#if 0 - first_entry--; -#else first_entry -= step; if (first_entry < 0) first_entry = 0; -#endif + drawChooseLevelList(first_entry, num_page_entries); drawChooseLevelInfo(first_entry); DrawGraphic(0, choice - 1, GFX_KUGEL_ROT); @@ -916,13 +925,10 @@ void HandleChooseLevel(int mx, int my, int dx, int dy, int button) if (first_entry + num_page_entries < num_leveldirs && (dy || DelayReached(&choose_delay, GADGET_FRAME_DELAY))) { -#if 0 - first_entry++; -#else first_entry += step; if (first_entry + num_page_entries > num_leveldirs) first_entry = num_leveldirs - num_page_entries; -#endif + drawChooseLevelList(first_entry, num_page_entries); drawChooseLevelInfo(first_entry + num_page_entries - 1); DrawGraphic(0, choice - 1, GFX_KUGEL_ROT);