rnd-20030927-2-src
authorHolger Schemel <info@artsoft.org>
Sat, 27 Sep 2003 16:34:30 +0000 (18:34 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:43:59 +0000 (10:43 +0200)
src/conf_fnt.c
src/conf_gfx.c
src/conf_gfx.h
src/conftime.h
src/editor.c
src/files.c
src/game.c
src/main.h
src/screens.c
src/tools.c

index ef44d5383c5bc8d4c9bf4611ce53264338907131..764bec1424c88508eeb6ad978e397c7343b356d8 100644 (file)
@@ -99,6 +99,10 @@ font_to_graphic[] =
     FONT_TEXT_2,                               GFX_SPECIAL_ARG_PREVIEW,
     IMG_FONT_TEXT_2_PREVIEW
   },
+  {
+    FONT_TEXT_2,                               GFX_SPECIAL_ARG_PLAYING,
+    IMG_FONT_TEXT_2_PLAYING
+  },
   {
     FONT_TEXT_2,                               GFX_SPECIAL_ARG_SCORES,
     IMG_FONT_TEXT_2_SCORES
@@ -119,6 +123,10 @@ font_to_graphic[] =
     FONT_TEXT_3,                               GFX_SPECIAL_ARG_PREVIEW,
     IMG_FONT_TEXT_3_PREVIEW
   },
+  {
+    FONT_TEXT_3,                               GFX_SPECIAL_ARG_PLAYING,
+    IMG_FONT_TEXT_3_PLAYING
+  },
   {
     FONT_TEXT_3,                               GFX_SPECIAL_ARG_SCORES,
     IMG_FONT_TEXT_3_SCORES
@@ -135,6 +143,10 @@ font_to_graphic[] =
     FONT_TEXT_4,                               GFX_SPECIAL_ARG_LEVELS,
     IMG_FONT_TEXT_4_LEVELS
   },
