rnd-20020930-2-src
authorHolger Schemel <info@artsoft.org>
Mon, 30 Sep 2002 21:38:09 +0000 (23:38 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:38:45 +0000 (10:38 +0200)
src/cartoons.c
src/conftime.h
src/game.c
src/init.c
src/libgame/toons.c
src/libgame/toons.h
src/main.c
src/main.h
src/tools.c
src/tools.h

index 100ad150969411a4e2a85c29662a8429bf08a57c..fde4e0ca08fef0e879edee0b31b0772d536ce901 100644 (file)
@@ -67,7 +67,7 @@ struct ToonInfo toons[NUM_TOONS] =
     DWARF_FRAMES,
     DWARF_FPS,
     DWARF_STEPSIZE,
-    ANIM_NORMAL,
+    ANIM_LOOP,
     ANIMDIR_RIGHT,
     ANIMPOS_DOWN
   },
@@ -78,7 +78,7 @@ struct ToonInfo toons[NUM_TOONS] =
     DWARF_FRAMES,
     DWARF_FPS,
     DWARF_STEPSIZE,
-    ANIM_NORMAL,
+    ANIM_LOOP,
     ANIMDIR_LEFT,
     ANIMPOS_DOWN
   },
@@ -89,7 +89,7 @@ struct ToonInfo toons[NUM_TOONS] =
     JUMPER_FRAMES,
     JUMPER_FPS,
     JUMPER_STEPSIZE,
-    ANIM_NORMAL,
+    ANIM_LOOP,
     ANIMDIR_RIGHT,
     ANIMPOS_DOWN
   },
@@ -100,7 +100,7 @@ struct ToonInfo toons[NUM_TOONS] =
     CLOWN_FRAMES,
     CLOWN_FPS,
     CLOWN_STEPSIZE,
-    ANIM_NORMAL,
+    ANIM_LOOP,
     ANIMDIR_UP,
     ANIMPOS_ANY
   },
@@ -134,7 +134,7 @@ struct ToonInfo toons[NUM_TOONS] =
     GAMETOON_FRAMES_4,
     GAMETOON_FPS,
     GAMETOON_STEPSIZE,
-    ANIM_NORMAL,
+    ANIM_LOOP,
     ANIMDIR_LEFT,
     ANIMPOS_DOWN
   },
@@ -146,7 +146,7 @@ struct ToonInfo toons[NUM_TOONS] =
     GAMETOON_FRAMES_4,
     GAMETOON_FPS,
     GAMETOON_STEPSIZE,
-    ANIM_NORMAL,
+    ANIM_LOOP,
     ANIMDIR_RIGHT,
     ANIMPOS_DOWN
   },
@@ -158,7 +158,7 @@ struct ToonInfo toons[NUM_TOONS] =
     GAMETOON_FRAMES_4,
     GAMETOON_FPS,
     GAMETOON_STEPSIZE,
-    ANIM_NORMAL,
+    ANIM_LOOP,
     ANIMDIR_LEFT,
     ANIMPOS_DOWN
   },
@@ -170,7 +170,7 @@ struct ToonInfo toons[NUM_TOONS] =
     GAMETOON_FRAMES_4,
     GAMETOON_FPS,
     GAMETOON_STEPSIZE,
-    ANIM_NORMAL,
+    ANIM_LOOP,
     ANIMDIR_RIGHT,
     ANIMPOS_DOWN
   },
@@ -182,7 +182,7 @@ struct ToonInfo toons[NUM_TOONS] =
     GAMETOON_FRAMES_4,
     GAMETOON_FPS,
     GAMETOON_STEPSIZE,
-    ANIM_NORMAL,
+    ANIM_LOOP,
     ANIMDIR_LEFT,
     ANIMPOS_DOWN
   },
@@ -194,7 +194,7 @@ struct ToonInfo toons[NUM_TOONS] =
     GAMETOON_FRAMES_4,
     GAMETOON_FPS,
     GAMETOON_STEPSIZE,
-    ANIM_NORMAL,
+    ANIM_LOOP,
     ANIMDIR_RIGHT,
     ANIMPOS_DOWN
   },
@@ -206,7 +206,7 @@ struct ToonInfo toons[NUM_TOONS] =
     GAMETOON_FRAMES_4,
     GAMETOON_FPS,
     GAMETOON_STEPSIZE,
-    ANIM_NORMAL,
+    ANIM_LOOP,
     ANIMDIR_LEFT,
     ANIMPOS_DOWN
   },
@@ -218,7 +218,7 @@ struct ToonInfo toons[NUM_TOONS] =
     GAMETOON_FRAMES_4,
     GAMETOON_FPS,
     GAMETOON_STEPSIZE,
-    ANIM_NORMAL,
+    ANIM_LOOP,
     ANIMDIR_RIGHT,
     ANIMPOS_DOWN
   },
@@ -230,7 +230,7 @@ struct ToonInfo toons[NUM_TOONS] =
     GAMETOON_FRAMES_4,
     GAMETOON_FPS,
     GAMETOON_STEPSIZE,
-    ANIM_NORMAL,
+    ANIM_LOOP,
     ANIMDIR_LEFT,
     ANIMPOS_DOWN
   },
@@ -242,7 +242,7 @@ struct ToonInfo toons[NUM_TOONS] =
     GAMETOON_FRAMES_4,
     GAMETOON_FPS,
     GAMETOON_STEPSIZE,
-    ANIM_NORMAL,
+    ANIM_LOOP,
     ANIMDIR_RIGHT,
     ANIMPOS_DOWN
   },
@@ -254,7 +254,7 @@ struct ToonInfo toons[NUM_TOONS] =
     GAMETOON_FRAMES_8,
     GAMETOON_FPS,
     GAMETOON_STEPSIZE,
-    ANIM_NORMAL,
+    ANIM_LOOP,
     ANIMDIR_LEFT,
     ANIMPOS_ANY
   },
@@ -266,7 +266,7 @@ struct ToonInfo toons[NUM_TOONS] =
     GAMETOON_FRAMES_8,
     GAMETOON_FPS,
     GAMETOON_STEPSIZE,
-    ANIM_NORMAL,
+    ANIM_LOOP,
     ANIMDIR_RIGHT,
     ANIMPOS_ANY
   },
index 73dcedfd9c415604a756f579bab06a19bd034a8a..36a50855fae9fee35a1580ece71879ecb87752cc 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2002-09-30 00:24]"
+#define COMPILE_DATE_STRING "[2002-09-30 23:37]"
index 5dd55c76ffa8391c9c2acb1af3ec3b542da531b9..56cb38b2a363d17f719130ff276301cc5b8ef44f 100644 (file)
@@ -795,6 +795,7 @@ void InitGame()
       MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0;
       Store[x][y] = Store2[x][y] = StorePlayer[x][y] = 0;
       Frame[x][y] = 0;
+      GfxAction[x][y] = GFX_ACTION_DEFAULT;
       AmoebaNr[x][y] = 0;
       JustStopped[x][y] = 0;
       Stop[x][y] = FALSE;
