* Fix readFXData to mark all the EFFECTs it loads as active

* Add a large amount of serializeX/deserializeX functions for the different savegame versions
 * Use uintX_t instead of the *WORD series of variables for structures that'll be saved out to disk (only those directly related to savegame code right now)
 * Make the save&load functions in game.c use the serialization and deserialization series of functions (this is also directly from a file rather than an intermediate in-memory buffer)
 * Remove function endian_SaveGameV since endian swapping is being dealt with by the (de)serialization functions
 * This commit changes the *.gam files from little endian to big endian, so expect loading of previous savegames to break

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2416 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2007-08-18 21:37:37 +00:00
parent c6d64739e1
commit 415ac4a437
8 changed files with 1431 additions and 828 deletions

View File

@ -2929,6 +2929,8 @@ bool readFXData(const char* fileName)
PHYSFS_close(fileHandle);
return false;
}
effectStatus[i] = ES_ACTIVE;
}
/* Ensure free effects kept up to date */

2203
src/game.c

File diff suppressed because it is too large Load Diff

View File

@ -126,9 +126,10 @@ typedef struct _score_save_header
/***************************************************************************/
extern BOOL loadGame(const char *pGameToLoad, BOOL keepObjects, BOOL freeMem, BOOL UserSaveGame); // UserSaveGame is TRUE when the save game is not a new level (User Save Game)
/*This just loads up the .gam file to determine which level data to set up - split up
so can be called in levLoadData when starting a game from a load save game*/
extern BOOL loadGameInit(const char *pGameToLoad);
extern bool loadGameInit(const char* fileName);
extern BOOL loadMissionExtras(const char *pGameToLoad, SWORD levelType);
@ -139,12 +140,12 @@ extern BOOL loadScriptState(char *pFileName);
extern BOOL loadTerrainTypeMap(const char *pFileData, UDWORD filesize);
//direct access for forceloader
extern BOOL gameLoad(char *pFileData, UDWORD filesize);
extern bool gameLoad(const char* fileName);
extern BOOL saveGame(char *aFileName, SDWORD saveType);
// Get the campaign number for loadGameInit game
extern UDWORD getCampaign(char *pGameToLoad, BOOL *bSkipCDCheck);
extern UDWORD getCampaign(const char* fileName);
/*calls windows find file tree*/
extern BOOL getSaveGameName(char *pName);

View File

@ -400,7 +400,6 @@ static BOOL _runLoadSave(BOOL bResetMissionWidgets)
char sTemp[MAX_STR_LENGTH];
UDWORD i;
W_CONTEXT context;
BOOL bSkipCD = FALSE;
id = widgRunScreen(psRequestScreen);
@ -553,7 +552,7 @@ failure:
// success on load.
success:
setCampaignNumber( getCampaign(sRequestResult,&bSkipCD) );
setCampaignNumber( getCampaign(sRequestResult) );
successforce:
closeLoadSave();
bRequestLoad = TRUE;

View File

@ -493,7 +493,7 @@ GAMECODE gameLoop(void)
}
else
{
ASSERT( FALSE,"Mid Mission: saveGame Failed" );
ASSERT(!"saveGame(sRequestResult, GTYPE_SAVE_MIDMISSION) failed", "Mid Mission: saveGame Failed" );
deleteSaveGame(sRequestResult);
}
}

View File

@ -32,14 +32,14 @@
//hopefully they'll never need to set it this high for other reasons!
#define SCR_LZ_COMPROMISED_TIME 999999
//this is used to compare the value passed in from the scripts with which is multiplied by 100
#define LZ_COMPROMISED_TIME 99999900
#define LZ_COMPROMISED_TIME 99999900
typedef struct _landing_zone
{
UBYTE x1;
UBYTE y1;
UBYTE x2;
UBYTE y2;
uint8_t x1;
uint8_t y1;
uint8_t x2;
uint8_t y2;
} LANDING_ZONE;
//storage structure for values that need to be kept between missions

View File

@ -97,22 +97,22 @@ typedef enum _msgtype
// /////////////////////////////////////////////////////////////////////////////////////////////////
// Game Options Structure. Enough info to completely describe the static stuff in amultiplay game.
typedef struct {
UBYTE type; // DMATCH/CAMPAIGN/SKIRMISH/TEAMPLAY etc...
uint8_t type; // DMATCH/CAMPAIGN/SKIRMISH/TEAMPLAY etc...
char map[128]; // name of multiplayer map being used.
char version[8]; // version of warzone
UBYTE maxPlayers; // max players to allow
uint8_t maxPlayers; // max players to allow
char name[128]; // game name (to be used)
BOOL fog;
UDWORD power; // power level for arena game
// UDWORD techLevel; // tech levels to use . 0= all levels.
UBYTE base; // clean/base/base&defence
UBYTE alliance; // no/yes/AIs vs Humans
UBYTE limit; // limit no/time/frag
UWORD bytesPerSec; // maximum bitrate achieved before dropping checks.
UBYTE packetsPerSec; // maximum packets to send before dropping checks.
UBYTE encryptKey; // key to use for encryption.
// UBYTE skirmishPlayers[MAX_PLAYERS];// players to use in skirmish game.
UBYTE skDiff[MAX_PLAYERS]; // skirmish game difficulty settings.
uint32_t power; // power level for arena game
// uint32_t techLevel; // tech levels to use . 0= all levels.
uint8_t base; // clean/base/base&defence
uint8_t alliance; // no/yes/AIs vs Humans
uint8_t limit; // limit no/time/frag
uint16_t bytesPerSec; // maximum bitrate achieved before dropping checks.
uint8_t packetsPerSec; // maximum packets to send before dropping checks.
uint8_t encryptKey; // key to use for encryption.
// uint8_t skirmishPlayers[MAX_PLAYERS];// players to use in skirmish game.
uint8_t skDiff[MAX_PLAYERS]; // skirmish game difficulty settings.
} MULTIPLAYERGAME, *LPMULTIPLAYERGAME;

View File

@ -28,10 +28,10 @@
// data for barbarians retreating
typedef struct _run_data
{
Vector2i sPos; // position to retreat to
UBYTE forceLevel; // number of units below which might run
UBYTE healthLevel; // %health value below which to turn and run - FOR GROUPS ONLY
UBYTE leadership; // basic chance to run
Vector2i sPos; // position to retreat to
uint8_t forceLevel; // number of units below which might run
uint8_t healthLevel; // %health value below which to turn and run - FOR GROUPS ONLY
uint8_t leadership; // basic chance to run
} RUN_DATA;
typedef struct _droid_order_data