+  {
+    FONT_TEXT_4,                               GFX_SPECIAL_ARG_PLAYING,
+    IMG_FONT_TEXT_4_PLAYING
+  },
   {
     FONT_TEXT_4,                               GFX_SPECIAL_ARG_SCORES,
     IMG_FONT_TEXT_4_SCORES
index 72dd3bd17eb1296466f05ddddbe87fa1a0e82f99..465277379ca25759f9a2bdfedb365e960aeaca5e 100644 (file)
@@ -3308,6 +3308,11 @@ struct ConfigInfo image_config[] =
   { "font.text_2.PREVIEW.y",                   "160"                   },
   { "font.text_2.PREVIEW.width",               "16"                    },
   { "font.text_2.PREVIEW.height",              "16"                    },
+  { "font.text_2.PLAYING",                     "RocksFontEM.pcx"       },
+  { "font.text_2.PLAYING.x",                   "0"                     },
+  { "font.text_2.PLAYING.y",                   "160"                   },
+  { "font.text_2.PLAYING.width",               "16"                    },
+  { "font.text_2.PLAYING.height",              "16"                    },
   { "font.text_2.SCORES",                      "RocksFontBig.pcx"      },
   { "font.text_2.SCORES.x",                    "0"                     },
   { "font.text_2.SCORES.y",                    "320"                   },
@@ -3333,6 +3338,11 @@ struct ConfigInfo image_config[] =
   { "font.text_3.PREVIEW.y",                   "160"                   },
   { "font.text_3.PREVIEW.width",               "16"                    },
   { "font.text_3.PREVIEW.height",              "16"                    },
+  { "font.text_3.PLAYING",                     "RocksFontEM.pcx"       },
+  { "font.text_3.PLAYING.x",                   "0"                     },
+  { "font.text_3.PLAYING.y",                   "160"                   },
+  { "font.text_3.PLAYING.width",               "16"                    },
+  { "font.text_3.PLAYING.height",              "16"                    },
   { "font.text_3.SCORES",                      "RocksFontMedium.pcx"   },
   { "font.text_3.SCORES.x",                    "0"                     },
   { "font.text_3.SCORES.y",                    "480"                   },
@@ -3353,6 +3363,11 @@ struct ConfigInfo image_config[] =
   { "font.text_4.LEVELS.y",                    "480"                   },
   { "font.text_4.LEVELS.width",                        "16"                    },
   { "font.text_4.LEVELS.height",               "32"                    },
+  { "font.text_4.PLAYING",                     "RocksFontEM.pcx"       },
+  { "font.text_4.PLAYING.x",                   "0"                     },
+  { "font.text_4.PLAYING.y",                   "160"                   },
+  { "font.text_4.PLAYING.width",               "16"                    },
+  { "font.text_4.PLAYING.height",              "16"                    },
   { "font.text_4.SCORES",                      "RocksFontMedium.pcx"   },
   { "font.text_4.SCORES.x",                    "0"                     },
   { "font.text_4.SCORES.y",                    "480"                   },
index cf51a444bf51302d5d683ef1af4c17ec22a14033..b1688cfba994c53affe69b5e8328498973e8b3c6 100644 (file)
 #define IMG_FONT_TEXT_2                                        1236
 #define IMG_FONT_TEXT_2_LEVELS                         1237
 #define IMG_FONT_TEXT_2_PREVIEW                                1238
-#define IMG_FONT_TEXT_2_SCORES                         1239
-#define IMG_FONT_TEXT_2_ACTIVE_SCORES                  1240
-#define IMG_FONT_TEXT_3                                        1241
-#define IMG_FONT_TEXT_3_LEVELS                         1242
-#define IMG_FONT_TEXT_3_PREVIEW                                1243
-#define IMG_FONT_TEXT_3_SCORES                         1244
-#define IMG_FONT_TEXT_3_ACTIVE_SCORES                  1245
-#define IMG_FONT_TEXT_4                                        1246
-#define IMG_FONT_TEXT_4_LEVELS                         1247
-#define IMG_FONT_TEXT_4_SCORES                         1248
-#define IMG_FONT_TEXT_4_ACTIVE_SCORES                  1249
-#define IMG_FONT_INPUT_1                               1250
-#define IMG_FONT_INPUT_1_MAIN                          1251
-#define IMG_FONT_INPUT_1_ACTIVE                                1252
-#define IMG_FONT_INPUT_1_ACTIVE_MAIN                   1253
-#define IMG_FONT_INPUT_1_ACTIVE_SETUP                  1254
-#define IMG_FONT_INPUT_2                               1255
-#define IMG_FONT_INPUT_2_ACTIVE                                1256
-#define IMG_FONT_OPTION_OFF                            1257
-#define IMG_FONT_OPTION_ON                             1258
-#define IMG_FONT_VALUE_1                               1259
-#define IMG_FONT_VALUE_2                               1260
-#define IMG_FONT_VALUE_OLD                             1261
-#define IMG_FONT_LEVEL_NUMBER                          1262
-#define IMG_FONT_TAPE_RECORDER                         1263
-#define IMG_FONT_GAME_INFO                             1264
-#define IMG_GLOBAL_BORDER                              1265
-#define IMG_GLOBAL_DOOR                                        1266
-#define IMG_EDITOR_ELEMENT_BORDER                      1267
-#define IMG_EDITOR_ELEMENT_BORDER_INPUT                        1268
-#define IMG_GAME_ENVELOPE_BACKGROUND                   1269
-#define IMG_GAME_ENVELOPE_1_BACKGROUND                 1270
-#define IMG_GAME_ENVELOPE_2_BACKGROUND                 1271
-#define IMG_GAME_ENVELOPE_3_BACKGROUND                 1272
-#define IMG_GAME_ENVELOPE_4_BACKGROUND                 1273
-#define IMG_BACKGROUND                                 1274
-#define IMG_BACKGROUND_MAIN                            1275
-#define IMG_BACKGROUND_LEVELS                          1276
-#define IMG_BACKGROUND_SCORES                          1277
-#define IMG_BACKGROUND_EDITOR                          1278
-#define IMG_BACKGROUND_INFO                            1279
-#define IMG_BACKGROUND_SETUP                           1280
-#define IMG_BACKGROUND_DOOR                            1281
+#define IMG_FONT_TEXT_2_PLAYING                                1239
+#define IMG_FONT_TEXT_2_SCORES                         1240
+#define IMG_FONT_TEXT_2_ACTIVE_SCORES                  1241
+#define IMG_FONT_TEXT_3                                        1242
+#define IMG_FONT_TEXT_3_LEVELS                         1243
+#define IMG_FONT_TEXT_3_PREVIEW                                1244
+#define IMG_FONT_TEXT_3_PLAYING                                1245
+#define IMG_FONT_TEXT_3_SCORES                         1246
+#define IMG_FONT_TEXT_3_ACTIVE_SCORES                  1247
+#define IMG_FONT_TEXT_4                                        1248
+#define IMG_FONT_TEXT_4_LEVELS                         1249
+#define IMG_FONT_TEXT_4_PLAYING                                1250
+#define IMG_FONT_TEXT_4_SCORES                         1251
+#define IMG_FONT_TEXT_4_ACTIVE_SCORES                  1252
+#define IMG_FONT_INPUT_1                               1253
+#define IMG_FONT_INPUT_1_MAIN                          1254
+#define IMG_FONT_INPUT_1_ACTIVE                                1255
+#define IMG_FONT_INPUT_1_ACTIVE_MAIN                   1256
+#define IMG_FONT_INPUT_1_ACTIVE_SETUP                  1257
+#define IMG_FONT_INPUT_2                               1258
+#define IMG_FONT_INPUT_2_ACTIVE                                1259
+#define IMG_FONT_OPTION_OFF                            1260
+#define IMG_FONT_OPTION_ON                             1261
+#define IMG_FONT_VALUE_1                               1262
+#define IMG_FONT_VALUE_2                               1263
+#define IMG_FONT_VALUE_OLD                             1264
+#define IMG_FONT_LEVEL_NUMBER                          1265
+#define IMG_FONT_TAPE_RECORDER                         1266
+#define IMG_FONT_GAME_INFO                             1267
+#define IMG_GLOBAL_BORDER                              1268
+#define IMG_GLOBAL_DOOR                                        1269
+#define IMG_EDITOR_ELEMENT_BORDER                      1270
+#define IMG_EDITOR_ELEMENT_BORDER_INPUT                        1271
+#define IMG_GAME_ENVELOPE_BACKGROUND                   1272
+#define IMG_GAME_ENVELOPE_1_BACKGROUND                 1273
+#define IMG_GAME_ENVELOPE_2_BACKGROUND                 1274
+#define IMG_GAME_ENVELOPE_3_BACKGROUND                 1275
+#define IMG_GAME_ENVELOPE_4_BACKGROUND                 1276
+#define IMG_BACKGROUND                                 1277
+#define IMG_BACKGROUND_MAIN                            1278
+#define IMG_BACKGROUND_LEVELS                          1279
+#define IMG_BACKGROUND_SCORES                          1280
+#define IMG_BACKGROUND_EDITOR                          1281
+#define IMG_BACKGROUND_INFO                            1282
+#define IMG_BACKGROUND_SETUP                           1283
+#define IMG_BACKGROUND_DOOR                            1284
 
-#define NUM_IMAGE_FILES                                        1282
+#define NUM_IMAGE_FILES                                        1285
 
 #endif /* CONF_GFX_H */
index 068d3fa4a5b9de6f024f10481e161509bb8bc13d..5f389b344e7f27a4068835c2360b7c47cccf257e 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2003-09-27 11:36]"
+#define COMPILE_DATE_STRING "[2003-09-27 18:33]"
index 4a95e613b748ce615ed76126edf1b9c587ac3b21..793ade1b2cf3ec494cb0aebf59e1d53fd0a9a3c5 100644 (file)
@@ -950,7 +950,7 @@ static struct
     GADGET_ID_CHANGE_CONT_RND_DOWN,    GADGET_ID_CHANGE_CONT_RND_UP,
     GADGET_ID_CHANGE_CONT_RND_TEXT,    GADGET_ID_NONE,
     &custom_element_change.random,