@@ -1213,7 +1214,7 @@ void GameWon()
 #endif
 
   /* Hero disappears */
-  DrawLevelField(ExitX, ExitY);
+  DrawNewLevelField(ExitX, ExitY);
   BackToFront();
 
   if (tape.playing)
@@ -1329,8 +1330,11 @@ void InitMovingField(int x, int y, int direction)
 
   MovDir[x][y] = direction;
   MovDir[newx][newy] = direction;
+
   if (Feld[newx][newy] == EL_EMPTY)
     Feld[newx][newy] = EL_BLOCKED;
+
+  GfxAction[x][y] = GFX_ACTION_MOVING;
 }
 
 void Moving2Blocked(int x, int y, int *goes_to_x, int *goes_to_y)
@@ -1441,22 +1445,31 @@ void RemoveMovingField(int x, int y)
   Feld[newx][newy] = EL_EMPTY;
   MovPos[oldx][oldy] = MovDir[oldx][oldy] = MovDelay[oldx][oldy] = 0;
   MovPos[newx][newy] = MovDir[newx][newy] = MovDelay[newx][newy] = 0;
+  GfxAction[oldx][oldy] = GfxAction[newx][newy] = GFX_ACTION_DEFAULT;
 
-  DrawLevelField(oldx, oldy);
-  DrawLevelField(newx, newy);
+  DrawNewLevelField(oldx, oldy);
+  DrawNewLevelField(newx, newy);
 }
 
 void DrawDynamite(int x, int y)
 {
   int sx = SCREENX(x), sy = SCREENY(y);
+#if 0
   int graphic = el2gfx(Feld[x][y]);
+#else
+  int graphic = el2img(Feld[x][y]);
+#endif
   int phase;
 
   if (!IN_SCR_FIELD(sx, sy) || IS_PLAYER(x, y))
     return;
 
   if (Store[x][y])
+#if 0
     DrawGraphic(sx, sy, el2gfx(Store[x][y]));
+#else
+    DrawNewGraphic(sx, sy, el2img(Store[x][y]), 0);
+#endif
 
   if (Feld[x][y] == EL_DYNAMITE_ACTIVE)
   {
@@ -1469,12 +1482,29 @@ void DrawDynamite(int x, int y)
       phase = 7 - phase;
   }
 
+#if 1
+  phase = getNewGraphicAnimationFrame(graphic, 96 - MovDelay[x][y]);
+#endif
+
+  /*
+  printf("-> %d: %d [%d]\n", graphic, phase, MovDelay[x][y]);
+  */
+
+#if 0
   if (game.emulation == EMU_SUPAPLEX)
     DrawGraphic(sx, sy, GFX_SP_DISK_RED);
   else if (Store[x][y])
     DrawGraphicThruMask(sx, sy, graphic + phase);
   else
     DrawGraphic(sx, sy, graphic + phase);
+#else
+  if (game.emulation == EMU_SUPAPLEX)
+    DrawNewGraphic(sx, sy, IMG_SP_DISK_RED, 0);
+  else if (Store[x][y])
+    DrawNewGraphicThruMask(sx, sy, graphic, phase);
+  else
+    DrawNewGraphic(sx, sy, graphic, phase);
+#endif
 }
 
 void CheckDynamite(int x, int y)
@@ -2723,6 +2753,8 @@ void StartMoving(int x, int y)
   if (Stop[x][y])
     return;
 
+  GfxAction[x][y] = GFX_ACTION_DEFAULT;
+
   if (CAN_FALL(element) && y<lev_fieldy-1)
   {
     if ((x>0 && IS_PLAYER(x-1, y)) || (x<lev_fieldx-1 && IS_PLAYER(x+1, y)))
@@ -2911,16 +2943,11 @@ void StartMoving(int x, int y)
        TurnRound(x, y);
 
        if (MovDelay[x][y] && (element == EL_BUG ||
-                              element == EL_SPACESHIP ||
-                              element == EL_SP_SNIKSNAK ||
-                              element == EL_SP_ELECTRON))
-         DrawNewLevelField(x, y);
-       else if (MovDelay[x][y] && (element == EL_BUG ||
                               element == EL_SPACESHIP ||
                               element == EL_SP_SNIKSNAK ||
                               element == EL_SP_ELECTRON ||
                               element == EL_MOLE))
-         DrawLevelField(x, y);
+         DrawNewLevelField(x, y);
       }
     }
 
@@ -2948,7 +2975,7 @@ void StartMoving(int x, int y)
        }
       }
       else if (element == EL_SP_ELECTRON)
-       DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_NORMAL);
+       DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_LOOP);
       else if (element == EL_DRAGON)
       {
        int i;
@@ -3032,7 +3059,7 @@ void StartMoving(int x, int y)
       if (Feld[newx][newy] == EL_EXIT_OPEN)
       {
        Feld[x][y] = EL_EMPTY;
-       DrawLevelField(x, y);
+       DrawNewLevelField(x, y);
 
        PlaySoundLevel(newx, newy, SND_PENGUIN_PASSING_EXIT);
        if (IN_SCR_FIELD(SCREENX(newx), SCREENY(newy)))
@@ -3048,7 +3075,7 @@ void StartMoving(int x, int y)
       else if (IS_MAMPF3(Feld[newx][newy]))
       {
        if (DigField(local_player, newx, newy, 0, 0, DF_DIG) == MF_MOVING)
-         DrawLevelField(newx, newy);
+         DrawNewLevelField(newx, newy);
        else
          MovDir[x][y] = MV_NO_MOVING;
       }
@@ -3057,7 +3084,7 @@ void StartMoving(int x, int y)
        if (IS_PLAYER(x, y))
          DrawPlayerField(x, y);
        else
-         DrawLevelField(x, y);
+         DrawNewLevelField(x, y);
        return;
       }
     }
@@ -3070,7 +3097,7 @@ void StartMoving(int x, int y)
        else
        {
          Feld[newx][newy] = EL_EMPTY;
-         DrawLevelField(newx, newy);
+         DrawNewLevelField(newx, newy);
        }
 
        PlaySoundLevel(x, y, SND_PIG_EATING);
@@ -3080,7 +3107,7 @@ void StartMoving(int x, int y)
        if (IS_PLAYER(x, y))
          DrawPlayerField(x, y);
        else
-         DrawLevelField(x, y);
+         DrawNewLevelField(x, y);
        return;
       }
     }
@@ -3091,7 +3118,7 @@ void StartMoving(int x, int y)
        if (IS_PLAYER(x, y))
          DrawPlayerField(x, y);
        else
-         DrawLevelField(x, y);
+         DrawNewLevelField(x, y);
        return;
       }
       else
@@ -3112,7 +3139,7 @@ void StartMoving(int x, int y)
          if (IS_PLAYER(x, y))
            DrawPlayerField(x, y);
          else
