From: Holger Schemel Date: Wed, 2 Dec 2015 20:06:39 +0000 (+0100) Subject: added configurability of different window size for title screens X-Git-Tag: 4.0.0.0-rc1~119 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=7ecbe0a730dc19d8a46ffe6bbcb052f20d0c4152;p=rocksndiamonds.git added configurability of different window size for title screens --- diff --git a/build-scripts/create_element_defs.pl b/build-scripts/create_element_defs.pl index a2d92d35..3c080a7a 100755 --- a/build-scripts/create_element_defs.pl +++ b/build-scripts/create_element_defs.pl @@ -2418,7 +2418,7 @@ sub print_image_config_vars $var .= "[GFX_SPECIAL_ARG_DEFAULT]"; } - if ($var =~ /^(viewport.(playfield|door_[12]))(.[a-z_]+)$/) + if ($var =~ /^(viewport.(window|playfield|door_[12]))(.[a-z_]+)$/) { $var = $1 . "[GFX_SPECIAL_ARG_DEFAULT]" . $3; } diff --git a/src/conf_gfx.c b/src/conf_gfx.c index 15a3b244..503f2b32 100644 --- a/src/conf_gfx.c +++ b/src/conf_gfx.c @@ -7706,6 +7706,9 @@ struct ConfigInfo image_config[] = { "viewport.window.width", "672" }, { "viewport.window.height", "560" }, + { "viewport.window.TITLE.width", ARG_DEFAULT }, + { "viewport.window.TITLE.height", ARG_DEFAULT }, + { "viewport.playfield.x", "6" }, { "viewport.playfield.y", "6" }, { "viewport.playfield.width", "548" }, @@ -7731,6 +7734,7 @@ struct ConfigInfo image_config[] = { "viewport.playfield.PLAYING.width", ARG_DEFAULT }, { "viewport.playfield.PLAYING.height", ARG_DEFAULT }, { "viewport.playfield.PLAYING.border_size", ARG_DEFAULT }, + { "viewport.door_1.x", "566" }, { "viewport.door_1.y", "60" }, { "viewport.door_1.width", "100" }, @@ -7756,6 +7760,7 @@ struct ConfigInfo image_config[] = { "viewport.door_1.PLAYING.width", ARG_DEFAULT }, { "viewport.door_1.PLAYING.height", ARG_DEFAULT }, { "viewport.door_1.PLAYING.border_size", ARG_DEFAULT }, + { "viewport.door_2.x", "566" }, { "viewport.door_2.y", "400" }, { "viewport.door_2.width", "100" }, diff --git a/src/files.c b/src/files.c index df4887a0..c357e2c7 100644 --- a/src/files.c +++ b/src/files.c @@ -8786,8 +8786,10 @@ static void InitMenuDesignSettings_SpecialPreProcessing() /* (eg, init "viewport.door_1.MAIN.xyz" from "viewport.door_1.xyz") */ for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++) { + viewport.window[i] = viewport.window[GFX_SPECIAL_ARG_DEFAULT]; viewport.playfield[i] = viewport.playfield[GFX_SPECIAL_ARG_DEFAULT]; - viewport.door_1[i] = viewport.door_1[GFX_SPECIAL_ARG_DEFAULT]; + viewport.door_1[i] = viewport.door_1[GFX_SPECIAL_ARG_DEFAULT]; + if (i != GFX_SPECIAL_ARG_EDITOR) /* editor value already initialized */ viewport.door_2[i] = viewport.door_2[GFX_SPECIAL_ARG_DEFAULT]; } @@ -8963,6 +8965,8 @@ static void LoadMenuDesignSettingsFromFilename(char *filename) /* (eg, init "viewport.door_1.MAIN.xyz" from "viewport.door_1.xyz") */ for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++) { + char *token_w1 = "viewport.window.width"; + char *token_w2 = "viewport.window.height"; char *token_01 = "viewport.playfield.x"; char *token_02 = "viewport.playfield.y"; char *token_03 = "viewport.playfield.width"; @@ -8978,6 +8982,8 @@ static void LoadMenuDesignSettingsFromFilename(char *filename) char *token_13 = "viewport.door_2.width"; char *token_14 = "viewport.door_2.height"; char *token_15 = "viewport.door_2.border_size"; + char *value_w1 = getHashEntry(setup_file_hash, token_w1); + char *value_w2 = getHashEntry(setup_file_hash, token_w2); char *value_01 = getHashEntry(setup_file_hash, token_01); char *value_02 = getHashEntry(setup_file_hash, token_02); char *value_03 = getHashEntry(setup_file_hash, token_03); @@ -8994,6 +9000,10 @@ static void LoadMenuDesignSettingsFromFilename(char *filename) char *value_14 = getHashEntry(setup_file_hash, token_14); char *value_15 = getHashEntry(setup_file_hash, token_15); + if (value_w1 != NULL) + viewport.window[i].width = get_token_parameter_value(token_w1, value_w1); + if (value_w2 != NULL) + viewport.window[i].height = get_token_parameter_value(token_w2, value_w2); if (value_01 != NULL) viewport.playfield[i].x = get_token_parameter_value(token_01, value_01); if (value_02 != NULL) diff --git a/src/main.h b/src/main.h index da66e67c..a8edcee7 100644 --- a/src/main.h +++ b/src/main.h @@ -2343,7 +2343,7 @@ struct EditorInfo struct ViewportInfo { - struct RectWithBorder window; + struct RectWithBorder window[NUM_SPECIAL_GFX_ARGS]; struct RectWithBorder playfield[NUM_SPECIAL_GFX_ARGS]; struct RectWithBorder door_1[NUM_SPECIAL_GFX_ARGS]; struct RectWithBorder door_2[NUM_SPECIAL_GFX_ARGS]; diff --git a/src/screens.c b/src/screens.c index 9de4b55d..e68ec1a8 100644 --- a/src/screens.c +++ b/src/screens.c @@ -1568,6 +1568,8 @@ void HandleTitleScreen(int mx, int my, int dx, int dy, int button) ClearField(); } + ChangeViewportPropertiesIfNeeded(); + if (tci->is_image) DrawTitleScreenImage(tci->local_nr, tci->initial); else @@ -2158,6 +2160,8 @@ static void DrawInfoScreen_Main() FadeOut(fade_mask); + ChangeViewportPropertiesIfNeeded(); + OpenDoor(GetDoorState() | DOOR_NO_DELAY | DOOR_FORCE_REDRAW); ClearField(); diff --git a/src/tools.c b/src/tools.c index 7e8806e5..3cf3b960 100644 --- a/src/tools.c +++ b/src/tools.c @@ -8142,10 +8142,13 @@ void ChangeViewportPropertiesIfNeeded() int gfx_game_mode = game_status; int gfx_game_mode2 = (game_status == GAME_MODE_EDITOR ? GAME_MODE_DEFAULT : game_status); + struct RectWithBorder *vp_window = &viewport.window[gfx_game_mode]; struct RectWithBorder *vp_playfield = &viewport.playfield[gfx_game_mode]; - struct RectWithBorder *vp_door_1 = &viewport.door_1[gfx_game_mode]; - struct RectWithBorder *vp_door_2 = &viewport.door_2[gfx_game_mode2]; - struct RectWithBorder *vp_door_3 = &viewport.door_2[GAME_MODE_EDITOR]; + struct RectWithBorder *vp_door_1 = &viewport.door_1[gfx_game_mode]; + struct RectWithBorder *vp_door_2 = &viewport.door_2[gfx_game_mode2]; + struct RectWithBorder *vp_door_3 = &viewport.door_2[GAME_MODE_EDITOR]; + int new_win_xsize = vp_window->width; + int new_win_ysize = vp_window->height; int border_size = vp_playfield->border_size; int new_sx = vp_playfield->x + border_size; int new_sy = vp_playfield->y + border_size; @@ -8181,11 +8184,11 @@ void ChangeViewportPropertiesIfNeeded() boolean init_gadgets_and_toons = FALSE; boolean init_em_graphics = FALSE; - if (viewport.window.width != WIN_XSIZE || - viewport.window.height != WIN_YSIZE) + if (new_win_xsize != WIN_XSIZE || + new_win_ysize != WIN_YSIZE) { - WIN_XSIZE = viewport.window.width; - WIN_YSIZE = viewport.window.height; + WIN_XSIZE = new_win_xsize; + WIN_YSIZE = new_win_ysize; init_video_buffer = TRUE; init_gfx_buffers = TRUE;