-    NULL,                              "use random change:", "(%)"
+    NULL,                              "use random replace:", "%"
   },
 };
 
@@ -1043,6 +1043,7 @@ static struct ValueTextInfo options_move_pattern[] =
   { MV_ALONG_RIGHT_SIDE,       "along right side"              },
   { MV_TURNING_LEFT,           "turning left"                  },
   { MV_TURNING_RIGHT,          "turning right"                 },
+  { MV_WHEN_PUSHED,            "when pushed"                   },
   { -1,                                NULL                            }
 };
 
@@ -1104,20 +1105,20 @@ static struct ValueTextInfo options_consistency[] =
 
 static struct ValueTextInfo options_time_units[] =
 {
-  { FRAMES_PER_SECOND,         "seconds"                       },
   { 1,                         "frames"                        },
+  { FRAMES_PER_SECOND,         "seconds"                       },
   { -1,                                NULL                            }
 };
 
 static struct ValueTextInfo options_change_direct_action[] =
 {
-  { CE_TOUCHED_BY_PLAYER,      "touched by player"             },
-  { CE_PRESSED_BY_PLAYER,      "pressed by player"             },
-  { CE_PUSHED_BY_PLAYER,       "pushed by player"              },
+  { CE_TOUCHED_BY_PLAYER,      "touched by player ..."         },
+  { CE_PRESSED_BY_PLAYER,      "pressed by player ..."         },
+  { CE_PUSHED_BY_PLAYER,       "pushed by player ..."          },
   { CE_ENTERED_BY_PLAYER,      "entered by player ..."         },
   { CE_LEFT_BY_PLAYER,         "left by player ..."            },
   { CE_DROPPED_BY_PLAYER,      "dropped by player"             },
-  { CE_COLLISION,              "collision"                     },
+  { CE_COLLISION,              "collision ..."                 },
   { CE_IMPACT,                 "impact"                        },
   { CE_SMASHED,                        "smashed"                       },
   { -1,                                NULL                            }
@@ -1125,9 +1126,9 @@ static struct ValueTextInfo options_change_direct_action[] =
 
 static struct ValueTextInfo options_change_other_action[] =
 {
-  { CE_OTHER_GETS_TOUCHED,     "player touches"                },
-  { CE_OTHER_GETS_PRESSED,     "player presses"                },
-  { CE_OTHER_GETS_PUSHED,      "player pushes"                 },
+  { CE_OTHER_GETS_TOUCHED,     "player touches ..."            },
+  { CE_OTHER_GETS_PRESSED,     "player presses ..."            },
+  { CE_OTHER_GETS_PUSHED,      "player pushes ..."             },
   { CE_OTHER_GETS_ENTERED,     "player enters ..."             },
   { CE_OTHER_GETS_LEFT,                "player leaves ..."             },
   { CE_OTHER_GETS_DIGGED,      "player digs"                   },
@@ -1659,13 +1660,13 @@ static struct
     ED_SETTINGS_XPOS(2),               ED_SETTINGS_YPOS(11),
     GADGET_ID_CHANGE_ONLY_COMPLETE,    GADGET_ID_NONE,
     &custom_element_change.only_complete,
-    NULL, "only use complete change",  "only use complete extended content"
+    NULL, "replace all or nothing",    "only replace when all can be changed"
   },
   {
     ED_SETTINGS_XPOS(2),               ED_SETTINGS_YPOS(12),
     GADGET_ID_CHANGE_USE_RANDOM,       GADGET_ID_NONE,
     &custom_element_change.use_random_change,
-    NULL, NULL,                                "use random value for new content"
+    NULL, NULL,                                "use percentage for random replace"
   },
   {
     ED_SETTINGS_XPOS(0),               ED_SETTINGS_YPOS(13),
@@ -7571,10 +7572,12 @@ void RequestExitLevelEditor(boolean ask_if_level_has_changed)
       Request("Level has changed! Exit without saving ?",
              REQ_ASK | REQ_STAY_OPEN))
   {
+#if 1
     CloseDoor(DOOR_CLOSE_1);
-    /*
+    SetDoorState(DOOR_CLOSE_2);
+#else
     CloseDoor(DOOR_CLOSE_ALL);
-    */
+#endif
     game_status = GAME_MODE_MAIN;
     DrawMainMenu();
   }
index 3c26c22fd2f41cdcf9417e4349ba91b179a363d2..4dac3c11d1c94aea0d67c9a1f63d284e85629607 100644 (file)
@@ -34,8 +34,6 @@
 #define LEVEL_CHUNK_CNT3_UNUSED        10      /* unused CNT3 chunk bytes    */
 #define LEVEL_CPART_CUS3_SIZE  134     /* size of CUS3 chunk part    */
 #define LEVEL_CPART_CUS3_UNUSED        15      /* unused CUS3 bytes / part   */
-#define LEVEL_CPART_CUS4_SIZE  ???     /* size of CUS4 chunk part    */
-#define LEVEL_CPART_CUS4_UNUSED        ???     /* unused CUS4 bytes / part   */
 #define TAPE_HEADER_SIZE       20      /* size of tape file header   */
 #define TAPE_HEADER_UNUSED     3       /* unused tape header bytes   */
 
@@ -80,7 +78,7 @@ void setElementChangeInfoToDefaults(struct ElementChangeInfo *change)
 
   change->delay_fixed = 0;
   change->delay_random = 0;
-  change->delay_frames = -1;   /* later set to reliable default value */
+  change->delay_frames = 1;
 
   change->trigger_element = EL_EMPTY_SPACE;
 
@@ -88,7 +86,7 @@ void setElementChangeInfoToDefaults(struct ElementChangeInfo *change)
   change->use_content = FALSE;
   change->only_complete = FALSE;
   change->use_random_change = FALSE;
-  change->random = 0;
+  change->random = 100;
   change->power = CP_NON_DESTRUCTIVE;
 
   for(x=0; x<3; x++)
@@ -782,8 +780,13 @@ static int LoadLevel_CUS4(FILE *file, int chunk_size, struct LevelInfo *level)
 
     change->can_change = getFile8Bit(file);
 
+    change->sides = getFile8Bit(file);
+
+    if (change->sides == CH_SIDE_NONE) /* correct empty sides field */
+      change->sides = CH_SIDE_ANY;
+
     /* some free bytes for future change property values and padding */
-    ReadUnusedBytesFromFile(file, 9);
+    ReadUnusedBytesFromFile(file, 8);
   }
 
   /* mark this custom element as modified */
