rnd-20021004-1-src
authorHolger Schemel <info@artsoft.org>
Fri, 4 Oct 2002 17:36:37 +0000 (19:36 +0200)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:38:47 +0000 (10:38 +0200)
src/conftime.h
src/game.c
src/init.c
src/main.c
src/main.h
src/tools.c

index 6f3e97655145ab3a04c113c4cd51733069284a02..fff6362fb13259a7ea4fbf08fad4cb00c0496b5e 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "[2002-10-01 00:29]"
+#define COMPILE_DATE_STRING "[2002-10-04 19:34]"
index 8e4d256cec8291d724a499a630b71a2e5b89eb19..05e83995548a9a5947ef6398e9f0df55238e2027 100644 (file)
@@ -1732,6 +1732,7 @@ void Explode(int ex, int ey, int phase, int mode)
   }
   else if (!(phase % delay) && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
   {
+#if 0
     int graphic = GFX_EXPLOSION;
 
     if (game.emulation == EMU_SUPAPLEX)
@@ -1739,18 +1740,35 @@ void Explode(int ex, int ey, int phase, int mode)
                 GFX_SP_EXPLODE_INFOTRON :
                 GFX_SP_EXPLODE_EMPTY);
 
+    graphic += (phase / delay - 1);
+#else
+    int graphic = IMG_EXPLOSION;
+    int frame = (phase / delay - 1);
+
+    if (game.emulation == EMU_SUPAPLEX)
+      graphic = (Store[x][y] == EL_SP_INFOTRON ?
+                IMG_SP_EXPLOSION_INFOTRON :
+                IMG_SP_EXPLOSION);
+#endif
+
     if (phase == delay)
       ErdreichAnbroeckeln(SCREENX(x), SCREENY(y));
 
-    graphic += (phase / delay - 1);
-
     if (IS_PFORTE(Store[x][y]))
     {
       DrawNewLevelElement(x, y, Store[x][y]);
+#if 0
       DrawGraphicThruMask(SCREENX(x), SCREENY(y), graphic);
+#else
+      DrawNewGraphicThruMask(SCREENX(x), SCREENY(y), graphic, frame);
+#endif
     }
     else
+#if 0
       DrawGraphic(SCREENX(x), SCREENY(y), graphic);
+#else
+      DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame);
+#endif
   }
 }
 
@@ -1880,8 +1898,14 @@ void Blurb(int x, int y)
   }
   else                                                         /* go on */
   {
+#if 0
     int graphic =
       (element == EL_ACID_SPLASHING_LEFT ? GFX_BLURB_LEFT : GFX_BLURB_RIGHT);
+#else
+    int graphic = (element == EL_ACID_SPLASHING_LEFT ?
+                  IMG_ACID_SPLASHING_LEFT :
+                  IMG_ACID_SPLASHING_RIGHT);
+#endif
 
     if (!MovDelay[x][y])       /* initialize animation counter */
       MovDelay[x][y] = 9;
@@ -1890,12 +1914,20 @@ void Blurb(int x, int y)
     {
       MovDelay[x][y]--;
       if (MovDelay[x][y]/2 && IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+#if 0
        DrawGraphic(SCREENX(x), SCREENY(y), graphic+4-MovDelay[x][y]/2);
+#else
+      {
+       int frame = getNewGraphicAnimationFrame(graphic, 8 - MovDelay[x][y]);
+
+        DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame);
+      }
+#endif
 
       if (!MovDelay[x][y])
       {
        Feld[x][y] = EL_EMPTY;
-       DrawLevelField(x, y);
+       DrawNewLevelField(x, y);
       }
     }
   }
@@ -1960,7 +1992,7 @@ static void ToggleBeltSwitch(int x, int y)
        if (e_belt_nr == belt_nr)
        {
          Feld[xx][yy] = belt_base_switch_element[belt_nr] + belt_dir_nr;
-         DrawLevelField(xx, yy);
+         DrawNewLevelField(xx, yy);
        }
       }
       else if (IS_BELT(element) && belt_dir != MV_NO_MOVING)
