level_file_info->filename = NULL;
}
+int getMappedElement_SB(int, boolean);
+
static void ActivateLevelTemplate()
{
int x, y;
+ if (check_special_flags("load_xsb_to_ces"))
+ {
+ /* fill smaller playfields with padding "beyond border wall" elements */
+ if (level.fieldx < level_template.fieldx ||
+ level.fieldy < level_template.fieldy)
+ {
+ short field[level.fieldx][level.fieldy];
+ int new_fieldx = MAX(level.fieldx, level_template.fieldx);
+ int new_fieldy = MAX(level.fieldy, level_template.fieldy);
+ int pos_fieldx = (new_fieldx - level.fieldx) / 2;
+ int pos_fieldy = (new_fieldy - level.fieldy) / 2;
+
+ /* copy old playfield (which is smaller than the visible area) */
+ for (y = 0; y < level.fieldy; y++) for (x = 0; x < level.fieldx; x++)
+ field[x][y] = level.field[x][y];
+
+ /* fill new, larger playfield with "beyond border wall" elements */
+ for (y = 0; y < new_fieldy; y++) for (x = 0; x < new_fieldx; x++)
+ level.field[x][y] = getMappedElement_SB('_', TRUE);
+
+ /* copy the old playfield to the middle of the new playfield */
+ for (y = 0; y < level.fieldy; y++) for (x = 0; x < level.fieldx; x++)
+ level.field[pos_fieldx + x][pos_fieldy + y] = field[x][y];
+
+ level.fieldx = new_fieldx;
+ level.fieldy = new_fieldy;
+ }
+ }
+
/* 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. */
{
/* special global settings can now be set in level template */
- /* fill smaller playfields with padding "beyond border wall" elements */
- if (level->fieldx < SCR_FIELDX ||
- level->fieldy < SCR_FIELDY)
- {
- short field[level->fieldx][level->fieldy];
- int new_fieldx = MAX(level->fieldx, SCR_FIELDX);
- int new_fieldy = MAX(level->fieldy, SCR_FIELDY);
- int pos_fieldx = (new_fieldx - level->fieldx) / 2;
- int pos_fieldy = (new_fieldy - level->fieldy) / 2;
-
- /* copy old playfield (which is smaller than the visible area) */
- for (y = 0; y < level->fieldy; y++) for (x = 0; x < level->fieldx; x++)
- field[x][y] = level->field[x][y];
-
- /* fill new, larger playfield with "beyond border wall" elements */
- for (y = 0; y < new_fieldy; y++) for (x = 0; x < new_fieldx; x++)
- level->field[x][y] = getMappedElement_SB('_', load_xsb_to_ces);
-
- /* copy the old playfield to the middle of the new playfield */
- for (y = 0; y < level->fieldy; y++) for (x = 0; x < level->fieldx; x++)
- level->field[pos_fieldx + x][pos_fieldy + y] = field[x][y];
-
- level->fieldx = new_fieldx;
- level->fieldy = new_fieldy;
- }
-
level->use_custom_template = TRUE;
}
}
/* set default position for snapshot buttons to stop/pause/play buttons */
for (i = 0; game_buttons_xy[i].dst != NULL; i++)
- {
if ((*game_buttons_xy[i].dst).x == -1 &&
(*game_buttons_xy[i].dst).y == -1)
+ *game_buttons_xy[i].dst = *game_buttons_xy[i].src;
+}
+
+static void InitMenuDesignSettings_SpecialPostProcessing_AfterGraphics()
+{
+ static struct
+ {
+ struct XYTileSize *dst, *src;
+ int graphic;
+ }
+ editor_buttons_xy[] =
+ {
+ {
+ &editor.button.element_left, &editor.palette.element_left,
+ IMG_GFX_EDITOR_BUTTON_ELEMENT_LEFT
+ },
+ {
+ &editor.button.element_middle, &editor.palette.element_middle,
+ IMG_GFX_EDITOR_BUTTON_ELEMENT_MIDDLE
+ },
{
- (*game_buttons_xy[i].dst).x = (*game_buttons_xy[i].src).x;
- (*game_buttons_xy[i].dst).y = (*game_buttons_xy[i].src).y;
+ &editor.button.element_right, &editor.palette.element_right,
+ IMG_GFX_EDITOR_BUTTON_ELEMENT_RIGHT
+ },
+
+ { NULL, NULL }
+ };
+ int i;
+
+ /* set default position for element buttons to element graphics */
+ for (i = 0; editor_buttons_xy[i].dst != NULL; i++)
+ {
+ if ((*editor_buttons_xy[i].dst).x == -1 &&
+ (*editor_buttons_xy[i].dst).y == -1)
+ {
+ struct GraphicInfo *gd = &graphic_info[editor_buttons_xy[i].graphic];
+
+ gd->width = gd->height = editor_buttons_xy[i].src->tile_size;
+
+ *editor_buttons_xy[i].dst = *editor_buttons_xy[i].src;
}
}
}
InitMenuDesignSettings_SpecialPostProcessing();
}
+void LoadMenuDesignSettings_AfterGraphics()
+{
+ InitMenuDesignSettings_SpecialPostProcessing_AfterGraphics();
+}
+
void LoadUserDefinedEditorElementList(int **elements, int *num_elements)
{
char *filename = getEditorSetupFilename();