+2010-01-10
+ * added new element "from_level_template" that is replaced by element
+ from level template at same playfield position when loaded (currently
+ not accessible from level editor, but only used for special Sokoban
+ level conversion when using "special_flags: load_xsb_to_ces")
+
2010-01-07
* added handling of gravity ports when converting Supaplex style R'n'D
levels to native Supaplex levels for playing with Supaplex engine
-#define COMPILE_DATE_STRING "2010-01-07 17:02"
+#define COMPILE_DATE_STRING "2010-01-10 21:27"
char *template_filename = getDefaultLevelFilename(-1);
boolean new_template = !fileExists(template_filename);
+ /* backup original "level.field" (needed to track playfield changes) */
+ CopyPlayfield(level.field, FieldBackup);
+
+ /* "SaveLevelTemplate()" uses "level.field", so copy editor playfield */
+ CopyPlayfield(Feld, level.field);
+
if (new_template ||
Request("Save this template and kill the old ?", REQ_ASK))
SaveLevelTemplate();
if (new_template)
Request("Template saved !", REQ_CONFIRM);
+
+ /* restore original "level.field" (needed to track playfield changes) */
+ CopyPlayfield(FieldBackup, level.field);
}
else if (type_id == ED_TEXTBUTTON_ID_ADD_CHANGE_PAGE &&
custom_element.num_change_pages < MAX_CHANGE_PAGES)
static void ActivateLevelTemplate()
{
+ int x, y;
+
/* Currently there is no special action needed to activate the template
data, because 'element_info' property settings overwrite the original
level data, while all other variables do not change. */
+
+ /* Exception: 'from_level_template' elements in the original level playfield
+ are overwritten with the corresponding elements at the same position in
+ playfield from the level template. */
+
+ for (x = 0; x < level.fieldx; x++)
+ for (y = 0; y < level.fieldy; y++)
+ if (level.field[x][y] == EL_FROM_LEVEL_TEMPLATE)
+ {
+ level.field[x][y] = level_template.field[x][y];
+
+#if 0
+ printf("::: found EL_FROM_LEVEL_TEMPLATE at %d, %d\n", x, y);
+#endif
+ }
}
static char *getLevelFilenameFromBasename(char *basename)
{ '.', EL_SOKOBAN_FIELD_EMPTY, EL_CUSTOM_5 }, /* goal square */
{ '*', EL_SOKOBAN_FIELD_FULL, EL_CUSTOM_6 }, /* box on goal square */
{ '+', EL_SOKOBAN_FIELD_PLAYER, EL_CUSTOM_7 }, /* player on goal square */
+#if 0
{ '_', EL_INVISIBLE_STEELWALL, EL_CUSTOM_8 }, /* floor beyond border */
+#else
+ { '_', EL_INVISIBLE_STEELWALL, EL_FROM_LEVEL_TEMPLATE }, /* floor beyond border */
+#endif
{ 0, -1, -1 },
};
"quicksand",
"fast quicksand (with rock)"
},
+ {
+ "from_level_template",
+ "from_level_template",
+ "element taken from level template"
+ },
/* ----------------------------------------------------------------------- */
/* "real" (and therefore drawable) runtime elements */
#define EL_QUICKSAND_FAST_EMPTY 861
#define EL_QUICKSAND_FAST_FULL 862
-#define NUM_FILE_ELEMENTS 863
+#define EL_FROM_LEVEL_TEMPLATE 863
+
+#define NUM_FILE_ELEMENTS 864
/* "real" (and therefore drawable) runtime elements */