X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=d986f8d96a164c12258cb1f6532278d95fa9f490;hb=32a5b3574b41354734b444313e91725e9c452b90;hp=dbbdf0c9d6344e4795ab7032af987ccda8605871;hpb=6d73c8c86a15e02051dfba65e436d38e4ebc3a36;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index dbbdf0c9..d986f8d9 100644 --- a/src/screens.c +++ b/src/screens.c @@ -131,8 +131,11 @@ #define MENU_CHOOSE_TREE_FONT(x) (FONT_TEXT_1 + (x)) #define MENU_CHOOSE_TREE_COLOR(ti, a) TREE_COLOR(ti, a) -#define TEXT_NEXT_PAGE "Press any key or button for next page" +#define TEXT_MAIN_MENU "Press any key or button for main menu" #define TEXT_INFO_MENU "Press any key or button for info menu" +#define TEXT_NEXT_PAGE "Press any key or button for next page" +#define TEXT_NEXT_MENU (info_screens_from_main ? \ + TEXT_MAIN_MENU : TEXT_INFO_MENU) // for input setup functions #define SETUPINPUT_SCREEN_POS_START 0 @@ -200,20 +203,21 @@ #define SCREEN_CTRL_ID_NEXT_PLAYER 11 #define SCREEN_CTRL_ID_INSERT_SOLUTION 12 #define SCREEN_CTRL_ID_PLAY_SOLUTION 13 -#define SCREEN_CTRL_ID_SWITCH_ECS_AGA 14 -#define SCREEN_CTRL_ID_TOUCH_PREV_PAGE 15 -#define SCREEN_CTRL_ID_TOUCH_NEXT_PAGE 16 -#define SCREEN_CTRL_ID_TOUCH_PREV_PAGE2 17 -#define SCREEN_CTRL_ID_TOUCH_NEXT_PAGE2 18 +#define SCREEN_CTRL_ID_LEVELSET_INFO 14 +#define SCREEN_CTRL_ID_SWITCH_ECS_AGA 15 +#define SCREEN_CTRL_ID_TOUCH_PREV_PAGE 16 +#define SCREEN_CTRL_ID_TOUCH_NEXT_PAGE 17 +#define SCREEN_CTRL_ID_TOUCH_PREV_PAGE2 18 +#define SCREEN_CTRL_ID_TOUCH_NEXT_PAGE2 19 -#define NUM_SCREEN_MENUBUTTONS 19 +#define NUM_SCREEN_MENUBUTTONS 20 -#define SCREEN_CTRL_ID_SCROLL_UP 19 -#define SCREEN_CTRL_ID_SCROLL_DOWN 20 -#define SCREEN_CTRL_ID_SCROLL_VERTICAL 21 -#define SCREEN_CTRL_ID_NETWORK_SERVER 22 +#define SCREEN_CTRL_ID_SCROLL_UP 20 +#define SCREEN_CTRL_ID_SCROLL_DOWN 21 +#define SCREEN_CTRL_ID_SCROLL_VERTICAL 22 +#define SCREEN_CTRL_ID_NETWORK_SERVER 23 -#define NUM_SCREEN_GADGETS 23 +#define NUM_SCREEN_GADGETS 24 #define NUM_SCREEN_SCROLLBUTTONS 2 #define NUM_SCREEN_SCROLLBARS 1 @@ -221,11 +225,12 @@ #define SCREEN_MASK_MAIN (1 << 0) #define SCREEN_MASK_MAIN_HAS_SOLUTION (1 << 1) -#define SCREEN_MASK_INPUT (1 << 2) -#define SCREEN_MASK_TOUCH (1 << 3) -#define SCREEN_MASK_TOUCH2 (1 << 4) -#define SCREEN_MASK_SCORES (1 << 5) -#define SCREEN_MASK_SCORES_INFO (1 << 6) +#define SCREEN_MASK_MAIN_HAS_SET_INFO (1 << 2) +#define SCREEN_MASK_INPUT (1 << 3) +#define SCREEN_MASK_TOUCH (1 << 4) +#define SCREEN_MASK_TOUCH2 (1 << 5) +#define SCREEN_MASK_SCORES (1 << 6) +#define SCREEN_MASK_SCORES_INFO (1 << 7) // graphic position and size values for buttons and scrollbars #define SC_MENUBUTTON_XSIZE TILEX @@ -318,6 +323,8 @@ static struct GadgetInfo *screen_gadget[NUM_SCREEN_GADGETS]; static int info_mode = INFO_MODE_MAIN; static int setup_mode = SETUP_MODE_MAIN; +static boolean info_screens_from_main = FALSE; + static TreeInfo *window_sizes = NULL; static TreeInfo *window_size_current = NULL; @@ -918,6 +925,11 @@ static struct MainControlInfo main_controls[] = }; +static boolean hasLevelSetInfo(void) +{ + return (getLevelSetInfoFilename(0) != NULL); +} + static int getTitleScreenGraphic(int nr, boolean initial) { return (initial ? IMG_TITLESCREEN_INITIAL_1 : IMG_TITLESCREEN_1) + nr; @@ -1804,6 +1816,7 @@ void DrawMainMenu(void) MapTapeButtons(); MapScreenMenuGadgets(SCREEN_MASK_MAIN); UpdateScreenMenuGadgets(SCREEN_MASK_MAIN_HAS_SOLUTION, hasSolutionTape()); + UpdateScreenMenuGadgets(SCREEN_MASK_MAIN_HAS_SET_INFO, hasLevelSetInfo()); // copy actual game door content to door double buffer for OpenDoor() BlitBitmap(drawto, bitmap_db_door_1, DX, DY, DXSIZE, DYSIZE, 0, 0); @@ -2537,6 +2550,18 @@ static void DrawInfoScreen_Main(void) int fade_mask = REDRAW_FIELD; int i; + // (needed after displaying info sub-screens directly from main menu) + if (info_screens_from_main) + { + info_screens_from_main = FALSE; + + SetGameStatus(GAME_MODE_MAIN); + + DrawMainMenu(); + + return; + } + if (redraw_mask & REDRAW_ALL) fade_mask = REDRAW_ALL; @@ -2955,7 +2980,7 @@ void DrawInfoScreen_NotAvailable(char *text_title, char *text_error) DrawTextSCentered(ystart1, font_title, text_title); DrawTextSCentered(ystart2, font_error, text_error); - DrawTextSCentered(ybottom, font_foot, TEXT_INFO_MENU); + DrawTextSCentered(ybottom, font_foot, TEXT_NEXT_MENU); FadeIn(REDRAW_FIELD); } @@ -3275,7 +3300,7 @@ void HandleInfoScreen_Music(int dx, int dy, int button) DrawHeadline(); DrawTextSCentered(ystart, font_title, "No music info for this level set."); - DrawTextSCentered(ybottom, font_foot, TEXT_INFO_MENU); + DrawTextSCentered(ybottom, font_foot, TEXT_NEXT_MENU); return; } @@ -3574,7 +3599,7 @@ static void DrawInfoScreen_Version(void) DrawTextF(xstart2, ystart, font_text, "%s", setup.system.sdl_audiodriver); DrawTextF(xstart3, ystart, font_text, "%s", driver_name); - DrawTextSCentered(ybottom, font_foot, TEXT_INFO_MENU); + DrawTextSCentered(ybottom, font_foot, TEXT_NEXT_MENU); FadeIn(REDRAW_FIELD); } @@ -3695,7 +3720,7 @@ static void DrawInfoScreen_GenericScreen(int screen_nr, int num_screens, } boolean last_screen = (screen_nr == num_screens - 1); - char *text_foot = (last_screen ? TEXT_INFO_MENU : TEXT_NEXT_PAGE); + char *text_foot = (last_screen ? TEXT_NEXT_MENU : TEXT_NEXT_PAGE); DrawTextSCentered(ybottom, font_foot, text_foot); } @@ -3775,7 +3800,7 @@ void HandleInfoScreen_Generic(int dx, int dy, int button) DrawHeadline(); DrawTextSCentered(ystart, font_title, text_no_info); - DrawTextSCentered(ybottom, font_foot, TEXT_INFO_MENU); + DrawTextSCentered(ybottom, font_foot, TEXT_NEXT_MENU); return; } @@ -3846,6 +3871,43 @@ static void DrawInfoScreen(void) PlayMenuSoundsAndMusic(); } +void DrawInfoScreen_FromMainMenu(int nr) +{ + int fade_mask = REDRAW_FIELD; + + if (nr < INFO_MODE_MAIN || nr >= MAX_INFO_MODES) + return; + + CloseDoor(DOOR_CLOSE_2); + + SetGameStatus(GAME_MODE_INFO); + + info_mode = nr; + info_screens_from_main = TRUE; + + if (redraw_mask & REDRAW_ALL) + fade_mask = REDRAW_ALL; + + if (CheckFadeAll()) + fade_mask = REDRAW_ALL; + + UnmapAllGadgets(); + FadeMenuSoundsAndMusic(); + + FadeSetEnterScreen(); + + FadeOut(fade_mask); + + FadeSkipNextFadeOut(); + + // needed if different viewport properties defined for info screen + ChangeViewportPropertiesIfNeeded(); + + SetMainBackgroundImage(IMG_BACKGROUND_INFO); + + DrawInfoScreen(); +} + void HandleInfoScreen(int mx, int my, int dx, int dy, int button) { if (info_mode == INFO_MODE_TITLE) @@ -4486,7 +4548,7 @@ static void drawChooseTreeScreen_Scores_NotAvailable(void) char *text_info = "HighScores of Level %d"; char *text_title = "Score information:"; char *text_error = "No scores for this level."; - char *text_foot = "Press any key or button for main menu"; + char *text_foot = TEXT_MAIN_MENU; int font_info = FONT_TITLE_2; int font_title = FONT_INITIAL_3; int font_error = FONT_INITIAL_4; @@ -9508,6 +9570,14 @@ static struct GD_EVENT_RELEASED, FALSE, "play solution tape" }, + { + IMG_MENU_BUTTON_LEVELSET_INFO, IMG_MENU_BUTTON_LEVELSET_INFO_ACTIVE, + &menu.main.button.levelset_info, NULL, + SCREEN_CTRL_ID_LEVELSET_INFO, + SCREEN_MASK_MAIN_HAS_SET_INFO, + GD_EVENT_RELEASED, + FALSE, "show level set info" + }, { IMG_MENU_BUTTON_SWITCH_ECS_AGA, IMG_MENU_BUTTON_SWITCH_ECS_AGA_ACTIVE, &menu.main.button.switch_ecs_aga, &setup.prefer_aga_graphics, @@ -9700,6 +9770,16 @@ static void CreateScreenMenubuttons(void) id == SCREEN_CTRL_ID_NEXT_LEVEL2 ? mSY + MENU_TITLE1_YPOS : 0); } + if (id == SCREEN_CTRL_ID_LEVELSET_INFO) + { + if (pos->x == -1 && pos->y == -1) + { + // use "SX" here to place button (ignore draw offsets) + x = SX + SXSIZE - 2 * TILESIZE; + y = SY + SYSIZE - 2 * TILESIZE; + } + } + gi = CreateGadget(GDI_CUSTOM_ID, id, GDI_CUSTOM_TYPE_ID, i, GDI_IMAGE_ID, gfx_unpressed, @@ -10116,6 +10196,10 @@ static void HandleScreenGadgets(struct GadgetInfo *gi) PlaySolutionTape(); break; + case SCREEN_CTRL_ID_LEVELSET_INFO: + DrawInfoScreen_FromMainMenu(INFO_MODE_LEVELSET); + break; + case SCREEN_CTRL_ID_SWITCH_ECS_AGA: setup.prefer_aga_graphics = !setup.prefer_aga_graphics; DrawMainMenu();