rnd-20100210-1-src
authorHolger Schemel <info@artsoft.org>
Tue, 9 Feb 2010 23:30:20 +0000 (00:30 +0100)
committerHolger Schemel <info@artsoft.org>
Sat, 30 Aug 2014 08:58:26 +0000 (10:58 +0200)
src/conftime.h
src/game_sp/BugsTerminals.c
src/game_sp/Globals.h
src/game_sp/Murphy.c
src/game_sp/Murphy.h

index 22c49103e61c1670998d39cf4981cd6848c4b5b2..e4ae1e55234cda8434d5606b2adcd4c75bb96284 100644 (file)
@@ -1 +1 @@
-#define COMPILE_DATE_STRING "2010-02-07 16:03"
+#define COMPILE_DATE_STRING "2010-02-10 00:26"
index 191ce52e25207f19f44d837e52f92e55ad8e3d0b..70aa7b64b6d34d2bf8b08fb924d5b44e824d221e 100644 (file)
@@ -113,12 +113,13 @@ int subAnimateTerminals(int si)
   if (game.use_native_sp_graphics_engine)
     GfxFrame[lx][ly]--;
 
   if (game.use_native_sp_graphics_engine)
     GfxFrame[lx][ly]--;
 
+  /* get last random animation delay */
   bl = HighByte(PlayField16[si]);
   if ((bl & 0x80) == 0x80)
     bl = (bl | 0xFF00);
 
   bl = bl + 1;
   bl = HighByte(PlayField16[si]);
   if ((bl & 0x80) == 0x80)
     bl = (bl | 0xFF00);
 
   bl = bl + 1;
-  if (bl <= 0)
+  if (bl <= 0)         /* return if random animation delay not yet reached */
   {
     MovHighByte(&PlayField16[si], bl);
 
   {
     MovHighByte(&PlayField16[si], bl);
 
@@ -130,8 +131,11 @@ int subAnimateTerminals(int si)
 #endif
   }
 
 #endif
   }
 
+  /* calculate new random animation delay */
   bl = -(subGetRandomNumber() & TerminalMaxCycles); // generate new random number
   MovHighByte(&PlayField16[si], bl); // save new sequence#
   bl = -(subGetRandomNumber() & TerminalMaxCycles); // generate new random number
   MovHighByte(&PlayField16[si], bl); // save new sequence#
+
+  /* check terminal state (active or inactive) */
   bl = TerminalState[si] + 1;
   if (bl == 8)
   {
   bl = TerminalState[si] + 1;
   if (bl == 8)
   {
index 7a618ed9d6588618979f1f126eb5e0beff0143a7..dcf6c799ecdf4d12a26feb1dc30d5ef9dd72163e 100644 (file)
 #endif
 
 #define aniExplosionInfo               (111)
 #endif
 
 #define aniExplosionInfo               (111)
+
+#if 1
+
+#define aniMurphy                      (IMG_SP_MURPHY)
+
+#define aniMurphySleepLeft             (IMG_SP_MURPHY_SLEEPING_LEFT)
+#define aniMurphySleepRight            (IMG_SP_MURPHY_SLEEPING_RIGHT)
+#define aniMurphyTouchDown             (IMG_SP_MURPHY_SNAPPING_DOWN)
+#define aniMurphyTouchLeft             (IMG_SP_MURPHY_SNAPPING_LEFT)
+#define aniMurphyTouchRight            (IMG_SP_MURPHY_SNAPPING_RIGHT)
+#define aniMurphyTouchUp               (IMG_SP_MURPHY_SNAPPING_UP)
+#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 aniSnikSnakDown                (167)
+#define aniSnikSnakLeft                (239)
+#define aniSnikSnakRight               (247)
+#define aniSnikSnakUp                  (159)
+
+#else
+
 #define aniMurphySleepLeft             (71)
 #define aniMurphySleepRight            (68)
 #define aniMurphyTouchDown             (47)
 #define aniMurphySleepLeft             (71)
 #define aniMurphySleepRight            (68)
 #define aniMurphyTouchDown             (47)
 #define aniPushLeft                    (45)
 #define aniPushRight                   (44)
 #define aniPushUpDown                  (79)
 #define aniPushLeft                    (45)
 #define aniPushRight                   (44)
 #define aniPushUpDown                  (79)
+
 #define aniSnikSnakDown                (167)
 #define aniSnikSnakLeft                (239)
 #define aniSnikSnakRight               (247)
 #define aniSnikSnakUp                  (159)
 
 #define aniSnikSnakDown                (167)
 #define aniSnikSnakLeft                (239)
 #define aniSnikSnakRight               (247)
 #define aniSnikSnakUp                  (159)
 
+#endif
+
 #define fiBase                                 (2)
 #define fiBug                          (25)
 #define fiElectron                     (24)
 #define fiBase                                 (2)
 #define fiBug                          (25)
 #define fiElectron                     (24)
index c50ecb87f68273d4a3b38d95e1f1bbf3c5ec4cf6..b00aef58f70eb9bb4b41ee1d5f36525146b368fc 100644 (file)
@@ -34,7 +34,12 @@ int subAnimateMurphy(int *si)
 
   // int ax, al, ah, bx, bl, i, X, Y;
   // int tX, tY, tDeltaX, tDeltaY, tPos, Tmp;
 
   // 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;
   int ax, al, bx, bl, i, X, Y;
+#endif
   int tDeltaX, tDeltaY, tPos, Tmp;
 
   // Variables that hold information about the animation sequence
   int tDeltaX, tDeltaY, tPos, Tmp;
 
   // Variables that hold information about the animation sequence
@@ -54,6 +59,11 @@ int subAnimateMurphy(int *si)
         *si, *si % 60, *si / 60, ax, al, (al == fiMurphy));
 #endif
 
         *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!
   if (al != fiMurphy)
   {
     MurphyMoveCounter = 0;             // We have no Murphy! Exit!
@@ -99,6 +109,96 @@ int subAnimateMurphy(int *si)
     goto loc_g_6364;
   }
 
     goto loc_g_6364;
   }
 
