Skip to content

Commit

Permalink
Engine: drop support of pre-3.5.0-alpha movelist format version
Browse files Browse the repository at this point in the history
This version was in public pre-alpha release and stayed for 3 months before being replaced by an updated format along with the new A* pathfinder.
  • Loading branch information
ivan-mogilko committed Oct 26, 2023
1 parent 24d2f58 commit 5ddadb0
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Engine/ac/characterextras.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ using namespace AGS; // FIXME later

enum CharacterSvgVersion
{
kCharSvgVersion_Initial = 0,
kCharSvgVersion_Initial = 0, // [UNSUPPORTED] from 3.5.0 pre-alpha
kCharSvgVersion_350 = 1, // new movelist format (along with pathfinder)
kCharSvgVersion_36025 = 2, // animation volume
kCharSvgVersion_36109 = 3, // removed movelists, save externally
Expand Down
4 changes: 2 additions & 2 deletions Engine/ac/movelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ HSaveError MoveList::ReadFromSavegame(Stream *in, int32_t cmp_ver)
{
if (cmp_ver < kMoveSvgVersion_350)
{
ReadFromSavegame_Legacy(in); // FIXME: pass an arg to not use padding; OR remove support of kMoveSvgVersion_Initial?
return HSaveError::None();
return new SavegameError(kSvgErr_UnsupportedComponentVersion,
String::FromFormat("Movelist format %d is no longer supported", cmp_ver));
}

*this = MoveList(); // reset struct
Expand Down
2 changes: 1 addition & 1 deletion Engine/ac/movelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ enum MoveListDoneFlags

enum MoveListSvgVersion
{
kMoveSvgVersion_Initial = 0,
kMoveSvgVersion_Initial = 0, // [UNSUPPORTED] from 3.5.0 pre-alpha
kMoveSvgVersion_350, // new pathfinder, arbitrary number of stages
kMoveSvgVersion_36109, // skip empty lists, progress as float
};
Expand Down
2 changes: 1 addition & 1 deletion Engine/ac/roomstatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ struct HotspotState
// Savegame data format for RoomStatus
enum RoomStatSvgVersion
{
kRoomStatSvgVersion_Initial = 0,
kRoomStatSvgVersion_Initial = 0, // [UNSUPPORTED] from 3.5.0 pre-alpha
kRoomStatSvgVersion_350 = 1, // new movelist format (along with pathfinder)
kRoomStatSvgVersion_36016 = 2, // hotspot and object names
kRoomStatSvgVersion_36025 = 3, // object animation volume
Expand Down
14 changes: 6 additions & 8 deletions Engine/game/savegame_components.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,6 @@ HSaveError ReadCharacters(Stream *in, int32_t cmp_ver, const PreservedParams& /*
HSaveError err;
if (!AssertGameContent(err, in->ReadInt32(), game.numcharacters, "Characters"))
return err;
const int mls_cmp_ver = cmp_ver > kCharSvgVersion_Initial ? kMoveSvgVersion_350 : kMoveSvgVersion_Initial;
for (int i = 0; i < game.numcharacters; ++i)
{
game.chars[i].ReadFromSavegame(in, cmp_ver);
Expand All @@ -569,7 +568,7 @@ HSaveError ReadCharacters(Stream *in, int32_t cmp_ver, const PreservedParams& /*
// character movement path (for old saves)
if (cmp_ver < kCharSvgVersion_36109)
{
err = mls[CHMLSOFFS + i].ReadFromSavegame(in, mls_cmp_ver);
err = mls[CHMLSOFFS + i].ReadFromSavegame(in, kMoveSvgVersion_350);
if (!err)
return err;
}
Expand Down Expand Up @@ -1102,10 +1101,9 @@ HSaveError ReadThisRoom(Stream *in, int32_t cmp_ver, const PreservedParams& /*pp
int objmls_count = in->ReadInt32();
if (!AssertCompatLimit(err, objmls_count, CHMLSOFFS, "room object move lists"))
return err;
const int mls_cmp_ver = cmp_ver > kRoomStatSvgVersion_Initial ? kMoveSvgVersion_350 : kMoveSvgVersion_Initial;
for (int i = 0; i < objmls_count; ++i)
{
err = mls[i].ReadFromSavegame(in, mls_cmp_ver);
err = mls[i].ReadFromSavegame(in, kMoveSvgVersion_350);
if (!err)
return err;
}
Expand Down Expand Up @@ -1212,7 +1210,7 @@ ComponentHandler ComponentHandlers[] =
{
"Characters",
kCharSvgVersion_36109,
kCharSvgVersion_Initial,
kCharSvgVersion_350, // skip pre-alpha 3.5.0 ver
WriteCharacters,
ReadCharacters
},
Expand Down Expand Up @@ -1282,21 +1280,21 @@ ComponentHandler ComponentHandlers[] =
{
"Room States",
kRoomStatSvgVersion_36109,
kRoomStatSvgVersion_Initial,
kRoomStatSvgVersion_350, // skip pre-alpha 3.5.0 ver
WriteRoomStates,
ReadRoomStates
},
{
"Loaded Room State",
kRoomStatSvgVersion_36109, // must correspond to "Room States"
kRoomStatSvgVersion_Initial,
kRoomStatSvgVersion_350, // skip pre-alpha 3.5.0 ver
WriteThisRoom,
ReadThisRoom
},
{
"Move Lists",
kMoveSvgVersion_36109,
kMoveSvgVersion_Initial,
kMoveSvgVersion_350, // skip pre-alpha 3.5.0 ver
WriteMoveLists,
ReadMoveLists
},
Expand Down

0 comments on commit 5ddadb0

Please sign in to comment.