rnd-19981014-1
[rocksndiamonds.git] / src / tools.c
index 1327e4e58acc2a057f47c1e544e61cb41f72250b..303dc46981781b72e2b3a3cf161aaec4ae471b24 100644 (file)
@@ -23,6 +23,7 @@
 #include "buttons.h"
 #include "joystick.h"
 #include "cartoons.h"
+#include "network.h"
 
 #include <math.h>
 
@@ -1307,6 +1308,10 @@ BOOL Request(char *text, unsigned int req_state)
   int mx,my, ty, result = -1;
   unsigned int old_door_state;
 
+  /* pause network game while waiting for request to answer */
+  if (network && game_status == PLAYING && req_state & REQUEST_WAIT_FOR)
+    SendToServer_PausePlaying();
+
   old_door_state = GetDoorState();
 
   CloseDoor(DOOR_CLOSE_1);
@@ -1347,52 +1352,26 @@ BOOL Request(char *text, unsigned int req_state)
   }
 
   if (req_state & REQ_ASK)
-    XCopyArea(display,pix[PIX_DOOR],pix[PIX_DB_DOOR],gc,
-             DOOR_GFX_PAGEX4,OK_BUTTON_GFX_YPOS,
-             DXSIZE,OK_BUTTON_YSIZE,
-             DOOR_GFX_PAGEX1,OK_BUTTON_YPOS);
+  {
+    DrawYesNoButton(BUTTON_OK, DB_INIT);
+    DrawYesNoButton(BUTTON_NO, DB_INIT);
+  }
   else if (req_state & REQ_CONFIRM)
-    XCopyArea(display,pix[PIX_DOOR],pix[PIX_DB_DOOR],gc,
-             DOOR_GFX_PAGEX4,CONFIRM_BUTTON_GFX_YPOS,
-             DXSIZE,CONFIRM_BUTTON_YSIZE,
-             DOOR_GFX_PAGEX1,CONFIRM_BUTTON_YPOS);
+  {
+    DrawConfirmButton(BUTTON_CONFIRM, DB_INIT);
+  }
   else if (req_state & REQ_PLAYER)
   {
     DrawPlayerButton(BUTTON_PLAYER_1, DB_INIT);
     DrawPlayerButton(BUTTON_PLAYER_2, DB_INIT);
     DrawPlayerButton(BUTTON_PLAYER_3, DB_INIT);
     DrawPlayerButton(BUTTON_PLAYER_4, DB_INIT);
-
-    /*
-    XCopyArea(display,pix[PIX_DOOR],pix[PIX_DB_DOOR],gc,
-             DOOR_GFX_PAGEX4 + PLAYER_BUTTON_GFX_XPOS, PLAYER_BUTTON_GFX_YPOS,
-             PLAYER_BUTTON_XSIZE,PLAYER_BUTTON_YSIZE,
-             DOOR_GFX_PAGEX1 + PLAYER_BUTTON_1_XPOS, PLAYER_BUTTON_1_YPOS);
-    XCopyArea(display,pix[PIX_DOOR],pix[PIX_DB_DOOR],gc,
-             DOOR_GFX_PAGEX4 + PLAYER_BUTTON_GFX_XPOS, PLAYER_BUTTON_GFX_YPOS,
-             PLAYER_BUTTON_XSIZE,PLAYER_BUTTON_YSIZE,
-             DOOR_GFX_PAGEX1 + PLAYER_BUTTON_1_XPOS, PLAYER_BUTTON_1_YPOS);
-    XCopyArea(display,pix[PIX_DOOR],pix[PIX_DB_DOOR],gc,
-             DOOR_GFX_PAGEX4 + PLAYER_BUTTON_GFX_XPOS, PLAYER_BUTTON_GFX_YPOS,
-             PLAYER_BUTTON_XSIZE,PLAYER_BUTTON_YSIZE,
-             DOOR_GFX_PAGEX1 + PLAYER_BUTTON_2_XPOS, PLAYER_BUTTON_2_YPOS);
-    XCopyArea(display,pix[PIX_DOOR],pix[PIX_DB_DOOR],gc,
-             DOOR_GFX_PAGEX4 + PLAYER_BUTTON_GFX_XPOS, PLAYER_BUTTON_GFX_YPOS,
-             PLAYER_BUTTON_XSIZE,PLAYER_BUTTON_YSIZE,
-             DOOR_GFX_PAGEX1 + PLAYER_BUTTON_3_XPOS, PLAYER_BUTTON_3_YPOS);
-    XCopyArea(display,pix[PIX_DOOR],pix[PIX_DB_DOOR],gc,
-             DOOR_GFX_PAGEX4 + PLAYER_BUTTON_GFX_XPOS, PLAYER_BUTTON_GFX_YPOS,
-             PLAYER_BUTTON_XSIZE,PLAYER_BUTTON_YSIZE,
-             DOOR_GFX_PAGEX1 + PLAYER_BUTTON_4_XPOS, PLAYER_BUTTON_4_YPOS);
-    */
   }
 
   OpenDoor(DOOR_OPEN_1);
   ClearEventQueue();
 
-  if (!(req_state & REQ_ASK) &&
-      !(req_state & REQ_CONFIRM) &&
-      !(req_state & REQ_PLAYER))
+  if (!(req_state & REQUEST_WAIT_FOR))
     return(FALSE);
 
   if (game_status != MAINMENU)
@@ -1531,6 +1510,10 @@ BOOL Request(char *text, unsigned int req_state)
     }
   }
 
+  /* continue network game after request */
+  if (network && game_status == PLAYING && req_state & REQUEST_WAIT_FOR)
+    SendToServer_ContinuePlaying();
+
   return(result);
 }