rnd-20100216-1-src
authorHolger Schemel <info@artsoft.org>
Tue, 16 Feb 2010 14:42:38 +0000 (15:42 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:58:31 +0000 (10:58 +0200)
* fixed bug in native Supaplex engine that broke several demo solutions

14 files changed:
ChangeLog
src/conftime.h
src/game_sp/BugsTerminals.c
src/game_sp/DDScrollBuffer.c
src/game_sp/Explosions.c
src/game_sp/Globals.c
src/game_sp/Globals.h
src/game_sp/MainForm.c
src/game_sp/MainGameLoop.c
src/game_sp/Murphy.c
src/game_sp/SnikSnaks.c
src/game_sp/file.c
src/game_sp/main.c
src/game_sp/main_sp.h

index b7f3fff323b9addfcef3204928ca72a6b85ab88e..e5ba1ba1b81331ed7ce93b02a746a430060c7901 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2010-02-16
+       * fixed bug in native Supaplex engine that broke several demo solutions
+
 2010-02-14
        * done integrating R'n'D graphics engine into file "Murphy.c"
        * done integrating R'n'D graphics engine into file "BugsTerminals.c"
index 3b6fdb1824d35abab15e7f0d5cb5a9fb8392b7bd..20908561a4af6a73001b56cec40d3971ab96e731 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2010-02-14 23:30"
+#define COMPILE_DATE_STRING "2010-02-16 15:40"
index f12a1a0b64ce5da8fa6633afc9216235045f0e10..17fc9a0fe459b5f726459ff14aba79f5d8c5a68a 100644 (file)
@@ -29,7 +29,9 @@ int subAnimateBugs(int si)
   // int ax, bx, cx, dx, di;
   // int ah, bh, ch, dh, al, bl, cl, dl;
   // int cx;
+#if 0
   int graphic, sync_frame;
+#endif
   int bl;
 
   if (fiBug != LowByte(PlayField16[si]))
@@ -108,19 +110,32 @@ markDisplay:
 
 #if 1
 
+#if 0
   graphic = (bl == 0  ? aniBugActivating :
             bl == 12 ? aniBugDeactivating :
             bl == 13 ? aniBug : aniBugActive);
   sync_frame = (bl >= 1 && bl <= 11 ? (bl - 1) * 4 : 0) + (TimerVar & 3);
+#endif
 
   // printf("::: %d [%d]\n", sync_frame, gfx.anim_random_frame);
 
+#if 0
   /* a general random frame treatment would be needed for _all_ animations */
+  /* (DONE) */
   if (isRandomAnimation_SP(graphic) &&
       !isNextAnimationFrame_SP(graphic, sync_frame))
     return subAnimateBugs;
+#endif
+
+#if 1
+
+  GfxGraphic[GetX(si)][GetY(si)] = (bl == 0  ? aniBugActivating :
+                                   bl == 12 ? aniBugDeactivating :
+                                   bl == 13 ? aniBug : aniBugActive);
 
+#else
   subCopyAnimToScreen(si, graphic, sync_frame);
+#endif
 
 #else
   subCopyFieldToScreen(si, aniFramesBug[bl]);
@@ -207,7 +222,15 @@ int subAnimateTerminals(int si)
     GfxFrame[lx][ly] += getGraphicInfo_Delay(graphic);
 
 #if 1
+
+#if 1
+
+  GfxGraphic[GetX(si)][GetY(si)] = (bl < 8 ? aniTerminal : aniTerminalActive);
+
+#else
   subCopyAnimToScreen(si, graphic, GfxFrame[lx][ly]);
+#endif
+
 #else
   X = GetStretchX(si);
   Y = GetStretchY(si);
@@ -276,6 +299,9 @@ int subGetRandomNumber()
   int subGetRandomNumber;
 
   long Tmp, RSeed;
+#if 0
+  long Tst;
+#endif
 
   RSeed = (long)(0x7FFF & RandomSeed);
   if (0x8000 == (RandomSeed & 0x8000))
@@ -287,6 +313,15 @@ int subGetRandomNumber()
 #else
   Tmp = 0xFFFF & (((0x5E5 * RandomSeed) & 0xFFFF) + 0x31);
 #endif
+
+#if 0
+  Tst = 0xFFFF & (((0x5E5 * RSeed) & 0xFFFF) + 0x31);
+  printf("::: BugsTerminals.c: subGetRandomNumber(): %d [%ld] [%ld, %ld]\n",
+        RandomSeed, RSeed, Tmp, Tst);
+  if (Tmp != Tst)
+    printf("::: !!!!!!!!!!\n");
+#endif
+
   RandomSeed = 0x7FFF & Tmp;
   if ((Tmp & 0x8000) != 0)
     RandomSeed = RandomSeed | 0x8000;
@@ -305,5 +340,10 @@ int subGetRandomNumber()
         subGetRandomNumber);
 #endif
 
+#if 0
+  printf("::: BugsTerminals.c: subGetRandomNumber(): %d [%ld, %d]\n",
+        subGetRandomNumber, Tmp, RandomSeed);
+#endif
+
   return subGetRandomNumber;
 } // subGetRandomNumber
index 53cc5ea06330f63bd4371ce94fef15c1275fe68b..5a89919c320bc0982be26a0b3d365d535c6f680f 100644 (file)
@@ -185,6 +185,76 @@ void InitScrollPlayfield()
 }
 
 void UpdatePlayfield()
