rnd-20140301-1-src
authorHolger Schemel <info@artsoft.org>
Sat, 1 Mar 2014 00:02:21 +0000 (01:02 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 09:01:06 +0000 (11:01 +0200)
* added ultra-generic, ultra-flexible request door animation handling

ChangeLog
src/conf_gfx.c
src/conf_var.c
src/conftime.h
src/libgame/system.h
src/tools.c

index bbd7e406e7cfc59e136d0b2b5399d50dd5ff5c0d..fd98ab0d7247d13e0947ad85b3d6da111960a125 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2014-03-01
+       * added ultra-generic, ultra-flexible request door animation handling
+
 2014-02-18
        * fixed major bugs in handling single-player and multi-player tapes
          (for details, see http://www.artsoft.org/forum/viewtopic.php?t=2086)
index 3eb72e80884f9dda5dbb1b0ecdd92745a3653b6e..317c11bdb2bccf0b36845c8f1552d12e0b3153cb 100644 (file)
@@ -5974,6 +5974,8 @@ struct ConfigInfo image_config[] =
   { "door_1.part_1.step_yoffset",              "1"                     },
   { "door_1.part_1.step_delay",                        "20"                    },
   { "door_1.part_1.start_step",                        "0"                     },
+  { "door_1.part_1.start_step_opening",                "0"                     },
+  { "door_1.part_1.start_step_closing",                "0"                     },
   { "door_1.part_1.draw_masked",               "true"                  },
   { "door_1.part_1.draw_order",                        "3"                     },
   { "door_1.part_2.x",                         "0"                     },
@@ -5982,6 +5984,8 @@ struct ConfigInfo image_config[] =
   { "door_1.part_2.step_yoffset",              "1"                     },
   { "door_1.part_2.step_delay",                        "20"                    },
   { "door_1.part_2.start_step",                        "0"                     },
+  { "door_1.part_2.start_step_opening",                "0"                     },
+  { "door_1.part_2.start_step_closing",                "0"                     },
   { "door_1.part_2.draw_masked",               "true"                  },
   { "door_1.part_2.draw_order",                        "5"                     },
   { "door_1.part_3.x",                         "0"                     },
@@ -5990,6 +5994,8 @@ struct ConfigInfo image_config[] =
   { "door_1.part_3.step_yoffset",              "1"                     },
   { "door_1.part_3.step_delay",                        "20"                    },
   { "door_1.part_3.start_step",                        "0"                     },
+  { "door_1.part_3.start_step_opening",                "0"                     },
+  { "door_1.part_3.start_step_closing",                "0"                     },
   { "door_1.part_3.draw_masked",               "true"                  },
   { "door_1.part_3.draw_order",                        "4"                     },
   { "door_1.part_4.x",                         "0"                     },
@@ -5998,6 +6004,8 @@ struct ConfigInfo image_config[] =
   { "door_1.part_4.step_yoffset",              "1"                     },
   { "door_1.part_4.step_delay",                        "20"                    },
   { "door_1.part_4.start_step",                        "0"                     },
+  { "door_1.part_4.start_step_opening",                "0"                     },
+  { "door_1.part_4.start_step_closing",                "0"                     },
   { "door_1.part_4.draw_masked",               "true"                  },
   { "door_1.part_4.draw_order",                        "6"                     },
   { "door_1.part_5.x",                         "0"                     },
@@ -6006,6 +6014,8 @@ struct ConfigInfo image_config[] =
   { "door_1.part_5.step_yoffset",              "-1"                    },
   { "door_1.part_5.step_delay",                        "20"                    },
   { "door_1.part_5.start_step",                        "0"                     },
+  { "door_1.part_5.start_step_opening",                "0"                     },
+  { "door_1.part_5.start_step_closing",                "0"                     },
   { "door_1.part_5.draw_masked",               "true"                  },
   { "door_1.part_5.draw_order",                        "1"                     },
   { "door_1.part_6.x",                         "0"                     },
@@ -6014,6 +6024,8 @@ struct ConfigInfo image_config[] =
   { "door_1.part_6.step_yoffset",              "-1"                    },
   { "door_1.part_6.step_delay",                        "20"                    },
   { "door_1.part_6.start_step",                        "0"                     },
+  { "door_1.part_6.start_step_opening",                "0"                     },
+  { "door_1.part_6.start_step_closing",                "0"                     },
   { "door_1.part_6.draw_masked",               "true"                  },
   { "door_1.part_6.draw_order",                        "7"                     },
   { "door_1.part_7.x",                         "0"                     },
@@ -6022,6 +6034,8 @@ struct ConfigInfo image_config[] =
   { "door_1.part_7.step_yoffset",              "-1"                    },
   { "door_1.part_7.step_delay",                        "20"                    },
   { "door_1.part_7.start_step",                        "0"                     },
+  { "door_1.part_7.start_step_opening",                "0"                     },
+  { "door_1.part_7.start_step_closing",                "0"                     },
   { "door_1.part_7.draw_masked",               "true"                  },
   { "door_1.part_7.draw_order",                        "2"                     },
   { "door_1.part_8.x",                         "0"                     },
@@ -6030,6 +6044,8 @@ struct ConfigInfo image_config[] =
   { "door_1.part_8.step_yoffset",              "-1"                    },
   { "door_1.part_8.step_delay",                        "20"                    },
   { "door_1.part_8.start_step",                        "0"                     },
+  { "door_1.part_8.start_step_opening",                "0"                     },
+  { "door_1.part_8.start_step_closing",                "0"                     },
   { "door_1.part_8.draw_masked",               "true"                  },
   { "door_1.part_8.draw_order",                        "8"                     },
 
@@ -6039,6 +6055,8 @@ struct ConfigInfo image_config[] =
   { "door_2.part_1.step_yoffset",              "1"                     },
   { "door_2.part_1.step_delay",                        "20"                    },
   { "door_2.part_1.start_step",                        "0"                     },
+  { "door_2.part_1.start_step_opening",                "0"                     },
+  { "door_2.part_1.start_step_closing",                "0"                     },
   { "door_2.part_1.draw_masked",               "true"                  },
   { "door_2.part_1.draw_order",                        "2"                     },
   { "door_2.part_2.x",                         "0"                     },
@@ -6047,6 +6065,8 @@ struct ConfigInfo image_config[] =
   { "door_2.part_2.step_yoffset",              "1"                     },
   { "door_2.part_2.step_delay",                        "20"                    },
   { "door_2.part_2.start_step",                        "0"                     },
+  { "door_2.part_2.start_step_opening",                "0"                     },
+  { "door_2.part_2.start_step_closing",                "0"                     },
   { "door_2.part_2.draw_masked",               "true"                  },
   { "door_2.part_2.draw_order",                        "3"                     },
   { "door_2.part_3.x",                         "0"                     },
@@ -6055,6 +6075,8 @@ struct ConfigInfo image_config[] =
   { "door_2.part_3.step_yoffset",              "-1"                    },
   { "door_2.part_3.step_delay",                        "20"                    },
   { "door_2.part_3.start_step",                        "0"                     },
+  { "door_2.part_3.start_step_opening",                "0"                     },
+  { "door_2.part_3.start_step_closing",                "0"                     },
   { "door_2.part_3.draw_masked",               "true"                  },
   { "door_2.part_3.draw_order",                        "1"                     },
   { "door_2.part_4.x",                         "0"                     },
@@ -6063,6 +6085,8 @@ struct ConfigInfo image_config[] =
   { "door_2.part_4.step_yoffset",              "-1"                    },
   { "door_2.part_4.step_delay",                        "20"                    },
   { "door_2.part_4.start_step",                        "0"                     },
+  { "door_2.part_4.start_step_opening",                "0"                     },
+  { "door_2.part_4.start_step_closing",                "0"                     },
   { "door_2.part_4.draw_masked",               "true"                  },
   { "door_2.part_4.draw_order",                        "4"                     },
   { "door_2.part_5.x",                         "-1"                    },
@@ -6071,6 +6095,8 @@ struct ConfigInfo image_config[] =
   { "door_2.part_5.step_yoffset",              "0"                     },
   { "door_2.part_5.step_delay",                        "0"                     },
   { "door_2.part_5.start_step",                        "0"                     },
+  { "door_2.part_5.start_step_opening",                "0"                     },
+  { "door_2.part_5.start_step_closing",                "0"                     },
   { "door_2.part_5.draw_masked",               "true"                  },
   { "door_2.part_5.draw_order",                        "0"                     },
   { "door_2.part_6.x",                         "-1"                    },
@@ -6079,6 +6105,8 @@ struct ConfigInfo image_config[] =
   { "door_2.part_6.step_yoffset",              "0"                     },
   { "door_2.part_6.step_delay",                        "0"                     },
   { "door_2.part_6.start_step",                        "0"                     },
+  { "door_2.part_6.start_step_opening",                "0"                     },
+  { "door_2.part_6.start_step_closing",                "0"                     },
   { "door_2.part_6.draw_masked",               "true"                  },
   { "door_2.part_6.draw_order",                        "0"                     },
   { "door_2.part_7.x",                         "-1"                    },
@@ -6087,6 +6115,8 @@ struct ConfigInfo image_config[] =
   { "door_2.part_7.step_yoffset",              "0"                     },
   { "door_2.part_7.step_delay",                        "0"                     },
   { "door_2.part_7.start_step",                        "0"                     },
+  { "door_2.part_7.start_step_opening",                "0"                     },
+  { "door_2.part_7.start_step_closing",                "0"                     },
   { "door_2.part_7.draw_masked",               "true"                  },
   { "door_2.part_7.draw_order",                        "0"                     },
   { "door_2.part_8.x",                         "-1"                    },
@@ -6095,6 +6125,8 @@ struct ConfigInfo image_config[] =
   { "door_2.part_8.step_yoffset",              "0"                     },
   { "door_2.part_8.step_delay",                        "0"                     },
   { "door_2.part_8.start_step",                        "0"                     },
+  { "door_2.part_8.start_step_opening",                "0"                     },
+  { "door_2.part_8.start_step_closing",                "0"                     },
   { "door_2.part_8.draw_masked",               "true"                  },
   { "door_2.part_8.draw_order",                        "0"                     },
 
@@ -6104,6 +6136,8 @@ struct ConfigInfo image_config[] =
   { "door_1.panel.step_yoffset",               "1"                     },
   { "door_1.panel.step_delay",                 "10"                    },
   { "door_1.panel.start_step",                 "212"                   },
+  { "door_1.panel.start_step_opening",         "0"                     },
+  { "door_1.panel.start_step_closing",         "0"                     },
   { "door_1.panel.draw_masked",                        "false"                 },
   { "door_1.panel.draw_order",                 "0"                     },
 
@@ -6113,6 +6147,8 @@ struct ConfigInfo image_config[] =
   { "door_2.panel.step_yoffset",               "1"                     },
   { "door_2.panel.step_delay",                 "10"                    },
   { "door_2.panel.start_step",                 "32"                    },
+  { "door_2.panel.start_step_opening",         "0"                     },
+  { "door_2.panel.start_step_closing",         "0"                     },
   { "door_2.panel.draw_masked",                        "false"                 },
   { "door_2.panel.draw_order",                 "0"                     },
 
index 0f7607801e205e81e0c7c1a3275a8c4a33b3308f..af5915b55104a36ec12af411d0a00f542427748a 100644 (file)
@@ -2116,6 +2116,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "door_1.part_1.start_step",
     &door_1.part_1.start_step
   },
+  {
+    "door_1.part_1.start_step_opening",
+    &door_1.part_1.start_step_opening
+  },
+  {
+    "door_1.part_1.start_step_closing",
+    &door_1.part_1.start_step_closing
+  },
   {
     "door_1.part_1.draw_masked",
     &door_1.part_1.draw_masked
@@ -2148,6 +2156,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "door_1.part_2.start_step",
     &door_1.part_2.start_step
   },
+  {
+    "door_1.part_2.start_step_opening",
+    &door_1.part_2.start_step_opening
+  },
+  {
+    "door_1.part_2.start_step_closing",
+    &door_1.part_2.start_step_closing
+  },
   {
     "door_1.part_2.draw_masked",
     &door_1.part_2.draw_masked
@@ -2180,6 +2196,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "door_1.part_3.start_step",
     &door_1.part_3.start_step
   },
+  {
+    "door_1.part_3.start_step_opening",
+    &door_1.part_3.start_step_opening
+  },
+  {
+    "door_1.part_3.start_step_closing",
+    &door_1.part_3.start_step_closing
+  },
   {
     "door_1.part_3.draw_masked",
     &door_1.part_3.draw_masked
@@ -2212,6 +2236,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "door_1.part_4.start_step",
     &door_1.part_4.start_step
   },
+  {
+    "door_1.part_4.start_step_opening",
+    &door_1.part_4.start_step_opening
+  },
+  {
+    "door_1.part_4.start_step_closing",
+    &door_1.part_4.start_step_closing
+  },
   {
     "door_1.part_4.draw_masked",
     &door_1.part_4.draw_masked
@@ -2244,6 +2276,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "door_1.part_5.start_step",
     &door_1.part_5.start_step
   },
+  {
+    "door_1.part_5.start_step_opening",
+    &door_1.part_5.start_step_opening
+  },
+  {
+    "door_1.part_5.start_step_closing",
+    &door_1.part_5.start_step_closing
+  },
   {
     "door_1.part_5.draw_masked",
     &door_1.part_5.draw_masked
@@ -2276,6 +2316,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "door_1.part_6.start_step",
     &door_1.part_6.start_step
   },
+  {
+    "door_1.part_6.start_step_opening",
+    &door_1.part_6.start_step_opening
+  },
+  {
+    "door_1.part_6.start_step_closing",
+    &door_1.part_6.start_step_closing
+  },
   {
     "door_1.part_6.draw_masked",
     &door_1.part_6.draw_masked
@@ -2308,6 +2356,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "door_1.part_7.start_step",
     &door_1.part_7.start_step
   },
+  {
+    "door_1.part_7.start_step_opening",
+    &door_1.part_7.start_step_opening
+  },
+  {
+    "door_1.part_7.start_step_closing",
+    &door_1.part_7.start_step_closing
+  },
   {
     "door_1.part_7.draw_masked",
     &door_1.part_7.draw_masked
@@ -2340,6 +2396,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "door_1.part_8.start_step",
     &door_1.part_8.start_step
   },
+  {
+    "door_1.part_8.start_step_opening",
+    &door_1.part_8.start_step_opening
+  },
+  {
+    "door_1.part_8.start_step_closing",
+    &door_1.part_8.start_step_closing
+  },
   {
     "door_1.part_8.draw_masked",
     &door_1.part_8.draw_masked
@@ -2372,6 +2436,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "door_2.part_1.start_step",
     &door_2.part_1.start_step
   },
+  {
+    "door_2.part_1.start_step_opening",
+    &door_2.part_1.start_step_opening
+  },
+  {
+    "door_2.part_1.start_step_closing",
+    &door_2.part_1.start_step_closing
+  },
   {
     "door_2.part_1.draw_masked",
     &door_2.part_1.draw_masked
@@ -2404,6 +2476,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "door_2.part_2.start_step",
     &door_2.part_2.start_step
   },
+  {
+    "door_2.part_2.start_step_opening",
+    &door_2.part_2.start_step_opening
+  },
+  {
+    "door_2.part_2.start_step_closing",
+    &door_2.part_2.start_step_closing
+  },
   {
     "door_2.part_2.draw_masked",
     &door_2.part_2.draw_masked
@@ -2436,6 +2516,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "door_2.part_3.start_step",
     &door_2.part_3.start_step
   },
+  {
+    "door_2.part_3.start_step_opening",
+    &door_2.part_3.start_step_opening
+  },
+  {
+    "door_2.part_3.start_step_closing",
+    &door_2.part_3.start_step_closing
+  },
   {
     "door_2.part_3.draw_masked",
     &door_2.part_3.draw_masked
@@ -2468,6 +2556,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "door_2.part_4.start_step",
     &door_2.part_4.start_step
   },
+  {
+    "door_2.part_4.start_step_opening",
+    &door_2.part_4.start_step_opening
+  },
+  {
+    "door_2.part_4.start_step_closing",
+    &door_2.part_4.start_step_closing
+  },
   {
     "door_2.part_4.draw_masked",
     &door_2.part_4.draw_masked
@@ -2500,6 +2596,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "door_2.part_5.start_step",
     &door_2.part_5.start_step
   },
+  {
+    "door_2.part_5.start_step_opening",
+    &door_2.part_5.start_step_opening
+  },
+  {
+    "door_2.part_5.start_step_closing",
+    &door_2.part_5.start_step_closing
+  },
   {
     "door_2.part_5.draw_masked",
     &door_2.part_5.draw_masked
@@ -2532,6 +2636,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "door_2.part_6.start_step",
     &door_2.part_6.start_step
   },
+  {
+    "door_2.part_6.start_step_opening",
+    &door_2.part_6.start_step_opening
+  },
+  {
+    "door_2.part_6.start_step_closing",
+    &door_2.part_6.start_step_closing
+  },
   {
     "door_2.part_6.draw_masked",
     &door_2.part_6.draw_masked
@@ -2564,6 +2676,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "door_2.part_7.start_step",
     &door_2.part_7.start_step
   },
+  {
+    "door_2.part_7.start_step_opening",
+    &door_2.part_7.start_step_opening
+  },
+  {
+    "door_2.part_7.start_step_closing",
+    &door_2.part_7.start_step_closing
+  },
   {
     "door_2.part_7.draw_masked",
     &door_2.part_7.draw_masked
@@ -2596,6 +2716,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "door_2.part_8.start_step",
     &door_2.part_8.start_step
   },
+  {
+    "door_2.part_8.start_step_opening",
+    &door_2.part_8.start_step_opening
+  },
+  {
+    "door_2.part_8.start_step_closing",
+    &door_2.part_8.start_step_closing
+  },
   {
     "door_2.part_8.draw_masked",
     &door_2.part_8.draw_masked
@@ -2628,6 +2756,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "door_1.panel.start_step",
     &door_1.panel.start_step
   },
+  {
+    "door_1.panel.start_step_opening",
+    &door_1.panel.start_step_opening
+  },
+  {
+    "door_1.panel.start_step_closing",
+    &door_1.panel.start_step_closing
+  },
   {
     "door_1.panel.draw_masked",
     &door_1.panel.draw_masked
@@ -2660,6 +2796,14 @@ struct TokenIntPtrInfo image_config_vars[] =
     "door_2.panel.start_step",
     &door_2.panel.start_step
   },
+  {
+    "door_2.panel.start_step_opening",
+    &door_2.panel.start_step_opening
+  },
+  {
+    "door_2.panel.start_step_closing",
+    &door_2.panel.start_step_closing
+  },
   {
     "door_2.panel.draw_masked",
     &door_2.panel.draw_masked
index 7e43d7b5fd3d9d24dca6ff95b06b230d88126883..2154ffcac6aff62d7872c2243ff2f90cc532d78c 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2014-02-28 21:40"
+#define COMPILE_DATE_STRING "2014-03-01 00:52"
index 0d7f583c6cba70a2e5b6a5ce404722e80961d67f..b74b6fae17165e376d7da80d6a22a8752e0fc7c2 100644 (file)
@@ -1215,6 +1215,8 @@ struct DoorPartPosInfo
   int step_yoffset;
   int step_delay;
   int start_step;
+  int start_step_opening;
+  int start_step_closing;
   boolean draw_masked;
   int sort_priority;
 };
index 0348f112c4f07abe7a21c31f2eb9b2178bb20afe..d7f64e0abb4d72e1bd75e7f9f1c364bdf8747a9a 100644 (file)
@@ -5335,7 +5335,15 @@ void InitDoors()
     struct DoorPartControlInfo *dpc = &door_part_controls[i];
     struct DoorPartOrderInfo *dpo = &door_part_order[i];
 
-    /* fill structure for door part draw order */
+    /* initialize "start_step_opening" and "start_step_closing", if needed */
+    if (dpc->pos->start_step_opening == 0 &&
+       dpc->pos->start_step_closing == 0)
+    {
+      dpc->pos->start_step_opening = dpc->pos->start_step;
+      dpc->pos->start_step_closing = dpc->pos->start_step;
+    }
+
+    /* fill structure for door part draw order (sorted below) */
     dpo->nr = i;
     dpo->sort_priority = dpc->pos->sort_priority;
 
@@ -5523,13 +5531,21 @@ unsigned int MoveDoor(unsigned int door_state)
 
     for (i = 0; i < MAX_DOOR_PARTS; i++)
     {
-      struct DoorPartControlInfo *dpc = &door_part_controls[i];
-      struct GraphicInfo *g = &graphic_info[dpc->graphic];
+      int nr = door_part_order[i].nr;
+      struct DoorPartControlInfo *dpc = &door_part_controls[nr];
       struct DoorPartPosInfo *pos = dpc->pos;
+      struct GraphicInfo *g = &graphic_info[dpc->graphic];
+      int door_token = dpc->door_nr;
+      boolean is_panel = DOOR_PART_IS_PANEL(nr);
       int step_xoffset = ABS(pos->step_xoffset);
       int step_yoffset = ABS(pos->step_yoffset);
       int step_delay = pos->step_delay;
-      int start_step = pos->start_step;
+      int current_door_state = door_state & door_token;
+      boolean door_opening = ((current_door_state & DOOR_OPEN)  != 0);
+      boolean door_closing = ((current_door_state & DOOR_CLOSE) != 0);
+      boolean part_opening = (is_panel ? door_closing : door_opening);
+      int start_step = (part_opening ? pos->start_step_opening :
+                       pos->start_step_closing);
       float move_xsize = (step_xoffset ? g->width  : 0);
       float move_ysize = (step_yoffset ? g->height : 0);
       int move_xsteps = (step_xoffset ? ceil(move_xsize / step_xoffset) : 0);
@@ -5539,13 +5555,13 @@ unsigned int MoveDoor(unsigned int door_state)
                        move_xsteps ? move_xsteps : move_ysteps) - start_step;
       int move_delay = move_steps * step_delay;
 
-      if (door_part_done[i])
+      if (door_part_done[nr])
        continue;
 
       max_move_delay = MAX(max_move_delay, move_delay);
       max_step_delay = (max_step_delay == 0 ? step_delay :
                        euclid(max_step_delay, step_delay));
-      num_steps[i] = move_steps;
+      num_steps[nr] = move_steps;
 
 #if 0
 #if 0
@@ -5580,23 +5596,24 @@ unsigned int MoveDoor(unsigned int door_state)
       {
        int nr = door_part_order[i].nr;
        struct DoorPartControlInfo *dpc = &door_part_controls[nr];
+       struct DoorPartPosInfo *pos = dpc->pos;
+       struct GraphicInfo *g = &graphic_info[dpc->graphic];
        int door_token = dpc->door_nr;
        int door_index = DOOR_INDEX_FROM_TOKEN(door_token);
        boolean is_panel = DOOR_PART_IS_PANEL(nr);
-       struct GraphicInfo *g = &graphic_info[dpc->graphic];
-       struct DoorPartPosInfo *pos = dpc->pos;
        struct XY *panel_pos = &panel_pos_list[door_index];
        struct Rect *door_rect = &door_rect_list[door_index];
        Bitmap *bitmap = (is_panel ? bitmap_db_door : g->bitmap);
        int current_door_state = door_state & door_token;
        boolean door_opening = ((current_door_state & DOOR_OPEN)  != 0);
        boolean door_closing = ((current_door_state & DOOR_CLOSE) != 0);
-       boolean mode_opening = (is_panel ? door_closing : door_opening);
-       int start_step = pos->start_step;
+       boolean part_opening = (is_panel ? door_closing : door_opening);
+       int start_step = (part_opening ? pos->start_step_opening :
+                         pos->start_step_closing);
        int step_delay = pos->step_delay;
        int step_factor = step_delay / max_step_delay;
        int k1 = (step_factor ? k / step_factor + 1 : k);
-       int k2 = (mode_opening ? k1 + start_step : num_steps[nr] - k1);
+       int k2 = (part_opening ? k1 + start_step : num_steps[nr] - k1);
        int kk = (k2 < 0 ? 0 : k2);
        int src_x, src_y, src_xx, src_yy;
        int dst_x, dst_y, dst_xx, dst_yy;