rocksndiamonds-3.3.0.0
[rocksndiamonds.git] / src / game_sp / Murphy.c
index 849e685cef5cc7df62d96a63a42ed6948f50258b..06cd9f7d4c9fc77c6e3bc0ebb9dc90bfeb89c093 100644 (file)
@@ -4,13 +4,10 @@
 
 #include "Murphy.h"
 
+
 static void subEatRedDisk(int si);
 static boolean subMoveKillsMurphy(int si, int ax, int bl);
 
-// static char *VB_Name = "modMurphy";
-
-// --- Option Explicit
-
 #if 1
 
 #define LocalStretch                   (2)
@@ -30,19 +27,12 @@ static boolean subMoveKillsMurphy(int si, int ax, int bl);
 
 void subAnimateMurphy(int *si)
 {
-  // int ax, al, ah, bx, bl, i, X, Y;
-  // int tX, tY, tDeltaX, tDeltaY, tPos, Tmp;
-#if 1
   int ax, al, bl, i, X, Y;
   int time1, time2;
-#else
-  int ax, al, bx, bl, i, X, Y;
-#endif
   int tDeltaX, tDeltaY, tPos, Tmp;
 
   // Variables that hold information about the animation sequence
-  static int *dx = 0; // an array of image positions in moving.mpx, finalized with -1
-  static int dx1 = 0; // same as "*dx" above, but as image/animation token
+  static int dx1 = 0; // image/animation token
   static int dx2 = 0; // an additional image position of a second sprite, for instance: yellow disk if pushed
   static int MurphyDX = 0, MurphyDY = 0; // murphys move steps
   static int SeqPos = 0; // index into dx()
@@ -54,16 +44,6 @@ void subAnimateMurphy(int *si)
   ax = PlayField16[*si];
   al = LowByte(ax);
 
-#if 0
-  printf("::: Murphy.c: subAnimateMurphy(): %d [%d, %d] %d, %d [%d]\n",
-        *si, *si % 60, *si / 60, ax, al, (al == fiMurphy));
-#endif
-
-#if 0
-  printf("::: Murphy.c: subAnimateMurphy(): %d [%d] [%d]\n",
-        YawnSleepCounter, FrameCounter, TimerVar);
-#endif
-
   if (al != fiMurphy)
   {
     MurphyMoveCounter = 0;             // We have no Murphy! Exit!
@@ -87,11 +67,14 @@ void subAnimateMurphy(int *si)
   dx2 = -1;
   SeqPos = 0;
   // end of FS
+
   ScratchGravity = 0; // scratch gravity off
   if (GravityFlag != 0) // Gravity? (1=gravity on)
   {
     bl = LowByte(PlayField16[*si - FieldWidth]); // check above
-    if (! (bl == fiPortUp || bl == fiPortUpAndDown || bl == fiPortAllDirections))
+    if (! (bl == fiPortUp ||
+          bl == fiPortUpAndDown ||
+          bl == fiPortAllDirections))
     {
       if (PlayField16[*si + FieldWidth] == 0) // gravity on and space below!
         ScratchGravity = 1;
@@ -102,10 +85,6 @@ void subAnimateMurphy(int *si)
   if (bl != 0) // a key was pressed!
     goto locKeyPressed5FCF;
 
-#if 0
-  printf("::: Murphy.c: !!! %d [%d]\n", DemoKeyCode, GravityFlag);
-#endif
-
   RedDiskReleaseFlag = 1;
   if (ScratchGravity != 0) // gravity pulls & space below?'-> force Space up to down
   {
@@ -683,10 +662,9 @@ loc_g_62E2:
 
   MovHighByte(&PlayField16[*si], 0x2A);
   MovingPictureSequencePhase = 0x40; // init picture move sequence
-  dx = aniFramesRedDisk;
   dx1 = aniRedDisk;
   MovLowByte(&RedDiskReleasePhase, 1);
-  Mov(&RedDiskReleaseMurphyPos, *si);             // remember Murphy's location
+  RedDiskReleaseMurphyPos = *si;             // remember Murphy's location
   goto loc_Split;
 
   // ==========================================================================
@@ -694,7 +672,6 @@ loc_g_62E2:
   // ==========================================================================
 
 loc_g_6312:
-  dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyMoveUpRight : aniMurphyMoveUpLeft);
   PlayField16[*si - FieldWidth] = 0x103;
   PlayField16[*si] = 0x300;
@@ -706,7 +683,6 @@ loc_g_6312:
   // ==========================================================================
 
 loc_g_6341:
-  dx = aniFramesMurphyEatLeft;
   dx1 = aniMurphyMoveLeft;
   PlayField16[*si - 1] = 0x203;
   PlayField16[*si] = 0x300;
@@ -718,7 +694,6 @@ loc_g_6341:
   // ==========================================================================
 
 loc_g_6364:
-  dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyMoveUpRight : aniMurphyMoveUpLeft);
   PlayField16[*si + FieldWidth] = 0x303;
   PlayField16[*si] = 0x300;
@@ -730,7 +705,6 @@ loc_g_6364:
   // ==========================================================================
 
 loc_g_6399:
-  dx = aniFramesMurphyEatRight;
   dx1 = aniMurphyMoveRight;
   PlayField16[*si + 1] = 0x403;
   PlayField16[*si] = 0x300;
@@ -755,8 +729,8 @@ loc_g_63C2:
   // ==========================================================================
 
 loc_g_63D3:
-  subSoundFXBase();
-  dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
+  subSoundFX(*si, fiBase, actDigging);
+
   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyDigUpRight : aniMurphyDigUpLeft);
   PlayField16[*si - FieldWidth] = 0x503;
   PlayField16[*si] = 0x300;
@@ -781,8 +755,8 @@ loc_g_640B:
   // ==========================================================================
 
 loc_g_641C:
-  subSoundFXBase();
-  dx = aniFramesMurphyEatLeft;
+  subSoundFX(*si, fiBase, actDigging);
+
   dx1 = aniMurphyDigLeft;
   PlayField16[*si - 1] = 0x203;
   PlayField16[*si] = 0x300;
@@ -807,8 +781,8 @@ loc_g_6448:
   // ==========================================================================
 
 loc_g_6459:
-  subSoundFXBase();
-  dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
+  subSoundFX(*si, fiBase, actDigging);
+
   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyDigUpRight : aniMurphyDigUpLeft);
   PlayField16[*si + FieldWidth] = 0x703;
   PlayField16[*si] = 0x300;
@@ -833,8 +807,8 @@ loc_g_6491:
   // ==========================================================================
 
 loc_g_64A2:
-  subSoundFXBase();
-  dx = aniFramesMurphyEatRight;
+  subSoundFX(*si, fiBase, actDigging);
+
   dx1 = aniMurphyDigRight;
   PlayField16[*si + 1] = 0x803;
   PlayField16[*si] = 0x300;
@@ -860,8 +834,8 @@ loc_g_64CE:
 
 loc_g_64DF:
   subCopyImageToScreen(*si, aniMurphyTouchUp);
-  subSoundFXBase();
-  dx = aniFramesTouchBase;
+  subSoundFX(*si, fiBase, actDigging);
+
   dx1 = aniTouchBase;
   dxPos = *si - FieldWidth;
   MovHighByte(&PlayField16[*si], 0x10);
@@ -886,8 +860,8 @@ loc_g_650C:
 
 loc_g_651D:
   subCopyImageToScreen(*si, aniMurphyTouchLeft);
-  subSoundFXBase();
-  dx = aniFramesTouchBase;
+  subSoundFX(*si, fiBase, actDigging);
+
   dx1 = aniTouchBase;
   dxPos = *si - 1;
   MovHighByte(&PlayField16[*si], 0x11);
@@ -912,8 +886,8 @@ loc_g_654A:
 
 loc_g_655B:
   subCopyImageToScreen(*si, aniMurphyTouchDown);
-  subSoundFXBase();
-  dx = aniFramesTouchBase;
+  subSoundFX(*si, fiBase, actDigging);
+
   dx1 = aniTouchBase;
   dxPos = *si + FieldWidth;
   MovHighByte(&PlayField16[*si], 0x12);
@@ -938,8 +912,8 @@ loc_g_6588:
 
 loc_g_6599:
   subCopyImageToScreen(*si, aniMurphyTouchRight);
-  subSoundFXBase();
-  dx = aniFramesTouchBase;
+  subSoundFX(*si, fiBase, actDigging);
+
   dx1 = aniTouchBase;
   dxPos = *si + 1;
   MovHighByte(&PlayField16[*si], 0x13);
@@ -950,8 +924,8 @@ loc_g_6599:
   // ==========================================================================
 
 loc_g_65C6:
-  subSoundFXInfotron();
-  dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
+  subSoundFX(*si, fiInfotron, actCollecting);
+
   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
   PlayField16[*si - FieldWidth] = 0x903;
   PlayField16[*si] = 0x300;
@@ -963,8 +937,8 @@ loc_g_65C6:
   // ==========================================================================
 
 loc_g_65FE:
-  subSoundFXInfotron();
-  dx = aniFramesEatInfotronLeft;
+  subSoundFX(*si, fiInfotron, actCollecting);
+
   dx1 = aniEatInfotronLeft;
 #if 0
   dx2 = fiInfotron;
@@ -981,8 +955,8 @@ loc_g_65FE:
   // ==========================================================================
 
 loc_g_662A:
-  subSoundFXInfotron();
-  dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
+  subSoundFX(*si, fiInfotron, actCollecting);
+
   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
   PlayField16[*si + FieldWidth] = 0xB03;
   PlayField16[*si] = 0x300;
@@ -994,8 +968,8 @@ loc_g_662A:
   // ==========================================================================
 
 loc_g_6662:
-  subSoundFXInfotron();
-  dx = aniFramesEatInfotronRight;
+  subSoundFX(*si, fiInfotron, actCollecting);
+
   dx1 = aniEatInfotronRight;
 #if 0
   dx2 = fiInfotron;
@@ -1013,8 +987,8 @@ loc_g_6662:
 
 loc_g_668E:
   subCopyImageToScreen(*si, aniMurphyTouchUp);
-  subSoundFXInfotron();
-  dx = aniFramesTouchInfotron;
+  subSoundFX(*si, fiInfotron, actCollecting);
+
   dx1 = aniTouchInfotron;
   MovHighByte(&PlayField16[*si], 0x14);
   MovHighByte(&PlayField16[*si - FieldWidth], 0xFF);
@@ -1026,8 +1000,8 @@ loc_g_668E:
 
 loc_g_66C0:
   subCopyImageToScreen(*si, aniMurphyTouchLeft);
-  subSoundFXInfotron();
-  dx = aniFramesTouchInfotron;
+  subSoundFX(*si, fiInfotron, actCollecting);
+
   dx1 = aniTouchInfotron;
   MovHighByte(&PlayField16[*si], 0x15);
   MovHighByte(&PlayField16[*si - 1], 0xFF);
@@ -1039,8 +1013,8 @@ loc_g_66C0:
 
 loc_g_66F2:
   subCopyImageToScreen(*si, aniMurphyTouchDown);
-  subSoundFXInfotron();
-  dx = aniFramesTouchInfotron;
+  subSoundFX(*si, fiInfotron, actCollecting);
+
   dx1 = aniTouchInfotron;
   MovHighByte(&PlayField16[*si], 0x16);
   MovHighByte(&PlayField16[*si + FieldWidth], 0xFF);
@@ -1052,8 +1026,8 @@ loc_g_66F2:
 
 loc_g_6724:
   subCopyImageToScreen(*si, aniMurphyTouchRight);
-  subSoundFXInfotron();
-  dx = aniFramesTouchInfotron;
+  subSoundFX(*si, fiInfotron, actCollecting);
+
   dx1 = aniTouchInfotron;
   MovHighByte(&PlayField16[*si], 0x17);
   MovHighByte(&PlayField16[*si + 1], 0xFF);
@@ -1072,34 +1046,18 @@ loc_g_6756:
   if (LowByte(InfotronsNeeded) != 0)
     return;
 
-#if 1
+#if 0
   if (!game_sp.LevelSolved)
-    printf("::: Murphy.c: !!!!!!!!!! LEVEL %d SOLVED !!!!!!!!!!\n",LevelNumber);
+    printf("::: Murphy.c: !!!!!!!!!! LEVEL %d SOLVED !!!!!!!!!!\n", level_nr);
 #endif
 
 #if 1
   game_sp.LevelSolved = TRUE;
 #endif
 
-  subSoundFXExit();
-  data_h_DemoDone = 1; // EP set level success bytes
-  LevelStatus = 1; // set Level Status DONE
-  EP_GameDemoVar0DAA = 0; // force demo for lead-out
-  if (SavedGameFlag == 0) // saved game running?
-  {
-    if (UpdateTimeFlag != 0)    // update time?
-    {
-      UpdatedFlag = 1; // prevent double update
-      subUpdatePlayingTime();    // update playing time
-    }
-  }
-
-#if 0
-  subUpdateHallOfFame(); // update time + Hall-Of-Fame
-#endif
+  subSoundFX(*si, fiExit, actPassing);
 
   LeadOutCounter = 0x40;          // quit: start lead-out
-  dx = aniFramesMurphyExit;
   dx1 = aniMurphyExit;
   MovHighByte(&PlayField16[*si], 0xD);
   goto loc_StopNoSplit;
@@ -1115,7 +1073,6 @@ loc_g_679B:
 
   MovHighByte(&PlayField16[*si - 2], 1);
   subCopyImageToScreen(*si, aniPushLeft); // draw pushing murphy
-  dx = aniFramesZonkRollLeft;
   dx1 = aniZonkRollLeft;
   dxPos = *si - 1;
   dx2 = aniPushLeft;
@@ -1138,7 +1095,6 @@ loc_g_67D4:
 
   MovHighByte(&PlayField16[*si + 2], 1);
   subCopyImageToScreen(*si, aniPushRight); // draw pushing murphy
-  dx = aniFramesZonkRollRight;
   dx1 = aniZonkRollRight;
   dxPos = *si + 1;
   dx2 = aniPushRight;
@@ -1271,7 +1227,6 @@ loc_g_6916:
   if (PlayField16[*si - 2 * FieldWidth] != 0)
     return;
 
-  dx = aniFramesSplitUpDown;
   dx1 = aniSplitUpDown;
   dx2Step = -FieldWidth;
   PlayField16[*si] = 0x1803;
@@ -1286,7 +1241,6 @@ loc_g_693A:
   if (PlayField16[*si - 2] != 0)
     return;
 
-  dx = aniFramesMurphyEatLeft;
   dx1 = aniMurphyMoveLeft;
   dx2Step = -1;
   PlayField16[*si] = 0x1903;
@@ -1301,7 +1255,6 @@ loc_g_695E:
   if (PlayField16[*si + 2 * FieldWidth] != 0)
     return;
 
-  dx = aniFramesSplitUpDown;
   dx1 = aniSplitUpDown;
   dx2Step = FieldWidth;
   PlayField16[*si] = 0x1A03;
@@ -1316,7 +1269,6 @@ loc_g_6982:
   if (PlayField16[*si + 2] != 0)
     return;
 
-  dx = aniFramesMurphyEatRight;
   dx1 = aniMurphyMoveRight;
   dx2Step = 1;
   PlayField16[*si] = 0x1B03;
@@ -1332,7 +1284,6 @@ loc_StopSplit:
   // ==========================================================================
 
 loc_g_69A6:
-  dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
   PlayField16[*si] = 0x1C03;
   PlayField16[*si - FieldWidth] = 0x300;
@@ -1343,7 +1294,6 @@ loc_g_69A6:
   // ==========================================================================
 
 loc_g_69CE:
-  dx = aniFramesMurphyEatLeft;
   dx1 = aniMurphyEatLeft;
   PlayField16[*si] = 0x300; // !!!!!! this time we move murphy at sequence-start!
   PlayField16[*si - 1] = 0x1D03;
@@ -1355,7 +1305,6 @@ loc_g_69CE:
   // ==========================================================================
 
 loc_g_69F7:
-  dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
   PlayField16[*si] = 0x1E03;
   PlayField16[*si + FieldWidth] = 0x300;
@@ -1366,8 +1315,7 @@ loc_g_69F7:
   // ==========================================================================
 
 loc_g_6A1F:
-  //  dx = aniFramesMurphyEatRightRedDisk 'this sequence is 9 steps long!
-  dx = aniFramesMurphyEatRight;
+  //  dx = aniMurphyEatRightRedDisk 'this sequence is 9 steps long!
   dx1 = aniMurphyEatRight;
   // --------------------------------------------------------------------------
   // BugFix
@@ -1380,13 +1328,8 @@ loc_g_6A1F:
   // Remember that this is not the real bug-fix, but we must live with
   // this existing bug and correct for the consequences of it.
 
-#if 1
-  if (0 == AllowEatRightRedDiskBug) // Murphy's screen x-position
+  if (AllowEatRightRedDiskBug == 0) // Murphy's screen x-position
     MurphyScreenXPos = MurphyScreenXPos - 2 * MurphyZoomFactor;
-#else
-  if (0 == AllowEatRightRedDiskBug) // Murphy's screen x-position
-    MurphyScreenXPos = MurphyScreenXPos - 2;
-#endif
 
   SeqPos = -1;
   // FS: for me this means to blit the first animation frame twice
@@ -1402,7 +1345,6 @@ loc_g_6A1F:
   // ==========================================================================
 
 loc_g_6A48:
-  dx = aniFramesTouchRedDisk;
   dx1 = aniTouchRedDisk;
   MovHighByte(&PlayField16[*si], 0x20);
   MovHighByte(&PlayField16[*si - FieldWidth], 3);
@@ -1413,7 +1355,6 @@ loc_g_6A48:
   // ==========================================================================
 
 loc_g_6A64:
-  dx = aniFramesTouchRedDisk;
   dx1 = aniTouchRedDisk;
   MovHighByte(&PlayField16[*si], 0x21);
   MovHighByte(&PlayField16[*si - 1], 3);
@@ -1424,7 +1365,6 @@ loc_g_6A64:
   // ==========================================================================
 
 loc_g_6A80:
-  dx = aniFramesTouchRedDisk;
   dx1 = aniTouchRedDisk;
   MovHighByte(&PlayField16[*si], 0x22);
   MovHighByte(&PlayField16[*si + FieldWidth], 3);
@@ -1435,7 +1375,6 @@ loc_g_6A80:
   // ==========================================================================
 
 loc_g_6A9C:
-  dx = aniFramesTouchRedDisk;
   dx1 = aniTouchRedDisk;
   MovHighByte(&PlayField16[*si], 0x23);
   MovHighByte(&PlayField16[*si + 1], 3);
@@ -1453,22 +1392,12 @@ loc_g_6AB8:
     return;
 
   PlayField16[*si - 2 * FieldWidth] = 0x1200;
-#if 0
-  subCopyImageToScreen(*si, aniPushRight);
-#endif
-  dx = aniFramesYellowDisk;
   dx1 = aniYellowDisk;
   dxPos = *si - FieldWidth;
-#if 1
   dx2 = (MurphyVarFaceLeft == 0 ? aniPushRight : aniPushLeft);
-#else
-  dx2 = aniPushUpDown;
-#endif
   dx2Step = FieldWidth;
   PlayField16[*si] = 0x2403;
-#if 1
   subCopyImageToScreen(*si, dx2);
-#endif
   goto loc_MoveNoSplit;
 
   // ==========================================================================
@@ -1481,7 +1410,6 @@ loc_g_6AF1:
 
   PlayField16[*si - 2] = 0x1200;
   subCopyImageToScreen(*si, aniPushLeft);
-  dx = aniFramesYellowDisk;
   dx1 = aniYellowDisk;
   dxPos = *si - 1;
   dx2 = aniPushLeft;
@@ -1498,22 +1426,12 @@ loc_g_6B2A:
     return;
 
   PlayField16[*si + 2 * FieldWidth] = 0x1200;
-#if 0
-  subCopyImageToScreen(*si, aniPushRight);
-#endif
-  dx = aniFramesYellowDisk;
   dx1 = aniYellowDisk;
   dxPos = *si + FieldWidth;
-#if 1
   dx2 = (MurphyVarFaceLeft == 0 ? aniPushRight : aniPushLeft);
-#else
-  dx2 = aniPushUpDown;
-#endif
   dx2Step = -FieldWidth;
   PlayField16[*si] = 0x2703;
-#if 1
   subCopyImageToScreen(*si, dx2);
-#endif
   goto loc_MoveNoSplit;
 
   // ==========================================================================
@@ -1526,7 +1444,6 @@ loc_g_6B63:
 
   PlayField16[*si + 2] = 0x1200;
   subCopyImageToScreen(*si, aniPushRight);
-  dx = aniFramesYellowDisk;
   dx1 = aniYellowDisk;
   dxPos = *si + 1;
   dx2 = aniPushRight;
@@ -1544,7 +1461,6 @@ loc_g_6B9B:
 
   PlayField16[*si - 2] = 0x800;
   subCopyImageToScreen(*si, aniPushLeft);
-  dx = aniFramesOrangeDisk;
   dx1 = aniOrangeDisk;
   dxPos = *si - 1;
   dx2 = aniPushLeft;
@@ -1565,7 +1481,6 @@ loc_g_6BD3:
 
   PlayField16[*si + 2] = 0x100;
   subCopyImageToScreen(*si, aniPushRight);
-  dx = aniFramesOrangeDisk;
   dx1 = aniOrangeDisk;
   dxPos = *si + 1;
   dx2 = aniPushRight;
@@ -1597,8 +1512,32 @@ locProceedMovingMurphy: // proceed moving murphy
 
   ax = ax - 1;   // next picture of sequence
   MovingPictureSequencePhase = ax;            // store for later
+
   if (ax == 0) // Sound effects
-    subSoundFXPush();
+  {
+    switch (HighByte(PlayField16[*si]))
+    {
+      case 0xE:
+      case 0xF:
+       subSoundFX(*si, fiZonk, actPushing);
+       break;
+
+      case 0x28:
+      case 0x29:
+       subSoundFX(*si, fiOrangeDisk, actPushing);
+       break;
+
+      case 0x24:
+      case 0x25:
+      case 0x26:
+      case 0x27:
+       subSoundFX(*si, fiYellowDisk, actPushing);
+       break;
+
+      default:
+       break;
+    }
+  }
 
   bl = HighByte(PlayField16[*si]);
   if (bl == 0xE)        // Push Zonk to left
@@ -1645,51 +1584,11 @@ loc_g_6C8F:
   {
     // ++++++++++++++++++++++++++
     // Begin of normal movement
-#if 1
     MurphyScreenXPos = MurphyScreenXPos + MurphyDX * MurphyZoomFactor;
     MurphyScreenYPos = MurphyScreenYPos + MurphyDY * MurphyZoomFactor;
-#else
-    MurphyScreenXPos = MurphyScreenXPos + MurphyDX;
-    MurphyScreenYPos = MurphyScreenYPos + MurphyDY;
-#endif
-
-
-#if 0
-  printf("::: %04d [%03ld, %02d] ----------> %s [%d] [%d, %d] [%d, %d] [%d]\n",
-        TimerVar,
-        DemoOffset - DemoPointer, DemoKeyRepeatCounter,
-        (DemoKeyCode == keyNone        ? "(none)"              :
-         DemoKeyCode == keyLeft        ? "left"                :
-         DemoKeyCode == keyRight       ? "right"               :
-         DemoKeyCode == keyUp          ? "up"                  :
-         DemoKeyCode == keyDown        ? "down"                :
-         DemoKeyCode == keySpace       ? "space"               :
-         DemoKeyCode == keySpaceLeft   ? "space + left"        :
-         DemoKeyCode == keySpaceRight  ? "space + right"       :
-         DemoKeyCode == keySpaceUp     ? "space + up"          :
-         DemoKeyCode == keySpaceDown   ? "space + down"        : "(unknown)"),
-        DemoKeyCode,
-        MurphyScreenXPos, MurphyScreenYPos,
-        MurphyPosIndex % 60, MurphyPosIndex / 60,
-        ClearPos);
-#endif
 
-#if 0
-  Delay(500);
-#endif
-
-#if 1
     if (!(ClearPos < 0)) // clear field that murphy is leaving
       subCopyImageToScreen(ClearPos, aniSpace);
-#else
-    if (! ClearPos < 0) // clear field that murphy is leaving
-      subCopyFieldToScreen(ClearPos, 0);
-#endif
-
-#if 0
-    printf("::: ---------------> %d, %d [%d, %d]\n",
-          MurphyScreenXPos, MurphyScreenYPos, MurphyDX, MurphyDY);
-#endif
 
 #if 0
     // !!! special two-tile animation currently not used !!!
@@ -1715,7 +1614,7 @@ loc_g_6C8F:
 #endif
 
 #if 1
-    StretchedSprites.BltImg(X, Y, dx1, Tmp);
+    DDSpriteBuffer_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);
@@ -1723,11 +1622,7 @@ loc_g_6C8F:
     StretchedSprites.BltEx(X, Y, dx[Tmp]);
 #endif
 
-#if 1
     if (!(dx2 < 0))
-#else
-    if (! dx2 < 0)
-#endif
     {
       tPos = dxPos + dx2Step;
       X = GetStretchX(tPos);
@@ -1741,13 +1636,8 @@ loc_g_6C8F:
       else // pushing something
 #endif
       {
-#if 1
        // (SeqPos iterates from 0 to 7 while pushing)
-        StretchedSprites.BltImg(X + tDeltaX, Y + tDeltaY, dx2, SeqPos);
-       // printf("::: SeqPos: %d\n", SeqPos);
-#else
-        StretchedSprites.BltEx(X + tDeltaX, Y + tDeltaY, dx2);
-#endif
+        DDSpriteBuffer_BltImg(X + tDeltaX, Y + tDeltaY, dx2, SeqPos);
       }
     }
 
@@ -1758,33 +1648,20 @@ loc_g_6C8F:
   {
     // ++++++++++++++++++++++++++++++++
     // Begin of split movement (port)
-#if 1
     MurphyScreenXPos = MurphyScreenXPos + 2 * MurphyDX * MurphyZoomFactor;
     MurphyScreenYPos = MurphyScreenYPos + 2 * MurphyDY * MurphyZoomFactor;
-#else
-    MurphyScreenXPos = MurphyScreenXPos + 2 * MurphyDX;
-    MurphyScreenYPos = MurphyScreenYPos + 2 * MurphyDY;
-#endif
     subCopyImageToScreen(ClearPos, aniSpace); // clear the field that murphy leaves
     tDeltaX = MurphyDX * LocalStretch * (SeqPos + 1);
     tDeltaY = MurphyDY * LocalStretch * (SeqPos + 1);
     X = GetStretchX(dxPos) + tDeltaX;
     Y = GetStretchY(dxPos) + tDeltaY;
-#if 1
-    StretchedSprites.BltImg(X, Y, dx1, SeqPos); // plot first murphy
-#else
-    StretchedSprites.BltEx(X, Y, dx[SeqPos]); // plot first murphy
-#endif
+    DDSpriteBuffer_BltImg(X, Y, dx1, SeqPos); // plot first murphy
+
     tPos = dxPos + dx2Step;
     X = GetStretchX(tPos);
     Y = GetStretchY(tPos);
-#if 1
-    StretchedSprites.BltImg(X + tDeltaX, Y + tDeltaY, dx1, SeqPos); // plot second murphy
-    StretchedSprites.BltImg(X, Y, fiGraphic[LowByte(PlayField16[tPos])], 0); // replot the port on top
-#else
-    StretchedSprites.BltEx(X + tDeltaX, Y + tDeltaY, dx[SeqPos]); // plot second murphy
-    StretchedSprites.BltEx(X, Y, LowByte(PlayField16[tPos])); // replot the port on top
-#endif
+    DDSpriteBuffer_BltImg(X + tDeltaX, Y + tDeltaY, dx1, SeqPos); // plot second murphy
+    DDSpriteBuffer_BltImg(X, Y, fiGraphic[LowByte(PlayField16[tPos])], 0); // replot the port on top
     // End of split movement (port)
     // ------------------------------
   } // loc_g_6D1E:'loc_g_6D28:
@@ -1942,7 +1819,6 @@ loc_g_6EBA:
   if (0 < LowByte(InfotronsNeeded))
     InfotronsNeeded = InfotronsNeeded - 1;
 
-  subDisplayInfotronsNeeded();
 loc_g_6EC8: // space, base
   PlayField16[*si] = fiMurphy;
   subAdjustZonksInfotronsAboveMurphy(*si + FieldWidth);
@@ -1957,7 +1833,6 @@ loc_g_6ED8:
   if (0 < LowByte(InfotronsNeeded))
     InfotronsNeeded = InfotronsNeeded - 1;
 
-  subDisplayInfotronsNeeded();
 loc_g_6EE6: // space, base
   PlayField16[*si] = fiMurphy;
   subAdjustZonksInfotronsAboveMurphy(*si + 1);
@@ -1972,7 +1847,6 @@ loc_g_6EF6:
   if (0 < LowByte(InfotronsNeeded))
     InfotronsNeeded = InfotronsNeeded - 1;
 
-  subDisplayInfotronsNeeded();
 loc_g_6F04: // space, base
   if (LowByte(PlayField16[*si - FieldWidth]) != fiExplosion)
     PlayField16[*si - FieldWidth] = 0;
@@ -1989,7 +1863,6 @@ loc_g_71B6:
   if (0 < LowByte(InfotronsNeeded))
     InfotronsNeeded = InfotronsNeeded - 1;
 
-  subDisplayInfotronsNeeded();
 loc_g_71C4: // space, base
   subAdjustZonksInfotronsAboveMurphy(*si - 1);
   PlayField16[*si] = fiMurphy;
@@ -2004,7 +1877,6 @@ loc_g_71D4:
   if (0 < LowByte(InfotronsNeeded))
     InfotronsNeeded = InfotronsNeeded - 1;
 
-  subDisplayInfotronsNeeded();
 loc_g_71E2: // base
   if (LowByte(PlayField16[*si - FieldWidth]) != fiExplosion)
     PlayField16[*si - FieldWidth] = 0;
@@ -2019,7 +1891,6 @@ loc_g_71F0:
   if (0 < LowByte(InfotronsNeeded))
     InfotronsNeeded = InfotronsNeeded - 1;
 
-  subDisplayInfotronsNeeded();
 loc_g_71FE: // base
   if (LowByte(PlayField16[*si - 1]) != fiExplosion)
     PlayField16[*si - 1] = 0;
@@ -2034,7 +1905,6 @@ loc_g_720C:
   if (0 < LowByte(InfotronsNeeded))
     InfotronsNeeded = InfotronsNeeded - 1;
 
-  subDisplayInfotronsNeeded();
 loc_g_721A: // base
   if (LowByte(PlayField16[*si + FieldWidth]) != fiExplosion)
     PlayField16[*si + FieldWidth] = 0;
@@ -2049,7 +1919,6 @@ loc_g_7228:
   if (0 < LowByte(InfotronsNeeded))
     InfotronsNeeded = InfotronsNeeded - 1;
 
-  subDisplayInfotronsNeeded();
 loc_g_7236: // base
   if (LowByte(PlayField16[*si + 1]) != fiExplosion)
     PlayField16[*si + 1] = 0;
@@ -2248,12 +2117,8 @@ loc_g_716E:
   }
   else if (MovingPictureSequencePhase == 0x20)
   {
-#if 1
     // anxious murphy, dropping red disk
     subCopyImageToScreen(*si, aniMurphyDropping);
-#else
-    subCopyFieldToScreen(*si, 43);  // anxious murphy
-#endif
     RedDiskReleasePhase = 1;
   }
 