@@ -1972,7 +2004,7 @@ static void ToggleBeltSwitch(int x, int y)
          int belt_part = Feld[xx][yy] - belt_base_element[belt_nr];
 
          Feld[xx][yy] = belt_base_active_element[belt_nr] + belt_part;
-         DrawLevelField(xx, yy);
+         DrawNewLevelField(xx, yy);
        }
       }
       else if (IS_BELT_ACTIVE(element) && belt_dir == MV_NO_MOVING)
@@ -1984,7 +2016,7 @@ static void ToggleBeltSwitch(int x, int y)
          int belt_part = Feld[xx][yy] - belt_base_active_element[belt_nr];
 
          Feld[xx][yy] = belt_base_element[belt_nr] + belt_part;
-         DrawLevelField(xx, yy);
+         DrawNewLevelField(xx, yy);
        }
       }
     }
@@ -2007,7 +2039,7 @@ static void ToggleSwitchgateSwitch(int x, int y)
          element == EL_SWITCHGATE_SWITCH_DOWN)
       {
        Feld[xx][yy] = EL_SWITCHGATE_SWITCH_UP + game.switchgate_pos;
-       DrawLevelField(xx, yy);
+       DrawNewLevelField(xx, yy);
       }
       else if (element == EL_SWITCHGATE_OPEN ||
               element == EL_SWITCHGATE_OPENING)
@@ -2053,13 +2085,13 @@ static void RedrawAllLightSwitchesAndInvisibleElements()
          game.light_time_left > 0)
       {
        Feld[x][y] = EL_LIGHT_SWITCH_ACTIVE;
-       DrawLevelField(x, y);
+       DrawNewLevelField(x, y);
       }
       else if (element == EL_LIGHT_SWITCH_ACTIVE &&
               game.light_time_left == 0)
       {
        Feld[x][y] = EL_LIGHT_SWITCH;
-       DrawLevelField(x, y);
+       DrawNewLevelField(x, y);
       }
       else if (element == EL_INVISIBLE_STEELWALL ||
               element == EL_INVISIBLE_WALL ||
@@ -2068,7 +2100,7 @@ static void RedrawAllLightSwitchesAndInvisibleElements()
        if (game.light_time_left > 0)
          Feld[x][y] = getInvisibleActiveFromInvisibleElement(element);
 
-       DrawLevelField(x, y);
+       DrawNewLevelField(x, y);
       }
       else if (element == EL_INVISIBLE_STEELWALL_ACTIVE ||
               element == EL_INVISIBLE_WALL_ACTIVE ||
@@ -2077,7 +2109,7 @@ static void RedrawAllLightSwitchesAndInvisibleElements()
        if (game.light_time_left == 0)
          Feld[x][y] = getInvisibleFromInvisibleActiveElement(element);
 
-       DrawLevelField(x, y);
+       DrawNewLevelField(x, y);
       }
     }
   }
@@ -2965,7 +2997,16 @@ void StartMoving(int x, int y)
          phase = 7 - phase;
 
        if (IN_SCR_FIELD(SCREENX(x), SCREENY(y)))
+#if 0
          DrawGraphic(SCREENX(x), SCREENY(y), el2gfx(element) + phase);
+#else
+       {
+         int graphic = el2img(element);
+         int frame = getNewGraphicAnimationFrame(graphic, MovDelay[x][y] % 8);
+
+         DrawNewGraphic(SCREENX(x), SCREENY(y), graphic, frame);
+       }
+#endif
 
        if (MovDelay[x][y] % 4 == 3)
        {
@@ -2976,23 +3017,36 @@ void StartMoving(int x, int y)
        }
       }
       else if (element == EL_SP_ELECTRON)
+#if 0
        DrawGraphicAnimation(x, y, GFX2_SP_ELECTRON, 8, 2, ANIM_LOOP);