@@ -1649,8 +1652,10 @@ static void SaveLevel_CUS4(FILE *file, struct LevelInfo *level, int element)
 
     putFile8Bit(file, change->can_change);
 
+    putFile8Bit(file, change->sides);
+
     /* some free bytes for future change property values and padding */
-    WriteUnusedBytesToFile(file, 9);
+    WriteUnusedBytesToFile(file, 8);
   }
 }
 
index 17eaef58990f47d39e4de9920cbbdeedd94b64a0..b73c4dc8d1b43187cc21798d4c4ac84fcdb9dfe8 100644 (file)
@@ -3649,6 +3649,13 @@ void TurnRound(int x, int y)
       MovDir[x][y] = old_move_dir;
     }
   }
+  else if (element_info[element].move_pattern == MV_WHEN_PUSHED)
+  {
+    if (!IN_LEV_FIELD_AND_IS_FREE(move_x, move_y))
+      MovDir[x][y] = MV_NO_MOVING;
+
+    MovDelay[x][y] = 0;
+  }
 }
 
 static boolean JustBeingPushed(int x, int y)
@@ -3959,11 +3966,16 @@ void StartMoving(int x, int y)
   {
     int newx, newy;
 
+#if 1
+    if (IS_PUSHABLE(element) && JustBeingPushed(x, y))
+      return;
+#else
     if ((element == EL_SATELLITE ||
         element == EL_BALLOON ||
         element == EL_SPRING)
        && JustBeingPushed(x, y))
       return;
+#endif
 
 #if 0
 #if 0
@@ -4496,7 +4508,7 @@ void ContinueMoving(int x, int y)
       Impact(x, newy);
 
     if (!IN_LEV_FIELD(nextx, nexty) || !IS_FREE(nextx, nexty))
-      CheckElementChange(newx, newy, element, CE_COLLISION);
+      CheckElementSideChange(newx, newy, element, direction, CE_COLLISION, -1);
 
 #if 1
     TestIfElementTouchesCustomElement(x, y);           /* for empty space */
@@ -6815,6 +6827,14 @@ void TestIfPlayerTouchesCustomElement(int x, int y)
     { +1, 0 },
     { 0, +1 }
   };
