UC_REPLAY

Save a replay after finishing a round.
Basically another tutorial unlock condition like UC_ADDON
This commit is contained in:
toaster 2023-03-10 21:44:48 +00:00
parent dfe75726df
commit fea235d8a7
5 changed files with 25 additions and 1 deletions

View file

@ -2520,6 +2520,7 @@ static void readcondition(UINT8 set, UINT32 id, char *word2)
}
}
else if ((offset=0) || fastcmp(params[0], "ADDON")
|| (++offset && fastcmp(params[0], "REPLAY"))
|| (++offset && fastcmp(params[0], "CRASH")))
{
//PARAMCHECK(1);

View file

@ -26,6 +26,7 @@
#include "g_game.h"
#include "g_demo.h"
#include "m_misc.h"
#include "m_cond.h"
#include "k_menu.h"
#include "m_argv.h"
#include "hu_stuff.h"
@ -4188,7 +4189,15 @@ void G_SaveDemo(void)
if (!modeattacking)
{
if (demo.savemode == DSM_SAVED)
{
CONS_Printf(M_GetText("Demo %s recorded\n"), demoname);
if (gamedata->eversavedreplay == false)
{
gamedata->eversavedreplay = true;
M_UpdateUnlockablesAndExtraEmblems(true);
G_SaveGameData(true);
}
}
else
CONS_Alert(CONS_WARNING, M_GetText("Demo %s not saved\n"), demoname);
}

View file

@ -4582,6 +4582,7 @@ void G_LoadGameData(void)
gamedata->crashflags |= GDCRASH_ANY;
gamedata->everloadedaddon = (boolean)READUINT8(save.p);
gamedata->eversavedreplay = (boolean)READUINT8(save.p);
}
else
{
@ -4795,7 +4796,7 @@ void G_SaveGameData(boolean dirty)
length = (4+1+4+4+
(4*GDGT_MAX)+
4+1+1+1+1+
1+1+4+
1+1+1+4+
(MAXEMBLEMS+(MAXUNLOCKABLES*2)+MAXCONDITIONSETS)+
4+2);
@ -4844,6 +4845,7 @@ void G_SaveGameData(boolean dirty)
}
WRITEUINT8(save.p, gamedata->everloadedaddon); // 1
WRITEUINT8(save.p, gamedata->eversavedreplay); // 1
WRITEUINT32(save.p, quickncasehash(timeattackfolder, 64));

View file

@ -526,6 +526,7 @@ void M_ClearStats(void)
gamedata->timesBeaten = 0;
gamedata->everloadedaddon = false;
gamedata->eversavedreplay = false;
gamedata->crashflags = 0;
}
@ -721,6 +722,8 @@ boolean M_CheckCondition(condition_t *cn, player_t *player)
M_SecretUnlocked(SECRET_ADDONS, true) &&
#endif
(gamedata->everloadedaddon == true));
case UC_REPLAY:
return (gamedata->eversavedreplay == true);
case UC_CRASH:
if (gamedata->crashflags & (GDCRASH_LAST|GDCRASH_ANY))
{
@ -1109,6 +1112,8 @@ static const char *M_GetConditionString(condition_t *cn)
if (!M_SecretUnlocked(SECRET_ADDONS, true) && !gamedata->everloadedaddon)
return NULL;
return "load a custom addon into \"Dr. Robotnik's Ring Racers\"";
case UC_REPLAY:
return "save a replay after finishing a round";
case UC_CRASH:
if (gamedata->crashflags & (GDCRASH_LAST|GDCRASH_ANY))
return "launch \"Dr. Robotnik's Ring Racers\" again after a game crash";

View file

@ -31,20 +31,26 @@ typedef enum
UC_PLAYTIME, // PLAYTIME [tics]
UC_ROUNDSPLAYED, // ROUNDSPLAYED [x played]
UC_TOTALRINGS, // TOTALRINGS [x collected]
UC_POWERLEVEL, // SRB2Kart: POWERLEVEL [power level to reach] [gametype, "0" for race, "1" for battle]
UC_GAMECLEAR, // GAMECLEAR <x times>
UC_OVERALLTIME, // OVERALLTIME [time to beat, tics]
UC_MAPVISITED, // MAPVISITED [map]
UC_MAPBEATEN, // MAPBEATEN [map]
UC_MAPENCORE, // MAPENCORE [map]
UC_MAPSPBATTACK, // MAPSPBATTACK [map]
UC_MAPTIME, // MAPTIME [map] [time to beat, tics]
UC_TOTALMEDALS, // TOTALMEDALS [number of emblems]
UC_EMBLEM, // EMBLEM [emblem number]
UC_UNLOCKABLE, // UNLOCKABLE [unlockable number]
UC_CONDITIONSET, // CONDITIONSET [condition set number]
UC_ADDON, // Ever loaded a custom file?
UC_REPLAY, // Save a replay
UC_CRASH, // Hee ho !
// Just for string building
@ -263,6 +269,7 @@ struct gamedata_t
// SPECIFIC SPECIAL EVENTS
boolean everloadedaddon;
boolean eversavedreplay;
UINT8 crashflags;
};