From: Holger Schemel Date: Sun, 7 Dec 2003 01:51:29 +0000 (+0100) Subject: rnd-20031207-1-src X-Git-Tag: 3.0.8^2~5 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=8c3a8e72f2bebc6a732f11cac24a4f3ca21dd730;p=rocksndiamonds.git rnd-20031207-1-src * fixed boring and sleeping sounds * added "maze runner" and "maze hunter" movement types * added extended collision conditions for custom elements * added warnings for undefined token values in artwork config files --- diff --git a/ChangeLog b/ChangeLog index 7d4d5730..b04fc9a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2003-12-07 + * fixed boring and sleeping sounds + +2003-12-05 + * added "maze runner" and "maze hunter" movement types + * added extended collision conditions for custom elements + +2003-12-03 + * added warnings for undefined token values in artwork config files + 2003-12-02 * added menu entry for level set information to the info screen @@ -10,6 +20,7 @@ 2003-11-25 * added configurable "bored" and "sleeping" animations for the player + * added "awakening" sound for player waking up after sleeping 2003-11-22 * added "copy" and "exchange" functions for custom elements to editor diff --git a/Makefile b/Makefile index ddb3f97d..0c0c57f4 100644 --- a/Makefile +++ b/Makefile @@ -50,8 +50,8 @@ CROSS_PATH_WIN32=/usr/local/cross-tools/i386-mingw32msvc SRC_DIR = src MAKE_CMD = $(MAKE) -C $(SRC_DIR) -DEFAULT_TARGET = x11 -# DEFAULT_TARGET = sdl +# DEFAULT_TARGET = x11 +DEFAULT_TARGET = sdl # ----------------------------------------------------------------------------- diff --git a/src/Makefile b/src/Makefile index 0512cf80..16c6cd6a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -41,7 +41,6 @@ PROGNAME = ../$(PROGBASE).exe SYS_CFLAGS = -DTARGET_X11 SYS_LDFLAGS = -s -lalleg - else # Unix or cross-compiling for MS-DOS and Win32 RM = rm -f @@ -77,8 +76,7 @@ endif ifeq ($(TARGET),x11) SYS_CFLAGS = -DTARGET_X11 $(X11_INCL) -# SYS_LDFLAGS = $(X11_LIBS) -lX11 -SYS_LDFLAGS = $(XLIB_PATH)/libX11.a +SYS_LDFLAGS = $(X11_LIBS) -lX11 endif ifeq ($(TARGET),sdl) diff --git a/src/conftime.h b/src/conftime.h index 2ec21bcf..c19e6d1d 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2003-12-05 00:32]" +#define COMPILE_DATE_STRING "[2003-12-07 02:50]" diff --git a/src/editor.c b/src/editor.c index 11259a9c..843eb19b 100644 --- a/src/editor.c +++ b/src/editor.c @@ -1071,8 +1071,10 @@ static struct ValueTextInfo options_move_pattern[] = { MV_TURNING_LEFT, "turning left" }, { MV_TURNING_RIGHT, "turning right" }, { MV_WHEN_PUSHED, "when pushed" }, +#if 0 { MV_MAZE_RUNNER, "maze runner style" }, { MV_MAZE_HUNTER, "maze hunter style" }, +#endif { -1, NULL } }; @@ -1148,8 +1150,12 @@ static struct ValueTextInfo options_change_direct_action[] = { CE_LEFT_BY_PLAYER, "left by player ..." }, { CE_DROPPED_BY_PLAYER, "dropped by player" }, { CE_SWITCHED, "switched ..." }, +#if 0 { CE_COLLISION_ACTIVE, "hitting something ..." }, { CE_COLLISION_PASSIVE, "hit by something ..." }, +#else + { CE_COLLISION_ACTIVE, "collision ..." }, +#endif { CE_IMPACT, "impact (on something)" }, { CE_SMASHED, "smashed (from above)" }, { -1, NULL } @@ -1166,8 +1172,10 @@ static struct ValueTextInfo options_change_other_action[] = { CE_OTHER_GETS_COLLECTED, "player collects" }, { CE_OTHER_GETS_DROPPED, "player drops" }, { CE_OTHER_IS_TOUCHING, "touching ..." }, +#if 0 { CE_OTHER_IS_COLL_ACTIVE, "hitting ..." }, { CE_OTHER_IS_COLL_PASSIVE, "hit by ..." }, +#endif { CE_OTHER_IS_SWITCHING, "switch of ..." }, { CE_OTHER_IS_CHANGING, "change of" }, { CE_OTHER_IS_EXPLODING, "explosion of" }, diff --git a/src/events.c b/src/events.c index 5af02c55..de4583dc 100644 --- a/src/events.c +++ b/src/events.c @@ -438,8 +438,6 @@ void HandleButton(int mx, int my, int button) printf(" GfxElement[%d][%d] == %d\n", x,y, GfxElement[x][y]); printf(" GfxAction[%d][%d] == %d\n", x,y, GfxAction[x][y]); printf(" GfxFrame[%d][%d] == %d\n", x,y, GfxFrame[x][y]); - printf(" RunnerVisit[%d][%d] == %d\n", x,y, RunnerVisit[x][y]); - printf(" PlayerVisit[%d][%d] == %d\n", x,y, PlayerVisit[x][y]); printf("\n"); } } @@ -718,7 +716,7 @@ void HandleKey(Key key, int key_status) } break; - case KSYM_s: + case KSYM_S: if (!global.fps_slowdown) { global.fps_slowdown = TRUE; diff --git a/src/files.c b/src/files.c index 5ff8c06a..8c268a7b 100644 --- a/src/files.c +++ b/src/files.c @@ -2829,12 +2829,12 @@ void LoadUserDefinedEditorElementList(int **elements, int *num_elements) #endif } -static struct MusicFileInfo *get_music_file_info(char *basename, int music) +static struct MusicFileInfo *get_music_file_info_ext(char *basename, int music, + boolean is_sound) { SetupFileHash *setup_file_hash = NULL; struct MusicFileInfo tmp_music_file_info, *new_music_file_info; - char *filename_music = getCustomMusicFilename(basename); - char *filename_prefix, *filename_info; + char *filename_music, *filename_prefix, *filename_info; struct { char *token; @@ -2842,15 +2842,23 @@ static struct MusicFileInfo *get_music_file_info(char *basename, int music) } token_to_value_ptr[] = { - { "context", &tmp_music_file_info.context }, - { "title", &tmp_music_file_info.title }, - { "artist", &tmp_music_file_info.artist }, - { "album", &tmp_music_file_info.album }, - { "year", &tmp_music_file_info.year }, - { NULL, NULL }, + { "title_header", &tmp_music_file_info.title_header }, + { "artist_header", &tmp_music_file_info.artist_header }, + { "album_header", &tmp_music_file_info.album_header }, + { "year_header", &tmp_music_file_info.year_header }, + + { "title", &tmp_music_file_info.title }, + { "artist", &tmp_music_file_info.artist }, + { "album", &tmp_music_file_info.album }, + { "year", &tmp_music_file_info.year }, + + { NULL, NULL }, }; int i; + filename_music = (is_sound ? getCustomSoundFilename(basename) : + getCustomMusicFilename(basename)); + if (filename_music == NULL) return NULL; @@ -2904,7 +2912,9 @@ static struct MusicFileInfo *get_music_file_info(char *basename, int music) getStringCopy(value != NULL ? value : UNKNOWN_NAME); } + tmp_music_file_info.basename = basename; tmp_music_file_info.music = music; + tmp_music_file_info.is_sound = is_sound; new_music_file_info = checked_malloc(sizeof(struct MusicFileInfo)); *new_music_file_info = tmp_music_file_info; @@ -2912,14 +2922,45 @@ static struct MusicFileInfo *get_music_file_info(char *basename, int music) return new_music_file_info; } +static struct MusicFileInfo *get_music_file_info(char *basename, int music) +{ + return get_music_file_info_ext(basename, music, FALSE); +} + +static struct MusicFileInfo *get_sound_file_info(char *basename, int sound) +{ + return get_music_file_info_ext(basename, sound, TRUE); +} + +static boolean music_info_listed_ext(struct MusicFileInfo *list, + char *basename, boolean is_sound) +{ + for (; list != NULL; list = list->next) + if (list->is_sound == is_sound && strcmp(list->basename, basename) == 0) + return TRUE; + + return FALSE; +} + +static boolean music_info_listed(struct MusicFileInfo *list, char *basename) +{ + return music_info_listed_ext(list, basename, FALSE); +} + +static boolean sound_info_listed(struct MusicFileInfo *list, char *basename) +{ + return music_info_listed_ext(list, basename, TRUE); +} + void LoadMusicInfo() { char *music_directory = getCustomMusicDirectory(); int num_music = getMusicListSize(); int num_music_noconf = 0; + int num_sounds = getSoundListSize(); DIR *dir; struct dirent *dir_entry; - struct FileInfo *music; + struct FileInfo *music, *sound; struct MusicFileInfo *next, **new; int i; @@ -2927,8 +2968,15 @@ void LoadMusicInfo() { next = music_file_info->next; - if (music_file_info->context) - free(music_file_info->context); + if (music_file_info->title_header) + free(music_file_info->title_header); + if (music_file_info->artist_header) + free(music_file_info->artist_header); + if (music_file_info->album_header) + free(music_file_info->album_header); + if (music_file_info->year_header) + free(music_file_info->year_header); + if (music_file_info->title) free(music_file_info->title); if (music_file_info->artist) @@ -2945,7 +2993,9 @@ void LoadMusicInfo() new = &music_file_info; +#if 0 printf("::: num_music == %d\n", num_music); +#endif for (i = 0; i < num_music; i++) { @@ -2969,9 +3019,12 @@ void LoadMusicInfo() printf("::: -> '%s' (configured)\n", music->filename); #endif - *new = get_music_file_info(music->filename, i); - if (*new != NULL) - new = &(*new)->next; + if (!music_info_listed(music_file_info, music->filename)) + { + *new = get_music_file_info(music->filename, i); + if (*new != NULL) + new = &(*new)->next; + } } if ((dir = opendir(music_directory)) == NULL) @@ -3010,15 +3063,44 @@ void LoadMusicInfo() printf("::: -> '%s' (found in directory)\n", basename); #endif - *new = get_music_file_info(basename, MAP_NOCONF_MUSIC(num_music_noconf)); - if (*new != NULL) - new = &(*new)->next; + if (!music_info_listed(music_file_info, basename)) + { + *new = get_music_file_info(basename, MAP_NOCONF_MUSIC(num_music_noconf)); + if (*new != NULL) + new = &(*new)->next; + } num_music_noconf++; } closedir(dir); + for (i = 0; i < num_sounds; i++) + { + sound = getSoundListEntry(i); + + if (sound->filename == NULL) + continue; + + if (strcmp(sound->filename, UNDEFINED_FILENAME) == 0) + continue; + + /* a configured file may be not recognized as sound */ + if (!FileIsSound(sound->filename)) + continue; + +#if 0 + printf("::: -> '%s' (configured)\n", sound->filename); +#endif + + if (!sound_info_listed(music_file_info, sound->filename)) + { + *new = get_sound_file_info(sound->filename, i); + if (*new != NULL) + new = &(*new)->next; + } + } + #if 0 /* TEST-ONLY */ for (next = music_file_info; next != NULL; next = next->next) diff --git a/src/game.c b/src/game.c index 855e331a..06ec792c 100644 --- a/src/game.c +++ b/src/game.c @@ -1075,6 +1075,7 @@ void InitGame() player->anim_delay_counter = 0; player->post_delay_counter = 0; + player->action_waiting = ACTION_DEFAULT; player->special_action_bored = ACTION_DEFAULT; player->special_action_sleeping = ACTION_DEFAULT; @@ -4878,6 +4879,7 @@ void ContinueMoving(int x, int y) CheckElementSideChange(newx, newy, Feld[newx][newy], direction, CE_COLLISION_ACTIVE, -1); +#if 0 if (IN_LEV_FIELD(nextx, nexty)) { static int opposite_directions[] = @@ -4945,6 +4947,7 @@ void ContinueMoving(int x, int y) } } } +#endif } TestIfPlayerTouchesCustomElement(newx, newy); @@ -6172,6 +6175,110 @@ static boolean CheckElementChange(int x, int y, int element, int trigger_event) return CheckElementSideChange(x, y, element, CH_SIDE_ANY, trigger_event, -1); } +int GetPlayerAction(struct PlayerInfo *player, int move_dir) +{ + int jx = player->jx, jy = player->jy; + int element = player->element_nr; + int action = (player->is_pushing ? ACTION_PUSHING : + player->is_digging ? ACTION_DIGGING : + player->is_collecting ? ACTION_COLLECTING : + player->is_moving ? ACTION_MOVING : + player->is_snapping ? ACTION_SNAPPING : + player->is_sleeping ? ACTION_SLEEPING : + player->is_bored ? ACTION_BORING : + player->is_waiting ? ACTION_WAITING : ACTION_DEFAULT); + + if (player->is_sleeping) + { + if (player->num_special_action_sleeping > 0) + { + int last_action = player->action_waiting; + + if (player->anim_delay_counter == 0 && player->post_delay_counter == 0) + { + int last_special_action = player->special_action_sleeping; + int num_special_action = player->num_special_action_sleeping; + int special_action = + (last_special_action == ACTION_DEFAULT ? ACTION_SLEEPING_1 : + last_special_action == ACTION_SLEEPING ? ACTION_SLEEPING : + last_special_action < ACTION_SLEEPING_1 + num_special_action - 1 ? + last_special_action + 1 : ACTION_SLEEPING); + int special_graphic = + el_act_dir2img(player->element_nr, special_action, move_dir); + + player->anim_delay_counter = + graphic_info[special_graphic].anim_delay_fixed + + SimpleRND(graphic_info[special_graphic].anim_delay_random); + player->post_delay_counter = + graphic_info[special_graphic].post_delay_fixed + + SimpleRND(graphic_info[special_graphic].post_delay_random); + + player->special_action_sleeping = special_action; + } + + if (player->anim_delay_counter > 0) + { + action = player->special_action_sleeping; + player->anim_delay_counter--; + } + else if (player->post_delay_counter > 0) + { + player->post_delay_counter--; + } + + player->action_waiting = action; + + if (last_action != action) + PlayLevelSoundElementAction(jx, jy, element, action); + else + PlayLevelSoundElementActionIfLoop(jx, jy, element, action); + } + } + else if (player->is_bored) + { + if (player->num_special_action_bored > 0) + { + int last_action = player->action_waiting; + + if (player->anim_delay_counter == 0 && player->post_delay_counter == 0) + { + int special_action = + ACTION_BORING_1 + SimpleRND(player->num_special_action_bored); + int special_graphic = + el_act_dir2img(player->element_nr, special_action, move_dir); + + player->anim_delay_counter = + graphic_info[special_graphic].anim_delay_fixed + + SimpleRND(graphic_info[special_graphic].anim_delay_random); + player->post_delay_counter = + graphic_info[special_graphic].post_delay_fixed + + SimpleRND(graphic_info[special_graphic].post_delay_random); + + player->special_action_bored = special_action; + } + + if (player->anim_delay_counter > 0) + { + action = player->special_action_bored; + player->anim_delay_counter--; + } + else if (player->post_delay_counter > 0) + { + player->post_delay_counter--; + } + + player->action_waiting = action; + + if (last_action != action) + PlayLevelSoundElementAction(jx, jy, element, action); + else + PlayLevelSoundElementActionIfLoop(jx, jy, element, action); + } + } + + return action; +} + static void SetPlayerWaiting(struct PlayerInfo *player, boolean is_waiting) { int jx = player->jx, jy = player->jy; @@ -6180,7 +6287,11 @@ static void SetPlayerWaiting(struct PlayerInfo *player, boolean is_waiting) if (is_waiting) { - int action; + int last_action, action; + boolean play_sound; + + last_action = (player->is_sleeping ? ACTION_SLEEPING : + player->is_bored ? ACTION_BORING : ACTION_WAITING); if (!was_waiting) /* not waiting -> waiting */ { @@ -6198,21 +6309,26 @@ static void SetPlayerWaiting(struct PlayerInfo *player, boolean is_waiting) InitPlayerGfxAnimation(player, ACTION_WAITING, player->MovDir); } - if (game.player_sleeping_delay_fixed != -1 && - game.player_sleeping_delay_random != -1 && + if (game.player_sleeping_delay_fixed + + game.player_sleeping_delay_random > 0 && player->anim_delay_counter == 0 && player->post_delay_counter == 0 && FrameCounter >= player->frame_counter_sleeping) player->is_sleeping = TRUE; - else if (game.player_boring_delay_fixed != -1 && - game.player_boring_delay_random != -1 && + else if (game.player_boring_delay_fixed + + game.player_boring_delay_random > 0 && FrameCounter >= player->frame_counter_bored) player->is_bored = TRUE; action = (player->is_sleeping ? ACTION_SLEEPING : player->is_bored ? ACTION_BORING : ACTION_WAITING); - if (!was_waiting) + play_sound = + ((player->is_sleeping && player->num_special_action_sleeping == 0) || + (player->is_bored && player->num_special_action_bored == 0) || + (player->is_waiting && !player->is_sleeping && !player->is_bored)); + + if (play_sound && action != last_action) PlayLevelSoundElementAction(jx, jy, element, action); else PlayLevelSoundElementActionIfLoop(jx, jy, element, action); diff --git a/src/game.h b/src/game.h index 519c6fc3..554fc952 100644 --- a/src/game.h +++ b/src/game.h @@ -72,6 +72,9 @@ void AusgangstuerBlinken(int, int); void EdelsteinFunkeln(int, int); void MauerWaechst(int, int); void MauerAbleger(int, int); + +int GetPlayerAction(struct PlayerInfo *, int); + void GameActions(void); void ScrollLevel(int, int); diff --git a/src/libgame/misc.c b/src/libgame/misc.c index a1321209..0c4547e0 100644 --- a/src/libgame/misc.c +++ b/src/libgame/misc.c @@ -283,48 +283,6 @@ void WaitUntilDelayReached(unsigned long *counter_var, unsigned long delay) /* random generator functions */ /* ------------------------------------------------------------------------- */ -#if 0 -unsigned int SimpleRND(unsigned int max) -{ - return (random_linux_libc(RND_FREE) % max); -} - -unsigned int InitSimpleRND(long seed) -{ - if (seed == NEW_RANDOMIZE) - { - struct timeval current_time; - - gettimeofday(¤t_time, NULL); - seed = (long)current_time.tv_usec; - } - - srandom_linux_libc(RND_FREE, (unsigned int) seed); - - return (unsigned int) seed; -} - -unsigned int RND(unsigned int max) -{ - return (random_linux_libc(RND_GAME) % max); -} - -unsigned int InitRND(long seed) -{ - if (seed == NEW_RANDOMIZE) - { - struct timeval current_time; - - gettimeofday(¤t_time, NULL); - seed = (long)current_time.tv_usec; - } - - srandom_linux_libc(RND_GAME, (unsigned int) seed); - - return (unsigned int) seed; -} -#endif - unsigned int init_random_number(int nr, long seed) { if (seed == NEW_RANDOMIZE) @@ -344,27 +302,10 @@ unsigned int init_random_number(int nr, long seed) return (unsigned int) seed; } -#if 1 -unsigned int get_random_number(int nr, unsigned int max) +unsigned int get_random_number(int nr, int max) { return (max > 0 ? random_linux_libc(nr) % max : 0); } -#else -unsigned int get_random_number(int nr, unsigned int max) -{ - unsigned int rnd = (max > 0 ? random_linux_libc(nr) % max : 0); - - if (nr == 0 && FrameCounter < 2) - printf("::: %d [%d]\n", rnd, FrameCounter); - -#if 0 - if (nr == 0 && FrameCounter < 2 && rnd == 8) - rnd /= 0; -#endif - - return rnd; -} -#endif /* ------------------------------------------------------------------------- */ diff --git a/src/libgame/misc.h b/src/libgame/misc.h index 968837bd..0e771902 100644 --- a/src/libgame/misc.h +++ b/src/libgame/misc.h @@ -87,7 +87,7 @@ unsigned int InitRND(long); #endif unsigned int init_random_number(int, long); -unsigned int get_random_number(int, unsigned int); +unsigned int get_random_number(int, int); char *getLoginName(void); char *getRealName(void); diff --git a/src/libgame/sound.c b/src/libgame/sound.c index c8d61a82..ea4e8463 100644 --- a/src/libgame/sound.c +++ b/src/libgame/sound.c @@ -1885,15 +1885,6 @@ void LoadCustomMusic_NoConf(void) struct dirent *dir_entry; int num_music = getMusicListSize(); -#if 0 - int ii; - for (ii = 0; ii < num_music; ii++) - { - struct FileInfo *music = getMusicListEntry(ii); - printf("sound process: music %d: '%s'\n", ii, music->filename); - } -#endif - if (!audio.sound_available) return; @@ -1929,10 +1920,6 @@ void LoadCustomMusic_NoConf(void) { struct FileInfo *music = getMusicListEntry(i); -#if 0 - printf("sound process: '%s'\n", music->filename); -#endif - if (strcmp(basename, music->filename) == 0) { music_already_used = TRUE; diff --git a/src/main.h b/src/main.h index 0ed5442c..32e7e3a7 100644 --- a/src/main.h +++ b/src/main.h @@ -1089,7 +1089,7 @@ #define PROGRAM_VERSION_MAJOR 3 #define PROGRAM_VERSION_MINOR 0 #define PROGRAM_VERSION_PATCH 8 -#define PROGRAM_VERSION_BUILD 0 +#define PROGRAM_VERSION_BUILD 1 #define PROGRAM_TITLE_STRING "Rocks'n'Diamonds" #define PROGRAM_AUTHOR_STRING "Holger Schemel" @@ -1217,6 +1217,7 @@ struct PlayerInfo int anim_delay_counter; int post_delay_counter; + int action_waiting; int special_action_bored; int special_action_sleeping; @@ -1545,7 +1546,12 @@ struct MusicPrefixInfo struct MusicFileInfo { - char *context; + char *basename; + + char *title_header; + char *artist_header; + char *album_header; + char *year_header; char *title; char *artist; @@ -1554,6 +1560,8 @@ struct MusicFileInfo int music; + boolean is_sound; + struct MusicFileInfo *next; }; diff --git a/src/screens.c b/src/screens.c index d3a05529..c7fd1da4 100644 --- a/src/screens.c +++ b/src/screens.c @@ -961,7 +961,7 @@ void DrawInfoScreen_Music() void HandleInfoScreen_Music(int button) { static struct MusicFileInfo *list = NULL; - int ystart = 150, ystep = 30; + int ystart = 150, dy = 30; int ybottom = SYSIZE - 20; int button_released = !button; @@ -994,6 +994,8 @@ void HandleInfoScreen_Music(int button) if (button_released || button == MB_MENU_INITIALIZE) { + int y = 0; + if (list == NULL) { info_mode = INFO_MODE_MAIN; @@ -1007,20 +1009,60 @@ void HandleInfoScreen_Music(int button) ClearWindow(); DrawHeadline(); - DrawTextSCentered(100, FONT_TEXT_1, "The Game Background Music:"); + if (list->is_sound) + { + PlaySound(list->music); + + DrawTextSCentered(100, FONT_TEXT_1, "The Game Background Sounds:"); + } + else + { + PlayMusic(list->music); + + DrawTextSCentered(100, FONT_TEXT_1, "The Game Background Music:"); + } + + if (strcmp(list->title, UNKNOWN_NAME) != 0) + { + if (strcmp(list->title_header, UNKNOWN_NAME) != 0) + DrawTextSCentered(ystart + y++ * dy, FONT_TEXT_2, list->title_header); + + DrawTextFCentered(ystart + y++ * dy, FONT_TEXT_3, "\"%s\"", list->title); + } + + if (strcmp(list->artist, UNKNOWN_NAME) != 0) + { + if (strcmp(list->artist_header, UNKNOWN_NAME) != 0) + DrawTextSCentered(ystart + y++ * dy, FONT_TEXT_2, list->artist_header); + else + DrawTextSCentered(ystart + y++ * dy, FONT_TEXT_2, "by"); + + DrawTextFCentered(ystart + y++ * dy, FONT_TEXT_3, "%s", list->artist); + } + + if (strcmp(list->album, UNKNOWN_NAME) != 0) + { + if (strcmp(list->album_header, UNKNOWN_NAME) != 0) + DrawTextSCentered(ystart + y++ * dy, FONT_TEXT_2, list->album_header); + else + DrawTextSCentered(ystart + y++ * dy, FONT_TEXT_2, "from the album"); - 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); + DrawTextFCentered(ystart + y++ * dy, FONT_TEXT_3, "\"%s\"", list->album); + } + + if (strcmp(list->year, UNKNOWN_NAME) != 0) + { + if (strcmp(list->year_header, UNKNOWN_NAME) != 0) + DrawTextSCentered(ystart + y++ * dy, FONT_TEXT_2, list->year_header); + else + DrawTextSCentered(ystart + y++ * dy, FONT_TEXT_2, "from the year"); + + DrawTextFCentered(ystart + y++ * dy, FONT_TEXT_3, "%s", list->year); + } DrawTextSCentered(ybottom, FONT_TEXT_4, "Press any key or button for next page"); - PlayMusic(list->music); - list = list->next; } } diff --git a/src/tools.c b/src/tools.c index 068afdef..106d251e 100644 --- a/src/tools.c +++ b/src/tools.c @@ -529,90 +529,6 @@ void DrawLevelElementAnimationIfNeeded(int x, int y, int element) DrawLevelFieldCrumbledSand(x, y); } -static int getPlayerAction(struct PlayerInfo *player, int move_dir) -{ - int action = (player->is_pushing ? ACTION_PUSHING : - player->is_digging ? ACTION_DIGGING : - player->is_collecting ? ACTION_COLLECTING : - player->is_moving ? ACTION_MOVING : - player->is_snapping ? ACTION_SNAPPING : - player->is_sleeping ? ACTION_SLEEPING : - player->is_bored ? ACTION_BORING : - player->is_waiting ? ACTION_WAITING : ACTION_DEFAULT); - - if (player->is_sleeping) - { - if (player->num_special_action_sleeping > 0) - { - if (player->anim_delay_counter == 0 && player->post_delay_counter == 0) - { - int last_special_action = player->special_action_sleeping; - int num_special_action = player->num_special_action_sleeping; - int special_action = - (last_special_action == ACTION_DEFAULT ? ACTION_SLEEPING_1 : - last_special_action == ACTION_SLEEPING ? ACTION_SLEEPING : - last_special_action < ACTION_SLEEPING_1 + num_special_action - 1 ? - last_special_action + 1 : ACTION_SLEEPING); - int special_graphic = - el_act_dir2img(player->element_nr, special_action, move_dir); - - player->anim_delay_counter = - graphic_info[special_graphic].anim_delay_fixed + - SimpleRND(graphic_info[special_graphic].anim_delay_random); - player->post_delay_counter = - graphic_info[special_graphic].post_delay_fixed + - SimpleRND(graphic_info[special_graphic].post_delay_random); - - player->special_action_sleeping = special_action; - } - - if (player->anim_delay_counter > 0) - { - action = player->special_action_sleeping; - player->anim_delay_counter--; - } - else if (player->post_delay_counter > 0) - { - player->post_delay_counter--; - } - } - } - else if (player->is_bored) - { - if (player->num_special_action_bored > 0) - { - if (player->anim_delay_counter == 0 && player->post_delay_counter == 0) - { - int special_action = - ACTION_BORING_1 + SimpleRND(player->num_special_action_bored); - int special_graphic = - el_act_dir2img(player->element_nr, special_action, move_dir); - - player->anim_delay_counter = - graphic_info[special_graphic].anim_delay_fixed + - SimpleRND(graphic_info[special_graphic].anim_delay_random); - player->post_delay_counter = - graphic_info[special_graphic].post_delay_fixed + - SimpleRND(graphic_info[special_graphic].post_delay_random); - - player->special_action_bored = special_action; - } - - if (player->anim_delay_counter > 0) - { - action = player->special_action_bored; - player->anim_delay_counter--; - } - else if (player->post_delay_counter > 0) - { - player->post_delay_counter--; - } - } - } - - return action; -} - static int getPlayerGraphic(struct PlayerInfo *player, int move_dir) { if (player->use_murphy_graphic) @@ -714,7 +630,7 @@ void DrawPlayer(struct PlayerInfo *player) #if 1 - action = getPlayerAction(player, move_dir); + action = GetPlayerAction(player, move_dir); #else