From b6f86cc379beb37be4bbf360d7d9595c64829d3d Mon Sep 17 00:00:00 2001 From: terminx Date: Mon, 24 Apr 2006 04:57:04 +0000 Subject: [PATCH] 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 --- polymer/eduke32/source/duke3d.h | 8 +++-- polymer/eduke32/source/game.c | 3 -- polymer/eduke32/source/gamedef.c | 2 +- polymer/eduke32/source/savegame.c | 52 +++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 6 deletions(-) diff --git a/polymer/eduke32/source/duke3d.h b/polymer/eduke32/source/duke3d.h index c99ff5364..8fe65bc9e 100644 --- a/polymer/eduke32/source/duke3d.h +++ b/polymer/eduke32/source/duke3d.h @@ -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 diff --git a/polymer/eduke32/source/game.c b/polymer/eduke32/source/game.c index 1ba93fed3..2c6821e23 100644 --- a/polymer/eduke32/source/game.c +++ b/polymer/eduke32/source/game.c @@ -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 diff --git a/polymer/eduke32/source/gamedef.c b/polymer/eduke32/source/gamedef.c index f0f7705ef..8a3c0946d 100644 --- a/polymer/eduke32/source/gamedef.c +++ b/polymer/eduke32/source/gamedef.c @@ -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; diff --git a/polymer/eduke32/source/savegame.c b/polymer/eduke32/source/savegame.c index 7a2245932..84d2ef82c 100644 --- a/polymer/eduke32/source/savegame.c +++ b/polymer/eduke32/source/savegame.c @@ -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