+{
+  int x, y;
+#if 1
+  int num_redrawn = 0;
+#endif
+
+  for (y = DisplayMinY; y <= DisplayMaxY; y++)
+  {
+    for (x = DisplayMinX; x <= DisplayMaxX; x++)
+    {
+      int element = LowByte(PlayField16[GetSI(x, y)]);
+      int graphic = GfxGraphic[x][y];
+      int sync_frame = GfxFrame[x][y];
+#if 1
+      boolean redraw = FALSE;
+#else
+      boolean redraw = TRUE;   // !!! TEST ONLY -- ALWAYS REDRAW !!!
+#endif
+
+      if (graphic < 0)
+       continue;
+
+      if (element != GfxElementLast[x][y] &&
+         graphic == GfxGraphicLast[x][y])
+      {
+       /* element changed, but not graphic => disable updating graphic */
+
+       GfxElementLast[x][y] = element;
+       GfxGraphicLast[x][y] = GfxGraphic[x][y] = -1;
+
+       continue;
+      }
+
+      if (graphic != GfxGraphicLast[x][y])                     // new graphic
+      {
+       redraw = TRUE;
+
+       GfxElementLast[x][y] = element;
+       GfxGraphicLast[x][y] = GfxGraphic[x][y];
+       sync_frame = GfxFrame[x][y] = 0;
+      }
+      else if (isNextAnimationFrame_SP(graphic, sync_frame))   // new frame
+      {
+       redraw = TRUE;
+      }
+
+      if (redraw)
+      {
+       int sx = x * StretchWidth;
+       int sy = y * StretchWidth;
+
+#if 0
+       printf("::: REDRAW (%d, %d): %d, %d\n", x, y, graphic, sync_frame);
+#endif
+
+       StretchedSprites.BltImg(sx, sy, graphic, sync_frame);
+
+#if 1
+       num_redrawn++;
+#endif
+      }
+    }
+  }
+
+#if 0
+  printf("::: FRAME %d: %d redrawn\n", FrameCounter, num_redrawn);
+#endif
+}
+
+void UpdatePlayfield_TMP()
 {
   int x1 = mScrollX_last / TILEX - 2;
   int y1 = mScrollY_last / TILEY - 2;
index 629e4818676b940b7b6879938ec705754ebb6c30..9398d84779d2c8c702f05a54eb984c0c4a10522e 100644 (file)
@@ -30,6 +30,10 @@ int subAnimateExplosion(int si)
     return subAnimateExplosion;
 
   bl = HighByte(PlayField16[si]);
+#if 0
+  printf("::: subAnimateExplosion: %d [%d, %d] [%d]\n",
+        bl, PlayField16[si], si, FrameCounter);
+#endif
   if ((bl & 0x80) != 0) // infotron explosion!
     goto loc_g_28D0;
 
@@ -124,6 +128,10 @@ static void LetExplodeFieldSP(int tsi, int cx, int dh)
     return;
 
   al = LowByte(PlayField16[tsi]);
+#if 0
+  printf("::: LetExplodeFieldSP: got %d [%d, %d] [%d]\n",
+        al, PlayField16[tsi], tsi, FrameCounter);
+#endif
   switch (al)
   {
     case fiHardWare:
@@ -166,6 +174,8 @@ static void LetExplodeFieldSP(int tsi, int cx, int dh)
       PlayField16[tsi] = cx;
       break;
   }
+
+  GfxGraphic[GetX(tsi)][GetY(tsi)] = -1;
 }
 
 static int subExplodeZonk(int tsi, int cx)
index b59125bcd18a86cba6cf14bd24f8862ffc44b962..6cc66efd62eb44baf4892405b9833ec556f3ccc7 100644 (file)
@@ -199,6 +199,51 @@ int aniFramesRedDisk[] = { 20, -1 };
 
 #if 1
 