+#else
+       DrawNewGraphicAnimation(x, y, IMG_SP_ELECTRON);
+#endif
       else if (element == EL_DRAGON)
       {
        int i;
        int dir = MovDir[x][y];
        int dx = (dir == MV_LEFT ? -1 : dir == MV_RIGHT ? +1 : 0);
        int dy = (dir == MV_UP   ? -1 : dir == MV_DOWN  ? +1 : 0);
+#if 0
        int graphic = (dir == MV_LEFT   ? GFX_FLAMMEN_LEFT :
                       dir == MV_RIGHT  ? GFX_FLAMMEN_RIGHT :
                       dir == MV_UP     ? GFX_FLAMMEN_UP :
                       dir == MV_DOWN   ? GFX_FLAMMEN_DOWN : GFX_LEERRAUM);
        int phase = FrameCounter % 2;
+#else
+       int graphic = (dir == MV_LEFT   ? IMG_FLAMES_LEFT1 :
+                      dir == MV_RIGHT  ? IMG_FLAMES_RIGHT1 :
+                      dir == MV_UP     ? IMG_FLAMES_UP1 :
+                      dir == MV_DOWN   ? IMG_FLAMES_DOWN1 : IMG_EMPTY);
+       int frame = getNewGraphicAnimationFrame(graphic, -1);
+#endif
 
        for (i=1; i<=3; i++)
        {
          int xx = x + i*dx, yy = y + i*dy;
          int sx = SCREENX(xx), sy = SCREENY(yy);
+         int flame_graphic = graphic + (i - 1);
 
          if (!IN_LEV_FIELD(xx, yy) ||
              IS_SOLID(Feld[xx][yy]) || Feld[xx][yy] == EL_EXPLOSION)
@@ -3009,13 +3063,17 @@ void StartMoving(int x, int y)
 
            Feld[xx][yy] = EL_FLAMES;
            if (IN_SCR_FIELD(sx, sy))
+#if 0
              DrawGraphic(sx, sy, graphic + phase*3 + i-1);
+#else
+             DrawNewGraphic(sx, sy, flame_graphic, frame);
+#endif
          }
          else
          {
            if (Feld[xx][yy] == EL_FLAMES)
              Feld[xx][yy] = EL_EMPTY;
-           DrawLevelField(xx, yy);
+           DrawNewLevelField(xx, yy);
          }
        }
       }
index 2af73af732b1992e38fac21a3cc2b9b38436dfec..66ce6f42545ebc318dfb113636a7f73a27322144 100644 (file)
@@ -1073,10 +1073,19 @@ static void InitGraphicInfo()
   {
     int *parameter = image_files[i].parameter;
 
-    /* always start with reliable default values */
     new_graphic_info[i].bitmap = getBitmapFromImageID(i);
+
     new_graphic_info[i].src_x = parameter[GFX_ARG_XPOS] * TILEX;
     new_graphic_info[i].src_y = parameter[GFX_ARG_YPOS] * TILEY;
+    new_graphic_info[i].offset_x = parameter[GFX_ARG_OFFSET];
+    new_graphic_info[i].offset_y = 0;
+
+    /* animation frames are ordered vertically instead of horizontally */
+    if (parameter[GFX_ARG_VERTICAL])
+    {
+      new_graphic_info[i].offset_x = 0;
+      new_graphic_info[i].offset_y = parameter[GFX_ARG_OFFSET];
+    }
 
     new_graphic_info[i].anim_frames = parameter[GFX_ARG_FRAMES];
 
@@ -1085,7 +1094,9 @@ static void InitGraphicInfo()
       new_graphic_info[i].anim_delay = 1;
 
     /* set mode for animation frame order */
-    if (parameter[GFX_ARG_MODE_LINEAR])
+    if (parameter[GFX_ARG_MODE_LOOP])
+      new_graphic_info[i].anim_mode = ANIM_LOOP;
+    else 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;
@@ -1102,8 +1113,6 @@ static void InitGraphicInfo()
 
     /* animation synchronized with global frame counter, not move position */
     new_graphic_info[i].anim_global_sync = parameter[GFX_ARG_GLOBAL_SYNC];
-
-    new_graphic_info[i].anim_vertical = parameter[GFX_ARG_VERTICAL];
   }
 
 #if 0
