Fix line endings

This commit is contained in:
James R 2024-03-22 00:46:36 -07:00
parent e55748a1b2
commit 11dc5b7318
11 changed files with 0 additions and 468 deletions

View file

@ -916,7 +916,6 @@ consvar_t cv_palettenum = PlayerCheat("palettenum", "0").values(CV_Unsigned).onc
extern CV_PossibleValue_t renderhitbox_cons_t[];
consvar_t cv_renderhitbox = PlayerCheat("renderhitbox", "Off").values(renderhitbox_cons_t).description("Show hitboxes around objects");
consvar_t cv_mentalsonic = Player("mentalsonic", "Off").dont_save().values(CV_OnOff).flags(CV_NOSHOWHELP).description("Works out at the library");
consvar_t cv_shittysigns = Player("shittysigns", "Off").dont_save().values(CV_OnOff).flags(CV_NOSHOWHELP).description("It's better because it's worse");
//

View file

@ -1746,8 +1746,6 @@ void D_SRB2Main(void)
CON_SetLoadingProgress(LOADED_PWAD);
cht_Init();
//---------------------------------------------------- READY SCREEN
// we need to check for dedicated before initialization of some subsystems

View file

@ -99,7 +99,6 @@ extern consvar_t cv_kartdebugstart;
extern consvar_t cv_debugrank;
extern consvar_t cv_battletest;
extern consvar_t cv_mentalsonic;
extern consvar_t cv_shittysigns;
extern consvar_t cv_4thgear;

View file

@ -2589,13 +2589,6 @@ static void readcondition(UINT16 set, UINT32 id, char *word2)
stringvar = Z_StrDup(spos);
}
else if (fastcmp(params[0], "PASSWORD"))
{
EXTENDEDPARAMCHECK(spos, 1);
ty = UC_PASSWORD;
stringvar = Z_StrDup(spos);
}
if (ty != UC_NONE)
goto setcondition;

View file

@ -6130,9 +6130,6 @@ void K_Squish(mobj_t *mo)
mo->spriteyscale =
FixedDiv(FRACUNIT, mo->spritexscale);
if (cv_mentalsonic.value && (mo->type == MT_PLAYER || (!P_MobjWasRemoved(mo->target) && mo->target->type == MT_PLAYER)))
mo->spriteyscale *= 2;
}
static mobj_t *K_FindLastTrailMobj(player_t *player)

View file