+int fiGraphic[] =
+{
+  aniSpace,
+  aniZonk,
+  aniBase,
+  aniMurphy,
+  aniInfotron,
+  aniRAM,
+  aniHardWare,
+  aniExit,
+  aniOrangeDisk,
+  aniPortRight,
+  aniPortDown,
+  aniPortLeft,
+  aniPortUp,
+  aniSpPortRight,
+  aniSpPortDown,
+  aniSpPortLeft,
+  aniSpPortUp,
+  aniSnikSnak,
+  aniYellowDisk,
+  aniTerminal,
+  aniRedDisk,
+  aniPortUpAndDown,
+  aniPortLeftAndRight,
+  aniPortAllDirections,
+  aniElectron,
+  aniBug,
+  aniRAMLeft,
+  aniRAMRight,
+  aniHW0,
+  aniHW1,
+  aniHW2,
+  aniHW3,
+  aniHW4,
+  aniHW5,
+  aniHW6,
+  aniHW7,
+  aniHW8,
+  aniHW9,
+  aniRAMTop,
+  aniRAMBottom,
+  aniWallSpace
+};
+
 int getSequenceLength(int sequence)
 {
   switch (sequence)
index 8762565c07b4579740c5be578e488c11d9e9a234..27bbb04ca40661523c539de3afb0295dac769c62 100644 (file)
 
 #define ZoomFactor                     (2)
 
-#define BaseWidth                      (ZoomFactor * 16)
-#define StretchWidth                   (ZoomFactor * 16)
-#define StretchWidth2                  (StretchWidth / 2)
-#define TwoPixels                      (ZoomFactor * 2)
+#define BaseWidth                      (ZoomFactor * 16)
+#define StretchWidth                   (ZoomFactor * 16)
+#define StretchWidth2                  (StretchWidth / 2)
+#define TwoPixels                      (ZoomFactor * 2)
 
 #else
 
-#define BaseWidth                      (16)
-#define StretchWidth                   (16)
-#define StretchWidth2                  (StretchWidth / 2)
-#define TwoPixels                      (2)
+#define BaseWidth                      (16)
+#define StretchWidth                   (16)
+#define StretchWidth2                  (StretchWidth / 2)
+#define TwoPixels                      (2)
 
 #endif
 
 
 #if 1
 
-#define fiSpace                        (0)
-#define fiZonk                                 (1)
-#define fiBase                                 (2)
-#define fiMurphy                       (3)
-#define fiInfotron                     (4)
-#define fiRAM                          (5)
-#define fiHardWare                     (6)
-#define fiExit                                 (7)
-#define fiOrangeDisk                   (8)
-#define fiPortRight                    (9)
-#define fiPortDown                     (10)
-#define fiPortLeft                     (11)
-#define fiPortUp                       (12)
-#define fiSpPortRight                  (13)
-#define fiSpPortDown                   (14)
-#define fiSpPortLeft                   (15)
-#define fiSpPortUp                     (16)
-#define fiSnikSnak                     (17)
-#define fiYellowDisk                   (18)
-#define fiTerminal                     (19)
-#define fiRedDisk                      (20)
-#define fiPortUpAndDown                (21)
-#define fiPortLeftAndRight             (22)
-#define fiPortAllDirections            (23)
-#define fiElectron                     (24)
-#define fiBug                          (25)
-#define fiRAMLeft                      (26)
-#define fiRAMRight                     (27)
-#define fiHWFirst                      (28)
+#define fiSpace                                (0)
+#define fiZonk                         (1)
+#define fiBase                         (2)
+#define fiMurphy                       (3)
+#define fiInfotron                     (4)
+#define fiRAM                          (5)
+#define fiHardWare                     (6)
+#define fiExit                         (7)
+#define fiOrangeDisk                   (8)
+#define fiPortRight                    (9)
+#define fiPortDown                     (10)
+#define fiPortLeft                     (11)
+#define fiPortUp                       (12)
+#define fiSpPortRight                  (13)
+#define fiSpPortDown                   (14)
+#define fiSpPortLeft                   (15)
+#define fiSpPortUp                     (16)
+#define fiSnikSnak                     (17)
+#define fiYellowDisk                   (18)
+#define fiTerminal                     (19)
+#define fiRedDisk                      (20)
+#define fiPortUpAndDown                        (21)
+#define fiPortLeftAndRight             (22)
+#define fiPortAllDirections            (23)
+#define fiElectron                     (24)
+#define fiBug                          (25)
+#define fiRAMLeft                      (26)
+#define fiRAMRight                     (27)
+#define fiHWFirst                      (28)
 #define fiHW0                          (fiHWFirst + 0)         // fiHWFirst
 #define fiHW1                          (fiHWFirst + 1)
 #define fiHW2                          (fiHWFirst + 2)
 #define fiHW7                          (fiHWFirst + 7)
 #define fiHW8                          (fiHWFirst + 8)
 #define fiHW9                          (fiHWFirst + 9)         // fiHWLast
-#define fiHWLast                       (37)
-#define fiRAMTop                       (38)
-#define fiRAMBottom                    (39)
-#define fiWallSpace                    (40)
-#define fiHWTrash1                     (41)
-#define fiHWTrash2                     (42)
-#define fiHWMurphy                     (43)
+#define fiHWLast                       (37)
+#define fiRAMTop                       (38)
+#define fiRAMBottom                    (39)
+#define fiWallSpace                    (40)
+#define fiHWTrash1                     (41)
+#define fiHWTrash2                     (42)
+#define fiHWMurphy                     (43)
 
-#define fiExplosion                    (0x1F)
+#define fiExplosion                    (0x1F)
 
 #else
 
-#define fiBase                                 (2)
-#define fiBug                          (25)
-#define fiElectron                     (24)
-#define fiExit                                 (7)
-#define fiExplosion                    (0x1F)
-#define fiHWFirst                      (28)
-#define fiHWLast                       (37)
-#define fiHWMurphy                     (43)
-#define fiHWTrash1                     (41)
-#define fiHWTrash2                     (42)
-#define fiHardWare                     (6)
-#define fiInfotron                     (4)
-#define fiMurphy                       (3)
-#define fiOrangeDisk                   (8)
-#define fiPortAllDirections            (23)
-#define fiPortDown                     (10)
-#define fiPortLeft                     (11)
-#define fiPortLeftAndRight             (22)
-#define fiPortRight                    (9)
-#define fiPortUp                       (12)
-#define fiPortUpAndDown                (21)
-#define fiRAM                          (5)
-#define fiRAMBottom                    (39)
-#define fiRAMLeft                      (26)
-#define fiRAMRight                     (27)
-#define fiRAMTop                       (38)
-#define fiRedDisk                      (20)
-#define fiSnikSnak                     (17)
-#define fiSpPortDown                   (14)
-#define fiSpPortLeft                   (15)
-#define fiSpPortRight                  (13)
-#define fiSpPortUp                     (16)
-#define fiSpace                        (0)
-#define fiTerminal                     (19)
-#define fiWallSpace                    (40)
-#define fiYellowDisk                   (18)
-#define fiZonk                                 (1)
+#define fiBase                         (2)
+#define fiBug                          (25)
+#define fiElectron                     (24)
+#define fiExit                         (7)
+#define fiExplosion                    (0x1F)
+#define fiHWFirst                      (28)
+#define fiHWLast                       (37)
+#define fiHWMurphy                     (43)
+#define fiHWTrash1                     (41)
+#define fiHWTrash2                     (42)
+#define fiHardWare                     (6)
+#define fiInfotron                     (4)
+#define fiMurphy                       (3)
+#define fiOrangeDisk                   (8)
+#define fiPortAllDirections            (23)
+#define fiPortDown                     (10)
+#define fiPortLeft                     (11)
+#define fiPortLeftAndRight             (22)
+#define fiPortRight                    (9)
+#define fiPortUp                       (12)
+#define fiPortUpAndDown                        (21)
+#define fiRAM                          (5)
+#define fiRAMBottom                    (39)
+#define fiRAMLeft                      (26)
+#define fiRAMRight                     (27)
+#define fiRAMTop                       (38)
+#define fiRedDisk                      (20)
+#define fiSnikSnak                     (17)
+#define fiSpPortDown                   (14)
+#define fiSpPortLeft                   (15)
+#define fiSpPortRight                  (13)
+#define fiSpPortUp                     (16)
+#define fiSpace                                (0)
+#define fiTerminal                     (19)
+#define fiWallSpace                    (40)
+#define fiYellowDisk                   (18)
+#define fiZonk                         (1)
 
 #endif
 
 
 // graphics and animations directly related to file elements
 
-#define aniSpace                       IMG_EMPTY_SPACE
-#define aniZonk                        IMG_SP_ZONK
-#define aniBase                        IMG_SP_BASE
-#define aniMurphy                      IMG_SP_MURPHY
-#define aniInfotron                    IMG_SP_INFOTRON
-#define aniRAM                                 IMG_SP_CHIP_SINGLE
-#define aniHardWare                    IMG_SP_HARDWARE_GRAY
-#define aniExit                        IMG_SP_EXIT_CLOSED
-#define aniOrangeDisk                  IMG_SP_DISK_ORANGE
-#define aniPortRight                   IMG_SP_PORT_RIGHT
-#define aniPortDown                    IMG_SP_PORT_DOWN
-#define aniPortLeft                    IMG_SP_PORT_LEFT
-#define aniPortUp                      IMG_SP_PORT_UP
-#define aniSpPortRight                         IMG_SP_GRAVITY_PORT_RIGHT
-#define aniSpPortDown                  IMG_SP_GRAVITY_PORT_DOWN
-#define aniSpPortLeft                  IMG_SP_GRAVITY_PORT_LEFT
-#define aniSpPortUp                    IMG_SP_GRAVITY_PORT_UP
-#define aniSnikSnak                    IMG_SP_SNIKSNAK
-#define aniYellowDisk                  IMG_SP_DISK_YELLOW
-#define aniTerminal                    IMG_SP_TERMINAL
-#define aniRedDisk                     IMG_SP_DISK_RED
-#define aniPortUpAndDown               IMG_SP_PORT_VERTICAL
-#define aniPortLeftAndRight            IMG_SP_PORT_HORIZONTAL
-#define aniPortAllDirections           IMG_SP_PORT_ANY
-#define aniElectron                    IMG_SP_ELECTRON
-#define aniBug                                 IMG_SP_BUGGY_BASE
-#define aniRAMLeft                     IMG_SP_CHIP_LEFT
-#define aniRAMRight                    IMG_SP_CHIP_RIGHT
-#define aniHWFirst                     IMG_SP_HARDWARE_BASE_1
+#define aniSpace                       IMG_EMPTY_SPACE
+#define aniZonk                                IMG_SP_ZONK
+#define aniBase                                IMG_SP_BASE
+#define aniMurphy                      IMG_SP_MURPHY
+#define aniInfotron                    IMG_SP_INFOTRON
+#define aniRAM                         IMG_SP_CHIP_SINGLE
+#define aniHardWare                    IMG_SP_HARDWARE_GRAY
+#define aniExit                                IMG_SP_EXIT_CLOSED
+#define aniOrangeDisk                  IMG_SP_DISK_ORANGE
+#define aniPortRight                   IMG_SP_PORT_RIGHT
+#define aniPortDown                    IMG_SP_PORT_DOWN
+#define aniPortLeft                    IMG_SP_PORT_LEFT
+#define aniPortUp                      IMG_SP_PORT_UP
+#define aniSpPortRight                 IMG_SP_GRAVITY_PORT_RIGHT
+#define aniSpPortDown                  IMG_SP_GRAVITY_PORT_DOWN
+#define aniSpPortLeft                  IMG_SP_GRAVITY_PORT_LEFT
+#define aniSpPortUp                    IMG_SP_GRAVITY_PORT_UP
+#define aniSnikSnak                    IMG_SP_SNIKSNAK
+#define aniYellowDisk                  IMG_SP_DISK_YELLOW
+#define aniTerminal                    IMG_SP_TERMINAL
+#define aniRedDisk                     IMG_SP_DISK_RED
+#define aniPortUpAndDown               IMG_SP_PORT_VERTICAL
+#define aniPortLeftAndRight            IMG_SP_PORT_HORIZONTAL
+#define aniPortAllDirections           IMG_SP_PORT_ANY
+#define aniElectron                    IMG_SP_ELECTRON
+#define aniBug                         IMG_SP_BUGGY_BASE
+#define aniRAMLeft                     IMG_SP_CHIP_LEFT
+#define aniRAMRight                    IMG_SP_CHIP_RIGHT
+#define aniHWFirst                     IMG_SP_HARDWARE_BASE_1
 #define aniHW0                         IMG_SP_HARDWARE_BASE_1
 #define aniHW1                         IMG_SP_HARDWARE_GREEN
 #define aniHW2                         IMG_SP_HARDWARE_BLUE
 #define aniHW7                         IMG_SP_HARDWARE_BASE_4
 #define aniHW8                         IMG_SP_HARDWARE_BASE_5
 #define aniHW9                         IMG_SP_HARDWARE_BASE_6
-#define aniHWLast                      IMG_SP_HARDWARE_BASE_6
-#define aniRAMTop                      IMG_SP_CHIP_TOP
-#define aniRAMBottom                   IMG_SP_CHIP_BOTTOM
-#define aniWallSpace                   IMG_INVISIBLE_WALL
-#define aniHWTrash1                    
-#define aniHWTrash2                    
-#define aniHWMurphy                    
+#define aniHWLast                      IMG_SP_HARDWARE_BASE_6
+#define aniRAMTop                      IMG_SP_CHIP_TOP
+#define aniRAMBottom                   IMG_SP_CHIP_BOTTOM
+#define aniWallSpace                   IMG_INVISIBLE_WALL
+#define aniHWTrash1                    
+#define aniHWTrash2                    
+#define aniHWMurphy                    
 
 
 // graphics and animations related to in-game animations for element actions
 
 #define aniMurphyDropping              IMG_SP_MURPHY_DROPPING
 
-#define aniMurphySleepLeft             IMG_SP_MURPHY_SLEEPING_LEFT
-#define aniMurphySleepRight            IMG_SP_MURPHY_SLEEPING_RIGHT
-#define aniMurphyTouchLeft             IMG_SP_MURPHY_SNAPPING_LEFT
-#define aniMurphyTouchRight            IMG_SP_MURPHY_SNAPPING_RIGHT
-#define aniMurphyTouchUp               IMG_SP_MURPHY_SNAPPING_UP
-#define aniMurphyTouchDown             IMG_SP_MURPHY_SNAPPING_DOWN
-#define aniMurphyYawn                  IMG_SP_MURPHY_BORING_1
-#define aniPushLeft                    IMG_SP_MURPHY_PUSHING_LEFT
-#define aniPushRight                   IMG_SP_MURPHY_PUSHING_RIGHT
-#define aniPushUpDown                  IMG_SP_MURPHY_PUSHING_RIGHT
+#define aniMurphySleepLeft             IMG_SP_MURPHY_SLEEPING_LEFT
+#define aniMurphySleepRight            IMG_SP_MURPHY_SLEEPING_RIGHT
+#define aniMurphyTouchLeft             IMG_SP_MURPHY_SNAPPING_LEFT
+#define aniMurphyTouchRight            IMG_SP_MURPHY_SNAPPING_RIGHT
+#define aniMurphyTouchUp               IMG_SP_MURPHY_SNAPPING_UP
+#define aniMurphyTouchDown             IMG_SP_MURPHY_SNAPPING_DOWN
+#define aniMurphyYawn                  IMG_SP_MURPHY_BORING_1
+#define aniPushLeft                    IMG_SP_MURPHY_PUSHING_LEFT
+#define aniPushRight                   IMG_SP_MURPHY_PUSHING_RIGHT
+#define aniPushUpDown                  IMG_SP_MURPHY_PUSHING_RIGHT
 
 #define aniBugActivating               IMG_SP_BUGGY_BASE_ACTIVATING
 #define aniBugDeactivating             IMG_SP_BUGGY_BASE_ACTIVATING
 #define aniOrangeDisk                  IMG_SP_DISK_ORANGE
 #define aniRedDisk                     IMG_SP_DISK_RED
 
-#define aniSnikSnakDown                167
-#define aniSnikSnakLeft                239
-#define aniSnikSnakRight               247
-#define aniSnikSnakUp                  159
+#define aniSnikSnakDown                        IMG_SP_SNIKSNAK_DOWN
+#define aniSnikSnakLeft                        IMG_SP_SNIKSNAK_LEFT
+#define aniSnikSnakRight               IMG_SP_SNIKSNAK_RIGHT
+#define aniSnikSnakUp                  IMG_SP_SNIKSNAK_UP
 
 #define aniTerminalActive              IMG_SP_TERMINAL_ACTIVE
 
-#define aniExplosionInfo               (111)
+#define aniExplosionInfo               (111)
 
 #else
 
-#define aniMurphySleepLeft             (71)
-#define aniMurphySleepRight            (68)
-#define aniMurphyTouchDown             (47)
-#define aniMurphyTouchLeft             (95)
-#define aniMurphyTouchRight            (94)
-#define aniMurphyTouchUp               (46)
-#define aniMurphyYawn                  (56)
-#define aniPushLeft                    (45)
-#define aniPushRight                   (44)
-#define aniPushUpDown                  (79)
-
-#define aniSnikSnakDown                (167)
-#define aniSnikSnakLeft                (239)
-#define aniSnikSnakRight               (247)
-#define aniSnikSnakUp                  (159)
+#define aniMurphySleepLeft             (71)
+#define aniMurphySleepRight            (68)
+#define aniMurphyTouchDown             (47)
+#define aniMurphyTouchLeft             (95)
+#define aniMurphyTouchRight            (94)
+#define aniMurphyTouchUp               (46)
+#define aniMurphyYawn                  (56)
+#define aniPushLeft                    (45)
+#define aniPushRight                   (44)
+#define aniPushUpDown                  (79)
+
+#define aniSnikSnakDown                        (167)
+#define aniSnikSnakLeft                        (239)
+#define aniSnikSnakRight               (247)
+#define aniSnikSnakUp                  (159)
 
 #define aniTerminal                    (0x80)
 #define aniTerminalActive              (0x88)
 
-#define aniExplosionInfo               (111)
+#define aniExplosionInfo               (111)
 
 #endif
 
-#define posFrameCorner                         (55)
-#define posFrameHorizontal             (111)
-#define posFrameVertical               (110)
+#define posFrameCorner                 (55)
+#define posFrameHorizontal             (111)
+#define posFrameVertical               (110)
 
 
 #if 1
@@ -304,29 +304,29 @@ extern int *aniYellowDisk, *aniOrangeDisk, *aniRedDisk;
 
 #if 1
 
-#define keyNone                        (0)
-#define keyUp                          (1)
-#define keyLeft                        (2)
-#define keyDown                        (3)
-#define keyRight                       (4)
-#define keySpaceUp                     (5)
-#define keySpaceLeft                   (6)
-#define keySpaceDown                   (7)
-#define keySpaceRight                  (8)
-#define keySpace                       (9)
+#define keyNone                                (0)
+#define keyUp                          (1)
+#define keyLeft                                (2)
+#define keyDown                                (3)
+#define keyRight                       (4)
+#define keySpaceUp                     (5)
+#define keySpaceLeft                   (6)
+#define keySpaceDown                   (7)
+#define keySpaceRight                  (8)
+#define keySpace                       (9)
 
 #else
 
-#define keyDown                        (3)
-#define keyLeft                        (2)
-#define keyNone                        (0)
-#define keyRight                       (4)
-#define keySpace                       (9)
-#define keySpaceDown                   (7)
-#define keySpaceLeft                   (6)
-#define keySpaceRight                  (8)
-#define keySpaceUp                     (5)
-#define keyUp                          (1)
+#define keyDown                                (3)
+#define keyLeft                                (2)
+#define keyNone                                (0)
+#define keyRight                       (4)
+#define keySpace                       (9)
+#define keySpaceDown                   (7)
+#define keySpaceLeft                   (6)
+#define keySpaceRight                  (8)
+#define keySpaceUp                     (5)
+#define keyUp                          (1)
 
 #endif
 
@@ -344,6 +344,8 @@ extern void ReadLevel();
 extern int getSequenceLength(int sequence);
 extern boolean isSnappingSequence(int sequence);
 
+extern int fiGraphic[];
+
 extern boolean Alignments;
 extern boolean BlockingSpeed;
 extern boolean Cracked;
index 9ee82353ac76f8e22d6ce2e6d8c72eca30aa57ce..1c93dc26e7627ceddfb38fc49cc6d57b975e0154 100644 (file)
@@ -3161,7 +3161,7 @@ void DrawField(int X, int Y)
 
   tsi = GetSI(X, Y);
   Tmp = LowByte(PlayField16[tsi]);
-  if (40 < Tmp)
+  if (Tmp > 40)
     Tmp = 0;
 
   if (Tmp == fiRAM || Tmp == fiHardWare)
@@ -3172,11 +3172,23 @@ void DrawField(int X, int Y)
 
   if (EditFlag)
   {
-    if (fiOrangeDisk < Tmp && Tmp < fiSnikSnak)
+    if (Tmp > fiOrangeDisk && Tmp < fiSnikSnak)
       Tmp = DisPlayField[tsi];
   }
 
+#if 1
+  if (Tmp >= 0 && Tmp <= 40)
+  {
+    subCopyImageToScreen(tsi, fiGraphic[Tmp]);
+
+#if 1
+    if (Tmp != fiSpace && Tmp != fiSnikSnak && Tmp != fiElectron)
+      GfxGraphic[X][Y] = fiGraphic[Tmp];
+#endif
+  }
+#else
   StretchedSprites.BltEx(StretchWidth * X, StretchWidth * Y, Tmp);
+#endif
 }
 
 void DrawFieldAnimated(int X, int Y)
