added configurability of different window size for title screens
authorHolger Schemel <info@artsoft.org>
Wed, 2 Dec 2015 20:06:39 +0000 (21:06 +0100)
committerHolger Schemel <info@artsoft.org>
Wed, 2 Dec 2015 20:06:39 +0000 (21:06 +0100)
build-scripts/create_element_defs.pl
src/conf_gfx.c
src/files.c
src/main.h
src/screens.c
src/tools.c

index a2d92d3..3c080a7 100755 (executable)
@@ -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;
            }
index 15a3b24..503f2b3 100644 (file)
@@ -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"                   },
index df4887a..c357e2c 100644 (file)
@@ -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)
index da66e67..a8edcee 100644 (file)
@@ -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];
index 9de4b55..e68ec1a 100644 (file)
@@ -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();
index 7e8806e..3cf3b96 100644 (file)
@@ -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;