-           DrawLevelField(x, y);
+           DrawNewLevelField(x, y);
 
          PlaySoundLevel(x, y, SND_DRAGON_ATTACKING);
 
@@ -3214,19 +3241,19 @@ void StartMoving(int x, int y)
 #endif
       else if (element == EL_BD_BUTTERFLY || element == EL_BD_FIREFLY)
 #if 0
-       DrawGraphicAnimation(x, y, el2gfx(element), 2, 4, ANIM_NORMAL);
+       DrawGraphicAnimation(x, y, el2gfx(element), 2, 4, ANIM_LOOP);
 #else
        DrawNewGraphicAnimation(x, y, el2img(element));
 #endif
       else if (element == EL_SATELLITE)
 #if 0
-       DrawGraphicAnimation(x, y, GFX_SONDE_START, 8, 2, ANIM_NORMAL);
+       DrawGraphicAnimation(x, y, GFX_SONDE_START, 8, 2, ANIM_LOOP);
 #else
        DrawNewGraphicAnimation(x, y, IMG_SATELLITE);
 #endif
       else if (element == EL_SP_ELECTRON)
 #if 0
-       DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_NORMAL);
+       DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_LOOP);
 #else
        DrawNewGraphicAnimation(x, y, IMG_SP_ELECTRON);
 #endif
@@ -3364,6 +3391,9 @@ void ContinueMoving(int x, int y)
     MovPos[x][y] = MovDir[x][y] = MovDelay[x][y] = 0;
     MovDelay[newx][newy] = 0;
 
+    GfxAction[newx][newy] = GfxAction[x][y];   /* keep action one frame */
+    GfxAction[x][y] = GFX_ACTION_DEFAULT;
+
     if (!CAN_MOVE(element))
       MovDir[newx][newy] = 0;
 
@@ -3388,6 +3418,9 @@ void ContinueMoving(int x, int y)
   }
   else                         /* still moving on */
   {
+    if (GfxAction[x][y] == GFX_ACTION_DEFAULT)
+      GfxAction[x][y] = GFX_ACTION_MOVING;
+
     DrawNewLevelField(x, y);
   }
 }
@@ -3908,7 +3941,7 @@ void Blubber(int x, int y)
   if (y > 0 && IS_MOVING(x, y-1) && MovDir[x][y-1] == MV_DOWN)
     DrawLevelField(x, y-1);
   else
-    DrawGraphicAnimation(x, y, GFX_GEBLUBBER, 4, 10, ANIM_NORMAL);
+    DrawGraphicAnimation(x, y, GFX_GEBLUBBER, 4, 10, ANIM_LOOP);
 }
 
 void NussKnacken(int x, int y)
@@ -4500,7 +4533,7 @@ static void DrawBeltAnimation(int x, int y, int element)
   if (belt_dir != MV_NO_MOVING)
   {
     int delay = 2;
-    int mode = (belt_dir == MV_LEFT ? ANIM_NORMAL : ANIM_REVERSE);
+    int mode = ANIM_LOOP | (belt_dir == MV_LEFT ? 0 : ANIM_REVERSE);
     int graphic = el2gfx(element) + (belt_dir == MV_LEFT ? 0 : 7);
 
     DrawGraphicAnimation(x, y, graphic, 8, delay, mode);
@@ -4858,10 +4891,10 @@ void GameActions()
     else if (element == EL_TRAP || element == EL_TRAP_ACTIVE)
       CheckTrap(x, y);
     else if (element == EL_SP_TERMINAL)
-      DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL, 7, 12, ANIM_NORMAL);
+      DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL, 7, 12, ANIM_LOOP);
     else if (element == EL_SP_TERMINAL_ACTIVE)
     {
-      DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL_ACTIVE, 7, 4, ANIM_NORMAL);
+      DrawGraphicAnimation(x, y, GFX2_SP_TERMINAL_ACTIVE, 7, 4, ANIM_LOOP);
 #if 0
       if (!(FrameCounter % 4))
        PlaySoundLevel(x, y, SND_SP_TERMINAL_ACTIVE);
@@ -4878,10 +4911,10 @@ void GameActions()
     else if (element == EL_TIMEGATE_CLOSING)
       CloseTimegate(x, y);
     else if (element == EL_EXTRA_TIME)
-      DrawGraphicAnimation(x, y, GFX_EXTRA_TIME, 6, 4, ANIM_NORMAL);
+      DrawGraphicAnimation(x, y, GFX_EXTRA_TIME, 6, 4, ANIM_LOOP);
     else if (element == EL_SHIELD_NORMAL)
     {
-      DrawGraphicAnimation(x, y, GFX_SHIELD_PASSIVE, 6, 4, ANIM_NORMAL);
+      DrawGraphicAnimation(x, y, GFX_SHIELD_PASSIVE, 6, 4, ANIM_LOOP);
 #if 0
       if (!(FrameCounter % 4))
        PlaySoundLevel(x, y, SND_SHIELD_PASSIVE_ACTIVATED);
@@ -4889,7 +4922,7 @@ void GameActions()
     }
     else if (element == EL_SHIELD_DEADLY)
     {
-      DrawGraphicAnimation(x, y, GFX_SHIELD_ACTIVE, 6, 4, ANIM_NORMAL);
+      DrawGraphicAnimation(x, y, GFX_SHIELD_ACTIVE, 6, 4, ANIM_LOOP);
 #if 0
       if (!(FrameCounter % 4))
        PlaySoundLevel(x, y, SND_SHIELD_DEADLY_ACTIVE);
index d800de9f61c72d4a5cd0cf676fc1eda09692d1dd..2af73af732b1992e38fac21a3cc2b9b38436dfec 100644 (file)
@@ -923,17 +923,17 @@ void InitElementInfo()
   };
 #endif
 
-  int i, j, k;
+  int i, act, dir;
 
-  /* always start with reliable default values */
+  /* set values to -1 to identify later as "uninitialized" values */
   for(i=0; i<MAX_ELEMENTS; i++)
   {
-    for(j=0; j<NUM_GFX_ACTIONS_MAPPED; j++)
+    for(act=0; act<NUM_GFX_ACTIONS_MAPPED; act++)
     {
-      element_info[i].graphic[j] = -1;                 /* use default */
+      element_info[i].graphic[act] = -1;
 
-      for(k=0; k<NUM_MV_DIRECTIONS; k++)
-       element_info[i].direction_graphic[j][k] = -1;   /* use default */
+      for(dir=0; dir<NUM_MV_DIRECTIONS; dir++)
+       element_info[i].direction_graphic[act][dir] = -1;
     }
   }
 
@@ -1010,7 +1010,7 @@ void InitElementInfo()
     i++;
   }
 
