rnd-20091020-2-src
[rocksndiamonds.git] / src / game_sp / MainGameLoop.c
index 99c5dbe4496203bdde12c10eac4b96a40707ecaf..2baa7435cc542dd2f258e55ad3a15b99b8971fe0 100644 (file)
@@ -91,7 +91,9 @@ int subMainGameLoop_Main()
   // --------------------- START OF GAME-BUSY LOOP ------------------------------
   // ----------------------------------------------------------------------------
 
+#if 0
 locRepeatMainGameLoop:                           // start repeating game loop
+#endif
 
   // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   // FS   synchronization
@@ -120,8 +122,19 @@ locRepeatMainGameLoop:                           // start repeating game loop
 
   // FS   end of synchronization
   // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+#if 1
+  if (EndFlag)
+  {
+    // (should never happen)
+
+    // printf("::: EndFlag == True\n");
+
+    goto locExitMainGameLoop;
+  }
+#else
   if (EndFlag)
     goto locExitMainGameLoop;
+#endif
 
   // If DemoFlag = 0 Then Call subCheckJoystick    ' check joystick
   // bx = subCheckRightMouseButton()                ' check (right) mouse button
@@ -190,8 +203,19 @@ locRepeatMainGameLoop:                           // start repeating game loop
     ScrollTowards(ScreenScrollXPos, ScreenScrollYPos);
   }
 
+#if 1
   if (ForcedExitFlag != 0) // Forced Exit?' yes--exit!
+  {
+    // (should never happen)
+
+    // printf("::: ForcedExitFlag == True\n");
+
     goto locExitMainGameLoop;
+  }
+#else
+  if (ForcedExitFlag != 0) // Forced Exit?' yes--exit!
+    goto locExitMainGameLoop;
+#endif
 
   TimerVar = TimerVar + 1;
 
@@ -206,23 +230,67 @@ locRepeatMainGameLoop:                           // start repeating game loop
   //      .Refresh
   //    End With
   //  End If
+
+#if 1
   if (ExitToMenuFlag == 1)
+  {
+    // happens when demo ends or when Murphy enters exit (to be checked)
+
+#if 0
+    printf("::: ExitToMenuFlag == True\n");
+#endif
+
+#if 0
     goto locExitMainGameLoop;
+#endif
+  }
+#else
+  if (ExitToMenuFlag == 1)
+    goto locExitMainGameLoop;
+#endif
 
+#if 1
+  if (LeadOutCounter == 0) // no lead-out: game busy
+    return subMainGameLoop;
+#else
   if (LeadOutCounter == 0) // no lead-out: game busy
     goto locRepeatMainGameLoop;
+#endif
 
   // ----------------------------------------------------------------------------
   // ---------------------- END OF GAME-BUSY LOOP -------------------------------
   // ----------------------------------------------------------------------------
   LeadOutCounter = LeadOutCounter - 1;             // do more lead-out after quit
+
+#if 0
+  printf("::: LeadOutCounter == %d\n", LeadOutCounter);
+#endif
+
+#if 1
+  if (LeadOutCounter != 0) // lead-out not ready: more
+    return subMainGameLoop;
+#else
   if (LeadOutCounter != 0) // lead-out not ready: more
     goto locRepeatMainGameLoop;
+#endif
 
   // lead-out done: exit now
   // ---------------------- END OF GAME-BUSY LOOP (including lead-out) ----------
 
 locExitMainGameLoop:
+
+#if 1
+  printf("::: locExitMainGameLoop reached [%d]\n", LeadOutCounter);
+#endif
+
+
+
+#if 1
+  return subMainGameLoop;
+#endif
+
+
+
   do
   {
     DoEvents(); // user may klick on menus or move the window here ...
@@ -255,7 +323,6 @@ locExitMainGameLoop:
   if (UpdatedFlag == 0) // update playing time
     subUpdatePlayingTime();
 
-
   return subMainGameLoop;
 } // subMainGameLoop