@@ -3216,15 +3228,23 @@ void DrawFieldNoAnimated(int X, int Y)
   switch (Tmp)
   {
     case fiSnikSnak:
+#if 1
+      subCopyImageToScreen(tsi, aniSpace);
+#else
       StretchedSprites.BltEx(StretchWidth * X, StretchWidth * Y, fiSpace);
+#endif
       break;
 
     case fiElectron:
+#if 1
+      subCopyImageToScreen(tsi, aniSpace);
+#else
       StretchedSprites.BltEx(StretchWidth * X, StretchWidth * Y, fiSpace);
+#endif
       break;
 
     default:
-      if (40 < Tmp)
+      if (Tmp > 40)
         Tmp = 0;
 
       if (Tmp == fiRAM || Tmp == fiHardWare)
@@ -3235,7 +3255,7 @@ void DrawFieldNoAnimated(int X, int Y)
 
       if (EditFlag)
       {
-        if (fiOrangeDisk < Tmp && Tmp < fiSnikSnak)
+        if (Tmp > fiOrangeDisk && Tmp < fiSnikSnak)
           Tmp = DisPlayField[tsi];
       }
 
@@ -3245,7 +3265,20 @@ void DrawFieldNoAnimated(int X, int Y)
               X, Y, Tmp);
 #endif
 
