rnd-20140219-1-src
[rocksndiamonds.git] / src / init.c
index ae154457308a300dfd0d161605ca6ed4532379e6..bd28fdc1cfe07352177a2f4bbb2185936e0eb13c 100644 (file)
@@ -2002,6 +2002,50 @@ static void InitGraphicCompatibilityInfo()
     }
   }
 
+#if 1
+  struct
+  {
+    int graphic;
+    int *width, *height;
+    boolean right_wing;
+  }
+  doors[] =
+  {
+    { IMG_DOOR_1_WING_LEFT,    &door_1.width,  &door_1.height, FALSE   },
+    { IMG_DOOR_1_WING_RIGHT,   &door_1.width,  &door_1.height, TRUE    },
+    { IMG_DOOR_2_WING_LEFT,    &door_2.width,  &door_2.height, FALSE   },
+    { IMG_DOOR_2_WING_RIGHT,   &door_2.width,  &door_2.height, TRUE    },
+
+    { 0,                       NULL,           NULL,           FALSE   }
+  };
+
+  for (i = 0; doors[i].graphic != 0; i++)
+  {
+    int graphic = doors[i].graphic;
+    int *width  = doors[i].width;
+    int *height = doors[i].height;
+    boolean right_wing = doors[i].right_wing;
+
+    struct FileInfo *fi = getImageListEntryFromImageID(graphic);
+    struct GraphicInfo *g = &graphic_info[graphic];
+
+    if (!fi->redefined)
+    {
+      if (*width != -1)
+      {
+       // correct start position for right wing of "standard" door graphic
+       if (right_wing)
+         g->src_x += g->width - *width;
+
+       g->width = *width;
+      }
+
+      if (*height != -1)
+       g->height = *height;
+    }
+  }
+#endif
+
 #if 0
   for (i = 0; i < num_images; i++)
   {
@@ -5027,7 +5071,7 @@ static void InitGlobal()
   global.fading_type = TYPE_ENTER_MENU;
 #endif
 
-  global.use_envelope_request = FALSE; /* !!! MOVE TO ARTWORK CONFIG !!! */
+  global.use_envelope_request = FALSE;
 }
 
 void Execute_Command(char *command)
@@ -5493,6 +5537,7 @@ static void InitMixer()
 
 void InitGfxBuffers()
 {
+  /* create additional image buffers for double-buffering and cross-fading */
   ReCreateBitmap(&bitmap_db_store, WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH);
   ReCreateBitmap(&bitmap_db_cross, WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH);
   ReCreateBitmap(&bitmap_db_field, FXSIZE, FYSIZE, DEFAULT_DEPTH);
@@ -5506,6 +5551,7 @@ void InitGfxBuffers()
                   bitmap_db_field);
   InitGfxDoor1Info(DX, DY, DXSIZE, DYSIZE);
   InitGfxDoor2Info(VX, VY, VXSIZE, VYSIZE);
+  InitGfxDoor3Info(EX, EY, EXSIZE, EYSIZE);
   InitGfxWindowInfo(WIN_XSIZE, WIN_YSIZE);
   InitGfxScrollbufferInfo(FXSIZE, FYSIZE);
   InitGfxClipRegion(FALSE, -1, -1, -1, -1);
@@ -5560,27 +5606,7 @@ void InitGfx()
   if (filename_font_initial == NULL)   /* should not happen */
     Error(ERR_EXIT, "cannot get filename for '%s'", CONFIG_TOKEN_FONT_INITIAL);
 
-#if 1
   InitGfxBuffers();
-#else
-  /* create additional image buffers for double-buffering and cross-fading */
-  bitmap_db_store = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH);
-  bitmap_db_cross = CreateBitmap(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH);
-  bitmap_db_field = CreateBitmap(FXSIZE, FYSIZE, DEFAULT_DEPTH);
-  bitmap_db_panel = CreateBitmap(DXSIZE, DYSIZE, DEFAULT_DEPTH);
-  bitmap_db_door  = CreateBitmap(3 * DXSIZE, DYSIZE + VYSIZE, DEFAULT_DEPTH);
-  bitmap_db_toons = CreateBitmap(FULL_SXSIZE, FULL_SYSIZE, DEFAULT_DEPTH);
-
-  /* initialize screen properties */
-  InitGfxFieldInfo(SX, SY, SXSIZE, SYSIZE,
-                  REAL_SX, REAL_SY, FULL_SXSIZE, FULL_SYSIZE,
-                  bitmap_db_field);
-  InitGfxDoor1Info(DX, DY, DXSIZE, DYSIZE);
-  InitGfxDoor2Info(VX, VY, VXSIZE, VYSIZE);
-  InitGfxWindowInfo(WIN_XSIZE, WIN_YSIZE);
-  InitGfxScrollbufferInfo(FXSIZE, FYSIZE);
-#endif
-
   InitGfxCustomArtworkInfo();
 
   bitmap_font_initial = LoadCustomImage(filename_font_initial);
@@ -5593,14 +5619,15 @@ void InitGfx()
   font_height = getFontHeight(FC_RED);
 
 #if 1
-  DrawInitText(getWindowTitleString(), 20, FC_YELLOW);
+  DrawInitTextAlways(getWindowTitleString(), 20, FC_YELLOW);
 #else
-  DrawInitText(getProgramInitString(), 20, FC_YELLOW);
+  DrawInitTextAlways(getProgramInitString(), 20, FC_YELLOW);
 #endif
-  DrawInitText(PROGRAM_COPYRIGHT_STRING, 50, FC_RED);
-  DrawInitText(PROGRAM_WEBSITE_STRING, WIN_YSIZE - 20 - font_height, FC_RED);
+  DrawInitTextAlways(PROGRAM_COPYRIGHT_STRING, 50, FC_RED);
+  DrawInitTextAlways(PROGRAM_WEBSITE_STRING, WIN_YSIZE - 20 - font_height,
+                    FC_RED);
 
-  DrawInitText("Loading graphics", 120, FC_GREEN);
+  DrawInitTextAlways("Loading graphics", 120, FC_GREEN);
 
 #if 1
 #if 1
@@ -6216,6 +6243,8 @@ void ReloadCustomArtwork(int force_reload)
 #endif
 
   print_timestamp_done("ReloadCustomArtwork");
+
+  LimitScreenUpdates(FALSE);
 }
 
 void KeyboardAutoRepeatOffUnlessAutoplay()
@@ -6316,10 +6345,6 @@ void OpenAll()
 
   InitSetup();
 
-#if 1
-  Error(ERR_INFO, "::: MARK 1: setup.fullscreen == %d", setup.fullscreen);
-#endif
-
   print_timestamp_time("[init setup/config stuff (1)]");
 
   InitGameInfo();
@@ -6344,10 +6369,6 @@ void OpenAll()
 
   print_timestamp_time("[init setup/config stuff]");
 
-#if 1
-  Error(ERR_INFO, "::: MARK 2: setup.fullscreen == %d", setup.fullscreen);
-#endif
-
   InitVideoDisplay();
   InitVideoBuffer(WIN_XSIZE, WIN_YSIZE, DEFAULT_DEPTH, setup.fullscreen);