@ -27,7 +27,6 @@
#include "m_misc.h"
#include "hu_stuff.h"
#include "m_cond.h" // secrets unlocked?
#include "v_video.h"
#include "z_zone.h"
@ -42,375 +41,6 @@
#include "g_party.h"
//
// CHEAT SEQUENCE PACKAGE
//
#define SCRAMBLE(a) \
((((a)&1)<<7) + (((a)&2)<<5) + ((a)&4) + (((a)&8)<<1) \
+ (((a)&16)>>1) + ((a)&32) + (((a)&64)>>5) + (((a)&128)>>7))
typedef struct
{
UINT8 *p;
UINT8 (*func)(void); // called when cheat confirmed.
UINT8 *sequence;
} cheatseq_t;
// ==========================================================================
// CHEAT Structures
// ==========================================================================
// Cheat responders
static UINT8 cheatf_warp(void)
{
UINT16 i;
boolean success = false;
/*if (modifiedgame)
return 0;*/
// Unlock EVERYTHING.
for (i = 0; i < MAXUNLOCKABLES; i++)
{
if (!unlockables[i].conditionset)
continue;
if (gamedata->unlocked[i])
continue;
gamedata->unlocked[i] = true;
success = true;
}
// Unlock all hidden levels.
#define GD_MV_SET (MV_VISITED|MV_BEATEN)
for (i = 0; i < nummapheaders; i++)
{
if ((mapheaderinfo[i]->records.mapvisited & GD_MV_SET) == GD_MV_SET)
continue;
mapheaderinfo[i]->records.mapvisited |= GD_MV_SET;
success = true;
}
#undef GD_MV_SET
// Goofy, but this call needs to be before M_ClearMenus because that path
// calls G_LoadLevel, which will trigger a gamedata save. Garbage factory
if (success)
{
gamedata->gonerlevel = GDGONER_DONE;
gamedata->sealedswapalerted = true;
G_SetUsedCheats();
}
M_ClearMenus(true);
const char *text;
if (success)
{
S_StartSound(0, sfx_kc42);
text = M_GetText(
"All challenges temporarily unlocked.\n"
"Saving is disabled - the game will\n"
"return to normal on next launch.\n"
);
}
else
{
S_StartSound(0, sfx_s3k7b);
if (usedCheats)
{
text = M_GetText(
"This is the correct password, but\n"
"you already have every challenge\n"
"unlocked, so nothing has changed.\n"
);
}
else
{
text = M_GetText(
"This is the correct password, but\n"
"you already have every challenge\n"
"unlocked, so saving is still allowed!\n"
);
}
}
M_StartMessage("Tournament Mode", text, NULL, MM_NOTHING, NULL, NULL);
return 1;
}
static UINT8 cheatf_wrongwarp(void)
{
// Tee hee.
M_WrongWarp(0);
return 1;
}
static UINT8 cheatf_savetheanimals(void)
{
M_GonerGDQ(true);
return 1;
}
static UINT8 cheatf_savetheframes(void)
{
M_GonerGDQ(false);
return 1;
}
static UINT8 cheatf_mentalsonic(void)
{
CV_SetValue(&cv_mentalsonic, !cv_mentalsonic.value);
if (cv_mentalsonic.value)
{
S_StartSound(NULL, sfx_gshbb);
}
else
{
S_StartSound(NULL, sfx_kc46);
}
return 1;
}
static UINT8 cheatf_shittysigns(void)
{
CV_SetValue(&cv_shittysigns, !cv_shittysigns.value);
if (cv_shittysigns.value)
{
S_StartSound(NULL, sfx_mixup);
}
else
{
S_StartSound(NULL, sfx_nghurt);
}
return 1;
}
static UINT8 cheatf_4thgear(void)
{
CV_SetValue(&cv_4thgear, !cv_4thgear.value);
if (cv_4thgear.value)
{
M_StartMessage("Restraint device compromised!", "Local play sped up to ""\x85""4th Gear!""\x80""\nLet's see what you're made of!\n\n""\x86""No effect in netplay and attack modes.", NULL, MM_NOTHING, NULL, NULL);
S_StartSound(NULL, sfx_gshc4);
}
else
{
S_StartSound(NULL, sfx_kc46);
}
return 1;
}
#ifdef DEVELOP
static UINT8 cheatf_devmode(void)
{
INT32 i;
if (modifiedgame)
return 0;
// Just unlock all the things and turn on -debug and console devmode.
for (i = 0; i < MAXUNLOCKABLES; i++)
{
if (!unlockables[i].conditionset)
continue;
gamedata->unlocked[i] = true;
}
// Unlock all hidden levels.
for (i = 0; i < nummapheaders; i++)
{
mapheaderinfo[i]->records.mapvisited = MV_MAX;
}
gamedata->gonerlevel = GDGONER_DONE;
gamedata->sealedswapalerted = true;
M_ClearMenus(true);
// This is a developer feature, you know how to delete ringdata
// G_SetUsedCheats();
S_StartSound(0, sfx_kc42);
devparm = true;
cht_debug |= 0x8000;
G_SaveGameData();
return 1;
}
static UINT8 cheatf_skipgoner(void)
{
gamedata->gonerlevel = GDGONER_DONE;
gamedata->finishedtutorialchallenge = true;
M_UpdateUnlockablesAndExtraEmblems(true, true);
M_ClearMenus(true);
S_StartSound(0, sfx_kc42);
G_SaveGameData();
return 1;
}
#endif
static cheatseq_t cheat_warp = {
NULL, cheatf_warp,
(UINT8[]){ SCRAMBLE('c'), SCRAMBLE('h'), SCRAMBLE('a'), SCRAMBLE('o'), SCRAMBLE('s'), SCRAMBLE(' '), SCRAMBLE('z'), SCRAMBLE('e'), SCRAMBLE('r'), SCRAMBLE('o'), SCRAMBLE(' '), SCRAMBLE('6'), SCRAMBLE('4'), 0xff }
};
static cheatseq_t cheat_wrongwarp = {
NULL, cheatf_wrongwarp,
(UINT8[]){ SCRAMBLE('b'), SCRAMBLE('a'), SCRAMBLE('n'), SCRAMBLE('a'), SCRAMBLE('n'), SCRAMBLE('a'), 0xff }
};
static cheatseq_t cheat_savetheanimals = {
NULL, cheatf_savetheanimals,
(UINT8[]){ SCRAMBLE('s'), SCRAMBLE('a'), SCRAMBLE('v'), SCRAMBLE('e'), SCRAMBLE('t'), SCRAMBLE('h'), SCRAMBLE('e'), SCRAMBLE('a'), SCRAMBLE('n'), SCRAMBLE('i'), SCRAMBLE('m'), SCRAMBLE('a'), SCRAMBLE('l'), SCRAMBLE('s'), 0xff }
};
static cheatseq_t cheat_savetheframes = {
NULL, cheatf_savetheframes,
(UINT8[]){ SCRAMBLE('s'), SCRAMBLE('a'), SCRAMBLE('v'), SCRAMBLE('e'), SCRAMBLE('t'), SCRAMBLE('h'), SCRAMBLE('e'), SCRAMBLE('f'), SCRAMBLE('r'), SCRAMBLE('a'), SCRAMBLE('m'), SCRAMBLE('e'), SCRAMBLE('s'), 0xff }
};
static cheatseq_t cheat_mentalsonic = {
NULL, cheatf_mentalsonic,
(UINT8[]){ SCRAMBLE('m'), SCRAMBLE('e'), SCRAMBLE('n'), SCRAMBLE('t'), SCRAMBLE('a'), SCRAMBLE('l'), SCRAMBLE(' '), SCRAMBLE('s'), SCRAMBLE('o'), SCRAMBLE('n'), SCRAMBLE('i'), SCRAMBLE('c'), 0xff }
};
static cheatseq_t cheat_4thgear = {
NULL, cheatf_4thgear,
(UINT8[]){ SCRAMBLE('l'), SCRAMBLE('e'), SCRAMBLE('t'), SCRAMBLE('\''), SCRAMBLE('s'), SCRAMBLE(' '),
SCRAMBLE('g'), SCRAMBLE('e'), SCRAMBLE('t'), SCRAMBLE(' '),
SCRAMBLE('f'), SCRAMBLE('i'), SCRAMBLE('r'), SCRAMBLE('e'), SCRAMBLE('d'), SCRAMBLE(' '),
SCRAMBLE('u'), SCRAMBLE('p'), SCRAMBLE('!'), 0xff }
};
static cheatseq_t cheat_shittysigns = {
NULL, cheatf_shittysigns,
(UINT8[]){ SCRAMBLE('i'), SCRAMBLE('d'), SCRAMBLE('s'), SCRAMBLE('p'), SCRAMBLE('i'), SCRAMBLE('s'), SCRAMBLE('p'), SCRAMBLE('o'), SCRAMBLE('p'), SCRAMBLE('d'), 0xff }
};
#ifdef DEVELOP
static cheatseq_t cheat_devmode = {
NULL, cheatf_devmode,
(UINT8[]){ SCRAMBLE('d'), SCRAMBLE('e'), SCRAMBLE('v'), SCRAMBLE('m'), SCRAMBLE('o'), SCRAMBLE('d'), SCRAMBLE('e'), 0xff }
};
static cheatseq_t cheat_skipgoner = {
NULL, cheatf_skipgoner,
(UINT8[]){ SCRAMBLE('g'), SCRAMBLE('a'), SCRAMBLE('s'), SCRAMBLE('t'), SCRAMBLE('e'), SCRAMBLE('r'), 0xff }
};
#endif
cheatseq_t *cheatseqlist[] =
{
&cheat_warp,
&cheat_wrongwarp,
&cheat_savetheanimals,
&cheat_savetheframes,
&cheat_mentalsonic,
&cheat_shittysigns,
&cheat_4thgear,
#ifdef DEVELOP
&cheat_devmode,
&cheat_skipgoner,
#endif
NULL
};
// ==========================================================================
// CHEAT SEQUENCE PACKAGE
// ==========================================================================
static UINT8 cheat_xlate_table[256];
void cht_Init(void)
{
size_t i = 0;
INT16 pi = 0;
for (; i < 256; i++, pi++)
{
const INT32 cc = SCRAMBLE(pi);
cheat_xlate_table[i] = (UINT8)cc;
}
}
//
// Called in st_stuff module, which handles the input.
// Returns a 1 if the cheat was successful, 0 if failed.
//
static UINT8 cht_CheckCheat(cheatseq_t *cht, char key, boolean shouldend)
{
UINT8 rc = 0; // end of sequence character
if (cht->p == NULL || *cht->p == 0xff)
return rc;
if (*cht->p == 0)
*(cht->p++) = key;
else if (cheat_xlate_table[(UINT8)key] == *cht->p)
cht->p++;
else
{
cht->p = NULL;
return rc;
}
if (*cht->p == 1)
cht->p++;
if (shouldend && *cht->p == 0xff) // end of sequence character
rc = cht->func();
return rc;
}
boolean cht_Interpret(const char *password)
{
if (!password)
return false;
UINT8 ret = 0;
size_t cheatseqid = 0;
const char *endofpassword = password;
while (*endofpassword && *(endofpassword+1))
endofpassword++;
cheatseqid = 0;
while (cheatseqlist[cheatseqid])
{
cheatseqlist[cheatseqid]->p = cheatseqlist[cheatseqid]->sequence;
cheatseqid++;
}
while (*password)
{
cheatseqid = 0;
while (cheatseqlist[cheatseqid])
{
ret += cht_CheckCheat(cheatseqlist[cheatseqid], tolower(*password), (password == endofpassword));
cheatseqid++;
}
password++;
}
return (ret > 0);
}
// Console cheat commands rely on these a lot...
#define REQUIRE_CHEATS if (!CV_CheatsEnabled())\
{ CONS_Printf(M_GetText("Cheats must be enabled.\n")); return; }

