+2006-08-01
+ * added selection of preferred fullscreen mode to setup / graphics menu
+ (useful if default mode 800 x 600 does not match screen aspect ratio)
+
2006-07-30
* improved down-scaling of images for better level and preview graphics
* changed user data directory for Mac OS X from Unix style to new place
-#define COMPILE_DATE_STRING "[2006-08-02 19:10]"
+#define COMPILE_DATE_STRING "[2006-08-02 21:27]"
{ TYPE_SWITCH, &si.skip_levels, "skip_levels" },
{ TYPE_SWITCH, &si.time_limit, "time_limit" },
{ TYPE_SWITCH, &si.fullscreen, "fullscreen" },
- { TYPE_SWITCH, &si.fullscreen_mode, "fullscreen_mode" },
+ { TYPE_STRING, &si.fullscreen_mode, "fullscreen_mode" },
{ TYPE_SWITCH, &si.ask_on_escape, "ask_on_escape" },
{ TYPE_SWITCH, &si.ask_on_escape_editor, "ask_on_escape_editor" },
{ TYPE_SWITCH, &si.quick_switch, "quick_player_switch" },
return &screen_mode;
}
+void get_aspect_ratio_from_screen_mode(struct ScreenModeInfo *screen_mode,
+ int *x, int *y)
+{
+ float aspect_ratio = (float)screen_mode->width / (float)screen_mode->height;
+ float aspect_ratio_new;
+ int i = 1;
+
+ do
+ {
+ *x = i * aspect_ratio;
+ *y = i;
+
+ aspect_ratio_new = (float)*x / (float)*y;
+
+ i++;
+ }
+ while (aspect_ratio_new != aspect_ratio && *x < screen_mode->width);
+}
+
static void FreeCustomArtworkList(struct ArtworkListInfo *,
struct ListNodeInfo ***, int *);
int get_auto_parameter_value(char *, char *);
struct ScreenModeInfo *get_screen_mode_from_string(char *);
+void get_aspect_ratio_from_screen_mode(struct ScreenModeInfo *, int *x, int *y);
struct FileInfo *getFileListFromConfigList(struct ConfigInfo *,
struct ConfigTypeInfo *,
fullscreen_mode = get_screen_mode_from_string(setup.fullscreen_mode);
+ if (fullscreen_mode == NULL)
+ return;
+
for (i = 0; video.fullscreen_modes[i].width != -1; i++)
{
if (fullscreen_mode->width == video.fullscreen_modes[i].width &&
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_COMMON_DOCUMENTS, NULL, 0, dir))
&& !strEqual(dir, "")) /* empty for Windows 95/98 */
- common_data_dir = getPath2(dir, program.userdata_directory);
+ common_data_dir = getPath2(dir, program.userdata_subdir);
else
common_data_dir = options.rw_base_directory;
}
video.fullscreen_available = FULLSCREEN_STATUS;
video.fullscreen_enabled = FALSE;
video.fullscreen_modes = NULL;
+ video.fullscreen_mode_current = NULL;
#if defined(TARGET_SDL)
SDLInitVideoBuffer(backbuffer, window, fullscreen);
{
int default_depth;
int width, height, depth;
+
boolean fullscreen_available;
boolean fullscreen_enabled;
struct ScreenModeInfo *fullscreen_modes;
+ char *fullscreen_mode_current;
};
struct AudioSystemInfo
static void ToggleFullscreenIfNeeded()
{
- if (setup.fullscreen != video.fullscreen_enabled)
+ if (setup.fullscreen != video.fullscreen_enabled ||
+ setup.fullscreen_mode != video.fullscreen_mode_current)
{
/* save old door content */
BlitBitmap(backbuffer, bitmap_db_door,
DX, DY, DXSIZE, DYSIZE, DOOR_GFX_PAGEX1, DOOR_GFX_PAGEY1);
+ if (setup.fullscreen && video.fullscreen_enabled)
+ {
+ /* keep fullscreen mode, but change screen mode */
+ video.fullscreen_mode_current = setup.fullscreen_mode;
+ video.fullscreen_enabled = FALSE;
+ }
+
/* toggle fullscreen */
ChangeVideoModeIfNeeded(setup.fullscreen);
setup.fullscreen = video.fullscreen_enabled;
char identifier[20], name[20];
int x = video.fullscreen_modes[i].width;
int y = video.fullscreen_modes[i].height;
+ int xx, yy;
+
+ get_aspect_ratio_from_screen_mode(&video.fullscreen_modes[i], &xx, &yy);
ti->node_top = &screen_modes;
ti->sort_priority = x * y;
sprintf(identifier, "%dx%d", x, y);
- sprintf(name, "%d x %d", x, y);
+ sprintf(name, "%d x %d [%d:%d]", x, y, xx, yy);
setString(&ti->identifier, identifier);
setString(&ti->name, name);
pushTreeInfo(&screen_modes, ti);
}
+ /* sort fullscreen modes to start with lowest available screen resolution */
sortTreeInfo(&screen_modes);
- /* set current screen mode for fullscreen mode to reliable default value */
+ /* set current screen mode for fullscreen mode to configured setup value */
screen_mode_current = getTreeInfoFromIdentifier(screen_modes,
- DEFAULT_FULLSCREEN_MODE);
+ setup.fullscreen_mode);
+
+ /* if that fails, set current screen mode to reliable default value */
+ if (screen_mode_current == NULL)
+ screen_mode_current = getTreeInfoFromIdentifier(screen_modes,
+ DEFAULT_FULLSCREEN_MODE);
+
+ /* if that also fails, set current screen mode to first available mode */
if (screen_mode_current == NULL)
screen_mode_current = screen_modes;