+  static int change_sides[4][2] =
+  {
+    /* center side       border side */
+    { CH_SIDE_TOP,     CH_SIDE_BOTTOM  },      /* check top    */
+    { CH_SIDE_LEFT,    CH_SIDE_RIGHT   },      /* check left   */
+    { CH_SIDE_RIGHT,   CH_SIDE_LEFT    },      /* check right  */
+    { CH_SIDE_BOTTOM,  CH_SIDE_TOP     }       /* check bottom */
+  };
   int i;
 
 #if 0
@@ -6828,10 +6848,30 @@ void TestIfPlayerTouchesCustomElement(int x, int y)
   {
     int xx = x + xy[i][0];
     int yy = y + xy[i][1];
+    int center_side = change_sides[i][0];
+    int border_side = change_sides[i][1];
 
     if (!IN_LEV_FIELD(xx, yy))
       continue;
 
+#if 1
+    if (IS_PLAYER(x, y))
+    {
+      CheckTriggeredElementSideChange(xx, yy, Feld[xx][yy], border_side,
+                                     CE_OTHER_GETS_TOUCHED);
+      CheckElementSideChange(xx, yy, Feld[xx][yy], border_side,
+                            CE_TOUCHED_BY_PLAYER, -1);
+    }
+    else if (IS_PLAYER(xx, yy))
+    {
+      CheckTriggeredElementSideChange(x, y, Feld[x][y], center_side,
+                                     CE_OTHER_GETS_TOUCHED);
+      CheckElementSideChange(x, y, Feld[x][y], center_side,
+                            CE_TOUCHED_BY_PLAYER, -1);
+
+      break;
+    }
+#else
     if (IS_PLAYER(x, y))
     {
       CheckTriggeredElementChange(xx, yy, Feld[xx][yy], CE_OTHER_GETS_TOUCHED);
@@ -6844,6 +6884,7 @@ void TestIfPlayerTouchesCustomElement(int x, int y)
 
       break;
     }
+#endif
   }
 
 #if 0
