- save the cookie texts in a savegame and clear them on level exit. Also handle them on a per-player basis.

Fixes #196
This commit is contained in:
Christoph Oelckers 2020-08-17 22:05:14 +02:00
parent 9159855957
commit 65cb267d56
4 changed files with 15 additions and 19 deletions

View file

@ -625,6 +625,8 @@ void TerminateLevel(void)
// Free panel sprites for players // Free panel sprites for players
pClearSpriteList(pp); pClearSpriteList(pp);
pp->cookieTime = 0;
memset(pp->cookieQuote, 0, sizeof(pp->cookieQuote));
pp->DoPlayerAction = NULL; pp->DoPlayerAction = NULL;
pp->SpriteP = NULL; pp->SpriteP = NULL;

View file

@ -810,8 +810,6 @@ SWBOOL DLL_ExecFunc(int procHandle, char *fName);
// //
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
void adduserquote(const char *daquote);
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// //
// Weapon // Weapon
@ -1168,6 +1166,10 @@ struct PLAYERstruct
short Reverb; // Player's current reverb setting short Reverb; // Player's current reverb setting
short Heads; // Number of Accursed Heads orbiting player short Heads; // Number of Accursed Heads orbiting player
int PlayerVersion; int PlayerVersion;
char cookieQuote[256]; // Should be an FString but must be POD for now to be storable in a savegame.
int cookieTime;
}; };
extern PLAYER Player[MAX_SW_PLAYERS_REG+1]; extern PLAYER Player[MAX_SW_PLAYERS_REG+1];

View file

@ -8060,6 +8060,12 @@ void CheckFootPrints(PLAYERp pp)
} }
} }
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
#include "saveable.h" #include "saveable.h"

View file

@ -992,21 +992,6 @@ static void UpdateFrame(void)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
static FString cookieQuote;
static int cookieTime;
void adduserquote(const char* daquote)
{
cookieQuote = daquote;
cookieTime = totalclock + 540;
}
//---------------------------------------------------------------------------
//
//
//
//---------------------------------------------------------------------------
void UpdateStatusBar(ClockTicks arg) void UpdateStatusBar(ClockTicks arg)
{ {
DSWStatusBar sbar; DSWStatusBar sbar;
@ -1017,10 +1002,11 @@ void UpdateStatusBar(ClockTicks arg)
} }
sbar.UpdateStatusBar(arg); sbar.UpdateStatusBar(arg);
if (totalclock < cookieTime) PLAYERp pp = &Player[screenpeek];
if (totalclock < pp->cookieTime)
{ {
const int MESSAGE_LINE = 142; // Used to be 164 const int MESSAGE_LINE = 142; // Used to be 164
MNU_DrawSmallString(160, MESSAGE_LINE, cookieQuote, 0, 0, 0, clamp((cookieTime - totalclock) / 60., 0., 1.)); MNU_DrawSmallString(160, MESSAGE_LINE, pp->cookieQuote, 0, 0, 0, clamp((pp->cookieTime - totalclock) / 60., 0., 1.));
} }
} }