+#if 1
+
+#if 0
+  ax = (TimerVar & 3);
+  if (ax != 0)
+    return subAnimateMurphy;
+#endif
+
+  // ------------------------------------------------------------------
+  // Murphy's YAWN & SLEEP sequence, counted down by YawnSleepCounter:
+
+  YawnSleepCounter = YawnSleepCounter + 1;
+
+  if (YawnSleepCounter < 16)
+    return subAnimateMurphy;
+
+  if (YawnSleepCounter < 2000)
+  {
+    // normal grin
+    // (default: single graphic, no animation)
+    subCopyImageToScreen(*si, aniMurphy, YawnSleepCounter - 16);
+
+    return subAnimateMurphy;
+  }
+
+  if (YawnSleepCounter < 4000)
+  {
+    // yawn! and look depressed afterwards...
+    // (default: 12 animation frames with delay of 8)
+    subCopyImageToScreen(*si, aniMurphyYawn, YawnSleepCounter - 2000);
+
+    return subAnimateMurphy;
+  }
+
+  if (YawnSleepCounter < 6400)
+  {
+    // yawn again!
+    // (default: 12 animation frames with delay of 8)
+    subCopyImageToScreen(*si, aniMurphyYawn, YawnSleepCounter - 4000);
+
+    return subAnimateMurphy;
+  }
+
+  // time1 = 6400 + 12 * 8;    // (default: 6496 == 6400 + 12 * 8)
+  time1 = 6400 + 12 * 10;
+
+  if (YawnSleepCounter < time1)
+  {
+    // yawn again! - third time
+    // (default: 12 animation frames with delay of 8)
+    subCopyImageToScreen(*si, aniMurphyYawn, YawnSleepCounter - 6400);
+
+    return subAnimateMurphy;
+  }
+
+  // time2 = 6496 + 3 * 64;    // (default: 6688 == 6496 + 3 * 64)
+  time2 = 6496 + 3 * 100;
+
+  if (YawnSleepCounter > time2)                // Murphy already went to sleep
+    return subAnimateMurphy;
+
+  if (PlayField16[*si - 1] == 0)
+  {
+    if (PlayField16[*si + 1] == 0)
+    {
+      // no sleep -- go back to "wait and start yawning" phase
+      YawnSleepCounter = 144;
+
+      return subAnimateMurphy;
+    }
+    else
+    {
+      // go to sleep (right side)
+      // (default: 3 animation frames with delay of 64)
+      subCopyImageToScreen(*si, aniMurphySleepRight, YawnSleepCounter - time1);
+
+      return subAnimateMurphy;
+    }
+  }
+
+  // go to sleep (left side)
+  // (default: 3 animation frames with delay of 64)
+  subCopyImageToScreen(*si, aniMurphySleepLeft, YawnSleepCounter - time1);
+
+  return subAnimateMurphy;
+
+  // end of YAWN-SLEEP-Sequence
+
+#else
+
   ax = (TimerVar & 3);
   if (ax != 0)
     return subAnimateMurphy;
   ax = (TimerVar & 3);
   if (ax != 0)
     return subAnimateMurphy;
