rnd-19990213-1
authorHolger Schemel <info@artsoft.org>
Sat, 13 Feb 1999 21:42:52 +0000 (22:42 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:33:36 +0000 (10:33 +0200)
src/editor.c
src/events.c
src/game.c
src/init.c
src/main.c
src/main.h
src/tools.c

index ab28fe0cf4d002a8d4760c7243992b925f634650..b178476d195e7ebd05e7a537c5ac3bcc311bfc62 100644 (file)
@@ -661,20 +661,20 @@ int element_shift = 0;
 
 int editor_element[] =
 {
-  EL_CHAR_A + ('B' - 'A'),
-  EL_CHAR_A + ('O' - 'A'),
-  EL_CHAR_A + ('U' - 'A'),
-  EL_CHAR_A + ('L' - 'A'),
+  EL_CHAR('B'),
+  EL_CHAR('O'),
+  EL_CHAR('U'),
+  EL_CHAR('L'),
 
   EL_CHAR_MINUS,
-  EL_CHAR_A + ('D' - 'A'),
-  EL_CHAR_A + ('E' - 'A'),
-  EL_CHAR_A + ('R' - 'A'),
+  EL_CHAR('D'),
+  EL_CHAR('E'),
+  EL_CHAR('R'),
 
-  EL_CHAR_A + ('D' - 'A'),
-  EL_CHAR_A + ('A' - 'A'),
-  EL_CHAR_A + ('S' - 'A'),
-  EL_CHAR_A + ('H' - 'A'),
+  EL_CHAR('D'),
+  EL_CHAR('A'),
+  EL_CHAR('S'),
+  EL_CHAR('H'),
 
   EL_SPIELFIGUR,
   EL_LEERRAUM,
@@ -701,20 +701,20 @@ int editor_element[] =
   EL_FIREFLY_U,
   EL_LEERRAUM,
 
-  EL_CHAR_A + ('E' - 'A'),
-  EL_CHAR_A + ('M' - 'A'),
-  EL_CHAR_A + ('E' - 'A'),
+  EL_CHAR('E'),
+  EL_CHAR('M'),
+  EL_CHAR('E'),
   EL_CHAR_MINUS,
 
-  EL_CHAR_A + ('R' - 'A'),
-  EL_CHAR_A + ('A' - 'A'),
-  EL_CHAR_A + ('L' - 'A'),
-  EL_CHAR_A + ('D' - 'A'),
+  EL_CHAR('R'),
+  EL_CHAR('A'),
+  EL_CHAR('L'),
+  EL_CHAR('D'),
 
-  EL_CHAR_A + ('M' - 'A'),
-  EL_CHAR_A + ('I' - 'A'),
-  EL_CHAR_A + ('N' - 'A'),
-  EL_CHAR_A + ('E' - 'A'),
+  EL_CHAR('M'),
+  EL_CHAR('I'),
+  EL_CHAR('N'),
+  EL_CHAR('E'),
 
   EL_SPIELER1,
   EL_SPIELER2,
@@ -781,6 +781,21 @@ int editor_element[] =
   EL_SCHLUESSEL3,
   EL_SCHLUESSEL4,
 
+  EL_EM_GATE_1,
+  EL_EM_GATE_2,
+  EL_EM_GATE_3,
+  EL_EM_GATE_4,
+
+  EL_EM_GATE_1X,
+  EL_EM_GATE_2X,
+  EL_EM_GATE_3X,
+  EL_EM_GATE_4X,
+
+  EL_CHAR('M'),
+  EL_CHAR('O'),
+  EL_CHAR('R'),
+  EL_CHAR('E'),
+
   EL_PFORTE1,
   EL_PFORTE2,
   EL_PFORTE3,
@@ -791,11 +806,6 @@ int editor_element[] =
   EL_PFORTE3X,
   EL_PFORTE4X,
 
-  EL_CHAR_A + ('M' - 'A'),
-  EL_CHAR_A + ('O' - 'A'),
-  EL_CHAR_A + ('R' - 'A'),
-  EL_CHAR_A + ('E' - 'A'),
-
   EL_PFEIL_L,
   EL_PFEIL_R,
   EL_PFEIL_O,
@@ -846,15 +856,15 @@ int editor_element[] =
   EL_SPEED_PILL,
   EL_BLACK_ORB,
 
-  EL_CHAR_A + ('S' - 'A'),
-  EL_CHAR_A + ('O' - 'A'),
-  EL_CHAR_A + ('K' - 'A'),
-  EL_CHAR_A + ('O' - 'A'),
+  EL_CHAR('S'),
+  EL_CHAR('O'),
+  EL_CHAR('K'),
+  EL_CHAR('O'),
 
   EL_CHAR_MINUS,
-  EL_CHAR_A + ('B' - 'A'),
-  EL_CHAR_A + ('A' - 'A'),
-  EL_CHAR_A + ('N' - 'A'),
+  EL_CHAR('B'),
+  EL_CHAR('A'),
+  EL_CHAR('N'),
 
   EL_SOKOBAN_OBJEKT,
   EL_SOKOBAN_FELD_LEER,
@@ -927,20 +937,20 @@ int editor_element[] =
   EL_SP_CHIP_LOWER,
 
   /*
-  EL_CHAR_A + ('D' - 'A'),
-  EL_CHAR_A + ('Y' - 'A'),
-  EL_CHAR_A + ('N' - 'A'),
-  EL_CHAR_A + ('A' - 'A'),
+  EL_CHAR('D'),
+  EL_CHAR('Y'),
+  EL_CHAR('N'),
+  EL_CHAR('A'),
 
-  EL_CHAR_A + ('B' - 'A'),
-  EL_CHAR_A + ('L' - 'A'),
-  EL_CHAR_A + ('A' - 'A'),
-  EL_CHAR_A + ('S' - 'A'),
+  EL_CHAR('B'),
+  EL_CHAR('L'),
+  EL_CHAR('A'),
+  EL_CHAR('S'),
 
   EL_CHAR_MINUS,
-  EL_CHAR_A + ('T' - 'A'),
-  EL_CHAR_A + ('E' - 'A'),
-  EL_CHAR_A + ('R' - 'A'),
+  EL_CHAR('T'),
+  EL_CHAR('E'),
+  EL_CHAR('R'),
   */
 
   EL_LEERRAUM,
index a336f013d3a5ae35140ad8095734aa216e643a58..61d1fc8d4d7eb5665014877f794b5e4d1e7bb54d 100644 (file)
@@ -610,7 +610,7 @@ void HandleKey(KeySym key, int key_status)
          break;
 #endif
 
-#if 1
+#if 0
        case XK_m:
          if (MoveSpeed == 8)
          {
index 4b533ca4955d0f26491ac1a678c218fc1b1870bc..b233fa55c1ef299c7d1fe3976d5d91a94ddf784e 100644 (file)
@@ -372,6 +372,7 @@ void InitGame()
     player->move_delay = 0;
     player->last_move_dir = MV_NO_MOVING;
 
+    player->move_speed = (level.double_speed ? 4 : 8);
     player->snapped = FALSE;
 
     player->gone = FALSE;
@@ -406,8 +407,12 @@ void InitGame()
   ScreenMovPos = 0;
   ScreenGfxPos = 0;
 
+  /*
   MoveSpeed = (level.double_speed ? 4 : 8);
   ScrollStepSize = TILEX / MoveSpeed;
+  */
+
+  ScrollStepSize = 0;
 
   AllPlayersGone = FALSE;
   SiebAktiv = FALSE;
@@ -3362,8 +3367,14 @@ static void PlayerActions(struct PlayerInfo *player, byte player_action)
   {
     DigField(player, 0, 0, 0, 0, DF_NO_PUSH);
     SnapField(player, 0, 0);
+
+    /*
     if (++player->frame_reset_delay > MoveSpeed)
       player->Frame = 0;
+    */
+
+    if (++player->frame_reset_delay > player->move_speed)
+      player->Frame = 0;
   }
 
   if (tape.recording && num_stored_actions >= MAX_PLAYERS && save_tape_entry)
@@ -3520,7 +3531,11 @@ void GameActions()
       /* this is very bad and need to be fixed!!! */
       unsigned long move_delay = stored_player[i].move_delay;
 
+      /*
       if (FrameReached(&move_delay, MoveSpeed))
+      */
+
+      if (FrameReached(&move_delay, stored_player[i].move_speed))
       {
        actual_player_action = stored_player[i].programmed_action;
        stored_player[i].programmed_action = 0;
@@ -3865,7 +3880,12 @@ boolean MoveFigureOneStep(struct PlayerInfo *player,
   jy = player->jy = new_jy;
   StorePlayer[jx][jy] = player->element_nr;
 
+  /*
   player->MovPos = (dx > 0 || dy > 0 ? -1 : 1) * (TILEX - TILEX / MoveSpeed);
+  */
+
+  player->MovPos =
+    (dx > 0 || dy > 0 ? -1 : 1) * (TILEX - TILEX / player->move_speed);
 
   ScrollFigure(player, SCROLL_INIT);
 
@@ -3881,22 +3901,36 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy)
   if (player->gone || (!dx && !dy))
     return FALSE;
 
+  /*
   if (!FrameReached(&player->move_delay, MoveSpeed) && !tape.playing)
     return FALSE;
+  */
+
+  if (!FrameReached(&player->move_delay, player->move_speed) && !tape.playing)
+    return FALSE;
 
   if (player->MovPos)
   {
     /* should only happen if pre-1.2 tape recordings are played */
     /* this is only for backward compatibility */
 
+    /*
     int old_move_speed = MoveSpeed;
+    */
+
+    int old_move_speed = player->move_speed;
 
 #if DEBUG
     printf("THIS SHOULD ONLY HAPPEN WITH PRE-1.2 LEVEL TAPES.\n");
 #endif
 
     /* scroll remaining steps with finest movement resolution */
+
+    /*
     MoveSpeed = 8;
+    */
+
+    player->move_speed = 8;
 
     while (player->MovPos)
     {
@@ -3907,7 +3941,12 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy)
       BackToFront();
     }
 
+    /*
     MoveSpeed = old_move_speed;
+    */
+
+    player->move_speed = old_move_speed;
+
   }
 
   if (player->last_move_dir & (MV_LEFT | MV_RIGHT))
@@ -4024,6 +4063,7 @@ void ScrollFigure(struct PlayerInfo *player, int mode)
 {
   int jx = player->jx, jy = player->jy;
   int last_jx = player->last_jx, last_jy = player->last_jy;
+  int move_stepsize = TILEX / player->move_speed;
 
   if (!player->active || player->gone || !player->MovPos)
     return;
@@ -4031,7 +4071,7 @@ void ScrollFigure(struct PlayerInfo *player, int mode)
   if (mode == SCROLL_INIT)
   {
     player->actual_frame_counter = FrameCounter;
-    player->GfxPos = ScrollStepSize * (player->MovPos / ScrollStepSize);
+    player->GfxPos = move_stepsize * (player->MovPos / move_stepsize);
 
     if (Feld[last_jx][last_jy] == EL_LEERRAUM)
       Feld[last_jx][last_jy] = EL_PLAYER_IS_LEAVING;
@@ -4042,8 +4082,8 @@ void ScrollFigure(struct PlayerInfo *player, int mode)
   else if (!FrameReached(&player->actual_frame_counter, 1))
     return;
 
-  player->MovPos += (player->MovPos > 0 ? -1 : 1) * TILEX / MoveSpeed;
-  player->GfxPos = ScrollStepSize * (player->MovPos / ScrollStepSize);
+  player->MovPos += (player->MovPos > 0 ? -1 : 1) * move_stepsize;
+  player->GfxPos = move_stepsize * (player->MovPos / move_stepsize);
 
   if (Feld[last_jx][last_jy] == EL_PLAYER_IS_LEAVING)
     Feld[last_jx][last_jy] = EL_LEERRAUM;
@@ -4052,31 +4092,21 @@ void ScrollFigure(struct PlayerInfo *player, int mode)
 
   if (!player->MovPos)
   {
-    switch (Feld[last_jx][last_jy])
+    if (IS_QUICK_GATE(Feld[last_jx][last_jy]))
     {
-      case EL_SP_PORT1_LEFT:
-      case EL_SP_PORT2_LEFT:
-      case EL_SP_PORT1_RIGHT:
-      case EL_SP_PORT2_RIGHT:
-      case EL_SP_PORT1_UP:
-      case EL_SP_PORT2_UP:
-      case EL_SP_PORT1_DOWN:
-      case EL_SP_PORT2_DOWN:
-      case EL_SP_PORT_X:
-      case EL_SP_PORT_Y:
-      case EL_SP_PORT_XY:
-       /* continue with normal speed after moving through port */
-       /* FIX THIS: what about player already having eaten a speed pill? */
-       MoveSpeed = 8;
-       ScrollStepSize = TILEX / MoveSpeed;
-
-       /* don't wait for the next move -- the whole move delay stuff
-          is worse at the moment; FIX THIS! ;-) */
-       player->move_delay = 0;
-       break;
+      /* continue with normal speed after moving through port */
+      /* FIX THIS: what about player already having eaten a speed pill? */
 
-      default:
-       break;
+      /*
+      MoveSpeed = 8;
+      ScrollStepSize = TILEX / MoveSpeed;
+      */
+
+      player->move_speed = 8;
+
+      /* don't wait for the next move -- the whole move delay stuff
+        is worse at the moment; FIX THIS! ;-) */
+      player->move_delay = 0;
     }
 
     player->last_jx = jx;
@@ -4098,6 +4128,9 @@ void ScrollScreen(struct PlayerInfo *player, int mode)
 
   if (mode == SCROLL_INIT)
   {
+    /* set scrolling step size according to actual player's moving speed */
+    ScrollStepSize = TILEX / player->move_speed;
+
     screen_frame_counter = FrameCounter;
     ScreenMovDir = player->MovDir;
     ScreenMovPos = player->MovPos;
@@ -4109,7 +4142,7 @@ void ScrollScreen(struct PlayerInfo *player, int mode)
 
   if (ScreenMovPos)
   {
-    ScreenMovPos += (ScreenMovPos > 0 ? -1 : 1) * TILEX / MoveSpeed;
+    ScreenMovPos += (ScreenMovPos > 0 ? -1 : 1) * ScrollStepSize;
     ScreenGfxPos = ScrollStepSize * (ScreenMovPos / ScrollStepSize);
     redraw_mask |= REDRAW_FIELD;
   }
@@ -4327,6 +4360,10 @@ int DigField(struct PlayerInfo *player,
 {
   int jx = player->jx, jy = player->jy;
   int dx = x - jx, dy = y - jy;
+  int move_direction = (dx == -1 ? MV_LEFT :
+                       dx == +1 ? MV_RIGHT :
+                       dy == -1 ? MV_UP :
+                       dy == +1 ? MV_DOWN : MV_NO_MOVING);
   int element;
 
   if (!player->MovPos)
@@ -4383,8 +4420,14 @@ int DigField(struct PlayerInfo *player,
 
     case EL_SPEED_PILL:
       RemoveField(x, y);
+
+      player->move_speed = 4;
+
+      /*
       MoveSpeed = 4;
       ScrollStepSize = TILEX / MoveSpeed;
+      */
+
       PlaySoundLevel(x, y, SND_PONG);
       break;
 
@@ -4525,7 +4568,7 @@ int DigField(struct PlayerInfo *player,
     case EL_PFORTE2:
     case EL_PFORTE3:
     case EL_PFORTE4:
-      if (!player->key[element-EL_PFORTE1])
+      if (!player->key[element - EL_PFORTE1])
        return MF_NO_ACTION;
       break;
 
@@ -4533,8 +4576,40 @@ int DigField(struct PlayerInfo *player,
     case EL_PFORTE2X:
     case EL_PFORTE3X:
     case EL_PFORTE4X:
-      if (!player->key[element-EL_PFORTE1X])
+      if (!player->key[element - EL_PFORTE1X])
+       return MF_NO_ACTION;
+      break;
+
+    case EL_EM_GATE_1:
+    case EL_EM_GATE_2:
+    case EL_EM_GATE_3:
+    case EL_EM_GATE_4:
+      if (!player->key[element - EL_EM_GATE_1])
        return MF_NO_ACTION;
+
+      if (!IN_LEV_FIELD(x + dx, y + dy) || !IS_FREE(x + dx, y + dy))
+       return MF_NO_ACTION;
+
+      /* automatically move to the next field with double speed */
+      player->programmed_action = move_direction;
+      player->move_speed = 4;
+
+      break;
+
+    case EL_EM_GATE_1X:
+    case EL_EM_GATE_2X:
+    case EL_EM_GATE_3X:
+    case EL_EM_GATE_4X:
+      if (!player->key[element - EL_EM_GATE_1X])
+       return MF_NO_ACTION;
+
+      if (!IN_LEV_FIELD(x + dx, y + dy) || !IS_FREE(x + dx, y + dy))
+       return MF_NO_ACTION;
+
+      /* automatically move to the next field with double speed */
+      player->programmed_action = move_direction;
+      player->move_speed = 4;
+
       break;
 
     case EL_SP_PORT1_LEFT:
@@ -4572,14 +4647,15 @@ int DigField(struct PlayerInfo *player,
          !IS_FREE(x + dx, y + dy))
        return MF_NO_ACTION;
 
-      /* automatically move to field behind the port */
-      player->programmed_action = (dx == -1 ? MV_LEFT :
-                                  dx == +1 ? MV_RIGHT :
-                                  dy == -1 ? MV_UP :
-                                  dy == +1 ? MV_DOWN : MV_NO_MOVING);
-      /* move through port with double speed */
+      /* automatically move to the next field with double speed */
+      player->programmed_action = move_direction;
+      player->move_speed = 4;
+
+      /*
       MoveSpeed = 4;
       ScrollStepSize = TILEX / MoveSpeed;
+      */
+
       break;
 
     case EL_AUSGANG_ZU:
index 7c62ad953e0e56ee95b5c0b3ac99751220b38208..e8de30a3d8ca3aee7fa33550b76cabdfbcc9fa8c 100644 (file)
@@ -889,7 +889,15 @@ void InitElementProperties()
     EL_PFORTE1X,
     EL_PFORTE2X,
     EL_PFORTE3X,
-    EL_PFORTE4X
+    EL_PFORTE4X,
+    EL_EM_GATE_1,
+    EL_EM_GATE_2,
+    EL_EM_GATE_3,
+    EL_EM_GATE_4,
+    EL_EM_GATE_1X,
+    EL_EM_GATE_2X,
+    EL_EM_GATE_3X,
+    EL_EM_GATE_4X
   };
   static int ep_pforte_num = sizeof(ep_pforte)/sizeof(int);
 
@@ -966,6 +974,14 @@ void InitElementProperties()
     EL_PFORTE2X,
     EL_PFORTE3X,
     EL_PFORTE4X,
+    EL_EM_GATE_1,
+    EL_EM_GATE_2,
+    EL_EM_GATE_3,
+    EL_EM_GATE_4,
+    EL_EM_GATE_1X,
+    EL_EM_GATE_2X,
+    EL_EM_GATE_3X,
+    EL_EM_GATE_4X,
     EL_SP_HARD_GRAY,
     EL_SP_HARD_GREEN,
     EL_SP_HARD_BLUE,
@@ -1039,6 +1055,14 @@ void InitElementProperties()
     EL_PFORTE2X,
     EL_PFORTE3X,
     EL_PFORTE4X,
+    EL_EM_GATE_1,
+    EL_EM_GATE_2,
+    EL_EM_GATE_3,
+    EL_EM_GATE_4,
+    EL_EM_GATE_1X,
+    EL_EM_GATE_2X,
+    EL_EM_GATE_3X,
+    EL_EM_GATE_4X,
     EL_AUSGANG_ZU,
     EL_AUSGANG_ACT,
     EL_AUSGANG_AUF,
@@ -1302,6 +1326,14 @@ void InitElementProperties()
     EL_PFORTE2X,
     EL_PFORTE3X,
     EL_PFORTE4X,
+    EL_EM_GATE_1,
+    EL_EM_GATE_2,
+    EL_EM_GATE_3,
+    EL_EM_GATE_4,
+    EL_EM_GATE_1X,
+    EL_EM_GATE_2X,
+    EL_EM_GATE_3X,
+    EL_EM_GATE_4X,
     EL_DYNAMIT_AUS,
     EL_UNSICHTBAR,
     EL_BIRNE_AUS,
@@ -1487,6 +1519,46 @@ void InitElementProperties()
   };
   static int ep_sp_element_num = sizeof(ep_sp_element)/sizeof(int);
 
+  static int ep_quick_gate[] =
+  {
+    EL_EM_GATE_1,
+    EL_EM_GATE_2,
+    EL_EM_GATE_3,
+    EL_EM_GATE_4,
+    EL_EM_GATE_1X,
+    EL_EM_GATE_2X,
+    EL_EM_GATE_3X,
+    EL_EM_GATE_4X,
+    EL_SP_PORT1_LEFT,
+    EL_SP_PORT2_LEFT,
+    EL_SP_PORT1_RIGHT,
+    EL_SP_PORT2_RIGHT,
+    EL_SP_PORT1_UP,
+    EL_SP_PORT2_UP,
+    EL_SP_PORT1_DOWN,
+    EL_SP_PORT2_DOWN,
+    EL_SP_PORT_X,
+    EL_SP_PORT_Y,
+    EL_SP_PORT_XY
+  };
+  static int ep_quick_gate_num = sizeof(ep_quick_gate)/sizeof(int);
+
+  static int ep_over_player[] =
+  {
+    EL_SP_PORT1_LEFT,
+    EL_SP_PORT2_LEFT,
+    EL_SP_PORT1_RIGHT,
+    EL_SP_PORT2_RIGHT,
+    EL_SP_PORT1_UP,
+    EL_SP_PORT2_UP,
+    EL_SP_PORT1_DOWN,
+    EL_SP_PORT2_DOWN,
+    EL_SP_PORT_X,
+    EL_SP_PORT_Y,
+    EL_SP_PORT_XY
+  };
+  static int ep_over_player_num = sizeof(ep_over_player)/sizeof(int);
+
   static long ep_bit[] =
   {
     EP_BIT_AMOEBALIVE,
@@ -1516,7 +1588,9 @@ void InitElementProperties()
     EP_BIT_PLAYER,
     EP_BIT_HAS_CONTENT,
     EP_BIT_EATABLE,
-    EP_BIT_SP_ELEMENT
+    EP_BIT_SP_ELEMENT,
+    EP_BIT_QUICK_GATE,
+    EP_BIT_OVER_PLAYER
   };
   static int *ep_array[] =
   {
@@ -1547,7 +1621,9 @@ void InitElementProperties()
     ep_player,
     ep_has_content,
     ep_eatable,
-    ep_sp_element
+    ep_sp_element,
+    ep_quick_gate,
+    ep_over_player
   };
   static int *ep_num[] =
   {
@@ -1578,7 +1654,9 @@ void InitElementProperties()
     &ep_player_num,
     &ep_has_content_num,
     &ep_eatable_num,
-    &ep_sp_element_num
+    &ep_sp_element_num,
+    &ep_quick_gate_num,
+    &ep_over_player_num
   };
   static int num_properties = sizeof(ep_num)/sizeof(int *);
 
index 161f384350a2992c7ff72e6958ab6f1ed7e22588..225f204fe0d0c373b4e01ff8bc7d2a0990d02540 100644 (file)
@@ -86,13 +86,12 @@ unsigned long       Elementeigenschaften[MAX_ELEMENTS];
 int            level_nr, leveldir_nr, num_leveldirs;
 int            lev_fieldx,lev_fieldy, scroll_x,scroll_y;
 
-int            FX = SX, FY = SY, ScrollStepSize = TILEX/8;
+int            FX = SX, FY = SY, ScrollStepSize;
 int            ScreenMovDir = MV_NO_MOVING, ScreenMovPos = 0;
 int            ScreenGfxPos = 0;
 int            BorderElement = EL_BETON;
 int            GameFrameDelay = GAME_FRAME_DELAY;
 int            FfwdFrameDelay = FFWD_FRAME_DELAY;
-int            MoveSpeed = 8;
 int            BX1 = 0, BY1 = 0, BX2 = SCR_FIELDX-1, BY2 = SCR_FIELDY-1;
 int            SBX_Left, SBX_Right;
 int            SBY_Upper, SBY_Lower;
index b4c3834cfdee63584c79c422157e440f0754a5f3..7fd5813671c838c6ef56564ab03e8e94c79f767e 100644 (file)
@@ -124,6 +124,8 @@ typedef unsigned char byte;
 #define EP_BIT_HAS_CONTENT     (1 << 26)
 #define EP_BIT_EATABLE         (1 << 27)
 #define EP_BIT_SP_ELEMENT      (1 << 28)
+#define EP_BIT_QUICK_GATE      (1 << 29)
+#define EP_BIT_OVER_PLAYER     (1 << 30)
 
 #define IS_AMOEBALIVE(e)       (Elementeigenschaften[e] & EP_BIT_AMOEBALIVE)
 #define IS_AMOEBOID(e)         (Elementeigenschaften[e] & EP_BIT_AMOEBOID)
@@ -154,6 +156,8 @@ typedef unsigned char byte;
 #define HAS_CONTENT(e)         (Elementeigenschaften[e] & EP_BIT_HAS_CONTENT)
 #define IS_EATABLE(e)          (Elementeigenschaften[e] & EP_BIT_EATABLE)
 #define IS_SP_ELEMENT(e)       (Elementeigenschaften[e] & EP_BIT_SP_ELEMENT)
+#define IS_QUICK_GATE(e)       (Elementeigenschaften[e] & EP_BIT_QUICK_GATE)
+#define IS_OVER_PLAYER(e)      (Elementeigenschaften[e] & EP_BIT_OVER_PLAYER)
 
 #define IS_PLAYER(x,y)         (ELEM_IS_PLAYER(StorePlayer[x][y]))
 
@@ -317,6 +321,7 @@ struct PlayerInfo
   boolean gone, LevelSolved, GameOver;
   boolean snapped;
 
+  int move_speed;
   unsigned long move_delay;
   int last_move_dir;
 
@@ -450,7 +455,6 @@ extern int          ScreenMovDir, ScreenMovPos, ScreenGfxPos;
 extern int             BorderElement;
 extern int             GameFrameDelay;
 extern int             FfwdFrameDelay;
-extern int             MoveSpeed;
 extern int             BX1,BY1, BX2,BY2;
 extern int             SBX_Left, SBX_Right;
 extern int             SBY_Upper, SBY_Lower;
@@ -539,12 +543,12 @@ extern char               *element_info[];
 #define MICRO_GFX_PER_LINE     128
 #define HEROES_PER_LINE                16
 #define MINI_MORE_STARTX       0
-#define MINI_MORE_STARTY       224
+#define MINI_MORE_STARTY       352
 #define MICRO_MORE_STARTX      0
-#define MICRO_MORE_STARTY      336
+#define MICRO_MORE_STARTY      448
 #define MORE_PER_LINE          16
 #define MINI_MORE_PER_LINE     16
-#define MICRO_MORE_PER_LINE    16
+#define MICRO_MORE_PER_LINE    64
 #define FONT_CHARS_PER_LINE    16
 #define FONT_LINES_PER_FONT    4
 
@@ -730,10 +734,11 @@ extern char               *element_info[];
 #define EL_MAUER_Y             201
 #define EL_MAUER_XY            202
 
-#define EL_UNUSED_203          203
-#define EL_UNUSED_204          204
-#define EL_UNUSED_205          205
-#define EL_UNUSED_206          206
+#define EL_EM_GATE_1           203
+#define EL_EM_GATE_2           204
+#define EL_EM_GATE_3           205
+#define EL_EM_GATE_4           206
+
 #define EL_UNUSED_207          207
 #define EL_UNUSED_208          208
 #define EL_UNUSED_209          209
@@ -781,10 +786,11 @@ extern char               *element_info[];
 #define EL_SP_CHIP_LOWER       (EL_SP_START + 39)
 #define EL_SP_END              (EL_SP_START + 39)
 
-#define EL_UNUSED_250          250
-#define EL_UNUSED_251          251
-#define EL_UNUSED_252          252
-#define EL_UNUSED_253          253
+#define EL_EM_GATE_1X          250
+#define EL_EM_GATE_2X          251
+#define EL_EM_GATE_3X          252
+#define EL_EM_GATE_4X          253
+
 #define EL_UNUSED_254          254
 #define EL_UNUSED_255          255
 
@@ -1109,6 +1115,19 @@ extern char              *element_info[];
 #define GFX_UNSICHTBAR         (GFX_START_ROCKSMORE +  5 * MORE_PER_LINE +  7)
 #define GFX_SP_ZONK            (GFX_START_ROCKSMORE +  6 * MORE_PER_LINE +  0)
 
+#define GFX_EM_KEY_1           (GFX_START_ROCKSMORE +  6 * MORE_PER_LINE +  4)
+#define GFX_EM_KEY_2           (GFX_START_ROCKSMORE +  6 * MORE_PER_LINE +  5)
+#define GFX_EM_KEY_3           (GFX_START_ROCKSMORE +  6 * MORE_PER_LINE +  6)
+#define GFX_EM_KEY_4           (GFX_START_ROCKSMORE +  6 * MORE_PER_LINE +  7)
+#define GFX_EM_GATE_1          (GFX_START_ROCKSMORE +  7 * MORE_PER_LINE +  0)
+#define GFX_EM_GATE_2          (GFX_START_ROCKSMORE +  7 * MORE_PER_LINE +  1)
+#define GFX_EM_GATE_3          (GFX_START_ROCKSMORE +  7 * MORE_PER_LINE +  2)
+#define GFX_EM_GATE_4          (GFX_START_ROCKSMORE +  7 * MORE_PER_LINE +  3)
+#define GFX_EM_GATE_1X         (GFX_START_ROCKSMORE +  7 * MORE_PER_LINE +  4)
+#define GFX_EM_GATE_2X         (GFX_START_ROCKSMORE +  7 * MORE_PER_LINE +  5)
+#define GFX_EM_GATE_3X         (GFX_START_ROCKSMORE +  7 * MORE_PER_LINE +  6)
+#define GFX_EM_GATE_4X         (GFX_START_ROCKSMORE +  7 * MORE_PER_LINE +  7)
+
 #define GFX_MURPHY_GO_LEFT     (GFX_START_ROCKSMORE +  0 * MORE_PER_LINE +  8)
 #define GFX_MURPHY_ANY_LEFT    (GFX_START_ROCKSMORE +  0 * MORE_PER_LINE +  9)
 #define GFX_MURPHY_GO_RIGHT    (GFX_START_ROCKSMORE +  0 * MORE_PER_LINE + 11)
index 56f7de4b48eb3ec2738eedefd7fd5b88d9fa0151..fba56ac5b1d331e7161e032f837d7e75db9c9413 100644 (file)
@@ -456,8 +456,9 @@ void DrawPlayer(struct PlayerInfo *player)
   int next_jx = jx + (jx - last_jx), next_jy = jy + (jy - last_jy);
   int sx = SCREENX(jx), sy = SCREENY(jy);
   int sxx = 0, syy = 0;
-  int element = Feld[jx][jy];
+  int element = Feld[jx][jy], last_element = Feld[last_jx][last_jy];
   int graphic, phase;
+  boolean player_is_moving = (last_jx != jx || last_jy != jy ? TRUE : FALSE);
 
   if (!player->active || player->gone ||
       !IN_SCR_FIELD(SCREENX(last_jx), SCREENY(last_jy)))
@@ -478,14 +479,18 @@ void DrawPlayer(struct PlayerInfo *player)
 
   /* draw things in the field the player is leaving, if needed */
 
+  /*
   if (last_jx != jx || last_jy != jy)
+  */
+
+  if (player_is_moving)
   {
-    if (Store[last_jx][last_jy] && IS_DRAWABLE(Feld[last_jx][last_jy]))
+    if (Store[last_jx][last_jy] && IS_DRAWABLE(last_element))
     {
       DrawLevelElement(last_jx, last_jy, Store[last_jx][last_jy]);
       DrawLevelFieldThruMask(last_jx, last_jy);
     }
-    else if (Feld[last_jx][last_jy] == EL_DYNAMIT)
+    else if (last_element == EL_DYNAMIT)
       DrawDynamite(last_jx, last_jy);
     else
       DrawLevelField(last_jx, last_jy);
@@ -523,8 +528,9 @@ void DrawPlayer(struct PlayerInfo *player)
   {
     static int last_dir = MV_LEFT;
     boolean action_moving =
-      ((player->action & (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)) &&
-       !(player->action & ~(MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)));
+      (player_is_moving ||
+       ((player->action & (MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN)) &&
+       !(player->action & ~(MV_LEFT | MV_RIGHT | MV_UP | MV_DOWN))));
 
     graphic = GFX_SP_MURPHY;
 
@@ -601,7 +607,7 @@ void DrawPlayer(struct PlayerInfo *player)
   {
     int px = SCREENX(next_jx), py = SCREENY(next_jy);
 
-    if (Feld[jx][jy] == EL_SOKOBAN_FELD_LEER ||
+    if (element == EL_SOKOBAN_FELD_LEER ||
        Feld[next_jx][next_jy] == EL_SOKOBAN_FELD_VOLL)
       DrawGraphicShiftedThruMask(px, py, sxx, syy, GFX_SOKOBAN_OBJEKT,
                                 NO_CUTTING);
@@ -624,7 +630,7 @@ void DrawPlayer(struct PlayerInfo *player)
     }
   }
 
-  /* draw things in front of player (EL_DYNAMIT || EL_DYNABOMB) */
+  /* draw things in front of player (EL_DYNAMIT or EL_DYNABOMB) */
 
   if (element == EL_DYNAMIT || element == EL_DYNABOMB)
   {
@@ -647,8 +653,11 @@ void DrawPlayer(struct PlayerInfo *player)
       DrawGraphicThruMask(sx, sy, graphic + phase);
   }
 
-  if ((last_jx != jx || last_jy != jy) &&
-      Feld[last_jx][last_jy] == EL_EXPLODING)
+  /*
+  if ((last_jx != jx || last_jy != jy) && last_element == EL_EXPLODING)
+  */
+
+  if (player_is_moving && last_element == EL_EXPLODING)
   {
     int phase = Frame[last_jx][last_jy];
     int delay = 2;
@@ -658,6 +667,14 @@ void DrawPlayer(struct PlayerInfo *player)
                          GFX_EXPLOSION + ((phase - 1) / delay - 1));
   }
 
+  /* draw elements that stay over the player */
+  /* handle the field the player is leaving ... */
+  if (player_is_moving && IS_OVER_PLAYER(last_element))
+    DrawLevelField(last_jx, last_jy);
+  /* ... and the field the player is entering */
+  if (IS_OVER_PLAYER(element))
+    DrawLevelField(jx, jy);
+
   if (setup.direct_draw)
   {
     int dest_x = SX + SCREENX(MIN(jx, last_jx)) * TILEX;
@@ -936,6 +953,7 @@ void getMiniGraphicSource(int graphic, Pixmap *pixmap, int *x, int *y)
   else if (graphic >= GFX_START_ROCKSMORE && graphic <= GFX_END_ROCKSMORE)
   {
     graphic -= GFX_START_ROCKSMORE;
+    graphic -= ((graphic / MORE_PER_LINE) * MORE_PER_LINE) / 2;
     *pixmap = pix[PIX_MORE];
     *x = MINI_MORE_STARTX + (graphic % MINI_MORE_PER_LINE) * MINI_TILEX;
     *y = MINI_MORE_STARTY + (graphic / MINI_MORE_PER_LINE) * MINI_TILEY;
@@ -1622,6 +1640,7 @@ void DrawMicroElement(int xpos, int ypos, int element)
   if (graphic >= GFX_START_ROCKSMORE && graphic <= GFX_END_ROCKSMORE)
   {
     graphic -= GFX_START_ROCKSMORE;
+    graphic -= ((graphic / MORE_PER_LINE) * MORE_PER_LINE) / 2;
     XCopyArea(display, pix[PIX_MORE], drawto, gc,
              MICRO_MORE_STARTX + (graphic % MICRO_MORE_PER_LINE) *MICRO_TILEX,
              MICRO_MORE_STARTY + (graphic / MICRO_MORE_PER_LINE) *MICRO_TILEY,
@@ -2730,6 +2749,14 @@ int el2gfx(int element)
       /* ^^^^^^^^^^ non-standard position in supaplex graphic set! */
     case EL_INVISIBLE_STEEL:   return GFX_INVISIBLE_STEEL;
     case EL_BLACK_ORB:         return GFX_BLACK_ORB;
+    case EL_EM_GATE_1:         return GFX_EM_GATE_1;
+    case EL_EM_GATE_2:         return GFX_EM_GATE_2;
+    case EL_EM_GATE_3:         return GFX_EM_GATE_3;
+    case EL_EM_GATE_4:         return GFX_EM_GATE_4;
+    case EL_EM_GATE_1X:                return GFX_EM_GATE_1X;
+    case EL_EM_GATE_2X:                return GFX_EM_GATE_2X;
+    case EL_EM_GATE_3X:                return GFX_EM_GATE_3X;
+    case EL_EM_GATE_4X:                return GFX_EM_GATE_4X;
 
     default:
     {