rnd-20030306-3-src
authorHolger Schemel <info@artsoft.org>
Thu, 6 Mar 2003 22:19:12 +0000 (23:19 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:40:40 +0000 (10:40 +0200)
src/conftime.h
src/game.c
src/game.h
src/main.h
src/tools.c

index 9f7db38de9eea0274df35d9dd6300952f7e7a59e..df5c19f54495981a1840463b1cd637843032d587 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2003-03-06 01:59]"
+#define COMPILE_DATE_STRING "[2003-03-06 23:15]"
index fb21d6f62cafab430c342d9c7f88b9ee7473a34f..9dca25854cf41ca1b13b79267f3d8323b54acaf4 100644 (file)
@@ -643,9 +643,10 @@ void InitGame()
     player->Pushing = FALSE;
     player->Switching = FALSE;
     player->GfxPos = 0;
     player->Pushing = FALSE;
     player->Switching = FALSE;
     player->GfxPos = 0;
-    player->Frame = 0;
-
+    player->GfxDir = MV_NO_MOVING;
     player->GfxAction = ACTION_DEFAULT;
     player->GfxAction = ACTION_DEFAULT;
+    player->Frame = 0;
+    player->StepFrame = 0;
 
     player->use_murphy_graphic = FALSE;
     player->use_disk_red_graphic = FALSE;
 
     player->use_murphy_graphic = FALSE;
     player->use_disk_red_graphic = FALSE;
@@ -1261,12 +1262,19 @@ int NewHiScore()
   return position;
 }
 
   return position;
 }
 
-static void InitPlayerGfxAnimation(struct PlayerInfo *player, int action)
+void InitPlayerGfxAnimation(struct PlayerInfo *player, int action, int dir)
 {
 {
-  if (player->GfxAction != action)
+  if (player->GfxAction != action || player->GfxDir != dir)
   {
   {
+#if 0
+    printf("Player frame reset! (%d => %d, %d => %d)\n",
+          player->GfxAction, action, player->GfxDir, dir);
+#endif
+
     player->GfxAction = action;
     player->GfxAction = action;
+    player->GfxDir = dir;
     player->Frame = 0;
     player->Frame = 0;
+    player->StepFrame = 0;
   }
 }
 
   }
 }
 
@@ -4465,7 +4473,13 @@ static void PlayerActions(struct PlayerInfo *player, byte player_action)
     CheckGravityMovement(player);
 
     if (player->MovPos == 0)
     CheckGravityMovement(player);
 
     if (player->MovPos == 0)
-      InitPlayerGfxAnimation(player, ACTION_DEFAULT);
+    {
+#if 0
+      printf("Trying... Player frame reset\n");
+#endif
+
+      InitPlayerGfxAnimation(player, ACTION_DEFAULT, player->MovDir);
+    }
 
     if (player->MovPos == 0)   /* needed for tape.playing */
       player->is_moving = FALSE;
 
     if (player->MovPos == 0)   /* needed for tape.playing */
       player->is_moving = FALSE;
@@ -4898,12 +4912,31 @@ void GameActions()
     redraw_mask |= REDRAW_FPS;
   }
 
     redraw_mask |= REDRAW_FPS;
   }
 
+#if 0
+  if (stored_player[0].jx != stored_player[0].last_jx ||
+      stored_player[0].jy != stored_player[0].last_jy)
+    printf("::: %d, %d, %d, %d, %d\n",
+          stored_player[0].MovDir,
+          stored_player[0].MovPos,
+          stored_player[0].GfxPos,
+          stored_player[0].Frame,
+          stored_player[0].StepFrame);
+#endif
+
 #if 1
   FrameCounter++;
   TimeFrames++;
 
   for (i=0; i<MAX_PLAYERS; i++)
 #if 1
   FrameCounter++;
   TimeFrames++;
 
   for (i=0; i<MAX_PLAYERS; i++)
-    stored_player[i].Frame++;
+  {
+    int move_frames =
+      MOVE_DELAY_NORMAL_SPEED /  stored_player[i].move_delay_value;
+
+    stored_player[i].Frame += move_frames;
+
+    if (stored_player[i].MovPos != 0)
+      stored_player[i].StepFrame += move_frames;
+  }
 #endif
 }
 
 #endif
 }
 
@@ -5200,7 +5233,7 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy)
     }
   }
 
     }
   }
 
-#if 1
+#if 0
 #if 1
   InitPlayerGfxAnimation(player, ACTION_DEFAULT);
 #else
 #if 1
   InitPlayerGfxAnimation(player, ACTION_DEFAULT);
 #else
@@ -5209,6 +5242,8 @@ boolean MoveFigure(struct PlayerInfo *player, int dx, int dy)
 #endif
 #endif
 
 #endif
 #endif
 
+  player->StepFrame = 0;
+
   if (moved & MF_MOVING)
   {
     if (old_jx != jx && old_jy == jy)
   if (moved & MF_MOVING)
   {
     if (old_jx != jx && old_jy == jy)
@@ -5628,7 +5663,8 @@ int DigField(struct PlayerInfo *player,
                        dy == +1 ? MV_DOWN : MV_NO_MOVING);
   int element;
 
                        dy == +1 ? MV_DOWN : MV_NO_MOVING);
   int element;
 
-  player->is_digging = FALSE;
+  if (player->MovPos == 0)
+    player->is_digging = FALSE;
 
   if (player->MovPos == 0)
     player->Pushing = FALSE;
 
   if (player->MovPos == 0)
     player->Pushing = FALSE;
@@ -6355,7 +6391,10 @@ boolean SnapField(struct PlayerInfo *player, int dx, int dy)
       player->Pushing = FALSE;
 
     player->snapped = FALSE;
       player->Pushing = FALSE;
 
     player->snapped = FALSE;
-    player->is_digging = FALSE;
+
+    if (player->MovPos == 0)
+      player->is_digging = FALSE;
+
     return FALSE;
   }
 
     return FALSE;
   }
 