index 0a821b2f429afe78c144317da7a0923e79f3e43f..ceb4964823e5bc7209aa964866fc37b334c58543 100644 (file)
@@ -164,17 +164,19 @@ struct ConfigInfo image_config_suffix[] =
 {
   { ".xpos",                           "0"                     },
   { ".ypos",                           "0"                     },
+  { ".offset",                         "32"                    },
+  { ".vertical",                       "0"                     },
   { ".frames",                         "1"                     },
 #if 0
   { ".start_frame",                    "-1"                    },
 #endif
   { ".delay",                          "1"                     },
+  { ".mode_loop",                      "0"                     },
   { ".mode_linear",                    "0"                     },
   { ".mode_pingpong",                  "0"                     },
   { ".mode_pingpong2",                 "0"                     },
   { ".mode_reverse",                   "0"                     },
   { ".global_sync",                    "0"                     },
-  { ".vertical",                       "0"                     },
 
   { NULL,                              NULL                    }
 };
@@ -805,7 +807,7 @@ struct ConfigInfo image_config[] =
   { "yamyam.xpos",                             "0"                     },
   { "yamyam.ypos",                             "5"                     },
   { "yamyam.frames",                           "4"                     },
-  { "yamyam.mode_pingpong",                    "1"                     },
+  { "yamyam.mode_pingpong2",                   "1"                     },
   { "yamyam.moving",                           "RocksElements.pcx"     },
   { "yamyam.moving.xpos",                      "0"                     },
   { "yamyam.moving.ypos",                      "5"                     },
@@ -815,7 +817,7 @@ struct ConfigInfo image_config[] =
   { "robot.xpos",                              "4"                     },
   { "robot.ypos",                              "5"                     },
   { "robot.frames",                            "4"                     },
-  { "robot.mode_pingpong",                     "1"                     },
+  { "robot.mode_pingpong2",                    "1"                     },
 
   { "robot_wheel",                             "RocksElements.pcx"     },
   { "robot_wheel.xpos",                                "0"                     },
@@ -907,10 +909,12 @@ struct ConfigInfo image_config[] =
   { "acid.splashing_left.xpos",                        "8"                     },
   { "acid.splashing_left.ypos",                        "10"                    },
   { "acid.splashing_left.frames",              "4"                     },
+  { "acid.splashing_left.delay",               "2"                     },
   { "acid.splashing_right",                    "RocksHeroes.pcx"       },
   { "acid.splashing_right.xpos",               "12"                    },
   { "acid.splashing_right.ypos",               "10"                    },
   { "acid.splashing_right.frames",             "4"                     },
+  { "acid.splashing_right.delay",              "2"                     },
 
   { "amoeba_drop",                             "RocksElements.pcx"     },
   { "amoeba_drop.xpos",                                "5"                     },
@@ -1690,7 +1694,7 @@ struct ConfigInfo image_config[] =
   { "dark_yamyam.xpos",                                "8"                     },
   { "dark_yamyam.ypos",                                "11"                    },
   { "dark_yamyam.frames",                      "4"                     },
-  { "dark_yamyam.mode_pingpong",               "1"                     },
+  { "dark_yamyam.mode_pingpong2",              "1"                     },
 
   { "dynabomb.active",                         "RocksElements.pcx"     },
   { "dynabomb.active.xpos",                    "12"                    },
@@ -1954,53 +1958,65 @@ struct ConfigInfo image_config[] =
   { "flames_left1.xpos",                       "8"                     },
   { "flames_left1.ypos",                       "12"                    },
   { "flames_left1.frames",                     "2"                     },
+  { "flames_left1.offset",                     "96"                    },
   { "flames_left2",                            "RocksHeroes.pcx"       },
   { "flames_left2.xpos",                       "9"                     },
   { "flames_left2.ypos",                       "12"                    },
   { "flames_left2.frames",                     "2"                     },
