rnd-19981014-1
[rocksndiamonds.git] / src / game.c
index 640c248624ddd158dd29f6d33d2a9f3b06e677e0..622a1857a553a41e70a89b7a00a9c5ff0cc152d4 100644 (file)
@@ -63,6 +63,9 @@ void InitGame()
   BOOL emulate_bd = TRUE;      /* unless non-BOULDERDASH elements found */
   BOOL emulate_sb = TRUE;      /* unless non-SOKOBAN     elements found */
 
+  /* don't play tapes over network */
+  network_playing = (network && !tape.playing);
+
   for(i=0; i<MAX_PLAYERS; i++)
   {
     struct PlayerInfo *player = &stored_player[i];
@@ -131,18 +134,9 @@ void InitGame()
 
   network_player_action_received = FALSE;
 
-
-
   /* initial null action */
-  SendToServer_MovePlayer(MV_NO_MOVING);
-
-
-
-  /*
-  printf("BLURB\n");
-  */
-
-
+  if (network_playing)
+    SendToServer_MovePlayer(MV_NO_MOVING);
 
   ZX = ZY = -1;
 
@@ -2888,7 +2882,7 @@ void GameActions(byte player_action)
   /* main game synchronization point */
   WaitUntilDelayReached(&action_delay, action_delay_value);
 
-  if (!standalone && !network_player_action_received)
+  if (network_playing && !network_player_action_received)
   {
     /*
 #ifdef DEBUG
@@ -2913,18 +2907,30 @@ void GameActions(byte player_action)
     }
   }
 
+
+  if (tape.pausing || (tape.playing && !TapePlayDelay()))
+    return;
+  else if (tape.recording)
+    TapeRecordDelay();
+
+
   if (tape.playing)
     recorded_player_action = TapePlayAction();
   else
     recorded_player_action = NULL;
 
-  if (!standalone)
+  if (network_playing)
     SendToServer_MovePlayer(player_action);
 
   for(i=0; i<MAX_PLAYERS; i++)
   {
+    /*
     int actual_player_action =
-      (standalone ? player_action : network_player_action[i]);
+      (network ? network_player_action[i] : player_action);
+      */
+
+    int actual_player_action =
+      (network_playing ? network_player_action[i] : player_action);
 
     /*
     int actual_player_action = network_player_action[i];
@@ -2941,7 +2947,7 @@ void GameActions(byte player_action)
       actual_player_action = 0;
     */
 
-    if (standalone && i != TestPlayer)
+    if (!network && i != TestPlayer)
       actual_player_action = 0;
 
     /* TEST TEST TEST */
@@ -2959,10 +2965,12 @@ void GameActions(byte player_action)
 
   ScrollScreen(NULL, SCROLL_GO_ON);
 
+  /*
   if (tape.pausing || (tape.playing && !TapePlayDelay()))
     return;
   else if (tape.recording)
     TapeRecordDelay();
+  */
 
   FrameCounter++;
   TimeFrames++;
@@ -3210,7 +3218,7 @@ BOOL MoveFigureOneStep(struct PlayerInfo *player,
   if (!IN_LEV_FIELD(new_jx,new_jy))
     return(MF_NO_ACTION);
 
-  if (standalone && !AllPlayersInSight(player, new_jx,new_jy))
+  if (!network && !AllPlayersInSight(player, new_jx,new_jy))
     return(MF_NO_ACTION);
 
   element = MovingOrBlocked2Element(new_jx,new_jy);
@@ -3283,7 +3291,7 @@ BOOL MoveFigure(struct PlayerInfo *player, int dx, int dy)
   */
 
   if (moved & MF_MOVING && !ScreenMovPos &&
-      (player == local_player || standalone))
+      (player == local_player || !network))
   {
     int old_scroll_x = scroll_x, old_scroll_y = scroll_y;
     int offset = (scroll_delay_on ? 3 : 0);
@@ -3353,7 +3361,7 @@ BOOL MoveFigure(struct PlayerInfo *player, int dx, int dy)
 
     if (scroll_x != old_scroll_x || scroll_y != old_scroll_y)
     {
-      if (standalone && !AllPlayersInVisibleScreen())
+      if (!network && !AllPlayersInVisibleScreen())
       {
        scroll_x = old_scroll_x;
        scroll_y = old_scroll_y;