@@ -7277,16 +7318,13 @@ static boolean checkDiagonalPushing(struct PlayerInfo *player,
 int DigField(struct PlayerInfo *player,
             int x, int y, int real_dx, int real_dy, int mode)
 {
-#if 0
-  static int change_sides[4][2] =
+  static int change_sides[4] =
   {
-    /* enter side        leave side */
-    { CH_SIDE_RIGHT,   CH_SIDE_LEFT    },      /* moving left  */
-    { CH_SIDE_LEFT,    CH_SIDE_RIGHT   },      /* moving right */
-    { CH_SIDE_BOTTOM,  CH_SIDE_TOP     },      /* moving up    */
-    { CH_SIDE_TOP,     CH_SIDE_BOTTOM  }       /* moving down  */
+    CH_SIDE_RIGHT,     /* moving left  */
+    CH_SIDE_LEFT,      /* moving right */
+    CH_SIDE_BOTTOM,    /* moving up    */
+    CH_SIDE_TOP,       /* moving down  */
   };
-#endif
   boolean use_spring_bug = (game.engine_version < VERSION_IDENT(2,2,0));
   int jx = player->jx, jy = player->jy;
   int dx = x - jx, dy = y - jy;
@@ -7295,10 +7333,7 @@ int DigField(struct PlayerInfo *player,
                        dx == +1 ? MV_RIGHT :
                        dy == -1 ? MV_UP :
                        dy == +1 ? MV_DOWN : MV_NO_MOVING);
-#if 0
-  int enter_side = change_sides[MV_DIR_BIT(move_direction)][0];
-  int leave_side = change_sides[MV_DIR_BIT(move_direction)][1];
-#endif
+  int dig_side = change_sides[MV_DIR_BIT(move_direction)];
   int element;
 
   if (player->MovPos == 0)
@@ -7762,9 +7797,22 @@ int DigField(struct PlayerInfo *player,
            !(element == EL_SPRING && use_spring_bug))
          return MF_NO_ACTION;
 
+#if 1
+       /*
+       printf("::: %d [%d,%d,%d => %d]\n", MovDir[x][y],
+              CAN_MOVE(element), move_direction, getElementMoveStepsize(x, y),
+              (CAN_MOVE(element) && MovDir[x][y] == move_direction &&
+               getElementMoveStepsize(x, y) > MOVE_STEPSIZE_NORMAL) );
+       */
+
+       /* do not push elements already moving away faster than player */
+       if (CAN_MOVE(element) && MovDir[x][y] == move_direction &&
+           ABS(getElementMoveStepsize(x, y)) > MOVE_STEPSIZE_NORMAL)
+         return MF_NO_ACTION;
+#else
        if (element == EL_SPRING && MovDir[x][y] != MV_NO_MOVING)
          return MF_NO_ACTION;
-
+#endif
        if (!player->Pushing &&
            game.engine_version >= RELEASE_IDENT(2,2,0,7))
          player->push_delay_value = GET_NEW_PUSH_DELAY(element);
@@ -7837,15 +7885,29 @@ int DigField(struct PlayerInfo *player,
        if (game.engine_version < RELEASE_IDENT(2,2,0,7))
          player->push_delay_value = GET_NEW_PUSH_DELAY(element);
 
+#if 1
+       CheckTriggeredElementSideChange(x, y, element, dig_side,
+                                       CE_OTHER_GETS_PUSHED);
+       CheckElementSideChange(x, y, element, dig_side,
+                              CE_PUSHED_BY_PLAYER, -1);
+#else
        CheckTriggeredElementChange(x, y, element, CE_OTHER_GETS_PUSHED);
        CheckElementChange(x, y, element, CE_PUSHED_BY_PLAYER);
+#endif
 
        break;
       }
       else
       {
+#if 1
+       CheckTriggeredElementSideChange(x, y, element, dig_side,
+                                   CE_OTHER_GETS_PRESSED);
+       CheckElementSideChange(x, y, element, dig_side,
+                              CE_PRESSED_BY_PLAYER, -1);
+#else
        CheckTriggeredElementChange(x, y, element, CE_OTHER_GETS_PRESSED);
        CheckElementChange(x, y, element, CE_PRESSED_BY_PLAYER);
+#endif
       }
 
       return MF_NO_ACTION;
@@ -7856,24 +7918,6 @@ int DigField(struct PlayerInfo *player,
   if (Feld[x][y] != element)           /* really digged/collected something */
     player->is_collecting = !player->is_digging;
 
-#if 0
-  if (IS_CUSTOM_ELEMENT(Feld[jx][jy]))
-  {
-    CheckTriggeredElementSideChange(jx, jy, Feld[jx][jy], leave_side,
-                                   CE_OTHER_GETS_LEFT);
-    CheckElementSideChange(jx, jy, Feld[jx][jy], leave_side,
-                          CE_LEFT_BY_PLAYER, -1);
-  }
-
-  if (IS_CUSTOM_ELEMENT(Feld[x][y]))
-  {
-    CheckTriggeredElementSideChange(x, y, Feld[x][y], enter_side,
-                                   CE_OTHER_GETS_ENTERED);
-    CheckElementSideChange(x, y, Feld[x][y], enter_side,
-                          CE_ENTERED_BY_PLAYER, -1);
-  }
-#endif
-
   return MF_MOVING;
 }
 
index ef941752bce33bef635740429830c178f531ec3a..ef25bdde5356676cc1e90d66531b1a8d5d032baf 100644 (file)
                                  (CH_EVENT_VAR(e) &= ~CH_EVENT_BIT(c))) : 0)
 
 /* values for change sides for custom elements */
