rnd-20031109-2-src
authorHolger Schemel <info@artsoft.org>
Sun, 9 Nov 2003 18:02:37 +0000 (19:02 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:44:29 +0000 (10:44 +0200)
* fixed reset of player animation frame when, for example,
  walking, digging or collecting share the same animation

ChangeLog
Makefile
src/conftime.h
src/game.c
src/tools.c

index 088f29306d9b310c884268a4044d72be90dc253b..aeaa2263eb24ea11a11d7cd3ab3d26a6290168d4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2003-11-09
+       * fixed reset of player animation frame when, for example,
+         walking, digging or collecting share the same animation
+
 2003-11-08
        * fixed tape recording when player is created from CE element change
 
index e981e70506d99f91646b174f917d954e1124a720..0c0c57f4b21fb887b3efdddc107a18ddf9ae26ef 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -108,6 +108,9 @@ valgrind:
 enginetest:
        ./Scripts/make_enginetest.sh
 
+enginetestcustom:
+       ./Scripts/make_enginetest.sh custom
+
 enginetestfast:
        ./Scripts/make_enginetest.sh fast
 
index 412582041c593633f77ceb45029690da950e9b51..14db736635daa92b656bd396ffe7c2d09836c86f 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2003-11-09 01:50]"
+#define COMPILE_DATE_STRING "[2003-11-09 18:37]"
index cfb239c97717b8c1f120ee7153eaf2240b04bc8a..71013bf598ebd1a491c8cc3a52f2311f0db2fdbe 100644 (file)
@@ -4657,7 +4657,9 @@ void ContinueMoving(int x, int y)
   {
     TestIfBadThingTouchesHero(newx, newy);
     TestIfBadThingTouchesFriend(newx, newy);
-    TestIfBadThingTouchesOtherBadThing(newx, newy);
+
+    if (!IS_CUSTOM_ELEMENT(element))
+      TestIfBadThingTouchesOtherBadThing(newx, newy);
   }
   else if (element == EL_PENGUIN)
     TestIfFriendTouchesBadThing(newx, newy);
index b66404ab0e7409a01d88279564cc3bb6ddec85c5..fbb3079302ec7e5a67aa8b7986827f3596112b00 100644 (file)
@@ -529,6 +529,30 @@ void DrawLevelElementAnimationIfNeeded(int x, int y, int element)
     DrawLevelFieldCrumbledSand(x, y);
 }
 
+static int getPlayerGraphic(struct PlayerInfo *player, int move_dir)
+{
+  if (player->use_murphy_graphic)
+  {
+    /* this works only because currently only one player can be "murphy" ... */
+    static int last_horizontal_dir = MV_LEFT;
+    int graphic = el_act_dir2img(EL_SP_MURPHY, player->GfxAction, move_dir);
+
+    if (move_dir == MV_LEFT || move_dir == MV_RIGHT)
+      last_horizontal_dir = move_dir;
+
+    if (graphic == IMG_SP_MURPHY)      /* undefined => use special graphic */
+    {
+      int direction = (player->is_snapping ? move_dir : last_horizontal_dir);
+
+      graphic = el_act_dir2img(EL_SP_MURPHY, player->GfxAction, direction);
+    }
+
+    return graphic;
+  }
+  else
+    return el_act_dir2img(player->element_nr, player->GfxAction, move_dir);
+}
+
 void DrawAllPlayers()
 {
   int i;
@@ -571,6 +595,8 @@ void DrawPlayer(struct PlayerInfo *player)
   int element = Feld[jx][jy], last_element = Feld[last_jx][last_jy];
   int graphic;
   int action = ACTION_DEFAULT;
+  int last_player_graphic = getPlayerGraphic(player, move_dir);
+  int last_player_frame = player->Frame;
   int frame = 0;
 
   if (!player->active || !IN_SCR_FIELD(SCREENX(last_jx), SCREENY(last_jy)))
@@ -672,6 +698,18 @@ void DrawPlayer(struct PlayerInfo *player)
   /* draw player himself                                                     */
   /* ----------------------------------------------------------------------- */
 
+#if 1
+
+  graphic = getPlayerGraphic(player, move_dir);
+
+  /* in the case of changed player action or direction, prevent the current
+     animation frame from being restarted for identical animations */
+  if (player->Frame == 0 &&
+      graphic_info[graphic].bitmap == graphic_info[last_player_graphic].bitmap)
+    player->Frame = last_player_frame;
+
+#else
+
   if (player->use_murphy_graphic)
   {
     static int last_horizontal_dir = MV_LEFT;
@@ -691,6 +729,8 @@ void DrawPlayer(struct PlayerInfo *player)
   else
     graphic = el_act_dir2img(player->element_nr, player->GfxAction, move_dir);
 
+#endif
+
   frame = getGraphicAnimationFrame(graphic, player->Frame);
 
   if (player->GfxPos)