rnd-20100416-1-src
authorHolger Schemel <info@artsoft.org>
Fri, 16 Apr 2010 10:03:17 +0000 (12:03 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:59:01 +0000 (10:59 +0200)
src/conf_gfx.c
src/conf_var.c
src/conftime.h
src/files.c
src/main.h
src/tools.c

index 156d48557ef3222f458b989dbba4a07728e09f60..b51564903b5db4ee42c044959e952f1bb90d8248 100644 (file)
@@ -6408,24 +6408,30 @@ struct ConfigInfo image_config[] =
 
   { "viewport.window.width",                   "672"                   },
   { "viewport.window.height",                  "560"                   },
-  { "viewport.playfield.menu.width",           "17"                    },
-  { "viewport.playfield.menu.height",          "17"                    },
-  { "viewport.playfield.game.width",           "17"                    },
-  { "viewport.playfield.game.height",          "17"                    },
-  { "viewport.playfield.editor.width",         "17"                    },
-  { "viewport.playfield.editor.height",                "17"                    },
-  { "viewport.door_1.menu.x",                  "566"                   },
-  { "viewport.door_1.menu.y",                  "60"                    },
-  { "viewport.door_1.game.x",                  "566"                   },
-  { "viewport.door_1.game.y",                  "60"                    },
-  { "viewport.door_1.editor.x",                        "566"                   },
-  { "viewport.door_1.editor.y",                        "60"                    },
-  { "viewport.door_2.menu.x",                  "566"                   },
-  { "viewport.door_2.menu.y",                  "400"                   },
-  { "viewport.door_2.game.x",                  "566"                   },
-  { "viewport.door_2.game.y",                  "400"                   },
-  { "viewport.door_2.editor.x",                        "566"                   },
-  { "viewport.door_2.editor.y",                        "356"                   },
+  { "viewport.playfield.width",                        "17"                    },
+  { "viewport.playfield.height",               "17"                    },
+  { "viewport.playfield.MAIN.width",           ARG_DEFAULT             },
+  { "viewport.playfield.MAIN.height",          ARG_DEFAULT             },
+  { "viewport.playfield.PLAYING.width",                ARG_DEFAULT             },
+  { "viewport.playfield.PLAYING.height",       ARG_DEFAULT             },
+  { "viewport.playfield.EDITOR.width",         ARG_DEFAULT             },
+  { "viewport.playfield.EDITOR.height",                ARG_DEFAULT             },
+  { "viewport.door_1.x",                       "566"                   },
+  { "viewport.door_1.y",                       "60"                    },
+  { "viewport.door_1.MAIN.x",                  ARG_DEFAULT             },
+  { "viewport.door_1.MAIN.y",                  ARG_DEFAULT             },
+  { "viewport.door_1.PLAYING.x",               ARG_DEFAULT             },
+  { "viewport.door_1.PLAYING.y",               ARG_DEFAULT             },
+  { "viewport.door_1.EDITOR.x",                        ARG_DEFAULT             },
+  { "viewport.door_1.EDITOR.y",                        ARG_DEFAULT             },
+  { "viewport.door_2.x",                       "566"                   },
+  { "viewport.door_2.y",                       "400"                   },
+  { "viewport.door_2.MAIN.x",                  ARG_DEFAULT             },
+  { "viewport.door_2.MAIN.y",                  ARG_DEFAULT             },
+  { "viewport.door_2.PLAYING.x",               ARG_DEFAULT             },
+  { "viewport.door_2.PLAYING.y",               ARG_DEFAULT             },
+  { "viewport.door_2.EDITOR.x",                        "566"                   },
+  { "viewport.door_2.EDITOR.y",                        "356"                   },
 
   { NULL,                                      NULL                    }
 };