+#define CH_SIDE_NONE           MV_NO_MOVING
 #define CH_SIDE_LEFT           MV_LEFT
 #define CH_SIDE_RIGHT          MV_RIGHT
 #define CH_SIDE_TOP            MV_UP
 #define MV_BIT_ALONG_RIGHT_SIDE        7
 #define MV_BIT_TURNING_LEFT    8
 #define MV_BIT_TURNING_RIGHT   9
+#define MV_BIT_WHEN_PUSHED     10
 
 /* values for special move patterns for custom elements */
 #define MV_HORIZONTAL          (MV_LEFT | MV_RIGHT)
 #define MV_ALONG_RIGHT_SIDE    (1 << MV_BIT_ALONG_RIGHT_SIDE)
 #define MV_TURNING_LEFT                (1 << MV_BIT_TURNING_LEFT)
 #define MV_TURNING_RIGHT       (1 << MV_BIT_TURNING_RIGHT)
+#define MV_WHEN_PUSHED         (1 << MV_BIT_WHEN_PUSHED)
 
 /* values for slippery property for custom elements */
 #define SLIPPERY_ANY_RANDOM    0
index c119ff7c1eef22da85ce44d37fe4fb76cc8dfeae..54ba6a4110cc4863aec45fd9e0f4e1f96d076ba2 100644 (file)
@@ -212,6 +212,7 @@ void DrawMainMenu()
   {
     game_status = GAME_MODE_EDITOR;
     DrawLevelEd();
+
     return;
   }
 
index 4fdb41205329838f3a0a77c71bfb87cb173223d5..3f4cff156333e254be9e205a7b1c7aa01c7fc8fb 100644 (file)
@@ -1599,6 +1599,170 @@ void DrawEnvelopeBackground(int envelope_nr, int startx, int starty,
               dst_x, dst_y);
 }
 
