From cf6b3ab16571c028cdaf955bb4c737798d352486 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Fri, 28 Nov 2003 03:03:37 +0100 Subject: [PATCH] rnd-20031128-1-src * added configurable "bored" and "sleeping" animations for the player --- ChangeLog | 3 + src/Makefile | 4 +- src/{conf_inf.c => conf_dem.c} | 259 ++++++++++++++++++++++++++++++++- src/conftime.h | 2 +- src/files.c | 92 ++++++++---- src/files.h | 3 +- src/libgame/setup.c | 59 +++++++- src/libgame/setup.h | 3 +- src/libgame/system.h | 8 +- src/main.c | 3 +- src/main.h | 8 +- src/screens.c | 91 ++++++++++-- src/screens.h | 4 +- 13 files changed, 472 insertions(+), 67 deletions(-) rename src/{conf_inf.c => conf_dem.c} (61%) diff --git a/ChangeLog b/ChangeLog index f9943b36..37d8c79d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,7 @@ +2003-11-25 + * added configurable "bored" and "sleeping" animations for the player + 2003-11-22 * added "copy" and "exchange" functions for custom elements to editor diff --git a/src/Makefile b/src/Makefile index f4ffbc8a..16c6cd6a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -136,7 +136,7 @@ SRCS = main.c \ conf_gfx.c \ conf_snd.c \ conf_mus.c \ - conf_inf.c \ + conf_dem.c \ init.c \ config.c \ events.c \ @@ -154,7 +154,7 @@ OBJS = main.o \ conf_gfx.o \ conf_snd.o \ conf_mus.o \ - conf_inf.o \ + conf_dem.o \ init.o \ config.o \ events.o \ diff --git a/src/conf_inf.c b/src/conf_dem.c similarity index 61% rename from src/conf_inf.c rename to src/conf_dem.c index 07b6375b..0204e1cd 100644 --- a/src/conf_inf.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 info_animation_config[] = +struct ConfigInfo demo_anim_info_config[] = { { "player_1.moving.down", "16" }, { "player_1.moving.up", "16" }, @@ -358,3 +358,260 @@ struct ConfigInfo info_animation_config[] = { NULL, NULL } }; + +struct ConfigInfo demo_anim_text_config[] = +{ + { + "player_1.moving.down", + "THE HERO: (Is _this_ guy good old Rockford?)" + }, + { + "sand", + "Normal sand: You can dig through it" + }, + { + "empty_space", + "Empty field: You can walk through it" + }, + { + "quicksand_empty", + "Quicksand: You cannot pass it, but rocks can fall through it" + }, + { + "steelwall", + "Massive Wall: Nothing can go through it" + }, + { + "wall", + "Normal Wall: You can't go through it, but you can bomb it away" + }, + { + "expandable_wall.growing.left", + "Growing Wall: Grows in several directions if there is an empty field" + }, + { + "invisible_wall", + "Invisible Wall: Behaves like normal wall, but is invisible" + }, + { + "wall_slippery", + "Old Wall: Like normal wall, but some things can fall down from it" + }, + { + "char_space", + "Letter Wall: Looks like a letter, behaves like a normal wall" + }, + { + "emerald", + "Emerald: You must collect enough of them to finish a level" + }, + { + "diamond", + "Diamond: Counts as 3 emeralds, but can be destroyed by rocks" + }, + { + "bd_diamond", + "Diamond (BD style): Counts like one emerald and behaves a bit different" + }, + { + "emerald_yellow", + "Colorful Gems: Seem to behave like Emeralds" + }, + { + "bd_rock", + "Rock: Smashes several things; Can be moved by the player" + }, + { + "bomb", + "Bomb: You can move it, but be careful when dropping it" + }, + { + "nut", + "Nut: Throw a rock on it to open it; Each nut contains an emerald" + }, + { + "wall_emerald", + "Wall with an emerald inside: Bomb the wall away to get it" + }, + { + "wall_diamond", + "Wall with a diamond inside: Bomb the wall away to get it" + }, + { + "wall_bd_diamond", + "Wall with BD style diamond inside: Bomb the wall away to get it" + }, + { + "wall_emerald_yellow", + "Wall with colorful gem inside: Bomb the wall away to get it" + }, + { + "acid", + "Acid: Things that fall in are gone forever (including our hero)" + }, + { + "key_1", + "Key: Opens the door that has the same color (red/yellow/green/blue)" + }, + { + "gate_1", + "Door: Can be opened by the key with the same color" + }, + { + "gate_1_gray", + "Door: You have to find out the right color of the key for it" + }, + { + "dynamite", + "Dynamite: Collect it and use it to destroy walls or kill enemies" + }, + { + "dynamite.active", + "Dynamite: This one explodes after a few seconds" + }, + { + "dynabomb.active", + "Dyna Bomb: Explodes in 4 directions with variable explosion size" + }, + { + "dynabomb_increase_number", + "Dyna Bomb: Increases the number of dyna bombs available at a time" + }, + { + "dynabomb_increase_size", + "Dyna Bomb: Increases the size of explosion of dyna bombs" + }, + { + "dynabomb_increase_power", + "Dyna Bomb: Increases the power of explosion of dyna bombs" + }, + { + "spaceship.right", + "Spaceship: Moves at the left side of walls; don't touch it!" + }, + { + "bug.right", + "Bug: Moves at the right side of walls; don't touch it!" + }, + { + "bd_butterfly", + "Butterfly: Moves at the right side of walls; don't touch it!" + }, + { + "bd_firefly", + "Firefly: Moves at the left side of walls; don't touch it!" + }, + { + "pacman.right", + "Pacman: Eats the amoeba and you, if you're not careful" + }, + { + "yamyam", + "Cruncher: Eats diamonds and you, if you're not careful" + }, + { + "dark_yamyam", + "Cruncher (BD style): Eats almost everything" + }, + { + "robot", + "Robot: Tries to kill the player" + }, + { + "mole.moving.right", + "The mole: Eats the amoeba and turns empty space into normal sand" + }, + { + "penguin.moving.right", + "The penguin: Guide him to the exit, but keep him away from monsters!" + }, + { + "pig.moving.right", + "The Pig: Harmless, but eats all gems it can get" + }, + { + "dragon.moving.right", + "The Dragon: Breathes fire, especially to some monsters" + }, + { + "satellite", + "Sonde: Follows you everywhere; harmless, but may block your way" + }, + { + "robot_wheel", + "Magic Wheel: Touch it to get rid of the robots for some seconds" + }, + { + "lamp", + "Light Bulb: All of them must be switched on to finish a level" + }, + { + "time_orb_full", + "Extra Time Orb: Adds some seconds to the time available for the level" + }, + { + "amoeba_drop", + "Amoeba Drop: Grows to an amoeba on the ground - don't touch it" + }, + { + "amoeba_dead", + "Dead Amoeba: Does not grow, but can still kill bugs and spaceships" + }, + { + "amoeba_wet", + "Normal Amoeba: Grows through empty fields, sand and quicksand" + }, + { + "amoeba_wet", + "Dropping Amoeba: This one makes drops that grow to a new amoeba" + }, + { + "amoeba_full", + "Living Amoeba (BD style): Contains other element, when surrounded" + }, + { + "game_of_life", + "Game Of Life: Behaves like the well known 'Game Of Life' (2333 style)" + }, + { + "biomaze", + "Biomaze: A bit like the 'Game Of Life', but builds crazy mazes" + }, + { + "magic_wall.active", + "Magic Wall: Changes rocks, emeralds and diamonds when they pass it" + }, + { + "bd_magic_wall.active", + "Magic Wall (BD style): Changes rocks and BD style diamonds" + }, + { + "exit_closed", + "Exit door: Opens if you have enough emeralds to finish the level" + }, + { + "exit_open", + "Open exit door: Enter here to leave the level and exit the actual game" + }, + { + "sokoban_object", + "Sokoban element: Object which must be pushed to an empty field" + }, + { + "sokoban_field_empty", + "Sokoban element: Empty field where a Sokoban object can be placed on" + }, + { + "sokoban_field_full", + "Sokoban element: Field with object which can be pushed away" + }, + { + "speed_pill", + "Speed pill: Lets the player run twice as fast as normally" + }, + + { + NULL, + NULL + } +}; diff --git a/src/conftime.h b/src/conftime.h index b0cc969b..21932cea 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-11-27 02:21]" +#define COMPILE_DATE_STRING "[2003-11-28 03:02]" diff --git a/src/files.c b/src/files.c index a2f7cf69..e65f387a 100644 --- a/src/files.c +++ b/src/files.c @@ -3019,16 +3019,16 @@ void LoadMusicInfo() #endif } -void add_info_animation(int element, int action, int direction, int delay, - int *num_list_entries) +void add_demo_anim(int element, int action, int direction, int delay, + int *num_list_entries) { - struct InfoAnimationInfo *new_list_entry; + struct DemoAnimInfo *new_list_entry; (*num_list_entries)++; - info_animation_info = - checked_realloc(info_animation_info, - *num_list_entries * sizeof(struct InfoAnimationInfo)); - new_list_entry = &info_animation_info[*num_list_entries - 1]; + demo_anim_info = + checked_realloc(demo_anim_info, + *num_list_entries * sizeof(struct DemoAnimInfo)); + new_list_entry = &demo_anim_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 LoadInfoAnimations() +void LoadDemoAnimInfo() { - char *filename = getElementInfoFilename(); + char *filename = getDemoAnimInfoFilename(); SetupFileList *setup_file_list, *list; SetupFileHash *element_hash, *action_hash, *direction_hash; int num_list_entries = 0; @@ -3069,13 +3069,13 @@ void LoadInfoAnimations() SetupFileList *insert_ptr; insert_ptr = setup_file_list = - newSetupFileList(info_animation_config[0].token, - info_animation_config[0].value); + newSetupFileList(demo_anim_info_config[0].token, + demo_anim_info_config[0].value); - for (i=1; info_animation_config[i].token; i++) - insert_ptr = addListEntry(insert_ptr, - info_animation_config[i].token, - info_animation_config[i].value); + for (i=1; demo_anim_info_config[i].token; i++) + insert_ptr = addListEntry(insert_ptr, + demo_anim_info_config[i].token, + demo_anim_info_config[i].value); } element_hash = newSetupFileHash(); @@ -3102,7 +3102,7 @@ void LoadInfoAnimations() if (strcmp(list->token, "end") == 0) { - add_info_animation(-1, -1, -1, -1, &num_list_entries); + add_demo_anim(-1, -1, -1, -1, &num_list_entries); continue; } @@ -3113,8 +3113,7 @@ void LoadInfoAnimations() if (element_value != NULL) { /* element found */ - add_info_animation(atoi(element_value), -1, -1, - delay, &num_list_entries); + add_demo_anim(atoi(element_value), -1, -1, delay, &num_list_entries); continue; } @@ -3147,8 +3146,8 @@ void LoadInfoAnimations() if (action_value != NULL) { /* action found */ - add_info_animation(atoi(element_value), atoi(action_value), -1, - delay, &num_list_entries); + add_demo_anim(atoi(element_value), atoi(action_value), -1, delay, + &num_list_entries); free(element_token); continue; @@ -3160,8 +3159,8 @@ void LoadInfoAnimations() if (direction_value != NULL) { /* direction found */ - add_info_animation(atoi(element_value), -1, atoi(direction_value), - delay, &num_list_entries); + add_demo_anim(atoi(element_value), -1, atoi(direction_value), delay, + &num_list_entries); free(element_token); continue; @@ -3197,9 +3196,8 @@ void LoadInfoAnimations() if (direction_value != NULL) { /* direction found */ - add_info_animation(atoi(element_value), atoi(action_value), - atoi(direction_value), - delay, &num_list_entries); + add_demo_anim(atoi(element_value), atoi(action_value), + atoi(direction_value), delay, &num_list_entries); free(element_token); free(action_token); @@ -3214,7 +3212,7 @@ void LoadInfoAnimations() print_unknown_token_end(num_unknown_tokens); - add_info_animation(-999, -999, -999, -999, &num_list_entries); + add_demo_anim(-999, -999, -999, -999, &num_list_entries); freeSetupFileList(setup_file_list); freeSetupFileHash(element_hash); @@ -3225,9 +3223,43 @@ void LoadInfoAnimations() /* TEST ONLY */ for (i=0; i < num_list_entries; i++) printf("::: %d, %d, %d => %d\n", - info_animation_info[i].element, - info_animation_info[i].action, - info_animation_info[i].direction, - info_animation_info[i].delay); + demo_anim_info[i].element, + demo_anim_info[i].action, + demo_anim_info[i].direction, + demo_anim_info[i].delay); +#endif +} + +void LoadDemoAnimText() +{ + char *filename = getDemoAnimTextFilename(); + int i; + + if (demo_anim_text != NULL) + freeSetupFileList(demo_anim_text); + + if ((demo_anim_text = loadSetupFileList(filename)) == NULL) + { + /* use reliable default values from static configuration */ + SetupFileList *insert_ptr; + + insert_ptr = demo_anim_text = + newSetupFileList(demo_anim_text_config[0].token, + demo_anim_text_config[0].value); + + for (i=1; demo_anim_text_config[i].token; i++) + insert_ptr = addListEntry(insert_ptr, + demo_anim_text_config[i].token, + demo_anim_text_config[i].value); + } + +#if 0 + /* TEST ONLY */ + { + SetupFileList *list; + + for (list = demo_anim_text; list != NULL; list = list->next) + printf("::: '%s' => '%s'\n", list->token, list->value); + } #endif } diff --git a/src/files.h b/src/files.h index 844503a0..28158de5 100644 --- a/src/files.h +++ b/src/files.h @@ -42,6 +42,7 @@ void LoadCustomElementDescriptions(); void LoadSpecialMenuDesignSettings(); void LoadUserDefinedEditorElementList(int **, int *); void LoadMusicInfo(); -void LoadInfoAnimations(); +void LoadDemoAnimInfo(); +void LoadDemoAnimText(); #endif /* FILES_H */ diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 00168642..dd36e29a 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -417,14 +417,26 @@ char *getEditorSetupFilename() return filename; } -char *getElementInfoFilename() +char *getDemoAnimInfoFilename() { static char *filename = NULL; if (filename != NULL) free(filename); - filename = getPath2(getCurrentLevelDir(), ELEMENTINFO_FILENAME); + filename = getPath2(getCurrentLevelDir(), DEMOANIMINFO_FILENAME); + + return filename; +} + +char *getDemoAnimTextFilename() +{ + static char *filename = NULL; + + if (filename != NULL) + free(filename); + + filename = getPath2(getCurrentLevelDir(), DEMOANIMTEXT_FILENAME); return filename; } @@ -1364,9 +1376,10 @@ static void printSetupFileHash(SetupFileHash *hash) static void *loadSetupFileData(char *filename, boolean use_hash) { int line_len; - char line[MAX_LINE_LEN]; + char line[MAX_LINE_LEN], previous_line[MAX_LINE_LEN]; char *token, *value, *line_ptr; void *setup_file_data, *insert_ptr = NULL; + boolean read_continued_line = FALSE; FILE *file; if (use_hash) @@ -1386,10 +1399,42 @@ static void *loadSetupFileData(char *filename, boolean use_hash) if (!fgets(line, MAX_LINE_LEN, file)) break; - /* cut trailing comment or whitespace from input line */ + /* cut trailing newline or carriage return */ + for (line_ptr = &line[strlen(line)]; line_ptr >= line; line_ptr--) + if ((*line_ptr == '\n' || *line_ptr == '\r') && *(line_ptr + 1) == '\0') + *line_ptr = '\0'; + + if (read_continued_line) + { + /* cut leading whitespaces from input line */ + for (line_ptr = line; *line_ptr; line_ptr++) + if (*line_ptr != ' ' && *line_ptr != '\t') + break; + + /* append new line to existing line, if there is enough space */ + if (strlen(previous_line) + strlen(line_ptr) < MAX_LINE_LEN) + strcat(previous_line, line_ptr); + + strcpy(line, previous_line); /* copy storage buffer to line */ + + read_continued_line = FALSE; + } + + /* if the last character is '\', continue at next line */ + if (strlen(line) > 0 && line[strlen(line) - 1] == '\\') + { + line[strlen(line) - 1] = '\0'; /* cut off trailing backslash */ + strcpy(previous_line, line); /* copy line to storage buffer */ + + read_continued_line = TRUE; + + continue; + } + + /* cut trailing comment from input line */ for (line_ptr = line; *line_ptr; line_ptr++) { - if (*line_ptr == '#' || *line_ptr == '\n' || *line_ptr == '\r') + if (*line_ptr == '#') { *line_ptr = '\0'; break; @@ -1397,8 +1442,8 @@ static void *loadSetupFileData(char *filename, boolean use_hash) } /* cut trailing whitespaces from input line */ - for (line_ptr = &line[strlen(line)]; line_ptr > line; line_ptr--) - if ((*line_ptr == ' ' || *line_ptr == '\t') && line_ptr[1] == '\0') + for (line_ptr = &line[strlen(line)]; line_ptr >= line; line_ptr--) + if ((*line_ptr == ' ' || *line_ptr == '\t') && *(line_ptr + 1) == '\0') *line_ptr = '\0'; /* ignore empty lines */ diff --git a/src/libgame/setup.h b/src/libgame/setup.h index 8f1bffef..dcbc5eea 100644 --- a/src/libgame/setup.h +++ b/src/libgame/setup.h @@ -197,7 +197,8 @@ char *getTapeFilename(int); char *getScoreFilename(int); char *getSetupFilename(void); char *getEditorSetupFilename(void); -char *getElementInfoFilename(void); +char *getDemoAnimInfoFilename(void); +char *getDemoAnimTextFilename(void); char *getImageFilename(char *); char *getCustomImageFilename(char *); char *getCustomSoundFilename(char *); diff --git a/src/libgame/system.h b/src/libgame/system.h index 3abbbd76..0449fcae 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -228,7 +228,8 @@ #define SETUP_FILENAME "setup.conf" #define LEVELSETUP_FILENAME "levelsetup.conf" #define EDITORSETUP_FILENAME "editorsetup.conf" -#define ELEMENTINFO_FILENAME "elementinfo.conf" +#define DEMOANIMINFO_FILENAME "demoaniminfo.conf" +#define DEMOANIMTEXT_FILENAME "demoanimtext.conf" #define LEVELINFO_FILENAME "levelinfo.conf" #define GRAPHICSINFO_FILENAME "graphicsinfo.conf" #define SOUNDSINFO_FILENAME "soundsinfo.conf" @@ -240,8 +241,9 @@ #define LEVELSETUP_DIRECTORY "lvlsetup" #define SETUP_FILENAME "setup.cnf" #define LEVELSETUP_FILENAME "lvlsetup.cnf" -#define EDITORSETUP_FILENAME "edsetup.conf" -#define ELEMENTINFO_FILENAME "eleminfo.conf" +#define EDITORSETUP_FILENAME "edsetup.cnf" +#define DEMOANIMINFO_FILENAME "demoainf.cnf" +#define DEMOANIMTEXT_FILENAME "demoatxt.cnf" #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 84697de8..ef5d4b99 100644 --- a/src/main.c +++ b/src/main.c @@ -105,7 +105,8 @@ struct GraphicInfo *graphic_info = NULL; struct SoundInfo *sound_info = NULL; struct MusicInfo *music_info = NULL; struct MusicFileInfo *music_file_info = NULL; -struct InfoAnimationInfo *info_animation_info = NULL; +struct DemoAnimInfo *demo_anim_info = NULL; +struct SetupFileList *demo_anim_text = NULL; /* ------------------------------------------------------------------------- */ diff --git a/src/main.h b/src/main.h index 620167e6..9f028d1d 100644 --- a/src/main.h +++ b/src/main.h @@ -1564,7 +1564,7 @@ struct SpecialSuffixInfo int value; }; -struct InfoAnimationInfo +struct DemoAnimInfo { int element; int action; @@ -1667,13 +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 InfoAnimationInfo *info_animation_info; +extern struct DemoAnimInfo *demo_anim_info; +extern struct SetupFileList *demo_anim_text; 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 info_animation_config[]; +extern struct ConfigInfo demo_anim_info_config[]; +extern struct ConfigInfo demo_anim_text_config[]; #endif /* MAIN_H */ diff --git a/src/screens.c b/src/screens.c index 078ebb23..e47e922b 100644 --- a/src/screens.c +++ b/src/screens.c @@ -812,7 +812,7 @@ static int num_helpscreen_music = 7; static int helpscreen_musicpos; #if 1 -void DrawHelpScreenElAction(int start) +void DrawHelpScreenElAction(int start, boolean init) { int i = 0, j = 0; int xstart = mSX + 16; @@ -823,13 +823,25 @@ void DrawHelpScreenElAction(int start) int delay; int sync_frame; - while (info_animation_info[j].element != -999) + if (init) + { + SetMainBackgroundImage(IMG_BACKGROUND_INFO); + ClearWindow(); + DrawHeadline(); + + DrawTextSCentered(100, FONT_TEXT_1, "The game elements:"); + + DrawTextSCentered(SYSIZE - 20, FONT_TEXT_4, + "Press any key or button for next page"); + } + + while (demo_anim_info[j].element != -999) { if (i >= start + MAX_HELPSCREEN_ELS || i >= num_helpscreen_els) break; else if (i < start) { - while (info_animation_info[j].element != -1) + while (demo_anim_info[j].element != -1) j++; j++; @@ -840,9 +852,9 @@ void DrawHelpScreenElAction(int start) j += helpscreen_step[i - start]; - element = info_animation_info[j].element; - action = info_animation_info[j].action; - direction = info_animation_info[j].direction; + element = demo_anim_info[j].element; + action = demo_anim_info[j].action; + direction = demo_anim_info[j].direction; if (action != -1 && direction != -1) graphic = el_act_dir2img(element, action, direction); @@ -853,7 +865,7 @@ void DrawHelpScreenElAction(int start) else graphic = el2img(element); - delay = info_animation_info[j++].delay; + delay = demo_anim_info[j++].delay; if (delay == -1) delay = 1000000; @@ -869,7 +881,7 @@ void DrawHelpScreenElAction(int start) helpscreen_frame[i - start]--; } - if (info_animation_info[j].element == -1) + if (demo_anim_info[j].element == -1) { if (!helpscreen_frame[i - start]) helpscreen_step[i - start] = 0; @@ -878,7 +890,7 @@ void DrawHelpScreenElAction(int start) { if (!helpscreen_frame[i - start]) helpscreen_step[i - start]++; - while(info_animation_info[j].element != -1) + while(demo_anim_info[j].element != -1) j++; } @@ -889,6 +901,9 @@ void DrawHelpScreenElAction(int start) DrawGraphicAnimationExt(drawto, xstart, ystart + (i - start) * ystep, graphic, sync_frame, USE_MASKING); + if (init) + DrawHelpScreenElText(element, action, direction, i - start); + i++; } @@ -984,6 +999,46 @@ void DrawHelpScreenElAction(int start) } #endif +#if 1 +void DrawHelpScreenElText(int element, int action, int direction, int ypos) +{ + int xstart = mSX + 56; + int ystart = mSY + 65 + 2 * 32; + int ystep = TILEY + 4; + char *text; + + text = getListEntry(demo_anim_text, element_info[element].token_name); + if (text == NULL) + { + char token[MAX_LINE_LEN]; + + strcpy(token, element_info[element].token_name); + + if (action != -1) + strcat(token, element_action_info[action].suffix); + + if (direction != -1) + strcat(token, element_direction_info[MV_DIR_BIT(direction)].suffix); + + text = getListEntry(demo_anim_text, token); + + if (text == NULL) + text = "[Oops! No Text found!]"; + } + +#if 1 + DrawTextToTextArea(xstart, ystart + ypos * ystep, text, FONT_TEXT_2, 34, + 34, 2, BLIT_ON_BACKGROUND); +#else + if (strlen(text) > 25) + text[25] = '\0'; + + DrawText(xstart, ystart + ypos * ystep + 8, text, FONT_TEXT_2); +#endif +} + +#else + void DrawHelpScreenElText(int start) { int i; @@ -1008,6 +1063,7 @@ void DrawHelpScreenElText(int start) DrawTextSCentered(ybottom, FONT_TEXT_4, "Press any key or button for next page"); } +#endif void DrawHelpScreenMusicText(int num) { @@ -1125,20 +1181,23 @@ void DrawHelpScreen() helpscreen_musicpos = 0; helpscreen_state = 0; - LoadInfoAnimations(); + LoadDemoAnimInfo(); + LoadDemoAnimText(); LoadMusicInfo(); num_helpscreen_els = 0; - for (i=0; info_animation_info[i].element != -999; i++) - if (info_animation_info[i].element == -1) + for (i=0; demo_anim_info[i].element != -999; i++) + if (demo_anim_info[i].element == -1) num_helpscreen_els++; num_helpscreen_music = 0; for (list = music_file_info; list != NULL; list = list->next) num_helpscreen_music++; + DrawHelpScreenElAction(0, TRUE); +#if 0 DrawHelpScreenElText(0); - DrawHelpScreenElAction(0); +#endif FadeToFront(); InitAnimation(); @@ -1164,8 +1223,10 @@ void HandleHelpScreen(int button) helpscreen_state++; FrameCounter = 0; + DrawHelpScreenElAction(helpscreen_state * MAX_HELPSCREEN_ELS, TRUE); +#if 0 DrawHelpScreenElText(helpscreen_state * MAX_HELPSCREEN_ELS); - DrawHelpScreenElAction(helpscreen_state * MAX_HELPSCREEN_ELS); +#endif } else if (helpscreen_state < num_helpscreen_els_pages + num_helpscreen_music - 1) @@ -1198,7 +1259,7 @@ void HandleHelpScreen(int button) if (DelayReached(&hs_delay, GAME_FRAME_DELAY)) { if (helpscreen_state < num_helpscreen_els_pages) - DrawHelpScreenElAction(helpscreen_state * MAX_HELPSCREEN_ELS); + DrawHelpScreenElAction(helpscreen_state * MAX_HELPSCREEN_ELS, FALSE); } PlayMenuSoundIfLoop(); diff --git a/src/screens.h b/src/screens.h index f4b704b4..6b126c97 100644 --- a/src/screens.h +++ b/src/screens.h @@ -26,8 +26,8 @@ void DrawHeadline(void); void DrawMainMenu(void); void HandleMainMenu(int, int, int, int, int); -void DrawHelpScreenElAction(int); -void DrawHelpScreenElText(int); +void DrawHelpScreenElAction(int, boolean); +void DrawHelpScreenElText(int, int, int, int); void DrawHelpScreenMusicText(int); void DrawHelpScreenCreditsText(void); void DrawHelpScreen(void); -- 2.34.1