added detection of global (common/system-wide) scores directory
[rocksndiamonds.git] / src / libgame / system.c
index 7d85f6171925be6137208f50461354d0dd751626..00e9c7295edde77c0f1f3fd117c39a29bb69c72a 100644 (file)
@@ -33,6 +33,7 @@ struct OptionInfo     options;
 struct VideoSystemInfo video;
 struct AudioSystemInfo audio;
 struct GfxInfo         gfx;
+struct OverlayInfo     overlay;
 struct ArtworkInfo     artwork;
 struct JoystickInfo    joystick;
 struct SetupInfo       setup;
@@ -97,6 +98,16 @@ void InitProgramInfo(char *argv0, char *config_filename, char *userdata_subdir,
   program.log_file[LOG_ERR_ID] = program.log_file_default[LOG_ERR_ID] = stderr;
 }
 
+void InitScoresInfo()
+{
+  char *global_scores_dir = getPath2(getCommonDataDir(), SCORES_DIRECTORY);
+
+  program.global_scores = directoryExists(global_scores_dir);
+  program.many_scores_per_name = !program.global_scores;
+
+  free(global_scores_dir);
+}
+
 void SetWindowTitle()
 {
   program.window_title = program.window_title_function();
@@ -270,6 +281,21 @@ void InitGfxOtherSettings()
   gfx.cursor_mode = CURSOR_DEFAULT;
 }
 
+void InitOverlayInfo()
+{
+  overlay.active = FALSE;
+}
+
+void SetOverlayActive(boolean active)
+{
+  overlay.active = active;
+}
+
+boolean GetOverlayActive()
+{
+  return overlay.active;
+}
+
 void SetDrawDeactivationMask(int draw_deactivation_mask)
 {
   gfx.draw_deactivation_mask = draw_deactivation_mask;
@@ -363,6 +389,9 @@ void LimitScreenUpdates(boolean enable)
 void InitVideoDisplay(void)
 {
   SDLInitVideoDisplay();
+#if defined(TARGET_SDL2)
+  SDLSetDisplaySize();
+#endif
 }
 
 void CloseVideoDisplay(void)
@@ -378,6 +407,11 @@ void InitVideoBuffer(int width, int height, int depth, boolean fullscreen)
   video.height = height;
   video.depth = GetRealDepth(depth);
 
+  video.screen_width = width;
+  video.screen_height = height;
+  video.screen_xoffset = 0;
+  video.screen_yoffset = 0;
+
   video.fullscreen_available = FULLSCREEN_STATUS;
   video.fullscreen_enabled = FALSE;
 
@@ -1401,16 +1435,6 @@ void SetAudioMode(boolean enabled)
 /* event functions                                                           */
 /* ========================================================================= */
 
-void InitEventFilter(EventFilter filter_function)
-{
-  /* set event filter to filter out certain events */
-#if defined(TARGET_SDL2)
-  SDL_SetEventFilter(filter_function, NULL);
-#else
-  SDL_SetEventFilter(filter_function);
-#endif
-}
-
 boolean PendingEvent(void)
 {
   return (SDL_PollEvent(NULL) ? TRUE : FALSE);