Rearrange player cheat flags

PC_GODMODE -> PF_GODMODE
PC_NOCLIP -> MF_NOCLIP
This commit is contained in:
James R 2022-09-29 02:23:07 -07:00
parent 048e7e807c
commit 0444e70413
7 changed files with 14 additions and 44 deletions

View file

@ -1891,7 +1891,6 @@ void CV_CheatsChanged(void)
else
{
consvar_t *cvar;
UINT8 i;
// Set everything back to default.
for (cvar = consvar_vars; cvar; cvar = cvar->next)
@ -1900,14 +1899,6 @@ void CV_CheatsChanged(void)
// Reset any other cheat command effects here, as well.
cv_debug = 0;
for (i = 0; i < MAXPLAYERS; i++)
{
if (!playeringame[i])
continue;
players[i].cheats = 0;
}
}
}

View file

@ -58,14 +58,15 @@ typedef enum
//
typedef enum
{
// free: 1<<0 to 1<<2
PF_GODMODE = 1<<0, // Immortal. No lightsnake from pits either
// free: 1<<1 and 1<<2
// Look back VFX has been spawned
// TODO: Is there a better way to track this?
PF_GAINAX = 1<<3,
// Accessibility and cheats
PF_KICKSTARTACCEL = 1<<4, // Is accelerate in kickstart mode?
PF_KICKSTARTACCEL = 1<<4, // Accessibility feature: Is accelerate in kickstart mode?
// 1<<5 free
// 1<<6 free
@ -105,13 +106,6 @@ typedef enum
// up to 1<<31 is free
} pflags_t;
typedef enum
{
PC_GODMODE = 1,
PC_NOCLIP = 1<<1,
// up to 1<<31 is free
} pcheats_t;
typedef enum
{
// Are animation frames playing?
@ -372,7 +366,6 @@ typedef struct player_s
// Bit flags.
// See pflags_t, above.
pflags_t pflags;
pcheats_t cheats;
// playing animation.
panim_t panim;

View file

@ -5708,8 +5708,9 @@ const char *const MAPTHINGFLAG_LIST[4] = {
};
const char *const PLAYERFLAG_LIST[] = {
// free: 1<<0 to 1<<2 (name un-matchable)
"\x01",
"GODMODE",
// free: 1<<1 and 1<<2 (name un-matchable)
"\x01",
"\x01",

View file

@ -2218,7 +2218,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
UINT32 followitem;
INT32 pflags;
INT32 cheats;
UINT8 ctfteam;
@ -2298,7 +2297,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
botrival = players[player].botvars.rival;
pflags = (players[player].pflags & (PF_WANTSTOJOIN|PF_KICKSTARTACCEL|PF_SHRINKME|PF_SHRINKACTIVE));
cheats = 0;
// SRB2kart
if (betweenmaps || leveltime < introtime)
@ -2373,10 +2371,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
pflags |= (players[player].pflags & (PF_STASIS|PF_ELIMINATED|PF_NOCONTEST|PF_FAULT|PF_LOSTLIFE));
}
// As long as we're not in multiplayer, carry over cheatcodes from map to map
if (!(netgame || multiplayer))
cheats = players[player].cheats;
if (!betweenmaps)
{
// Obliterate follower from existence (if valid memory)
@ -2392,7 +2386,6 @@ void G_PlayerReborn(INT32 player, boolean betweenmaps)
p->roundscore = roundscore;
p->lives = lives;
p->pflags = pflags;
p->cheats = cheats;
p->ctfteam = ctfteam;
p->jointime = jointime;
p->splitscreenindex = splitscreenindex;
@ -4783,9 +4776,6 @@ void G_InitNew(UINT8 pencoremode, INT32 map, boolean resetplayer, boolean skippr
players[i].playerstate = PST_REBORN;
memset(&players[i].respawn, 0, sizeof (players[i].respawn));
// Clear cheatcodes too, just in case.
players[i].cheats = 0;
players[i].roundscore = 0;
if (resetplayer && !(multiplayer && demo.playback)) // SRB2Kart

View file

@ -262,13 +262,8 @@ void Command_CheatNoClip_f(void)
if (!plyr->mo || P_MobjWasRemoved(plyr->mo))
return;
plyr->cheats ^= PC_NOCLIP;
CONS_Printf(M_GetText("No Clipping %s\n"), plyr->cheats & PC_NOCLIP ? M_GetText("On") : M_GetText("Off"));
if (plyr->cheats & PC_NOCLIP)
plyr->mo->flags |= MF_NOCLIP;
else
plyr->mo->flags &= ~MF_NOCLIP;
plyr->mo->flags ^= MF_NOCLIP;
CONS_Printf(M_GetText("No Clipping %s\n"), plyr->mo->flags & MF_NOCLIP ? M_GetText("On") : M_GetText("Off"));
}
void Command_CheatGod_f(void)
@ -280,8 +275,8 @@ void Command_CheatGod_f(void)
REQUIRE_SINGLEPLAYER; // TODO: make multiplayer compatible
plyr = &players[consoleplayer];
plyr->cheats ^= PC_GODMODE;
CONS_Printf(M_GetText("Cheese Mode %s\n"), plyr->cheats & PC_GODMODE ? M_GetText("On") : M_GetText("Off"));
plyr->pflags ^= PF_GODMODE;
CONS_Printf(M_GetText("Cheese Mode %s\n"), plyr->pflags & PF_GODMODE ? M_GetText("On") : M_GetText("Off"));
}
void Command_Scale_f(void)

View file

@ -1874,7 +1874,7 @@ boolean P_DamageMobj(mobj_t *target, mobj_t *inflictor, mobj_t *source, INT32 da
if (player) // Player is the target
{
if (player->cheats & PC_GODMODE)
if (player->pflags & PF_GODMODE)
return false;
if (!force)

View file

@ -2082,7 +2082,7 @@ boolean P_CheckDeathPitCollide(mobj_t *mo)
I_Assert(mo != NULL);
I_Assert(!P_MobjWasRemoved(mo));
if (mo->player && mo->player->cheats & PC_GODMODE)
if (mo->player && mo->player->pflags & PF_GODMODE)
return false;
if (((mo->z <= mo->subsector->sector->floorheight
@ -3620,7 +3620,7 @@ boolean P_CameraThinker(player_t *player, camera_t *thiscam, boolean resetcalled
player->karthud[khud_timeovercam] = (2*TICRATE)+1;
}
if (!resetcalled && !(player->cheats & PC_NOCLIP || leveltime < introtime) && !P_CheckSight(&dummy, player->mo)) // TODO: "P_CheckCameraSight" instead.
if (!resetcalled && !(player->mo->flags & MF_NOCLIP || leveltime < introtime) && !P_CheckSight(&dummy, player->mo)) // TODO: "P_CheckCameraSight" instead.
{
P_ResetCamera(player, thiscam);
}