X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=0965eb9efcfe60aec3c14658bb3b7e28df351cfa;hb=1ed02c282e3b4bd73c5d26244e4df30d731cc6c8;hp=d096d3bb5ec12162b1e7d7a4c0fcd5b4d1d3226f;hpb=bc8503fee1600305a9e915da07d5f2c29d9890b6;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index d096d3bb..0965eb9e 100644 --- a/src/screens.c +++ b/src/screens.c @@ -155,10 +155,10 @@ static void PlaySound_Menu_Continue(int sound) void DrawHeadline() { - int font1_width = getFontWidth(FONT_TITLE_1); - int font2_width = getFontWidth(FONT_TITLE_2); - int x1 = SX + (SXSIZE - strlen(PROGRAM_TITLE_STRING) * font1_width) / 2; - int x2 = SX + (SXSIZE - strlen(WINDOW_SUBTITLE_STRING) * font2_width) / 2; + int text1_width = getTextWidth(PROGRAM_TITLE_STRING, FONT_TITLE_1); + int text2_width = getTextWidth(WINDOW_SUBTITLE_STRING, FONT_TITLE_2); + int x1 = SX + (SXSIZE - text1_width) / 2; + int x2 = SX + (SXSIZE - text2_width) / 2; DrawText(x1, SY + 8, PROGRAM_TITLE_STRING, FONT_TITLE_1); DrawText(x2, SY + 46, WINDOW_SUBTITLE_STRING, FONT_TITLE_2); @@ -192,13 +192,10 @@ void DrawMainMenu() { static LevelDirTree *leveldir_last_valid = NULL; char *name_text = (!options.network && setup.team_mode ? "Team:" : "Name:"); - int font_width = getFontWidth(FONT_MENU_1); - int name_width = font_width * strlen("Name:"); - int level_width = font_width * strlen("Level:"); + int name_width = getTextWidth("Name:", FONT_MENU_1); + int level_width = getTextWidth("Level:", FONT_MENU_1); int i; - printf("::: CHECK A: '%s'\n", leveldir_current->graphics_path); - UnmapAllGadgets(); FadeSounds(); @@ -224,24 +221,16 @@ void DrawMainMenu() /* needed if last screen was the setup screen and fullscreen state changed */ ToggleFullscreenIfNeeded(); - printf("::: CHECK B.1: '%s'\n", leveldir_current->graphics_path); - -#if 1 /* leveldir_current may be invalid (level group, parent link) */ if (!validLevelSeries(leveldir_current)) leveldir_current = getFirstValidTreeInfoEntry(leveldir_last_valid); /* store valid level series information */ leveldir_last_valid = leveldir_current; -#endif - - printf("::: CHECK B.2: '%s'\n", leveldir_current->graphics_path); /* needed if last screen (level choice) changed graphics, sounds or music */ ReloadCustomArtwork(); - printf("::: CHECK C: '%s'\n", leveldir_current->graphics_path); - #ifdef TARGET_SDL SetDrawtoField(DRAW_BACKBUFFER); #endif @@ -249,15 +238,6 @@ void DrawMainMenu() /* map gadgets for main menu screen */ MapTapeButtons(); -#if 0 - /* leveldir_current may be invalid (level group, parent link) */ - if (!validLevelSeries(leveldir_current)) - leveldir_current = getFirstValidTreeInfoEntry(leveldir_last_valid); - - /* store valid level series information */ - leveldir_last_valid = leveldir_current; -#endif - /* level_nr may have been set to value over handicap with level editor */ if (setup.handicap && level_nr > leveldir_current->handicap_level) level_nr = leveldir_current->handicap_level; @@ -325,8 +305,6 @@ static void gotoTopLevelDir() /* move upwards to top level directory */ while (leveldir_current->node_parent) { - printf("::: ---> '%s'\n", leveldir_current->graphics_path); - /* write a "path" into level tree for easy navigation to last level */ if (leveldir_current->node_parent->node_group->cl_first == -1) { @@ -348,16 +326,12 @@ static void gotoTopLevelDir() } leveldir_current = leveldir_current->node_parent; - - printf("::: +++> '%s'\n", leveldir_current->graphics_path); } - - printf("::: ===> '%s'\n", leveldir_current->graphics_path); } void HandleMainMenu(int mx, int my, int dx, int dy, int button) { - static int choice = 0; + static int choice = 5; int x = 0; int y = choice; @@ -443,12 +417,8 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) SaveLevelSetup_LastSeries(); SaveLevelSetup_SeriesInfo(); - printf("::: CHECK C.1: '%s'\n", leveldir_current->graphics_path); - gotoTopLevelDir(); - printf("::: CHECK C.2: '%s'\n", leveldir_current->graphics_path); - DrawChooseLevel(); } } @@ -502,8 +472,6 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) } } - BackToFront(); - out: if (game_status == GAME_MODE_MAIN) @@ -511,6 +479,8 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) DrawMicroLevel(MICROLEV_XPOS, MICROLEV_YPOS, FALSE); DoAnimation(); } + + BackToFront(); } @@ -1161,10 +1131,9 @@ void HandleHelpScreen(int button) #else PlaySound_Menu_Continue(SND_BACKGROUND_INFO); #endif - - DoAnimation(); } + DoAnimation(); BackToFront(); } @@ -1271,8 +1240,11 @@ static void drawChooseTreeList(int first_entry, int num_page_entries, int yoffset = (ti->type == TREE_TYPE_LEVEL_DIR ? 0 : yoffset_setup); int last_game_status = game_status; /* save current game status */ +#if 1 + DrawBackground(mSX, mSY, SXSIZE - 32 + menu.scrollbar_xoffset, SYSIZE); +#else DrawBackground(SX, SY, SXSIZE - 32, SYSIZE); - redraw_mask |= REDRAW_FIELD; +#endif title_string = (ti->type == TREE_TYPE_LEVEL_DIR ? "Level Directories" : @@ -1308,6 +1280,8 @@ static void drawChooseTreeList(int first_entry, int num_page_entries, } game_status = last_game_status; /* restore current game status */ + + redraw_mask |= REDRAW_FIELD; } static void drawChooseTreeInfo(int entry_pos, TreeInfo *ti) @@ -1562,10 +1536,12 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, } } - BackToFront(); - +#if 0 if (game_status == GAME_MODE_LEVELS || game_status == GAME_MODE_SETUP) DoAnimation(); + + BackToFront(); +#endif } void DrawChooseLevel() @@ -1578,6 +1554,9 @@ void DrawChooseLevel() void HandleChooseLevel(int mx, int my, int dx, int dy, int button) { HandleChooseTree(mx, my, dx, dy, button, &leveldir_current); + + DoAnimation(); + BackToFront(); } void DrawHallOfFame(int highlight_position) @@ -1631,6 +1610,8 @@ static void drawHallOfFameList(int first_entry, int highlight_position) DrawText(mSX + dx2, sy, highscore[entry].Name, font_nr2); DrawText(mSX + dx3, sy, int2str(highscore[entry].Score, 5), font_nr4); } + + redraw_mask |= REDRAW_FIELD; } void HandleHallOfFame(int mx, int my, int dx, int dy, int button) @@ -1661,8 +1642,6 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button) first_entry = 0; drawHallOfFameList(first_entry, highlight_position); - - return; } } else if (dy > 0) @@ -1674,27 +1653,22 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button) first_entry = MAX(0, MAX_SCORE_ENTRIES - NUM_MENU_ENTRIES_ON_SCREEN); drawHallOfFameList(first_entry, highlight_position); - - return; } } - - if (button_released) + else if (button_released) { FadeSound(SND_BACKGROUND_SCORES); game_status = GAME_MODE_MAIN; DrawMainMenu(); } - BackToFront(); - - if (game_status == GAME_MODE_SCORES) - { - DoAnimation(); #if 1 + if (game_status == GAME_MODE_SCORES) PlaySound_Menu_Continue(SND_BACKGROUND_SCORES); #endif - } + + DoAnimation(); + BackToFront(); } @@ -1837,6 +1811,9 @@ static struct TokenInfo setup_info_editor[] = { TYPE_SWITCH, &setup.editor.el_dx_boulderdash,"DX Boulderd.:" }, { TYPE_SWITCH, &setup.editor.el_chars, "Characters:" }, { TYPE_SWITCH, &setup.editor.el_custom, "Custom:" }, + { TYPE_SWITCH, &setup.editor.el_custom_more, "More Custom:" }, + { TYPE_EMPTY, NULL, "" }, + { TYPE_SWITCH, &setup.editor.el_headlines, "Headlines:" }, { TYPE_EMPTY, NULL, "" }, { TYPE_LEAVE_MENU, execSetupMain, "Back" }, { 0, NULL, NULL } @@ -1860,8 +1837,6 @@ static struct TokenInfo setup_info_graphics[] = static struct TokenInfo setup_info_sound[] = { - { TYPE_SWITCH, &setup.sound, "Sound:", }, - { TYPE_EMPTY, NULL, "" }, { TYPE_SWITCH, &setup.sound_simple, "Simple Sound:" }, { TYPE_SWITCH, &setup.sound_loops, "Sound Loops:" }, { TYPE_SWITCH, &setup.sound_music, "Game Music:" }, @@ -1940,8 +1915,8 @@ static Key getSetupKey() } } - BackToFront(); DoAnimation(); + BackToFront(); /* don't eat all CPU time */ Delay(10); @@ -2070,10 +2045,10 @@ static void DrawSetupScreen_Generic() int font_nr = FONT_MENU_1; /* set some entries to "unchangeable" according to other variables */ - if ((value_ptr == &setup.sound && !audio.sound_available) || - (value_ptr == &setup.sound_loops && !audio.loops_available) || - (value_ptr == &setup.sound_music && !audio.music_available) || - (value_ptr == &setup.fullscreen && !video.fullscreen_available)) + if ((value_ptr == &setup.sound_simple && !audio.sound_available) || + (value_ptr == &setup.sound_loops && !audio.loops_available) || + (value_ptr == &setup.sound_music && !audio.music_available) || + (value_ptr == &setup.fullscreen && !video.fullscreen_available)) setup_info[i].type |= TYPE_GHOSTED; if (setup_info[i].type & TYPE_STRING) @@ -2189,10 +2164,12 @@ void HandleSetupScreen_Generic(int mx, int my, int dx, int dy, int button) } } +#if 0 BackToFront(); if (game_status == GAME_MODE_SETUP) DoAnimation(); +#endif } void DrawSetupScreen_Input() @@ -2369,7 +2346,11 @@ void HandleSetupScreen_Input(int mx, int my, int dx, int dy, int button) static unsigned long delay = 0; if (!DelayReached(&delay, GADGET_FRAME_DELAY)) +#if 1 + return; +#else goto out; +#endif player_nr = (player_nr + (x == 10 ? -1 : +1) + MAX_PLAYERS) % MAX_PLAYERS; @@ -2433,12 +2414,14 @@ void HandleSetupScreen_Input(int mx, int my, int dx, int dy, int button) } } +#if 0 BackToFront(); out: if (game_status == GAME_MODE_SETUP) DoAnimation(); +#endif } void CustomizeKeyboard(int player_nr) @@ -2556,8 +2539,8 @@ void CustomizeKeyboard(int player_nr) } } - BackToFront(); DoAnimation(); + BackToFront(); /* don't eat all CPU time */ Delay(10); @@ -2719,8 +2702,8 @@ static boolean CalibrateJoystickMain(int player_nr) } - BackToFront(); DoAnimation(); + BackToFront(); /* don't eat all CPU time */ Delay(10); @@ -2797,6 +2780,9 @@ void HandleSetupScreen(int mx, int my, int dx, int dy, int button) HandleChooseTree(mx, my, dx, dy, button, &artwork.mus_current); else HandleSetupScreen_Generic(mx, my, dx, dy, button); + + DoAnimation(); + BackToFront(); } void HandleGameActions() @@ -2935,6 +2921,7 @@ static void CreateScreenScrollbuttons() GDI_STATE, GD_BUTTON_UNPRESSED, GDI_DESIGN_UNPRESSED, gd_bitmap_unpressed, gd_x1, gd_y1, GDI_DESIGN_PRESSED, gd_bitmap_pressed, gd_x2, gd_y2, + GDI_DIRECT_DRAW, FALSE, GDI_EVENT_MASK, event_mask, GDI_CALLBACK_ACTION, HandleScreenGadgets, GDI_END); @@ -3011,6 +2998,7 @@ static void CreateScreenScrollbars() GDI_DESIGN_UNPRESSED, gd_bitmap_unpressed, gd_x1, gd_y1, GDI_DESIGN_PRESSED, gd_bitmap_pressed, gd_x2, gd_y2, GDI_BORDER_SIZE, SC_BORDER_SIZE, SC_BORDER_SIZE, + GDI_DIRECT_DRAW, FALSE, GDI_EVENT_MASK, event_mask, GDI_CALLBACK_ACTION, HandleScreenGadgets, GDI_END);