X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fscreens.c;h=2b798954ff5b9541f48137849c05271add7fca5e;hb=adf5287f4ea598a54facd610c8bf195a4bc61d30;hp=29e4f3cb7fe53435d4a88343eb94dca0d3b7717d;hpb=b6b5d3fe94b178e8e48e9c51b61f3b1b8383a42f;p=rocksndiamonds.git diff --git a/src/screens.c b/src/screens.c index 29e4f3cb..2b798954 100644 --- a/src/screens.c +++ b/src/screens.c @@ -68,27 +68,31 @@ #define SETUP_MODE_CHOOSE_GAME_SPEED 18 #define SETUP_MODE_CHOOSE_SCROLL_DELAY 19 #define SETUP_MODE_CHOOSE_SNAPSHOT_MODE 20 -#define SETUP_MODE_CHOOSE_WINDOW_SIZE 21 -#define SETUP_MODE_CHOOSE_SCALING_TYPE 22 -#define SETUP_MODE_CHOOSE_RENDERING 23 -#define SETUP_MODE_CHOOSE_VSYNC 24 -#define SETUP_MODE_CHOOSE_GRAPHICS 25 -#define SETUP_MODE_CHOOSE_SOUNDS 26 -#define SETUP_MODE_CHOOSE_MUSIC 27 -#define SETUP_MODE_CHOOSE_VOLUME_SIMPLE 28 -#define SETUP_MODE_CHOOSE_VOLUME_LOOPS 29 -#define SETUP_MODE_CHOOSE_VOLUME_MUSIC 30 -#define SETUP_MODE_CHOOSE_TOUCH_CONTROL 31 -#define SETUP_MODE_CHOOSE_MOVE_DISTANCE 32 -#define SETUP_MODE_CHOOSE_DROP_DISTANCE 33 -#define SETUP_MODE_CHOOSE_TRANSPARENCY 34 -#define SETUP_MODE_CHOOSE_GRID_XSIZE_0 35 -#define SETUP_MODE_CHOOSE_GRID_YSIZE_0 36 -#define SETUP_MODE_CHOOSE_GRID_XSIZE_1 37 -#define SETUP_MODE_CHOOSE_GRID_YSIZE_1 38 -#define SETUP_MODE_CONFIG_VIRT_BUTTONS 39 - -#define MAX_SETUP_MODES 40 +#define SETUP_MODE_CHOOSE_BD_PALETTE_C64 21 +#define SETUP_MODE_CHOOSE_BD_PALETTE_C64DTV 22 +#define SETUP_MODE_CHOOSE_BD_PALETTE_ATARI 23 +#define SETUP_MODE_CHOOSE_BD_COLOR_TYPE 24 +#define SETUP_MODE_CHOOSE_WINDOW_SIZE 25 +#define SETUP_MODE_CHOOSE_SCALING_TYPE 26 +#define SETUP_MODE_CHOOSE_RENDERING 27 +#define SETUP_MODE_CHOOSE_VSYNC 28 +#define SETUP_MODE_CHOOSE_GRAPHICS 29 +#define SETUP_MODE_CHOOSE_SOUNDS 30 +#define SETUP_MODE_CHOOSE_MUSIC 31 +#define SETUP_MODE_CHOOSE_VOLUME_SIMPLE 32 +#define SETUP_MODE_CHOOSE_VOLUME_LOOPS 33 +#define SETUP_MODE_CHOOSE_VOLUME_MUSIC 34 +#define SETUP_MODE_CHOOSE_TOUCH_CONTROL 35 +#define SETUP_MODE_CHOOSE_MOVE_DISTANCE 36 +#define SETUP_MODE_CHOOSE_DROP_DISTANCE 37 +#define SETUP_MODE_CHOOSE_TRANSPARENCY 38 +#define SETUP_MODE_CHOOSE_GRID_XSIZE_0 39 +#define SETUP_MODE_CHOOSE_GRID_YSIZE_0 40 +#define SETUP_MODE_CHOOSE_GRID_XSIZE_1 41 +#define SETUP_MODE_CHOOSE_GRID_YSIZE_1 42 +#define SETUP_MODE_CONFIG_VIRT_BUTTONS 43 + +#define MAX_SETUP_MODES 44 #define MAX_MENU_MODES MAX(MAX_INFO_MODES, MAX_SETUP_MODES) @@ -121,6 +125,10 @@ #define STR_SETUP_CHOOSE_GAME_SPEED "Game Speed" #define STR_SETUP_CHOOSE_SCROLL_DELAY "Scroll Delay" #define STR_SETUP_CHOOSE_SNAPSHOT_MODE "Snapshot Mode" +#define STR_SETUP_CHOOSE_BD_PALETTE_C64 "Palette (C64)" +#define STR_SETUP_CHOOSE_BD_PALETTE_C64DTV "Palette (C64DTV)" +#define STR_SETUP_CHOOSE_BD_PALETTE_ATARI "Palette (Atari)" +#define STR_SETUP_CHOOSE_BD_COLOR_TYPE "Color Type" #define STR_SETUP_CHOOSE_WINDOW_SIZE "Window Scaling" #define STR_SETUP_CHOOSE_SCALING_TYPE "Anti-Aliasing" #define STR_SETUP_CHOOSE_RENDERING "Rendering Mode" @@ -367,6 +375,18 @@ static TreeInfo *scroll_delay_current = NULL; static TreeInfo *snapshot_modes = NULL; static TreeInfo *snapshot_mode_current = NULL; +static TreeInfo *bd_palettes_c64 = NULL; +static TreeInfo *bd_palette_c64_current = NULL; + +static TreeInfo *bd_palettes_c64dtv = NULL; +static TreeInfo *bd_palette_c64dtv_current = NULL; + +static TreeInfo *bd_palettes_atari = NULL; +static TreeInfo *bd_palette_atari_current = NULL; + +static TreeInfo *bd_color_types = NULL; +static TreeInfo *bd_color_type_current = NULL; + static TreeInfo *scores_types = NULL; static TreeInfo *scores_type_current = NULL; @@ -410,216 +430,264 @@ static TreeInfo *score_entry_current = NULL; static struct ValueTextInfo window_sizes_list[] = { - { 50, "50 %" }, - { 80, "80 %" }, - { 90, "90 %" }, - { 100, "100 % (Default)" }, - { 110, "110 %" }, - { 120, "120 %" }, - { 130, "130 %" }, - { 140, "140 %" }, - { 150, "150 %" }, - { 200, "200 %" }, - { 250, "250 %" }, - { 300, "300 %" }, - - { -1, NULL }, + { 50, "50 %" }, + { 80, "80 %" }, + { 90, "90 %" }, + { 100, "100 % (Default)" }, + { 110, "110 %" }, + { 120, "120 %" }, + { 130, "130 %" }, + { 140, "140 %" }, + { 150, "150 %" }, + { 200, "200 %" }, + { 250, "250 %" }, + { 300, "300 %" }, + + { -1, NULL }, }; static struct StringValueTextInfo scaling_types_list[] = { - { SCALING_QUALITY_NEAREST, "Off" }, - { SCALING_QUALITY_LINEAR, "Linear" }, - { SCALING_QUALITY_BEST, "Anisotropic" }, + { SCALING_QUALITY_NEAREST, "Off" }, + { SCALING_QUALITY_LINEAR, "Linear" }, + { SCALING_QUALITY_BEST, "Anisotropic" }, - { NULL, NULL }, + { NULL, NULL }, }; static struct StringValueTextInfo rendering_modes_list[] = { - { STR_SPECIAL_RENDERING_OFF, "Off (May show artifacts, fast)" }, - { STR_SPECIAL_RENDERING_BITMAP, "Bitmap/Texture mode (slower)" }, + { STR_SPECIAL_RENDERING_OFF, "Off (May show artifacts, fast)"}, + { STR_SPECIAL_RENDERING_BITMAP, "Bitmap/Texture mode (slower)" }, #if DEBUG // this mode may work under certain conditions, but does not work on Windows - { STR_SPECIAL_RENDERING_TARGET, "Target Texture mode (slower)" }, + { STR_SPECIAL_RENDERING_TARGET, "Target Texture mode (slower)" }, #endif - { STR_SPECIAL_RENDERING_DOUBLE, "Double Texture mode (slower)" }, + { STR_SPECIAL_RENDERING_DOUBLE, "Double Texture mode (slower)" }, - { NULL, NULL }, + { NULL, NULL }, }; static struct StringValueTextInfo vsync_modes_list[] = { - { STR_VSYNC_MODE_OFF, "Off" }, - { STR_VSYNC_MODE_NORMAL, "Normal" }, - { STR_VSYNC_MODE_ADAPTIVE, "Adaptive" }, + { STR_VSYNC_MODE_OFF, "Off" }, + { STR_VSYNC_MODE_NORMAL, "Normal" }, + { STR_VSYNC_MODE_ADAPTIVE, "Adaptive" }, - { NULL, NULL }, + { NULL, NULL }, }; static struct StringValueTextInfo scores_types_list[] = { - { STR_SCORES_TYPE_LOCAL_ONLY, "Local scores only" }, - { STR_SCORES_TYPE_SERVER_ONLY, "Server scores only" }, - { STR_SCORES_TYPE_LOCAL_AND_SERVER, "Local and server scores" }, + { STR_SCORES_TYPE_LOCAL_ONLY, "Local scores only" }, + { STR_SCORES_TYPE_SERVER_ONLY, "Server scores only" }, + { STR_SCORES_TYPE_LOCAL_AND_SERVER, "Local and server scores" }, - { NULL, NULL }, + { NULL, NULL }, }; static struct ValueTextInfo game_speeds_list_normal[] = { - { 30, "Very Slow" }, - { 25, "Slow" }, - { 20, "Normal" }, - { 15, "Fast" }, - { 10, "Very Fast" }, + { 30, "Very Slow" }, + { 25, "Slow" }, + { 20, "Normal" }, + { 15, "Fast" }, + { 10, "Very Fast" }, - { -1, NULL }, + { -1, NULL }, }; static struct ValueTextInfo game_speeds_list_extended[] = { - { 1000, "1 fps (Extremely Slow)" }, - { 500, "2 fps" }, - { 200, "5 fps" }, - { 100, "10 fps" }, - { 50, "20 fps" }, - { 29, "35 fps (Original Supaplex)" }, - { 25, "40 fps" }, - { 20, "50 fps (=== Normal Speed ===)" }, - { 16, "60 fps (60 Hz VSync Speed)" }, - { 14, "70 fps (Maximum Supaplex)" }, - { 10, "100 fps" }, - { 5, "200 fps" }, - { 2, "500 fps" }, - { 1, "1000 fps (Extremely Fast)" }, - - { -1, NULL }, + { 1000, "1 fps (Extremely Slow)" }, + { 500, "2 fps" }, + { 200, "5 fps" }, + { 100, "10 fps" }, + { 50, "20 fps" }, + { 29, "35 fps (Original Supaplex)" }, + { 25, "40 fps" }, + { 20, "50 fps (=== Normal Speed ===)" }, + { 16, "60 fps (60 Hz VSync Speed)" }, + { 14, "70 fps (Maximum Supaplex)" }, + { 10, "100 fps" }, + { 5, "200 fps" }, + { 2, "500 fps" }, + { 1, "1000 fps (Extremely Fast)" }, + + { -1, NULL }, }; static struct ValueTextInfo *game_speeds_list; static struct ValueTextInfo scroll_delays_list[] = { - { 0, "0 Tiles (No Scroll Delay)" }, - { 1, "1 Tile" }, - { 2, "2 Tiles" }, - { 3, "3 Tiles (Default)" }, - { 4, "4 Tiles" }, - { 5, "5 Tiles" }, - { 6, "6 Tiles" }, - { 7, "7 Tiles" }, - { 8, "8 Tiles (Maximum Scroll Delay)"}, - - { -1, NULL }, + { 0, "0 Tiles (No Scroll Delay)" }, + { 1, "1 Tile" }, + { 2, "2 Tiles" }, + { 3, "3 Tiles (Default)" }, + { 4, "4 Tiles" }, + { 5, "5 Tiles" }, + { 6, "6 Tiles" }, + { 7, "7 Tiles" }, + { 8, "8 Tiles (Maximum Scroll Delay)"}, + + { -1, NULL }, }; static struct StringValueTextInfo 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_EVERY_COLLECT, "Every Collect" }, + { 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 }, +}; + +static struct ValueTextInfo bd_palettes_c64_list[] = +{ + { GD_PALETTE_C64_VICE_NEW, "Vice new" }, + { GD_PALETTE_C64_VICE_OLD, "Vice old" }, + { GD_PALETTE_C64_VIDE_DEFAULT, "Vice default" }, + { GD_PALETTE_C64_C64HQ, "C64HQ" }, + { GD_PALETTE_C64_C64S, "C64S" }, + { GD_PALETTE_C64_CCS64, "CCS64" }, + { GD_PALETTE_C64_FRODO, "Frodo" }, + { GD_PALETTE_C64_GODOT, "GoDot" }, + { GD_PALETTE_C64_PC64, "PC64" }, + { GD_PALETTE_C64_RTADASH, "RTADash" }, + + { -1, NULL }, +}; + +static struct ValueTextInfo bd_palettes_c64dtv_list[] = +{ + { GD_PALETTE_C64DTV_SPIFF, "Spiff" }, + { GD_PALETTE_C64DTV_MURRAY, "Murray" }, - { NULL, NULL }, + { -1, NULL }, +}; + +static struct ValueTextInfo bd_palettes_atari_list[] = +{ + { GD_PALETTE_ATARI_BUILTIN, "BuiltIn" }, + { GD_PALETTE_ATARI_BUILTIN_CONTRAST, "BuiltIn contrast" }, + { GD_PALETTE_ATARI_DEFAULT, "Default" }, + { GD_PALETTE_ATARI_JAKUB, "Jakub" }, + { GD_PALETTE_ATARI_JAKUB_CONTRAST, "Jakub contrast" }, + { GD_PALETTE_ATARI_REAL, "Real" }, + { GD_PALETTE_ATARI_REAL_CONTRAST, "Real contrast" }, + { GD_PALETTE_ATARI_XFORMER, "XFormer" }, + + { -1, NULL }, +}; + +static struct ValueTextInfo bd_color_types_list[] = +{ + { GD_COLOR_TYPE_RGB, "RGB colors" }, + { GD_COLOR_TYPE_C64, "C64 colors" }, + { GD_COLOR_TYPE_C64DTV, "C64DTV colors" }, + { GD_COLOR_TYPE_ATARI, "Atari colors" }, + + { -1, NULL }, }; static struct ValueTextInfo volumes_list[] = { - { 0, "0 %" }, - { 1, "1 %" }, - { 2, "2 %" }, - { 5, "5 %" }, - { 10, "10 %" }, - { 20, "20 %" }, - { 30, "30 %" }, - { 40, "40 %" }, - { 50, "50 %" }, - { 60, "60 %" }, - { 70, "70 %" }, - { 80, "80 %" }, - { 90, "90 %" }, - { 100, "100 %" }, - - { -1, NULL }, + { 0, "0 %" }, + { 1, "1 %" }, + { 2, "2 %" }, + { 5, "5 %" }, + { 10, "10 %" }, + { 20, "20 %" }, + { 30, "30 %" }, + { 40, "40 %" }, + { 50, "50 %" }, + { 60, "60 %" }, + { 70, "70 %" }, + { 80, "80 %" }, + { 90, "90 %" }, + { 100, "100 %" }, + + { -1, NULL }, }; static struct StringValueTextInfo touch_controls_list[] = { - { TOUCH_CONTROL_OFF, "Off" }, - { TOUCH_CONTROL_VIRTUAL_BUTTONS, "Virtual Buttons" }, - { TOUCH_CONTROL_WIPE_GESTURES, "Wipe Gestures" }, - { TOUCH_CONTROL_FOLLOW_FINGER, "Follow Finger" }, + { TOUCH_CONTROL_OFF, "Off" }, + { TOUCH_CONTROL_VIRTUAL_BUTTONS, "Virtual Buttons" }, + { TOUCH_CONTROL_WIPE_GESTURES, "Wipe Gestures" }, + { TOUCH_CONTROL_FOLLOW_FINGER, "Follow Finger" }, - { NULL, NULL }, + { NULL, NULL }, }; static struct ValueTextInfo distances_list[] = { - { 1, "1 %" }, - { 2, "2 %" }, - { 3, "3 %" }, - { 4, "4 %" }, - { 5, "5 %" }, - { 10, "10 %" }, - { 15, "15 %" }, - { 20, "20 %" }, - { 25, "25 %" }, - - { -1, NULL }, + { 1, "1 %" }, + { 2, "2 %" }, + { 3, "3 %" }, + { 4, "4 %" }, + { 5, "5 %" }, + { 10, "10 %" }, + { 15, "15 %" }, + { 20, "20 %" }, + { 25, "25 %" }, + + { -1, NULL }, }; static struct ValueTextInfo transparencies_list[] = { - { 0, "0 % (Opaque)" }, - { 10, "10 %" }, - { 20, "20 %" }, - { 30, "30 %" }, - { 40, "40 %" }, - { 50, "50 %" }, - { 60, "60 %" }, - { 70, "70 %" }, - { 80, "80 %" }, - { 90, "90 %" }, - { 100, "100 % (Invisible)" }, - - { -1, NULL }, + { 0, "0 % (Opaque)" }, + { 10, "10 %" }, + { 20, "20 %" }, + { 30, "30 %" }, + { 40, "40 %" }, + { 50, "50 %" }, + { 60, "60 %" }, + { 70, "70 %" }, + { 80, "80 %" }, + { 90, "90 %" }, + { 100, "100 % (Invisible)" }, + + { -1, NULL }, }; static struct ValueTextInfo grid_sizes_list[] = { - { 3, "3" }, - { 4, "4" }, - { 5, "5" }, - { 6, "6" }, - { 7, "7" }, - { 8, "8" }, - { 9, "9" }, - { 10, "10" }, - { 11, "11" }, - { 12, "12" }, - { 13, "13" }, - { 14, "14" }, - { 15, "15" }, - { 16, "16" }, - { 17, "17" }, - { 18, "18" }, - { 19, "19" }, - { 20, "20" }, - { 21, "21" }, - { 22, "22" }, - { 23, "23" }, - { 24, "24" }, - { 25, "25" }, - { 26, "26" }, - { 27, "27" }, - { 28, "28" }, - { 29, "29" }, - { 30, "30" }, - { 31, "31" }, - { 32, "32" }, - - { -1, NULL }, + { 3, "3" }, + { 4, "4" }, + { 5, "5" }, + { 6, "6" }, + { 7, "7" }, + { 8, "8" }, + { 9, "9" }, + { 10, "10" }, + { 11, "11" }, + { 12, "12" }, + { 13, "13" }, + { 14, "14" }, + { 15, "15" }, + { 16, "16" }, + { 17, "17" }, + { 18, "18" }, + { 19, "19" }, + { 20, "20" }, + { 21, "21" }, + { 22, "22" }, + { 23, "23" }, + { 24, "24" }, + { 25, "25" }, + { 26, "26" }, + { 27, "27" }, + { 28, "28" }, + { 29, "29" }, + { 30, "30" }, + { 31, "31" }, + { 32, "32" }, + + { -1, NULL }, }; static int align_xoffset = 0; @@ -1119,6 +1187,27 @@ static int compareTitleControlInfo(const void *object1, const void *object2) return compare_result; } +static boolean CheckTitleScreen_BD(int nr, boolean initial) +{ + // only show BD style title screen for native BD level sets + if (level.game_engine_type != GAME_ENGINE_TYPE_BD) + return FALSE; + + // only show BD style title screen for first title screen of a level set + if (initial || nr != 0) + return FALSE; + + int graphic = getTitleScreenGraphic(nr, initial); + Bitmap *bitmap = graphic_info[graphic].bitmap; + + // only show BD style title screen if no other title screen defined + if (bitmap != NULL) + return FALSE; + + // check if BD style title screen defined + return (GetTitleScreenBitmaps_BD() != NULL); +} + static void InitializeTitleControlsExt_AddTitleInfo(boolean is_image, boolean initial, int nr, int sort_priority) @@ -1145,8 +1234,8 @@ static void InitializeTitleControls_CheckTitleInfo(boolean initial) boolean has_title_screen = (bitmap != NULL); // check for optional title screen of native BD style level set - if (!has_title_screen && level.game_engine_type == GAME_ENGINE_TYPE_BD && !initial && i == 0) - has_title_screen = (GetTitleScreen_BD() != NULL); + if (CheckTitleScreen_BD(i, initial)) + has_title_screen = TRUE; if (has_title_screen) InitializeTitleControlsExt_AddTitleInfo(TRUE, initial, i, sort_priority); @@ -1601,8 +1690,10 @@ static void DrawInfoScreen_Headline(int screen_nr, int num_screens, static void DrawTitleScreenImage(int nr, boolean initial) { + static int frame_counter = 0; int graphic = getTitleScreenGraphic(nr, initial); Bitmap *bitmap = graphic_info[graphic].bitmap; + Bitmap *bitmap_background = NULL; int draw_masked = graphic_info[graphic].draw_masked; int width = graphic_info[graphic].width; int height = graphic_info[graphic].height; @@ -1611,9 +1702,12 @@ static void DrawTitleScreenImage(int nr, boolean initial) int dst_x, dst_y; // check for optional title screen of native BD style level set - if (bitmap == NULL && level.game_engine_type == GAME_ENGINE_TYPE_BD && !initial && nr == 0) + if (CheckTitleScreen_BD(nr, initial)) { - bitmap = GetTitleScreen_BD(); + Bitmap **title_screen_bitmaps = GetTitleScreenBitmaps_BD(); + + bitmap = title_screen_bitmaps[0]; + bitmap_background = title_screen_bitmaps[1]; if (bitmap != NULL) { @@ -1650,7 +1744,19 @@ static void DrawTitleScreenImage(int nr, boolean initial) ClearRectangleOnBackground(drawto, 0, 0, WIN_XSIZE, WIN_YSIZE); - if (DrawingOnBackground(dst_x, dst_y) && draw_masked) + boolean draw_masked_final = (DrawingOnBackground(dst_x, dst_y) && draw_masked); + + if (bitmap_background != NULL) + { + int size = bitmap_background->height - bitmap->height; + int offset = frame_counter++ % size; + + BlitBitmap(bitmap_background, drawto, src_x, src_y + offset, width, height, dst_x, dst_y); + + draw_masked_final = TRUE; + } + + if (draw_masked_final) BlitBitmapMasked(bitmap, drawto, src_x, src_y, width, height, dst_x, dst_y); else BlitBitmap(bitmap, drawto, src_x, src_y, width, height, dst_x, dst_y); @@ -2096,6 +2202,21 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) return_to_main_menu = TRUE; } } + else + { + tci = &title_controls[title_screen_nr]; + + // check for optional title screen of native BD style level set + if (tci->is_image && CheckTitleScreen_BD(tci->local_nr, tci->initial)) + { + Bitmap **title_screen_bitmaps = GetTitleScreenBitmaps_BD(); + + // if title screen is animated, draw title screen animation + if (title_screen_bitmaps[0] != NULL && + title_screen_bitmaps[1] != NULL) + DrawTitleScreenImage(tci->local_nr, tci->initial); + } + } if (return_to_main_menu) { @@ -4668,6 +4789,10 @@ static void drawChooseTreeText(TreeInfo *ti, int y, boolean active) char *pos_text = getHallOfFameRankText(pos, 3); int i; + // highlight all high score entries of the current player + if (strEqual(scores.entry[pos].name, setup.player_name)) + font_nr2 = FONT_TEXT_2_ACTIVE; + DrawText(startx1, starty, pos_text, font_nr1); for (i = 0; i < num_dots; i++) @@ -4913,6 +5038,11 @@ 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_BD_PALETTE_C64 || + setup_mode == SETUP_MODE_CHOOSE_BD_PALETTE_C64DTV || + setup_mode == SETUP_MODE_CHOOSE_BD_PALETTE_ATARI || + setup_mode == SETUP_MODE_CHOOSE_BD_COLOR_TYPE) + execSetupEngines(); else if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE || setup_mode == SETUP_MODE_CHOOSE_SCALING_TYPE || setup_mode == SETUP_MODE_CHOOSE_RENDERING || @@ -5031,6 +5161,14 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, return; } + else if (game_status == GAME_MODE_NAMES && dx == 1) + { + SetGameStatus(GAME_MODE_PSEUDO_TYPENAMES); + + DrawTypeName(); + + return; + } else if (dx == 1) { TreeInfo *node_first, *node_cursor; @@ -5101,6 +5239,11 @@ 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_BD_PALETTE_C64 || + setup_mode == SETUP_MODE_CHOOSE_BD_PALETTE_C64DTV || + setup_mode == SETUP_MODE_CHOOSE_BD_PALETTE_ATARI || + setup_mode == SETUP_MODE_CHOOSE_BD_COLOR_TYPE) + execSetupEngines(); else if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE || setup_mode == SETUP_MODE_CHOOSE_SCALING_TYPE || setup_mode == SETUP_MODE_CHOOSE_RENDERING || @@ -5178,6 +5321,11 @@ 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_BD_PALETTE_C64 || + setup_mode == SETUP_MODE_CHOOSE_BD_PALETTE_C64DTV || + setup_mode == SETUP_MODE_CHOOSE_BD_PALETTE_ATARI || + setup_mode == SETUP_MODE_CHOOSE_BD_COLOR_TYPE) + execSetupEngines(); else if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE || setup_mode == SETUP_MODE_CHOOSE_SCALING_TYPE || setup_mode == SETUP_MODE_CHOOSE_RENDERING || @@ -5823,6 +5971,10 @@ static char *rendering_mode_text; static char *vsync_mode_text; static char *scroll_delay_text; static char *snapshot_mode_text; +static char *bd_palette_c64_text; +static char *bd_palette_c64dtv_text; +static char *bd_palette_atari_text; +static char *bd_color_type_text; static char *game_speed_text; static char *scores_type_text; static char *network_server_text; @@ -6134,10 +6286,243 @@ static void execSetupChooseSnapshotMode(void) DrawSetupScreen(); } +static void execSetupEngines_setPalettesC64(void) +{ + if (bd_palettes_c64 == NULL) + { + int i; + + for (i = 0; bd_palettes_c64_list[i].value != -1; i++) + { + TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED); + char identifier[32], name[32]; + int value = bd_palettes_c64_list[i].value; + char *text = bd_palettes_c64_list[i].text; + + ti->node_top = &bd_palettes_c64; + ti->sort_priority = value; + + sprintf(identifier, "%d", value); + sprintf(name, "%s", text); + + setString(&ti->identifier, identifier); + setString(&ti->name, name); + setString(&ti->name_sorting, name); + setString(&ti->infotext, STR_SETUP_CHOOSE_BD_PALETTE_C64); + + pushTreeInfo(&bd_palettes_c64, ti); + } + + // sort palette values to start with lowest palette value + sortTreeInfo(&bd_palettes_c64); + + // set current palette value to configured palette value + bd_palette_c64_current = + getTreeInfoFromIdentifier(bd_palettes_c64, i_to_a(setup.bd_palette_c64)); + + // if that fails, set current palette to reliable default value + if (bd_palette_c64_current == NULL) + bd_palette_c64_current = + getTreeInfoFromIdentifier(bd_palettes_c64, i_to_a(GD_DEFAULT_PALETTE_C64)); + + // if that also fails, set current palette to first available value + if (bd_palette_c64_current == NULL) + bd_palette_c64_current = bd_palettes_c64; + } + + setup.bd_palette_c64 = atoi(bd_palette_c64_current->identifier); + + // needed for displaying palette text instead of identifier + bd_palette_c64_text = bd_palette_c64_current->name; +} + +static void execSetupEngines_setPalettesC64DTV(void) +{ + if (bd_palettes_c64dtv == NULL) + { + int i; + + for (i = 0; bd_palettes_c64dtv_list[i].value != -1; i++) + { + TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED); + char identifier[32], name[32]; + int value = bd_palettes_c64dtv_list[i].value; + char *text = bd_palettes_c64dtv_list[i].text; + + ti->node_top = &bd_palettes_c64dtv; + ti->sort_priority = value; + + sprintf(identifier, "%d", value); + sprintf(name, "%s", text); + + setString(&ti->identifier, identifier); + setString(&ti->name, name); + setString(&ti->name_sorting, name); + setString(&ti->infotext, STR_SETUP_CHOOSE_BD_PALETTE_C64DTV); + + pushTreeInfo(&bd_palettes_c64dtv, ti); + } + + // sort palette values to start with lowest palette value + sortTreeInfo(&bd_palettes_c64dtv); + + // set current palette value to configured palette value + bd_palette_c64dtv_current = + getTreeInfoFromIdentifier(bd_palettes_c64dtv, i_to_a(setup.bd_palette_c64dtv)); + + // if that fails, set current palette to reliable default value + if (bd_palette_c64dtv_current == NULL) + bd_palette_c64dtv_current = + getTreeInfoFromIdentifier(bd_palettes_c64dtv, i_to_a(GD_DEFAULT_PALETTE_C64DTV)); + + // if that also fails, set current palette to first available value + if (bd_palette_c64dtv_current == NULL) + bd_palette_c64dtv_current = bd_palettes_c64dtv; + } + + setup.bd_palette_c64dtv = atoi(bd_palette_c64dtv_current->identifier); + + // needed for displaying palette text instead of identifier + bd_palette_c64dtv_text = bd_palette_c64dtv_current->name; +} + +static void execSetupEngines_setPalettesAtari(void) +{ + if (bd_palettes_atari == NULL) + { + int i; + + for (i = 0; bd_palettes_atari_list[i].value != -1; i++) + { + TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED); + char identifier[32], name[32]; + int value = bd_palettes_atari_list[i].value; + char *text = bd_palettes_atari_list[i].text; + + ti->node_top = &bd_palettes_atari; + ti->sort_priority = value; + + sprintf(identifier, "%d", value); + sprintf(name, "%s", text); + + setString(&ti->identifier, identifier); + setString(&ti->name, name); + setString(&ti->name_sorting, name); + setString(&ti->infotext, STR_SETUP_CHOOSE_BD_PALETTE_ATARI); + + pushTreeInfo(&bd_palettes_atari, ti); + } + + // sort palette values to start with lowest palette value + sortTreeInfo(&bd_palettes_atari); + + // set current palette value to configured palette value + bd_palette_atari_current = + getTreeInfoFromIdentifier(bd_palettes_atari, i_to_a(setup.bd_palette_atari)); + + // if that fails, set current palette to reliable default value + if (bd_palette_atari_current == NULL) + bd_palette_atari_current = + getTreeInfoFromIdentifier(bd_palettes_atari, i_to_a(GD_DEFAULT_PALETTE_ATARI)); + + // if that also fails, set current palette to first available value + if (bd_palette_atari_current == NULL) + bd_palette_atari_current = bd_palettes_atari; + } + + setup.bd_palette_atari = atoi(bd_palette_atari_current->identifier); + + // needed for displaying palette text instead of identifier + bd_palette_atari_text = bd_palette_atari_current->name; +} + +static void execSetupEngines_setColorType(void) +{ + if (bd_color_types == NULL) + { + int i; + + for (i = 0; bd_color_types_list[i].value != -1; i++) + { + TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED); + char identifier[32], name[32]; + int value = bd_color_types_list[i].value; + char *text = bd_color_types_list[i].text; + + ti->node_top = &bd_color_types; + ti->sort_priority = value; + + sprintf(identifier, "%d", value); + sprintf(name, "%s", text); + + setString(&ti->identifier, identifier); + setString(&ti->name, name); + setString(&ti->name_sorting, name); + setString(&ti->infotext, STR_SETUP_CHOOSE_BD_COLOR_TYPE); + + pushTreeInfo(&bd_color_types, ti); + } + + // sort color type values to start with lowest color type value + sortTreeInfo(&bd_color_types); + + // set current color type value to configured color type value + bd_color_type_current = + getTreeInfoFromIdentifier(bd_color_types, i_to_a(setup.bd_default_color_type)); + + // if that fails, set current color type to reliable default value + if (bd_color_type_current == NULL) + bd_color_type_current = + getTreeInfoFromIdentifier(bd_color_types, i_to_a(GD_DEFAULT_COLOR_TYPE)); + + // if that also fails, set current color type to first available value + if (bd_color_type_current == NULL) + bd_color_type_current = bd_color_types; + } + + setup.bd_default_color_type = atoi(bd_color_type_current->identifier); + + // needed for displaying color type text instead of identifier + bd_color_type_text = bd_color_type_current->name; +} + static void execSetupEngines(void) { setup_mode = SETUP_MODE_ENGINES; + execSetupEngines_setPalettesC64(); + execSetupEngines_setPalettesC64DTV(); + execSetupEngines_setPalettesAtari(); + execSetupEngines_setColorType(); + + DrawSetupScreen(); +} + +static void execSetupChoosePaletteC64(void) +{ + setup_mode = SETUP_MODE_CHOOSE_BD_PALETTE_C64; + + DrawSetupScreen(); +} + +static void execSetupChoosePaletteC64DTV(void) +{ + setup_mode = SETUP_MODE_CHOOSE_BD_PALETTE_C64DTV; + + DrawSetupScreen(); +} + +static void execSetupChoosePaletteAtari(void) +{ + setup_mode = SETUP_MODE_CHOOSE_BD_PALETTE_ATARI; + + DrawSetupScreen(); +} + +static void execSetupChooseColorType(void) +{ + setup_mode = SETUP_MODE_CHOOSE_BD_COLOR_TYPE; + DrawSetupScreen(); } @@ -7491,6 +7876,14 @@ static struct TokenInfo setup_info_engines[] = { TYPE_SWITCH, &setup.bd_skip_hatching, "Skip hatching player:" }, { TYPE_SWITCH, &setup.bd_scroll_delay, "Scroll Delay:" }, { TYPE_YES_NO_AUTO, &setup.bd_smooth_movements, "Smooth Element Movement:" }, + { TYPE_ENTER_LIST, &execSetupChoosePaletteC64, "Color Palette (C64):" }, + { TYPE_STRING, &bd_palette_c64_text, "" }, + { TYPE_ENTER_LIST, &execSetupChoosePaletteC64DTV, "Color Palette (C64DTV):" }, + { TYPE_STRING, &bd_palette_c64dtv_text, "" }, + { TYPE_ENTER_LIST, &execSetupChoosePaletteAtari, "Color Palette (Atari):" }, + { TYPE_STRING, &bd_palette_atari_text, "" }, + { TYPE_ENTER_LIST, &execSetupChooseColorType, "Preferred Color Type:" }, + { TYPE_STRING, &bd_color_type_text, "" }, { TYPE_EMPTY, NULL, "" }, { TYPE_HEADLINE, NULL, "Emerald Mine" }, { TYPE_SWITCH, &setup.forced_scroll_delay, "Scroll Delay:" }, @@ -9476,6 +9869,14 @@ void DrawSetupScreen(void) DrawChooseTree(&scroll_delay_current); else if (setup_mode == SETUP_MODE_CHOOSE_SNAPSHOT_MODE) DrawChooseTree(&snapshot_mode_current); + else if (setup_mode == SETUP_MODE_CHOOSE_BD_PALETTE_C64) + DrawChooseTree(&bd_palette_c64_current); + else if (setup_mode == SETUP_MODE_CHOOSE_BD_PALETTE_C64DTV) + DrawChooseTree(&bd_palette_c64dtv_current); + else if (setup_mode == SETUP_MODE_CHOOSE_BD_PALETTE_ATARI) + DrawChooseTree(&bd_palette_atari_current); + else if (setup_mode == SETUP_MODE_CHOOSE_BD_COLOR_TYPE) + DrawChooseTree(&bd_color_type_current); else if (setup_mode == SETUP_MODE_CHOOSE_WINDOW_SIZE) DrawChooseTree(&window_size_current); else if (setup_mode == SETUP_MODE_CHOOSE_SCALING_TYPE) @@ -9560,6 +9961,14 @@ 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_BD_PALETTE_C64) + HandleChooseTree(mx, my, dx, dy, button, &bd_palette_c64_current); + else if (setup_mode == SETUP_MODE_CHOOSE_BD_PALETTE_C64DTV) + HandleChooseTree(mx, my, dx, dy, button, &bd_palette_c64dtv_current); + else if (setup_mode == SETUP_MODE_CHOOSE_BD_PALETTE_ATARI) + HandleChooseTree(mx, my, dx, dy, button, &bd_palette_atari_current); + else if (setup_mode == SETUP_MODE_CHOOSE_BD_COLOR_TYPE) + HandleChooseTree(mx, my, dx, dy, button, &bd_color_type_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) @@ -10494,7 +10903,7 @@ static void HandleScreenGadgets(struct GadgetInfo *gi) void HandleScreenGadgetKeys(Key key) { - if (key == setup.shortcut.tape_play) + if (key == setup.shortcut.tape_play || key == KSYM_Return) HandleScreenGadgets(screen_gadget[SCREEN_CTRL_ID_PLAY_TAPE]); }