index 0f2cd01c4b73c353a0f4a22c3da4faacf7171a62..4593e424fe06449c878de11d07f29b593d446d80 100644 (file)
@@ -5101,76 +5101,100 @@ struct TokenIntPtrInfo image_config_vars[] =
     &viewport.window.height
   },
   {
-    "viewport.playfield.menu.width",
-    &viewport.playfield.menu.width
+    "viewport.playfield.width",
+    &viewport.playfield[GFX_SPECIAL_ARG_DEFAULT].width
   },
   {
-    "viewport.playfield.menu.height",
-    &viewport.playfield.menu.height
+    "viewport.playfield.height",
+    &viewport.playfield[GFX_SPECIAL_ARG_DEFAULT].height
   },
   {
-    "viewport.playfield.game.width",
-    &viewport.playfield.game.width
+    "viewport.playfield.MAIN.width",
+    &viewport.playfield[GFX_SPECIAL_ARG_MAIN].width
   },
   {
-    "viewport.playfield.game.height",
-    &viewport.playfield.game.height
+    "viewport.playfield.MAIN.height",
+    &viewport.playfield[GFX_SPECIAL_ARG_MAIN].height
   },
   {
-    "viewport.playfield.editor.width",
-    &viewport.playfield.editor.width
+    "viewport.playfield.PLAYING.width",
+    &viewport.playfield[GFX_SPECIAL_ARG_PLAYING].width
   },
   {
-    "viewport.playfield.editor.height",
-    &viewport.playfield.editor.height
+    "viewport.playfield.PLAYING.height",
+    &viewport.playfield[GFX_SPECIAL_ARG_PLAYING].height
   },
   {
-    "viewport.door_1.menu.x",
-    &viewport.door_1.menu.x
+    "viewport.playfield.EDITOR.width",
+    &viewport.playfield[GFX_SPECIAL_ARG_EDITOR].width
   },
   {
-    "viewport.door_1.menu.y",
-    &viewport.door_1.menu.y
+    "viewport.playfield.EDITOR.height",
+    &viewport.playfield[GFX_SPECIAL_ARG_EDITOR].height
   },
   {
-    "viewport.door_1.game.x",
-    &viewport.door_1.game.x
+    "viewport.door_1.x",
+    &viewport.door_1[GFX_SPECIAL_ARG_DEFAULT].x
   },
   {
-    "viewport.door_1.game.y",
-    &viewport.door_1.game.y
+    "viewport.door_1.y",
+    &viewport.door_1[GFX_SPECIAL_ARG_DEFAULT].y
   },
   {
-    "viewport.door_1.editor.x",
-    &viewport.door_1.editor.x
+    "viewport.door_1.MAIN.x",
+    &viewport.door_1[GFX_SPECIAL_ARG_MAIN].x
   },
   {
-    "viewport.door_1.editor.y",
-    &viewport.door_1.editor.y
+    "viewport.door_1.MAIN.y",
+    &viewport.door_1[GFX_SPECIAL_ARG_MAIN].y
   },
   {
-    "viewport.door_2.menu.x",
-    &viewport.door_2.menu.x
+    "viewport.door_1.PLAYING.x",
+    &viewport.door_1[GFX_SPECIAL_ARG_PLAYING].x
   },
   {
-    "viewport.door_2.menu.y",
-    &viewport.door_2.menu.y
+    "viewport.door_1.PLAYING.y",
+    &viewport.door_1[GFX_SPECIAL_ARG_PLAYING].y
   },
   {
-    "viewport.door_2.game.x",
-    &viewport.door_2.game.x
+    "viewport.door_1.EDITOR.x",
+    &viewport.door_1[GFX_SPECIAL_ARG_EDITOR].x
   },
   {
-    "viewport.door_2.game.y",
-    &viewport.door_2.game.y
+    "viewport.door_1.EDITOR.y",
+    &viewport.door_1[GFX_SPECIAL_ARG_EDITOR].y
   },
   {
-    "viewport.door_2.editor.x",
-    &viewport.door_2.editor.x
+    "viewport.door_2.x",
+    &viewport.door_2[GFX_SPECIAL_ARG_DEFAULT].x
   },
   {
-    "viewport.door_2.editor.y",
-    &viewport.door_2.editor.y
+    "viewport.door_2.y",
+    &viewport.door_2[GFX_SPECIAL_ARG_DEFAULT].y
+  },
+  {
+    "viewport.door_2.MAIN.x",
+    &viewport.door_2[GFX_SPECIAL_ARG_MAIN].x
+  },
+  {
+    "viewport.door_2.MAIN.y",
+    &viewport.door_2[GFX_SPECIAL_ARG_MAIN].y
+  },
+  {
+    "viewport.door_2.PLAYING.x",
+    &viewport.door_2[GFX_SPECIAL_ARG_PLAYING].x
+  },
+  {
+    "viewport.door_2.PLAYING.y",
+    &viewport.door_2[GFX_SPECIAL_ARG_PLAYING].y
+  },
+  {
+    "viewport.door_2.EDITOR.x",
+    &viewport.door_2[GFX_SPECIAL_ARG_EDITOR].x
+  },
+  {
+    "viewport.door_2.EDITOR.y",
+    &viewport.door_2[GFX_SPECIAL_ARG_EDITOR].y
   },
   {
     NULL,
index 15df429df33c909c57113c56bdd0361e8cdcc7fc..d918a3cb47a61f120e70bf2adde6c9d47c6bde5d 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2010-04-07 23:40"
+#define COMPILE_DATE_STRING "2010-04-16 11:49"
index 91e597b1fb680e5367cb6ce4700311321b2bf6b0..9f92ad68cb84300f0e09883ac808a6803a4b153a 100644 (file)
@@ -9807,6 +9807,15 @@ static void InitMenuDesignSettings_SpecialPreProcessing()
     menu.enter_screen[i] = menu.enter_screen[GFX_SPECIAL_ARG_DEFAULT];
     menu.leave_screen[i] = menu.leave_screen[GFX_SPECIAL_ARG_DEFAULT];
   }