+#if 1
+      if (Tmp >= 0 && Tmp <= 40)
+      {
+       subCopyImageToScreen(tsi, fiGraphic[Tmp]);
+
+#if 1
+       if (Tmp != fiSpace && Tmp != fiSnikSnak && Tmp != fiElectron)
+         GfxGraphic[X][Y] = fiGraphic[Tmp];
+#endif
+      }
+#else
       StretchedSprites.BltEx(StretchWidth * X, StretchWidth * Y, Tmp);
+#endif
+
       break;
   }
 }
index 38f76fc7f6a1f7b760f5f1fd3a96ba4122f27171..60a479db7c6ec9056ce2541e7743139efa34222d 100644 (file)
@@ -599,6 +599,8 @@ int subCalculateScreenScrollPos()
   if (ExplosionShake != 0)
   {
     subGetRandomNumber();
+
+    // printf("::: ExplosionShake [%d]\n", FrameCounter);
   }
 
   {
index ff03ea27091dcce2321efc97d0223848134792c3..e104a5c7d1b4b4d3fd8f32010d941363dd2e58fa 100644 (file)
@@ -1161,7 +1161,11 @@ loc_g_6817:
 
 #if 1
   // draw new terminal type
+#if 1
+  GfxGraphic[GetX(*si - FieldWidth)][GetY(*si - FieldWidth)] = aniTerminalActive;
+#else
   subCopyImageToScreen(*si - FieldWidth, aniTerminalActive);
+#endif
 #else
   subCopyFieldToScreen(*si - FieldWidth, 0x88); // draw new terminal type
 #endif
@@ -1183,7 +1187,11 @@ loc_g_684E:
 
 #if 1
   // draw new terminal type
+#if 1
+  GfxGraphic[GetX(*si - 1)][GetY(*si - 1)] = aniTerminalActive;
+#else
   subCopyImageToScreen(*si - 1, aniTerminalActive);
+#endif
 #else
   subCopyFieldToScreen(*si - 1, 0x88); // draw new terminal type
 #endif
@@ -1205,7 +1213,11 @@ loc_g_6884:
 
 #if 1
   // draw new terminal type
+#if 1
+  GfxGraphic[GetX(*si + FieldWidth)][GetY(*si + FieldWidth)] = aniTerminalActive;
+#else
   subCopyImageToScreen(*si + FieldWidth, aniTerminalActive);
+#endif
 #else
   subCopyFieldToScreen(*si + FieldWidth, 0x88); // draw new terminal type
 #endif
@@ -1227,7 +1239,11 @@ loc_g_68BA:
 
 #if 1
   // draw new terminal type
+#if 1
+  GfxGraphic[GetX(*si + 1)][GetY(*si + 1)] = aniTerminalActive;
+#else
   subCopyImageToScreen(*si + 1, aniTerminalActive);
+#endif
 #else
   subCopyFieldToScreen(*si + 1, 0x88); // draw new terminal type
 #endif
@@ -1697,6 +1713,8 @@ loc_g_6C8F:
 
 #if 1
     StretchedSprites.BltImg(X, Y, dx1, Tmp);
+    GfxGraphic[GetX(*si)][GetY(*si)] = -1;     // (Murphy's position)
+    GfxGraphic[GetX(dxPos)][GetY(dxPos)] = -1; // (snapping position)
     // printf("::: Tmp: %d\n", Tmp);
 #else
     StretchedSprites.BltEx(X, Y, dx[Tmp]);
index 465431849745f3e91430e891b56eba2114c94dcc..d7b11e175dfe5300b99e231d5c45dbc43346c96b 100644 (file)
@@ -34,6 +34,12 @@ int subAnimateSnikSnaks(int si)
   if (SnikSnaksElectronsFrozen == 1)
     return subAnimateSnikSnaks;
 
+#if 1
+  /* (not sure why this was removed -- this broke several level solutions) */
+  if (LowByte(PlayField16[si]) != fiSnikSnak)
+    return subAnimateSnikSnaks;
+#endif
+
   //  If LowByte(PlayField16(si)) <> fiSnikSnak Then Exit Function
   // Debug.Assert (LowByte(PlayField16[si]) == fiSnikSnak);
   bx = HighByte(PlayField16[si]);
@@ -119,7 +125,7 @@ static int subSnikSnakTurnLeft(int si, int bx)
   static int subSnikSnakTurnLeft;
 
   // int ax, ah, bl, dx, X, Y;
-  int ax, ah, bl, X, Y;
+  int ax, ah, bl;
 
   ax = (TimerVar & 3);
   if (ax != 0)
@@ -130,11 +136,16 @@ static int subSnikSnakTurnLeft(int si, int bx)
     return subSnikSnakTurnLeft;
   } // loc_g_75E0:
 
