X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ffiles.c;h=28ae73a23b4b70f06b59f5c892cbb3160d94b8cb;hb=f7f534a6f25f89d3df87e26e50d472995f3971b4;hp=b2a6fb5c13f4976c8d23ffd8e3c942f69706ba4f;hpb=d239aab42a5a0661af0056f7f01e95a7f05bd757;p=rocksndiamonds.git diff --git a/src/files.c b/src/files.c index b2a6fb5c..28ae73a2 100644 --- a/src/files.c +++ b/src/files.c @@ -59,6 +59,7 @@ #define TAPE_CHUNK_VERS_SIZE 8 // size of file version chunk #define TAPE_CHUNK_HEAD_SIZE 20 // size of tape file header #define TAPE_CHUNK_HEAD_UNUSED 1 // unused tape header bytes +#define TAPE_CHUNK_SCRN_SIZE 2 // size of screen size chunk #define LEVEL_CHUNK_CNT3_SIZE(x) (LEVEL_CHUNK_CNT3_HEADER + (x)) #define LEVEL_CHUNK_CUS3_SIZE(x) (2 + (x) * LEVEL_CPART_CUS3_SIZE) @@ -7628,6 +7629,9 @@ static void setTapeInfoToDefaults(void) tape.playing = FALSE; tape.pausing = FALSE; + tape.scr_fieldx = SCR_FIELDX_DEFAULT; + tape.scr_fieldy = SCR_FIELDY_DEFAULT; + tape.no_valid_file = FALSE; } @@ -7718,6 +7722,14 @@ static int LoadTape_HEAD(File *file, int chunk_size, struct TapeInfo *tape) return chunk_size; } +static int LoadTape_SCRN(File *file, int chunk_size, struct TapeInfo *tape) +{ + tape->scr_fieldx = getFile8Bit(file); + tape->scr_fieldy = getFile8Bit(file); + + return chunk_size; +} + static int LoadTape_INFO(File *file, int chunk_size, struct TapeInfo *tape) { int level_identifier_size; @@ -8008,6 +8020,7 @@ void LoadTapeFromFilename(char *filename) { { "VERS", TAPE_CHUNK_VERS_SIZE, LoadTape_VERS }, { "HEAD", TAPE_CHUNK_HEAD_SIZE, LoadTape_HEAD }, + { "SCRN", TAPE_CHUNK_SCRN_SIZE, LoadTape_SCRN }, { "INFO", -1, LoadTape_INFO }, { "BODY", -1, LoadTape_BODY }, { NULL, 0, NULL } @@ -8088,6 +8101,14 @@ void LoadSolutionTape(int nr) CopyNativeTape_SP_to_RND(&level); } +static boolean checkSaveTape_SCRN(struct TapeInfo *tape) +{ + // chunk required for team mode tapes with non-default screen size + return (tape->num_participating_players > 1 && + (tape->scr_fieldx != SCR_FIELDX_DEFAULT || + tape->scr_fieldy != SCR_FIELDY_DEFAULT)); +} + static void SaveTape_VERS(FILE *file, struct TapeInfo *tape) { putFileVersion(file, tape->file_version); @@ -8120,6 +8141,12 @@ static void SaveTape_HEAD(FILE *file, struct TapeInfo *tape) putFileVersion(file, tape->engine_version); } +static void SaveTape_SCRN(FILE *file, struct TapeInfo *tape) +{ + putFile8Bit(file, tape->scr_fieldx); + putFile8Bit(file, tape->scr_fieldy); +} + static void SaveTape_INFO(FILE *file, struct TapeInfo *tape) { int level_identifier_size = strlen(tape->level_identifier) + 1; @@ -8185,6 +8212,12 @@ void SaveTapeToFilename(char *filename) putFileChunkBE(file, "HEAD", TAPE_CHUNK_HEAD_SIZE); SaveTape_HEAD(file, &tape); + if (checkSaveTape_SCRN(&tape)) + { + putFileChunkBE(file, "SCRN", TAPE_CHUNK_SCRN_SIZE); + SaveTape_SCRN(file, &tape); + } + putFileChunkBE(file, "INFO", info_chunk_size); SaveTape_INFO(file, &tape); @@ -8545,6 +8578,10 @@ static struct TokenInfo global_setup_tokens[] = TYPE_SWITCH, &setup.prefer_lowpass_sounds, "prefer_lowpass_sounds" }, + { + TYPE_SWITCH, + &setup.prefer_extra_panel_items, "prefer_extra_panel_items" + }, { TYPE_SWITCH, &setup.game_speed_extended, "game_speed_extended" @@ -9216,6 +9253,7 @@ static void setSetupInfoToDefaults(struct SetupInfo *si) si->input_on_focus = FALSE; si->prefer_aga_graphics = TRUE; si->prefer_lowpass_sounds = FALSE; + si->prefer_extra_panel_items = TRUE; si->game_speed_extended = FALSE; si->game_frame_delay = GAME_FRAME_DELAY; si->sp_show_border_elements = FALSE; @@ -10450,6 +10488,9 @@ int get_parameter_value(char *value_raw, char *suffix, int type) if (string_has_parameter(value, "reverse")) result |= STYLE_REVERSE; + if (string_has_parameter(value, "leftmost_position")) + result |= STYLE_LEFTMOST_POSITION; + if (string_has_parameter(value, "block_clicks")) result |= STYLE_BLOCK;