From: Holger Schemel Date: Sat, 29 Nov 2003 13:53:21 +0000 (+0100) Subject: rnd-20031129-2-src X-Git-Tag: 3.0.8^2~13 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=c6a3052208767e8feadd0d712b1354f29547db07;p=rocksndiamonds.git rnd-20031129-2-src --- diff --git a/src/conf_dem.c b/src/conf_dem.c index 0204e1cd..20f76dc4 100644 --- a/src/conf_dem.c +++ b/src/conf_dem.c @@ -19,7 +19,7 @@ reliable default values. If that value is GFX_ARG_UNDEFINED, it will be dynamically determined, using some of the other list values. */ -struct ConfigInfo demo_anim_info_config[] = +struct ConfigInfo helpanim_config[] = { { "player_1.moving.down", "16" }, { "player_1.moving.up", "16" }, @@ -359,7 +359,7 @@ struct ConfigInfo demo_anim_info_config[] = { NULL, NULL } }; -struct ConfigInfo demo_anim_text_config[] = +struct ConfigInfo helptext_config[] = { { "player_1.moving.down", diff --git a/src/conftime.h b/src/conftime.h index 8fb097a7..b7125160 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-11-29 01:44]" +#define COMPILE_DATE_STRING "[2003-11-29 14:53]" diff --git a/src/editor.c b/src/editor.c index 0eea3c6d..061d1304 100644 --- a/src/editor.c +++ b/src/editor.c @@ -5530,7 +5530,6 @@ char *getElementDescriptionFilename(int element) return NULL; } -#if 1 static boolean PrintInfoText(char *text, int font_nr, int start_line) { int font_height = getFontHeight(font_nr); @@ -5548,8 +5547,6 @@ static boolean PrintInfoText(char *text, int font_nr, int start_line) return TRUE; } -#if 1 - static int PrintElementDescriptionFromFile(char *filename, int start_line) { int font_nr = FONT_TEXT_2; @@ -5637,320 +5634,6 @@ static int PrintElementDescriptionFromFile(char *filename, int start_line) return (current_line - start_line); } -#else - -static int PrintElementDescriptionFromFile(char *filename, int start_line) -{ - int font_nr = FONT_TEXT_2; - int font_width = getFontWidth(font_nr); - int font_height = getFontHeight(font_nr); - int pad_x = ED_SETTINGS_XPOS(0); - int pad_y = ED_SETTINGS_YPOS(0) + ED_BORDER_SIZE; - int sx = SX + pad_x; - int sy = SY + pad_y; - int max_chars_per_line = (SXSIZE - 2 * pad_x) / font_width; - int max_lines_per_screen = (SYSIZE - pad_y) / font_height - 1; - int current_line = start_line; - char line[MAX_LINE_LEN]; - char buffer[max_chars_per_line + 1]; - int buffer_len; - FILE *file; - - if (filename == NULL) - return 0; - - if (!(file = fopen(filename, MODE_READ))) - return 0; - - buffer[0] = '\0'; - buffer_len = 0; - - while(!feof(file)) - { - char *line_ptr, *word_ptr; - boolean last_line_was_empty = TRUE; - - /* read next line of input file */ - if (!fgets(line, MAX_LINE_LEN, file)) - break; - - /* skip comments (lines directly beginning with '#') */ - if (line[0] == '#') - continue; - - /* cut trailing newline from input line */ - for (line_ptr = line; *line_ptr; line_ptr++) - { - if (*line_ptr == '\n' || *line_ptr == '\r') - { - *line_ptr = '\0'; - break; - } - } - - if (strlen(line) == 0) /* special case: force empty line */ - strcpy(line, "\n"); - - word_ptr = line; - - while (*word_ptr) - { - boolean print_buffer = FALSE; - int word_len; - - /* skip leading whitespaces */ - while (*word_ptr == ' ' || *word_ptr == '\t') - word_ptr++; - - line_ptr = word_ptr; - word_len = 0; - - /* look for end of next word */ - while (*line_ptr != ' ' && *line_ptr != '\t' && *line_ptr != '\0') - { - line_ptr++; - word_len++; - } - - if (word_len == 0) - { - continue; - } - else if (*word_ptr == '\n') /* special case: force empty line */ - { - if (buffer_len == 0) - word_ptr++; - - /* prevent printing of multiple empty lines */ - if (buffer_len > 0 || !last_line_was_empty) - print_buffer = TRUE; - } - else if (word_len < max_chars_per_line - buffer_len) - { - /* word fits into text buffer -- add word */ - - if (buffer_len > 0) - buffer[buffer_len++] = ' '; - - strncpy(&buffer[buffer_len], word_ptr, word_len); - buffer_len += word_len; - buffer[buffer_len] = '\0'; - word_ptr += word_len; - } - else if (buffer_len > 0) - { - /* not enough space left for word in text buffer -- print buffer */ - - print_buffer = TRUE; - } - else - { - /* word does not fit at all into empty text buffer -- cut word */ - - strncpy(buffer, word_ptr, max_chars_per_line); - buffer[max_chars_per_line] = '\0'; - word_ptr += max_chars_per_line; - print_buffer = TRUE; - } - - if (print_buffer) - { - if (current_line >= max_lines_per_screen) - { - fclose(file); - - return (current_line - start_line); - } - - DrawText(sx, sy + current_line * font_height, buffer, font_nr); - current_line++; - - last_line_was_empty = (buffer_len == 0); - - buffer[0] = '\0'; - buffer_len = 0; - print_buffer = FALSE; - } - } - } - - fclose(file); - - if (buffer_len > 0 && current_line < max_lines_per_screen) - { - DrawText(sx, sy + current_line * font_height, buffer, font_nr); - current_line++; - } - - return (current_line - start_line); -} -#endif - -#else - -static boolean PrintInfoText(char *text, int font_nr, int screen_line) -{ - int font_height = getFontHeight(font_nr); - int pad_x = ED_SETTINGS_XPOS(0); - int pad_y = ED_SETTINGS_YPOS(0) + ED_BORDER_SIZE; - int sx = SX + pad_x; - int sy = SY + pad_y; - int max_lines_per_screen = (SYSIZE - pad_y) / font_height - 1; - - if (screen_line >= max_lines_per_screen) - return FALSE; - - DrawText(sx, sy + screen_line * font_height, text, font_nr); - - return TRUE; -} - -static int PrintElementDescriptionFromFile(char *filename, int screen_line) -{ - int font_nr = FONT_TEXT_2; - int font_width = getFontWidth(font_nr); - int pad_x = ED_SETTINGS_XPOS(0); - int max_chars_per_line = (SXSIZE - 2 * pad_x) / font_width; - char line[MAX_LINE_LEN]; - char buffer[max_chars_per_line + 1]; - int buffer_len; - int lines_printed = 0; - FILE *file; - - if (filename == NULL) - return 0; - - if (!(file = fopen(filename, MODE_READ))) - return 0; - - buffer[0] = '\0'; - buffer_len = 0; - - while(!feof(file)) - { - char *line_ptr, *word_ptr; - boolean last_line_was_empty = TRUE; - - /* read next line of input file */ - if (!fgets(line, MAX_LINE_LEN, file)) - break; - - /* skip comments (lines directly beginning with '#') */ - if (line[0] == '#') - continue; - - /* cut trailing newline from input line */ - for (line_ptr = line; *line_ptr; line_ptr++) - { - if (*line_ptr == '\n' || *line_ptr == '\r') - { - *line_ptr = '\0'; - break; - } - } - - if (strlen(line) == 0) /* special case: force empty line */ - strcpy(line, "\n"); - - word_ptr = line; - -#if 0 - printf("::: got line '%s'...\n", line); -#endif - - while (*word_ptr) - { - boolean print_buffer = FALSE; - int word_len; - - /* skip leading whitespaces */ - while (*word_ptr == ' ' || *word_ptr == '\t') - word_ptr++; - - line_ptr = word_ptr; - word_len = 0; - - /* look for end of next word */ - while (*line_ptr != ' ' && *line_ptr != '\t' && *line_ptr != '\0') - { - line_ptr++; - word_len++; - } - - if (word_len == 0) - { - continue; - } - else if (*word_ptr == '\n') /* special case: force empty line */ - { - if (buffer_len == 0) - word_ptr++; - - /* prevent printing of multiple empty lines */ - if (buffer_len > 0 || !last_line_was_empty) - print_buffer = TRUE; - } - else if (word_len < max_chars_per_line - buffer_len) - { - /* word fits into text buffer -- add word */ - - if (buffer_len > 0) - buffer[buffer_len++] = ' '; - - strncpy(&buffer[buffer_len], word_ptr, word_len); - buffer_len += word_len; - buffer[buffer_len] = '\0'; - word_ptr += word_len; - } - else if (buffer_len > 0) - { - /* not enough space left for word in text buffer -- print buffer */ - - print_buffer = TRUE; - } - else - { - /* word does not fit at all into empty text buffer -- cut word */ - - strncpy(buffer, word_ptr, max_chars_per_line); - buffer[max_chars_per_line] = '\0'; - word_ptr += max_chars_per_line; - print_buffer = TRUE; - } - - if (print_buffer) - { -#if 0 - printf("::: printing '%s'...\n", buffer); -#endif - - if (!PrintInfoText(buffer, font_nr, screen_line + lines_printed)) - { - fclose(file); - - return lines_printed; - } - - last_line_was_empty = (buffer_len == 0); - lines_printed++; - - buffer[0] = '\0'; - buffer_len = 0; - print_buffer = FALSE; - } - } - } - - fclose(file); - - if (buffer_len > 0) - if (PrintInfoText(buffer, font_nr, screen_line + lines_printed)) - lines_printed++; - - return lines_printed; -} -#endif - static void DrawPropertiesTabulatorGadgets() { struct GadgetInfo *gd_gi = level_editor_gadget[GADGET_ID_PROPERTIES_INFO]; diff --git a/src/events.c b/src/events.c index e021ec83..e7f7d89d 100644 --- a/src/events.c +++ b/src/events.c @@ -398,7 +398,7 @@ void HandleButton(int mx, int my, int button) break; case GAME_MODE_INFO: - HandleHelpScreen(button); + HandleInfoScreen(button); break; case GAME_MODE_SETUP: @@ -652,7 +652,7 @@ void HandleKey(Key key, int key_status) break; case GAME_MODE_INFO: - HandleHelpScreen(MB_RELEASED); + HandleInfoScreen(MB_RELEASED); break; case GAME_MODE_SCORES: @@ -920,7 +920,7 @@ void HandleJoystick() break; case GAME_MODE_INFO: - HandleHelpScreen(!newbutton); + HandleInfoScreen(!newbutton); break; case GAME_MODE_EDITOR: diff --git a/src/files.c b/src/files.c index cb4c6a60..e1cc87ba 100644 --- a/src/files.c +++ b/src/files.c @@ -3019,16 +3019,16 @@ void LoadMusicInfo() #endif } -void add_demo_anim(int element, int action, int direction, int delay, - int *num_list_entries) +void add_helpanim_entry(int element, int action, int direction, int delay, + int *num_list_entries) { - struct DemoAnimInfo *new_list_entry; + struct HelpAnimInfo *new_list_entry; (*num_list_entries)++; - demo_anim_info = - checked_realloc(demo_anim_info, - *num_list_entries * sizeof(struct DemoAnimInfo)); - new_list_entry = &demo_anim_info[*num_list_entries - 1]; + helpanim_info = + checked_realloc(helpanim_info, + *num_list_entries * sizeof(struct HelpAnimInfo)); + new_list_entry = &helpanim_info[*num_list_entries - 1]; new_list_entry->element = element; new_list_entry->action = action; @@ -3054,9 +3054,9 @@ void print_unknown_token_end(int token_nr) Error(ERR_RETURN_LINE, "-"); } -void LoadDemoAnimInfo() +void LoadHelpAnimInfo() { - char *filename = getDemoAnimInfoFilename(); + char *filename = getHelpAnimFilename(); SetupFileList *setup_file_list, *list; SetupFileHash *element_hash, *action_hash, *direction_hash; int num_list_entries = 0; @@ -3069,13 +3069,13 @@ void LoadDemoAnimInfo() SetupFileList *insert_ptr; insert_ptr = setup_file_list = - newSetupFileList(demo_anim_info_config[0].token, - demo_anim_info_config[0].value); + newSetupFileList(helpanim_config[0].token, + helpanim_config[0].value); - for (i=1; demo_anim_info_config[i].token; i++) + for (i=1; helpanim_config[i].token; i++) insert_ptr = addListEntry(insert_ptr, - demo_anim_info_config[i].token, - demo_anim_info_config[i].value); + helpanim_config[i].token, + helpanim_config[i].value); } element_hash = newSetupFileHash(); @@ -3102,7 +3102,7 @@ void LoadDemoAnimInfo() if (strcmp(list->token, "end") == 0) { - add_demo_anim(-1, -1, -1, -1, &num_list_entries); + add_helpanim_entry(HELPANIM_LIST_NEXT, -1, -1, -1, &num_list_entries); continue; } @@ -3113,7 +3113,7 @@ void LoadDemoAnimInfo() if (element_value != NULL) { /* element found */ - add_demo_anim(atoi(element_value), -1, -1, delay, &num_list_entries); + add_helpanim_entry(atoi(element_value), -1, -1, delay,&num_list_entries); continue; } @@ -3146,7 +3146,7 @@ void LoadDemoAnimInfo() if (action_value != NULL) { /* action found */ - add_demo_anim(atoi(element_value), atoi(action_value), -1, delay, + add_helpanim_entry(atoi(element_value), atoi(action_value), -1, delay, &num_list_entries); free(element_token); @@ -3159,8 +3159,8 @@ void LoadDemoAnimInfo() if (direction_value != NULL) { /* direction found */ - add_demo_anim(atoi(element_value), -1, atoi(direction_value), delay, - &num_list_entries); + add_helpanim_entry(atoi(element_value), -1, atoi(direction_value), delay, + &num_list_entries); free(element_token); continue; @@ -3196,8 +3196,8 @@ void LoadDemoAnimInfo() if (direction_value != NULL) { /* direction found */ - add_demo_anim(atoi(element_value), atoi(action_value), - atoi(direction_value), delay, &num_list_entries); + add_helpanim_entry(atoi(element_value), atoi(action_value), + atoi(direction_value), delay, &num_list_entries); free(element_token); free(action_token); @@ -3212,7 +3212,7 @@ void LoadDemoAnimInfo() print_unknown_token_end(num_unknown_tokens); - add_demo_anim(-999, -999, -999, -999, &num_list_entries); + add_helpanim_entry(HELPANIM_LIST_END, -1, -1, -1, &num_list_entries); freeSetupFileList(setup_file_list); freeSetupFileHash(element_hash); @@ -3223,34 +3223,35 @@ void LoadDemoAnimInfo() /* TEST ONLY */ for (i=0; i < num_list_entries; i++) printf("::: %d, %d, %d => %d\n", - demo_anim_info[i].element, - demo_anim_info[i].action, - demo_anim_info[i].direction, - demo_anim_info[i].delay); + helpanim_info[i].element, + helpanim_info[i].action, + helpanim_info[i].direction, + helpanim_info[i].delay); #endif } -void LoadDemoAnimText() +void LoadHelpTextInfo() { - char *filename = getDemoAnimTextFilename(); + char *filename = getHelpTextFilename(); int i; - if (demo_anim_text != NULL) - freeSetupFileHash(demo_anim_text); + if (helptext_info != NULL) + freeSetupFileHash(helptext_info); - if ((demo_anim_text = loadSetupFileHash(filename)) == NULL) + if ((helptext_info = loadSetupFileHash(filename)) == NULL) { /* use reliable default values from static configuration */ - demo_anim_text = newSetupFileHash(); + helptext_info = newSetupFileHash(); - for (i=0; demo_anim_text_config[i].token; i++) - setHashEntry(demo_anim_text, demo_anim_text_config[i].token, - demo_anim_text_config[i].value); + for (i=0; helptext_config[i].token; i++) + setHashEntry(helptext_info, + helptext_config[i].token, + helptext_config[i].value); } #if 0 /* TEST ONLY */ - BEGIN_HASH_ITERATION(demo_anim_text, itr) + BEGIN_HASH_ITERATION(helptext_info, itr) { printf("::: '%s' => '%s'\n", HASH_ITERATION_TOKEN(itr), HASH_ITERATION_VALUE(itr)); diff --git a/src/files.h b/src/files.h index 28158de5..7f87399c 100644 --- a/src/files.h +++ b/src/files.h @@ -42,7 +42,7 @@ void LoadCustomElementDescriptions(); void LoadSpecialMenuDesignSettings(); void LoadUserDefinedEditorElementList(int **, int *); void LoadMusicInfo(); -void LoadDemoAnimInfo(); -void LoadDemoAnimText(); +void LoadHelpAnimInfo(); +void LoadHelpTextInfo(); #endif /* FILES_H */ diff --git a/src/init.c b/src/init.c index 0e7680a4..4d36c281 100644 --- a/src/init.c +++ b/src/init.c @@ -3192,10 +3192,10 @@ static void InitGlobal() void Execute_Command(char *command) { + int i; + if (strcmp(command, "print graphicsinfo.conf") == 0) { - int i; - printf("# You can configure additional/alternative image files here.\n"); printf("# (The entries below are default and therefore commented out.)\n"); printf("\n"); @@ -3205,16 +3205,13 @@ void Execute_Command(char *command) printf("\n"); for (i=0; image_config[i].token != NULL; i++) - printf("# %s\n", - getFormattedSetupEntry(image_config[i].token, - image_config[i].value)); + printf("# %s\n", getFormattedSetupEntry(image_config[i].token, + image_config[i].value)); exit(0); } else if (strcmp(command, "print soundsinfo.conf") == 0) { - int i; - printf("# You can configure additional/alternative sound files here.\n"); printf("# (The entries below are default and therefore commented out.)\n"); printf("\n"); @@ -3224,16 +3221,13 @@ void Execute_Command(char *command) printf("\n"); for (i=0; sound_config[i].token != NULL; i++) - printf("# %s\n", - getFormattedSetupEntry(sound_config[i].token, - sound_config[i].value)); + printf("# %s\n", getFormattedSetupEntry(sound_config[i].token, + sound_config[i].value)); exit(0); } else if (strcmp(command, "print musicinfo.conf") == 0) { - int i; - printf("# You can configure additional/alternative music files here.\n"); printf("# (The entries below are default and therefore commented out.)\n"); printf("\n"); @@ -3243,9 +3237,8 @@ void Execute_Command(char *command) printf("\n"); for (i=0; music_config[i].token != NULL; i++) - printf("# %s\n", - getFormattedSetupEntry(music_config[i].token, - music_config[i].value)); + printf("# %s\n", getFormattedSetupEntry(music_config[i].token, + music_config[i].value)); exit(0); } @@ -3259,6 +3252,35 @@ void Execute_Command(char *command) exit(0); } + else if (strcmp(command, "print helpanim.conf") == 0) + { + printf("# You can configure different element help animations here.\n"); + printf("# (The entries below are default and therefore commented out.)\n"); + printf("\n"); + + for (i=0; helpanim_config[i].token != NULL; i++) + { + printf("# %s\n", getFormattedSetupEntry(helpanim_config[i].token, + helpanim_config[i].value)); + + if (strcmp(helpanim_config[i].token, "end") == 0) + printf("#\n"); + } + + exit(0); + } + else if (strcmp(command, "print helptext.conf") == 0) + { + printf("# You can configure different element help text here.\n"); + printf("# (The entries below are default and therefore commented out.)\n"); + printf("\n"); + + for (i=0; helptext_config[i].token != NULL; i++) + printf("# %s\n", getFormattedSetupEntry(helptext_config[i].token, + helptext_config[i].value)); + + exit(0); + } else if (strncmp(command, "dump level ", 11) == 0) { char *filename = &command[11]; diff --git a/src/libgame/setup.c b/src/libgame/setup.c index dd36e29a..34614e68 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -417,26 +417,26 @@ char *getEditorSetupFilename() return filename; } -char *getDemoAnimInfoFilename() +char *getHelpAnimFilename() { static char *filename = NULL; if (filename != NULL) free(filename); - filename = getPath2(getCurrentLevelDir(), DEMOANIMINFO_FILENAME); + filename = getPath2(getCurrentLevelDir(), HELPANIM_FILENAME); return filename; } -char *getDemoAnimTextFilename() +char *getHelpTextFilename() { static char *filename = NULL; if (filename != NULL) free(filename); - filename = getPath2(getCurrentLevelDir(), DEMOANIMTEXT_FILENAME); + filename = getPath2(getCurrentLevelDir(), HELPTEXT_FILENAME); return filename; } diff --git a/src/libgame/setup.h b/src/libgame/setup.h index 006a713a..512d0506 100644 --- a/src/libgame/setup.h +++ b/src/libgame/setup.h @@ -197,8 +197,8 @@ char *getTapeFilename(int); char *getScoreFilename(int); char *getSetupFilename(void); char *getEditorSetupFilename(void); -char *getDemoAnimInfoFilename(void); -char *getDemoAnimTextFilename(void); +char *getHelpAnimFilename(void); +char *getHelpTextFilename(void); char *getImageFilename(char *); char *getCustomImageFilename(char *); char *getCustomSoundFilename(char *); diff --git a/src/libgame/system.h b/src/libgame/system.h index 0449fcae..4f4496a6 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -228,8 +228,8 @@ #define SETUP_FILENAME "setup.conf" #define LEVELSETUP_FILENAME "levelsetup.conf" #define EDITORSETUP_FILENAME "editorsetup.conf" -#define DEMOANIMINFO_FILENAME "demoaniminfo.conf" -#define DEMOANIMTEXT_FILENAME "demoanimtext.conf" +#define HELPANIM_FILENAME "helpanim.conf" +#define HELPTEXT_FILENAME "helptext.conf" #define LEVELINFO_FILENAME "levelinfo.conf" #define GRAPHICSINFO_FILENAME "graphicsinfo.conf" #define SOUNDSINFO_FILENAME "soundsinfo.conf" @@ -242,8 +242,8 @@ #define SETUP_FILENAME "setup.cnf" #define LEVELSETUP_FILENAME "lvlsetup.cnf" #define EDITORSETUP_FILENAME "edsetup.cnf" -#define DEMOANIMINFO_FILENAME "demoainf.cnf" -#define DEMOANIMTEXT_FILENAME "demoatxt.cnf" +#define HELPANIM_FILENAME "helpanim.conf" +#define HELPTEXT_FILENAME "helptext.conf" #define LEVELINFO_FILENAME "lvlinfo.cnf" #define GRAPHICSINFO_FILENAME "gfxinfo.cnf" #define SOUNDSINFO_FILENAME "sndinfo.cnf" diff --git a/src/main.c b/src/main.c index 1754e225..da163c9e 100644 --- a/src/main.c +++ b/src/main.c @@ -105,8 +105,8 @@ struct GraphicInfo *graphic_info = NULL; struct SoundInfo *sound_info = NULL; struct MusicInfo *music_info = NULL; struct MusicFileInfo *music_file_info = NULL; -struct DemoAnimInfo *demo_anim_info = NULL; -SetupFileHash *demo_anim_text = NULL; +struct HelpAnimInfo *helpanim_info = NULL; +SetupFileHash *helptext_info = NULL; /* ------------------------------------------------------------------------- */ @@ -3899,6 +3899,8 @@ static void print_usage() " \"print soundsinfo.conf\" print default sounds config\n" " \"print musicinfo.conf\" print default music config\n" " \"print editorsetup.conf\" print default editor config\n" + " \"print helpanim.conf\" print default helpanim config\n" + " \"print helptext.conf\" print default helptext config\n" " \"dump level FILE\" dump level data from FILE\n" " \"dump tape FILE\" dump tape data from FILE\n" " \"autoplay LEVELDIR\" play level tapes for LEVELDIR\n" diff --git a/src/main.h b/src/main.h index ed85f13f..1b002b0d 100644 --- a/src/main.h +++ b/src/main.h @@ -1071,6 +1071,12 @@ #define NUM_MUSIC_PREFIXES 1 #define MAX_LEVELS 1000 +/* definitions for demo animation lists */ +#define HELPANIM_LIST_NEXT -1 +#define HELPANIM_LIST_END -999 + + +/* program information and versioning definitions */ #define PROGRAM_VERSION_MAJOR 3 #define PROGRAM_VERSION_MINOR 0 @@ -1081,12 +1087,6 @@ #define PROGRAM_AUTHOR_STRING "Holger Schemel" #define PROGRAM_COPYRIGHT_STRING "Copyright ©1995-2003 by Holger Schemel" -#if 0 -#define PROGRAM_DOS_PORT_STRING "DOS port done by Guido Schulz" -#define PROGRAM_IDENT_STRING PROGRAM_VERSION_STRING " " TARGET_STRING -#define WINDOW_TITLE_STRING PROGRAM_TITLE_STRING " " PROGRAM_IDENT_STRING -#endif - #define ICON_TITLE_STRING PROGRAM_TITLE_STRING #define COOKIE_PREFIX "ROCKSNDIAMONDS" #define FILENAME_PREFIX "Rocks" @@ -1564,7 +1564,7 @@ struct SpecialSuffixInfo int value; }; -struct DemoAnimInfo +struct HelpAnimInfo { int element; int action; @@ -1667,15 +1667,15 @@ extern struct GraphicInfo *graphic_info; extern struct SoundInfo *sound_info; extern struct MusicInfo *music_info; extern struct MusicFileInfo *music_file_info; -extern struct DemoAnimInfo *demo_anim_info; -extern SetupFileHash *demo_anim_text; +extern struct HelpAnimInfo *helpanim_info; +extern SetupFileHash *helptext_info; extern struct ConfigInfo image_config[]; extern struct ConfigInfo sound_config[]; extern struct ConfigInfo music_config[]; extern struct ConfigInfo image_config_suffix[]; extern struct ConfigInfo sound_config_suffix[]; extern struct ConfigInfo music_config_suffix[]; -extern struct ConfigInfo demo_anim_info_config[]; -extern struct ConfigInfo demo_anim_text_config[]; +extern struct ConfigInfo helpanim_config[]; +extern struct ConfigInfo helptext_config[]; #endif /* MAIN_H */ diff --git a/src/screens.c b/src/screens.c index ec0a1231..13e8128f 100644 --- a/src/screens.c +++ b/src/screens.c @@ -45,7 +45,16 @@ #define SETUPINPUT_SCREEN_POS_EMPTY1 (SETUPINPUT_SCREEN_POS_START + 3) #define SETUPINPUT_SCREEN_POS_EMPTY2 (SETUPINPUT_SCREEN_POS_END - 1) +/* screens on the info screen */ +#define INFO_MODE_ELEMENTS 0 +#define INFO_MODE_MUSIC 1 +#define INFO_MODE_CREDITS 2 +#define INFO_MODE_PROGRAM 3 + +#define MAX_INFO_MODES 4 + /* for various menu stuff */ +#define MAX_INFO_ELEMENTS_ON_SCREEN 10 #define MAX_MENU_ENTRIES_ON_SCREEN (SCR_FIELDY - 2) #define MENU_SCREEN_START_YPOS 2 #define MENU_SCREEN_VALUE_XPOS 14 @@ -68,9 +77,22 @@ static void CalibrateJoystick(int); static void execSetupArtwork(void); static void HandleChooseTree(int, int, int, int, int, TreeInfo **); +static void DrawInfoScreenDemoAnim(int, boolean); +static void DrawInfoScreenDemoText(int, int, int, int); +static void DrawInfoScreenMusicText(int); +static void DrawInfoScreenCreditsText(void); +static void DrawInfoScreen(void); + static struct GadgetInfo *screen_gadget[NUM_SCREEN_GADGETS]; static int setup_mode = SETUP_MODE_MAIN; +static long infoscreen_state; +static int infoscreen_step[MAX_INFO_ELEMENTS_ON_SCREEN]; +static int infoscreen_frame[MAX_INFO_ELEMENTS_ON_SCREEN]; +static int num_infoscreen_elements; +static int num_infoscreen_music; +static int infoscreen_musicpos; + #define mSX (SX + (game_status >= GAME_MODE_MAIN && \ game_status <= GAME_MODE_SETUP ? \ menu.draw_xoffset[game_status] : menu.draw_xoffset_default)) @@ -384,7 +406,8 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) { static unsigned long level_delay = 0; int step = (button == 1 ? 1 : button == 2 ? 5 : 10); - int new_level_nr, old_level_nr = level_nr; + int old_level_nr = level_nr; + int new_level_nr; new_level_nr = level_nr + (x == 10 ? -step : +step); if (new_level_nr < leveldir_current->first_level) @@ -395,25 +418,26 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) if (setup.handicap && new_level_nr > leveldir_current->handicap_level) new_level_nr = leveldir_current->handicap_level; - if (old_level_nr == new_level_nr || - !DelayReached(&level_delay, GADGET_FRAME_DELAY)) - goto out; - - level_nr = new_level_nr; + if (new_level_nr != old_level_nr && + DelayReached(&level_delay, GADGET_FRAME_DELAY)) + { + level_nr = new_level_nr; - DrawText(mSX + 11 * 32, mSY + 3 * 32, int2str(level_nr, 3), FONT_VALUE_1); + DrawText(mSX + 11 * 32, mSY + 3 * 32, int2str(level_nr, 3), + FONT_VALUE_1); - LoadLevel(level_nr); - DrawMicroLevel(MICROLEV_XPOS, MICROLEV_YPOS, TRUE); + LoadLevel(level_nr); + DrawMicroLevel(MICROLEV_XPOS, MICROLEV_YPOS, TRUE); - TapeErase(); - LoadTape(level_nr); - DrawCompleteVideoDisplay(); + TapeErase(); + LoadTape(level_nr); + DrawCompleteVideoDisplay(); - /* needed because DrawMicroLevel() takes some time */ - BackToFront(); - SyncDisplay(); - DelayReached(&level_delay, 0); /* reset delay counter */ + /* needed because DrawMicroLevel() takes some time */ + BackToFront(); + SyncDisplay(); + DelayReached(&level_delay, 0); /* reset delay counter */ + } } else if (x == 0 && y >= 0 && y <= 7) { @@ -462,7 +486,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) else if (y == 4) { game_status = GAME_MODE_INFO; - DrawHelpScreen(); + DrawInfoScreen(); } else if (y == 5) { @@ -496,8 +520,6 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) } } - out: - if (game_status == GAME_MODE_MAIN) { DrawMicroLevel(MICROLEV_XPOS, MICROLEV_YPOS, FALSE); @@ -507,312 +529,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) BackToFront(); } - -#define MAX_HELPSCREEN_ELS 10 -#define HA_NEXT -999 -#define HA_END -1000 - -static long helpscreen_state; -static int helpscreen_step[MAX_HELPSCREEN_ELS]; -static int helpscreen_frame[MAX_HELPSCREEN_ELS]; - -#if 0 -static int helpscreen_action[] = -{ - IMG_PLAYER_1_MOVING_DOWN, 16, - IMG_PLAYER_1_MOVING_UP, 16, - IMG_PLAYER_1_MOVING_LEFT, 16, - IMG_PLAYER_1_MOVING_RIGHT, 16, - IMG_PLAYER_1_PUSHING_LEFT, 16, - IMG_PLAYER_1_PUSHING_RIGHT, 16, HA_NEXT, - - IMG_SAND, -1, HA_NEXT, - - IMG_EMPTY_SPACE, -1, HA_NEXT, - - IMG_QUICKSAND_EMPTY, -1, HA_NEXT, - - IMG_STEELWALL, -1, HA_NEXT, - - IMG_WALL, -1, HA_NEXT, - - IMG_EXPANDABLE_WALL_GROWING_LEFT, 20, - IMG_WALL, 50, - IMG_EMPTY_SPACE, 20, - IMG_EXPANDABLE_WALL_GROWING_RIGHT, 20, - IMG_WALL, 50, - IMG_EMPTY_SPACE, 20, - IMG_EXPANDABLE_WALL_GROWING_UP, 20, - IMG_WALL, 50, - IMG_EMPTY_SPACE, 20, - IMG_EXPANDABLE_WALL_GROWING_DOWN, 20, - IMG_WALL, 50, - IMG_EMPTY_SPACE, 20, HA_NEXT, - - IMG_INVISIBLE_WALL, -1, HA_NEXT, - - IMG_WALL_SLIPPERY, -1, HA_NEXT, - - IMG_FONT_GAME_INFO, -1, HA_NEXT, - - IMG_EMERALD, -1, HA_NEXT, - - IMG_DIAMOND, -1, HA_NEXT, - - IMG_BD_DIAMOND, -1, HA_NEXT, - - IMG_EMERALD_YELLOW, 50, - IMG_EMERALD_RED, 50, - IMG_EMERALD_PURPLE, 50, HA_NEXT, - - IMG_BD_ROCK, -1, HA_NEXT, - - IMG_BOMB, 100, - IMG_EXPLOSION, 16, - IMG_EMPTY_SPACE, 10, HA_NEXT, - - IMG_NUT, 100, - IMG_NUT_BREAKING, 6, - IMG_EMERALD, 20, HA_NEXT, - - IMG_WALL_EMERALD, 100, - IMG_EXPLOSION, 16, - IMG_EMERALD, 20, HA_NEXT, - - IMG_WALL_DIAMOND, 100, - IMG_EXPLOSION, 16, - IMG_DIAMOND, 20, HA_NEXT, - - IMG_WALL_BD_DIAMOND, 100, - IMG_EXPLOSION, 16, - IMG_BD_DIAMOND, 20, HA_NEXT, - - IMG_WALL_EMERALD_YELLOW, 100, - IMG_EXPLOSION, 16, - IMG_EMERALD_YELLOW, 20, - IMG_WALL_EMERALD_RED, 100, - IMG_EXPLOSION, 16, - IMG_EMERALD_RED, 20, - IMG_WALL_EMERALD_PURPLE, 100, - IMG_EXPLOSION, 16, - IMG_EMERALD_PURPLE, 20, HA_NEXT, - - IMG_ACID, -1, HA_NEXT, - - IMG_KEY_1, 50, - IMG_KEY_2, 50, - IMG_KEY_3, 50, - IMG_KEY_4, 50, HA_NEXT, - - IMG_GATE_1, 50, - IMG_GATE_2, 50, - IMG_GATE_3, 50, - IMG_GATE_4, 50, HA_NEXT, - - IMG_GATE_1_GRAY, 50, - IMG_GATE_2_GRAY, 50, - IMG_GATE_3_GRAY, 50, - IMG_GATE_4_GRAY, 50, HA_NEXT, - - IMG_DYNAMITE, -1, HA_NEXT, - - IMG_DYNAMITE_ACTIVE, 96, - IMG_EXPLOSION, 16, - IMG_EMPTY_SPACE, 20, HA_NEXT, - - IMG_DYNABOMB_ACTIVE, 100, - IMG_EXPLOSION, 16, - IMG_EMPTY_SPACE, 20, HA_NEXT, - - IMG_DYNABOMB_INCREASE_NUMBER, -1, HA_NEXT, - - IMG_DYNABOMB_INCREASE_SIZE, -1, HA_NEXT, - - IMG_DYNABOMB_INCREASE_POWER, -1, HA_NEXT, - - IMG_SPACESHIP_RIGHT, 16, - IMG_SPACESHIP_UP, 16, - IMG_SPACESHIP_LEFT, 16, - IMG_SPACESHIP_DOWN, 16, HA_NEXT, - - IMG_BUG_RIGHT, 16, - IMG_BUG_UP, 16, - IMG_BUG_LEFT, 16, - IMG_BUG_DOWN, 16, HA_NEXT, - - IMG_BD_BUTTERFLY, -1, HA_NEXT, - - IMG_BD_FIREFLY, -1, HA_NEXT, - - IMG_PACMAN_RIGHT, 16, - IMG_PACMAN_UP, 16, - IMG_PACMAN_LEFT, 16, - IMG_PACMAN_DOWN, 16, HA_NEXT, - - IMG_YAMYAM, -1, HA_NEXT, - - IMG_DARK_YAMYAM, -1, HA_NEXT, - - IMG_ROBOT, -1, HA_NEXT, - - IMG_MOLE_MOVING_RIGHT, 16, - IMG_MOLE_MOVING_UP, 16, - IMG_MOLE_MOVING_LEFT, 16, - IMG_MOLE_MOVING_DOWN, 16, HA_NEXT, - - IMG_PENGUIN_MOVING_RIGHT, 16, - IMG_PENGUIN_MOVING_UP, 16, - IMG_PENGUIN_MOVING_LEFT, 16, - IMG_PENGUIN_MOVING_DOWN, 16, HA_NEXT, - - IMG_PIG_MOVING_RIGHT, 16, - IMG_PIG_MOVING_UP, 16, - IMG_PIG_MOVING_LEFT, 16, - IMG_PIG_MOVING_DOWN, 16, HA_NEXT, - - IMG_DRAGON_MOVING_RIGHT, 16, - IMG_DRAGON_MOVING_UP, 16, - IMG_DRAGON_MOVING_LEFT, 16, - IMG_DRAGON_MOVING_DOWN, 16, HA_NEXT, - - IMG_SATELLITE, -1, HA_NEXT, - - IMG_ROBOT_WHEEL, 50, - IMG_ROBOT_WHEEL_ACTIVE, 100, HA_NEXT, - - IMG_LAMP, 50, - IMG_LAMP_ACTIVE, 50, HA_NEXT, - - IMG_TIME_ORB_FULL, 50, - IMG_TIME_ORB_EMPTY, 50, HA_NEXT, - - IMG_AMOEBA_DROP, 50, - IMG_AMOEBA_GROWING, 6, - IMG_AMOEBA_WET, 20, HA_NEXT, - - IMG_AMOEBA_DEAD, -1, HA_NEXT, - - IMG_AMOEBA_WET, -1, HA_NEXT, - - IMG_AMOEBA_WET, 100, - IMG_AMOEBA_GROWING, 6, HA_NEXT, - - IMG_AMOEBA_FULL, 50, - IMG_AMOEBA_DEAD, 50, - IMG_EXPLOSION, 16, - IMG_DIAMOND, 20, HA_NEXT, - - IMG_GAME_OF_LIFE, -1, HA_NEXT, - - IMG_BIOMAZE, -1, HA_NEXT, - - IMG_MAGIC_WALL_ACTIVE, -1, HA_NEXT, - - IMG_BD_MAGIC_WALL_ACTIVE, -1, HA_NEXT, - - IMG_EXIT_CLOSED, 200, - IMG_EXIT_OPENING, 16, - IMG_EXIT_OPEN, 100, HA_NEXT, - - IMG_EXIT_OPEN, -1, HA_NEXT, - - IMG_SOKOBAN_OBJECT, -1, HA_NEXT, - - IMG_SOKOBAN_FIELD_EMPTY, -1, HA_NEXT, - - IMG_SOKOBAN_FIELD_FULL, -1, HA_NEXT, - - IMG_SPEED_PILL, -1, HA_NEXT, - - HA_END -}; -#endif - -static char *helpscreen_eltext[][2] = -{ - {"THE HERO:", "(Is _this_ guy good old Rockford?)"}, - {"Normal sand:", "You can dig through it"}, - {"Empty field:", "You can walk through it"}, - {"Quicksand: You cannot pass it,", "but rocks can fall through it"}, - {"Massive Wall:", "Nothing can go through it"}, - {"Normal Wall: You can't go through", "it, but you can bomb it away"}, - {"Growing Wall: Grows in several di-", "rections if there is an empty field"}, - {"Invisible Wall: Behaves like normal","wall, but is invisible"}, - {"Old Wall: Like normal wall, but", "some things can fall down from it"}, - {"Letter Wall: Looks like a letter,", "behaves like a normal wall"}, - {"Emerald: You must collect enough of","them to finish a level"}, - {"Diamond: Counts as 3 emeralds, but", "can be destroyed by rocks"}, - {"Diamond (BD style): Counts like one","emerald and behaves a bit different"}, - {"Colorful Gems:", "Seem to behave like Emeralds"}, - {"Rock: Smashes several things;", "Can be moved by the player"}, - {"Bomb: You can move it, but be", "careful when dropping it"}, - {"Nut: Throw a rock on it to open it;","Each nut contains an emerald"}, - {"Wall with an emerald inside:", "Bomb the wall away to get it"}, - {"Wall with a diamond inside:", "Bomb the wall away to get it"}, - {"Wall with BD style diamond inside:", "Bomb the wall away to get it"}, - {"Wall with colorful gem inside:", "Bomb the wall away to get it"}, - {"Acid: Things that fall in are gone", "forever (including our hero)"}, - {"Key: Opens the door that has the", "same color (red/yellow/green/blue)"}, - {"Door: Can be opened by the key", "with the same color"}, - {"Door: You have to find out the", "right color of the key for it"}, - {"Dynamite: Collect it and use it to", "destroy walls or kill enemies"}, - {"Dynamite: This one explodes after", "a few seconds"}, - {"Dyna Bomb: Explodes in 4 directions","with variable explosion size"}, - {"Dyna Bomb: Increases the number of", "dyna bombs available at a time"}, - {"Dyna Bomb: Increases the size of", "explosion of dyna bombs"}, - {"Dyna Bomb: Increases the power of", "explosion of dyna bombs"}, - {"Spaceship: Moves at the left side", "of walls; don't touch it!"}, - {"Bug: Moves at the right side", "of walls; don't touch it!"}, - {"Butterfly: Moves at the right side", "of walls; don't touch it!"}, - {"Firefly: Moves at the left side", "of walls; don't touch it!"}, - {"Pacman: Eats the amoeba and you,", "if you're not careful"}, - {"Cruncher: Eats diamonds and you,", "if you're not careful"}, - {"Cruncher (BD style):", "Eats almost everything"}, - {"Robot: Tries to kill the player", ""}, - {"The mole: Eats the amoeba and turns","empty space into normal sand"}, - {"The penguin: Guide him to the exit,","but keep him away from monsters!"}, - {"The Pig: Harmless, but eats all", "gems it can get"}, - {"The Dragon: Breathes fire,", "especially to some monsters"}, - {"Sonde: Follows you everywhere;", "harmless, but may block your way"}, - {"Magic Wheel: Touch it to get rid of","the robots for some seconds"}, - {"Light Bulb: All of them must be", "switched on to finish a level"}, - {"Extra Time Orb: Adds some seconds", "to the time available for the level"}, - {"Amoeba Drop: Grows to an amoeba on", "the ground - don't touch it"}, - {"Dead Amoeba: Does not grow, but", "can still kill bugs and spaceships"}, - {"Normal Amoeba: Grows through empty", "fields, sand and quicksand"}, - {"Dropping Amoeba: This one makes", "drops that grow to a new amoeba"}, - {"Living Amoeba (BD style): Contains", "other element, when surrounded"}, - {"Game Of Life: Behaves like the well","known 'Game Of Life' (2333 style)"}, - {"Biomaze: A bit like the 'Game Of", "Life', but builds crazy mazes"}, - {"Magic Wall: Changes rocks, emeralds","and diamonds when they pass it"}, - {"Magic Wall (BD style):", "Changes rocks and BD style diamonds"}, - {"Exit door: Opens if you have enough","emeralds to finish the level"}, - {"Open exit door: Enter here to leave","the level and exit the actual game"}, - {"Sokoban element: Object which must", "be pushed to an empty field"}, - {"Sokoban element: Empty field where", "a Sokoban object can be placed on"}, - {"Sokoban element: Field with object", "which can be pushed away"}, - {"Speed pill: Lets the player run", "twice as fast as normally"}, -}; -static int num_helpscreen_els = sizeof(helpscreen_eltext) / (2*sizeof(char *)); - -#if 0 -static char *helpscreen_music[][3] = -{ - { "Alchemy", "Ian Boddy", "Drive" }, - { "The Chase", "Propaganda", "A Secret Wish" }, - { "Network 23", "Tangerine Dream", "Exit" }, - { "Czardasz", "Robert Pieculewicz", "Czardasz" }, - { "21st Century Common Man", "Tangerine Dream", "Tyger" }, - { "Voyager", "The Alan Parsons Project","Pyramid" }, - { "Twilight Painter", "Tangerine Dream", "Heartbreakers" } -}; -#endif - -static int num_helpscreen_music = 7; -static int helpscreen_musicpos; - -#if 1 -void DrawHelpScreenElAction(int start, boolean init) +void DrawInfoScreenDemoAnim(int start, boolean init) { int i = 0, j = 0; int xstart = mSX + 16; @@ -835,13 +552,14 @@ void DrawHelpScreenElAction(int start, boolean init) "Press any key or button for next page"); } - while (demo_anim_info[j].element != -999) + while (helpanim_info[j].element != HELPANIM_LIST_END) { - if (i >= start + MAX_HELPSCREEN_ELS || i >= num_helpscreen_els) + if (i >= start + MAX_INFO_ELEMENTS_ON_SCREEN || + i >= num_infoscreen_elements) break; else if (i < start) { - while (demo_anim_info[j].element != -1) + while (helpanim_info[j].element != HELPANIM_LIST_NEXT) j++; j++; @@ -850,11 +568,11 @@ void DrawHelpScreenElAction(int start, boolean init) continue; } - j += helpscreen_step[i - start]; + j += infoscreen_step[i - start]; - element = demo_anim_info[j].element; - action = demo_anim_info[j].action; - direction = demo_anim_info[j].direction; + element = helpanim_info[j].element; + action = helpanim_info[j].action; + direction = helpanim_info[j].direction; if (action != -1 && direction != -1) graphic = el_act_dir2img(element, action, direction); @@ -865,32 +583,32 @@ void DrawHelpScreenElAction(int start, boolean init) else graphic = el2img(element); - delay = demo_anim_info[j++].delay; + delay = helpanim_info[j++].delay; if (delay == -1) delay = 1000000; - if (helpscreen_frame[i - start] == 0) + if (infoscreen_frame[i - start] == 0) { sync_frame = 0; - helpscreen_frame[i - start] = delay - 1; + infoscreen_frame[i - start] = delay - 1; } else { - sync_frame = delay - helpscreen_frame[i - start]; - helpscreen_frame[i - start]--; + sync_frame = delay - infoscreen_frame[i - start]; + infoscreen_frame[i - start]--; } - if (demo_anim_info[j].element == -1) + if (helpanim_info[j].element == -1) { - if (!helpscreen_frame[i - start]) - helpscreen_step[i - start] = 0; + if (!infoscreen_frame[i - start]) + infoscreen_step[i - start] = 0; } else { - if (!helpscreen_frame[i - start]) - helpscreen_step[i - start]++; - while(demo_anim_info[j].element != -1) + if (!infoscreen_frame[i - start]) + infoscreen_step[i - start]++; + while(helpanim_info[j].element != -1) j++; } @@ -902,112 +620,27 @@ void DrawHelpScreenElAction(int start, boolean init) graphic, sync_frame, USE_MASKING); if (init) - DrawHelpScreenElText(element, action, direction, i - start); - - i++; - } - - redraw_mask |= REDRAW_FIELD; - - FrameCounter++; -} - -#else - -void DrawHelpScreenElAction(int start) -{ - int i = 0, j = 0; - int xstart = mSX + 16; - int ystart = mSY + 64 + 2 * 32; - int ystep = TILEY + 4; - int graphic; - int frame_count; - int sync_frame; - - while (helpscreen_action[j] != HA_END) - { - if (i >= start + MAX_HELPSCREEN_ELS || i >= num_helpscreen_els) - break; - else if (i < start) - { - while (helpscreen_action[j] != HA_NEXT) - j++; - - j++; - i++; - - continue; - } - - j += 2 * helpscreen_step[i-start]; - graphic = helpscreen_action[j++]; - frame_count = helpscreen_action[j++]; - if (frame_count == -1) - frame_count = 1000000; - - if (helpscreen_frame[i-start] == 0) - { - sync_frame = 0; - helpscreen_frame[i-start] = frame_count - 1; - } - else - { - sync_frame = frame_count - helpscreen_frame[i-start]; - helpscreen_frame[i-start]--; - } - - if (helpscreen_action[j] == HA_NEXT) - { - if (!helpscreen_frame[i-start]) - helpscreen_step[i-start] = 0; - } - else - { - if (!helpscreen_frame[i-start]) - helpscreen_step[i-start]++; - while(helpscreen_action[j] != HA_NEXT) - j++; - } - j++; - -#if 1 - ClearRectangleOnBackground(drawto, xstart, ystart + (i - start) * ystep, - TILEX, TILEY); - DrawGraphicAnimationExt(drawto, xstart, ystart + (i - start) * ystep, - graphic, sync_frame, USE_MASKING); -#else - frame = getGraphicAnimationFrame(graphic, sync_frame); - - DrawGraphicExt(drawto, xstart, ystart + (i-start) * ystep, - graphic, frame); -#endif + DrawInfoScreenDemoText(element, action, direction, i - start); i++; } -#if 1 redraw_mask |= REDRAW_FIELD; -#else - for(i=2; i<16; i++) - { - MarkTileDirty(0, i); - MarkTileDirty(1, i); - } -#endif FrameCounter++; } -#endif -#if 1 -void DrawHelpScreenElText(int element, int action, int direction, int ypos) +void DrawInfoScreenDemoText(int element, int action, int direction, int ypos) { - int xstart = mSX + 56; - int ystart = mSY + 65 + 2 * 32; + int font_nr = FONT_TEXT_2; + int max_chars_per_line = 34; + int max_lines_per_text = 2; + int sx = mSX + 56; + int sy = mSY + 65 + 2 * 32 + 1; int ystep = TILEY + 4; char *text; - text = getHashEntry(demo_anim_text, element_info[element].token_name); + text = getHashEntry(helptext_info, element_info[element].token_name); if (text == NULL) { @@ -1021,68 +654,20 @@ void DrawHelpScreenElText(int element, int action, int direction, int ypos) if (direction != -1) strcat(token, element_direction_info[MV_DIR_BIT(direction)].suffix); - text = getHashEntry(demo_anim_text, token); + text = getHashEntry(helptext_info, token); if (text == NULL) text = "No description available"; } -#if 1 - -#if 1 - - if (strlen(text) <= 34) - ystart += getFontHeight(FONT_TEXT_2) / 2; - -#if 0 - DrawTextWrapped(xstart, ystart+1 + ypos * ystep, text, FONT_LEVEL_NUMBER, - 34, 2); -#else - DrawTextWrapped(xstart, ystart+1 + ypos * ystep, text, FONT_TEXT_2, 34, 2); -#endif - -#else - DrawTextToTextArea(xstart, ystart + ypos * ystep, text, FONT_TEXT_2, 34, - 34, 2, BLIT_ON_BACKGROUND); -#endif - -#else - if (strlen(text) > 25) - text[25] = '\0'; + if (strlen(text) <= max_chars_per_line) + sy += getFontHeight(font_nr) / 2; - DrawText(xstart, ystart + ypos * ystep + 8, text, FONT_TEXT_2); -#endif + DrawTextWrapped(sx, sy + ypos * ystep, text, font_nr, + max_chars_per_line, max_lines_per_text); } -#else - -void DrawHelpScreenElText(int start) -{ - int i; - int xstart = mSX + 56, ystart = mSY + 65 + 2 * 32, ystep = TILEY + 4; - int ybottom = SYSIZE - 20; - - SetMainBackgroundImage(IMG_BACKGROUND_INFO); - ClearWindow(); - DrawHeadline(); - - DrawTextSCentered(100, FONT_TEXT_1, "The game elements:"); - - for(i=start; i < start + MAX_HELPSCREEN_ELS && i < num_helpscreen_els; i++) - { - DrawText(xstart, - ystart + (i - start) * ystep + (*helpscreen_eltext[i][1] ? 0 : 8), - helpscreen_eltext[i][0], FONT_TEXT_2); - DrawText(xstart, ystart + (i - start) * ystep + 16, - helpscreen_eltext[i][1], FONT_TEXT_2); - } - - DrawTextSCentered(ybottom, FONT_TEXT_4, - "Press any key or button for next page"); -} -#endif - -void DrawHelpScreenMusicText(int num) +void DrawInfoScreenMusicText(int num) { struct MusicFileInfo *list = music_file_info; int ystart = 150, ystep = 30; @@ -1098,34 +683,23 @@ void DrawHelpScreenMusicText(int num) DrawTextSCentered(100, FONT_TEXT_1, "The game background music loops:"); -#if 1 DrawTextSCentered(ystart + 0 * ystep, FONT_TEXT_2, "Excerpt from"); DrawTextFCentered(ystart + 1 * ystep, FONT_TEXT_3, "\"%s\"", list->title); DrawTextSCentered(ystart + 2 * ystep, FONT_TEXT_2, "by"); DrawTextFCentered(ystart + 3 * ystep, FONT_TEXT_3, "%s", list->artist); DrawTextSCentered(ystart + 4 * ystep, FONT_TEXT_2, "from the album"); DrawTextFCentered(ystart + 5 * ystep, FONT_TEXT_3, "\"%s\"", list->album); -#else - DrawTextSCentered(ystart + 0 * ystep, FONT_TEXT_2, "Excerpt from"); - DrawTextFCentered(ystart + 1 * ystep, FONT_TEXT_3, - "\"%s\"", helpscreen_music[num][0]); - DrawTextSCentered(ystart + 2 * ystep, FONT_TEXT_2, "by"); - DrawTextFCentered(ystart + 3 * ystep, FONT_TEXT_3, - "%s", helpscreen_music[num][1]); - DrawTextSCentered(ystart + 4 * ystep, FONT_TEXT_2, "from the album"); - DrawTextFCentered(ystart + 5 * ystep, FONT_TEXT_3, - "\"%s\"", helpscreen_music[num][2]); -#endif DrawTextSCentered(ybottom, FONT_TEXT_4, "Press any key or button for next page"); + /* !!! add playing music !!! */ #if 0 PlaySoundLoop(background_loop[num]); #endif } -void DrawHelpScreenCreditsText() +void DrawInfoScreenCreditsText() { int ystart = 150, ystep = 30; int ybottom = SYSIZE - 20; @@ -1147,7 +721,7 @@ void DrawHelpScreenCreditsText() "Press any key or button for next page"); } -void DrawHelpScreenContactText() +void DrawInfoScreenContactText() { int ystart = 150, ystep = 30; int ybottom = SYSIZE - 20; @@ -1185,7 +759,48 @@ void DrawHelpScreenContactText() "Press any key or button for main menu"); } -void DrawHelpScreen() +#if 1 +void DrawInfoScreen() +{ + struct MusicFileInfo *list; + int i; + + UnmapAllGadgets(); + CloseDoor(DOOR_CLOSE_2); + + for(i=0; i < MAX_INFO_ELEMENTS_ON_SCREEN; i++) + infoscreen_step[i] = infoscreen_frame[i] = 0; + infoscreen_musicpos = 0; + infoscreen_state = 0; + + LoadHelpAnimInfo(); + LoadHelpTextInfo(); + LoadMusicInfo(); + + num_infoscreen_elements = 0; + for (i=0; helpanim_info[i].element != HELPANIM_LIST_END; i++) + if (helpanim_info[i].element == HELPANIM_LIST_NEXT) + num_infoscreen_elements++; + + num_infoscreen_music = 0; + for (list = music_file_info; list != NULL; list = list->next) + num_infoscreen_music++; + + DrawInfoScreenDemoAnim(0, TRUE); +#if 0 + DrawInfoScreenDemoText(0); +#endif + + FadeToFront(); + InitAnimation(); + + PlayMenuSound(); + PlayMenuMusic(); +} + +#else + +void DrawInfoScreen() { struct MusicFileInfo *list; int i; @@ -1193,27 +808,27 @@ void DrawHelpScreen() UnmapAllGadgets(); CloseDoor(DOOR_CLOSE_2); - for(i=0;inext) - num_helpscreen_music++; + num_infoscreen_music++; - DrawHelpScreenElAction(0, TRUE); + DrawInfoScreenDemoAnim(0, TRUE); #if 0 - DrawHelpScreenElText(0); + DrawInfoScreenDemoText(0); #endif FadeToFront(); @@ -1222,46 +837,49 @@ void DrawHelpScreen() PlayMenuSound(); PlayMenuMusic(); } +#endif -void HandleHelpScreen(int button) +void HandleInfoScreen(int button) { static unsigned long hs_delay = 0; - int num_helpscreen_els_pages = - (num_helpscreen_els + MAX_HELPSCREEN_ELS-1) / MAX_HELPSCREEN_ELS; + int num_infoscreen_element_pages = + (num_infoscreen_elements + MAX_INFO_ELEMENTS_ON_SCREEN - 1) + / MAX_INFO_ELEMENTS_ON_SCREEN; int button_released = !button; int i; if (button_released) { - if (helpscreen_state < num_helpscreen_els_pages - 1) + if (infoscreen_state < num_infoscreen_element_pages - 1) { - for(i=0;i