@@ -2530,8 +2395,8 @@ loc_g_747F:
   PlayField16[*si] = fiMurphy;
   RedDiskReleasePhase = 2;
   RedDiskCount = RedDiskCount - 1;
-  subDisplayRedDiskCount();
-  subSoundFXPush();                 // Sound effects
+
+  subSoundFX(*si, fiRedDisk, actDropping);
 } // subAnimateMurphy
 
 // ==========================================================================
@@ -2628,76 +2493,24 @@ loc_g_753F:
 // The 10-port data base is at data_h_0D28, 10 entries of 6 bytes each:
 // (hi),(lo),(gravity),(freeze zonks),(freeze enemies),(unused)
 // ==========================================================================
-int subSpPortTest(int si)
-{
-  int subSpPortTest;
-
-  int i, cx, bx;
 
-#if 1
-  cx = LInfo.SpecialPortCount; // number of special ports
+void subSpPortTest(int si)
+{
+  int i;
 
-  for (i = 0; i < cx; i++)
+  for (i = 0; i < LInfo.SpecialPortCount; i++)
   {
-#if 1
-    /* this assumes that PortLocation is stored as big endian */
-    bx = LInfo.SpecialPort[i].PortLocation;
-#else
-    /* this assumes that PortLocation is stored as little endian */
-    bx = HighByte(LInfo.SpecialPort[i].PortLocation);
-    MovHighByte(&bx, LowByte(LInfo.SpecialPort[i].PortLocation));
-#endif
-
-    if (bx / 2 == si)
+    if (LInfo.SpecialPort[i].PortLocation / 2 == si)
     {
-      GravityFlag = LInfo.SpecialPort[i].Gravity;
-      FreezeZonks = LInfo.SpecialPort[i].FreezeZonks;
+      GravityFlag              = LInfo.SpecialPort[i].Gravity;
+      FreezeZonks              = LInfo.SpecialPort[i].FreezeZonks;
       SnikSnaksElectronsFrozen = LInfo.SpecialPort[i].FreezeEnemies;
 
-      // RandomTime = RandomTime Xor RandomSeed 'is RandomTime used at all? no!
-
       break;
     }
   }
-
-#else
-
-  cx = LInfo.SpecialPortCount; // number of special ports
-  for (i = 1; i <= cx; i++)
-  {
-    {
-      bx = HighByte(LInfo.SpecialPort[i].PortLocation);
-      MovHighByte(&bx, LowByte(LInfo.SpecialPort[i].PortLocation));
-      if (bx / 2 == si)
-      {
-        GravityFlag = LInfo.SpecialPort[i].Gravity;
-        FreezeZonks = LInfo.SpecialPort[i].FreezeZonks;
-        SnikSnaksElectronsFrozen = LInfo.SpecialPort[i].FreezeEnemies;
-        //        RandomTime = RandomTime Xor RandomSeed 'is RandomTime used at all? no!
-        i = cx + 1;
-      }
-    }
-  }
-#endif
-
-  return subSpPortTest;
-} // subSpPortTest
-
-#if 0
-
-void subCopyFieldToScreen(int si, int fi)
-{
-  int X, Y;
-
-  // +++++++++++++++++++++++++++++++++++++++++
-  X = GetStretchX(si);
-  Y = GetStretchY(si);
-  StretchedSprites.BltEx(X, Y, fi);
-  // +++++++++++++++++++++++++++++++++++++++++
 }
 
-#endif
-
 void subCopyAnimToScreen(int si, int graphic, int sync_frame)
 {
   int X, Y;
@@ -2705,7 +2518,7 @@ void subCopyAnimToScreen(int si, int graphic, int sync_frame)
   // +++++++++++++++++++++++++++++++++++++++++
   X = GetStretchX(si);
   Y = GetStretchY(si);
-  StretchedSprites.BltImg(X, Y, graphic, sync_frame);
+  DDSpriteBuffer_BltImg(X, Y, graphic, sync_frame);
   // +++++++++++++++++++++++++++++++++++++++++
 }
 
@@ -2726,7 +2539,6 @@ static void subEatRedDisk(int si)
   }
 
   RedDiskCount = (RedDiskCount + 1) % 256;
-  subDisplayRedDiskCount();
 }
 
 void subAdjustZonksInfotronsAboveMurphy(int si)
@@ -2776,4 +2588,4 @@ loc_g_15E8: // zonk/infotron above right
     MovHighByte(&PlayField16[si - FieldWidth + 1], 0x50); // make roll left
     PlayField16[si - FieldWidth] = 0x8888;
   }
-} // subAdjustZonksInfotronsAboveMurphy
+}