int i;
/* always start with reliable default values (empty tape) */
- tape.file_version = FILE_VERSION_ACTUAL;
- tape.game_version = GAME_VERSION_ACTUAL;
TapeErase();
/* default values (also for pre-1.2 tapes) with only the first player */
if (tape->file_version >= FILE_VERSION_1_2)
{
byte store_participating_players = fgetc(file);
-
- ReadUnusedBytesFromFile(file, TAPE_HEADER_UNUSED);
+ int engine_version;
/* since version 1.2, tapes store which players participate in the tape */
tape->num_participating_players = 0;
}
}
- ReadUnusedBytesFromFile(file, 4);
+ ReadUnusedBytesFromFile(file, TAPE_HEADER_UNUSED);
+
+ engine_version = getFileVersion(file);
+ if (engine_version > 0)
+ tape->engine_version = engine_version;
}
return chunk_size;
fputc(store_participating_players, file);
+ /* unused bytes not at the end here for 4-byte alignment of engine_version */
WriteUnusedBytesToFile(file, TAPE_HEADER_UNUSED);
- WriteUnusedBytesToFile(file, 4);
+ putFileVersion(file, tape->engine_version);
}
static void SaveTape_BODY(FILE *file, struct TapeInfo *tape)
static void InitGameEngine()
{
- boolean emulate_bd = TRUE; /* unless non-BOULDERDASH elements found */
- boolean emulate_sb = TRUE; /* unless non-SOKOBAN elements found */
- boolean emulate_sp = TRUE; /* unless non-SUPAPLEX elements found */
- int i, x, y;
-
- for(y=0; y<lev_fieldy; y++)
- {
- for(x=0; x<lev_fieldx; x++)
- {
- if (emulate_bd && !IS_BD_ELEMENT(Feld[x][y]))
- emulate_bd = FALSE;
- if (emulate_sb && !IS_SB_ELEMENT(Feld[x][y]))
- emulate_sb = FALSE;
- if (emulate_sp && !IS_SP_ELEMENT(Feld[x][y]))
- emulate_sp = FALSE;
- }
- }
+ int i;
game.engine_version = (tape.playing ? tape.engine_version :
level.game_version);
- game.emulation = (emulate_bd ? EMU_BOULDERDASH :
- emulate_sb ? EMU_SOKOBAN :
- emulate_sp ? EMU_SUPAPLEX : EMU_NONE);
#if 0
printf("level %d: level version == %06d\n", level_nr, level.game_version);
void InitGame()
{
+ boolean emulate_bd = TRUE; /* unless non-BOULDERDASH elements found */
+ boolean emulate_sb = TRUE; /* unless non-SOKOBAN elements found */
+ boolean emulate_sp = TRUE; /* unless non-SUPAPLEX elements found */
int i, j, x, y;
InitGameEngine();
}
for(y=0; y<lev_fieldy; y++)
+ {
for(x=0; x<lev_fieldx; x++)
+ {
+ if (emulate_bd && !IS_BD_ELEMENT(Feld[x][y]))
+ emulate_bd = FALSE;
+ if (emulate_sb && !IS_SB_ELEMENT(Feld[x][y]))
+ emulate_sb = FALSE;
+ if (emulate_sp && !IS_SP_ELEMENT(Feld[x][y]))
+ emulate_sp = FALSE;
+
InitField(x, y, TRUE);
+ }
+ }
+
+ game.emulation = (emulate_bd ? EMU_BOULDERDASH :
+ emulate_sb ? EMU_SOKOBAN :
+ emulate_sp ? EMU_SUPAPLEX : EMU_NONE);
/* correct non-moving belts to start moving left */
for (i=0; i<4; i++)
return FALSE;
#else
if (!FrameReached(&player->move_delay, player->move_delay_value) &&
- !(tape.playing && tape.game_version < GAME_VERSION_2_0))
+ !(tape.playing && tape.file_version < FILE_VERSION_2_0))
return FALSE;
#endif
return MF_NO_ACTION;
#else
if (!FrameReached(&player->push_delay, player->push_delay_value) &&
- !(tape.playing && tape.game_version < GAME_VERSION_2_0) &&
+ !(tape.playing && tape.file_version < FILE_VERSION_2_0) &&
element != EL_SPRING)
return MF_NO_ACTION;
#endif
return MF_NO_ACTION;
#else
if (!FrameReached(&player->push_delay, player->push_delay_value) &&
- !(tape.playing && tape.game_version < GAME_VERSION_2_0) &&
+ !(tape.playing && tape.file_version < FILE_VERSION_2_0) &&
element != EL_BALLOON)
return MF_NO_ACTION;
#endif