Finalize the work on the new save file format.
Remove all references to state files from the format. Some still leaks in in the GmSt chunk, but those are ignored or overwritten by later loading phases.
This commit is contained in:
+1
-33
@@ -298,7 +298,7 @@ LoadGameState (GAME_STATE *GSPtr, void *fh)
|
||||
return FALSE;
|
||||
}
|
||||
read_32 (fh, &magic);
|
||||
if (magic != 79)
|
||||
if (magic != 75)
|
||||
{
|
||||
/* Chunk is the wrong size. */
|
||||
return FALSE;
|
||||
@@ -334,8 +334,6 @@ LoadGameState (GAME_STATE *GSPtr, void *fh)
|
||||
read_16s (fh, &GSPtr->velocity.incr.width);
|
||||
read_16s (fh, &GSPtr->velocity.incr.height);
|
||||
|
||||
read_32 (fh, &GSPtr->BattleGroupRef);
|
||||
|
||||
read_32 (fh, &magic);
|
||||
if (magic != GAME_STATE_TAG)
|
||||
{
|
||||
@@ -446,27 +444,6 @@ LoadStarDesc (STAR_DESC *SDPtr, void *fh)
|
||||
read_8 (fh, &SDPtr->Postfix);
|
||||
}
|
||||
|
||||
static void
|
||||
LoadStateFile (int file_type, void *fh, DWORD flen)
|
||||
{
|
||||
GAME_STATE_FILE *fp = OpenStateFile (file_type, "wb");
|
||||
char buf[256];
|
||||
if (fp)
|
||||
{
|
||||
while (flen)
|
||||
{
|
||||
COUNT num_bytes;
|
||||
|
||||
num_bytes = flen >= sizeof (buf) ? sizeof (buf) : (COUNT)flen;
|
||||
read_a8 (fh, buf, num_bytes);
|
||||
WriteStateFile (buf, num_bytes, 1, fp);
|
||||
|
||||
flen -= num_bytes;
|
||||
}
|
||||
CloseStateFile (fp);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
LoadScanInfo (uio_Stream *fh, DWORD flen)
|
||||
{
|
||||
@@ -765,15 +742,6 @@ LoadGame (COUNT which_game, SUMMARY_DESC *SummPtr)
|
||||
}
|
||||
LoadBattleGroup (in_fp, chunkSize);
|
||||
break;
|
||||
case STAR_SF_TAG:
|
||||
LoadStateFile (STARINFO_FILE, in_fp, chunkSize);
|
||||
break;
|
||||
case DEFGRP_SF_TAG:
|
||||
LoadStateFile (DEFGRPINFO_FILE, in_fp, chunkSize);
|
||||
break;
|
||||
case RANDGRP_SF_TAG:
|
||||
LoadStateFile (RANDGRPINFO_FILE, in_fp, chunkSize);
|
||||
break;
|
||||
default:
|
||||
log_add (log_Debug, "Skipping chunk of tag %08X (size %u)", chunk, chunkSize);
|
||||
if (skip_8(in_fp, chunkSize) != 1)
|
||||
|
||||
+5
-9
@@ -330,7 +330,7 @@ static void
|
||||
SaveGameState (const GAME_STATE *GSPtr, uio_Stream *fh)
|
||||
{
|
||||
write_32 (fh, GLOBAL_STATE_TAG);
|
||||
write_32 (fh, 79);
|
||||
write_32 (fh, 75);
|
||||
write_8 (fh, GSPtr->glob_flags);
|
||||
write_8 (fh, GSPtr->CrewCost);
|
||||
write_8 (fh, GSPtr->FuelCost);
|
||||
@@ -362,9 +362,9 @@ SaveGameState (const GAME_STATE *GSPtr, uio_Stream *fh)
|
||||
write_16 (fh, GSPtr->velocity.incr.width);
|
||||
write_16 (fh, GSPtr->velocity.incr.height);
|
||||
|
||||
write_32 (fh, GSPtr->BattleGroupRef);
|
||||
|
||||
/* The Game state bits. Vanilla UQM uses 155 bytes here. */
|
||||
/* The Game state bits. Vanilla UQM uses 155 bytes here at
|
||||
* present. Only the first 99 bytes are significant, though;
|
||||
* the rest will be overwritten by the BtGp chunks. */
|
||||
write_32 (fh, GAME_STATE_TAG);
|
||||
write_32 (fh, sizeof (GSPtr->GameState));
|
||||
write_a8 (fh, GSPtr->GameState, sizeof (GSPtr->GameState));
|
||||
@@ -815,11 +815,7 @@ SaveGame (COUNT which_game, SUMMARY_DESC *SummPtr, const char *name)
|
||||
// Save the encounter chunk (black globes in HS/QS)
|
||||
SaveEncounters (out_fp);
|
||||
|
||||
// Save out the state file chunks.
|
||||
SaveStateFile (STARINFO_FILE, STAR_SF_TAG, out_fp);
|
||||
SaveStateFile (DEFGRPINFO_FILE, DEFGRP_SF_TAG, out_fp);
|
||||
SaveStateFile (RANDGRPINFO_FILE, RANDGRP_SF_TAG, out_fp);
|
||||
|
||||
// Save out the data that used to be in state files
|
||||
SaveStarInfo (out_fp);
|
||||
SaveGroups (out_fp);
|
||||
|
||||
|
||||
@@ -48,9 +48,6 @@ extern "C" {
|
||||
#define SCAN_TAG 0x6e616353 // "Scan": Scan Masks (stuff picked up)
|
||||
#define BATTLE_GROUP_TAG 0x70477442 // "BtGp": Battle Group definition
|
||||
#define GROUP_LIST_TAG 0x73707247 // "Grps": Group List
|
||||
#define STAR_SF_TAG 0x46534953 // "SISF": Star Info State File
|
||||
#define DEFGRP_SF_TAG 0x46534744 // "DGSF": Defined Group State File
|
||||
#define RANDGRP_SF_TAG 0x46534752 // "RGSF": Random Group State File
|
||||
|
||||
typedef struct
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user