+  { "flames_left2.offset",                     "96"                    },
   { "flames_left3",                            "RocksHeroes.pcx"       },
   { "flames_left3.xpos",                       "10"                    },
   { "flames_left3.ypos",                       "12"                    },
   { "flames_left3.frames",                     "2"                     },
+  { "flames_left3.offset",                     "96"                    },
 
   { "flames_right1",                           "RocksHeroes.pcx"       },
   { "flames_right1.xpos",                      "8"                     },
   { "flames_right1.ypos",                      "13"                    },
   { "flames_right1.frames",                    "2"                     },
+  { "flames_right1.offset",                    "96"                    },
   { "flames_right2",                           "RocksHeroes.pcx"       },
   { "flames_right2.xpos",                      "9"                     },
   { "flames_right2.ypos",                      "13"                    },
   { "flames_right2.frames",                    "2"                     },
+  { "flames_right2.offset",                    "96"                    },
   { "flames_right3",                           "RocksHeroes.pcx"       },
   { "flames_right3.xpos",                      "10"                    },
   { "flames_right3.ypos",                      "13"                    },
   { "flames_right3.frames",                    "2"                     },
+  { "flames_right3.offset",                    "96"                    },
 
   { "flames_up1",                              "RocksHeroes.pcx"       },
   { "flames_up1.xpos",                         "8"                     },
   { "flames_up1.ypos",                         "14"                    },
   { "flames_up1.frames",                       "2"                     },
+  { "flames_up1.offset",                       "96"                    },
   { "flames_up2",                              "RocksHeroes.pcx"       },
   { "flames_up2.xpos",                         "9"                     },
   { "flames_up2.ypos",                         "14"                    },
   { "flames_up2.frames",                       "2"                     },
+  { "flames_up2.offset",                       "96"                    },
   { "flames_up3",                              "RocksHeroes.pcx"       },
   { "flames_up3.xpos",                         "10"                    },
   { "flames_up3.ypos",                         "14"                    },
   { "flames_up3.frames",                       "2"                     },
+  { "flames_up3.offset",                       "96"                    },
 
   { "flames_down1",                            "RocksHeroes.pcx"       },
   { "flames_down1.xpos",                       "8"                     },
   { "flames_down1.ypos",                       "15"                    },
   { "flames_down1.frames",                     "2"                     },
+  { "flames_down1.offset",                     "96"                    },
   { "flames_down2",                            "RocksHeroes.pcx"       },
   { "flames_down2.xpos",                       "9"                     },
   { "flames_down2.ypos",                       "15"                    },
   { "flames_down2.frames",                     "2"                     },
+  { "flames_down2.offset",                     "96"                    },
   { "flames_down3",                            "RocksHeroes.pcx"       },
   { "flames_down3.xpos",                       "10"                    },
   { "flames_down3.ypos",                       "15"                    },
   { "flames_down3.frames",                     "2"                     },
+  { "flames_down3.offset",                     "96"                    },
 
   { "stoneblock",                              "RocksElements.pcx"     },
   { "stoneblock.xpos",                         "10"                    },
index 354ec878d43882a3f22d144508942cf185c42562..0afb5dbbe0c27b02c537939d9e217cc3b6697798 100644 (file)
@@ -30,6 +30,8 @@
 #include "conf_gfx.h"
 #include "conf_snd.h"
 
+#define IMG_EMPTY      IMG_EMPTY_SPACE
+#define IMG_SP_EMPTY   IMG_SP_EMPTY_SPACE
 
 #define WIN_XSIZE      672
 #define WIN_YSIZE      560
 /* values for image configuration suffixes */
 #define GFX_ARG_XPOS                           0
 #define GFX_ARG_YPOS                           1
-#define GFX_ARG_FRAMES                         2
-#define GFX_ARG_DELAY                          3
-#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
+#define GFX_ARG_OFFSET                         2
+#define GFX_ARG_VERTICAL                       3
+#define GFX_ARG_FRAMES                         4
+#define GFX_ARG_DELAY                          5
+#define GFX_ARG_MODE_LOOP                      6
+#define GFX_ARG_MODE_LINEAR                    7
+#define GFX_ARG_MODE_PINGPONG                  8
+#define GFX_ARG_MODE_PINGPONG2                 9
+#define GFX_ARG_MODE_REVERSE                   10
+#define GFX_ARG_GLOBAL_SYNC                    11
 
 /* values for sound configuration suffixes */
 /* (currently none) */
