X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=4dabbaff5fe5fa275c3c0283cfa799b190a0fccc;hb=361e9177c362d319b8baecf4b210c3400ee451de;hp=8ec78ee60f455d7f0518bfd3517549040ca72c5f;hpb=11bd782b9345d3bec0ed2f6b2ed1bb310f365c4f;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index 8ec78ee6..4dabbaff 100644 --- a/src/screens.c +++ b/src/screens.c @@ -61,20 +61,19 @@ #define SETUP_MODE_CHOOSE_GAME_SPEED 16 #define SETUP_MODE_CHOOSE_SCROLL_DELAY 17 #define SETUP_MODE_CHOOSE_SNAPSHOT_MODE 18 -#define SETUP_MODE_CHOOSE_SCREEN_MODE 19 -#define SETUP_MODE_CHOOSE_WINDOW_SIZE 20 -#define SETUP_MODE_CHOOSE_SCALING_TYPE 21 -#define SETUP_MODE_CHOOSE_GRAPHICS 22 -#define SETUP_MODE_CHOOSE_SOUNDS 23 -#define SETUP_MODE_CHOOSE_MUSIC 24 -#define SETUP_MODE_CHOOSE_VOLUME_SIMPLE 25 -#define SETUP_MODE_CHOOSE_VOLUME_LOOPS 26 -#define SETUP_MODE_CHOOSE_VOLUME_MUSIC 27 -#define SETUP_MODE_CHOOSE_TOUCH_CONTROL 28 -#define SETUP_MODE_CHOOSE_MOVE_DISTANCE 29 -#define SETUP_MODE_CHOOSE_DROP_DISTANCE 30 - -#define MAX_SETUP_MODES 31 +#define SETUP_MODE_CHOOSE_WINDOW_SIZE 19 +#define SETUP_MODE_CHOOSE_SCALING_TYPE 20 +#define SETUP_MODE_CHOOSE_GRAPHICS 21 +#define SETUP_MODE_CHOOSE_SOUNDS 22 +#define SETUP_MODE_CHOOSE_MUSIC 23 +#define SETUP_MODE_CHOOSE_VOLUME_SIMPLE 24 +#define SETUP_MODE_CHOOSE_VOLUME_LOOPS 25 +#define SETUP_MODE_CHOOSE_VOLUME_MUSIC 26 +#define SETUP_MODE_CHOOSE_TOUCH_CONTROL 27 +#define SETUP_MODE_CHOOSE_MOVE_DISTANCE 28 +#define SETUP_MODE_CHOOSE_DROP_DISTANCE 29 + +#define MAX_SETUP_MODES 30 #define MAX_MENU_MODES MAX(MAX_INFO_MODES, MAX_SETUP_MODES) @@ -196,9 +195,6 @@ static struct GadgetInfo *screen_gadget[NUM_SCREEN_GADGETS]; static int info_mode = INFO_MODE_MAIN; static int setup_mode = SETUP_MODE_MAIN; -static TreeInfo *screen_modes = NULL; -static TreeInfo *screen_mode_current = NULL; - static TreeInfo *window_sizes = NULL; static TreeInfo *window_size_current = NULL; @@ -235,6 +231,9 @@ static TreeInfo *drop_distance_current = NULL; static TreeInfo *level_number = NULL; static TreeInfo *level_number_current = NULL; +static unsigned int sync_frame_delay = 0; +static unsigned int sync_frame_delay_value = GAME_FRAME_DELAY; + static struct { int value; @@ -326,11 +325,12 @@ static struct char *text; } snapshot_modes_list[] = { - { STR_SNAPSHOT_MODE_OFF, "Off" }, - { STR_SNAPSHOT_MODE_EVERY_STEP, "Every Step" }, - { STR_SNAPSHOT_MODE_EVERY_MOVE, "Every Move" }, + { STR_SNAPSHOT_MODE_OFF, "Off" }, + { STR_SNAPSHOT_MODE_EVERY_STEP, "Every Step" }, + { STR_SNAPSHOT_MODE_EVERY_MOVE, "Every Move" }, + { STR_SNAPSHOT_MODE_EVERY_COLLECT, "Every Collect" }, - { NULL, NULL }, + { NULL, NULL }, }; static struct @@ -455,6 +455,7 @@ struct TitleControlInfo { boolean is_image; boolean initial; + boolean first; int local_nr; int sort_priority; }; @@ -803,44 +804,29 @@ static int getTitleMusic(struct TitleControlInfo *tci) static struct TitleFadingInfo getTitleFading(struct TitleControlInfo *tci) { boolean is_image = tci->is_image; - int initial = tci->initial; + boolean initial = tci->initial; + boolean first = tci->first; int nr = tci->local_nr; + struct TitleMessageInfo tmi; struct TitleFadingInfo ti; - if (is_image) - { - int graphic = getTitleScreenGraphic(nr, initial); - - /* initialize fading control values to default title config settings */ - ti = (initial ? title_initial_default : title_default); - - /* override default settings with image config settings, if defined */ - if (graphic_info[graphic].fade_mode != FADE_MODE_DEFAULT) - ti.fade_mode = graphic_info[graphic].fade_mode; - if (graphic_info[graphic].fade_delay > -1) - ti.fade_delay = graphic_info[graphic].fade_delay; - if (graphic_info[graphic].post_delay > -1) - ti.post_delay = graphic_info[graphic].post_delay; - if (graphic_info[graphic].auto_delay > -1) - ti.auto_delay = graphic_info[graphic].auto_delay; - } - else - { - if (initial) - { - ti.fade_mode = titlemessage_initial[nr].fade_mode; - ti.fade_delay = titlemessage_initial[nr].fade_delay; - ti.post_delay = titlemessage_initial[nr].post_delay; - ti.auto_delay = titlemessage_initial[nr].auto_delay; - } - else - { - ti.fade_mode = titlemessage[nr].fade_mode; - ti.fade_delay = titlemessage[nr].fade_delay; - ti.post_delay = titlemessage[nr].post_delay; - ti.auto_delay = titlemessage[nr].auto_delay; - } - } + tmi = (is_image ? (initial ? (first ? + titlescreen_initial_first[nr] : + titlescreen_initial[nr]) + : (first ? + titlescreen_first[nr] : + titlescreen[nr])) + : (initial ? (first ? + titlemessage_initial_first[nr] : + titlemessage_initial[nr]) + : (first ? + titlemessage_first[nr] : + titlemessage[nr]))); + + ti.fade_mode = tmi.fade_mode; + ti.fade_delay = tmi.fade_delay; + ti.post_delay = tmi.post_delay; + ti.auto_delay = tmi.auto_delay; return ti; } @@ -872,6 +858,8 @@ static void InitializeTitleControlsExt_AddTitleInfo(boolean is_image, title_controls[num_title_screens].local_nr = nr; title_controls[num_title_screens].sort_priority = sort_priority; + title_controls[num_title_screens].first = FALSE; /* will be set later */ + num_title_screens++; } @@ -914,6 +902,9 @@ static void InitializeTitleControls(boolean show_title_initial) /* sort title screens according to sort_priority and title number */ qsort(title_controls, num_title_screens, sizeof(struct TitleControlInfo), compareTitleControlInfo); + + /* mark first title screen */ + title_controls[0].first = TRUE; } static boolean visibleMenuPos(struct MenuPosInfo *pos) @@ -1242,7 +1233,7 @@ static void drawChooseTreeCursor(int ypos, boolean active) drawCursorExt(0, ypos, active, -1); - game_status = last_game_status; /* restore current game status */ + SetGameStatus(last_game_status); /* restore current game status */ } void DrawHeadline() @@ -1252,14 +1243,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); @@ -1314,7 +1297,15 @@ void DrawTitleScreenMessage(int nr, boolean initial) return; /* force TITLE font on title message screen */ - game_status = getTitleMessageGameMode(initial); + SetGameStatus(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) @@ -1328,6 +1319,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)); @@ -1337,7 +1336,7 @@ void DrawTitleScreenMessage(int nr, boolean initial) filename, tmi->font, tmi->chars, -1, tmi->lines, 0, -1, tmi->autowrap, tmi->centered, tmi->parse_comments); - game_status = last_game_status; /* restore current game status */ + SetGameStatus(last_game_status); /* restore current game status */ } void DrawTitleScreen() @@ -1391,7 +1390,10 @@ void DrawMainMenu() /* needed if last screen was the playing screen, invoked from level editor */ if (level_editor_test_game) { - game_status = GAME_MODE_EDITOR; + CloseDoor(DOOR_CLOSE_ALL); + + SetGameStatus(GAME_MODE_EDITOR); + DrawLevelEd(); return; @@ -1416,6 +1418,17 @@ void DrawMainMenu() /* needed if last screen (level choice) changed graphics, sounds or music */ ReloadCustomArtwork(0); + if (CheckTitleScreen(levelset_has_changed)) + { + game_status_last_screen = GAME_MODE_MAIN; + + SetGameStatus(GAME_MODE_TITLE); + + DrawTitleScreen(); + + return; + } + /* needed if different viewport properties defined for menues */ ChangeViewportPropertiesIfNeeded(); @@ -1427,20 +1440,8 @@ void DrawMainMenu() FadeOut(fade_mask); - /* needed if last screen was the editor screen */ - UndrawSpecialEditorDoor(); - SetDrawtoField(DRAW_BACKBUFFER); - if (CheckTitleScreen(levelset_has_changed)) - { - game_status = GAME_MODE_TITLE; - - DrawTitleScreen(); - - return; - } - /* 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; @@ -1543,9 +1544,6 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) static int last_sound = -1, last_music = -1; boolean return_to_main_menu = FALSE; struct TitleControlInfo *tci; - struct TitleFadingInfo fading_default; - struct TitleFadingInfo fading_last = fading; - struct TitleFadingInfo fading_next; int sound, music; if (button == MB_MENU_INITIALIZE) @@ -1557,10 +1555,21 @@ 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 (num_title_screens != 0) + { + FadeSetEnterScreen(); + + /* use individual title fading instead of global "enter screen" fading */ + fading = getTitleFading(tci); + } + + if (game_status_last_screen == GAME_MODE_INFO) { if (num_title_screens == 0) { + /* switch game mode from title screen mode back to info screen mode */ + SetGameStatus(GAME_MODE_INFO); + DrawInfoScreen_NotAvailable("Title screen information:", "No title screen for this level set."); @@ -1568,26 +1577,21 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) } FadeSoundsAndMusic(); - - FadeOut(REDRAW_ALL); } + FadeOut(REDRAW_ALL); + + /* only required to update logic for redrawing global border */ + ClearField(); + + /* title screens may have different window size */ + ChangeViewportPropertiesIfNeeded(); + if (tci->is_image) DrawTitleScreenImage(tci->local_nr, tci->initial); else DrawTitleScreenMessage(tci->local_nr, tci->initial); - fading_default = (tci->initial ? title_initial_default : title_default); - - fading = fading_next = getTitleFading(tci); - - if (!(fading_last.fade_mode & FADE_TYPE_TRANSFORM) && - fading_next.fade_mode & FADE_TYPE_TRANSFORM) - { - fading.fade_mode = FADE_MODE_FADE; - fading.fade_delay = fading_default.fade_delay; - } - sound = getTitleSound(tci); music = getTitleMusic(tci); @@ -1603,8 +1607,6 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) FadeIn(REDRAW_ALL); - fading = fading_next; - DelayReached(&title_delay, 0); /* reset delay counter */ return; @@ -1619,11 +1621,12 @@ 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(); + SetGameStatus(GAME_MODE_INFO); info_mode = INFO_MODE_MAIN; + DrawInfoScreen(); return; @@ -1642,6 +1645,8 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) if (music == MUS_UNDEFINED || music != last_music) FadeMusic(); + fading = getTitleFading(tci); + FadeOut(REDRAW_ALL); if (tci->is_image) @@ -1649,8 +1654,6 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) else DrawTitleScreenMessage(tci->local_nr, tci->initial); - fading_next = getTitleFading(tci); - sound = getTitleSound(tci); music = getTitleMusic(tci); @@ -1662,15 +1665,8 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) last_sound = sound; last_music = music; - /* last screen already faded out, next screen has no animation */ - if (!(fading.fade_mode & FADE_TYPE_TRANSFORM) && - fading_next.fade_mode == FADE_MODE_NONE) - fading = fading_next; - FadeIn(REDRAW_ALL); - fading = fading_next; - DelayReached(&title_delay, 0); /* reset delay counter */ } else @@ -1688,15 +1684,17 @@ 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) { + SetGameStatus(GAME_MODE_INFO); + info_mode = INFO_MODE_MAIN; DrawInfoScreen(); } else /* default: return to main menu */ { - game_status = GAME_MODE_MAIN; + SetGameStatus(GAME_MODE_MAIN); DrawMainMenu(); } @@ -1831,7 +1829,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) CloseDoor(DOOR_CLOSE_2); - game_status = GAME_MODE_LEVELNR; + SetGameStatus(GAME_MODE_LEVELNR); ChangeViewportPropertiesIfNeeded(); @@ -1857,7 +1855,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) if (pos == MAIN_CONTROL_NAME) { - game_status = GAME_MODE_PSEUDO_TYPENAME; + SetGameStatus(GAME_MODE_PSEUDO_TYPENAME); HandleTypeName(strlen(setup.player_name), 0); } @@ -1869,7 +1867,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) CloseDoor(DOOR_CLOSE_2); - game_status = GAME_MODE_LEVELS; + SetGameStatus(GAME_MODE_LEVELS); SaveLevelSetup_LastSeries(); SaveLevelSetup_SeriesInfo(); @@ -1888,7 +1886,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) CloseDoor(DOOR_CLOSE_2); - game_status = GAME_MODE_SCORES; + SetGameStatus(GAME_MODE_SCORES); DrawHallOfFame(-1); } @@ -1902,7 +1900,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) CloseDoor(DOOR_CLOSE_2); - game_status = GAME_MODE_EDITOR; + SetGameStatus(GAME_MODE_EDITOR); FadeSetEnterScreen(); @@ -1914,7 +1912,8 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) CloseDoor(DOOR_CLOSE_2); - game_status = GAME_MODE_INFO; + SetGameStatus(GAME_MODE_INFO); + info_mode = INFO_MODE_MAIN; ChangeViewportPropertiesIfNeeded(); @@ -1933,7 +1932,8 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) CloseDoor(DOOR_CLOSE_2); - game_status = GAME_MODE_SETUP; + SetGameStatus(GAME_MODE_SETUP); + setup_mode = SETUP_MODE_MAIN; ChangeViewportPropertiesIfNeeded(); @@ -1946,7 +1946,7 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) SaveLevelSetup_SeriesInfo(); if (Request("Do you really want to quit?", REQ_ASK | REQ_STAY_CLOSED)) - game_status = GAME_MODE_QUIT; + SetGameStatus(GAME_MODE_QUIT); } } } @@ -2014,7 +2014,7 @@ static void execInfoLevelSet() static void execExitInfo() { - game_status = GAME_MODE_MAIN; + SetGameStatus(GAME_MODE_MAIN); DrawMainMenu(); } @@ -2087,7 +2087,6 @@ static void DrawCursorAndText_Setup(int screen_pos, int menu_info_pos_raw, DrawCursorAndText_Menu_Ext(setup_info, screen_pos, menu_info_pos_raw, active); } -static char *screen_mode_text; static char *window_size_text; static char *scaling_type_text; @@ -2114,7 +2113,6 @@ static void drawMenuInfoList(int first_entry, int num_page_entries, (value_ptr == &setup.sound_loops && !audio.loops_available) || (value_ptr == &setup.sound_music && !audio.music_available) || (value_ptr == &setup.fullscreen && !video.fullscreen_available) || - (value_ptr == &screen_mode_text && !video.fullscreen_available) || (value_ptr == &window_size_text && !video.window_scaling_available) || (value_ptr == &scaling_type_text && !video.window_scaling_available)) si->type |= TYPE_GHOSTED; @@ -2150,8 +2148,6 @@ static void DrawInfoScreen_Main() FreeScreenGadgets(); CreateScreenGadgets(); - CloseDoor(DOOR_CLOSE_2); - /* (needed after displaying title screens which disable auto repeat) */ KeyboardAutoRepeatOn(); @@ -2159,10 +2155,12 @@ static void DrawInfoScreen_Main() FadeOut(fade_mask); - OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); + ChangeViewportPropertiesIfNeeded(); ClearField(); + OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); + DrawTextSCentered(mSY - SY + 16, FONT_TITLE_1, "Info Screen"); info_info = info_info_main; @@ -2662,6 +2660,10 @@ void DrawInfoScreen_HelpText(int element, int action, int direction, int ypos) void DrawInfoScreen_TitleScreen() { + game_status_last_screen = GAME_MODE_INFO; + + SetGameStatus(GAME_MODE_TITLE); + DrawTitleScreen(); } @@ -3593,7 +3595,7 @@ void HandleTypeName(int newxpos, Key key) is_active = FALSE; - game_status = GAME_MODE_MAIN; + SetGameStatus(GAME_MODE_MAIN); } else if (key == KSYM_Escape) { @@ -3601,7 +3603,7 @@ void HandleTypeName(int newxpos, Key key) is_active = FALSE; - game_status = GAME_MODE_MAIN; + SetGameStatus(GAME_MODE_MAIN); } if (is_active) @@ -3639,7 +3641,7 @@ static void DrawChooseTree(TreeInfo **ti_ptr) if (strEqual((*ti_ptr)->subdir, STRING_TOP_DIRECTORY)) { - game_status = GAME_MODE_MAIN; + SetGameStatus(GAME_MODE_MAIN); DrawMainMenu(); @@ -3651,14 +3653,12 @@ static void DrawChooseTree(TreeInfo **ti_ptr) FreeScreenGadgets(); CreateScreenGadgets(); - CloseDoor(DOOR_CLOSE_2); - FadeOut(fade_mask); - OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); - ClearField(); + OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); + HandleChooseTree(0, 0, 0, 0, MB_MENU_INITIALIZE, ti_ptr); MapScreenTreeGadgets(*ti_ptr); @@ -3718,7 +3718,7 @@ static void drawChooseTreeList(int first_entry, int num_page_entries, initCursor(i, IMG_MENU_BUTTON); } - game_status = last_game_status; /* restore current game status */ + SetGameStatus(last_game_status); /* restore current game status */ redraw_mask |= REDRAW_FIELD; } @@ -3775,7 +3775,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, else num_page_entries = NUM_MENU_ENTRIES_ON_SCREEN; - game_status = last_game_status; /* restore current game status */ + SetGameStatus(last_game_status); /* restore current game status */ if (button == MB_MENU_INITIALIZE) { @@ -3826,8 +3826,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, setup_mode == SETUP_MODE_CHOOSE_SCROLL_DELAY || setup_mode == SETUP_MODE_CHOOSE_SNAPSHOT_MODE) execSetupGame(); - else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE || - setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE || + else if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE || setup_mode == SETUP_MODE_CHOOSE_SCALING_TYPE) execSetupGraphics(); else if (setup_mode == SETUP_MODE_CHOOSE_VOLUME_SIMPLE || @@ -3850,7 +3849,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, HandleMainMenu_SelectLevel(0, 0, new_level_nr); } - game_status = GAME_MODE_MAIN; + SetGameStatus(GAME_MODE_MAIN); DrawMainMenu(); } @@ -3865,7 +3864,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, x = (mx - mSX) / 32; y = (my - mSY) / 32 - MENU_SCREEN_START_YPOS; - game_status = last_game_status; /* restore current game status */ + SetGameStatus(last_game_status); /* restore current game status */ } else if (dx || dy) /* keyboard or scrollbar/scrollbutton input */ { @@ -4024,8 +4023,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, setup_mode == SETUP_MODE_CHOOSE_SCROLL_DELAY || setup_mode == SETUP_MODE_CHOOSE_SNAPSHOT_MODE) execSetupGame(); - else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE || - setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE || + else if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE || setup_mode == SETUP_MODE_CHOOSE_SCALING_TYPE) execSetupGraphics(); else if (setup_mode == SETUP_MODE_CHOOSE_VOLUME_SIMPLE || @@ -4048,7 +4046,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, HandleMainMenu_SelectLevel(0, 0, new_level_nr); } - game_status = GAME_MODE_MAIN; + SetGameStatus(GAME_MODE_MAIN); DrawMainMenu(); } @@ -4137,9 +4135,6 @@ void DrawHallOfFame(int highlight_position) { int fade_mask = REDRAW_FIELD; - /* required before door position may be changed in next step */ - CloseDoor(DOOR_CLOSE_ALL); - /* needed if different viewport properties defined for scores */ ChangeViewportPropertiesIfNeeded(); @@ -4264,7 +4259,7 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button) FadeSound(SND_BACKGROUND_SCORES); - game_status = GAME_MODE_MAIN; + SetGameStatus(GAME_MODE_MAIN); DrawMainMenu(); } @@ -4274,7 +4269,7 @@ void HandleHallOfFame(int mx, int my, int dx, int dy, int button) FadeSound(SND_BACKGROUND_SCORES); - game_status = GAME_MODE_MAIN; + SetGameStatus(GAME_MODE_MAIN); DrawMainMenu(); } @@ -4292,7 +4287,6 @@ static struct TokenInfo *setup_info; static int num_setup_info; /* number of setup entries shown on screen */ static int max_setup_info; /* total number of setup entries in list */ -static char *screen_mode_text; static char *window_size_text; static char *scaling_type_text; static char *scroll_delay_text; @@ -4387,31 +4381,31 @@ static void execSetupGame_setScrollDelays() setString(&ti->identifier, identifier); setString(&ti->name, name); setString(&ti->name_sorting, name); - setString(&ti->infotext, "Scaling Type"); + setString(&ti->infotext, "Scroll Delay"); pushTreeInfo(&scroll_delays, ti); } - /* sort scaling type values to start with lowest scaling type value */ + /* sort scroll delay values to start with lowest scroll delay value */ sortTreeInfo(&scroll_delays); - /* set current scaling type value to configured scaling type value */ + /* set current scroll delay value to configured scroll delay value */ scroll_delay_current = getTreeInfoFromIdentifier(scroll_delays,i_to_a(setup.scroll_delay_value)); - /* if that fails, set current scaling type to reliable default value */ + /* if that fails, set current scroll delay to reliable default value */ if (scroll_delay_current == NULL) scroll_delay_current = getTreeInfoFromIdentifier(scroll_delays, i_to_a(STD_SCROLL_DELAY)); - /* if that also fails, set current scaling type to first available value */ + /* if that also fails, set current scroll delay to first available value */ if (scroll_delay_current == NULL) scroll_delay_current = scroll_delays; } setup.scroll_delay_value = atoi(scroll_delay_current->identifier); - /* needed for displaying scaling type text instead of identifier */ + /* needed for displaying scroll delay text instead of identifier */ scroll_delay_text = scroll_delay_current->name; } @@ -4639,67 +4633,6 @@ static void execSetupGraphics_setScalingTypes() scaling_type_text = scaling_type_current->name; } -static void execSetupGraphics_setScreenModes() -{ - // if (screen_modes == NULL && video.fullscreen_available) - if (screen_modes == NULL && video.fullscreen_modes != NULL) - { - int i; - - for (i = 0; video.fullscreen_modes[i].width != -1; i++) - { - TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED); - char identifier[32], name[32]; - int x = video.fullscreen_modes[i].width; - int y = video.fullscreen_modes[i].height; - int xx, yy; - - get_aspect_ratio_from_screen_mode(&video.fullscreen_modes[i], &xx, &yy); - - ti->node_top = &screen_modes; - ti->sort_priority = x * 10000 + y; - - sprintf(identifier, "%dx%d", x, y); - sprintf(name, "%d x %d [%d:%d]", x, y, xx, yy); - - setString(&ti->identifier, identifier); - setString(&ti->name, name); - setString(&ti->name_sorting, name); - setString(&ti->infotext, "Fullscreen Mode"); - - pushTreeInfo(&screen_modes, ti); - } - - /* sort fullscreen modes to start with lowest available screen resolution */ - sortTreeInfo(&screen_modes); - - /* set current screen mode for fullscreen mode to configured setup value */ - screen_mode_current = getTreeInfoFromIdentifier(screen_modes, - setup.fullscreen_mode); - - /* if that fails, set current screen mode to reliable default value */ - if (screen_mode_current == NULL) - screen_mode_current = getTreeInfoFromIdentifier(screen_modes, - DEFAULT_FULLSCREEN_MODE); - - /* if that also fails, set current screen mode to first available mode */ - if (screen_mode_current == NULL) - screen_mode_current = screen_modes; - - if (screen_mode_current == NULL) - video.fullscreen_available = FALSE; - } - - // if (video.fullscreen_available) - if (screen_mode_current != NULL) - { - setup.fullscreen_mode = screen_mode_current->identifier; - - /* needed for displaying screen mode name instead of identifier */ - screen_mode_text = screen_mode_current->name; - } -} - static void execSetupGraphics() { if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE) @@ -4714,7 +4647,6 @@ static void execSetupGraphics() } execSetupGraphics_setScalingTypes(); - execSetupGraphics_setScreenModes(); setup_mode = SETUP_MODE_GRAPHICS; @@ -4730,8 +4662,7 @@ static void execSetupGraphics() #endif } -#if !defined(PLATFORM_ANDROID) -#if defined(TARGET_SDL2) +#if defined(TARGET_SDL2) && !defined(PLATFORM_ANDROID) static void execSetupChooseWindowSize() { setup_mode = SETUP_MODE_CHOOSE_WINDOW_SIZE; @@ -4745,17 +4676,6 @@ static void execSetupChooseScalingType() DrawSetupScreen(); } -#else -static void execSetupChooseScreenMode() -{ - if (!video.fullscreen_available) - return; - - setup_mode = SETUP_MODE_CHOOSE_SCREEN_MODE; - - DrawSetupScreen(); -} -#endif #endif static void execSetupChooseVolumeSimple() @@ -5264,7 +5184,7 @@ static void execSetupShortcuts5() static void execExitSetup() { - game_status = GAME_MODE_MAIN; + SetGameStatus(GAME_MODE_MAIN); DrawMainMenu(); } @@ -5354,17 +5274,12 @@ static struct TokenInfo setup_info_editor[] = static struct TokenInfo setup_info_graphics[] = { -#if !defined(PLATFORM_ANDROID) +#if defined(TARGET_SDL2) && !defined(PLATFORM_ANDROID) { TYPE_SWITCH, &setup.fullscreen, "Fullscreen:" }, -#if defined(TARGET_SDL2) { TYPE_ENTER_LIST, execSetupChooseWindowSize, "Window Scaling:" }, { TYPE_STRING, &window_size_text, "" }, { TYPE_ENTER_LIST, execSetupChooseScalingType, "Anti-Aliasing:" }, { TYPE_STRING, &scaling_type_text, "" }, -#else - { TYPE_ENTER_LIST, execSetupChooseScreenMode, "Fullscreen Mode:" }, - { TYPE_STRING, &screen_mode_text, "" }, -#endif #endif #if 0 { TYPE_ENTER_LIST, execSetupChooseScrollDelay, "Scroll Delay:" }, @@ -5374,7 +5289,7 @@ static struct TokenInfo setup_info_graphics[] = { TYPE_SWITCH, &setup.quick_switch, "Quick Player Focus Switch:" }, { TYPE_SWITCH, &setup.quick_doors, "Quick Menu Doors:" }, { TYPE_SWITCH, &setup.show_titlescreen,"Show Title Screens:" }, - { TYPE_SWITCH, &setup.toons, "Show Toons:" }, + { TYPE_SWITCH, &setup.toons, "Show Menu Animations:" }, { TYPE_ECS_AGA, &setup.prefer_aga_graphics,"EMC graphics preference:" }, { TYPE_SWITCH, &setup.sp_show_border_elements,"Supaplex Border Elements:" }, { TYPE_SWITCH, &setup.small_game_graphics, "Small Game Graphics:" }, @@ -5593,8 +5508,7 @@ static Key getSetupKey() DoAnimation(); BackToFront(); - /* don't eat all CPU time */ - Delay(10); + WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value); } return key; @@ -5765,17 +5679,15 @@ static void DrawSetupScreen_Generic() FreeScreenGadgets(); CreateScreenGadgets(); - CloseDoor(DOOR_CLOSE_2); - if (redraw_mask & REDRAW_ALL) redraw_all = TRUE; FadeOut(fade_mask); - OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); - ClearField(); + OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); + if (setup_mode == SETUP_MODE_MAIN) { setup_info = setup_info_main; @@ -6281,8 +6193,7 @@ void CustomizeKeyboard(int player_nr) DoAnimation(); BackToFront(); - /* don't eat all CPU time */ - Delay(10); + WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value); } /* write new key bindings back to player setup */ @@ -6437,8 +6348,7 @@ static boolean CalibrateJoystickMain(int player_nr) DoAnimation(); BackToFront(); - /* don't eat all CPU time */ - Delay(10); + WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value); } /* calibrated center position (joystick should now be centered) */ @@ -6460,7 +6370,7 @@ static boolean CalibrateJoystickMain(int player_nr) NextEvent(&event); HandleOtherEvents(&event); - Delay(10); + WaitUntilDelayReached(&sync_frame_delay, sync_frame_delay_value); } } @@ -6504,8 +6414,6 @@ void DrawSetupScreen() DrawChooseTree(&scroll_delay_current); else if (setup_mode == SETUP_MODE_CHOOSE_SNAPSHOT_MODE) DrawChooseTree(&snapshot_mode_current); - else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE) - DrawChooseTree(&screen_mode_current); else if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE) DrawChooseTree(&window_size_current); else if (setup_mode == SETUP_MODE_CHOOSE_SCALING_TYPE) @@ -6557,8 +6465,6 @@ void HandleSetupScreen(int mx, int my, int dx, int dy, int button) HandleChooseTree(mx, my, dx, dy, button, &scroll_delay_current); else if (setup_mode == SETUP_MODE_CHOOSE_SNAPSHOT_MODE) HandleChooseTree(mx, my, dx, dy, button, &snapshot_mode_current); - else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE) - HandleChooseTree(mx, my, dx, dy, button, &screen_mode_current); else if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE) HandleChooseTree(mx, my, dx, dy, button, &window_size_current); else if (setup_mode == SETUP_MODE_CHOOSE_SCALING_TYPE) @@ -6918,7 +6824,7 @@ void CreateScreenGadgets() CreateScreenScrollbuttons(); CreateScreenScrollbars(); - game_status = last_game_status; /* restore current game status */ + SetGameStatus(last_game_status); /* restore current game status */ } void FreeScreenGadgets()