rnd-20140304-1-src
[rocksndiamonds.git] / src / init.c
index a1b92d253eb63a7cd292fa64459d6b72574cecfa..33bfb5ec409a4941074335f3372b23ceabae653e 100644 (file)
@@ -2002,6 +2002,54 @@ static void InitGraphicCompatibilityInfo()
     }
   }
 
+#if 1
+  InitGraphicCompatibilityInfo_Doors();
+#endif
+
+#if 0
+  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++)
   {
@@ -2425,6 +2473,8 @@ static void ReinitializeGraphics()
   print_timestamp_time("InitGadgets");
   InitToons();
   print_timestamp_time("InitToons");
+  InitDoors();
+  print_timestamp_time("InitDoors");
 
   print_timestamp_done("ReinitializeGraphics");
 }
@@ -5027,7 +5077,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 +5543,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 +5557,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 +5612,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);