@@ -1574,12 +1578,12 @@ struct GraphicInfo
 struct NewGraphicInfo
 {
   Bitmap *bitmap;
-  int src_x, src_y;
+  int src_x, src_y;            /* derived from (tile sized) .xpos/.ypos */
+  int offset_x, offset_y;      /* x/y offset to next animation frame */
   int anim_frames;
-  int anim_delay;
+  int anim_delay;              /* important: delay of 1 means "no delay"! */
   int anim_mode;
   boolean anim_global_sync;
-  boolean anim_vertical;
 };
 
 extern GC              tile_clip_gc;
index ce6f34b3c886511b42005df2e4a469b021001bb4..37a01c4df16245f65940ec38f9e843476aec4933 100644 (file)
@@ -911,11 +911,11 @@ void DrawNewGraphicExt(DrawBuffer *dst_bitmap, int x, int y, int graphic,
   Bitmap *src_bitmap = new_graphic_info[graphic].bitmap;
   int src_x = new_graphic_info[graphic].src_x;
   int src_y = new_graphic_info[graphic].src_y;
+  int offset_x = new_graphic_info[graphic].offset_x;
+  int offset_y = new_graphic_info[graphic].offset_y;
 
-  if (new_graphic_info[graphic].anim_vertical)
-    src_y += frame * TILEY;
-  else
-    src_x += frame * TILEX;
+  src_x += frame * offset_x;
+  src_y += frame * offset_y;
 
   BlitBitmap(src_bitmap, dst_bitmap, src_x, src_y, TILEX, TILEY, x, y);
 }
@@ -992,11 +992,11 @@ void DrawNewGraphicThruMaskExt(DrawBuffer *d, int dest_x, int dest_y,
   GC drawing_gc = src_bitmap->stored_clip_gc;
   int src_x = new_graphic_info[graphic].src_x;
   int src_y = new_graphic_info[graphic].src_y;
+  int offset_x = new_graphic_info[graphic].offset_x;
+  int offset_y = new_graphic_info[graphic].offset_y;
 
-  if (new_graphic_info[graphic].anim_vertical)
-    src_y += frame * TILEY;
-  else
-    src_x += frame * TILEX;
+  src_x += frame * offset_x;
+  src_y += frame * offset_y;
 
   SetClipOrigin(src_bitmap, drawing_gc, dest_x - src_x, dest_y - src_y);
   BlitBitmapMasked(src_bitmap, d, src_x, src_y, TILEX, TILEY, dest_x, dest_y);
@@ -1196,6 +1196,8 @@ void DrawNewGraphicShifted(int x,int y, int dx,int dy, int graphic, int frame,
   GC drawing_gc;
   int src_x;
   int src_y;
+  int offset_x;
+  int offset_y;
 
   int width = TILEX, height = TILEY;
   int cx = 0, cy = 0;
@@ -1275,11 +1277,11 @@ void DrawNewGraphicShifted(int x,int y, int dx,int dy, int graphic, int frame,
   drawing_gc = src_bitmap->stored_clip_gc;
   src_x = new_graphic_info[graphic].src_x;
   src_y = new_graphic_info[graphic].src_y;
+  offset_x = new_graphic_info[graphic].offset_x;
+  offset_y = new_graphic_info[graphic].offset_y;
 
-  if (new_graphic_info[graphic].anim_vertical)
-    src_y += frame * TILEY;
-  else
-    src_x += frame * TILEX;
+  src_x += frame * offset_x;
+  src_y += frame * offset_y;
 
   src_x += cx;
   src_y += cy;
@@ -3274,7 +3276,7 @@ int el2img(int element)
       break;
   }
 
-  return IMG_EMPTY_SPACE;
+  return IMG_EMPTY;
 #endif
 }