Skip to content

Commit

Permalink
Bump SAVEGAME_VERSION to 18 for the CstDoom3 GUI changes
Browse files Browse the repository at this point in the history
incl. backwards compat for older savegames.
only partly useful: old savegames only work if you didn't change the
gamedata, with the CstDoom3 .gui files, loading them crashes. I don't
think that can be avoided, apparently Doom3 has no way to detect that
the GUIs have changed?
  • Loading branch information
DanielGibson committed Jan 18, 2025
1 parent a9f1488 commit b4960d1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 13 deletions.
3 changes: 2 additions & 1 deletion neo/framework/Licensee.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ If you have questions concerning this license or the applicable additional terms
// NOTE: a seperate core savegame version and game savegame version could be useful
// 16: Doom v1.1
// 17: Doom v1.2 / D3XP. Can still read old v16 with defaults for new data
#define SAVEGAME_VERSION 17
// 18: dhewm3 with CstDoom3 anchored window support - can still read v16 and v17, unless gamedata changed
#define SAVEGAME_VERSION 18

// <= Doom v1.1: 1. no DS_VERSION token ( default )
// Doom v1.2: 2
Expand Down
3 changes: 1 addition & 2 deletions neo/framework/Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2130,8 +2130,7 @@ bool idSessionLocal::LoadGame( const char *saveName ) {
// check the version, if it doesn't match, cancel the loadgame,
// but still load the map with the persistant playerInfo from the header
// so that the player doesn't lose too much progress.
if ( savegameVersion != SAVEGAME_VERSION &&
!( savegameVersion == 16 && SAVEGAME_VERSION == 17 ) ) { // handle savegame v16 in v17
if ( savegameVersion < 16 || savegameVersion > SAVEGAME_VERSION ) { // dhewm3 supports savegames with v16 - v18
common->Warning( "Savegame Version mismatch: aborting loadgame and starting level with persistent data" );
loadingSaveGame = false;
fileSystem->CloseFile( savegameFile );
Expand Down
14 changes: 9 additions & 5 deletions neo/ui/SimpleWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ If you have questions concerning this license or the applicable additional terms
*/

#include "sys/platform.h"
#include "framework/Session.h"
#include "ui/DeviceContext.h"
#include "ui/Window.h"
#include "ui/UserInterfaceLocal.h"
Expand Down Expand Up @@ -476,11 +477,14 @@ void idSimpleWindow::ReadFromSaveGame( idFile *savefile ) {
shear.ReadFromSaveGame( savefile );
backGroundName.ReadFromSaveGame( savefile );

//#modified-fva; BEGIN // FIXME: savegame version?
cstAnchor.ReadFromSaveGame(savefile);
cstAnchorTo.ReadFromSaveGame(savefile);
cstAnchorFactor.ReadFromSaveGame(savefile);
savefile->Read(&cstNoClipBackground, sizeof(cstNoClipBackground));
//#modified-fva; BEGIN
// TODO: why does this have to be read from the savegame anyway, does it change?
if ( session->GetSaveGameVersion() >= 18 ) {
cstAnchor.ReadFromSaveGame(savefile);
cstAnchorTo.ReadFromSaveGame(savefile);
cstAnchorFactor.ReadFromSaveGame(savefile);
savefile->Read(&cstNoClipBackground, sizeof(cstNoClipBackground));
} // else keep default values, I guess
//#modified-fva; END

int stringLen;
Expand Down
13 changes: 8 additions & 5 deletions neo/ui/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3782,11 +3782,14 @@ void idWindow::ReadFromSaveGame( idFile *savefile ) {
hideCursor = false;
}

//#modified-fva; BEGIN // FIXME: savegame version?
cstAnchor.ReadFromSaveGame(savefile);
cstAnchorTo.ReadFromSaveGame(savefile);
cstAnchorFactor.ReadFromSaveGame(savefile);
savefile->Read(&cstNoClipBackground, sizeof(cstNoClipBackground));
//#modified-fva; BEGIN
// TODO: why does this have to be read from the savegame anyway, does it change?
if ( session->GetSaveGameVersion() >= 18 ) {
cstAnchor.ReadFromSaveGame(savefile);
cstAnchorTo.ReadFromSaveGame(savefile);
cstAnchorFactor.ReadFromSaveGame(savefile);
savefile->Read(&cstNoClipBackground, sizeof(cstNoClipBackground));
} // else keep default values, I guess
//#modified-fva; END

// Defined Vars
Expand Down

0 comments on commit b4960d1

Please sign in to comment.