rnd-20100315-3-src
[rocksndiamonds.git] / src / game_sp / Murphy.c
index 849e685cef5cc7df62d96a63a42ed6948f50258b..0bc114ff869a72c15d55aa7342bdbe396a824a78 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,14 +27,8 @@ 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
@@ -54,16 +45,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 +68,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;
@@ -686,7 +670,7 @@ loc_g_62E2:
   dx = aniFramesRedDisk;
   dx1 = aniRedDisk;
   MovLowByte(&RedDiskReleasePhase, 1);
-  Mov(&RedDiskReleaseMurphyPos, *si);             // remember Murphy's location
+  RedDiskReleaseMurphyPos = *si;             // remember Murphy's location
   goto loc_Split;
 
   // ==========================================================================
@@ -755,7 +739,12 @@ loc_g_63C2:
   // ==========================================================================
 
 loc_g_63D3:
+#if 1
+  subSoundFX(*si, fiBase, actDigging);
+#else
   subSoundFXBase();
+#endif
+
   dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyDigUpRight : aniMurphyDigUpLeft);
   PlayField16[*si - FieldWidth] = 0x503;
@@ -781,7 +770,12 @@ loc_g_640B:
   // ==========================================================================
 
 loc_g_641C:
+#if 1
+  subSoundFX(*si, fiBase, actDigging);
+#else
   subSoundFXBase();
+#endif
+
   dx = aniFramesMurphyEatLeft;
   dx1 = aniMurphyDigLeft;
   PlayField16[*si - 1] = 0x203;
@@ -807,7 +801,12 @@ loc_g_6448:
   // ==========================================================================
 
 loc_g_6459:
+#if 1
+  subSoundFX(*si, fiBase, actDigging);
+#else
   subSoundFXBase();
+#endif
+
   dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyDigUpRight : aniMurphyDigUpLeft);
   PlayField16[*si + FieldWidth] = 0x703;
@@ -833,7 +832,12 @@ loc_g_6491:
   // ==========================================================================
 
 loc_g_64A2:
+#if 1
+  subSoundFX(*si, fiBase, actDigging);
+#else
   subSoundFXBase();
+#endif
+
   dx = aniFramesMurphyEatRight;
   dx1 = aniMurphyDigRight;
   PlayField16[*si + 1] = 0x803;
@@ -860,7 +864,12 @@ loc_g_64CE:
 
 loc_g_64DF:
   subCopyImageToScreen(*si, aniMurphyTouchUp);
+#if 1
+  subSoundFX(*si, fiBase, actDigging);
+#else
   subSoundFXBase();
+#endif
+
   dx = aniFramesTouchBase;
   dx1 = aniTouchBase;
   dxPos = *si - FieldWidth;
@@ -886,7 +895,12 @@ loc_g_650C:
 
 loc_g_651D:
   subCopyImageToScreen(*si, aniMurphyTouchLeft);
+#if 1
+  subSoundFX(*si, fiBase, actDigging);
+#else
   subSoundFXBase();
+#endif
+
   dx = aniFramesTouchBase;
   dx1 = aniTouchBase;
   dxPos = *si - 1;
@@ -912,7 +926,12 @@ loc_g_654A:
 
 loc_g_655B:
   subCopyImageToScreen(*si, aniMurphyTouchDown);
+#if 1
+  subSoundFX(*si, fiBase, actDigging);
+#else
   subSoundFXBase();
+#endif
+
   dx = aniFramesTouchBase;
   dx1 = aniTouchBase;
   dxPos = *si + FieldWidth;
@@ -938,7 +957,12 @@ loc_g_6588:
 
 loc_g_6599:
   subCopyImageToScreen(*si, aniMurphyTouchRight);
+#if 1
+  subSoundFX(*si, fiBase, actDigging);
+#else
   subSoundFXBase();
+#endif
+
   dx = aniFramesTouchBase;
   dx1 = aniTouchBase;
   dxPos = *si + 1;
@@ -950,7 +974,12 @@ loc_g_6599:
   // ==========================================================================
 
 loc_g_65C6:
+#if 1
+  subSoundFX(*si, fiInfotron, actCollecting);
+#else
   subSoundFXInfotron();
+#endif
+
   dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
   PlayField16[*si - FieldWidth] = 0x903;
@@ -963,7 +992,12 @@ loc_g_65C6:
   // ==========================================================================
 
 loc_g_65FE:
+#if 1
+  subSoundFX(*si, fiInfotron, actCollecting);
+#else
   subSoundFXInfotron();
+#endif
+
   dx = aniFramesEatInfotronLeft;
   dx1 = aniEatInfotronLeft;
 #if 0
@@ -981,7 +1015,12 @@ loc_g_65FE:
   // ==========================================================================
 
 loc_g_662A:
