minor code cleanup
[rocksndiamonds.git] / src / tools.c
index c730e8510e89648d87e5540d2b466c319c857d11..3ffbdad17fe2a8e511dd9dd9c77de8f495b40e27 100644 (file)
@@ -3244,7 +3244,7 @@ static void AnimateEnvelopeRequest(int anim_mode, int action)
   boolean ffwd_delay = (tape.playing && tape.fast_forward);
   boolean no_delay = (tape.warp_forward);
   int delay_value = (ffwd_delay ? delay_value_fast : delay_value_normal);
-  int anim_delay_value = MAX(1, (no_delay ? 0 : delay_value + 500 * 0) / 2);
+  int anim_delay_value = MAX(1, (no_delay ? 0 : delay_value) / 2);
   DelayCounter anim_delay = { anim_delay_value };
 
   int tile_size = MAX(request.step_offset, 1);
@@ -4791,7 +4791,7 @@ static int RequestHandleEvents(unsigned int req_state, int draw_buffer_game)
   return result;
 }
 
-static void DoRequestBefore(unsigned int req_state)
+static void DoRequestBefore(void)
 {
   if (game_status == GAME_MODE_PLAYING)
     BlitScreenToBitmap(backbuffer);
@@ -4805,8 +4805,7 @@ static void DoRequestBefore(unsigned int req_state)
   // pause network game while waiting for request to answer
   if (network.enabled &&
       game_status == GAME_MODE_PLAYING &&
-      !game.all_players_gone &&
-      req_state & REQUEST_WAIT_FOR_INPUT)
+      !game.all_players_gone)
     SendToServer_PausePlaying();
 
   // simulate releasing mouse button over last gadget, if still pressed
@@ -4816,7 +4815,7 @@ static void DoRequestBefore(unsigned int req_state)
   UnmapAllGadgets();
 }
 
-static void DoRequestAfter(unsigned int req_state)
+static void DoRequestAfter(void)
 {
   RemapAllGadgets();
 
@@ -4833,8 +4832,7 @@ static void DoRequestAfter(unsigned int req_state)
   // continue network game after request
   if (network.enabled &&
       game_status == GAME_MODE_PLAYING &&
-      !game.all_players_gone &&
-      req_state & REQUEST_WAIT_FOR_INPUT)
+      !game.all_players_gone)
     SendToServer_ContinuePlaying();
 
   // restore deactivated drawing when quick-loading level tape recording
@@ -4858,10 +4856,7 @@ static boolean RequestDoor(char *text, unsigned int req_state)
     font_nr = FONT_TEXT_1;
   }
 
-  DoRequestBefore(req_state);
-
-  // draw released gadget before proceeding
-  // BackToFront();
+  DoRequestBefore();
 
   if (old_door_state & DOOR_OPEN_1)
   {
@@ -4869,7 +4864,7 @@ static boolean RequestDoor(char *text, unsigned int req_state)
 
     // save old door content
     BlitBitmap(bitmap_db_door_1, bitmap_db_door_1,
-              0 * DXSIZE, 0, DXSIZE, DYSIZE, 1 * DXSIZE, 0);
+              0, 0, DXSIZE, DYSIZE, DXSIZE, 0);
   }
 
   SetDoorBackgroundImage(IMG_BACKGROUND_DOOR);
@@ -4893,7 +4888,6 @@ static boolean RequestDoor(char *text, unsigned int req_state)
     for (tl = 0, tx = 0; tx < max_request_line_len; tl++, tx++)
     {
       tc = *(text_ptr + tx);
-      // if (!tc || tc == ' ')
       if (!tc || tc == ' ' || tc == '?' || tc == '!')
        break;
     }
@@ -4916,7 +4910,6 @@ static boolean RequestDoor(char *text, unsigned int req_state)
             text_line, font_nr);
 
     text_ptr += tl + (tc == ' ' ? 1 : 0);
-    // text_ptr += tl + (tc == ' ' || tc == '?' || tc == '!' ? 1 : 0);
   }
 
   ResetFontStatus();
@@ -4928,23 +4921,6 @@ static boolean RequestDoor(char *text, unsigned int req_state)
 
   OpenDoor(DOOR_OPEN_1);
 
-  if (!(req_state & REQUEST_WAIT_FOR_INPUT))
-  {
-    if (game_status == GAME_MODE_PLAYING)
-    {
-      SetPanelBackground();
-      SetDrawBackgroundMask(REDRAW_DOOR_1);
-    }
-    else
-    {
-      SetDrawBackgroundMask(REDRAW_FIELD);
-    }
-
-    return FALSE;
-  }
-
-  SetDrawBackgroundMask(REDRAW_FIELD | REDRAW_DOOR_1);
-
   // ---------- handle request buttons ----------
   result = RequestHandleEvents(req_state, draw_buffer_last);
 
@@ -4959,7 +4935,7 @@ static boolean RequestDoor(char *text, unsigned int req_state)
       OpenDoor(DOOR_OPEN_1 | DOOR_COPY_BACK);
   }
 
-  DoRequestAfter(req_state);
+  DoRequestAfter();
 
   return result;
 }
@@ -4969,28 +4945,11 @@ static boolean RequestEnvelope(char *text, unsigned int req_state)
   int draw_buffer_last = GetDrawtoField();
   int result;
 
-  DoRequestBefore(req_state);
+  DoRequestBefore();
 
   DrawEnvelopeRequest(text, req_state);
   ShowEnvelopeRequest(text, req_state, ACTION_OPENING);
 
-  if (!(req_state & REQUEST_WAIT_FOR_INPUT))
-  {
-    if (game_status == GAME_MODE_PLAYING)
-    {
-      SetPanelBackground();
-      SetDrawBackgroundMask(REDRAW_DOOR_1);
-    }
-    else
-    {
-      SetDrawBackgroundMask(REDRAW_FIELD);
-    }
-
-    return FALSE;
-  }
-
-  SetDrawBackgroundMask(REDRAW_FIELD | REDRAW_DOOR_1);
-
   // ---------- handle request buttons ----------
   result = RequestHandleEvents(req_state, draw_buffer_last);
 
@@ -4998,7 +4957,7 @@ static boolean RequestEnvelope(char *text, unsigned int req_state)
 
   ShowEnvelopeRequest(text, req_state, ACTION_CLOSING);
 
-  DoRequestAfter(req_state);
+  DoRequestAfter();
 
   return result;
 }