fixed viewport properties for score info page
[rocksndiamonds.git] / src / tools.c
index 144bce2afeb7dc36852b81bc32cb66192fe3b405..83b61d9c54e2c490e26422356a2b5be61b35c407 100644 (file)
@@ -512,6 +512,10 @@ static void DrawMaskedBorderExt_Rect(int x, int y, int width, int height,
   Bitmap *src_bitmap = getGlobalBorderBitmapFromStatus(global.border_status);
   Bitmap *dst_bitmap = gfx.masked_border_bitmap_ptr;
 
+  // may happen for "border.draw_masked.*" with undefined "global.border.*"
+  if (src_bitmap == NULL)
+    return;
+
   if (x == -1 && y == -1)
     return;
 
@@ -1118,7 +1122,8 @@ Bitmap *getGlobalBorderBitmapFromStatus(int status)
   int graphic =
     (status == GAME_MODE_MAIN ||
      status == GAME_MODE_PSEUDO_TYPENAME       ? IMG_GLOBAL_BORDER_MAIN :
-     status == GAME_MODE_SCORES                        ? IMG_GLOBAL_BORDER_SCORES :
+     status == GAME_MODE_SCORES ||
+     status == GAME_MODE_SCOREINFO             ? IMG_GLOBAL_BORDER_SCORES :
      status == GAME_MODE_EDITOR                        ? IMG_GLOBAL_BORDER_EDITOR :
      status == GAME_MODE_PLAYING               ? IMG_GLOBAL_BORDER_PLAYING :
      IMG_GLOBAL_BORDER);
@@ -2523,6 +2528,11 @@ void DrawScreenGraphic(int x, int y, int graphic, int frame)
   }
 }
 
+void DrawLevelGraphic(int x, int y, int graphic, int frame)
+{
+  DrawScreenGraphic(SCREENX(x), SCREENY(y), graphic, frame);
+}
+
 void DrawScreenElement(int x, int y, int element)
 {
   int mask_mode = NO_MASKING;
@@ -9730,7 +9740,8 @@ void ChangeViewportPropertiesIfNeeded(void)
 {
   boolean use_mini_tilesize = (level.game_engine_type == GAME_ENGINE_TYPE_MM ?
                               FALSE : setup.small_game_graphics);
-  int gfx_game_mode = game_status;
+  int gfx_game_mode = (game_status == GAME_MODE_SCOREINFO ? GAME_MODE_SCORES :
+                      game_status);
   int gfx_game_mode2 = (game_status == GAME_MODE_EDITOR ? GAME_MODE_DEFAULT :
                        game_status);
   struct RectWithBorder *vp_window    = &viewport.window[gfx_game_mode];
@@ -9945,6 +9956,16 @@ void ChangeViewportPropertiesIfNeeded(void)
   }
 }
 
+void OpenURL(char *url)
+{
+  SDL_OpenURL(url);
+}
+
+void OpenURLFromHash(SetupFileHash *hash, int hash_key)
+{
+  OpenURL(getHashEntry(hash, int2str(hash_key, 0)));
+}
+
 
 // ============================================================================
 // tests