projects
/
rocksndiamonds.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added function to calculate data size at tape position
[rocksndiamonds.git]
/
src
/
files.c
diff --git
a/src/files.c
b/src/files.c
index e94692c5edd653cda057191333b59bb3060d709f..51fd5b2ed313a22967001afe6eeeb477b3ec1c15 100644
(file)
--- a/
src/files.c
+++ b/
src/files.c
@@
-768,9
+768,15
@@
static struct LevelFileConfigInfo chunk_config_ELEM[] =
&li.android_clone_time, 10
},
{
&li.android_clone_time, 10
},
{
- EL_EMC_ANDROID,
-1
,
+ EL_EMC_ANDROID,
SAVE_CONF_NEVER
,
TYPE_ELEMENT_LIST, CONF_VALUE_BYTES(1),
&li.android_clone_element[0], EL_EMPTY, NULL,
TYPE_ELEMENT_LIST, CONF_VALUE_BYTES(1),
&li.android_clone_element[0], EL_EMPTY, NULL,
+ &li.num_android_clone_elements, 1, MAX_ANDROID_ELEMENTS_OLD
+ },
+ {
+ EL_EMC_ANDROID, -1,
+ TYPE_ELEMENT_LIST, CONF_VALUE_BYTES(2),
+ &li.android_clone_element[0], EL_EMPTY, NULL,
&li.num_android_clone_elements, 1, MAX_ANDROID_ELEMENTS
},
&li.num_android_clone_elements, 1, MAX_ANDROID_ELEMENTS
},
@@
-809,7
+815,7
@@
static struct LevelFileConfigInfo chunk_config_ELEM[] =
{
EL_EMC_MAGIC_BALL, -1,
TYPE_BOOLEAN, CONF_VALUE_8_BIT(2),
{
EL_EMC_MAGIC_BALL, -1,
TYPE_BOOLEAN, CONF_VALUE_8_BIT(2),
- &li.ball_
state_initial,
FALSE
+ &li.ball_
active_initial,
FALSE
},
{
EL_EMC_MAGIC_BALL, -1,
},
{
EL_EMC_MAGIC_BALL, -1,
@@
-3539,7
+3545,7
@@
static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
for (y = 0; y < 3; y++)
for (x = 0; x < 3; x++)
cav->eater_array[i][y * 3 + x] =
for (y = 0; y < 3; y++)
for (x = 0; x < 3; x++)
cav->eater_array[i][y * 3 + x] =
- map_element_RND_to_EM(level->yamyam_content[i].e[x][y]);
+ map_element_RND_to_EM
_cave
(level->yamyam_content[i].e[x][y]);
cav->amoeba_time = level->amoeba_speed;
cav->wonderwall_time = level->time_magic_wall;
cav->amoeba_time = level->amoeba_speed;
cav->wonderwall_time = level->time_magic_wall;
@@
-3548,7
+3554,7
@@
static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
cav->android_move_time = level->android_move_time;
cav->android_clone_time = level->android_clone_time;
cav->ball_random = level->ball_random;
cav->android_move_time = level->android_move_time;
cav->android_clone_time = level->android_clone_time;
cav->ball_random = level->ball_random;
- cav->ball_
state = level->ball_stat
e_initial;
+ cav->ball_
active = level->ball_activ
e_initial;
cav->ball_time = level->ball_time;
cav->num_ball_arrays = level->num_ball_contents;
cav->ball_time = level->ball_time;
cav->num_ball_arrays = level->num_ball_contents;
@@
-3561,29
+3567,27
@@
static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
cav->wind_direction =
map_direction_RND_to_EM(level->wind_direction_initial);
cav->wind_direction =
map_direction_RND_to_EM(level->wind_direction_initial);
- cav->wind_cnt = (level->wind_direction_initial != MV_NONE ?
- cav->wind_time : 0);
for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
for (j = 0; j < 8; j++)
cav->ball_array[i][j] =
for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
for (j = 0; j < 8; j++)
cav->ball_array[i][j] =
- map_element_RND_to_EM
(level->
-
ball_content[i].
e[ball_xy[j][0]][ball_xy[j][1]]);
+ map_element_RND_to_EM
_cave(level->ball_content[i].
+
e[ball_xy[j][0]][ball_xy[j][1]]);
map_android_clone_elements_RND_to_EM(level);
map_android_clone_elements_RND_to_EM(level);
- // first fill the complete playfield with the
default border
element
+ // first fill the complete playfield with the
empty space
element
for (y = 0; y < EM_MAX_CAVE_HEIGHT; y++)
for (x = 0; x < EM_MAX_CAVE_WIDTH; x++)
for (y = 0; y < EM_MAX_CAVE_HEIGHT; y++)
for (x = 0; x < EM_MAX_CAVE_WIDTH; x++)
- cav->cave[x][y] =
Zborder
;
+ cav->cave[x][y] =
Cblank
;
// then copy the real level contents from level file into the playfield
for (y = 0; y < cav->height; y++) for (x = 0; x < cav->width; x++)
{
// then copy the real level contents from level file into the playfield
for (y = 0; y < cav->height; y++) for (x = 0; x < cav->width; x++)
{
- int new_element = map_element_RND_to_EM(level->field[x][y]);
+ int new_element = map_element_RND_to_EM
_cave
(level->field[x][y]);
if (level->field[x][y] == EL_AMOEBA_DEAD)
if (level->field[x][y] == EL_AMOEBA_DEAD)
- new_element = map_element_RND_to_EM(EL_AMOEBA_WET);
+ new_element = map_element_RND_to_EM
_cave
(EL_AMOEBA_WET);
cav->cave[x][y] = new_element;
}
cav->cave[x][y] = new_element;
}
@@
-3604,7
+3608,7
@@
static void CopyNativeLevel_RND_to_EM(struct LevelInfo *level)
cav->player_x[player_nr] = x;
cav->player_y[player_nr] = y;
cav->player_x[player_nr] = x;
cav->player_y[player_nr] = y;
- cav->cave[x][y] = map_element_RND_to_EM(EL_EMPTY);
+ cav->cave[x][y] = map_element_RND_to_EM
_cave
(EL_EMPTY);
}
}
}
}
}
}
@@
-3651,7
+3655,7
@@
static void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
for (y = 0; y < 3; y++)
for (x = 0; x < 3; x++)
level->yamyam_content[i].e[x][y] =
for (y = 0; y < 3; y++)
for (x = 0; x < 3; x++)
level->yamyam_content[i].e[x][y] =
- map_element_EM_to_RND(cav->eater_array[i][y * 3 + x]);
+ map_element_EM_to_RND
_cave
(cav->eater_array[i][y * 3 + x]);
level->amoeba_speed = cav->amoeba_time;
level->time_magic_wall = cav->wonderwall_time;
level->amoeba_speed = cav->amoeba_time;
level->time_magic_wall = cav->wonderwall_time;
@@
-3660,7
+3664,7
@@
static void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
level->android_move_time = cav->android_move_time;
level->android_clone_time = cav->android_clone_time;
level->ball_random = cav->ball_random;
level->android_move_time = cav->android_move_time;
level->android_clone_time = cav->android_clone_time;
level->ball_random = cav->ball_random;
- level->ball_
state_initial = cav->ball_stat
e;
+ level->ball_
active_initial = cav->ball_activ
e;
level->ball_time = cav->ball_time;
level->num_ball_contents = cav->num_ball_arrays;
level->ball_time = cav->ball_time;
level->num_ball_contents = cav->num_ball_arrays;
@@
-3677,14
+3681,14
@@
static void CopyNativeLevel_EM_to_RND(struct LevelInfo *level)
for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
for (j = 0; j < 8; j++)
level->ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]] =
for (i = 0; i < MAX_ELEMENT_CONTENTS; i++)
for (j = 0; j < 8; j++)
level->ball_content[i].e[ball_xy[j][0]][ball_xy[j][1]] =
- map_element_EM_to_RND(cav->ball_array[i][j]);
+ map_element_EM_to_RND
_cave
(cav->ball_array[i][j]);
map_android_clone_elements_EM_to_RND(level);
// convert the playfield (some elements need special treatment)
for (y = 0; y < level->fieldy; y++) for (x = 0; x < level->fieldx; x++)
{
map_android_clone_elements_EM_to_RND(level);
// convert the playfield (some elements need special treatment)
for (y = 0; y < level->fieldy; y++) for (x = 0; x < level->fieldx; x++)
{
- int new_element = map_element_EM_to_RND(cav->cave[x][y]);
+ int new_element = map_element_EM_to_RND
_cave
(cav->cave[x][y]);
if (new_element == EL_AMOEBA_WET && level->amoeba_speed == 0)
new_element = EL_AMOEBA_DEAD;
if (new_element == EL_AMOEBA_WET && level->amoeba_speed == 0)
new_element = EL_AMOEBA_DEAD;
@@
-3982,7
+3986,7
@@
static void CopyNativeTape_SP_to_RND(struct LevelInfo *level)
int demo_repeat = (demo->data[i] & 0xf0) >> 4;
int tape_action = map_key_SP_to_RND(demo_action);
int tape_repeat = demo_repeat + 1;
int demo_repeat = (demo->data[i] & 0xf0) >> 4;
int tape_action = map_key_SP_to_RND(demo_action);
int tape_repeat = demo_repeat + 1;
- byte action[MAX_
PLAYERS] = { tape_action, 0, 0, 0
};
+ byte action[MAX_
TAPE_ACTIONS] = { tape_action
};
boolean success = 0;
int j;
boolean success = 0;
int j;
@@
-7615,6
+7619,20
@@
static void setTapeInfoToDefaults(void)
tape.no_valid_file = FALSE;
}
tape.no_valid_file = FALSE;
}
+static int getTapePosSize(struct TapeInfo *tape)
+{
+ int tape_pos_size = 0;
+
+ if (!tape->use_mouse)
+ tape_pos_size += tape->num_participating_players;
+ else
+ tape_pos_size += 3; // x and y position and mouse button mask
+
+ tape_pos_size += 1; // tape action delay value
+
+ return tape_pos_size;
+}
+
static int LoadTape_VERS(File *file, int chunk_size, struct TapeInfo *tape)
{
tape->file_version = getFileVersion(file);
static int LoadTape_VERS(File *file, int chunk_size, struct TapeInfo *tape)
{
tape->file_version = getFileVersion(file);
@@
-7687,8
+7705,7
@@
static int LoadTape_INFO(File *file, int chunk_size, struct TapeInfo *tape)
static int LoadTape_BODY(File *file, int chunk_size, struct TapeInfo *tape)
{
int i, j;
static int LoadTape_BODY(File *file, int chunk_size, struct TapeInfo *tape)
{
int i, j;
- int tape_pos_size =
- (tape->use_mouse ? 3 : tape->num_participating_players) + 1;
+ int tape_pos_size = getTapePosSize(tape);
int chunk_size_expected = tape_pos_size * tape->length;
if (chunk_size_expected != chunk_size)
int chunk_size_expected = tape_pos_size * tape->length;
if (chunk_size_expected != chunk_size)
@@
-8101,7
+8118,6
@@
void SaveTape(int nr)
{
char *filename = getTapeFilename(nr);
FILE *file;
{
char *filename = getTapeFilename(nr);
FILE *file;
- int num_participating_players = 0;
int tape_pos_size;
int info_chunk_size;
int body_chunk_size;
int tape_pos_size;
int info_chunk_size;
int body_chunk_size;
@@
-8118,12
+8134,14
@@
void SaveTape(int nr)
tape.file_version = FILE_VERSION_ACTUAL;
tape.game_version = GAME_VERSION_ACTUAL;
tape.file_version = FILE_VERSION_ACTUAL;
tape.game_version = GAME_VERSION_ACTUAL;
+ tape.num_participating_players = 0;
+
// count number of participating players
for (i = 0; i < MAX_PLAYERS; i++)
if (tape.player_participates[i])
// count number of participating players
for (i = 0; i < MAX_PLAYERS; i++)
if (tape.player_participates[i])
- num_participating_players++;
+
tape.
num_participating_players++;
- tape_pos_size =
(tape.use_mouse ? 3 : num_participating_players) + 1
;
+ tape_pos_size =
getTapePosSize(&tape)
;
info_chunk_size = 2 + (strlen(tape.level_identifier) + 1) + 2;
body_chunk_size = tape_pos_size * tape.length;
info_chunk_size = 2 + (strlen(tape.level_identifier) + 1) + 2;
body_chunk_size = tape_pos_size * tape.length;
@@
-8361,6
+8379,10
@@
static struct TokenInfo global_setup_tokens[] =
TYPE_SWITCH,
&setup.scroll_delay, "scroll_delay"
},
TYPE_SWITCH,
&setup.scroll_delay, "scroll_delay"
},
+ {
+ TYPE_SWITCH,
+ &setup.forced_scroll_delay, "forced_scroll_delay"
+ },
{
TYPE_INTEGER,
&setup.scroll_delay_value, "scroll_delay_value"
{
TYPE_INTEGER,
&setup.scroll_delay_value, "scroll_delay_value"
@@
-9106,6
+9128,7
@@
static void setSetupInfoToDefaults(struct SetupInfo *si)
si->sound_simple = TRUE;
si->toons = TRUE;
si->scroll_delay = TRUE;
si->sound_simple = TRUE;
si->toons = TRUE;
si->scroll_delay = TRUE;
+ si->forced_scroll_delay = FALSE;
si->scroll_delay_value = STD_SCROLL_DELAY;
si->engine_snapshot_mode = getStringCopy(STR_SNAPSHOT_MODE_DEFAULT);
si->engine_snapshot_memory = SNAPSHOT_MEMORY_DEFAULT;
si->scroll_delay_value = STD_SCROLL_DELAY;
si->engine_snapshot_mode = getStringCopy(STR_SNAPSHOT_MODE_DEFAULT);
si->engine_snapshot_memory = SNAPSHOT_MEMORY_DEFAULT;
@@
-10300,6
+10323,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, "block_clicks"))
+ result |= STYLE_BLOCK;
+
if (string_has_parameter(value, "passthrough_clicks"))
result |= STYLE_PASSTHROUGH;
if (string_has_parameter(value, "passthrough_clicks"))
result |= STYLE_PASSTHROUGH;