From: Holger Schemel Date: Thu, 3 Jun 1999 23:33:42 +0000 (+0200) Subject: rnd-19990604-1-src X-Git-Tag: 1.4.0^2~28 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=48542a06103232c408ce6250f5bc2d9add00f233;p=rocksndiamonds.git rnd-19990604-1-src --- diff --git a/src/events.c b/src/events.c index 60a6ceb3..a34c1ab9 100644 --- a/src/events.c +++ b/src/events.c @@ -68,7 +68,8 @@ void EventLoop(void) if (game_status != PLAYING) { XSync(display, FALSE); - Delay(10); + if (!XPending(display)) /* delay only if no pending events */ + Delay(10); } /* refresh window contents from drawing buffer, if needed */ @@ -529,6 +530,16 @@ void HandleKey(KeySym key, int key_status) HandleSetupInputScreen(0,0, 0,0, MB_MENU_CHOICE); break; + case XK_Page_Up: + if (game_status == CHOOSELEVEL) + HandleChooseLevel(0,0, 0,-SCR_FIELDY, MB_MENU_MARK); + break; + + case XK_Page_Down: + if (game_status == CHOOSELEVEL) + HandleChooseLevel(0,0, 0,SCR_FIELDY, MB_MENU_MARK); + break; + default: break; } diff --git a/src/files.c b/src/files.c index 00099201..7e1ad30b 100644 --- a/src/files.c +++ b/src/files.c @@ -975,6 +975,7 @@ static struct /* level directory info */ { TYPE_STRING, &ldi.name, "name" }, + { TYPE_STRING, &ldi.name_short, "name_short" }, { TYPE_STRING, &ldi.author, "author" }, { TYPE_INTEGER, &ldi.levels, "levels" }, { TYPE_INTEGER, &ldi.first_level, "first_level" }, @@ -1240,6 +1241,7 @@ static void checkSetupFileListIdentifier(struct SetupFileList *setup_file_list, static void setLevelDirInfoToDefaults(struct LevelDirInfo *ldi) { ldi->name = getStringCopy(ANONYMOUS_NAME); + ldi->name_short = NULL; ldi->author = getStringCopy(ANONYMOUS_NAME); ldi->levels = 0; ldi->first_level = 0; @@ -1462,6 +1464,10 @@ static int LoadLevelInfoFromLevelDir(char *level_directory, int start_entry) setSetupInfo(i, getTokenValue(setup_file_list, token_info[i].text)); leveldir[current_entry] = ldi; + if (leveldir[current_entry].name_short == NULL) + leveldir[current_entry].name_short = + getStringCopy(leveldir[current_entry].name); + leveldir[current_entry].filename = getStringCopy(dir_entry->d_name); leveldir[current_entry].last_level = leveldir[current_entry].first_level + @@ -1532,6 +1538,7 @@ static void SaveUserLevelInfo() setLevelDirInfoToDefaults(&ldi); ldi.name = getLoginName(); + ldi.name_short = getLoginName(); ldi.author = getRealName(); ldi.levels = 100; ldi.first_level = 1; diff --git a/src/init.c b/src/init.c index dcd82244..78bfb711 100644 --- a/src/init.c +++ b/src/init.c @@ -1497,7 +1497,9 @@ void InitElementProperties() EL_SP_HARD_BASE5, EL_SP_HARD_BASE6, EL_SP_CHIP_UPPER, - EL_SP_CHIP_LOWER + EL_SP_CHIP_LOWER, + /* additional elements that appeared in newer Supaplex levels */ + EL_UNSICHTBAR }; static int ep_sp_element_num = sizeof(ep_sp_element)/sizeof(int); diff --git a/src/main.h b/src/main.h index fad880a4..d0aed23d 100644 --- a/src/main.h +++ b/src/main.h @@ -368,6 +368,7 @@ struct LevelDirInfo { char *filename; char *name; + char *name_short; /* optional short name for level selection screen */ char *author; int levels; int first_level; @@ -1338,7 +1339,7 @@ extern char *element_info[]; #define TAPES_DIRECTORY "tapes" #define SCORES_DIRECTORY "scores" -#define PROGRAM_VERSION_STRING "1.3.0" +#define PROGRAM_VERSION_STRING "1.3.5" #define PROGRAM_TITLE_STRING "Rocks'n'Diamonds" #define PROGRAM_AUTHOR_STRING "Holger Schemel" #define WINDOW_TITLE_STRING PROGRAM_TITLE_STRING " " PROGRAM_VERSION_STRING diff --git a/src/screens.c b/src/screens.c index ed99fd40..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); @@ -820,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) @@ -896,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) @@ -904,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); @@ -922,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);