added handling game actions also after unsolved game end (not used yet)
[rocksndiamonds.git] / src / tools.c
index bccbc9abbd3e6c4b82c7f16aaa5a322f33fa5d69..b23a96dd7c0bd96a5a674617c0e15a079e04c8d4 100644 (file)
@@ -4203,7 +4203,7 @@ void WaitForEventToContinue(void)
     {
       switch (event.type)
       {
-       case EVENT_BUTTONPRESS:
+       case EVENT_BUTTONRELEASE:
        case EVENT_KEYPRESS:
 #if defined(TARGET_SDL2)
         case SDL_CONTROLLERBUTTONDOWN:
@@ -4236,13 +4236,19 @@ void WaitForEventToContinue(void)
 
 static int RequestHandleEvents(unsigned int req_state)
 {
-  boolean level_solved = (game_status == GAME_MODE_PLAYING &&
-                         local_player->LevelSolved_GameEnd);
+  boolean game_just_ended = (game_status == GAME_MODE_PLAYING &&
+                            checkGameEnded());
   int width  = request.width;
   int height = request.height;
   int sx, sy;
   int result;
 
+  /* when showing request dialog after game ended, deactivate game panel */
+  if (game_just_ended)
+    game.panel.active = FALSE;
+
+  game.request_active = TRUE;
+
   setRequestPosition(&sx, &sy, FALSE);
 
   button_status = MB_RELEASED;
@@ -4252,7 +4258,7 @@ static int RequestHandleEvents(unsigned int req_state)
 
   while (result < 0)
   {
-    if (level_solved)
+    if (game_just_ended)
     {
       /* the MM game engine does not use a special (scrollable) field buffer */
       if (level.game_engine_type != GAME_ENGINE_TYPE_MM)
@@ -4531,7 +4537,7 @@ static int RequestHandleEvents(unsigned int req_state)
       }
     }
 
-    if (level_solved)
+    if (game_just_ended)
     {
       if (global.use_envelope_request)
       {
@@ -4543,6 +4549,8 @@ static int RequestHandleEvents(unsigned int req_state)
     BackToFront();
   }
 
+  game.request_active = FALSE;
+
   return result;
 }
 
@@ -4555,7 +4563,7 @@ static boolean RequestDoor(char *text, unsigned int req_state)
   int result;
   int ty;
 
-  if (maxWordLengthInString(text) > MAX_REQUEST_LINE_FONT1_LEN)
+  if (maxWordLengthInRequestString(text) > MAX_REQUEST_LINE_FONT1_LEN)
   {
     max_request_line_len = MAX_REQUEST_LINE_FONT2_LEN;
     font_nr = FONT_TEXT_1;