+#if 1
+
+void AnimateEnvelope(int envelope_nr)
+{
+}
+
+void ShowEnvelope(int envelope_nr)
+{
+  int element = EL_ENVELOPE_1 + envelope_nr;
+  int graphic = IMG_GAME_ENVELOPE_1_BACKGROUND + envelope_nr;
+  int sound_opening = element_info[element].sound[ACTION_OPENING];
+  int sound_closing = element_info[element].sound[ACTION_CLOSING];
+  boolean draw_masked = graphic_info[graphic].draw_masked;
+  int anim_mode = graphic_info[graphic].anim_mode;
+  int mask_mode = (draw_masked ? BLIT_MASKED : BLIT_ON_BACKGROUND);
+  int font_nr = FONT_TEXT_1 + envelope_nr;
+  int font_width = getFontWidth(font_nr);
+  int font_height = getFontHeight(font_nr);
+  boolean ffwd_delay = (tape.playing && tape.fast_forward);
+  unsigned long anim_delay = 0;
+  int anim_delay_value = (ffwd_delay ? FfwdFrameDelay : GameFrameDelay);
+  int wait_delay_value = (ffwd_delay ? 500 : 1000);
+  int start_pos_vertically = 0;
+  int i, x, y;
+
+  game.envelope_active = TRUE;
+
+  if (anim_mode != ANIM_NONE)
+    PlaySoundStereo(sound_opening, SOUND_MIDDLE);
+
+  if (anim_mode == ANIM_DEFAULT)
+  {
+    /* open envelope window horizontally */
+    for (i = 0; i <= level.envelope_xsize[envelope_nr]; i++)
+    {
+      int xsize = i + 2;
+      int ysize = 2;
+      int startx = (SXSIZE - xsize * font_width)  / 2;
+      int starty = (SYSIZE - ysize * font_height) / 2;
+
+      SetDrawtoField(DRAW_BUFFERED);
+
+      BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY);
+
+      SetDrawtoField(DRAW_BACKBUFFER);
+
+      for (y=0; y < ysize; y++) for (x=0; x < xsize; x++)
+       DrawEnvelopeBackground(envelope_nr, startx, starty, x, y, xsize, ysize,
+                              font_nr);
+
+      redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER;
+      BackToFront();
+
+      WaitUntilDelayReached(&anim_delay, anim_delay_value / 2);
+    }
+  }
+
+  if (anim_mode == ANIM_NONE)
+    start_pos_vertically = level.envelope_ysize[envelope_nr];
+
+  /* open envelope window vertically */
+  for (i = start_pos_vertically; i <= level.envelope_ysize[envelope_nr]; i++)
+  {
+    int xsize = level.envelope_xsize[envelope_nr] + 2;
+    int ysize = i + 2;
+    int startx = (SXSIZE - xsize * font_width)  / 2;
+    int starty = (SYSIZE - ysize * font_height) / 2;
+
+    SetDrawtoField(DRAW_BUFFERED);
+
+    BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY);
+
+    SetDrawtoField(DRAW_BACKBUFFER);
+
+    for (y=0; y < ysize; y++) for (x=0; x < xsize; x++)
+      DrawEnvelopeBackground(envelope_nr, startx, starty, x, y, xsize, ysize,
+                            font_nr);
+
+    DrawTextToTextArea(SX + startx + font_width, SY + starty + font_height,
+                      level.envelope_text[envelope_nr], font_nr,
+                      level.envelope_xsize[envelope_nr], i, mask_mode);
+
+    redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER;
+    BackToFront();
+
+    WaitUntilDelayReached(&anim_delay, anim_delay_value);
+  }
+
+  if (tape.playing)
+    Delay(wait_delay_value);
+  else
+    WaitForEventToContinue();
+
+  if (anim_mode != ANIM_NONE)
+    PlaySoundStereo(sound_closing, SOUND_MIDDLE);
+
+  if (anim_mode != ANIM_NONE)
+  {
+    /* close envelope window vertically */
+    for (i = level.envelope_ysize[envelope_nr]; i >= 0; i--)
+    {
+      int xsize = level.envelope_xsize[envelope_nr] + 2;
+      int ysize = i + 2;
+      int startx = (SXSIZE - xsize * font_width)  / 2;
+      int starty = (SYSIZE - ysize * font_height) / 2;
+
+      SetDrawtoField(DRAW_BUFFERED);
+
+      BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY);
+
+      SetDrawtoField(DRAW_BACKBUFFER);
+
+      for (y=0; y < ysize; y++) for (x=0; x < xsize; x++)
+       DrawEnvelopeBackground(envelope_nr, startx, starty, x, y, xsize, ysize,
+                              font_nr);
+
+      DrawTextToTextArea(SX + startx + font_width, SY + starty + font_height,
+                        level.envelope_text[envelope_nr], font_nr,
+                        level.envelope_xsize[envelope_nr], i, mask_mode);
+
+      redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER;
+      BackToFront();
+
+      WaitUntilDelayReached(&anim_delay, anim_delay_value);
+    }
+  }
+
+  if (anim_mode == ANIM_DEFAULT)
+  {
+    /* close envelope window horizontally */
+    for (i = level.envelope_xsize[envelope_nr]; i >= 0; i--)
+    {
+      int xsize = i + 2;
+      int ysize = 2;
+      int startx = (SXSIZE - xsize * font_width)  / 2;
+      int starty = (SYSIZE - ysize * font_height) / 2;
+
+      SetDrawtoField(DRAW_BUFFERED);
+
+      BlitBitmap(fieldbuffer, backbuffer, FX, FY, SXSIZE, SYSIZE, SX, SY);
+
+      SetDrawtoField(DRAW_BACKBUFFER);
+
+      for (y=0; y < ysize; y++) for (x=0; x < xsize; x++)
+       DrawEnvelopeBackground(envelope_nr, startx, starty, x, y, xsize, ysize,
+                              font_nr);
+
+      redraw_mask |= REDRAW_FIELD | REDRAW_FROM_BACKBUFFER;
+      BackToFront();
+
+      WaitUntilDelayReached(&anim_delay, anim_delay_value / 2);
+    }
+  }
+
+  game.envelope_active = FALSE;
+
+  SetDrawtoField(DRAW_BUFFERED);
+
+  redraw_mask |= REDRAW_FIELD;
+  BackToFront();
+}
+
+#else
+
 void ShowEnvelope(int envelope_nr)
 {
   int element = EL_ENVELOPE_1 + envelope_nr;
@@ -1755,6 +1919,8 @@ void ShowEnvelope(int envelope_nr)
   BackToFront();
 }
 
+#endif
+
 void getMicroGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y)
 {
   Bitmap *src_bitmap = graphic_info[graphic].bitmap;
@@ -2352,7 +2518,7 @@ unsigned int MoveDoor(unsigned int door_state)
   static int door1 = DOOR_OPEN_1;
   static int door2 = DOOR_CLOSE_2;
   unsigned long door_delay = 0;
-  unsigned long door_delay_value = door_1.step_delay;
+  unsigned long door_delay_value;
   int stepsize = 1;
 
   if (door_state == DOOR_GET_STATE)
@@ -2377,6 +2543,9 @@ unsigned int MoveDoor(unsigned int door_state)
   else if (door2 == DOOR_CLOSE_2 && door_state & DOOR_CLOSE_2)
     door_state &= ~DOOR_CLOSE_2;
 
+  door_delay_value = (door_state & DOOR_ACTION_1 ? door_1.step_delay :
+                     door_2.step_delay);
+
   if (setup.quick_doors)
   {
     stepsize = 20;             /* must be choosen to always draw last frame */