cleanup of game mode handling
[rocksndiamonds.git] / src / tools.c
index 1dc080b22906ea71c5afa4815509c72c52eae037..7e8806e54f67fd3e2e9055f631bee2229863b15b 100644 (file)
@@ -227,7 +227,7 @@ void DumpTile(int x, int y)
   printf("  CustomValue: %d\n", CustomValue[x][y]);
   printf("  GfxElement:  %d\n", GfxElement[x][y]);
   printf("  GfxAction:   %d\n", GfxAction[x][y]);
-  printf("  GfxFrame:    %d\n", GfxFrame[x][y]);
+  printf("  GfxFrame:    %d [%d]\n", GfxFrame[x][y], FrameCounter);
   printf("\n");
 }
 
@@ -330,8 +330,8 @@ void DrawMaskedBorder_ALL()
 void DrawMaskedBorder(int redraw_mask)
 {
   /* never draw masked screen borders on borderless screens */
-  if (effectiveGameStatus() == GAME_MODE_LOADING ||
-      effectiveGameStatus() == GAME_MODE_TITLE)
+  if (game_status == GAME_MODE_LOADING ||
+      game_status == GAME_MODE_TITLE)
     return;
 
   if (redraw_mask & REDRAW_ALL)
@@ -826,6 +826,10 @@ boolean CheckIfGlobalBorderRedrawIsNeeded()
   if (game_status == game_status_last)
     return FALSE;
 
+  // redraw if last screen was title screen
+  if (game_status_last == GAME_MODE_TITLE)
+    return TRUE;
+
   // redraw if global screen border has changed
   if (CheckIfGlobalBorderHasChanged())
     return TRUE;
@@ -2283,7 +2287,7 @@ void DrawEnvelopeRequest(char *text)
   int text_width = line_length * font_width;
   int width = request.width;
   int height = request.height;
-  int tile_size = request.step_offset;
+  int tile_size = MAX(request.step_offset, 1);
   int x_steps = width  / tile_size;
   int y_steps = height / tile_size;
   int sx_offset = border_size;
@@ -2294,7 +2298,7 @@ void DrawEnvelopeRequest(char *text)
   if (request.centered)
     sx_offset = (request.width - text_width) / 2;
 
-  if (request.wrap_single_words)
+  if (request.wrap_single_words && !request.autowrap)
   {
     char *src_text_ptr, *dst_text_ptr;
 
@@ -2362,7 +2366,7 @@ void AnimateEnvelopeRequest(int anim_mode, int action)
   int anim_delay_value = (no_delay ? 0 : delay_value + 500 * 0) / 2;
   unsigned int anim_delay = 0;
 
-  int tile_size = request.step_offset;
+  int tile_size = MAX(request.step_offset, 1);
   int max_xsize = request.width  / tile_size;
   int max_ysize = request.height / tile_size;
   int max_xsize_inner = max_xsize - 2;