+#if 1
+  subDrawSnikSnakTurnLeft(si, bx);
+#else
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
   X = GetStretchX(si);
   Y = GetStretchY(si);
   StretchedSprites.BltEx(X, Y, aniFramesSnikSnak[bx]);
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
+#endif
+
   bx = (bx + 1) & 0x7;
   MovHighByte(&PlayField16[si], bx);
   return subSnikSnakTurnLeft;
@@ -243,7 +254,7 @@ static int subSnikSnakTurnRight(int si, int bx)
   static int subSnikSnakTurnRight;
 
   // int ax, ah, bl, dx, X, Y;
-  int ax, ah, bl, X, Y;
+  int ax, ah, bl;
 
   ax = (TimerVar & 3);
   if (ax != 0)
@@ -254,11 +265,16 @@ static int subSnikSnakTurnRight(int si, int bx)
     return subSnikSnakTurnRight;
   } // loc_g_76DB:
 
+#if 1
+  subDrawSnikSnakTurnRight(si, bx);
+#else
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
   X = GetStretchX(si);
   Y = GetStretchY(si);
   StretchedSprites.BltEx(X, Y, aniFramesSnikSnak[0x10 - bx]);
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
+#endif
+
   bx = ((bx + 1) & 0x7) | 8;
   MovHighByte(&PlayField16[si], bx);
   return subSnikSnakTurnRight;