View file

@ -46,12 +46,6 @@ typedef enum {
NUMBER_OF_CHEATS
} cheat_t;
//
// Cheat sequences
//
boolean cht_Interpret(const char *password);
void cht_Init(void);
//
// ObjectPlace
//

View file

@ -1608,8 +1608,6 @@ boolean M_CheckCondition(condition_t *cn, player_t *player)
return false;
case UC_TUTORIALSKIP:
return (gamedata->finishedtutorialchallenge == true);
case UC_PASSWORD:
return (cn->stringvar == NULL);
case UC_SPRAYCAN:
{
@ -2477,8 +2475,6 @@ static const char *M_GetConditionString(condition_t *cn)
return NULL;
case UC_TUTORIALSKIP:
return "successfully skip the Tutorial";
case UC_PASSWORD:
return "enter a secret password";
case UC_SPRAYCAN:
{
@ -2985,43 +2981,6 @@ static boolean M_CheckUnlockConditions(player_t *player)
return ret;
}
boolean M_ConditionInterpret(const char *password)
{
UINT32 i, j;
conditionset_t *c;
condition_t *cn;
for (i = 0; i < MAXCONDITIONSETS; ++i)
{
c = &conditionSets[i];
if (!c->numconditions || gamedata->achieved[i])
continue;
for (j = 0; j < c->numconditions; ++j)
{
cn = &c->condition[j];
if (cn->type != UC_PASSWORD)
continue;
if (cn->stringvar == NULL)
continue;
if (stricmp(cn->stringvar, password))
continue;
// Remove the password for this session.
Z_Free(cn->stringvar);
cn->stringvar = NULL;
return true;
}
}
return false;
}
boolean M_UpdateUnlockablesAndExtraEmblems(boolean loud, boolean doall)
{
UINT16 i = 0, response = 0, newkeys = 0;

View file

@ -67,8 +67,6 @@ typedef enum
UC_CRASH, // Hee ho !
UC_TUTORIALSKIP, // Complete the Tutorial Challenge
UC_PASSWORD, // Type in something funny
UC_SPRAYCAN, // Grab a spraycan
UC_PRISONEGGCD, // Grab a CD from a Prison Egg
@ -450,7 +448,6 @@ boolean M_NotFreePlay(void);
UINT16 M_CheckCupEmeralds(UINT8 difficulty);
// Updating conditions and unlockables
boolean M_ConditionInterpret(const char *password);
boolean M_CheckCondition(condition_t *cn, player_t *player);
boolean M_UpdateUnlockablesAndExtraEmblems(boolean loud, boolean doall);

View file

@ -4,7 +4,6 @@
#include "../i_time.h"
#include "../k_menu.h"
#include "../m_cond.h"
#include "../m_cheat.h"
#include "../s_sound.h"
#include "../f_finale.h"
#include "../k_credits.h"
@ -171,23 +170,6 @@ void M_ExtrasTick(void)
extrasmenu.textx = 160;
extrasmenu.texty = 50;
}
if (menutyping.active == false && cv_dummyextraspassword.string[0] != '\0')
{
if (M_ConditionInterpret(cv_dummyextraspassword.string) == true)
{
if (M_UpdateUnlockablesAndExtraEmblems(true, true))
{
M_Challenges(0);
}
}
else if (cht_Interpret(cv_dummyextraspassword.string) == true && menuactive == true)
{
M_InitExtras(-1);
}
CV_StealthSet(&cv_dummyextraspassword, "");
}
}
boolean M_ExtrasInputs(INT32 ch)

View file

@ -851,22 +851,6 @@ void M_GonerTick(void)
if (menutyping.active || menumessage.active || P_AutoPause())
return;
if (cv_dummyextraspassword.string[0] != '\0')
{
// Challenges are not interpreted at this stage.
// See M_ExtraTick for the full behaviour.
if (!cht_Interpret(cv_dummyextraspassword.string))
{
goner_delay = 0;
LinesToDigest.emplace_front(GONERSPEAKER_EGGMAN, TICRATE,
"Aha! Nice try. You're tricky enough WITHOUT admin access, thank you.");
M_GonerHidePassword();
}
CV_StealthSet(&cv_dummyextraspassword, "");
}
if (goner_typewriter.textDone)
{
if (!LinesOutput.empty())