From: Holger Schemel Date: Wed, 16 Aug 2006 19:25:59 +0000 (+0200) Subject: rnd-20060816-2-src X-Git-Tag: 3.2.1^2~11 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=c0c5862d9ee59c70412b1c35e558101b109a8ec9;p=rocksndiamonds.git rnd-20060816-2-src --- diff --git a/src/conf_gfx.c b/src/conf_gfx.c index f0c99a79..3a5a7a86 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -4535,6 +4535,9 @@ struct ConfigInfo image_config[] = { "menu.list_size.SCORES", "-1" }, { "menu.list_size.INFO", "-1" }, + { "menu.fade_delay", "250" }, + { "menu.post_delay", "125" }, + { "door_1.width", "-1" }, { "door_1.height", "-1" }, { "door_1.step_offset", "2" }, diff --git a/src/conftime.h b/src/conftime.h index 82074bec..a4d3e98d 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "[2006-08-16 01:45]" +#define COMPILE_DATE_STRING "[2006-08-16 21:23]" diff --git a/src/game.c b/src/game.c index aa9fa6f4..4e4c901c 100644 --- a/src/game.c +++ b/src/game.c @@ -2634,12 +2634,12 @@ void InitGame() StopAnimation(); - if (do_fading) - FadeOutField(TITLE_SCREEN_FADE_DELAY, TITLE_SCREEN_POST_DELAY); - if (!game.restart_level) CloseDoor(DOOR_CLOSE_1); + if (do_fading) + FadeOut(REDRAW_FIELD); + /* !!! FIX THIS (START) !!! */ if (level.game_engine_type == GAME_ENGINE_TYPE_EM) { @@ -2666,7 +2666,7 @@ void InitGame() /* !!! FIX THIS (END) !!! */ if (do_fading) - FadeInField(TITLE_SCREEN_FADE_DELAY); + FadeIn(REDRAW_FIELD); if (!game.restart_level) { @@ -3059,11 +3059,11 @@ void GameEnd() if (!local_player->LevelSolved_SaveScore) { - FadeOutField(TITLE_SCREEN_FADE_DELAY, TITLE_SCREEN_POST_DELAY); + FadeOut(REDRAW_FIELD); game_status = GAME_MODE_MAIN; - DrawMainMenuExt(TITLE_SCREEN_FADE_DELAY, REDRAW_FIELD); + DrawAndFadeInMainMenu(REDRAW_FIELD); return; } @@ -3093,7 +3093,7 @@ void GameEnd() } else { - FadeOutField(TITLE_SCREEN_FADE_DELAY, TITLE_SCREEN_POST_DELAY); + FadeOut(REDRAW_FIELD); game_status = GAME_MODE_MAIN; @@ -3103,7 +3103,7 @@ void GameEnd() TapeErase(); } - DrawMainMenuExt(TITLE_SCREEN_FADE_DELAY, REDRAW_FIELD); + DrawAndFadeInMainMenu(REDRAW_FIELD); } local_player->LevelSolved_SaveScore = FALSE; @@ -13434,11 +13434,11 @@ void RequestQuitGame(boolean ask_if_really_quit) } else { - FadeOutField(TITLE_SCREEN_FADE_DELAY, TITLE_SCREEN_POST_DELAY); + FadeOut(REDRAW_FIELD); game_status = GAME_MODE_MAIN; - DrawMainMenuExt(TITLE_SCREEN_FADE_DELAY, REDRAW_FIELD); + DrawAndFadeInMainMenu(REDRAW_FIELD); } } } diff --git a/src/game_em/graphics.c b/src/game_em/graphics.c index 9aff1644..800ee03f 100644 --- a/src/game_em/graphics.c +++ b/src/game_em/graphics.c @@ -1028,11 +1028,13 @@ void RedrawPlayfield_EM(boolean force_redraw) for (i = 0; i < MAX_PLAYERS; i++) blitplayer(&ply[i]); +#if 0 SyncDisplay(); blitscreen(); FlushDisplay(); +#endif } void game_animscreen(void) diff --git a/src/game_em/input.c b/src/game_em/input.c index 353b36ee..2c6c1faa 100644 --- a/src/game_em/input.c +++ b/src/game_em/input.c @@ -62,6 +62,9 @@ void InitGameEngine_EM() game_initscreen(); game_animscreen(); + + /* blit playfield from scroll buffer to back buffer for fading in */ + BlitScreenToBitmap_EM(backbuffer); } void GameActions_EM(byte action[MAX_PLAYERS], boolean warp_mode) @@ -70,6 +73,14 @@ void GameActions_EM(byte action[MAX_PLAYERS], boolean warp_mode) game_animscreen(); +#if 1 + SyncDisplay(); + + blitscreen(); + + FlushDisplay(); +#endif + RandomEM = RandomEM * 129 + 1; frame = (frame - 1) & 7; diff --git a/src/init.c b/src/init.c index 1e281a0f..e8bf10b6 100644 --- a/src/init.c +++ b/src/init.c @@ -4496,7 +4496,7 @@ void InitGfx() Error(ERR_EXIT, "cannot get filename for '%s'", CONFIG_TOKEN_FONT_INITIAL); /* create additional image buffers for double-buffering and cross-fading */ - bitmap_db_title = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH); + bitmap_db_cross = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH); bitmap_db_field = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH); bitmap_db_panel = CreateBitmap(DXSIZE, DYSIZE, DEFAULT_DEPTH); bitmap_db_door = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH); @@ -4893,7 +4893,7 @@ void OpenAll() #endif #if 0 - DrawMainMenuExt(TITLE_SCREEN_FADE_DELAY, REDRAW_ALL); + DrawMainMenuExt(REDRAW_ALL); #else DrawMainMenu(); #endif diff --git a/src/libgame/system.c b/src/libgame/system.c index c0448a8e..264a3366 100644 --- a/src/libgame/system.c +++ b/src/libgame/system.c @@ -327,6 +327,7 @@ void InitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window, video.width = width; video.height = height; video.depth = GetRealDepth(depth); + video.fullscreen_available = FULLSCREEN_STATUS; video.fullscreen_enabled = FALSE; video.fullscreen_modes = NULL; diff --git a/src/main.c b/src/main.c index 1d48c5d8..f09dbd62 100644 --- a/src/main.c +++ b/src/main.c @@ -20,7 +20,7 @@ #include "events.h" #include "config.h" -Bitmap *bitmap_db_title; +Bitmap *bitmap_db_cross; Bitmap *bitmap_db_field; Bitmap *bitmap_db_panel; Bitmap *bitmap_db_door; @@ -4664,6 +4664,9 @@ struct TokenIntPtrInfo image_config_vars[] = { "menu.list_size.SCORES", &menu.list_size[GFX_SPECIAL_ARG_SCORES] }, { "menu.list_size.INFO", &menu.list_size[GFX_SPECIAL_ARG_INFO] }, + { "menu.fade_delay", &menu.fade_delay }, + { "menu.post_delay", &menu.post_delay }, + { "door_1.width", &door_1.width }, { "door_1.height", &door_1.height }, { "door_1.step_offset", &door_1.step_offset }, diff --git a/src/main.h b/src/main.h index 1254d9f2..cd6ffe2b 100644 --- a/src/main.h +++ b/src/main.h @@ -806,10 +806,6 @@ #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 @@ -1846,6 +1842,9 @@ struct MenuInfo int list_size[NUM_SPECIAL_GFX_ARGS]; + int fade_delay; + int post_delay; + int sound[NUM_SPECIAL_GFX_ARGS]; int music[NUM_SPECIAL_GFX_ARGS]; }; @@ -2348,7 +2347,7 @@ struct HelpAnimInfo }; -extern Bitmap *bitmap_db_title; +extern Bitmap *bitmap_db_cross; extern Bitmap *bitmap_db_field; extern Bitmap *bitmap_db_panel; extern Bitmap *bitmap_db_door; diff --git a/src/screens.c b/src/screens.c index 0a4534b5..05956c4c 100644 --- a/src/screens.c +++ b/src/screens.c @@ -299,7 +299,7 @@ void DrawTitleScreen() StopAnimation(); } -void DrawMainMenuExt(int fade_delay, int redraw_mask) +void DrawMainMenuExt(int redraw_mask, boolean do_fading) { static LevelDirTree *leveldir_last_valid = NULL; boolean levelset_has_changed = FALSE; @@ -532,12 +532,10 @@ void DrawMainMenuExt(int fade_delay, int redraw_mask) #if 1 #if 1 - if (redraw_mask == REDRAW_FIELD) - FadeInField(fade_delay); - else if (redraw_mask == REDRAW_ALL) - FadeIn(fade_delay); - - BackToFront(); + if (do_fading) + FadeIn(redraw_mask); + else + BackToFront(); #else BackToFront(); #endif @@ -552,9 +550,14 @@ void DrawMainMenuExt(int fade_delay, int redraw_mask) #endif } +void DrawAndFadeInMainMenu(int redraw_mask) +{ + DrawMainMenuExt(redraw_mask, TRUE); +} + void DrawMainMenu() { - DrawMainMenuExt(0, REDRAW_ALL); + DrawMainMenuExt(REDRAW_ALL, FALSE); } #if 0 @@ -594,8 +597,6 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) boolean return_to_main_menu = FALSE; boolean use_fading_main_menu = TRUE; boolean use_cross_fading = TRUE; - int fade_delay = TITLE_SCREEN_FADE_DELAY; - int post_delay = TITLE_SCREEN_POST_DELAY; if (button == MB_MENU_INITIALIZE) { @@ -614,7 +615,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) FadeSoundsAndMusic(); - FadeOut(fade_delay, post_delay); + FadeOut(REDRAW_ALL); } /* force TITLE music on title info screen */ @@ -627,7 +628,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) DrawTitleScreenImage(title_nr); - FadeIn(fade_delay); + FadeIn(REDRAW_ALL); return; } @@ -650,7 +651,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) title_nr++; if (!use_cross_fading) - FadeOut(fade_delay, post_delay); + FadeOut(REDRAW_ALL); if (title_nr < MAX_NUM_TITLE_SCREENS && graphic_info[IMG_TITLESCREEN_1 + title_nr].bitmap != NULL) @@ -658,22 +659,22 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) Bitmap *drawto_last = drawto; if (use_cross_fading) - drawto = bitmap_db_title; + drawto = bitmap_db_cross; DrawTitleScreenImage(title_nr); drawto = drawto_last; if (use_cross_fading) - FadeCross(fade_delay); + FadeCross(REDRAW_ALL); else - FadeIn(fade_delay); + FadeIn(REDRAW_ALL); } else { FadeSoundsAndMusic(); - FadeOut(fade_delay, post_delay); + FadeOut(REDRAW_ALL); return_to_main_menu = TRUE; } @@ -681,8 +682,6 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) if (return_to_main_menu) { - int menu_fade_delay = (use_fading_main_menu ? fade_delay : 0); - RedrawBackground(); if (game_status == GAME_MODE_INFO) @@ -690,14 +689,14 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) OpenDoor(DOOR_CLOSE_1 | DOOR_CLOSE_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); info_mode = INFO_MODE_MAIN; - DrawInfoScreenExt(menu_fade_delay); + DrawInfoScreenExt(use_fading_main_menu); } else /* default: return to main menu */ { OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); game_status = GAME_MODE_MAIN; - DrawMainMenuExt(menu_fade_delay, REDRAW_ALL); + DrawMainMenuExt(REDRAW_ALL, use_fading_main_menu); } } } @@ -994,7 +993,7 @@ static struct TokenInfo info_info_main[] = { 0, NULL, NULL } }; -static void DrawInfoScreen_Main(int fade_delay) +static void DrawInfoScreen_Main(boolean do_fading) { int i; @@ -1037,7 +1036,11 @@ static void DrawInfoScreen_Main(int fade_delay) PlayMenuSound(); PlayMenuMusic(); - FadeIn(fade_delay); + if (do_fading) + FadeIn(REDRAW_ALL); + else + BackToFront(); + InitAnimation(); #else @@ -1466,7 +1469,7 @@ void HandleInfoScreen_Music(int button) FadeSoundsAndMusic(); if (button != MB_MENU_INITIALIZE) - drawto = bitmap_db_title; + drawto = bitmap_db_cross; ClearWindow(); DrawHeadline(); @@ -1533,7 +1536,7 @@ void HandleInfoScreen_Music(int button) drawto = drawto_last; if (button != MB_MENU_INITIALIZE) - FadeCrossField(TITLE_SCREEN_FADE_DELAY); + FadeCross(REDRAW_FIELD); } if (list != NULL && list->is_sound && sound_info[list->music].loop) @@ -1743,7 +1746,7 @@ void HandleInfoScreen_Credits(int button) screen_nr++; - drawto = bitmap_db_title; + drawto = bitmap_db_cross; show_screen = DrawInfoScreen_CreditsScreen(screen_nr); @@ -1751,7 +1754,7 @@ void HandleInfoScreen_Credits(int button) if (show_screen) { - FadeCrossField(TITLE_SCREEN_FADE_DELAY); + FadeCross(REDRAW_FIELD); } else { @@ -1893,7 +1896,7 @@ void HandleInfoScreen_LevelSet(int button) } } -static void DrawInfoScreenExt(int fade_delay) +static void DrawInfoScreenExt(boolean do_fading) { SetMainBackgroundImage(IMG_BACKGROUND_INFO); @@ -1910,7 +1913,7 @@ static void DrawInfoScreenExt(int fade_delay) else if (info_mode == INFO_MODE_LEVELSET) DrawInfoScreen_LevelSet(); else - DrawInfoScreen_Main(fade_delay); + DrawInfoScreen_Main(do_fading); if (info_mode != INFO_MODE_MAIN && info_mode != INFO_MODE_TITLE && @@ -2420,7 +2423,7 @@ void DrawHallOfFame(int highlight_position) if (highlight_position < 0) LoadScore(level_nr); - FadeOutField(TITLE_SCREEN_FADE_DELAY, TITLE_SCREEN_POST_DELAY); + FadeOut(REDRAW_FIELD); #if 0 FadeToFront(); @@ -2432,7 +2435,7 @@ void DrawHallOfFame(int highlight_position) HandleHallOfFame(highlight_position, 0, 0, 0, MB_MENU_INITIALIZE); - FadeInField(TITLE_SCREEN_FADE_DELAY); + FadeIn(REDRAW_FIELD); } static void drawHallOfFameList(int first_entry, int highlight_position) @@ -2524,16 +2527,16 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button) game_status = GAME_MODE_MAIN; - DrawMainMenuExt(0, REDRAW_FIELD); + DrawMainMenu(); } else if (button == MB_MENU_CHOICE) { FadeSound(SND_BACKGROUND_SCORES); - FadeOutField(TITLE_SCREEN_FADE_DELAY, TITLE_SCREEN_POST_DELAY); + FadeOut(REDRAW_FIELD); game_status = GAME_MODE_MAIN; - DrawMainMenuExt(TITLE_SCREEN_FADE_DELAY, REDRAW_FIELD); + DrawAndFadeInMainMenu(REDRAW_FIELD); } if (game_status == GAME_MODE_SCORES) diff --git a/src/screens.h b/src/screens.h index 17eec4d3..f54106e2 100644 --- a/src/screens.h +++ b/src/screens.h @@ -21,7 +21,8 @@ #define SCROLL_PAGE (2 * SCR_FIELDY) -void DrawMainMenuExt(int, int); +void DrawMainMenuExt(int, boolean); +void DrawAndFadeInMainMenu(int); void DrawMainMenu(void); void DrawHallOfFame(int); diff --git a/src/tools.c b/src/tools.c index 8d0fe8de..72b5a290 100644 --- a/src/tools.c +++ b/src/tools.c @@ -414,99 +414,60 @@ void FadeToFront() BackToFront(); } -void FadeIn(int fade_delay) +void FadeExt(int fade_mask, int fade_mode) { - if (fade_delay == 0) - { - BackToFront(); + Bitmap *bitmap = (fade_mode == FADE_MODE_CROSSFADE ? bitmap_db_cross : NULL); + int fade_delay = menu.fade_delay; + int post_delay = (fade_mode == FADE_MODE_FADE_OUT ? menu.post_delay : 0); + int x, y, width, height; - return; + if (fade_mask & REDRAW_ALL) + { + x = 0; + y = 0; + width = WIN_XSIZE; + height = WIN_YSIZE; } - - FadeRectangle(NULL, 0, 0, WIN_XSIZE, WIN_YSIZE, - FADE_MODE_FADE_IN, fade_delay, 0); - - redraw_mask = REDRAW_NONE; -} - -void FadeOut(int fade_delay, int post_delay) -{ - if (fade_delay == 0) + else if (fade_mask & REDRAW_FIELD) { - ClearRectangle(backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE); - BackToFront(); - - return; + x = REAL_SX; + y = REAL_SY; + width = FULL_SXSIZE; + height = FULL_SYSIZE; } - FadeRectangle(NULL, 0, 0, WIN_XSIZE, WIN_YSIZE, - FADE_MODE_FADE_OUT, fade_delay, post_delay); - - redraw_mask = REDRAW_NONE; -} + redraw_mask |= fade_mask; -void FadeCross(int fade_delay) -{ if (fade_delay == 0) { - BlitBitmap(bitmap_db_title, backbuffer, 0, 0, WIN_XSIZE, WIN_YSIZE, 0, 0); + if (fade_mode == FADE_MODE_CROSSFADE) + BlitBitmap(bitmap, backbuffer, x, y, width, height, x, y); + else if (fade_mode == FADE_MODE_FADE_OUT) + ClearRectangle(backbuffer, x, y, width, height); + BackToFront(); return; } - FadeRectangle(bitmap_db_title, 0, 0, WIN_XSIZE, WIN_YSIZE, - FADE_MODE_CROSSFADE, fade_delay, 0); + FadeRectangle(bitmap, x, y, width, height, fade_mode, fade_delay, post_delay); - redraw_mask = REDRAW_NONE; + redraw_mask &= ~fade_mask; } -void FadeInField(int fade_delay) +void FadeIn(int fade_mask) { - 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; + FadeExt(fade_mask, FADE_MODE_FADE_IN); } -void FadeOutField(int fade_delay, int post_delay) +void FadeOut(int fade_mask) { - 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; + FadeExt(fade_mask, FADE_MODE_FADE_OUT); } -void FadeCrossField(int fade_delay) +void FadeCross(int fade_mask) { - 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; + FadeExt(fade_mask, FADE_MODE_CROSSFADE); } void SetMainBackgroundImageIfDefined(int graphic) diff --git a/src/tools.h b/src/tools.h index 55929e50..21288a94 100644 --- a/src/tools.h +++ b/src/tools.h @@ -68,11 +68,8 @@ void BackToFront(); void FadeToFront(); void FadeIn(int); -void FadeOut(int, int); +void FadeOut(int); void FadeCross(int); -void FadeInField(int); -void FadeOutField(int, int); -void FadeCrossField(int); void ClearWindow(); void SetMainBackgroundImageIfDefined(int);