X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=601c05de45e3ff278c40ea8e637e5d7960caa8ab;hb=483d088f2bd4dd2ee267aff416503b2c667a69d3;hp=7e87e50dc7117cd912e91db620e12e2a2f26eb36;hpb=d41f47ca417187ce83d23c6db9cd42c543678980;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index 7e87e50d..601c05de 100644 --- a/src/screens.c +++ b/src/screens.c @@ -126,6 +126,7 @@ // other screen text constants #define STR_CHOOSE_TREE_EDIT "Edit" #define MENU_CHOOSE_TREE_FONT(x) (FONT_TEXT_1 + (x)) +#define MENU_CHOOSE_TREE_COLOR(ti, a) TREE_COLOR(ti, a) // for input setup functions #define SETUPINPUT_SCREEN_POS_START 0 @@ -1629,9 +1630,8 @@ void DrawMainMenu(void) return; } - // leveldir_current may be invalid (level group, parent link) - if (!validLevelSeries(leveldir_current)) - leveldir_current = getFirstValidTreeInfoEntry(leveldir_last_valid); + // leveldir_current may be invalid (level group, parent link, node copy) + leveldir_current = getValidLevelSeries(leveldir_current, leveldir_last_valid); if (leveldir_current != leveldir_last_valid) { @@ -1738,6 +1738,16 @@ void DrawMainMenu(void) SetMouseCursor(CURSOR_DEFAULT); OpenDoor(DOOR_CLOSE_1 | DOOR_OPEN_2); + +#if defined(PLATFORM_EMSCRIPTEN) + EM_ASM + ( + FS.syncfs(function(err) + { + assert(!err); + }); + ); +#endif } static void gotoTopLevelDir(void) @@ -2212,7 +2222,8 @@ void HandleMainMenu(int mx, int my, int dx, int dy, int button) SaveLevelSetup_LastSeries(); SaveLevelSetup_SeriesInfo(); - if (Request("Do you really want to quit?", REQ_ASK | REQ_STAY_CLOSED)) + if (!setup.ask_on_quit_program || + Request("Do you really want to quit?", REQ_ASK | REQ_STAY_CLOSED)) SetGameStatus(GAME_MODE_QUIT); } } @@ -4408,9 +4419,8 @@ static void drawChooseTreeText(int y, boolean active, TreeInfo *ti) int entry_pos = first_entry + y; TreeInfo *node_first = getTreeInfoFirstGroupEntry(ti); TreeInfo *node = getTreeInfoFromPos(node_first, entry_pos); - int node_color = (node->color == FC_YELLOW ? FC_GREEN : node->color); - int color = (active ? FC_YELLOW : node_color); - int font_nr = MENU_CHOOSE_TREE_FONT(color); + int font_color = MENU_CHOOSE_TREE_COLOR(node, active); + int font_nr = MENU_CHOOSE_TREE_FONT(font_color); int font_xoffset = getFontBitmapInfo(font_nr)->draw_xoffset; int xpos = MENU_SCREEN_START_XPOS; int ypos = MENU_SCREEN_START_YPOS + y; @@ -4503,6 +4513,12 @@ static void drawChooseTreeInfo(int entry_pos, TreeInfo *ti) MarkTileDirty(x, 1); } +static void drawChooseTreeCursorAndText(int y, boolean active, TreeInfo *ti) +{ + drawChooseTreeCursor(y, active); + drawChooseTreeText(y, active, ti); +} + static void HandleChooseTree(int mx, int my, int dx, int dy, int button, TreeInfo **ti_ptr) { @@ -4550,7 +4566,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, drawChooseTreeList(ti->cl_first, num_page_entries, ti); drawChooseTreeInfo(ti->cl_first + ti->cl_cursor, ti); - drawChooseTreeCursor(ti->cl_cursor, TRUE); + drawChooseTreeCursorAndText(ti->cl_cursor, TRUE, ti); return; } @@ -4660,7 +4676,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, { drawChooseTreeList(ti->cl_first, num_page_entries, ti); drawChooseTreeInfo(ti->cl_first + ti->cl_cursor, ti); - drawChooseTreeCursor(ti->cl_cursor, TRUE); + drawChooseTreeCursorAndText(ti->cl_cursor, TRUE, ti); AdjustChooseTreeScrollbar(SCREEN_CTRL_ID_SCROLL_VERTICAL, ti->cl_first, ti); @@ -4724,8 +4740,8 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, { PlaySound(SND_MENU_ITEM_ACTIVATING); - drawChooseTreeCursor(ti->cl_cursor, FALSE); - drawChooseTreeCursor(y, TRUE); + drawChooseTreeCursorAndText(ti->cl_cursor, FALSE, ti); + drawChooseTreeCursorAndText(y, TRUE, ti); drawChooseTreeInfo(ti->cl_first + y, ti); ti->cl_cursor = y; @@ -4863,6 +4879,9 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, LoadLevelSetup_LastSeries(); LoadLevelSetup_SeriesInfo(); + // update list of last played level sets + UpdateLastPlayedLevels_TreeInfo(); + TapeErase(); ToggleFullscreenIfNeeded(); @@ -6713,6 +6732,8 @@ static struct TokenInfo setup_info_game[] = { TYPE_SWITCH, &setup.count_score_after_game,"Count Score After Game:" }, { TYPE_SWITCH, &setup.show_scores_after_game,"Show Scores After Game:" }, { TYPE_YES_NO, &setup.ask_on_game_over, "Ask on Game Over:" }, + { TYPE_YES_NO, &setup.ask_on_quit_game, "Ask on Quit Game:" }, + { TYPE_YES_NO, &setup.ask_on_quit_program, "Ask on Quit Program:" }, { TYPE_SWITCH, &setup.autorecord, "Auto-Record Tapes:" }, { TYPE_ENTER_LIST, execSetupChooseGameSpeed, "Game Speed:" }, { TYPE_STRING, &game_speed_text, "" },