+
+  /* special case: initialize "ARG_DEFAULT" values in static default config */
+  /* (eg, init "viewport.door_1.MAIN.xyz" from "viewport.door_1.xyz") */
+  for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++)
+  {
+    viewport.playfield[i] = viewport.playfield[GFX_SPECIAL_ARG_DEFAULT];
+    viewport.door_1[i] = viewport.door_1[GFX_SPECIAL_ARG_DEFAULT];
+    viewport.door_2[i] = viewport.door_2[GFX_SPECIAL_ARG_DEFAULT];
+  }
 }
 
 static void InitMenuDesignSettings_SpecialPostProcessing()
@@ -9944,6 +9953,37 @@ static void LoadMenuDesignSettingsFromFilename(char *filename)
                                                                  value_6);
   }
 
+  /* special case: initialize with default values that may be overwritten */
+  /* (eg, init "viewport.door_1.MAIN.xyz" from "viewport.door_1.xyz") */
+  for (i = 0; i < NUM_SPECIAL_GFX_ARGS; i++)
+  {
+    char *token_1 = "viewport.playfield.width";
+    char *token_2 = "viewport.playfield.height";
+    char *token_3 = "viewport.door_1.x";
+    char *token_4 = "viewport.door_1.y";
+    char *token_5 = "viewport.door_2.x";
+    char *token_6 = "viewport.door_2.y";
+    char *value_1 = getHashEntry(setup_file_hash, token_1);
+    char *value_2 = getHashEntry(setup_file_hash, token_2);
+    char *value_3 = getHashEntry(setup_file_hash, token_3);
+    char *value_4 = getHashEntry(setup_file_hash, token_4);
+    char *value_5 = getHashEntry(setup_file_hash, token_5);
+    char *value_6 = getHashEntry(setup_file_hash, token_6);
+
+    if (value_1 != NULL)
+      viewport.playfield[i].width = get_token_parameter_value(token_1,value_1);
+    if (value_2 != NULL)
+      viewport.playfield[i].height = get_token_parameter_value(token_2,value_2);
+    if (value_3 != NULL)
+      viewport.door_1[i].x = get_token_parameter_value(token_3, value_3);
+    if (value_4 != NULL)
+      viewport.door_1[i].y = get_token_parameter_value(token_4, value_4);
+    if (value_5 != NULL)
+      viewport.door_2[i].x = get_token_parameter_value(token_5, value_5);
+    if (value_6 != NULL)
+      viewport.door_2[i].y = get_token_parameter_value(token_6, value_6);
+  }
+
   /* special case: initialize with default values that may be overwritten */
   /* (e.g., init "titlemessage_1.fade_mode" from "[titlemessage].fade_mode") */
   for (i = 0; titlemessage_arrays[i].array != NULL; i++)
index 09306600a7dbbcc6e9b06e0f445f98690ef72555..4268c9018b494b39e759a60e340852237313637e 100644 (file)
@@ -2257,6 +2257,14 @@ struct PreviewInfo
   int anim_mode;
 };
 
+struct ViewportInfo
+{
+  struct Rect window;
+  struct Rect playfield[NUM_SPECIAL_GFX_ARGS];
+  struct Rect door_1[NUM_SPECIAL_GFX_ARGS];
+  struct Rect door_2[NUM_SPECIAL_GFX_ARGS];
+};
+
 struct HiScore
 {
   char Name[MAX_PLAYER_NAME_LEN + 1];
@@ -2454,21 +2462,6 @@ struct GlobalInfo
 #endif
 };
 