-  /* now set all '-1' values with element specific default values */
+  /* now set all '-1' values to element specific default values */
   for(i=0; i<MAX_ELEMENTS; i++)
   {
     int default_action_graphic = element_info[i].graphic[GFX_ACTION_DEFAULT];
@@ -1019,27 +1019,33 @@ void InitElementInfo()
     if (default_action_graphic == -1)
       default_action_graphic = EL_CHAR_QUESTION;
 
-    for(k=0; k<NUM_MV_DIRECTIONS; k++)
-      default_action_direction_graphic[k] =
-       element_info[i].direction_graphic[GFX_ACTION_DEFAULT][k];
-
-    for(j=0; j<NUM_GFX_ACTIONS_MAPPED; j++)
+    for(dir=0; dir<NUM_MV_DIRECTIONS; dir++)
     {
-      /* no graphic for this specific action -- use default action graphic */
-      if (element_info[i].graphic[j] == -1)
-       element_info[i].graphic[j] = default_action_graphic;
+      default_action_direction_graphic[dir] =
+       element_info[i].direction_graphic[GFX_ACTION_DEFAULT][dir];
+
+      if (default_action_direction_graphic[dir] == -1)
+       default_action_direction_graphic[dir] = default_action_graphic;
+    }
 
-      for(k=0; k<NUM_MV_DIRECTIONS; k++)
+    for(act=0; act<NUM_GFX_ACTIONS_MAPPED; act++)
+    {
+      for(dir=0; dir<NUM_MV_DIRECTIONS; dir++)
       {
-       int default_direction_graphic = default_action_direction_graphic[k];
+       int default_direction_graphic = element_info[i].graphic[act];
 
-       /* no default direction graphic -- use graphic for current action */
+       /* no graphic for current action -- use default direction graphic */
        if (default_direction_graphic == -1)
-         default_direction_graphic = element_info[i].graphic[j];
+         default_direction_graphic = default_action_direction_graphic[dir];
 
-       if (element_info[i].direction_graphic[j][k] == -1)
-         element_info[i].direction_graphic[j][k] = default_direction_graphic;
+       if (element_info[i].direction_graphic[act][dir] == -1)
+         element_info[i].direction_graphic[act][dir] =
+           default_direction_graphic;
       }
+
+      /* no graphic for this specific action -- use default action graphic */
+      if (element_info[i].graphic[act] == -1)
+       element_info[i].graphic[act] = default_action_graphic;
     }
   }
 
@@ -1078,17 +1084,21 @@ static void InitGraphicInfo()
     if (new_graphic_info[i].anim_delay == 0)   /* delay must be at least 1 */
       new_graphic_info[i].anim_delay = 1;
 
-    /* basically, animation can be either normal or reverse direction */
-    if (parameter[GFX_ARG_REVERSE])
-      new_graphic_info[i].anim_mode = ANIM_REVERSE;
+    /* set mode for animation frame order */
+    if (parameter[GFX_ARG_MODE_LINEAR])
+      new_graphic_info[i].anim_mode = ANIM_LINEAR;
+    else if (parameter[GFX_ARG_MODE_PINGPONG])
+      new_graphic_info[i].anim_mode = ANIM_PINGPONG;
+    else if (parameter[GFX_ARG_MODE_PINGPONG2])
+      new_graphic_info[i].anim_mode = ANIM_PINGPONG2;
+    else if (parameter[GFX_ARG_FRAMES] > 1)
+      new_graphic_info[i].anim_mode = ANIM_LOOP;
     else
-      new_graphic_info[i].anim_mode = ANIM_NORMAL;
+      new_graphic_info[i].anim_mode = ANIM_NONE;
 
-    /* additionally, animation can be either pingpong or pingpong2 layout */
-    if (parameter[GFX_ARG_PINGPONG])
-      new_graphic_info[i].anim_mode |= ANIM_PINGPONG;
-    else if (parameter[GFX_ARG_PINGPONG2])
-      new_graphic_info[i].anim_mode |= ANIM_PINGPONG2;
+    /* set additional flag to play animation frames in reverse order */
+    if (parameter[GFX_ARG_MODE_REVERSE])
+      new_graphic_info[i].anim_mode |= ANIM_REVERSE;
 
     /* animation synchronized with global frame counter, not move position */
     new_graphic_info[i].anim_global_sync = parameter[GFX_ARG_GLOBAL_SYNC];