+#if 1
+  subSoundFX(*si, fiInfotron, actCollecting);
+#else
   subSoundFXInfotron();
+#endif
+
   dx = (MurphyVarFaceLeft == 0 ? aniFramesMurphyEatUpRight : aniFramesMurphyEatUpLeft);
   dx1 = (MurphyVarFaceLeft == 0 ? aniMurphyEatUpRight : aniMurphyEatUpLeft);
   PlayField16[*si + FieldWidth] = 0xB03;
@@ -994,7 +1033,12 @@ loc_g_662A:
   // ==========================================================================
 
 loc_g_6662:
+#if 1
+  subSoundFX(*si, fiInfotron, actCollecting);
+#else
   subSoundFXInfotron();
+#endif
+
   dx = aniFramesEatInfotronRight;
   dx1 = aniEatInfotronRight;
 #if 0
@@ -1013,7 +1057,12 @@ loc_g_6662:
 
 loc_g_668E:
   subCopyImageToScreen(*si, aniMurphyTouchUp);
+#if 1
+  subSoundFX(*si, fiInfotron, actCollecting);
+#else
   subSoundFXInfotron();
+#endif
+
   dx = aniFramesTouchInfotron;
   dx1 = aniTouchInfotron;
   MovHighByte(&PlayField16[*si], 0x14);
@@ -1026,7 +1075,12 @@ loc_g_668E:
 
 loc_g_66C0:
   subCopyImageToScreen(*si, aniMurphyTouchLeft);
+#if 1
+  subSoundFX(*si, fiInfotron, actCollecting);
+#else
   subSoundFXInfotron();
+#endif
+
   dx = aniFramesTouchInfotron;
   dx1 = aniTouchInfotron;
   MovHighByte(&PlayField16[*si], 0x15);
@@ -1039,7 +1093,12 @@ loc_g_66C0:
 
 loc_g_66F2:
   subCopyImageToScreen(*si, aniMurphyTouchDown);
+#if 1
+  subSoundFX(*si, fiInfotron, actCollecting);
+#else
   subSoundFXInfotron();
+#endif
+
   dx = aniFramesTouchInfotron;
   dx1 = aniTouchInfotron;
   MovHighByte(&PlayField16[*si], 0x16);
@@ -1052,7 +1111,12 @@ loc_g_66F2:
 
 loc_g_6724:
   subCopyImageToScreen(*si, aniMurphyTouchRight);
+#if 1
+  subSoundFX(*si, fiInfotron, actCollecting);
+#else
   subSoundFXInfotron();
+#endif
+
   dx = aniFramesTouchInfotron;
   dx1 = aniTouchInfotron;
   MovHighByte(&PlayField16[*si], 0x17);
@@ -1081,7 +1145,12 @@ loc_g_6756:
   game_sp.LevelSolved = TRUE;
 #endif
 
+#if 1
+  subSoundFX(*si, fiExit, actPassing);
+#else
   subSoundFXExit();
+#endif
+
   data_h_DemoDone = 1; // EP set level success bytes
   LevelStatus = 1; // set Level Status DONE
   EP_GameDemoVar0DAA = 0; // force demo for lead-out
@@ -1090,7 +1159,6 @@ loc_g_6756:
     if (UpdateTimeFlag != 0)    // update time?
     {
       UpdatedFlag = 1; // prevent double update
-      subUpdatePlayingTime();    // update playing time
     }
   }
 
@@ -1597,8 +1665,36 @@ locProceedMovingMurphy: // proceed moving murphy
 
   ax = ax - 1;   // next picture of sequence
   MovingPictureSequencePhase = ax;            // store for later
+
   if (ax == 0) // Sound effects
+#if 1
+  {
+    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;
+    }
+  }
+#else
     subSoundFXPush();
+#endif
 
   bl = HighByte(PlayField16[*si]);
   if (bl == 0xE)        // Push Zonk to left
@@ -1942,7 +2038,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 +2052,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 +2066,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 +2082,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 +2096,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 +2110,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 +2124,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 +2138,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;
@@ -2530,8 +2618,12 @@ loc_g_747F:
   PlayField16[*si] = fiMurphy;
   RedDiskReleasePhase = 2;
   RedDiskCount = RedDiskCount - 1;
-  subDisplayRedDiskCount();
+
+#if 1
+  subSoundFX(*si, fiRedDisk, actDropping);
+#else
   subSoundFXPush();                 // Sound effects
+#endif
 } // subAnimateMurphy
 
 // ==========================================================================
@@ -2726,7 +2818,6 @@ static void subEatRedDisk(int si)
   }
 
   RedDiskCount = (RedDiskCount + 1) % 256;
-  subDisplayRedDiskCount();
 }
 
 void subAdjustZonksInfotronsAboveMurphy(int si)