{ "door_2.step_delay", "10" },
{ "door_2.anim_mode", "default" },
+#if DEBUG
+ { "game.level.x", "-1" },
+ { "game.level.y", "-1" },
+ { "game.gems.x", "-1" },
+ { "game.gems.y", "-1" },
+ { "game.bombs.x", "-1" },
+ { "game.bombs.y", "-1" },
+ { "game.keys.x", "-1" },
+ { "game.keys.y", "-1" },
+ { "game.score.x", "-1" },
+ { "game.score.y", "-1" },
+ { "game.time.x", "-1" },
+ { "game.time.y", "-1" },
+#if 0
+ { "game.tape.x", "-1" },
+ { "game.tape.y", "-1" },
+#endif
+#endif
+
{ "[player].boring_delay_fixed", "1000" },
{ "[player].boring_delay_random", "1000" },
{ "[player].sleeping_delay_fixed", "2000" },
-#define COMPILE_DATE_STRING "[2006-07-30 22:09]"
+#define COMPILE_DATE_STRING "[2006-08-02 01:51]"
#define SETUP_TOKEN_SKIP_LEVELS 14
#define SETUP_TOKEN_TIME_LIMIT 15
#define SETUP_TOKEN_FULLSCREEN 16
-#define SETUP_TOKEN_ASK_ON_ESCAPE 17
-#define SETUP_TOKEN_ASK_ON_ESCAPE_EDITOR 18
-#define SETUP_TOKEN_QUICK_SWITCH 19
-#define SETUP_TOKEN_INPUT_ON_FOCUS 20
-#define SETUP_TOKEN_PREFER_AGA_GRAPHICS 21
-#define SETUP_TOKEN_GRAPHICS_SET 22
-#define SETUP_TOKEN_SOUNDS_SET 23
-#define SETUP_TOKEN_MUSIC_SET 24
-#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS 25
-#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS 26
-#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC 27
-
-#define NUM_GLOBAL_SETUP_TOKENS 28
+#define SETUP_TOKEN_FULLSCREEN_MODE 17
+#define SETUP_TOKEN_ASK_ON_ESCAPE 18
+#define SETUP_TOKEN_ASK_ON_ESCAPE_EDITOR 19
+#define SETUP_TOKEN_QUICK_SWITCH 20
+#define SETUP_TOKEN_INPUT_ON_FOCUS 21
+#define SETUP_TOKEN_PREFER_AGA_GRAPHICS 22
+#define SETUP_TOKEN_GRAPHICS_SET 23
+#define SETUP_TOKEN_SOUNDS_SET 24
+#define SETUP_TOKEN_MUSIC_SET 25
+#define SETUP_TOKEN_OVERRIDE_LEVEL_GRAPHICS 26
+#define SETUP_TOKEN_OVERRIDE_LEVEL_SOUNDS 27
+#define SETUP_TOKEN_OVERRIDE_LEVEL_MUSIC 28
+
+#define NUM_GLOBAL_SETUP_TOKENS 29
/* editor setup */
#define SETUP_TOKEN_EDITOR_EL_BOULDERDASH 0
{ 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_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" },
si->skip_levels = TRUE;
si->time_limit = TRUE;
si->fullscreen = FALSE;
+ si->fullscreen_mode = getStringCopy(DEFAULT_FULLSCREEN_MODE);
si->ask_on_escape = TRUE;
si->ask_on_escape_editor = TRUE;
si->quick_switch = FALSE;
}
else
{
- /* print valid modes */
printf("Available Modes:\n");
+
for(i = 0; modes[i]; i++)
printf(" %d x %d\n", modes[i]->w, modes[i]->h);
}
return get_parameter_value(value_raw, suffix, TYPE_INTEGER);
}
+struct ScreenModeInfo *get_screen_mode_from_string(char *screen_mode_string)
+{
+ static struct ScreenModeInfo screen_mode;
+ char *screen_mode_string_x = strchr(screen_mode_string, 'x');
+ char *screen_mode_string_copy;
+ char *screen_mode_string_pos_w;
+ char *screen_mode_string_pos_h;
+
+ if (screen_mode_string_x == NULL) /* invalid screen mode format */
+ return NULL;
+
+ screen_mode_string_copy = getStringCopy(screen_mode_string);
+
+ screen_mode_string_pos_w = screen_mode_string_copy;
+ screen_mode_string_pos_h = strchr(screen_mode_string_copy, 'x');
+ *screen_mode_string_pos_h++ = '\0';
+
+ screen_mode.width = atoi(screen_mode_string_pos_w);
+ screen_mode.height = atoi(screen_mode_string_pos_h);
+
+ return &screen_mode;
+}
+
static void FreeCustomArtworkList(struct ArtworkListInfo *,
struct ListNodeInfo ***, int *);
int get_parameter_value(char *, char *, int);
int get_auto_parameter_value(char *, char *);
+struct ScreenModeInfo *get_screen_mode_from_string(char *);
+
struct FileInfo *getFileListFromConfigList(struct ConfigInfo *,
struct ConfigTypeInfo *,
char **, int);
/* functions from SGE library */
void sge_Line(SDL_Surface *, Sint16, Sint16, Sint16, Sint16, Uint32);
-/* #ifdef PLATFORM_WIN32 */
-#define FULLSCREEN_BUG
-/* #endif */
-
/* stuff needed to work around SDL/Windows fullscreen drawing bug */
static int fullscreen_width;
static int fullscreen_height;
static int video_xoffset;
static int video_yoffset;
+static void setFullscreenParameters()
+{
+ struct ScreenModeInfo *fullscreen_mode;
+ int i;
+
+ fullscreen_mode = get_screen_mode_from_string(setup.fullscreen_mode);
+
+ for (i = 0; video.fullscreen_modes[i].width != -1; i++)
+ {
+ if (fullscreen_mode->width == video.fullscreen_modes[i].width &&
+ fullscreen_mode->height == video.fullscreen_modes[i].height)
+ {
+ fullscreen_width = fullscreen_mode->width;
+ fullscreen_height = fullscreen_mode->height;
+
+ fullscreen_xoffset = (fullscreen_width - video.width) / 2;
+ fullscreen_yoffset = (fullscreen_height - video.height) / 2;
+
+ break;
+ }
+ }
+}
+
void SDLInitVideoDisplay(void)
{
putenv("SDL_VIDEO_CENTERED=1");
void SDLInitVideoBuffer(DrawBuffer **backbuffer, DrawWindow **window,
boolean fullscreen)
{
-#ifdef FULLSCREEN_BUG
- int i;
static int screen_xy[][2] =
{
{ 640, 480 },
{ 1024, 768 },
{ -1, -1 }
};
-#endif
+ SDL_Rect **modes;
+ int i, j;
/* default: normal game window size */
fullscreen_width = video.width;
fullscreen_xoffset = 0;
fullscreen_yoffset = 0;
-#ifdef FULLSCREEN_BUG
for (i = 0; screen_xy[i][0] != -1; i++)
{
- if (video.width <= screen_xy[i][0] && video.height <= screen_xy[i][1])
+ if (screen_xy[i][0] >= video.width && screen_xy[i][1] >= video.height)
{
- fullscreen_width = screen_xy[i][0];
+ fullscreen_width = screen_xy[i][0];
fullscreen_height = screen_xy[i][1];
+
break;
}
}
- fullscreen_xoffset = (fullscreen_width - video.width) / 2;
+ fullscreen_xoffset = (fullscreen_width - video.width) / 2;
fullscreen_yoffset = (fullscreen_height - video.height) / 2;
-#endif
+
+ /* get available hardware supported fullscreen modes */
+ modes = SDL_ListModes(NULL, SDL_FULLSCREEN | SDL_HWSURFACE);
+
+ if (modes == NULL)
+ {
+ /* no screen modes available => no fullscreen mode support */
+ video.fullscreen_available = FALSE;
+ }
+ else if (modes == (SDL_Rect **)-1)
+ {
+ /* fullscreen resolution is not restricted -- all resolutions available */
+ video.fullscreen_modes = checked_calloc(2 * sizeof(struct ScreenModeInfo));
+
+ /* use native video buffer size for fullscreen mode */
+ video.fullscreen_modes[0].width = video.width;
+ video.fullscreen_modes[0].height = video.height;
+
+ video.fullscreen_modes[1].width = -1;
+ video.fullscreen_modes[1].height = -1;
+ }
+ else
+ {
+ /* in this case, a certain number of screen modes is available */
+ int num_modes = 0;
+
+ for(i = 0; modes[i] != NULL; i++)
+ {
+ boolean found_mode = FALSE;
+
+ /* screen mode is smaller than video buffer size -- skip it */
+ if (modes[i]->w < video.width || modes[i]->h < video.height)
+ continue;
+
+ if (video.fullscreen_modes != NULL)
+ for (j = 0; video.fullscreen_modes[j].width != -1; j++)
+ if (modes[i]->w == video.fullscreen_modes[j].width &&
+ modes[i]->h == video.fullscreen_modes[j].height)
+ found_mode = TRUE;
+
+ if (found_mode) /* screen mode already stored -- skip it */
+ continue;
+
+ /* new mode found; add it to list of available fullscreen modes */
+
+ num_modes++;
+
+ video.fullscreen_modes = checked_realloc(video.fullscreen_modes,
+ (num_modes + 1) *
+ sizeof(struct ScreenModeInfo));
+
+ video.fullscreen_modes[num_modes - 1].width = modes[i]->w;
+ video.fullscreen_modes[num_modes - 1].height = modes[i]->h;
+
+ video.fullscreen_modes[num_modes].width = -1;
+ video.fullscreen_modes[num_modes].height = -1;
+ }
+
+ if (num_modes == 0)
+ {
+ /* no appropriate screen modes available => no fullscreen mode support */
+ video.fullscreen_available = FALSE;
+ }
+ }
/* open SDL video output device (window or fullscreen mode) */
if (!SDLSetVideoMode(backbuffer, fullscreen))
if (fullscreen && !video.fullscreen_enabled && video.fullscreen_available)
{
+ setFullscreenParameters();
+
video_xoffset = fullscreen_xoffset;
video_yoffset = fullscreen_yoffset;
Bitmap *real_dst_bitmap = (dst_bitmap == window ? backbuffer : dst_bitmap);
SDL_Rect src_rect, dst_rect;
-#ifdef FULLSCREEN_BUG
if (src_bitmap == backbuffer)
{
src_x += video_xoffset;
src_y += video_yoffset;
}
-#endif
src_rect.x = src_x;
src_rect.y = src_y;
src_rect.w = width;
src_rect.h = height;
-#ifdef FULLSCREEN_BUG
if (dst_bitmap == backbuffer || dst_bitmap == window)
{
dst_x += video_xoffset;
dst_y += video_yoffset;
}
-#endif
dst_rect.x = dst_x;
dst_rect.y = dst_y;
Bitmap *real_dst_bitmap = (dst_bitmap == window ? backbuffer : dst_bitmap);
SDL_Rect rect;
-#ifdef FULLSCREEN_BUG
if (dst_bitmap == backbuffer || dst_bitmap == window)
{
x += video_xoffset;
y += video_yoffset;
}
-#endif
rect.x = x;
rect.y = y;
src_rect.w = video.width;
src_rect.h = video.height;
-#ifdef FULLSCREEN_BUG
dst_x += video_xoffset;
dst_y += video_yoffset;
-#endif
dst_rect.x = dst_x;
dst_rect.y = dst_y;
rect.w = (to_x - from_x + 1);
rect.h = (to_y - from_y + 1);
-#ifdef FULLSCREEN_BUG
if (dst_bitmap == backbuffer || dst_bitmap == window)
{
rect.x += video_xoffset;
rect.y += video_yoffset;
}
-#endif
SDL_FillRect(surface, &rect, color);
}
void SDLDrawLine(Bitmap *dst_bitmap, int from_x, int from_y,
int to_x, int to_y, Uint32 color)
{
-#ifdef FULLSCREEN_BUG
if (dst_bitmap == backbuffer || dst_bitmap == window)
{
from_x += video_xoffset;
to_x += video_xoffset;
to_y += video_yoffset;
}
-#endif
sge_Line(dst_bitmap->surface, from_x, from_y, to_x, to_y, color);
}
{
SDL_Surface *surface = src_bitmap->surface;
-#ifdef FULLSCREEN_BUG
if (src_bitmap == backbuffer || src_bitmap == window)
{
x += video_xoffset;
y += video_yoffset;
}
-#endif
switch (surface->format->BytesPerPixel)
{
void SDLPutPixel(Bitmap *dst_bitmap, int x, int y, Pixel pixel)
{
-#ifdef FULLSCREEN_BUG
if (dst_bitmap == backbuffer || dst_bitmap == window)
{
x += video_xoffset;
y += video_yoffset;
}
-#endif
sge_PutPixel(dst_bitmap->surface, x, y, pixel);
}
{
SDL_WaitEvent(event);
-#ifdef FULLSCREEN_BUG
if (event->type == EVENT_BUTTONPRESS ||
event->type == EVENT_BUTTONRELEASE)
{
else
((MotionEvent *)event)->y = 0;
}
-#endif
}
#define MAX_COOKIE_LEN 256
+static void setTreeInfoToDefaults(TreeInfo *, int);
+static int compareTreeInfoEntries(const void *, const void *);
+
static int token_value_position = TOKEN_VALUE_POSITION_DEFAULT;
static int token_comment_position = TOKEN_COMMENT_POSITION_DEFAULT;
/* file functions */
/* ------------------------------------------------------------------------- */
-static char *getLevelClassDescription(TreeInfo *ldi)
+static char *getLevelClassDescription(TreeInfo *ti)
{
- int position = ldi->sort_priority / 100;
+ int position = ti->sort_priority / 100;
if (position >= 0 && position < NUM_LEVELCLASS_DESC)
return levelclass_desc[position];
return checked_calloc(sizeof(TreeInfo));
}
+TreeInfo *newTreeInfo_setDefaults(int type)
+{
+ TreeInfo *ti = newTreeInfo();
+
+ setTreeInfoToDefaults(ti, type);
+
+ return ti;
+}
+
void pushTreeInfo(TreeInfo **node_first, TreeInfo *node_new)
{
node_new->next = *node_first;
}
}
-void sortTreeInfo(TreeInfo **node_first,
- int (*compare_function)(const void *, const void *))
+void sortTreeInfoBySortFunction(TreeInfo **node_first,
+ int (*compare_function)(const void *,
+ const void *))
{
int num_nodes = numTreeInfo(*node_first);
TreeInfo **sort_array;
while (node)
{
if (node->node_group != NULL)
- sortTreeInfo(&node->node_group, compare_function);
+ sortTreeInfoBySortFunction(&node->node_group, compare_function);
node = node->next;
}
}
+void sortTreeInfo(TreeInfo **node_first)
+{
+ sortTreeInfoBySortFunction(node_first, compareTreeInfoEntries);
+}
+
/* ========================================================================= */
/* some stuff from "files.c" */
return program.userdata_path;
}
-void fixUserGameDataDir()
+void updateUserGameDataDir()
{
#if defined(PLATFORM_MACOSX)
char *userdata_dir_old = getPath2(getHomeDir(), program.userdata_subdir_unix);
{ TYPE_BOOLEAN, &ldi.skip_levels, "skip_levels" }
};
-static void setTreeInfoToDefaults(TreeInfo *ldi, int type)
+static void setTreeInfoToDefaults(TreeInfo *ti, int type)
{
- ldi->type = type;
+ ti->type = type;
- ldi->node_top = (ldi->type == TREE_TYPE_LEVEL_DIR ? &leveldir_first :
- ldi->type == TREE_TYPE_GRAPHICS_DIR ? &artwork.gfx_first :
- ldi->type == TREE_TYPE_SOUNDS_DIR ? &artwork.snd_first :
- ldi->type == TREE_TYPE_MUSIC_DIR ? &artwork.mus_first :
- NULL);
+ ti->node_top = (ti->type == TREE_TYPE_LEVEL_DIR ? &leveldir_first :
+ ti->type == TREE_TYPE_GRAPHICS_DIR ? &artwork.gfx_first :
+ ti->type == TREE_TYPE_SOUNDS_DIR ? &artwork.snd_first :
+ ti->type == TREE_TYPE_MUSIC_DIR ? &artwork.mus_first :
+ NULL);
- ldi->node_parent = NULL;
- ldi->node_group = NULL;
- ldi->next = NULL;
+ ti->node_parent = NULL;
+ ti->node_group = NULL;
+ ti->next = NULL;
- ldi->cl_first = -1;
- ldi->cl_cursor = -1;
+ ti->cl_first = -1;
+ ti->cl_cursor = -1;
- ldi->subdir = NULL;
- ldi->fullpath = NULL;
- ldi->basepath = NULL;
- ldi->identifier = NULL;
- ldi->name = getStringCopy(ANONYMOUS_NAME);
- ldi->name_sorting = NULL;
- ldi->author = getStringCopy(ANONYMOUS_NAME);
+ ti->subdir = NULL;
+ ti->fullpath = NULL;
+ ti->basepath = NULL;
+ ti->identifier = NULL;
+ ti->name = getStringCopy(ANONYMOUS_NAME);
+ ti->name_sorting = NULL;
+ ti->author = getStringCopy(ANONYMOUS_NAME);
- ldi->sort_priority = LEVELCLASS_UNDEFINED; /* default: least priority */
- ldi->latest_engine = FALSE; /* default: get from level */
- ldi->parent_link = FALSE;
- ldi->in_user_dir = FALSE;
- ldi->user_defined = FALSE;
- ldi->color = 0;
- ldi->class_desc = NULL;
+ ti->sort_priority = LEVELCLASS_UNDEFINED; /* default: least priority */
+ ti->latest_engine = FALSE; /* default: get from level */
+ ti->parent_link = FALSE;
+ ti->in_user_dir = FALSE;
+ ti->user_defined = FALSE;
+ ti->color = 0;
+ ti->class_desc = NULL;
- if (ldi->type == TREE_TYPE_LEVEL_DIR)
+ ti->infotext = getStringCopy(TREE_INFOTEXT(ti->type));
+
+ if (ti->type == TREE_TYPE_LEVEL_DIR)
{
- ldi->imported_from = NULL;
- ldi->imported_by = NULL;
+ ti->imported_from = NULL;
+ ti->imported_by = NULL;
- ldi->graphics_set_ecs = NULL;
- ldi->graphics_set_aga = NULL;
- ldi->graphics_set = NULL;
- ldi->sounds_set = NULL;
- ldi->music_set = NULL;
- ldi->graphics_path = getStringCopy(UNDEFINED_FILENAME);
- ldi->sounds_path = getStringCopy(UNDEFINED_FILENAME);
- ldi->music_path = getStringCopy(UNDEFINED_FILENAME);
+ ti->graphics_set_ecs = NULL;
+ ti->graphics_set_aga = NULL;
+ ti->graphics_set = NULL;
+ ti->sounds_set = NULL;
+ ti->music_set = NULL;
+ ti->graphics_path = getStringCopy(UNDEFINED_FILENAME);
+ ti->sounds_path = getStringCopy(UNDEFINED_FILENAME);
+ ti->music_path = getStringCopy(UNDEFINED_FILENAME);
- ldi->level_filename = NULL;
- ldi->level_filetype = NULL;
+ ti->level_filename = NULL;
+ ti->level_filetype = NULL;
- ldi->levels = 0;
- ldi->first_level = 0;
- ldi->last_level = 0;
- ldi->level_group = FALSE;
- ldi->handicap_level = 0;
- ldi->readonly = TRUE;
- ldi->handicap = TRUE;
- ldi->skip_levels = FALSE;
+ ti->levels = 0;
+ ti->first_level = 0;
+ ti->last_level = 0;
+ ti->level_group = FALSE;
+ ti->handicap_level = 0;
+ ti->readonly = TRUE;
+ ti->handicap = TRUE;
+ ti->skip_levels = FALSE;
}
}
-static void setTreeInfoToDefaultsFromParent(TreeInfo *ldi, TreeInfo *parent)
+static void setTreeInfoToDefaultsFromParent(TreeInfo *ti, TreeInfo *parent)
{
if (parent == NULL)
{
Error(ERR_WARN, "setTreeInfoToDefaultsFromParent(): parent == NULL");
- setTreeInfoToDefaults(ldi, TREE_TYPE_UNDEFINED);
+ setTreeInfoToDefaults(ti, TREE_TYPE_UNDEFINED);
return;
}
/* copy all values from the parent structure */
- ldi->type = parent->type;
+ ti->type = parent->type;
+
+ ti->node_top = parent->node_top;
+ ti->node_parent = parent;
+ ti->node_group = NULL;
+ ti->next = NULL;
- ldi->node_top = parent->node_top;
- ldi->node_parent = parent;
- ldi->node_group = NULL;
- ldi->next = NULL;
+ ti->cl_first = -1;
+ ti->cl_cursor = -1;
- ldi->cl_first = -1;
- ldi->cl_cursor = -1;
+ ti->subdir = NULL;
+ ti->fullpath = NULL;
+ ti->basepath = NULL;
+ ti->identifier = NULL;
+ ti->name = getStringCopy(ANONYMOUS_NAME);
+ ti->name_sorting = NULL;
+ ti->author = getStringCopy(parent->author);
- ldi->subdir = NULL;
- ldi->fullpath = NULL;
- ldi->basepath = NULL;
- ldi->identifier = NULL;
- ldi->name = getStringCopy(ANONYMOUS_NAME);
- ldi->name_sorting = NULL;
- ldi->author = getStringCopy(parent->author);
+ ti->sort_priority = parent->sort_priority;
+ ti->latest_engine = parent->latest_engine;
+ ti->parent_link = FALSE;
+ ti->in_user_dir = parent->in_user_dir;
+ ti->user_defined = parent->user_defined;
+ ti->color = parent->color;
+ ti->class_desc = getStringCopy(parent->class_desc);
- ldi->sort_priority = parent->sort_priority;
- ldi->latest_engine = parent->latest_engine;
- ldi->parent_link = FALSE;
- ldi->in_user_dir = parent->in_user_dir;
- ldi->user_defined = parent->user_defined;
- ldi->color = parent->color;
- ldi->class_desc = getStringCopy(parent->class_desc);
+ ti->infotext = getStringCopy(parent->infotext);
- if (ldi->type == TREE_TYPE_LEVEL_DIR)
+ if (ti->type == TREE_TYPE_LEVEL_DIR)
{
- ldi->imported_from = getStringCopy(parent->imported_from);
- ldi->imported_by = getStringCopy(parent->imported_by);
+ ti->imported_from = getStringCopy(parent->imported_from);
+ ti->imported_by = getStringCopy(parent->imported_by);
- ldi->graphics_set_ecs = NULL;
- ldi->graphics_set_aga = NULL;
- ldi->graphics_set = NULL;
- ldi->sounds_set = NULL;
- ldi->music_set = NULL;
- ldi->graphics_path = getStringCopy(UNDEFINED_FILENAME);
- ldi->sounds_path = getStringCopy(UNDEFINED_FILENAME);
- ldi->music_path = getStringCopy(UNDEFINED_FILENAME);
+ ti->graphics_set_ecs = NULL;
+ ti->graphics_set_aga = NULL;
+ ti->graphics_set = NULL;
+ ti->sounds_set = NULL;
+ ti->music_set = NULL;
+ ti->graphics_path = getStringCopy(UNDEFINED_FILENAME);
+ ti->sounds_path = getStringCopy(UNDEFINED_FILENAME);
+ ti->music_path = getStringCopy(UNDEFINED_FILENAME);
- ldi->level_filename = NULL;
- ldi->level_filetype = NULL;
+ ti->level_filename = NULL;
+ ti->level_filetype = NULL;
- ldi->levels = 0;
- ldi->first_level = 0;
- ldi->last_level = 0;
- ldi->level_group = FALSE;
- ldi->handicap_level = 0;
- ldi->readonly = TRUE;
- ldi->handicap = TRUE;
- ldi->skip_levels = FALSE;
+ ti->levels = 0;
+ ti->first_level = 0;
+ ti->last_level = 0;
+ ti->level_group = FALSE;
+ ti->handicap_level = 0;
+ ti->readonly = TRUE;
+ ti->handicap = TRUE;
+ ti->skip_levels = FALSE;
}
}
-static void freeTreeInfo(TreeInfo *ldi)
+static void freeTreeInfo(TreeInfo *ti)
{
- checked_free(ldi->subdir);
- checked_free(ldi->fullpath);
- checked_free(ldi->basepath);
- checked_free(ldi->identifier);
+ checked_free(ti->subdir);
+ checked_free(ti->fullpath);
+ checked_free(ti->basepath);
+ checked_free(ti->identifier);
+
+ checked_free(ti->name);
+ checked_free(ti->name_sorting);
+ checked_free(ti->author);
- checked_free(ldi->name);
- checked_free(ldi->name_sorting);
- checked_free(ldi->author);
+ checked_free(ti->class_desc);
- checked_free(ldi->class_desc);
+ checked_free(ti->infotext);
- if (ldi->type == TREE_TYPE_LEVEL_DIR)
+ if (ti->type == TREE_TYPE_LEVEL_DIR)
{
- checked_free(ldi->imported_from);
- checked_free(ldi->imported_by);
+ checked_free(ti->imported_from);
+ checked_free(ti->imported_by);
- checked_free(ldi->graphics_set_ecs);
- checked_free(ldi->graphics_set_aga);
- checked_free(ldi->graphics_set);
- checked_free(ldi->sounds_set);
- checked_free(ldi->music_set);
+ checked_free(ti->graphics_set_ecs);
+ checked_free(ti->graphics_set_aga);
+ checked_free(ti->graphics_set);
+ checked_free(ti->sounds_set);
+ checked_free(ti->music_set);
- checked_free(ldi->graphics_path);
- checked_free(ldi->sounds_path);
- checked_free(ldi->music_path);
+ checked_free(ti->graphics_path);
+ checked_free(ti->sounds_path);
+ checked_free(ti->music_path);
- checked_free(ldi->level_filename);
- checked_free(ldi->level_filetype);
+ checked_free(ti->level_filename);
+ checked_free(ti->level_filetype);
}
}
if (leveldir_first == NULL)
Error(ERR_EXIT, "cannot find any valid level series in any directory");
- sortTreeInfo(&leveldir_first, compareTreeInfoEntries);
+ sortTreeInfo(&leveldir_first);
#if 0
dumpTreeInfo(leveldir_first, 0);
printf("music set == %s\n\n", artwork.mus_current_identifier);
#endif
- sortTreeInfo(&artwork.gfx_first, compareTreeInfoEntries);
- sortTreeInfo(&artwork.snd_first, compareTreeInfoEntries);
- sortTreeInfo(&artwork.mus_first, compareTreeInfoEntries);
+ sortTreeInfo(&artwork.gfx_first);
+ sortTreeInfo(&artwork.snd_first);
+ sortTreeInfo(&artwork.mus_first);
#if 0
dumpTreeInfo(artwork.gfx_first, 0);
artwork.mus_current = getFirstValidTreeInfoEntry(artwork.mus_first);
}
- sortTreeInfo(&artwork.gfx_first, compareTreeInfoEntries);
- sortTreeInfo(&artwork.snd_first, compareTreeInfoEntries);
- sortTreeInfo(&artwork.mus_first, compareTreeInfoEntries);
+ sortTreeInfo(&artwork.gfx_first);
+ sortTreeInfo(&artwork.snd_first);
+ sortTreeInfo(&artwork.mus_first);
#if 0
dumpTreeInfo(artwork.gfx_first, 0);
/* additional values for setup screen */
#define TYPE_ENTER_SCREEN (1 << 9)
-#define TYPE_ENTER_MENU (1 << 10)
-#define TYPE_LEAVE_MENU (1 << 11)
-#define TYPE_EMPTY (1 << 12)
-#define TYPE_KEYTEXT (1 << 13)
+#define TYPE_LEAVE_SCREEN (1 << 10)
+#define TYPE_ENTER_MENU (1 << 11)
+#define TYPE_LEAVE_MENU (1 << 12)
+#define TYPE_ENTER_LIST (1 << 13)
+#define TYPE_LEAVE_LIST (1 << 14)
+#define TYPE_EMPTY (1 << 15)
+#define TYPE_KEYTEXT (1 << 16)
-#define TYPE_GHOSTED (1 << 14)
-#define TYPE_QUERY (1 << 15)
+#define TYPE_GHOSTED (1 << 17)
+#define TYPE_QUERY (1 << 18)
/* additional values for internal purposes */
-#define TYPE_BITFIELD (1 << 16)
-#define TYPE_ELEMENT (1 << 17)
-#define TYPE_CONTENT (1 << 18)
-#define TYPE_ELEMENT_LIST (1 << 19)
-#define TYPE_CONTENT_LIST (1 << 20)
+#define TYPE_BITFIELD (1 << 19)
+#define TYPE_ELEMENT (1 << 20)
+#define TYPE_CONTENT (1 << 21)
+#define TYPE_ELEMENT_LIST (1 << 22)
+#define TYPE_CONTENT_LIST (1 << 23)
/* derived values for setup file handling */
#define TYPE_BOOLEAN_STYLE (TYPE_BOOLEAN | \
#define TYPE_SKIP_ENTRY (TYPE_EMPTY | \
TYPE_KEY | \
- TYPE_STRING)
+ TYPE_STRING | \
+ TYPE_GHOSTED)
-#define TYPE_ENTER_OR_LEAVE_MENU (TYPE_ENTER_SCREEN | \
+#define TYPE_ENTER_OR_LEAVE (TYPE_ENTER_SCREEN | \
+ TYPE_LEAVE_SCREEN | \
TYPE_ENTER_MENU | \
- TYPE_LEAVE_MENU)
+ TYPE_LEAVE_MENU | \
+ TYPE_ENTER_LIST | \
+ TYPE_LEAVE_LIST)
/* cookie token for file identifier and version number */
#define TOKEN_STR_FILE_IDENTIFIER "file_identifier"
void InitLevelSetupDirectory(char *);
TreeInfo *newTreeInfo();
+TreeInfo *newTreeInfo_setDefaults(int);
void pushTreeInfo(TreeInfo **, TreeInfo *);
int numTreeInfo(TreeInfo *);
boolean validLevelSeries(TreeInfo *);
TreeInfo *getTreeInfoFromPos(TreeInfo *, int);
TreeInfo *getTreeInfoFromIdentifier(TreeInfo *, char *);
void dumpTreeInfo(TreeInfo *, int);
-void sortTreeInfo(TreeInfo **,
- int (*compare_function)(const void *, const void *));
+void sortTreeInfoBySortFunction(TreeInfo **,
+ int (*compare_function)(const void *,
+ const void *));
+void sortTreeInfo(TreeInfo **);
char *getHomeDir(void);
char *getCommonDataDir(void);
char *getSetupDir(void);
char *getCurrentLevelDir(void);
-void fixUserGameDataDir(void);
+void updateUserGameDataDir(void);
void createDirectory(char *, char *, int);
void InitUserDataDirectory(void);
#endif
#if defined(PLATFORM_MACOSX)
- fixUserGameDataDir();
+ updateUserGameDataDir();
#endif
#if !defined(PLATFORM_UNIX) || defined(PLATFORM_MACOSX)
video.depth = GetRealDepth(depth);
video.fullscreen_available = FULLSCREEN_STATUS;
video.fullscreen_enabled = FALSE;
+ video.fullscreen_modes = NULL;
#if defined(TARGET_SDL)
SDLInitVideoBuffer(backbuffer, window, fullscreen);
#define NUM_TREE_TYPES 4
+#define INFOTEXT_UNDEFINED ""
+#define INFOTEXT_GRAPHICS_DIR "Custom Graphics"
+#define INFOTEXT_SOUNDS_DIR "Custom Sounds"
+#define INFOTEXT_MUSIC_DIR "Custom Music"
+#define INFOTEXT_LEVEL_DIR "Level Sets"
+
+#define TREE_INFOTEXT(t) ((t) == TREE_TYPE_LEVEL_DIR ? \
+ INFOTEXT_LEVEL_DIR : \
+ (t) == TREE_TYPE_GRAPHICS_DIR ? \
+ INFOTEXT_GRAPHICS_DIR : \
+ (t) == TREE_TYPE_SOUNDS_DIR ? \
+ INFOTEXT_SOUNDS_DIR : \
+ (t) == TREE_TYPE_MUSIC_DIR ? \
+ INFOTEXT_MUSIC_DIR : \
+ INFOTEXT_UNDEFINED)
/* values for artwork handling */
#define LEVELDIR_ARTWORK_SET_PTR(leveldir, type) \
boolean debug;
};
+struct ScreenModeInfo
+{
+ int width, height;
+};
+
struct VideoSystemInfo
{
int default_depth;
int width, height, depth;
boolean fullscreen_available;
boolean fullscreen_enabled;
+ struct ScreenModeInfo *fullscreen_modes;
};
struct AudioSystemInfo
boolean skip_levels;
boolean time_limit;
boolean fullscreen;
+ char *fullscreen_mode;
boolean ask_on_escape;
boolean ask_on_escape_editor;
boolean quick_switch;
int color; /* color to use on selection screen for this level */
char *class_desc; /* description of level series class */
int handicap_level; /* number of the lowest unsolved level */
+
+ char *infotext; /* optional text to describe the tree type (headline) */
};
typedef struct TreeInfo TreeInfo;
#define WIN_XSIZE 672
#define WIN_YSIZE 560
+#define DEFAULT_FULLSCREEN_MODE "800x600"
+
#define SCR_FIELDX 17
#define SCR_FIELDY 17
#define MAX_BUF_XSIZE (SCR_FIELDX + 2)
#define SETUP_MODE_SHORTCUT_1 4
#define SETUP_MODE_SHORTCUT_2 5
#define SETUP_MODE_GRAPHICS 6
-#define SETUP_MODE_SOUND 7
-#define SETUP_MODE_ARTWORK 8
-#define SETUP_MODE_CHOOSE_GRAPHICS 9
-#define SETUP_MODE_CHOOSE_SOUNDS 10
-#define SETUP_MODE_CHOOSE_MUSIC 11
+#define SETUP_MODE_CHOOSE_SCREEN_MODE 7
+#define SETUP_MODE_SOUND 8
+#define SETUP_MODE_ARTWORK 9
+#define SETUP_MODE_CHOOSE_GRAPHICS 10
+#define SETUP_MODE_CHOOSE_SOUNDS 11
+#define SETUP_MODE_CHOOSE_MUSIC 12
-#define MAX_SETUP_MODES 12
+#define MAX_SETUP_MODES 13
/* for input setup functions */
#define SETUPINPUT_SCREEN_POS_START 0
static void HandleSetupScreen_Input(int, int, int, int, int);
static void CustomizeKeyboard(int);
static void CalibrateJoystick(int);
+static void execSetupGraphics(void);
static void execSetupArtwork(void);
static void HandleChooseTree(int, int, int, int, int, TreeInfo **);
static int setup_mode = SETUP_MODE_MAIN;
static int info_mode = INFO_MODE_MAIN;
+static TreeInfo *screen_modes = NULL;
+static TreeInfo *screen_mode_current = NULL;
+
#define DRAW_OFFSET_MODE(x) (x >= GAME_MODE_MAIN && \
x <= GAME_MODE_SETUP ? x : \
x == GAME_MODE_PSEUDO_TYPENAME ? \
DrawText(mSX + xpos * 32, mSY + ypos * 32, info_info[i].text, font_nr);
- if (info_info[i].type & TYPE_ENTER_MENU)
+ if (info_info[i].type & (TYPE_ENTER_MENU|TYPE_ENTER_LIST))
initCursor(i, IMG_MENU_BUTTON_ENTER_MENU);
- else if (info_info[i].type & TYPE_LEAVE_MENU)
+ else if (info_info[i].type & (TYPE_LEAVE_MENU|TYPE_LEAVE_LIST))
initCursor(i, IMG_MENU_BUTTON_LEAVE_MENU);
else if (info_info[i].type & ~TYPE_SKIP_ENTRY)
initCursor(i, IMG_MENU_BUTTON);
}
else if (!(info_info[y].type & TYPE_GHOSTED))
{
- if (info_info[y].type & TYPE_ENTER_OR_LEAVE_MENU)
+ if (info_info[y].type & TYPE_ENTER_OR_LEAVE)
{
void (*menu_callback_function)(void) = info_info[choice].value;
#endif
int last_game_status = game_status; /* save current game status */
- title_string =
- (ti->type == TREE_TYPE_LEVEL_DIR ? "Level Sets" :
- ti->type == TREE_TYPE_GRAPHICS_DIR ? "Custom Graphics" :
- ti->type == TREE_TYPE_SOUNDS_DIR ? "Custom Sounds" :
- ti->type == TREE_TYPE_MUSIC_DIR ? "Custom Music" : "");
+ title_string = ti->infotext;
#if 1
DrawTextSCentered(mSY - SY + yoffset, FONT_TITLE_1, title_string);
}
else if (game_status == GAME_MODE_SETUP)
{
- execSetupArtwork();
+ if (game_status == GAME_MODE_SETUP)
+ {
+ if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
+ execSetupGraphics();
+ else
+ execSetupArtwork();
+ }
}
else
{
if (game_status == GAME_MODE_SETUP)
{
- execSetupArtwork();
+ if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
+ execSetupGraphics();
+ else
+ execSetupArtwork();
}
else
{
static struct TokenInfo *setup_info;
static int num_setup_info;
+static char *screen_mode_text;
static char *graphics_set_name;
static char *sounds_set_name;
static char *music_set_name;
static void execSetupGraphics()
{
+ if (video.fullscreen_available && screen_modes == NULL)
+ {
+ int i;
+
+ for (i = 0; video.fullscreen_modes[i].width != -1; i++)
+ {
+ TreeInfo *ti = newTreeInfo_setDefaults(TREE_TYPE_UNDEFINED);
+ char identifier[20], name[20];
+ int x = video.fullscreen_modes[i].width;
+ int y = video.fullscreen_modes[i].height;
+
+ ti->node_top = &screen_modes;
+ ti->sort_priority = x * y;
+
+ sprintf(identifier, "%dx%d", x, y);
+ sprintf(name, "%d x %d", x, y);
+
+ setString(&ti->identifier, identifier);
+ setString(&ti->name, name);
+ setString(&ti->name_sorting, name);
+ setString(&ti->infotext, "Fullscreen Mode");
+
+ pushTreeInfo(&screen_modes, ti);
+ }
+
+ sortTreeInfo(&screen_modes);
+
+ /* set current screen mode for fullscreen mode to reliable default value */
+ screen_mode_current = getTreeInfoFromIdentifier(screen_modes,
+ DEFAULT_FULLSCREEN_MODE);
+ if (screen_mode_current == NULL)
+ screen_mode_current = screen_modes;
+
+ if (screen_mode_current == NULL)
+ video.fullscreen_available = FALSE;
+ }
+
+ if (video.fullscreen_available)
+ {
+ setup.fullscreen_mode = screen_mode_current->identifier;
+
+ /* needed for displaying screen mode name instead of identifier */
+ screen_mode_text = screen_mode_current->name;
+ }
+
setup_mode = SETUP_MODE_GRAPHICS;
DrawSetupScreen();
}
+static void execSetupChooseScreenMode()
+{
+ if (!video.fullscreen_available)
+ return;
+
+ setup_mode = SETUP_MODE_CHOOSE_SCREEN_MODE;
+ DrawSetupScreen();
+}
+
static void execSetupSound()
{
setup_mode = SETUP_MODE_SOUND;
static struct TokenInfo setup_info_graphics[] =
{
- { TYPE_SWITCH, &setup.fullscreen, "Fullscreen Mode:" },
+ { TYPE_SWITCH, &setup.fullscreen, "Fullscreen:" },
+ { TYPE_ENTER_LIST, execSetupChooseScreenMode, "Fullscreen Mode:" },
+ { TYPE_STRING, &screen_mode_text, "" },
{ TYPE_SWITCH, &setup.scroll_delay, "Delayed Scrolling:" },
#if 0
{ TYPE_SWITCH, &setup.soft_scrolling, "Soft Scrolling:" },
static struct TokenInfo setup_info_artwork[] =
{
- { TYPE_ENTER_MENU, execSetupChooseGraphics,"Custom Graphics" },
+ { TYPE_ENTER_LIST, execSetupChooseGraphics,"Custom Graphics:" },
{ TYPE_STRING, &graphics_set_name, "" },
- { TYPE_ENTER_MENU, execSetupChooseSounds, "Custom Sounds" },
+ { TYPE_ENTER_LIST, execSetupChooseSounds, "Custom Sounds:" },
{ TYPE_STRING, &sounds_set_name, "" },
- { TYPE_ENTER_MENU, execSetupChooseMusic, "Custom Music" },
+ { TYPE_ENTER_LIST, execSetupChooseMusic, "Custom Music:" },
{ TYPE_STRING, &music_set_name, "" },
{ TYPE_EMPTY, NULL, "" },
#if 1
TYPE_YES_NO |
TYPE_STRING |
TYPE_ECS_AGA |
- TYPE_KEYTEXT))
+ TYPE_KEYTEXT |
+ TYPE_ENTER_LIST))
return FONT_MENU_2;
else
return FONT_MENU_1;
if ((value_ptr == &setup.sound_simple && !audio.sound_available) ||
(value_ptr == &setup.sound_loops && !audio.loops_available) ||
(value_ptr == &setup.sound_music && !audio.music_available) ||
- (value_ptr == &setup.fullscreen && !video.fullscreen_available))
+ (value_ptr == &setup.fullscreen && !video.fullscreen_available) ||
+ (value_ptr == &screen_mode_text && !video.fullscreen_available))
setup_info[i].type |= TYPE_GHOSTED;
#if 1
DrawText(mSX + xpos * 32, mSY + ypos * 32, setup_info[i].text, font_nr);
- if (setup_info[i].type & TYPE_ENTER_MENU)
+ if (setup_info[i].type & (TYPE_ENTER_MENU|TYPE_ENTER_LIST))
initCursor(i, IMG_MENU_BUTTON_ENTER_MENU);
- else if (setup_info[i].type & TYPE_LEAVE_MENU)
+ else if (setup_info[i].type & (TYPE_LEAVE_MENU|TYPE_LEAVE_LIST))
initCursor(i, IMG_MENU_BUTTON_LEAVE_MENU);
else if (setup_info[i].type & ~TYPE_SKIP_ENTRY)
initCursor(i, IMG_MENU_BUTTON);
}
else if (!(setup_info[y].type & TYPE_GHOSTED))
{
- if (setup_info[y].type & TYPE_ENTER_OR_LEAVE_MENU)
+ if (setup_info[y].type & TYPE_ENTER_OR_LEAVE)
{
void (*menu_callback_function)(void) = setup_info[choice].value;
if (setup_mode == SETUP_MODE_INPUT)
DrawSetupScreen_Input();
+ else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
+ DrawChooseTree(&screen_mode_current);
else if (setup_mode == SETUP_MODE_CHOOSE_GRAPHICS)
DrawChooseTree(&artwork.gfx_current);
else if (setup_mode == SETUP_MODE_CHOOSE_SOUNDS)
{
if (setup_mode == SETUP_MODE_INPUT)
HandleSetupScreen_Input(mx, my, dx, dy, button);
+ else if (setup_mode == SETUP_MODE_CHOOSE_SCREEN_MODE)
+ HandleChooseTree(mx, my, dx, dy, button, &screen_mode_current);
else if (setup_mode == SETUP_MODE_CHOOSE_GRAPHICS)
HandleChooseTree(mx, my, dx, dy, button, &artwork.gfx_current);
else if (setup_mode == SETUP_MODE_CHOOSE_SOUNDS)
static struct GadgetInfo *tool_gadget[NUM_TOOL_BUTTONS];
static int request_gadget_id = -1;
+static int preview_tilesize = 4;
+
static char *print_if_not_empty(int element)
{
static char *s = NULL;
*y = src_y;
}
+void getPreviewGraphicSource(int graphic, Bitmap **bitmap, int *x, int *y,
+ int tilesize)
+{
+ struct
+ {
+ int width_mult, width_div;
+ int height_mult, height_div;
+ } offset_calc[4] =
+ {
+ { 0, 1, 0, 1 },
+ { 0, 1, 2, 3 },
+ { 1, 2, 2, 3 },
+ { 3, 4, 2, 3 },
+ };
+ int offset_calc_pos = (tilesize < MICRO_TILESIZE || tilesize > TILESIZE ? 3 :
+ 5 - log_2(tilesize));
+ Bitmap *src_bitmap = graphic_info[graphic].bitmap;
+ int width_mult = offset_calc[offset_calc_pos].width_mult;
+ int width_div = offset_calc[offset_calc_pos].width_div;
+ int height_mult = offset_calc[offset_calc_pos].height_mult;
+ int height_div = offset_calc[offset_calc_pos].height_div;
+ int mini_startx = src_bitmap->width * width_mult / width_div;
+ int mini_starty = src_bitmap->height * height_mult / height_div;
+ int src_x = mini_startx + graphic_info[graphic].src_x * tilesize / TILESIZE;
+ int src_y = mini_starty + graphic_info[graphic].src_y * tilesize / TILESIZE;
+
+ *bitmap = src_bitmap;
+ *x = src_x;
+ *y = src_y;
+}
+
void DrawMicroElement(int xpos, int ypos, int element)
{
Bitmap *src_bitmap;
xpos, ypos);
}
+void DrawPreviewElement(int xpos, int ypos, int element, int tilesize)
+{
+ Bitmap *src_bitmap;
+ int src_x, src_y;
+ int graphic = el2preimg(element);
+
+ getPreviewGraphicSource(graphic, &src_bitmap, &src_x, &src_y, tilesize);
+ BlitBitmap(src_bitmap, drawto, src_x, src_y, tilesize, tilesize, xpos, ypos);
+}
+
void DrawLevel()
{
int x,y;
redraw_mask |= REDRAW_FIELD;
}
-static void DrawMicroLevelExt(int xpos, int ypos, int from_x, int from_y)
+static void DrawMicroLevelExt(int xpos, int ypos, int from_x, int from_y,
+ int preview_size_x, int preview_size_y)
{
int x, y;
DrawBackground(xpos, ypos, MICROLEVEL_XSIZE, MICROLEVEL_YSIZE);
- if (lev_fieldx < STD_LEV_FIELDX)
- xpos += (STD_LEV_FIELDX - lev_fieldx) / 2 * MICRO_TILEX;
- if (lev_fieldy < STD_LEV_FIELDY)
- ypos += (STD_LEV_FIELDY - lev_fieldy) / 2 * MICRO_TILEY;
+ if (lev_fieldx < preview_size_x)
+ xpos += (preview_size_x - lev_fieldx) / 2 * preview_tilesize;
+ if (lev_fieldy < preview_size_y)
+ ypos += (preview_size_y - lev_fieldy) / 2 * preview_tilesize;
- xpos += MICRO_TILEX;
- ypos += MICRO_TILEY;
+ xpos += preview_tilesize;
+ ypos += preview_tilesize;
- for (x = -1; x <= STD_LEV_FIELDX; x++)
+ for (x = -1; x <= preview_size_x; x++)
{
- for (y = -1; y <= STD_LEV_FIELDY; y++)
+ for (y = -1; y <= preview_size_y; y++)
{
int lx = from_x + x, ly = from_y + y;
- if (lx >= 0 && lx < lev_fieldx && ly >= 0 && ly < lev_fieldy)
- DrawMicroElement(xpos + x * MICRO_TILEX, ypos + y * MICRO_TILEY,
- level.field[lx][ly]);
- else if (lx >= -1 && lx < lev_fieldx+1 && ly >= -1 && ly < lev_fieldy+1
- && BorderElement != EL_EMPTY)
- DrawMicroElement(xpos + x * MICRO_TILEX, ypos + y * MICRO_TILEY,
- getBorderElement(lx, ly));
+ if (lx >= 0 && lx < lev_fieldx &&
+ ly >= 0 && ly < lev_fieldy)
+ DrawPreviewElement(xpos + x * preview_tilesize,
+ ypos + y * preview_tilesize,
+ level.field[lx][ly], preview_tilesize);
+ else if (lx >= -1 && lx < lev_fieldx+1 &&
+ ly >= -1 && ly < lev_fieldy+1 && BorderElement != EL_EMPTY)
+ DrawPreviewElement(xpos + x * preview_tilesize,
+ ypos + y * preview_tilesize,
+ getBorderElement(lx, ly), preview_tilesize);
}
}
static unsigned long label_delay = 0;
static int from_x, from_y, scroll_direction;
static int label_state, label_counter;
+ int preview_size_x = STD_LEV_FIELDX * MICRO_TILESIZE / preview_tilesize;
+ int preview_size_y = STD_LEV_FIELDY * MICRO_TILESIZE / preview_tilesize;
int last_game_status = game_status; /* save current game status */
/* force PREVIEW font on preview level */
label_state = 1;
label_counter = 0;
- DrawMicroLevelExt(xpos, ypos, from_x, from_y);
+ DrawMicroLevelExt(xpos, ypos, from_x, from_y,
+ preview_size_x, preview_size_y);
DrawMicroLevelLabelExt(label_state);
/* initialize delay counters */
}
/* scroll micro level, if needed */
- if ((lev_fieldx > STD_LEV_FIELDX || lev_fieldy > STD_LEV_FIELDY) &&
+ if ((lev_fieldx > preview_size_x || lev_fieldy > preview_size_y) &&
DelayReached(&scroll_delay, MICROLEVEL_SCROLL_DELAY))
{
switch (scroll_direction)
break;
case MV_RIGHT:
- if (from_x < lev_fieldx - STD_LEV_FIELDX)
+ if (from_x < lev_fieldx - preview_size_x)
from_x++;
else
scroll_direction = MV_DOWN;
break;
case MV_DOWN:
- if (from_y < lev_fieldy - STD_LEV_FIELDY)
+ if (from_y < lev_fieldy - preview_size_y)
from_y++;
else
scroll_direction = MV_LEFT;
break;
}
- DrawMicroLevelExt(xpos, ypos, from_x, from_y);
+ DrawMicroLevelExt(xpos, ypos, from_x, from_y,
+ preview_size_x, preview_size_y);
}
/* !!! THIS ALL SUCKS -- SHOULD BE CLEANLY REWRITTEN !!! */