index 2546975b5b5f978e509b068043eb3c21909d0ecf..5c95800cc72c5f53fa0d126221dbaf9e890ac3ae 100644 (file)
@@ -220,7 +220,7 @@ boolean AnimateToon(int toon_nr, boolean restart)
 
   if (frame<0 || frame>=anim->frames)
   {
-    if (anim->pingpong)
+    if (anim->mode == ANIM_PINGPONG)
     {
       frame_step *= -1;
       frame = (frame<0 ? 1 : anim->frames-2);
index f090b4d293922ca3b55e254293f13b8a24ab6940..cf267345df4cecd8b167cf09ef12ff21c799c57c 100644 (file)
 #include "system.h"
 
 
-/* values for toon animation */
+/* values for animation mode (frame order and direction) */
+#define ANIM_NONE              0
+#define ANIM_LOOP              (1 << 0)
+#define ANIM_LINEAR            (1 << 1)
+#define ANIM_PINGPONG          (1 << 2)
+#define ANIM_PINGPONG2         (1 << 3)
+#define ANIM_REVERSE           (1 << 4)
+
+/* values for toon animation direction */
 #define ANIMDIR_LEFT   1
 #define ANIMDIR_RIGHT  2
 #define ANIMDIR_UP     4
@@ -54,7 +62,7 @@ struct ToonInfo
   int frames;
   int frames_per_second;
   int stepsize;
-  boolean pingpong;
+  int mode;
   int direction;
   int position;
 };
index 6cafa8eaa5a2942a2e9848e1373092a6550301fd..0a821b2f429afe78c144317da7a0923e79f3e43f 100644 (file)
@@ -42,6 +42,7 @@ short         Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 short          Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 short          StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 short          Frame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+short          GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 boolean                Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 short          JustStopped[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 short          AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
@@ -168,9 +169,10 @@ struct ConfigInfo image_config_suffix[] =
   { ".start_frame",                    "-1"                    },
 #endif
   { ".delay",                          "1"                     },
-  { ".pingpong",                       "0"                     },
-  { ".pingpong2",                      "0"                     },
-  { ".reverse",                                "0"                     },
+  { ".mode_linear",                    "0"                     },
+  { ".mode_pingpong",                  "0"                     },
+  { ".mode_pingpong2",                 "0"                     },
+  { ".mode_reverse",                   "0"                     },
   { ".global_sync",                    "0"                     },
   { ".vertical",                       "0"                     },
 
@@ -221,25 +223,25 @@ struct ConfigInfo image_config[] =
   { "bd_magic_wall.active.xpos",               "12"                    },
   { "bd_magic_wall.active.ypos",               "10"                    },
   { "bd_magic_wall.active.frames",             "4"                     },
-  { "bd_magic_wall.active.reverse",            "1"                     },
+  { "bd_magic_wall.active.mode_reverse",       "1"                     },
   { "bd_magic_wall.active.delay",              "4"                     },
   { "bd_magic_wall.filling",                   "RocksElements.pcx"     },
   { "bd_magic_wall.filling.xpos",              "12"                    },
   { "bd_magic_wall.filling.ypos",              "10"                    },
   { "bd_magic_wall.filling.frames",            "4"                     },
-  { "bd_magic_wall.filling.reverse",           "1"                     },
+  { "bd_magic_wall.filling.mode_reverse",      "1"                     },
   { "bd_magic_wall.filling.delay",             "4"                     },
   { "bd_magic_wall.full",                      "RocksElements.pcx"     },
   { "bd_magic_wall.full.xpos",                 "12"                    },
   { "bd_magic_wall.full.ypos",                 "10"                    },
   { "bd_magic_wall.full.frames",               "4"                     },
-  { "bd_magic_wall.full.reverse",              "1"                     },
+  { "bd_magic_wall.full.mode_reverse",         "1"                     },
   { "bd_magic_wall.full.delay",                        "4"                     },
   { "bd_magic_wall.emptying",                  "RocksElements.pcx"     },
   { "bd_magic_wall.emptying.xpos",             "12"                    },
   { "bd_magic_wall.emptying.ypos",             "10"                    },
   { "bd_magic_wall.emptying.frames",           "4"                     },
-  { "bd_magic_wall.emptying.reverse",          "1"                     },
+  { "bd_magic_wall.emptying.mode_reverse",     "1"                     },
   { "bd_magic_wall.emptying.delay",            "4"                     },
   { "bd_magic_wall.dead",                      "RocksElements.pcx"     },
   { "bd_magic_wall.dead.xpos",                 "12"                    },
@@ -271,13 +273,13 @@ struct ConfigInfo image_config[] =
   { "bd_butterfly.xpos",                       "4"                     },
   { "bd_butterfly.ypos",                       "12"                    },
   { "bd_butterfly.frames",                     "2"                     },
-  { "bd_butterfly.pingpong",                   "1"                     },
+  { "bd_butterfly.mode_pingpong",              "1"                     },
   { "bd_butterfly.delay",                      "4"                     },
   { "bd_butterfly.moving",                     "RocksElements.pcx"     },
   { "bd_butterfly.moving.xpos",                        "4"                     },
   { "bd_butterfly.moving.ypos",                        "12"                    },
   { "bd_butterfly.moving.frames",              "2"                     },
-  { "bd_butterfly.moving.pingpong",            "1"                     },
+  { "bd_butterfly.moving.mode_pingpong",       "1"                     },
   { "bd_butterfly.moving.delay",               "4"                     },
   { "bd_butterfly_right",                      "RocksElements.pcx"     },
   { "bd_butterfly_right.xpos",                 "8"                     },
@@ -300,13 +302,13 @@ struct ConfigInfo image_config[] =
   { "bd_firefly.xpos",                         "6"                     },
   { "bd_firefly.ypos",                         "12"                    },
   { "bd_firefly.frames",                       "2"                     },
-  { "bd_firefly.pingpong",                     "1"                     },
+  { "bd_firefly.mode_pingpong",                        "1"                     },
   { "bd_firefly.delay",                                "4"                     },
   { "bd_firefly.moving",                       "RocksElements.pcx"     },
   { "bd_firefly.moving.xpos",                  "6"                     },
   { "bd_firefly.moving.ypos",                  "12"                    },
   { "bd_firefly.moving.frames",                        "2"                     },
-  { "bd_firefly.moving.pingpong",              "1"                     },
+  { "bd_firefly.moving.mode_pingpong",         "1"                     },
   { "bd_firefly.moving.delay",                 "4"                     },
   { "bd_firefly_right",                                "RocksElements.pcx"     },
   { "bd_firefly_right.xpos",                   "12"                    },
@@ -362,12 +364,12 @@ struct ConfigInfo image_config[] =
   { "sp_murphy_left.moving.xpos",              "8"                     },
   { "sp_murphy_left.moving.ypos",              "0"                     },
   { "sp_murphy_left.moving.frames",            "3"                     },
-  { "sp_murphy_left.moving.pingpong",          "1"                     },
+  { "sp_murphy_left.moving.mode_pingpong",     "1"                     },
   { "sp_murphy_left.digging",                  "RocksSP.pcx"           },
   { "sp_murphy_left.digging.xpos",             "8"                     },
   { "sp_murphy_left.digging.ypos",             "0"                     },
   { "sp_murphy_left.digging.frames",           "3"                     },
-  { "sp_murphy_left.digging.pingpong",         "1"                     },
+  { "sp_murphy_left.digging.mode_pingpong",    "1"                     },
   { "sp_murphy_left.pushing",                  "RocksSP.pcx"           },
   { "sp_murphy_left.pushing.xpos",             "11"                    },
   { "sp_murphy_left.pushing.ypos",             "1"                     },
@@ -385,12 +387,12 @@ struct ConfigInfo image_config[] =
   { "sp_murphy_right.moving.xpos",             "11"                    },
   { "sp_murphy_right.moving.ypos",             "0"                     },
   { "sp_murphy_right.moving.frames",           "3"                     },
-  { "sp_murphy_right.moving.pingpong",         "1"                     },
+  { "sp_murphy_right.moving.mode_pingpong",    "1"                     },
   { "sp_murphy_right.digging",                 "RocksSP.pcx"           },
   { "sp_murphy_right.digging.xpos",            "11"                    },
   { "sp_murphy_right.digging.ypos",            "0"                     },
   { "sp_murphy_right.digging.frames",          "3"                     },
-  { "sp_murphy_right.digging.pingpong",                "1"                     },
+  { "sp_murphy_right.digging.mode_pingpong",   "1"                     },
   { "sp_murphy_right.pushing",                 "RocksSP.pcx"           },
   { "sp_murphy_right.pushing.xpos",            "10"                    },
   { "sp_murphy_right.pushing.ypos",            "1"                     },
@@ -567,22 +569,22 @@ struct ConfigInfo image_config[] =
   { "sp_sniksnak_left.xpos",                   "8"                     },
   { "sp_sniksnak_left.ypos",                   "8"                     },
   { "sp_sniksnak_left.frames",                 "4"                     },
-  { "sp_sniksnak_left.pingpong2",              "1"                     },
+  { "sp_sniksnak_left.mode_pingpong2",         "1"                     },
   { "sp_sniksnak_right",                       "RocksSP.pcx"           },
   { "sp_sniksnak_right.xpos",                  "12"                    },
   { "sp_sniksnak_right.ypos",                  "8"                     },
   { "sp_sniksnak_right.frames",                        "4"                     },
-  { "sp_sniksnak_right.pingpong2",             "1"                     },
+  { "sp_sniksnak_right.mode_pingpong2",                "1"                     },
   { "sp_sniksnak_up",                          "RocksSP.pcx"           },
   { "sp_sniksnak_up.xpos",                     "8"                     },
   { "sp_sniksnak_up.ypos",                     "9"                     },
   { "sp_sniksnak_up.frames",                   "4"                     },
-  { "sp_sniksnak_up.pingpong2",                        "1"                     },
+  { "sp_sniksnak_up.mode_pingpong2",           "1"                     },
   { "sp_sniksnak_down",                                "RocksSP.pcx"           },
   { "sp_sniksnak_down.xpos",                   "12"                    },
   { "sp_sniksnak_down.ypos",                   "9"                     },
   { "sp_sniksnak_down.frames",                 "4"                     },
-  { "sp_sniksnak_down.pingpong2",              "1"                     },
+  { "sp_sniksnak_down.mode_pingpong2",         "1"                     },
 
   { "sp_electron",                             "RocksSP.pcx"           },
   { "sp_electron.xpos",                                "8"                     },
@@ -734,6 +736,7 @@ struct ConfigInfo image_config[] =
   { "nut.cracking.xpos",                       "13"                    },
   { "nut.cracking.ypos",                       "1"                     },
   { "nut.cracking.frames",                     "3"                     },
+  { "nut.cracking.mode_linear",                        "1"                     },
 
   { "dynamite",                                        "RocksElements.pcx"     },
   { "dynamite.xpos",                           "0"                     },
@@ -743,6 +746,8 @@ struct ConfigInfo image_config[] =
   { "dynamite.active.xpos",                    "1"                     },
   { "dynamite.active.ypos",                    "3"                     },
   { "dynamite.active.frames",                  "7"                     },
+  { "dynamite.active.delay",                   "12"                    },
+  { "dynamite.active.mode_linear",             "1"                     },
 
   { "wall_emerald",                            "RocksElements.pcx"     },
   { "wall_emerald.xpos",                       "4"                     },
@@ -800,7 +805,7 @@ struct ConfigInfo image_config[] =
   { "yamyam.xpos",                             "0"                     },
   { "yamyam.ypos",                             "5"                     },
   { "yamyam.frames",                           "4"                     },
-  { "yamyam.pingpong",                         "1"                     },
+  { "yamyam.mode_pingpong",                    "1"                     },
   { "yamyam.moving",                           "RocksElements.pcx"     },
   { "yamyam.moving.xpos",                      "0"                     },
   { "yamyam.moving.ypos",                      "5"                     },
@@ -810,7 +815,7 @@ struct ConfigInfo image_config[] =
   { "robot.xpos",                              "4"                     },
   { "robot.ypos",                              "5"                     },
   { "robot.frames",                            "4"                     },
-  { "robot.pingpong",                          "1"                     },
+  { "robot.mode_pingpong",                     "1"                     },
 
   { "robot_wheel",                             "RocksElements.pcx"     },
   { "robot_wheel.xpos",                                "0"                     },
@@ -829,25 +834,25 @@ struct ConfigInfo image_config[] =
   { "magic_wall.active.xpos",                  "0"                     },
   { "magic_wall.active.ypos",                  "8"                     },
   { "magic_wall.active.frames",                        "4"                     },
-  { "magic_wall.active.reverse",               "1"                     },
+  { "magic_wall.active.mode_reverse",          "1"                     },
   { "magic_wall.active.delay",                 "4"                     },
   { "magic_wall.filling",                      "RocksElements.pcx"     },
   { "magic_wall.filling.xpos",                 "0"                     },
   { "magic_wall.filling.ypos",                 "8"                     },
   { "magic_wall.filling.frames",               "4"                     },
-  { "magic_wall.filling.reverse",              "1"                     },
+  { "magic_wall.filling.mode_reverse",         "1"                     },
   { "magic_wall.filling.delay",                        "4"                     },
   { "magic_wall.full",                         "RocksElements.pcx"     },
   { "magic_wall.full.xpos",                    "0"                     },
   { "magic_wall.full.ypos",                    "8"                     },
   { "magic_wall.full.frames",                  "4"                     },
-  { "magic_wall.full.reverse",                 "1"                     },
+  { "magic_wall.full.mode_reverse",            "1"                     },
   { "magic_wall.full.delay",                   "4"                     },
   { "magic_wall.emptying",                     "RocksElements.pcx"     },
   { "magic_wall.emptying.xpos",                        "0"                     },
   { "magic_wall.emptying.ypos",                        "8"                     },
   { "magic_wall.emptying.frames",              "4"                     },
-  { "magic_wall.emptying.reverse",             "1"                     },
+  { "magic_wall.emptying.mode_reverse",                "1"                     },
   { "magic_wall.emptying.delay",               "4"                     },
   { "magic_wall.dead",                         "RocksElements.pcx"     },
   { "magic_wall.dead.xpos",                    "0"                     },
@@ -1010,7 +1015,7 @@ struct ConfigInfo image_config[] =
   { "exit_open.xpos",                          "4"                     },
   { "exit_open.ypos",                          "11"                    },
   { "exit_open.frames",                                "4"                     },
-  { "exit_open.pingpong",                      "1"                     },
+  { "exit_open.mode_pingpong",                 "1"                     },
 
   /* images for Emerald Mine Club style elements and actions */
 
@@ -1022,7 +1027,7 @@ struct ConfigInfo image_config[] =
   { "balloon.moving.xpos",                     "12"                    },
   { "balloon.moving.ypos",                     "7"                     },
   { "balloon.moving.frames",                   "4"                     },
-  { "balloon.moving.pingpong",                 "1"                     },
+  { "balloon.moving.mode_pingpong",            "1"                     },
   { "balloon.moving.delay",                    "2"                     },
 
   { "balloon_send_left",                       "RocksDC.pcx"           },
@@ -1354,13 +1359,13 @@ struct ConfigInfo image_config[] =
   { "shield_normal.active.xpos",               "1"                     },
   { "shield_normal.active.ypos",               "13"                    },
   { "shield_normal.active.frames",             "3"                     },
-  { "shield_normal.active.pingpong",           "1"                     },
+  { "shield_normal.active.mode_pingpong",      "1"                     },
 
   { "shield_deadly.active",                    "RocksHeroes.pcx"       },
   { "shield_deadly.active.xpos",               "5"                     },
   { "shield_deadly.active.ypos",               "13"                    },
   { "shield_deadly.active.frames",             "3"                     },
-  { "shield_deadly.active.pingpong",           "1"                     },
+  { "shield_deadly.active.mode_pingpong",      "1"                     },
 
   { "switchgate_closed",                       "RocksDC.pcx"           },
   { "switchgate_closed.xpos",                  "8"                     },
@@ -1378,7 +1383,7 @@ struct ConfigInfo image_config[] =
   { "switchgate.closing.xpos",                 "8"                     },
   { "switchgate.closing.ypos",                 "5"                     },
   { "switchgate.closing.frames",               "5"                     },
-  { "switchgate.closing.reverse",              "1"                     },
+  { "switchgate.closing.mode_reverse",         "1"                     },
 
   { "timegate_closed",                         "RocksDC.pcx"           },
   { "timegate_closed.xpos",                    "8"                     },
@@ -1396,7 +1401,7 @@ struct ConfigInfo image_config[] =
   { "timegate.closing.xpos",                   "8"                     },
   { "timegate.closing.ypos",                   "6"                     },
   { "timegate.closing.frames",                 "5"                     },
-  { "timegate.closing.reverse",                        "1"                     },
+  { "timegate.closing.mode_reverse",           "1"                     },
 
   { "pearl",                                   "RocksMore.pcx"         },
   { "pearl.xpos",                              "0"                     },
@@ -1406,6 +1411,7 @@ struct ConfigInfo image_config[] =
   { "pearl.breaking.xpos",                     "0"                     },
   { "pearl.breaking.ypos",                     "4"                     },
   { "pearl.breaking.frames",                   "4"                     },
+  { "pearl.breaking.mode_linear",              "4"                     },
 
   { "crystal",                                 "RocksMore.pcx"         },
   { "crystal.xpos",                            "1"                     },
@@ -1559,25 +1565,25 @@ struct ConfigInfo image_config[] =
   { "pacman_right.xpos",                       "8"                     },
   { "pacman_right.ypos",                       "5"                     },
   { "pacman_right.frames",                     "2"                     },
-  { "pacman_right.reverse",                    "1"                     },
+  { "pacman_right.mode_reverse",               "1"                     },
   { "pacman_right.delay",                      "4"                     },
   { "pacman_up",                               "RocksElements.pcx"     },
   { "pacman_up.xpos",                          "10"                    },
   { "pacman_up.ypos",                          "5"                     },
   { "pacman_up.frames",                                "2"                     },
-  { "pacman_up.reverse",                       "1"                     },
+  { "pacman_up.mode_reverse",                  "1"                     },
   { "pacman_up.delay",                         "4"                     },
   { "pacman_left",                             "RocksElements.pcx"     },
   { "pacman_left.xpos",                                "12"                    },
   { "pacman_left.ypos",                                "5"                     },
   { "pacman_left.frames",                      "2"                     },
-  { "pacman_left.reverse",                     "1"                     },
+  { "pacman_left.mode_reverse",                        "1"                     },
   { "pacman_left.delay",                       "4"                     },
   { "pacman_down",                             "RocksElements.pcx"     },
   { "pacman_down.xpos",                                "14"                    },
   { "pacman_down.ypos",                                "5"                     },
   { "pacman_down.frames",                      "2"                     },
-  { "pacman_down.reverse",                     "1"                     },
+  { "pacman_down.mode_reverse",                        "1"                     },
   { "pacman_down.delay",                       "4"                     },
 
   { "lamp",                                    "RocksElements.pcx"     },
@@ -1684,33 +1690,38 @@ struct ConfigInfo image_config[] =
   { "dark_yamyam.xpos",                                "8"                     },
   { "dark_yamyam.ypos",                                "11"                    },
   { "dark_yamyam.frames",                      "4"                     },
-  { "dark_yamyam.pingpong",                    "1"                     },
+  { "dark_yamyam.mode_pingpong",               "1"                     },
 
   { "dynabomb.active",                         "RocksElements.pcx"     },
   { "dynabomb.active.xpos",                    "12"                    },
   { "dynabomb.active.ypos",                    "11"                    },
   { "dynabomb.active.frames",                  "4"                     },
-  { "dynabomb.active.pingpong",                        "1"                     },
+  { "dynabomb.active.delay",                   "6"                     },
+  { "dynabomb.active.mode_pingpong",           "1"                     },
   { "dynabomb_player1.active",                 "RocksElements.pcx"     },
   { "dynabomb_player1.active.xpos",            "12"                    },
   { "dynabomb_player1.active.ypos",            "11"                    },
   { "dynabomb_player1.active.frames",          "4"                     },
-  { "dynabomb_player1.active.pingpong",                "1"                     },
+  { "dynabomb_player1.active.delay",           "6"                     },
+  { "dynabomb_player1.active.mode_pingpong",   "1"                     },
   { "dynabomb_player2.active",                 "RocksElements.pcx"     },
   { "dynabomb_player2.active.xpos",            "12"                    },
   { "dynabomb_player2.active.ypos",            "11"                    },
   { "dynabomb_player2.active.frames",          "4"                     },
-  { "dynabomb_player2.active.pingpong",                "1"                     },
+  { "dynabomb_player2.active.delay",           "6"                     },
+  { "dynabomb_player2.active.mode_pingpong",   "1"                     },
   { "dynabomb_player3.active",                 "RocksElements.pcx"     },
   { "dynabomb_player3.active.xpos",            "12"                    },
   { "dynabomb_player3.active.ypos",            "11"                    },
   { "dynabomb_player3.active.frames",          "4"                     },
-  { "dynabomb_player3.active.pingpong",                "1"                     },
+  { "dynabomb_player3.active.delay",           "6"                     },
+  { "dynabomb_player3.active.mode_pingpong",   "1"                     },
   { "dynabomb_player4.active",                 "RocksElements.pcx"     },
   { "dynabomb_player4.active.xpos",            "12"                    },
   { "dynabomb_player4.active.ypos",            "11"                    },
   { "dynabomb_player4.active.frames",          "4"                     },
-  { "dynabomb_player4.active.pingpong",                "1"                     },
+  { "dynabomb_player4.active.delay",           "6"                     },
+  { "dynabomb_player4.active.mode_pingpong",   "1"                     },
   { "dynabomb_nr",                             "RocksElements.pcx"     },
   { "dynabomb_nr.xpos",                                "12"                    },
   { "dynabomb_nr.ypos",                                "11"                    },
@@ -2347,12 +2358,12 @@ struct ConfigInfo image_config[] =
   { "twinkle_blue.xpos",                       "8"                     },
   { "twinkle_blue.ypos",                       "11"                    },
   { "twinkle_blue.frames",                     "3"                     },
-  { "twinkle_blue.pingpong",                   "1"                     },
+  { "twinkle_blue.mode_pingpong",              "1"                     },
   { "twinkle_white",                           "RocksHeroes.pcx"       },
   { "twinkle_white.xpos",                      "8"                     },
   { "twinkle_white.ypos",                      "11"                    },
   { "twinkle_white.frames",                    "3"                     },
-  { "twinkle_white.pingpong",                  "1"                     },
+  { "twinkle_white.mode_pingpong",             "1"                     },
 
   { "steelwall_topleft",                       "RocksElements.pcx"     },
   { "steelwall_topleft.xpos",                  "0"                     },
index 4309ddbef17a5116ccc00b71308c1255552b0b84..354ec878d43882a3f22d144508942cf185c42562 100644 (file)
 #define GFX_ARG_YPOS                           1
 #define GFX_ARG_FRAMES                         2
 #define GFX_ARG_DELAY                          3
-#define GFX_ARG_PINGPONG                       4
-#define GFX_ARG_PINGPONG2                      5
-#define GFX_ARG_REVERSE                                6
-#define GFX_ARG_GLOBAL_SYNC                    7
-#define GFX_ARG_VERTICAL                       8
+#define GFX_ARG_MODE_LINEAR                    4
+#define GFX_ARG_MODE_PINGPONG                  5
+#define GFX_ARG_MODE_PINGPONG2                 6
+#define GFX_ARG_MODE_REVERSE                   7
+#define GFX_ARG_GLOBAL_SYNC                    8
+#define GFX_ARG_VERTICAL                       9
 
 /* values for sound configuration suffixes */
 /* (currently none) */
                                              PROGRAM_VERSION_MINOR, \
                                              PROGRAM_VERSION_PATCH)
 
-/* for DrawGraphicAnimation() [tools.c] and AnimateToon() [cartoons.c] */
-#define ANIM_NORMAL            0
-#define ANIM_REVERSE           (1 << 0)
-#define ANIM_PINGPONG          (1 << 1)
-#define ANIM_PINGPONG2         (1 << 2)
-
 /* values for game_emulation */
 #define EMU_NONE               0
 #define EMU_BOULDERDASH                1
@@ -1611,6 +1606,7 @@ extern short              Store[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 extern short           Store2[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 extern short           StorePlayer[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 extern short           Frame[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
+extern short           GfxAction[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 extern boolean         Stop[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 extern short           JustStopped[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
 extern short           AmoebaNr[MAX_LEV_FIELDX][MAX_LEV_FIELDY];
index cfdd40edc9812e09f1f7fb2ddaace42c5473d2a0..ce6f34b3c886511b42005df2e4a469b021001bb4 100644 (file)
@@ -706,18 +706,29 @@ static int getGraphicAnimationPhase(int frames, int delay, int mode)
   return phase;
 }
 
-static int getNewGraphicAnimationFrame(int graphic, int sync_frame)
+int getNewGraphicAnimationFrame(int graphic, int sync_frame)
 {
   int num_frames = new_graphic_info[graphic].anim_frames;
   int delay = new_graphic_info[graphic].anim_delay;
   int mode = new_graphic_info[graphic].anim_mode;
-  int frame;
+  int frame = 0;
 
   /* animation synchronized with global frame counter, not move position */
   if (new_graphic_info[graphic].anim_global_sync || sync_frame < 0)
     sync_frame = FrameCounter;
 
-  if (mode & ANIM_PINGPONG)            /* use border frames once */
+  if (mode & ANIM_LOOP)                        /* normal, looping animation */
+  {
+    frame = (sync_frame % (delay * num_frames)) / delay;
+  }
+  else if (mode & ANIM_LINEAR)         /* normal, non-looping animation */
+  {
+    frame = sync_frame / delay;
+
+    if (frame > num_frames - 1)
+      frame = num_frames - 1;
+  }
+  else if (mode & ANIM_PINGPONG)       /* use border frames once */
   {
     int max_anim_frames = 2 * num_frames - 2;
 
@@ -731,8 +742,6 @@ static int getNewGraphicAnimationFrame(int graphic, int sync_frame)
     frame = (sync_frame % (delay * max_anim_frames)) / delay;
     frame = (frame < num_frames ? frame : max_anim_frames - frame - 1);
   }
-  else /* mode == ANIM_NORMAL || mode == ANIM_REVERSE */
-    frame = (sync_frame % (delay * num_frames)) / delay;
 
   if (mode & ANIM_REVERSE)             /* use reverse animation direction */
     frame = num_frames - frame - 1;
@@ -1344,7 +1353,7 @@ void DrawScreenElementExt(int x, int y, int dx, int dy, int element,
   }
   else if (element == EL_SP_ELECTRON)
   {
-    graphic = GFX2_SP_ELECTRON + getGraphicAnimationPhase(8, 2, ANIM_NORMAL);
+    graphic = GFX2_SP_ELECTRON + getGraphicAnimationPhase(8, 2, ANIM_LOOP);
   }
   else if (element == EL_MOLE || element == EL_PENGUIN ||
           element == EL_PIG || element == EL_DRAGON)
@@ -1370,11 +1379,11 @@ void DrawScreenElementExt(int x, int y, int dx, int dy, int element,
   }
   else if (element == EL_SATELLITE)
   {
-    graphic = GFX_SONDE_START + getGraphicAnimationPhase(8, 2, ANIM_NORMAL);
+    graphic = GFX_SONDE_START + getGraphicAnimationPhase(8, 2, ANIM_LOOP);
   }
   else if (element == EL_ACID)
   {
-    graphic = GFX_GEBLUBBER + getGraphicAnimationPhase(4, 10, ANIM_NORMAL);
+    graphic = GFX_GEBLUBBER + getGraphicAnimationPhase(4, 10, ANIM_LOOP);
   }
   else if (element == EL_BD_BUTTERFLY || element == EL_BD_FIREFLY)
   {
@@ -1457,20 +1466,27 @@ void DrawScreenElementExt(int x, int y, int dx, int dy, int element,
     DrawGraphic(x, y, graphic);
 }
 
+inline static int getGfxAction(int x, int y)
+{
+  int gfx_action = GFX_ACTION_DEFAULT;
+
+  if (GfxAction[x][y] != GFX_ACTION_DEFAULT)
+    gfx_action = GfxAction[x][y];
+  else if (IS_MOVING(x, y))
+    gfx_action = GFX_ACTION_MOVING;
+
+  return gfx_action;
+}
+
 void DrawNewScreenElementExt(int x, int y, int dx, int dy, int element,
                          int cut_mode, int mask_mode)
 {
   int ux = LEVELX(x), uy = LEVELY(y);
   int move_dir = MovDir[ux][uy];
   int move_pos = ABS(MovPos[ux][uy]) / (TILEX / 8);
-  int gfx_action = (IS_MOVING(ux,uy) ? GFX_ACTION_MOVING : GFX_ACTION_DEFAULT);
+  int gfx_action = getGfxAction(ux, uy);
   int graphic = el_dir_act2img(element, move_dir, gfx_action);
   int frame = getNewGraphicAnimationFrame(graphic, move_pos);
-#if 0
-  int phase8 = move_pos;
-  int phase4 = phase8 / 2;
-  int phase2  = phase8 / 4;
-#endif
 
   if (element == EL_WALL_GROWING)
   {
index eb55e5eee143cf1d1cd8bd0ccee9ae6682e8b879..33f43c8c786ec220a33df38bc9998732f0888fdd 100644 (file)
@@ -70,6 +70,7 @@ void SetBorderElement();
 void DrawAllPlayers(void);
 void DrawPlayerField(int, int);
 void DrawPlayer(struct PlayerInfo *);
+int getNewGraphicAnimationFrame(int, int);
 void DrawGraphicAnimationExt(int, int, int, int, int, int, int);
 void DrawGraphicAnimation(int, int, int, int, int, int);
 void DrawNewGraphicAnimation(int, int, int);