Save extra sprite flags, sprite cache settings, and all quotes to savegames

git-svn-id: https://svn.eduke32.com/eduke32@105 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
terminx 2006-04-24 04:57:04 +00:00
parent 13716bb952
commit b6f86cc379
4 changed files with 59 additions and 6 deletions

View file

@ -845,12 +845,16 @@ enum logoflags {
extern char numl, condebug;
extern char cheatkey[2];
#define MAXCHEATLEN 20
#define NUMCHEATCODES (signed int)(sizeof(cheatquotes)/sizeof(cheatquotes[MAXCHEATLEN]))
extern char cheatkey[2];
extern char cheatquotes[][MAXCHEATLEN];
extern short weapon_sprites[MAX_WEAPONS];
extern int redefined_quote_count;
#ifdef __cplusplus
}
#endif

View file

@ -6280,9 +6280,6 @@ PALONLY:
static char terminx[64] = { "Undead TC still sucks." };
// #define NUMCHEATCODES 26
// #define NUMCHEATCODES (signed int)(sizeof(cheatquotes)/sizeof(cheatquotes[14]))
#define NUMCHEATCODES (signed int)(sizeof(cheatquotes)/sizeof(cheatquotes[MAXCHEATLEN]))
char cheatquotes[][MAXCHEATLEN] = {
"cornholio", // 0
"stuff", // 1

View file

@ -4551,7 +4551,6 @@ repeatcase:
if (tw == CON_REDEFINEQUOTE)
{
redefined_quote_count++;
if(redefined_quotes[redefined_quote_count] == NULL)
redefined_quotes[redefined_quote_count] = Bcalloc(MAXQUOTELEN,sizeof(char));
if (!redefined_quotes[redefined_quote_count])
@ -4590,6 +4589,7 @@ repeatcase:
{
*(fta_quotes[redefined_quote_count]+i) = '\0';
*scriptptr++=redefined_quote_count;
redefined_quote_count++;
}
return 0;

View file

@ -283,6 +283,36 @@ int loadplayer(signed char spot)
if (kdfread(&defaultprojectile[0],sizeof(proj_struct),MAXTILES,fil) != MAXTILES) goto corrupt;
if (kdfread(&thisprojectile[0],sizeof(proj_struct),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
if (kdfread(&spriteflags[0],sizeof(spriteflags[0]),MAXTILES,fil) != MAXTILES) goto corrupt;
if (kdfread(&actorspriteflags[0],sizeof(actorspriteflags[0]),MAXSPRITES,fil) != MAXSPRITES) goto corrupt;
if (kdfread(&spritecache[0],sizeof(spritecache[0]),MAXTILES,fil) != MAXTILES) goto corrupt;
if (kdfread(&i,sizeof(long),1,fil) != 1) goto corrupt;
while(i != NUMOFFIRSTTIMEACTIVE)
{
if(fta_quotes[i] != NULL)
Bfree(fta_quotes[i]);
fta_quotes[i] = Bcalloc(MAXQUOTELEN,sizeof(char));
if(kdfread((char *)fta_quotes[i],MAXQUOTELEN,1,fil) != 1) goto corrupt;
if(kdfread(&i,sizeof(long),1,fil) != 1) goto corrupt;
}
if (kdfread(&redefined_quote_count,sizeof(redefined_quote_count),1,fil) != 1) goto corrupt;
for(i=0;i<redefined_quote_count;i++)
{
if(redefined_quotes[i] != NULL)
Bfree(redefined_quotes[i]);
redefined_quotes[i] = Bcalloc(MAXQUOTELEN,sizeof(char));
if(kdfread((char *)redefined_quotes[i],MAXQUOTELEN,1,fil) != 1) goto corrupt;
}
ReadGameVars(fil);
kclose(fil);
@ -625,6 +655,28 @@ int saveplayer(signed char spot)
dfwrite(&defaultprojectile[0],sizeof(proj_struct),MAXTILES,fil);
dfwrite(&thisprojectile[0],sizeof(proj_struct),MAXSPRITES,fil);
dfwrite(&spriteflags[0],sizeof(spriteflags[0]),MAXTILES,fil);
dfwrite(&actorspriteflags[0],sizeof(actorspriteflags[0]),MAXSPRITES,fil);
dfwrite(&spritecache[0],sizeof(spritecache[0]),MAXTILES,fil);
for(i=0;i<NUMOFFIRSTTIMEACTIVE;i++)
{
if(fta_quotes[i] != NULL)
{
dfwrite(&i,sizeof(long),1,fil);
dfwrite(fta_quotes[i],MAXQUOTELEN, 1, fil);
}
}
dfwrite(&i,sizeof(long),1,fil);
dfwrite(&redefined_quote_count,sizeof(redefined_quote_count),1,fil);
for(i=0;i<redefined_quote_count;i++)
{
if(redefined_quotes[i] != NULL)
dfwrite(redefined_quotes[i],MAXQUOTELEN, 1, fil);
}
SaveGameVars(fil);
fclose(fil);