projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
changed saving artwork info cache only if it has changed
[rocksndiamonds.git]
/
src
/
files.c
diff --git
a/src/files.c
b/src/files.c
index bb08277e9817d5b97723086914a4424737b3c701..39c0321ac51ad81576d56661450db81803a48ed9 100644
(file)
--- 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_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)
#define LEVEL_CHUNK_CNT3_SIZE(x) (LEVEL_CHUNK_CNT3_HEADER + (x))
#define LEVEL_CHUNK_CUS3_SIZE(x) (2 + (x) * LEVEL_CPART_CUS3_SIZE)
@@
-257,6
+258,12
@@
static struct LevelFileConfigInfo chunk_config_INFO[] =
&li.solved_by_one_player, FALSE
},
&li.solved_by_one_player, FALSE
},
+ {
+ -1, -1,
+ TYPE_INTEGER, CONF_VALUE_8_BIT(12),
+ &li.time_score_base, 1
+ },
+
{
-1, -1,
-1, -1,
{
-1, -1,
-1, -1,
@@
-307,6
+314,11
@@
static struct LevelFileConfigInfo chunk_config_ELEM[] =
TYPE_BOOLEAN, CONF_VALUE_8_BIT(15),
&li.lazy_relocation, FALSE
},
TYPE_BOOLEAN, CONF_VALUE_8_BIT(15),
&li.lazy_relocation, FALSE
},
+ {
+ EL_PLAYER_1, -1,
+ TYPE_BOOLEAN, CONF_VALUE_8_BIT(16),
+ &li.finish_dig_collect, TRUE
+ },
// (these values are different for each player)
{
// (these values are different for each player)
{
@@
-1063,6
+1075,18
@@
static struct LevelFileConfigInfo chunk_config_CUSX_base[] =
&xx_ei.move_delay_random, 0,
&yy_ei.move_delay_random
},
&xx_ei.move_delay_random, 0,
&yy_ei.move_delay_random
},
+ {
+ -1, -1,
+ TYPE_INTEGER, CONF_VALUE_16_BIT(16),
+ &xx_ei.step_delay_fixed, 0,
+ &yy_ei.step_delay_fixed
+ },
+ {
+ -1, -1,
+ TYPE_INTEGER, CONF_VALUE_16_BIT(17),
+ &xx_ei.step_delay_random, 0,
+ &yy_ei.step_delay_random
+ },
{
-1, -1,
{
-1, -1,
@@
-3710,6
+3734,9
@@
static void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
if (jx != -1 && jy != -1)
level->field[jx][jy] = EL_PLAYER_1 + nr;
}
if (jx != -1 && jy != -1)
level->field[jx][jy] = EL_PLAYER_1 + nr;
}
+
+ // time score is counted for each 10 seconds left in Emerald Mine levels
+ level->time_score_base = 10;
}
}
@@
-5727,6
+5754,9
@@
static void LoadLevelFromFileStream_DC(File *file, struct LevelInfo *level,
// Diamond Caves has the same (strange) behaviour as Emerald Mine that gems
// can slip down from flat walls, like normal walls and steel walls
level->em_slippery_gems = TRUE;
// Diamond Caves has the same (strange) behaviour as Emerald Mine that gems
// can slip down from flat walls, like normal walls and steel walls
level->em_slippery_gems = TRUE;
+
+ // time score is counted for each 10 seconds left in Diamond Caves levels
+ level->time_score_base = 10;
}
static void LoadLevelFromFileInfo_DC(struct LevelInfo *level,
}
static void LoadLevelFromFileInfo_DC(struct LevelInfo *level,
@@
-6250,7
+6280,7
@@
static void LoadLevel_InitVersion(struct LevelInfo *level)
if (level->game_version < VERSION_IDENT(3,2,0,5))
{
// time bonus score was given for 10 s instead of 1 s before 3.2.0-5
if (level->game_version < VERSION_IDENT(3,2,0,5))
{
// time bonus score was given for 10 s instead of 1 s before 3.2.0-5
- level->
score[SC_TIME_BONUS] /
= 10;
+ level->
time_score_base
= 10;
}
if (leveldir_current->latest_engine)
}
if (leveldir_current->latest_engine)
@@
-6422,6
+6452,10
@@
static void LoadLevel_InitVersion(struct LevelInfo *level)
// only Sokoban fields (but not objects) had to be solved before 4.1.1.1
if (level->game_version < VERSION_IDENT(4,1,1,1))
level->sb_objects_needed = FALSE;
// only Sokoban fields (but not objects) had to be solved before 4.1.1.1
if (level->game_version < VERSION_IDENT(4,1,1,1))
level->sb_objects_needed = FALSE;
+
+ // CE actions were triggered by unfinished digging/collecting up to 4.2.2.0
+ if (level->game_version <= VERSION_IDENT(4,2,2,0))
+ level->finish_dig_collect = FALSE;
}
static void LoadLevel_InitStandardElements(struct LevelInfo *level)
}
static void LoadLevel_InitStandardElements(struct LevelInfo *level)
@@
-7628,6
+7662,9
@@
static void setTapeInfoToDefaults(void)
tape.playing = FALSE;
tape.pausing = FALSE;
tape.playing = FALSE;
tape.pausing = FALSE;
+ tape.scr_fieldx = SCR_FIELDX_DEFAULT;
+ tape.scr_fieldy = SCR_FIELDY_DEFAULT;
+
tape.no_valid_file = FALSE;
}
tape.no_valid_file = FALSE;
}
@@
-7718,6
+7755,14
@@
static int LoadTape_HEAD(File *file, int chunk_size, struct TapeInfo *tape)
return chunk_size;
}
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;
static int LoadTape_INFO(File *file, int chunk_size, struct TapeInfo *tape)
{
int level_identifier_size;
@@
-8008,6
+8053,7
@@
void LoadTapeFromFilename(char *filename)
{
{ "VERS", TAPE_CHUNK_VERS_SIZE, LoadTape_VERS },
{ "HEAD", TAPE_CHUNK_HEAD_SIZE, LoadTape_HEAD },
{
{ "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 }
{ "INFO", -1, LoadTape_INFO },
{ "BODY", -1, LoadTape_BODY },
{ NULL, 0, NULL }
@@
-8088,6
+8134,14
@@
void LoadSolutionTape(int nr)
CopyNativeTape_SP_to_RND(&level);
}
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);
static void SaveTape_VERS(FILE *file, struct TapeInfo *tape)
{
putFileVersion(file, tape->file_version);
@@
-8120,6
+8174,12
@@
static void SaveTape_HEAD(FILE *file, struct TapeInfo *tape)
putFileVersion(file, tape->engine_version);
}
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;
static void SaveTape_INFO(FILE *file, struct TapeInfo *tape)
{
int level_identifier_size = strlen(tape->level_identifier) + 1;
@@
-8185,6
+8245,12
@@
void SaveTapeToFilename(char *filename)
putFileChunkBE(file, "HEAD", TAPE_CHUNK_HEAD_SIZE);
SaveTape_HEAD(file, &tape);
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);
putFileChunkBE(file, "INFO", info_chunk_size);
SaveTape_INFO(file, &tape);
@@
-8491,7
+8557,11
@@
static struct TokenInfo global_setup_tokens[] =
},
{
TYPE_SWITCH,
},
{
TYPE_SWITCH,
- &setup.skip_scores_after_game, "skip_scores_after_game"
+ &setup.count_score_after_game, "count_score_after_game"
+ },
+ {
+ TYPE_SWITCH,
+ &setup.show_scores_after_game, "show_scores_after_game"
},
{
TYPE_SWITCH,
},
{
TYPE_SWITCH,
@@
-8545,6
+8615,10
@@
static struct TokenInfo global_setup_tokens[] =
TYPE_SWITCH,
&setup.prefer_lowpass_sounds, "prefer_lowpass_sounds"
},
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"
{
TYPE_SWITCH,
&setup.game_speed_extended, "game_speed_extended"
@@
-8689,6
+8763,10
@@
static struct TokenInfo editor_setup_tokens[] =
TYPE_SWITCH,
&setup.editor.show_element_token, "editor.show_element_token"
},
TYPE_SWITCH,
&setup.editor.show_element_token, "editor.show_element_token"
},
+ {
+ TYPE_SWITCH,
+ &setup.editor.show_read_only_warning, "editor.show_read_only_warning"
+ },
};
static struct TokenInfo editor_cascade_setup_tokens[] =
};
static struct TokenInfo editor_cascade_setup_tokens[] =
@@
-9202,7
+9280,8
@@
static void setSetupInfoToDefaults(struct SetupInfo *si)
si->skip_levels = TRUE;
si->increment_levels = TRUE;
si->auto_play_next_level = TRUE;
si->skip_levels = TRUE;
si->increment_levels = TRUE;
si->auto_play_next_level = TRUE;
- si->skip_scores_after_game = FALSE;
+ si->count_score_after_game = TRUE;
+ si->show_scores_after_game = TRUE;
si->time_limit = TRUE;
si->fullscreen = FALSE;
si->window_scaling_percent = STD_WINDOW_SCALING_PERCENT;
si->time_limit = TRUE;
si->fullscreen = FALSE;
si->window_scaling_percent = STD_WINDOW_SCALING_PERCENT;
@@
-9216,6
+9295,7
@@
static void setSetupInfoToDefaults(struct SetupInfo *si)
si->input_on_focus = FALSE;
si->prefer_aga_graphics = TRUE;
si->prefer_lowpass_sounds = FALSE;
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;
si->game_speed_extended = FALSE;
si->game_frame_delay = GAME_FRAME_DELAY;
si->sp_show_border_elements = FALSE;
@@
-9319,6
+9399,8
@@
static void setSetupInfoToDefaults(struct SetupInfo *si)
si->editor.show_element_token = FALSE;
si->editor.show_element_token = FALSE;
+ si->editor.show_read_only_warning = TRUE;
+
si->editor.use_template_for_new_levels = TRUE;
si->shortcut.save_game = DEFAULT_KEY_SAVE_GAME;
si->editor.use_template_for_new_levels = TRUE;
si->shortcut.save_game = DEFAULT_KEY_SAVE_GAME;
@@
-9673,7
+9755,7
@@
void LoadUserNames(void)
}
if (global.user_names[i] == NULL)
}
if (global.user_names[i] == NULL)
- global.user_names[i] = getStringCopy(
EMPTY_PLAYER_NAME
);
+ global.user_names[i] = getStringCopy(
getDefaultUserName(i)
);
}
user.nr = last_user_nr;
}
user.nr = last_user_nr;
@@
-10450,6
+10532,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, "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;
if (string_has_parameter(value, "block_clicks"))
result |= STYLE_BLOCK;