2009-12-10
* fixed bug with steel exit being destructible during opening phase
+ * added token "special_flags" to "levelinfo.conf" (currently with the
+ only recognized value "load_xsb_to_ces", doing the same as the flag
+ "-Dload_xsb_to_ces" on the command line, but as a permanent flag for
+ converting all elements in native (XSB) Sokoban level files to CEs)
2009-12-08
* fixed some problems with Supaplex engine when compiling for Windows
2009-12-05
* added special mode to convert elements of Sokoban XSB levels to CEs
+ by adding "-Dload_xsb_to_ces" to the command line starting the game
+ (also adding a dependency to a template level file "template.level")
2009-12-01
* added reading native Sokoban levels and level packages (XSB files)
-#define COMPILE_DATE_STRING "2009-12-10 14:59"
+#define COMPILE_DATE_STRING "2009-12-11 00:08"
/* functions for loading SB level */
/* ------------------------------------------------------------------------- */
+#if 1
+
+static boolean check_special_flags(char *flag)
+{
+#if 0
+ printf("::: '%s', '%s', '%s'\n",
+ flag,
+ options.special_flags,
+ leveldir_current->special_flags);
+#endif
+
+ if (strEqual(options.special_flags, flag) ||
+ strEqual(leveldir_current->special_flags, flag))
+ return TRUE;
+
+ return FALSE;
+}
+
+#else
+
+#define SPECIAL_FLAG_LOAD_XSB_TO_CES (1 << 0)
+
+static unsigned long get_special_flags(char *flags_string)
+{
+ unsigned long flags_value = 0;
+
+ if (strEqual(flags_string, "load_xsb_to_ces"))
+ flags_value = SPECIAL_FLAG_LOAD_XSB_TO_CES;
+
+ return flags_value;
+}
+
+#endif
+
int getMappedElement_SB(int element_ascii, boolean use_ces)
{
static struct
boolean reading_playfield = FALSE;
boolean got_valid_playfield_line = FALSE;
boolean invalid_playfield_char = FALSE;
- boolean load_xsb_to_ces = options.cmd_switches & CMD_SWITCH_LOAD_XSB_TO_CES;
+#if 1
+ boolean load_xsb_to_ces = check_special_flags("load_xsb_to_ces");
+#else
+ boolean load_xsb_to_ces = options.special_flags & SPECIAL_FLAG_LOAD_XSB_TO_CES;
+#endif
int file_level_nr = 0;
int line_nr = 0;
int x, y;
static void init_global_values()
{
- menBorder.Checked = True * 0;
+ menBorder.Checked = False;
menPanel.Checked = True;
menAutoScroll.Checked = True;
game_sp_info.LevelSolved = FALSE;
game_sp_info.GameOver = FALSE;
+ menBorder.Checked = setup.sp_show_border_elements;
+
InitScrollPlayfield();
#if 1
/* command line option handling functions */
/* ------------------------------------------------------------------------- */
-void GetOptions(char *argv[], void (*print_usage_function)(void),
- unsigned long (*get_cmd_switch_function)(char *))
+void GetOptions(char *argv[], void (*print_usage_function)(void))
{
char *ro_base_path = RO_BASE_PATH;
char *rw_base_path = RW_BASE_PATH;
options.sounds_directory = getPath2(ro_base_path, SOUNDS_DIRECTORY);
options.music_directory = getPath2(ro_base_path, MUSIC_DIRECTORY);
options.docs_directory = getPath2(ro_base_path, DOCS_DIRECTORY);
+
options.execute_command = NULL;
+ options.special_flags = NULL;
options.serveronly = FALSE;
options.network = FALSE;
options.debug = FALSE;
options.debug_x11_sync = FALSE;
- options.cmd_switches = 0;
-
#if !defined(PLATFORM_UNIX)
if (*options_left == NULL) /* no options given -- enable verbose mode */
options.verbose = TRUE;
}
else if (strPrefix(option, "-D"))
{
- char *switch_string = &option[2];
- unsigned long switch_value;
+#if 1
+ options.special_flags = getStringCopy(&option[2]);
+#else
+ char *flags_string = &option[2];
+ unsigned long flags_value;
- if (*switch_string == '\0')
- Error(ERR_EXIT_HELP, "empty switch ignored");
+ if (*flags_string == '\0')
+ Error(ERR_EXIT_HELP, "empty flag ignored");
- switch_value = get_cmd_switch_function(switch_string);
+ flags_value = get_special_flags_function(flags_string);
- if (switch_value == 0)
- Error(ERR_EXIT_HELP, "unknown switch '%s'", switch_string);
+ if (flags_value == 0)
+ Error(ERR_EXIT_HELP, "unknown flag '%s'", flags_string);
- options.cmd_switches |= switch_value;
+ options.special_flags |= flags_value;
+#endif
}
else if (strncmp(option, "-execute", option_len) == 0)
{
boolean strPrefixLower(char *, char *);
boolean strSuffixLower(char *, char *);
-void GetOptions(char **, void (*print_usage_function)(void),
- unsigned long (*get_cmd_switch_function)(char *));
+void GetOptions(char **, void (*print_usage_function)(void));
void SetError(char *, ...);
char *GetError(void);
#define LEVELINFO_TOKEN_MUSIC_SET 18
#define LEVELINFO_TOKEN_FILENAME 19
#define LEVELINFO_TOKEN_FILETYPE 20
-#define LEVELINFO_TOKEN_HANDICAP 21
-#define LEVELINFO_TOKEN_SKIP_LEVELS 22
+#define LEVELINFO_TOKEN_SPECIAL_FLAGS 21
+#define LEVELINFO_TOKEN_HANDICAP 22
+#define LEVELINFO_TOKEN_SKIP_LEVELS 23
-#define NUM_LEVELINFO_TOKENS 23
+#define NUM_LEVELINFO_TOKENS 24
static LevelDirTree ldi;
{ TYPE_STRING, &ldi.music_set, "music_set" },
{ TYPE_STRING, &ldi.level_filename, "filename" },
{ TYPE_STRING, &ldi.level_filetype, "filetype" },
+ { TYPE_STRING, &ldi.special_flags, "special_flags" },
{ TYPE_BOOLEAN, &ldi.handicap, "handicap" },
{ TYPE_BOOLEAN, &ldi.skip_levels, "skip_levels" }
};
ti->level_filename = NULL;
ti->level_filetype = NULL;
+ ti->special_flags = NULL;
+
ti->levels = 0;
ti->first_level = 0;
ti->last_level = 0;
ti->level_filename = NULL;
ti->level_filetype = NULL;
+ ti->special_flags = getStringCopy(parent->special_flags);
+
ti->levels = 0;
ti->first_level = 0;
ti->last_level = 0;
ti_copy->level_filename = getStringCopy(ti->level_filename);
ti_copy->level_filetype = getStringCopy(ti->level_filetype);
+ ti_copy->special_flags = getStringCopy(ti->special_flags);
+
ti_copy->levels = ti->levels;
ti_copy->first_level = ti->first_level;
ti_copy->last_level = ti->last_level;
checked_free(ti->level_filename);
checked_free(ti->level_filetype);
+
+ checked_free(ti->special_flags);
}
checked_free(ti);
char *sounds_directory;
char *music_directory;
char *docs_directory;
+
char *execute_command;
+ char *special_flags;
+
boolean serveronly;
boolean network;
boolean verbose;
boolean debug;
boolean debug_x11_sync;
-
- unsigned long cmd_switches;
};
struct ScreenModeInfo
char *level_filename; /* filename of level file (for packed level file) */
char *level_filetype; /* type of levels in level directory or level file */
+ char *special_flags; /* flags for special actions performed on level file */
+
int levels; /* number of levels in level series */
int first_level; /* first level number (to allow start with 0 or 1) */
int last_level; /* last level number (automatically calculated) */
/* main() */
/* ========================================================================= */
-static unsigned long get_cmd_switch(char *switch_string)
-{
- unsigned long switch_value = 0;
-
- if (strEqual(switch_string, "load_xsb_to_ces"))
- switch_value = CMD_SWITCH_LOAD_XSB_TO_CES;
-
- return switch_value;
-}
-
static void print_usage()
{
printf("\n"
InitExitFunction(CloseAllAndExit);
InitPlatformDependentStuff();
- GetOptions(argv, print_usage, get_cmd_switch);
+ GetOptions(argv, print_usage);
OpenAll();
EventLoop();
#include "conf_mus.h" /* include auto-generated data structure definitions */
-#define CMD_SWITCH_LOAD_XSB_TO_CES (1 << 0)
-
#define IMG_UNDEFINED (-1)
#define IMG_EMPTY IMG_EMPTY_SPACE
#define IMG_SP_EMPTY IMG_SP_EMPTY_SPACE
num_title_screens = 0;
#if 1
+ /* 1st step: initialize title screens for game start (only when starting) */
if (show_title_initial)
InitializeTitleControls_CheckTitleInfo(TRUE);
#endif
+ /* 2nd step: initialize title screens for current level set */
InitializeTitleControls_CheckTitleInfo(FALSE);
/* sort title screens according to sort_priority and title number */