BorderElement = EL_STEELWALL;
- level->no_level_file = FALSE;
+ level->no_valid_file = FALSE;
if (leveldir_current == NULL) /* only when dumping level */
return;
if (!(file = fopen(filename, MODE_READ)))
{
- level->no_level_file = TRUE;
+ level->no_valid_file = TRUE;
if (level != &level_template)
Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
getFileChunkBE(file, chunk_name, NULL);
if (strcmp(chunk_name, "CAVE") != 0)
{
+ level->no_valid_file = TRUE;
+
Error(ERR_WARN, "unknown format of level file '%s'", filename);
fclose(file);
return;
if (!checkCookieString(cookie, LEVEL_COOKIE_TMPL))
{
+ level->no_valid_file = TRUE;
+
Error(ERR_WARN, "unknown format of level file '%s'", filename);
fclose(file);
return;
if ((level->file_version = getFileVersionFromCookieString(cookie)) == -1)
{
+ level->no_valid_file = TRUE;
+
Error(ERR_WARN, "unsupported version of level file '%s'", filename);
fclose(file);
return;
if (!(file = fopen(filename, MODE_READ)))
{
- level->no_level_file = TRUE;
+ level->no_valid_file = TRUE;
Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
if (!(file = fopen(filename, MODE_READ)))
{
- level->no_level_file = TRUE;
+ level->no_valid_file = TRUE;
Error(ERR_WARN, "cannot read level '%s' -- using empty level", filename);
/* position file stream to the requested level inside the level package */
if (fseek(file, nr * SP_LEVEL_SIZE, SEEK_SET) != 0)
{
- level->no_level_file = TRUE;
+ level->no_valid_file = TRUE;
Error(ERR_WARN, "cannot fseek level '%s' -- using empty level", filename);
void DumpLevel(struct LevelInfo *level)
{
+ if (level->no_valid_file)
+ {
+ Error(ERR_WARN, "cannot dump -- no valid level file found");
+
+ return;
+ }
+
printf_line("-", 79);
printf("Level xxx (file version %08d, game version %08d)\n",
level->file_version, level->game_version);
tape.recording = FALSE;
tape.playing = FALSE;
tape.pausing = FALSE;
+
+ tape.no_valid_file = FALSE;
}
static int LoadTape_VERS(FILE *file, int chunk_size, struct TapeInfo *tape)
setTapeInfoToDefaults();
if (!(file = fopen(filename, MODE_READ)))
+ {
+ tape.no_valid_file = TRUE;
+
+ Error(ERR_WARN, "cannot read tape '%s' -- using empty tape", filename);
+
return;
+ }
getFileChunkBE(file, chunk_name, NULL);
if (strcmp(chunk_name, "RND1") == 0)
getFileChunkBE(file, chunk_name, NULL);
if (strcmp(chunk_name, "TAPE") != 0)
{
+ tape.no_valid_file = TRUE;
+
Error(ERR_WARN, "unknown format of tape file '%s'", filename);
fclose(file);
return;
if (!checkCookieString(cookie, TAPE_COOKIE_TMPL))
{
+ tape.no_valid_file = TRUE;
+
Error(ERR_WARN, "unknown format of tape file '%s'", filename);
fclose(file);
return;
if ((tape.file_version = getFileVersionFromCookieString(cookie)) == -1)
{
+ tape.no_valid_file = TRUE;
+
Error(ERR_WARN, "unsupported version of tape file '%s'", filename);
fclose(file);
return;
{
int i, j;
+#if 1
+ if (tape->no_valid_file)
+ {
+ Error(ERR_WARN, "cannot dump -- no valid tape file found");
+
+ return;
+ }
+#else
if (TAPE_IS_EMPTY(*tape))
{
Error(ERR_WARN, "no tape available for level %d", tape->level_nr);
+
return;
}
+#endif
printf_line("-", 79);
printf("Tape of Level %03d (file version %08d, game version %08d)\n",
{
if (game.gravity && !player->programmed_action)
{
- int move_dir_vertical = player->action & (MV_UP | MV_DOWN);
- int move_dir_horizontal = player->action & (MV_LEFT | MV_RIGHT);
+ int move_dir_horizontal = player->action & MV_HORIZONTAL;
+ int move_dir_vertical = player->action & MV_VERTICAL;
int move_dir =
- (player->last_move_dir & (MV_LEFT | MV_RIGHT) ?
+ (player->last_move_dir & MV_HORIZONTAL ?
(move_dir_vertical ? move_dir_vertical : move_dir_horizontal) :
(move_dir_horizontal ? move_dir_horizontal : move_dir_vertical));
int jx = player->jx, jy = player->jy;
int dx = (move_dir & MV_LEFT ? -1 : move_dir & MV_RIGHT ? +1 : 0);
int dy = (move_dir & MV_UP ? -1 : move_dir & MV_DOWN ? +1 : 0);
int new_jx = jx + dx, new_jy = jy + dy;
+ boolean player_is_snapping = player->action & JOY_BUTTON_1;
boolean field_under_player_is_free =
(IN_LEV_FIELD(jx, jy + 1) && IS_FREE(jx, jy + 1));
boolean player_is_moving_to_valid_field =
- (IN_LEV_FIELD(new_jx, new_jy) &&
+ (
+#if 1
+ !player_is_snapping &&
+#endif
+ IN_LEV_FIELD(new_jx, new_jy) &&
(Feld[new_jx][new_jy] == EL_SP_BASE ||
Feld[new_jx][new_jy] == EL_SAND ||
(IS_SP_PORT(Feld[new_jx][new_jy]) &&
(IS_WALKABLE(Feld[jx][jy]) &&
!(element_info[Feld[jx][jy]].access_direction & MV_DOWN)));
+#if 0
+ printf("::: checking gravity NOW [%d, %d, %d] [%d] ...\n",
+ field_under_player_is_free,
+ player_is_standing_on_valid_field,
+ player_is_moving_to_valid_field,
+ (player_is_moving_to_valid_field ? Feld[new_jx][new_jy] : -1));
+#endif
+
if (field_under_player_is_free &&
!player_is_standing_on_valid_field &&
!player_is_moving_to_valid_field)
+ {
+#if 0
+ printf("::: setting programmed_action to MV_DOWN ...\n");
+#endif
+
player->programmed_action = MV_DOWN;
+ }
}
}
player->move_delay_value = original_move_delay_value;
}
- if (player->last_move_dir & (MV_LEFT | MV_RIGHT))
+ if (player->last_move_dir & MV_HORIZONTAL)
{
if (!(moved |= MovePlayerOneStep(player, 0, dy, dx, dy)))
moved |= MovePlayerOneStep(player, dx, 0, dx, dy);