index dfc4312fb59ef6144241219b4489f824bf89c58d..ffacbdddc1e96d1c0165d57fe892a7757a6d2395 100644 (file)
@@ -37,6 +37,8 @@ void InitMovDir(int, int);
 void InitAmoebaNr(int, int);
 void GameWon(void);
 int NewHiScore(void);
 void InitAmoebaNr(int, int);
 void GameWon(void);
 int NewHiScore(void);
+
+void InitPlayerGfxAnimation(struct PlayerInfo *, int, int);
 void InitMovingField(int, int, int);
 void Moving2Blocked(int, int, int *, int *);
 void Blocked2Moving(int, int, int *, int *);
 void InitMovingField(int, int, int);
 void Moving2Blocked(int, int, int *, int *);
 void Blocked2Moving(int, int, int *, int *);
index 326f63be64e463001fb58f88fb5d0bfae7440429..aa5926f5fb30692019f36f80216559a3c7f80ff6 100644 (file)
@@ -920,8 +920,8 @@ struct PlayerInfo
                                   through doors); overrides other actions */
 
   int jx,jy, last_jx,last_jy;
                                   through doors); overrides other actions */
 
   int jx,jy, last_jx,last_jy;
-  int MovDir, MovPos, GfxPos;
-  int Frame;
+  int MovDir, MovPos, GfxDir, GfxPos;
+  int Frame, StepFrame;
 
   int GfxAction;
 
 
   int GfxAction;
 
index 4226eec9824ac3ac2fa454b577463eb624003d00..979eead935e254fe9a62febb76a90bb2a6290194 100644 (file)
@@ -542,6 +542,7 @@ void DrawPlayer(struct PlayerInfo *player)
   int graphic;
   int frame = 0;
   boolean player_is_moving = (last_jx != jx || last_jy != jy ? TRUE : FALSE);
   int graphic;
   int frame = 0;
   boolean player_is_moving = (last_jx != jx || last_jy != jy ? TRUE : FALSE);
+  int current_action = ACTION_DEFAULT;
 
   if (!player->active || !IN_SCR_FIELD(SCREENX(last_jx), SCREENY(last_jy)))
     return;
 
   if (!player->active || !IN_SCR_FIELD(SCREENX(last_jx), SCREENY(last_jy)))
     return;
@@ -559,6 +560,13 @@ void DrawPlayer(struct PlayerInfo *player)
   if (element == EL_EXPLOSION)
     return;
 
   if (element == EL_EXPLOSION)
     return;
 
+  current_action = (player->Pushing ? ACTION_PUSHING :
+                   player->is_digging ? ACTION_DIGGING :
+                   player->is_moving ? ACTION_MOVING :
+                   player->snapped ? ACTION_SNAPPING : ACTION_DEFAULT);
+
+  InitPlayerGfxAnimation(player, current_action, player->MovDir);
+
   /* ----------------------------------------------------------------------- */
   /* draw things in the field the player is leaving, if needed               */
   /* ----------------------------------------------------------------------- */
   /* ----------------------------------------------------------------------- */
   /* draw things in the field the player is leaving, if needed               */
   /* ----------------------------------------------------------------------- */
@@ -616,7 +624,8 @@ void DrawPlayer(struct PlayerInfo *player)
       int old_element = GfxElement[jx][jy];
       int old_graphic =
        el_act_dir2img(old_element, ACTION_DIGGING, player->MovDir);
       int old_element = GfxElement[jx][jy];
       int old_graphic =
        el_act_dir2img(old_element, ACTION_DIGGING, player->MovDir);
-      int frame = getGraphicAnimationFrame(old_graphic, player->Frame);
+      int frame = getGraphicAnimationFrame(old_graphic, player->StepFrame);
+
 #if 0
       Bitmap *src_bitmap;
       int src_x, src_y;
 #if 0
       Bitmap *src_bitmap;
       int src_x, src_y;
@@ -650,10 +659,10 @@ void DrawPlayer(struct PlayerInfo *player)
                 width, height, FX + sx * TILEX + cx, FY + sy * TILEY + cy);
 #else
 #if 0
                 width, height, FX + sx * TILEX + cx, FY + sy * TILEY + cy);
 #else
 #if 0
-      printf("::: %d, %d, %d, %d => %d, %d [%d]\n",
+      printf("::: %d, %d, %d, %d => %d, %d [%d, %d, %d]\n",
             old_element, ACTION_DIGGING, player->MovDir, player->Frame,
             old_graphic, frame,
             old_element, ACTION_DIGGING, player->MovDir, player->Frame,
             old_graphic, frame,
-            player->GfxPos);
+            player->MovPos, player->GfxPos, player->StepFrame);
 #endif
 
       DrawGraphic(sx, sy, old_graphic, frame);
 #endif
 
       DrawGraphic(sx, sy, old_graphic, frame);
@@ -671,11 +680,6 @@ void DrawPlayer(struct PlayerInfo *player)
   /* draw player himself                                                     */
   /* ----------------------------------------------------------------------- */
 
   /* draw player himself                                                     */
   /* ----------------------------------------------------------------------- */
 
-  player->GfxAction = (player->Pushing ? ACTION_PUSHING :
-                      player->is_digging ? ACTION_DIGGING :
-                      player->is_moving ? ACTION_MOVING :
-                      player->snapped ? ACTION_SNAPPING : ACTION_DEFAULT);
-
   if (player->use_murphy_graphic)
   {
     static int last_horizontal_dir = MV_LEFT;
   if (player->use_murphy_graphic)
   {
     static int last_horizontal_dir = MV_LEFT;