@@ -367,8 +383,12 @@ static int subSnikSnakFromBelow(int si, int bx)
   static int subSnikSnakFromBelow;
 
   // int ax, ah, bl, dx, X, Y;
-  int ax, bl, X, Y;
+  int ax, bl;
 
+#if 1
+  subDrawSnikSnakFromBelow(si, bx);
+  bx = bx - 0xF;  // get and increment sequence#
+#else
   bx = bx - 0xF;  // get and increment sequence#
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
   X = GetStretchX(si);
@@ -376,6 +396,8 @@ static int subSnikSnakFromBelow(int si, int bx)
   StretchedSprites.BltEx(X, Y, 0);
   StretchedSprites.BltEx(X, Y - bx * TwoPixels, aniSnikSnakUp + bx);
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
+#endif
+
   bl = LowByte(bx);
   if (bl == 7 && LowByte(PlayField16[si + FieldWidth]) != fiExplosion)
   {
@@ -430,8 +452,12 @@ static int subSnikSnakFromRight(int si, int bx)
   static int subSnikSnakFromRight;
 
   // int ax, ah, bl, dx, X, Y;
-  int ax, bl, X, Y;
+  int ax, bl;
 
+#if 1
+  subDrawSnikSnakFromRight(si, bx);
+  bx = bx - 0x17;  // get and increment sequence#
+#else
   bx = bx - 0x17;  // get and increment sequence#
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
   X = GetStretchX(si + 1);
@@ -439,6 +465,8 @@ static int subSnikSnakFromRight(int si, int bx)
   StretchedSprites.BltEx(X, Y, 0);
   StretchedSprites.BltEx(X - bx * TwoPixels, Y, aniSnikSnakLeft + bx);
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
+#endif
+
   bl = LowByte(bx);
   if (bl == 7 && LowByte(PlayField16[si + 1]) != fiExplosion)
   {
@@ -492,8 +520,12 @@ static int subSnikSnakFromAbove(int si, int bx)
   static int subSnikSnakFromAbove;
 
   // int ax, ah, bl, dx, X, Y;
-  int ax, bl, X, Y;
+  int ax, bl;
 
+#if 1
+  subDrawSnikSnakFromAbove(si, bx);
+  bx = bx - 0x1F;  // get and increment sequence#
+#else
   bx = bx - 0x1F;  // get and increment sequence#
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
   X = GetStretchX(si);
@@ -501,6 +533,8 @@ static int subSnikSnakFromAbove(int si, int bx)
   StretchedSprites.BltEx(X, Y, 0);
   StretchedSprites.BltEx(X, Y + bx * TwoPixels, aniSnikSnakDown + bx);
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
+#endif
+
   bl = LowByte(bx);
   if (bl == 7 && LowByte(PlayField16[si - FieldWidth]) != fiExplosion)
   {
@@ -554,8 +588,12 @@ static int subSnikSnakFromLeft(int si, int bx)
   static int subSnikSnakFromLeft;
 
   // int ax, ah, bl, dx, X, Y;
-  int ax, bl, X, Y;
+  int ax, bl;
 
+#if 1
+  subDrawSnikSnakFromLeft(si, bx);
+  bx = bx - 0x27;  // get and increment sequence#
+#else
   bx = bx - 0x27;  // get and increment sequence#
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
   X = GetStretchX(si - 1);
@@ -563,6 +601,8 @@ static int subSnikSnakFromLeft(int si, int bx)
   StretchedSprites.BltEx(X, Y, 0);
   StretchedSprites.BltEx(X + bx * TwoPixels, Y, aniSnikSnakRight + bx);
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
+#endif
+
   bl = LowByte(bx);
   if (bl == 7 && LowByte(PlayField16[si - 1]) != fiExplosion)
   {
@@ -651,8 +691,13 @@ static int subDrawSnikSnakFromBelow(int si, int bx)
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
   X = GetStretchX(si);
   Y = GetStretchY(si + FieldWidth);
+#if 1
+  StretchedSprites.BltImg(X, Y, aniSpace, 0);
+  StretchedSprites.BltImg(X, Y - bx * TwoPixels, aniSnikSnakUp, bx);
+#else
   StretchedSprites.BltEx(X, Y, 0);
   StretchedSprites.BltEx(X, Y - bx * TwoPixels, aniSnikSnakUp + bx);
+#endif
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
 
   return subDrawSnikSnakFromBelow;
@@ -668,8 +713,13 @@ static int subDrawSnikSnakFromRight(int si, int bx)
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
   X = GetStretchX(si + 1);
   Y = GetStretchY(si);
+#if 1
+  StretchedSprites.BltImg(X, Y, aniSpace, 0);
+  StretchedSprites.BltImg(X - bx * TwoPixels, Y, aniSnikSnakLeft, bx);
+#else
   StretchedSprites.BltEx(X, Y, 0);
   StretchedSprites.BltEx(X - bx * TwoPixels, Y, aniSnikSnakLeft + bx);
+#endif
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
 
   return subDrawSnikSnakFromRight;
@@ -685,8 +735,13 @@ static int subDrawSnikSnakFromAbove(int si, int bx)
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
   X = GetStretchX(si);
   Y = GetStretchY(si - FieldWidth);
+#if 1
+  StretchedSprites.BltImg(X, Y, aniSpace, 0);
+  StretchedSprites.BltImg(X, Y + bx * TwoPixels, aniSnikSnakDown, bx);
+#else
   StretchedSprites.BltEx(X, Y, 0);
   StretchedSprites.BltEx(X, Y + bx * TwoPixels, aniSnikSnakDown + bx);
+#endif
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
 
   return subDrawSnikSnakFromAbove;
@@ -702,8 +757,13 @@ static int subDrawSnikSnakFromLeft(int si, int bx)
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
   X = GetStretchX(si - 1);
   Y = GetStretchY(si);
+#if 1
+  StretchedSprites.BltImg(X, Y, aniSpace, 0);
+  StretchedSprites.BltImg(X + bx * TwoPixels, Y, aniSnikSnakRight, bx);
+#else
   StretchedSprites.BltEx(X, Y, 0);
   StretchedSprites.BltEx(X + bx * TwoPixels, Y, aniSnikSnakRight + bx);
+#endif
   // +++++++++++++++++++++++++++++++++++++++++++++++++++++
 
   return subDrawSnikSnakFromLeft;
index 0d09e22e37b098e07c5d67ac8750c7d0167ec062..40ffacb35738d5bef3479c718614c97cd74de874 100644 (file)
@@ -69,9 +69,19 @@ void copyInternalEngineVars_SP()
 
   PlayField8 = REDIM_1D(sizeof(byte), 0, FileMax + 1 - 1);
   DisPlayField = REDIM_1D(sizeof(byte), 0, FieldMax + 1 - 1);
+#if 0
   PlayField16 = REDIM_1D(sizeof(int), -FieldWidth, FieldMax);
+#else
+  PlayField16 = REDIM_1D(sizeof(int), -FieldWidth * 2, FieldMax);
+#endif
+
+#if 1
 
 #if 1
+  /* fill preceding playfield buffer zone with (indestructible) "hardware" */
+  for (i = -FieldWidth * 2; i < -FieldWidth; i++)
+    PlayField16[i] = 0x20;
+#endif
 
 #if 0
   /* fill preceding playfield buffer zone with (indestructible) "hardware" */
index 1e874354a0e870e6fd2c96eb2db814cd557b2bb6..38e54a364c238537c3472fe3c576c6a60ee01722 100644 (file)
@@ -6,6 +6,10 @@
 struct GameInfo_SP game_sp_info;
 struct LevelInfo_SP native_sp_level;
 
+
+int GfxElementLast[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
+int GfxGraphicLast[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
+int GfxGraphic[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
 int GfxFrame[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
 
 
@@ -21,8 +25,15 @@ void InitGameEngine_SP()
   menBorder.Checked = setup.sp_show_border_elements;
 
   for (x = 0; x < SP_MAX_PLAYFIELD_WIDTH; x++)
+  {
     for (y = 0; y < SP_MAX_PLAYFIELD_HEIGHT; y++)
+    {
+      GfxElementLast[x][y] = -1;
+      GfxGraphicLast[x][y] = -1;
+      GfxGraphic[x][y] = -1;
       GfxFrame[x][y] = 0;
+    }
+  }
 
   InitScrollPlayfield();
 
@@ -68,7 +79,7 @@ void GameActions_SP(byte action[MAX_PLAYERS], boolean warp_mode)
 
   RedrawPlayfield_SP(FALSE);
 
-  for (x = 0; x < SP_MAX_PLAYFIELD_WIDTH; x++)
-    for (y = 0; y < SP_MAX_PLAYFIELD_HEIGHT; y++)
+  for (x = DisplayMinX; x <= DisplayMaxX; x++)
+    for (y = DisplayMinY; y <= DisplayMaxY; y++)
       GfxFrame[x][y]++;
 }
index 8aa3f7fc705ffa018db01a24c2e4f81b894bdb66..ff3035a483dd0c2a20ef6f8af10f7f09f1a7ad31 100644 (file)
@@ -70,6 +70,9 @@ extern Bitmap *screenBitmap;
 
 extern Bitmap *sp_objects;
 
+extern int GfxElementLast[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
+extern int GfxGraphicLast[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
+extern int GfxGraphic[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];
 extern int GfxFrame[SP_MAX_PLAYFIELD_WIDTH][SP_MAX_PLAYFIELD_HEIGHT];