X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=1230cf0ab482d1e455907ffba4c854c0677b48c8;hb=7b3991f74b0e0dc6774453a59e674696560c2d93;hp=324bd45bf150f22d8964a81506922b8724d88410;hpb=deb451e04c703615d19fd5c3b6863499c09ae2ba;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index 324bd45b..1230cf0a 100644 --- a/src/tools.c +++ b/src/tools.c @@ -2981,7 +2981,7 @@ void DrawMiniLevel(int size_x, int size_y, int scroll_x, int scroll_y) redraw_mask |= REDRAW_FIELD; } -static void DrawPreviewLevelPlayfieldExt(int from_x, int from_y) +static void DrawPreviewLevelPlayfield(int from_x, int from_y) { boolean show_level_border = (BorderElement != EL_EMPTY); int level_xsize = lev_fieldx + (show_level_border ? 2 : 0); @@ -3046,9 +3046,8 @@ static int getMaxTextLength(struct TextPosInfo *pos, int font_nr) return max_text_width / font_width; } -static void DrawPreviewLevelLabelExt(int mode) +static void DrawPreviewLevelLabelExt(int mode, struct TextPosInfo *pos) { - struct TextPosInfo *pos = &menu.main.text.level_info_2; char label_text[MAX_OUTPUT_LINESIZE + 1]; int max_len_label_text; int font_nr = pos->font; @@ -3091,6 +3090,19 @@ static void DrawPreviewLevelLabelExt(int mode) redraw_mask |= REDRAW_FIELD; } +static void DrawPreviewLevelLabel(int mode) +{ + DrawPreviewLevelLabelExt(mode, &menu.main.text.level_info_2); +} + +static void DrawPreviewLevelInfo(int mode) +{ + if (mode == MICROLABEL_LEVEL_NAME) + DrawPreviewLevelLabelExt(mode, &menu.main.text.level_name); + else if (mode == MICROLABEL_LEVEL_AUTHOR) + DrawPreviewLevelLabelExt(mode, &menu.main.text.level_author); +} + static void DrawPreviewLevelExt(boolean restart) { static unsigned int scroll_delay = 0; @@ -3122,8 +3134,11 @@ static void DrawPreviewLevelExt(boolean restart) label_state = 1; label_counter = 0; - DrawPreviewLevelPlayfieldExt(from_x, from_y); - DrawPreviewLevelLabelExt(label_state); + DrawPreviewLevelPlayfield(from_x, from_y); + DrawPreviewLevelLabel(label_state); + + DrawPreviewLevelInfo(MICROLABEL_LEVEL_NAME); + DrawPreviewLevelInfo(MICROLABEL_LEVEL_AUTHOR); /* initialize delay counters */ DelayReached(&scroll_delay, 0); @@ -3202,7 +3217,7 @@ static void DrawPreviewLevelExt(boolean restart) break; } - DrawPreviewLevelPlayfieldExt(from_x, from_y); + DrawPreviewLevelPlayfield(from_x, from_y); } /* !!! THIS ALL SUCKS -- SHOULD BE CLEANLY REWRITTEN !!! */ @@ -3243,7 +3258,7 @@ static void DrawPreviewLevelExt(boolean restart) label_state = (label_state == MICROLABEL_IMPORTED_FROM_HEAD ? MICROLABEL_IMPORTED_BY_HEAD : MICROLABEL_IMPORTED_BY); - DrawPreviewLevelLabelExt(label_state); + DrawPreviewLevelLabel(label_state); } } @@ -3762,12 +3777,10 @@ void WaitForEventToContinue() while (still_wait) { - if (PendingEvent()) - { - Event event; - - NextEvent(&event); + Event event; + if (NextValidEvent(&event)) + { switch (event.type) { case EVENT_BUTTONPRESS: @@ -4866,6 +4879,9 @@ unsigned int MoveDoor(unsigned int door_state) SkipUntilDelayReached(&door_delay, door_delay_value, &k, last_frame); current_move_delay += max_step_delay; + + /* prevent OS (Windows) from complaining about program not responding */ + CheckQuitEvent(); } if (door_part_done_all) @@ -8482,7 +8498,7 @@ void PlayMenuMusicExt(int music) void PlayMenuMusic() { char *curr_music = getCurrentlyPlayingMusicFilename(); - char *next_music = getMusicListEntry(menu.music[game_status])->filename; + char *next_music = getMusicInfoEntryFilename(menu.music[game_status]); if (!strEqual(curr_music, next_music)) PlayMenuMusicExt(menu.music[game_status]); @@ -8502,7 +8518,7 @@ static void FadeMenuSounds() static void FadeMenuMusic() { char *curr_music = getCurrentlyPlayingMusicFilename(); - char *next_music = getMusicListEntry(menu.music[game_status])->filename; + char *next_music = getMusicInfoEntryFilename(menu.music[game_status]); if (!strEqual(curr_music, next_music)) FadeMusic();