-struct SubViewportInfo
-{
-  struct Rect menu;
-  struct Rect game;
-  struct Rect editor;
-};
-
-struct ViewportInfo
-{
-  struct Rect window;
-  struct SubViewportInfo playfield;
-  struct SubViewportInfo door_1;
-  struct SubViewportInfo door_2;
-};
-
 struct ElementChangeInfo
 {
   boolean can_change;          /* use or ignore this change info */
index 30df9f7cafa12b121a177f0cbd1221e6bc8e7280..2ec7c9ee816cbb412912f2b96394c136e448f8b2 100644 (file)
@@ -8088,6 +8088,14 @@ void ToggleFullscreenIfNeeded()
 
 void ChangeViewportPropertiesIfNeeded()
 {
+  int *door_1_x = &DX;
+  int *door_1_y = &DY;
+  int *door_2_x = (game_status == GAME_MODE_EDITOR ? &EX : &VX);
+  int *door_2_y = (game_status == GAME_MODE_EDITOR ? &EY : &VY);
+  int gfx_game_mode = (game_status == GAME_MODE_PLAYING ||
+                      game_status == GAME_MODE_EDITOR ? game_status :
+                      GAME_MODE_MAIN);
+
   if (viewport.window.width  != WIN_XSIZE ||
       viewport.window.height != WIN_YSIZE)
   {
@@ -8105,64 +8113,25 @@ void ChangeViewportPropertiesIfNeeded()
 #endif
   }
 
-  if (game_status == GAME_MODE_PLAYING)
+  if (viewport.playfield[gfx_game_mode].width  != SCR_FIELDX ||
+      viewport.playfield[gfx_game_mode].height != SCR_FIELDY ||
+      viewport.door_1[gfx_game_mode].x != *door_1_x ||
+      viewport.door_1[gfx_game_mode].y != *door_1_y ||
+      viewport.door_2[gfx_game_mode].x != *door_2_x ||
+      viewport.door_2[gfx_game_mode].y != *door_2_y)
   {
-    if (viewport.playfield.game.width  != SCR_FIELDX ||
-       viewport.playfield.game.height != SCR_FIELDY ||
-       viewport.door_1.game.x != DX ||
-       viewport.door_1.game.y != DY ||
-       viewport.door_2.game.x != VX ||
-       viewport.door_2.game.y != VY)
-    {
-      SCR_FIELDX = viewport.playfield.game.width;
-      SCR_FIELDY = viewport.playfield.game.height;
-
-      DX = viewport.door_1.game.x;
-      DY = viewport.door_1.game.y;
-      VX = viewport.door_2.game.x;
-      VY = viewport.door_2.game.y;
+    SCR_FIELDX = viewport.playfield[gfx_game_mode].width;
+    SCR_FIELDY = viewport.playfield[gfx_game_mode].height;
 
-      InitGfxBuffers();
-    }
-  }
-  else if (game_status == GAME_MODE_EDITOR)
-  {
-    if (viewport.playfield.editor.width  != SCR_FIELDX ||
-       viewport.playfield.editor.height != SCR_FIELDY ||
-       viewport.door_1.editor.x != DX ||
-       viewport.door_1.editor.y != DY ||
-       viewport.door_2.editor.x != EX ||
-       viewport.door_2.editor.y != EY)
-    {
-      SCR_FIELDX = viewport.playfield.editor.width;
-      SCR_FIELDY = viewport.playfield.editor.height;
+    *door_1_x = viewport.door_1[gfx_game_mode].x;
+    *door_1_y = viewport.door_1[gfx_game_mode].y;
+    *door_2_x = viewport.door_2[gfx_game_mode].x;
+    *door_2_y = viewport.door_2[gfx_game_mode].y;
 
-      DX = viewport.door_1.editor.x;
-      DY = viewport.door_1.editor.y;
-      EX = viewport.door_2.editor.x;
-      EY = viewport.door_2.editor.y;
+    InitGfxBuffers();
 
-      InitGfxBuffers();
-    }
-  }
-  else         /* any menu screen */
-  {
-    if (viewport.playfield.menu.width  != SCR_FIELDX ||
-       viewport.playfield.menu.height != SCR_FIELDY ||
-       viewport.door_1.menu.x != DX ||
-       viewport.door_1.menu.y != DY ||
-       viewport.door_2.menu.x != VX ||
-       viewport.door_2.menu.y != VY)
+    if (gfx_game_mode == GAME_MODE_MAIN)
     {
-      SCR_FIELDX = viewport.playfield.menu.width;
-      SCR_FIELDY = viewport.playfield.menu.height;
-
-      DX = viewport.door_1.menu.x;
-      DY = viewport.door_1.menu.y;
-      VX = viewport.door_2.menu.x;
-      VY = viewport.door_2.menu.y;
-
-      InitGfxBuffers();
       InitGadgets();
       InitToons();
     }