@@ -163,9 +263,13 @@ int subAnimateMurphy(int *si)
 
   bx = (YawnSleepCounter - 1622) / 16;
   subCopyFieldToScreen(*si, aniMurphySleepLeft + bx); // go to sleep
 
   bx = (YawnSleepCounter - 1622) / 16;
   subCopyFieldToScreen(*si, aniMurphySleepLeft + bx); // go to sleep
+
   return subAnimateMurphy;
 
   // end of YAWN-SLEEP-Sequence
   return subAnimateMurphy;
 
   // end of YAWN-SLEEP-Sequence
+
+#endif
+
   // ------------------------------------------------------------------
   // ==========================================================================
   //                       (Direct Jump) a key was pressed
   // ------------------------------------------------------------------
   // ==========================================================================
   //                       (Direct Jump) a key was pressed
@@ -1010,7 +1114,7 @@ loc_g_6817:
   subCopyFieldToScreen(*si, aniMurphyTouchUp);
   if (YellowDisksExploded != 0)
   {
   subCopyFieldToScreen(*si, aniMurphyTouchUp);
   if (YellowDisksExploded != 0)
   {
-    YawnSleepCounter = 10; // stay hypnotized
+    YawnSleepCounter = 40; // stay hypnotized
     return subAnimateMurphy;
   } // loc_g_6838:
 
     return subAnimateMurphy;
   } // loc_g_6838:
 
@@ -1026,7 +1130,7 @@ loc_g_684E:
   subCopyFieldToScreen(*si, aniMurphyTouchLeft);
   if (YellowDisksExploded != 0)
   {
   subCopyFieldToScreen(*si, aniMurphyTouchLeft);
   if (YellowDisksExploded != 0)
   {
-    YawnSleepCounter = 10; // stay hypnotized
+    YawnSleepCounter = 40; // stay hypnotized
     return subAnimateMurphy;
   } // loc_g_6838:
 
     return subAnimateMurphy;
   } // loc_g_6838:
 
@@ -1042,7 +1146,7 @@ loc_g_6884:
   subCopyFieldToScreen(*si, aniMurphyTouchDown);
   if (YellowDisksExploded != 0)
   {
   subCopyFieldToScreen(*si, aniMurphyTouchDown);
   if (YellowDisksExploded != 0)
   {
-    YawnSleepCounter = 10; // stay hypnotized
+    YawnSleepCounter = 40; // stay hypnotized
     return subAnimateMurphy;
   } // loc_g_6838:
 
     return subAnimateMurphy;
   } // loc_g_6838:
 
@@ -1058,7 +1162,7 @@ loc_g_68BA:
   subCopyFieldToScreen(*si, aniMurphyTouchRight);
   if (YellowDisksExploded != 0)
   {
   subCopyFieldToScreen(*si, aniMurphyTouchRight);
   if (YellowDisksExploded != 0)
   {
-    YawnSleepCounter = 10; // stay hypnotized
+    YawnSleepCounter = 40; // stay hypnotized
     return subAnimateMurphy;
   } // loc_g_6838:
 
     return subAnimateMurphy;
   } // loc_g_6838:
 
@@ -2398,6 +2502,17 @@ void subCopyFieldToScreen(int si, int fi)
   // +++++++++++++++++++++++++++++++++++++++++
 }
 
   // +++++++++++++++++++++++++++++++++++++++++
 }
 
+void subCopyImageToScreen(int si, int graphic, int sync_frame)
+{
+  int X, Y;
+
+  // +++++++++++++++++++++++++++++++++++++++++
+  X = GetStretchX(si);
+  Y = GetStretchY(si);
+  StretchedSprites.BltImg(X, Y, graphic, sync_frame);
+  // +++++++++++++++++++++++++++++++++++++++++
+}
+
 static void subEatRedDisk(int si)
 {
   if (AllowRedDiskCheat == 0)
 static void subEatRedDisk(int si)
 {
   if (AllowRedDiskCheat == 0)
index 3708b48c2e287d4c65c86ac9d1ab44bb55662f5d..8f0dd400c6662f09ec985bdeaf83651ca5b7f0c6 100644 (file)
@@ -15,6 +15,7 @@
 extern int subAdjustZonksInfotronsAboveMurphy(int si);
 extern int subAnimateMurphy(int *si);
 extern void subCopyFieldToScreen(int si, int fi);
 extern int subAdjustZonksInfotronsAboveMurphy(int si);
 extern int subAnimateMurphy(int *si);
 extern void subCopyFieldToScreen(int si, int fi);
+extern void subCopyImageToScreen(int si, int graphic, int sync_frame);
 extern int subExplodeSnikSnaksBelow(int si);
 extern int subSpPortTest(int si);
 
 extern int subExplodeSnikSnaksBelow(int si);
 extern int subSpPortTest(int si);