X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=30214464c1bd46d791915af73b9c195f3fbd0481;hb=6b748c845ff51daac061662d016447e122cf6fb3;hp=83e508ea3af63c962b4004828b9ae75add0f0d1d;hpb=f89a490028c36509216b97a96b779b779c2065c9;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index 83e508ea..30214464 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1252,14 +1252,6 @@ void DrawHeadline() setup.internal.program_copyright); } -int effectiveGameStatus() -{ - if (game_status == GAME_MODE_INFO && info_mode == INFO_MODE_TITLE) - return GAME_MODE_TITLE; - - return game_status; -} - void DrawTitleScreenImage(int nr, boolean initial) { int graphic = getTitleScreenGraphic(nr, initial); @@ -1316,6 +1308,14 @@ void DrawTitleScreenMessage(int nr, boolean initial) /* force TITLE font on title message screen */ game_status = getTitleMessageGameMode(initial); + /* if chars *and* width set to "-1", automatically determine width */ + if (tmi->chars == -1 && tmi->width == -1) + tmi->width = viewport.window[game_status].width; + + /* if lines *and* height set to "-1", automatically determine height */ + if (tmi->lines == -1 && tmi->height == -1) + tmi->height = viewport.window[game_status].height; + /* if chars set to "-1", automatically determine by text and font width */ if (tmi->chars == -1) tmi->chars = tmi->width / getFontWidth(tmi->font); @@ -1328,6 +1328,14 @@ void DrawTitleScreenMessage(int nr, boolean initial) else tmi->height = tmi->lines * getFontHeight(tmi->font); + /* if x set to "-1", automatically determine by width and alignment */ + if (tmi->x == -1) + tmi->x = -1 * ALIGNED_XPOS(0, tmi->width, tmi->align); + + /* if y set to "-1", automatically determine by height and alignment */ + if (tmi->y == -1) + tmi->y = -1 * ALIGNED_YPOS(0, tmi->height, tmi->valign); + SetDrawBackgroundMask(REDRAW_ALL); SetWindowBackgroundImage(getTitleBackground(nr, initial, FALSE)); @@ -1416,24 +1424,17 @@ void DrawMainMenu() /* needed if last screen (level choice) changed graphics, sounds or music */ ReloadCustomArtwork(0); -#if 1 /* needed if different viewport properties defined for menues */ ChangeViewportPropertiesIfNeeded(); -#endif if (redraw_mask & REDRAW_ALL) fade_mask = REDRAW_ALL; - if (CheckIfRedrawGlobalBorderIsNeeded()) + if (CheckIfGlobalBorderHasChanged()) fade_mask = REDRAW_ALL; FadeOut(fade_mask); -#if 0 - /* needed if different viewport properties defined for menues */ - ChangeViewportPropertiesIfNeeded(); -#endif - /* needed if last screen was the editor screen */ UndrawSpecialEditorDoor(); @@ -1441,6 +1442,7 @@ void DrawMainMenu() if (CheckTitleScreen(levelset_has_changed)) { + game_status_last_screen = GAME_MODE_MAIN; game_status = GAME_MODE_TITLE; DrawTitleScreen(); @@ -1461,7 +1463,7 @@ void DrawMainMenu() SetMainBackgroundImage(IMG_BACKGROUND_MAIN); -#if 1 +#if 0 if (fade_mask == REDRAW_ALL) RedrawGlobalBorder(); #endif @@ -1492,16 +1494,12 @@ void DrawMainMenu() MapScreenMenuGadgets(SCREEN_MASK_MAIN); /* copy actual game door content to door double buffer for OpenDoor() */ + BlitBitmap(drawto, bitmap_db_door_1, DX, DY, DXSIZE, DYSIZE, 0, 0); BlitBitmap(drawto, bitmap_db_door_2, VX, VY, VXSIZE, VYSIZE, 0, 0); OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); - DrawMaskedBorder(REDRAW_ALL); - -#if 0 - if (redraw_mask & REDRAW_ALL) - fade_mask = REDRAW_ALL; -#endif + DrawMaskedBorder(fade_mask); FadeIn(fade_mask); FadeSetEnterMenu(); @@ -1568,7 +1566,7 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) last_sound = SND_UNDEFINED; last_music = MUS_UNDEFINED; - if (game_status == GAME_MODE_INFO) + if (game_status_last_screen == GAME_MODE_INFO) { if (num_title_screens == 0) { @@ -1581,8 +1579,13 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) FadeSoundsAndMusic(); FadeOut(REDRAW_ALL); + + /* only required to update logic for redrawing global border */ + ClearField(); } + ChangeViewportPropertiesIfNeeded(); + if (tci->is_image) DrawTitleScreenImage(tci->local_nr, tci->initial); else @@ -1630,11 +1633,13 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) } else if (button == MB_MENU_CHOICE) { - if (game_status == GAME_MODE_INFO && num_title_screens == 0) + if (game_status_last_screen == GAME_MODE_INFO && num_title_screens == 0) { FadeSetEnterScreen(); + game_status = GAME_MODE_INFO; info_mode = INFO_MODE_MAIN; + DrawInfoScreen(); return; @@ -1699,8 +1704,9 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) /* force full menu screen redraw after displaying title screens */ redraw_mask = REDRAW_ALL; - if (game_status == GAME_MODE_INFO) + if (game_status_last_screen == GAME_MODE_INFO) { + game_status = GAME_MODE_INFO; info_mode = INFO_MODE_MAIN; DrawInfoScreen(); @@ -1838,6 +1844,10 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) } else if (pos == MAIN_CONTROL_LEVEL_NUMBER && !button) { + StopAnimation(); + + CloseDoor(DOOR_CLOSE_2); + game_status = GAME_MODE_LEVELNR; ChangeViewportPropertiesIfNeeded(); @@ -1872,6 +1882,10 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) { if (leveldir_first) { + StopAnimation(); + + CloseDoor(DOOR_CLOSE_2); + game_status = GAME_MODE_LEVELS; SaveLevelSetup_LastSeries(); @@ -1887,6 +1901,10 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) } else if (pos == MAIN_CONTROL_SCORES) { + StopAnimation(); + + CloseDoor(DOOR_CLOSE_2); + game_status = GAME_MODE_SCORES; DrawHallOfFame(-1); @@ -1897,6 +1915,8 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) !strEqual(setup.player_name, "Artsoft")) Request("This level is read only!", REQ_CONFIRM); + StopAnimation(); + CloseDoor(DOOR_CLOSE_2); game_status = GAME_MODE_EDITOR; @@ -1907,6 +1927,10 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) } else if (pos == MAIN_CONTROL_INFO) { + StopAnimation(); + + CloseDoor(DOOR_CLOSE_2); + game_status = GAME_MODE_INFO; info_mode = INFO_MODE_MAIN; @@ -1916,10 +1940,16 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) } else if (pos == MAIN_CONTROL_GAME) { + StopAnimation(); + StartGameActions(options.network, setup.autorecord, level.random_seed); } else if (pos == MAIN_CONTROL_SETUP) { + StopAnimation(); + + CloseDoor(DOOR_CLOSE_2); + game_status = GAME_MODE_SETUP; setup_mode = SETUP_MODE_MAIN; @@ -2129,7 +2159,7 @@ static void DrawInfoScreen_Main() if (redraw_mask & REDRAW_ALL) fade_mask = REDRAW_ALL; - if (CheckIfRedrawGlobalBorderIsNeeded()) + if (CheckIfGlobalBorderHasChanged()) fade_mask = REDRAW_ALL; UnmapAllGadgets(); @@ -2146,12 +2176,9 @@ static void DrawInfoScreen_Main() FadeOut(fade_mask); - if (fade_mask == REDRAW_ALL) - { - RedrawGlobalBorder(); + ChangeViewportPropertiesIfNeeded(); - OpenDoor(DOOR_CLOSE_1 | DOOR_CLOSE_2 | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); - } + OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); ClearField(); @@ -2654,6 +2681,9 @@ void DrawInfoScreen_HelpText(int element, int action, int direction, int ypos) void DrawInfoScreen_TitleScreen() { + game_status_last_screen = GAME_MODE_INFO; + game_status = GAME_MODE_TITLE; + DrawTitleScreen(); } @@ -3626,7 +3656,7 @@ static void DrawChooseTree(TreeInfo **ti_ptr) { int fade_mask = REDRAW_FIELD; - if (CheckIfRedrawGlobalBorderIsNeeded()) + if (CheckIfGlobalBorderHasChanged()) fade_mask = REDRAW_ALL; if (strEqual((*ti_ptr)->subdir, STRING_TOP_DIRECTORY)) @@ -3647,11 +3677,15 @@ static void DrawChooseTree(TreeInfo **ti_ptr) FadeOut(fade_mask); + OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); + ClearField(); HandleChooseTree(0, 0, 0, 0, MB_MENU_INITIALIZE, ti_ptr); MapScreenTreeGadgets(*ti_ptr); + DrawMaskedBorder(fade_mask); + FadeIn(fade_mask); InitAnimation(); @@ -4131,7 +4165,7 @@ void DrawHallOfFame(int highlight_position) /* needed if different viewport properties defined for scores */ ChangeViewportPropertiesIfNeeded(); - if (CheckIfRedrawGlobalBorderIsNeeded()) + if (CheckIfGlobalBorderHasChanged()) fade_mask = REDRAW_ALL; UnmapAllGadgets(); @@ -4157,8 +4191,12 @@ void DrawHallOfFame(int highlight_position) PlayMenuSound(); PlayMenuMusic(); + OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); + HandleHallOfFame(highlight_position, 0, 0, 0, MB_MENU_INITIALIZE); + DrawMaskedBorder(fade_mask); + FadeIn(fade_mask); } @@ -5741,7 +5779,7 @@ static void DrawSetupScreen_Generic() char *title_string = NULL; int i; - if (CheckIfRedrawGlobalBorderIsNeeded()) + if (CheckIfGlobalBorderHasChanged()) fade_mask = REDRAW_ALL; UnmapAllGadgets(); @@ -5756,6 +5794,8 @@ static void DrawSetupScreen_Generic() FadeOut(fade_mask); + OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); + ClearField(); if (setup_mode == SETUP_MODE_MAIN) @@ -5843,6 +5883,8 @@ static void DrawSetupScreen_Generic() if (redraw_all) redraw_mask = fade_mask = REDRAW_ALL; + DrawMaskedBorder(fade_mask); + FadeIn(fade_mask); InitAnimation();