From: Holger Schemel Date: Tue, 15 Aug 2006 23:48:34 +0000 (+0200) Subject: rnd-20060816-1-src X-Git-Tag: 3.2.1^2~12 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=f7704e2d22e9499efe6380e0c916c2bd4918e4be;p=rocksndiamonds.git rnd-20060816-1-src * added some more smooth screen fadings (game start, hall of fame etc.) --- diff --git a/ChangeLog b/ChangeLog index 6fd0529f..53c04a0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,6 @@ 2006-08-15 * changed behaviour after solved game -- do not immediately stop engine + * added some more smooth screen fadings (game start, hall of fame etc.) 2006-08-14 * fixed bug with displaying pushed CE with value/score/delay anim_mode diff --git a/src/conftime.h b/src/conftime.h index 4e32acc8..82074bec 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-08-15 22:10]" +#define COMPILE_DATE_STRING "[2006-08-16 01:45]" diff --git a/src/events.c b/src/events.c index 3e159dc4..4cb4b109 100644 --- a/src/events.c +++ b/src/events.c @@ -772,54 +772,58 @@ void HandleKey(Key key, int key_status) case GAME_MODE_LEVELS: case GAME_MODE_SETUP: case GAME_MODE_INFO: + case GAME_MODE_SCORES: switch(key) { -#if 1 - case KSYM_space: -#else - /* !!! only use "space" key to start game from main menu !!! */ case KSYM_space: -#endif case KSYM_Return: if (game_status == GAME_MODE_TITLE) - HandleTitleScreen(0,0, 0,0, MB_MENU_CHOICE); + HandleTitleScreen(0, 0, 0, 0, MB_MENU_CHOICE); else if (game_status == GAME_MODE_MAIN) - HandleMainMenu(0,0, 0,0, MB_MENU_CHOICE); + HandleMainMenu(0, 0, 0, 0, MB_MENU_CHOICE); else if (game_status == GAME_MODE_LEVELS) - HandleChooseLevel(0,0, 0,0, MB_MENU_CHOICE); + HandleChooseLevel(0, 0, 0, 0, MB_MENU_CHOICE); else if (game_status == GAME_MODE_SETUP) - HandleSetupScreen(0,0, 0,0, MB_MENU_CHOICE); + HandleSetupScreen(0, 0, 0, 0, MB_MENU_CHOICE); else if (game_status == GAME_MODE_INFO) - HandleInfoScreen(0,0, 0,0, MB_MENU_CHOICE); + HandleInfoScreen(0, 0, 0, 0, MB_MENU_CHOICE); + else if (game_status == GAME_MODE_SCORES) + HandleHallOfFame(0, 0, 0, 0, MB_MENU_CHOICE); break; case KSYM_Escape: if (game_status == GAME_MODE_TITLE) - HandleTitleScreen(0,0, 0,0, MB_MENU_LEAVE); + HandleTitleScreen(0, 0, 0, 0, MB_MENU_LEAVE); else if (game_status == GAME_MODE_LEVELS) - HandleChooseLevel(0,0, 0,0, MB_MENU_LEAVE); + HandleChooseLevel(0, 0, 0, 0, MB_MENU_LEAVE); else if (game_status == GAME_MODE_SETUP) - HandleSetupScreen(0,0, 0,0, MB_MENU_LEAVE); + HandleSetupScreen(0, 0, 0, 0, MB_MENU_LEAVE); else if (game_status == GAME_MODE_INFO) - HandleInfoScreen(0,0, 0,0, MB_MENU_LEAVE); + HandleInfoScreen(0, 0, 0, 0, MB_MENU_LEAVE); + else if (game_status == GAME_MODE_SCORES) + HandleHallOfFame(0, 0, 0, 0, MB_MENU_LEAVE); break; case KSYM_Page_Up: if (game_status == GAME_MODE_LEVELS) - HandleChooseLevel(0,0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK); + HandleChooseLevel(0, 0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK); else if (game_status == GAME_MODE_SETUP) - HandleSetupScreen(0,0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK); + HandleSetupScreen(0, 0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK); else if (game_status == GAME_MODE_INFO) - HandleInfoScreen(0,0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK); + HandleInfoScreen(0, 0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK); + else if (game_status == GAME_MODE_SCORES) + HandleHallOfFame(0, 0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK); break; case KSYM_Page_Down: if (game_status == GAME_MODE_LEVELS) - HandleChooseLevel(0,0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK); + HandleChooseLevel(0, 0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK); else if (game_status == GAME_MODE_SETUP) - HandleSetupScreen(0,0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK); + HandleSetupScreen(0, 0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK); else if (game_status == GAME_MODE_INFO) - HandleInfoScreen(0,0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK); + HandleInfoScreen(0, 0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK); + else if (game_status == GAME_MODE_SCORES) + HandleHallOfFame(0, 0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK); break; #ifdef DEBUG @@ -833,28 +837,37 @@ void HandleKey(Key key, int key_status) } break; +#if 0 case GAME_MODE_SCORES: switch(key) { case KSYM_space: case KSYM_Return: + HandleHallOfFame(0, 0, 0, 0, MB_MENU_CHOICE); + break; + case KSYM_Escape: +#if 1 + HandleHallOfFame(0, 0, 0, 0, MB_MENU_LEAVE); +#else game_status = GAME_MODE_MAIN; DrawMainMenu(); +#endif break; case KSYM_Page_Up: - HandleHallOfFame(0,0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK); + HandleHallOfFame(0, 0, 0, -1 * SCROLL_PAGE, MB_MENU_MARK); break; case KSYM_Page_Down: - HandleHallOfFame(0,0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK); + HandleHallOfFame(0, 0, 0, +1 * SCROLL_PAGE, MB_MENU_MARK); break; default: break; } break; +#endif case GAME_MODE_EDITOR: if (!anyTextGadgetActiveOrJustFinished || key == KSYM_Escape) @@ -1043,20 +1056,20 @@ void HandleJoystick() newbutton = dx = dy = 0; if (game_status == GAME_MODE_TITLE) - HandleTitleScreen(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); + HandleTitleScreen(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); else if (game_status == GAME_MODE_MAIN) - HandleMainMenu(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); + HandleMainMenu(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); else if (game_status == GAME_MODE_LEVELS) - HandleChooseLevel(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); + HandleChooseLevel(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); else if (game_status == GAME_MODE_SETUP) - HandleSetupScreen(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); + HandleSetupScreen(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); else if (game_status == GAME_MODE_INFO) - HandleInfoScreen(0,0,dx,dy,newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); + HandleInfoScreen(0,0,dx,dy, newbutton ? MB_MENU_CHOICE : MB_MENU_MARK); break; } case GAME_MODE_SCORES: - HandleHallOfFame(0,0, dx,dy, !newbutton); + HandleHallOfFame(0, 0, dx, dy, !newbutton); break; case GAME_MODE_EDITOR: diff --git a/src/game.c b/src/game.c index 914661d1..aa9fa6f4 100644 --- a/src/game.c +++ b/src/game.c @@ -2037,8 +2037,11 @@ void InitGame() boolean emulate_bd = TRUE; /* unless non-BOULDERDASH elements found */ boolean emulate_sb = TRUE; /* unless non-SOKOBAN elements found */ boolean emulate_sp = TRUE; /* unless non-SUPAPLEX elements found */ + boolean do_fading = (game_status == GAME_MODE_MAIN); int i, j, x, y; + game_status = GAME_MODE_PLAYING; + InitGameEngine(); /* don't play tapes over network */ @@ -2629,6 +2632,11 @@ void InitGame() local_player->jy - MIDPOSY); } + StopAnimation(); + + if (do_fading) + FadeOutField(TITLE_SCREEN_FADE_DELAY, TITLE_SCREEN_POST_DELAY); + if (!game.restart_level) CloseDoor(DOOR_CLOSE_1); @@ -2650,10 +2658,16 @@ void InitGame() BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY); redraw_mask |= REDRAW_FROM_BACKBUFFER; + +#if 0 FadeToFront(); +#endif } /* !!! FIX THIS (END) !!! */ + if (do_fading) + FadeInField(TITLE_SCREEN_FADE_DELAY); + if (!game.restart_level) { /* copy default game door content to main double buffer */ @@ -3045,9 +3059,11 @@ void GameEnd() if (!local_player->LevelSolved_SaveScore) { + FadeOutField(TITLE_SCREEN_FADE_DELAY, TITLE_SCREEN_POST_DELAY); + game_status = GAME_MODE_MAIN; - DrawMainMenu(); + DrawMainMenuExt(TITLE_SCREEN_FADE_DELAY, REDRAW_FIELD); return; } @@ -3077,6 +3093,8 @@ void GameEnd() } else { + FadeOutField(TITLE_SCREEN_FADE_DELAY, TITLE_SCREEN_POST_DELAY); + game_status = GAME_MODE_MAIN; if (raise_level) @@ -3085,7 +3103,7 @@ void GameEnd() TapeErase(); } - DrawMainMenu(); + DrawMainMenuExt(TITLE_SCREEN_FADE_DELAY, REDRAW_FIELD); } local_player->LevelSolved_SaveScore = FALSE; @@ -9827,10 +9845,6 @@ void StartGameActions(boolean init_network_game, boolean record_tape, } #endif - StopAnimation(); - - game_status = GAME_MODE_PLAYING; - InitGame(); } @@ -13412,8 +13426,20 @@ void RequestQuitGame(boolean ask_if_really_quit) else #endif { - game_status = GAME_MODE_MAIN; - DrawMainMenu(); + if (!ask_if_really_quit || level_editor_test_game) + { + game_status = GAME_MODE_MAIN; + + DrawMainMenu(); + } + else + { + FadeOutField(TITLE_SCREEN_FADE_DELAY, TITLE_SCREEN_POST_DELAY); + + game_status = GAME_MODE_MAIN; + + DrawMainMenuExt(TITLE_SCREEN_FADE_DELAY, REDRAW_FIELD); + } } } else diff --git a/src/game.h b/src/game.h index aff4cd5f..f855387a 100644 --- a/src/game.h +++ b/src/game.h @@ -214,7 +214,7 @@ void DrawGameValue_Time(int); void DrawGameDoorValues(void); void InitGameSound(); -void InitGame(void); +void InitGame(); void UpdateEngineValues(int, int); void GameWon(void); diff --git a/src/init.c b/src/init.c index c8c288a1..1e281a0f 100644 --- a/src/init.c +++ b/src/init.c @@ -4892,7 +4892,11 @@ void OpenAll() em_open_all(); #endif +#if 0 + DrawMainMenuExt(TITLE_SCREEN_FADE_DELAY, REDRAW_ALL); +#else DrawMainMenu(); +#endif InitNetworkServer(); } diff --git a/src/libgame/sdl.c b/src/libgame/sdl.c index 732fc9be..b85a8075 100644 --- a/src/libgame/sdl.c +++ b/src/libgame/sdl.c @@ -354,8 +354,8 @@ void SDLCopyArea(Bitmap *src_bitmap, Bitmap *dst_bitmap, SDL_UpdateRect(backbuffer->surface, dst_x, dst_y, width, height); } -void SDLFillRectangle(Bitmap *dst_bitmap, int x, int y, - int width, int height, Uint32 color) +void SDLFillRectangle(Bitmap *dst_bitmap, int x, int y, int width, int height, + Uint32 color) { Bitmap *real_dst_bitmap = (dst_bitmap == window ? backbuffer : dst_bitmap); SDL_Rect rect; @@ -377,8 +377,8 @@ void SDLFillRectangle(Bitmap *dst_bitmap, int x, int y, SDL_UpdateRect(backbuffer->surface, x, y, width, height); } -void SDLFadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay, - int post_delay) +void SDLFadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height, + int fade_mode, int fade_delay, int post_delay) { static boolean initialization_needed = TRUE; static SDL_Surface *surface_screen_copy = NULL; @@ -386,8 +386,8 @@ void SDLFadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay, SDL_Surface *surface_screen = backbuffer->surface; SDL_Surface *surface_cross; /* initialized later */ SDL_Rect src_rect, dst_rect; - int src_x = 0, src_y = 0; - int dst_x = 0, dst_y = 0; + int src_x = x, src_y = y; + int dst_x = x, dst_y = y; boolean fade_reverse = (fade_mode == FADE_MODE_FADE_IN ? TRUE : FALSE); unsigned int time_last, time_current; float alpha; @@ -395,16 +395,16 @@ void SDLFadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay, src_rect.x = src_x; src_rect.y = src_y; - src_rect.w = video.width; - src_rect.h = video.height; + src_rect.w = width; + src_rect.h = height; dst_x += video_xoffset; dst_y += video_yoffset; dst_rect.x = dst_x; dst_rect.y = dst_y; - dst_rect.w = video.width; - dst_rect.h = video.height; + dst_rect.w = width; + dst_rect.h = height; #if 0 if (!initialization_needed) @@ -496,7 +496,11 @@ void SDLFadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay, SDL_BlitSurface(surface_cross, &src_rect, surface_screen, &dst_rect); /* draw screen buffer to visible display */ +#if 1 + SDL_UpdateRect(surface_screen, dst_x, dst_y, width, height); +#else SDL_Flip(surface_screen); +#endif } Delay(post_delay); diff --git a/src/libgame/sdl.h b/src/libgame/sdl.h index c30afde6..a3104360 100644 --- a/src/libgame/sdl.h +++ b/src/libgame/sdl.h @@ -354,7 +354,7 @@ void SDLCreateBitmapContent(Bitmap *, int, int, int); void SDLFreeBitmapPointers(Bitmap *); void SDLCopyArea(Bitmap *, Bitmap *, int, int, int, int, int, int, int); void SDLFillRectangle(Bitmap *, int, int, int, int, Uint32); -void SDLFadeScreen(Bitmap *, int, int, int); +void SDLFadeRectangle(Bitmap *, int, int, int, int, int, int, int); void SDLDrawSimpleLine(Bitmap *, int, int, int, int, Uint32); void SDLDrawLine(Bitmap *, int, int, int, int, Uint32); Pixel SDLGetPixel(Bitmap *, int, int); diff --git a/src/libgame/system.c b/src/libgame/system.c index 38e341b0..c0448a8e 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -457,13 +457,15 @@ void BlitBitmap(Bitmap *src_bitmap, Bitmap *dst_bitmap, dst_x, dst_y, BLIT_OPAQUE); } -void FadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay, - int post_delay) +void FadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height, + int fade_mode, int fade_delay, int post_delay) { #if defined(TARGET_SDL) - SDLFadeScreen(bitmap_cross, fade_mode, fade_delay, post_delay); + SDLFadeRectangle(bitmap_cross, x, y, width, height, + fade_mode, fade_delay, post_delay); #else - X11FadeScreen(bitmap_cross, fade_mode, fade_delay, post_delay); + X11FadeRectangle(bitmap_cross, x, y, width, height, + fade_mode, fade_delay, post_delay); #endif } diff --git a/src/libgame/system.h b/src/libgame/system.h index 967a41e4..8fdc7881 100644 --- a/src/libgame/system.h +++ b/src/libgame/system.h @@ -1047,7 +1047,7 @@ Bitmap *CreateBitmapStruct(void); Bitmap *CreateBitmap(int, int, int); void FreeBitmap(Bitmap *); void BlitBitmap(Bitmap *, Bitmap *, int, int, int, int, int, int); -void FadeScreen(Bitmap *bitmap, int, int, int); +void FadeRectangle(Bitmap *bitmap, int, int, int, int, int, int, int); void FillRectangle(Bitmap *, int, int, int, int, Pixel); void ClearRectangle(Bitmap *, int, int, int, int); void ClearRectangleOnBackground(Bitmap *, int, int, int, int); diff --git a/src/libgame/x11.c b/src/libgame/x11.c index b0d70d55..4626324f 100644 --- a/src/libgame/x11.c +++ b/src/libgame/x11.c @@ -362,16 +362,16 @@ void X11FillRectangle(Bitmap *bitmap, int x, int y, XFillRectangle(display, bitmap->drawable, bitmap->gc, x, y, width, height); } -void X11FadeScreen(Bitmap *bitmap_cross, int fade_mode, int fade_delay, - int post_delay) +void X11FadeRectangle(Bitmap *bitmap_cross, int x, int y, int width, int height, + int fade_mode, int fade_delay, int post_delay) { /* fading currently not supported -- simply copy target image to screen */ if (fade_mode == FADE_MODE_FADE_OUT) - X11FillRectangle(window, 0, 0, video.width, video.height, BLACK_PIXEL); + X11FillRectangle(window, x, y, width, height, BLACK_PIXEL); else X11CopyArea(bitmap_cross != NULL ? bitmap_cross : backbuffer, window, - 0, 0, video.width, video.height, 0, 0, BLIT_OPAQUE); + x, y, width, height, 0, 0, BLIT_OPAQUE); /* as we currently cannot use the fade delay, also do not use post delay */ } diff --git a/src/libgame/x11.h b/src/libgame/x11.h index a7aaf38a..c14a23a1 100644 --- a/src/libgame/x11.h +++ b/src/libgame/x11.h @@ -339,7 +339,7 @@ void X11CreateBitmapContent(Bitmap *, int, int, int); void X11FreeBitmapPointers(Bitmap *); void X11CopyArea(Bitmap *, Bitmap *, int, int, int, int, int, int, int); void X11FillRectangle(Bitmap *, int, int, int, int, Pixel); -void X11FadeScreen(Bitmap *, int, int, int); +void X11FadeScreen(Bitmap *, int, int, int, int, int, int, int); void X11DrawSimpleLine(Bitmap *, int, int, int, int, Pixel); Pixel X11GetPixel(Bitmap *, int, int); Pixel X11GetPixelFromRGB(unsigned int, unsigned int, unsigned int); diff --git a/src/main.h b/src/main.h index 99cdc705..1254d9f2 100644 --- a/src/main.h +++ b/src/main.h @@ -806,6 +806,10 @@ #define MICROLEVEL_SCROLL_DELAY 50 /* delay for scrolling micro level */ #define MICROLEVEL_LABEL_DELAY 250 /* delay for micro level label */ +/* values for fading in and out */ +#define TITLE_SCREEN_FADE_DELAY 250 +#define TITLE_SCREEN_POST_DELAY (TITLE_SCREEN_FADE_DELAY / 2) + /* boundaries of arrays etc. */ #define MAX_LEVEL_NAME_LEN 32 #define MAX_LEVEL_AUTHOR_LEN 32 diff --git a/src/network.c b/src/network.c index feb79bd9..1733aba9 100644 --- a/src/network.c +++ b/src/network.c @@ -541,20 +541,7 @@ static void Handle_OP_START_PLAYING() LoadTape(level_nr); LoadLevel(level_nr); -#if 1 StartGameActions(FALSE, setup.autorecord, new_random_seed); -#else - if (setup.autorecord) - TapeStartRecording(); - - if (tape.recording) - tape.random_seed = new_random_seed; - - InitRND(new_random_seed); - - game_status = GAME_MODE_PLAYING; - InitGame(); -#endif } static void Handle_OP_PAUSE_PLAYING() diff --git a/src/screens.c b/src/screens.c index 690c27b1..0a4534b5 100644 --- a/src/screens.c +++ b/src/screens.c @@ -115,8 +115,6 @@ #define SC_BORDER_SIZE 14 -#define TITLE_SCREEN_FADE_DELAY 250 - /* forward declarations of internal functions */ static void HandleScreenGadgets(struct GadgetInfo *); @@ -301,7 +299,7 @@ void DrawTitleScreen() StopAnimation(); } -static void DrawMainMenuExt(int fade_delay) +void DrawMainMenuExt(int fade_delay, int redraw_mask) { static LevelDirTree *leveldir_last_valid = NULL; boolean levelset_has_changed = FALSE; @@ -534,7 +532,12 @@ static void DrawMainMenuExt(int fade_delay) #if 1 #if 1 - FadeIn(fade_delay); + if (redraw_mask == REDRAW_FIELD) + FadeInField(fade_delay); + else if (redraw_mask == REDRAW_ALL) + FadeIn(fade_delay); + + BackToFront(); #else BackToFront(); #endif @@ -551,7 +554,7 @@ static void DrawMainMenuExt(int fade_delay) void DrawMainMenu() { - DrawMainMenuExt(0); + DrawMainMenuExt(0, REDRAW_ALL); } #if 0 @@ -592,7 +595,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) boolean use_fading_main_menu = TRUE; boolean use_cross_fading = TRUE; int fade_delay = TITLE_SCREEN_FADE_DELAY; - int post_delay = fade_delay / 2; + int post_delay = TITLE_SCREEN_POST_DELAY; if (button == MB_MENU_INITIALIZE) { @@ -694,7 +697,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); game_status = GAME_MODE_MAIN; - DrawMainMenuExt(menu_fade_delay); + DrawMainMenuExt(menu_fade_delay, REDRAW_ALL); } } } @@ -1445,6 +1448,7 @@ void HandleInfoScreen_Music(int button) if (button_released || button == MB_MENU_INITIALIZE) { + Bitmap *drawto_last = drawto; int y = 0; if (button != MB_MENU_INITIALIZE) @@ -1461,6 +1465,9 @@ void HandleInfoScreen_Music(int button) FadeSoundsAndMusic(); + if (button != MB_MENU_INITIALIZE) + drawto = bitmap_db_title; + ClearWindow(); DrawHeadline(); @@ -1522,6 +1529,11 @@ void HandleInfoScreen_Music(int button) DrawTextSCentered(ybottom, FONT_TEXT_4, "Press any key or button for next page"); + + drawto = drawto_last; + + if (button != MB_MENU_INITIALIZE) + FadeCrossField(TITLE_SCREEN_FADE_DELAY); } if (list != NULL && list->is_sound && sound_info[list->music].loop) @@ -1726,9 +1738,22 @@ void HandleInfoScreen_Credits(int button) } else if (button == MB_MENU_CHOICE) { + Bitmap *drawto_last = drawto; + boolean show_screen; + screen_nr++; - if (!DrawInfoScreen_CreditsScreen(screen_nr)) + drawto = bitmap_db_title; + + show_screen = DrawInfoScreen_CreditsScreen(screen_nr); + + drawto = drawto_last; + + if (show_screen) + { + FadeCrossField(TITLE_SCREEN_FADE_DELAY); + } + else { FadeSoundsAndMusic(); @@ -2395,13 +2420,19 @@ void DrawHallOfFame(int highlight_position) if (highlight_position < 0) LoadScore(level_nr); + FadeOutField(TITLE_SCREEN_FADE_DELAY, TITLE_SCREEN_POST_DELAY); + +#if 0 FadeToFront(); +#endif InitAnimation(); PlayMenuSound(); PlayMenuMusic(); HandleHallOfFame(highlight_position, 0, 0, 0, MB_MENU_INITIALIZE); + + FadeInField(TITLE_SCREEN_FADE_DELAY); } static void drawHallOfFameList(int first_entry, int highlight_position) @@ -2452,7 +2483,6 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button) static int first_entry = 0; static int highlight_position = 0; int step = (button == 1 ? 1 : button == 2 ? 5 : 10); - int button_released = !button; if (button == MB_MENU_INITIALIZE) { @@ -2488,11 +2518,22 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button) drawHallOfFameList(first_entry, highlight_position); } } - else if (button_released) + else if (button == MB_MENU_LEAVE) { FadeSound(SND_BACKGROUND_SCORES); + game_status = GAME_MODE_MAIN; - DrawMainMenu(); + + DrawMainMenuExt(0, REDRAW_FIELD); + } + else if (button == MB_MENU_CHOICE) + { + FadeSound(SND_BACKGROUND_SCORES); + FadeOutField(TITLE_SCREEN_FADE_DELAY, TITLE_SCREEN_POST_DELAY); + + game_status = GAME_MODE_MAIN; + + DrawMainMenuExt(TITLE_SCREEN_FADE_DELAY, REDRAW_FIELD); } if (game_status == GAME_MODE_SCORES) diff --git a/src/screens.h b/src/screens.h index e895c4fe..17eec4d3 100644 --- a/src/screens.h +++ b/src/screens.h @@ -21,6 +21,7 @@ #define SCROLL_PAGE (2 * SCR_FIELDY) +void DrawMainMenuExt(int, int); void DrawMainMenu(void); void DrawHallOfFame(int); diff --git a/src/tape.c b/src/tape.c index 2f912cff..9387b3a5 100644 --- a/src/tape.c +++ b/src/tape.c @@ -542,14 +542,14 @@ static void TapeStartGameRecording() #if defined(NETWORK_AVALIABLE) if (options.network) - SendToServer_StartPlaying(); - else -#endif { - game_status = GAME_MODE_PLAYING; - StopAnimation(); - InitGame(); + SendToServer_StartPlaying(); + + return; } +#endif + + InitGame(); } static void TapeAppendRecording() @@ -706,8 +706,6 @@ static void TapeStartGamePlaying() { TapeStartPlaying(); - game_status = GAME_MODE_PLAYING; - StopAnimation(); InitGame(); } diff --git a/src/tools.c b/src/tools.c index 9d376086..8d0fe8de 100644 --- a/src/tools.c +++ b/src/tools.c @@ -423,7 +423,8 @@ void FadeIn(int fade_delay) return; } - FadeScreen(NULL, FADE_MODE_FADE_IN, fade_delay, 0); + FadeRectangle(NULL, 0, 0, WIN_XSIZE, WIN_YSIZE, + FADE_MODE_FADE_IN, fade_delay, 0); redraw_mask = REDRAW_NONE; } @@ -438,7 +439,8 @@ void FadeOut(int fade_delay, int post_delay) return; } - FadeScreen(NULL, FADE_MODE_FADE_OUT, fade_delay, post_delay); + FadeRectangle(NULL, 0, 0, WIN_XSIZE, WIN_YSIZE, + FADE_MODE_FADE_OUT, fade_delay, post_delay); redraw_mask = REDRAW_NONE; } @@ -453,11 +455,60 @@ void FadeCross(int fade_delay) return; } - FadeScreen(bitmap_db_title, FADE_MODE_CROSSFADE, fade_delay, 0); + FadeRectangle(bitmap_db_title, 0, 0, WIN_XSIZE, WIN_YSIZE, + FADE_MODE_CROSSFADE, fade_delay, 0); redraw_mask = REDRAW_NONE; } +void FadeInField(int fade_delay) +{ + if (fade_delay == 0) + { + BackToFront(); + + return; + } + + FadeRectangle(NULL, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE, + FADE_MODE_FADE_IN, fade_delay, 0); + + redraw_mask &= ~REDRAW_FIELD; +} + +void FadeOutField(int fade_delay, int post_delay) +{ + if (fade_delay == 0) + { + ClearRectangle(backbuffer, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE); + BackToFront(); + + return; + } + + FadeRectangle(NULL, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE, + FADE_MODE_FADE_OUT, fade_delay, post_delay); + + redraw_mask &= ~REDRAW_FIELD; +} + +void FadeCrossField(int fade_delay) +{ + if (fade_delay == 0) + { + BlitBitmap(bitmap_db_title, backbuffer, REAL_SX, REAL_SY, + FULL_SXSIZE, FULL_SYSIZE, REAL_SX, REAL_SY); + BackToFront(); + + return; + } + + FadeRectangle(bitmap_db_title, REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE, + FADE_MODE_CROSSFADE, fade_delay, 0); + + redraw_mask &= ~REDRAW_FIELD; +} + void SetMainBackgroundImageIfDefined(int graphic) { if (graphic_info[graphic].bitmap) @@ -490,7 +541,11 @@ void SetPanelBackground() void DrawBackground(int dst_x, int dst_y, int width, int height) { +#if 1 + ClearRectangleOnBackground(drawto, dst_x, dst_y, width, height); +#else ClearRectangleOnBackground(backbuffer, dst_x, dst_y, width, height); +#endif redraw_mask |= REDRAW_FIELD; } diff --git a/src/tools.h b/src/tools.h index 1174199e..55929e50 100644 --- a/src/tools.h +++ b/src/tools.h @@ -70,6 +70,9 @@ void FadeToFront(); void FadeIn(int); void FadeOut(int, int); void FadeCross(int); +void FadeInField(int); +void FadeOutField(int, int); +void FadeCrossField(int); void ClearWindow(); void SetMainBackgroundImageIfDefined(int);