Add debugprisoncd cheat (DEVELOP only)

- Always drops a CD from Prison Eggs
This commit is contained in:
James R 2024-03-05 03:11:05 -08:00
parent e86ae4b22b
commit f60309983a
3 changed files with 39 additions and 1 deletions

View file

@ -873,6 +873,10 @@ consvar_t cv_1pswap = PlayerCheat("1pswap", "1").min_max(1, MAXSPLITSCREENPLAYER
consvar_t cv_debugfinishline = PlayerCheat("debugfinishline", "Off").on_off().description("Highlight finish lines, respawn lines, death pits and instakill planes with high contrast colors");
consvar_t cv_debughudtracker = PlayerCheat("debughudtracker", "Off").on_off().description("Highlight overlapping HUD tracker blocks");
#ifdef DEVELOP
consvar_t cv_debugprisoncd = PlayerCheat("debugprisoncd", "Off").on_off().description("Always drop a CD from breaking Prisons");
#endif
consvar_t cv_debugrank = PlayerCheat("debugrank", "Off").description("Show GP rank state on the HUD; optionally force a rank grade").values({
{0, "Off"},
{1, "On"},

View file

@ -1019,6 +1019,32 @@ cacheprisoneggpickup:
}
//CONS_Printf("thisprisoneggpickup = %u (MAXCONDITIONSETS is %u)\n", gamedata->thisprisoneggpickup, MAXCONDITIONSETS);
#ifdef DEVELOP
extern consvar_t cv_debugprisoncd;
// If all drops are collected, just force the first valid one.
if (cv_debugprisoncd.value && gamedata->thisprisoneggpickup_cached == NULL)
{
for (i = 0; gamedata->thisprisoneggpickup_cached == NULL &&
i < gamedata->numprisoneggpickups; i++)
{
c = &conditionSets[gamedata->prisoneggpickups[i]];
if (c->numconditions)
{
for (j = 0; j < c->numconditions; ++j)
{
cn = &c->condition[j];
if (cn->type != UC_PRISONEGGCD)
continue;
gamedata->thisprisoneggpickup = gamedata->prisoneggpickups[i];
gamedata->thisprisoneggpickup_cached = cn;
break;
}
}
}
}
#endif
}
static void M_PrecacheLevelLocks(void)

View file

@ -1198,13 +1198,21 @@ static void P_AddBrokenPrison(mobj_t *target, mobj_t *inflictor, mobj_t *source)
secretextratime = TICRATE/2;
}
if (
#ifdef DEVELOP
extern consvar_t cv_debugprisoncd;
#endif
if ((
grandprixinfo.gp == true // Bonus Round
&& demo.playback == false // Not playback
&& netgame == false // game design + makes it easier to implement
&& gamedata->thisprisoneggpickup_cached != NULL
&& gamedata->prisoneggstothispickup == 0
&& gamedata->thisprisoneggpickupgrabbed == false
)
#ifdef DEVELOP
|| (cv_debugprisoncd.value && gamedata->thisprisoneggpickup_cached != NULL)
#endif
)
{
// Will be 0 for the next level