- Added noclip2 cheat. This is similar to noclip, except it also adds nogravity and the ability to fly through 3D floors.

SVN r3832 (trunk)
This commit is contained in:
Randy Heit 2012-08-22 21:31:48 +00:00
parent adf9bd2e1a
commit a505352da3
9 changed files with 72 additions and 11 deletions

View file

@ -712,6 +712,8 @@ public:
// Do I hate the other actor?
bool IsHostile (AActor *other);
inline bool IsNoClip2() const;
// What species am I?
virtual FName GetSpecies();

View file

@ -175,6 +175,15 @@ CCMD (noclip)
Net_WriteByte (CHT_NOCLIP);
}
CCMD (noclip2)
{
if (CheckCheatmode())
return;
Net_WriteByte (DEM_GENERICCHEAT);
Net_WriteByte (CHT_NOCLIP2);
}
CCMD (powerup)
{
if (CheckCheatmode ())

View file

@ -208,6 +208,7 @@ typedef enum
CF_BUDDHA = 1 << 27, // [SP] Buddha mode - take damage, but don't die
CF_WEAPONRELOADOK = 1 << 28, // [XA] Okay to reload this weapon.
CF_WEAPONZOOMOK = 1 << 29, // [XA] Okay to use weapon zoom function.
CF_NOCLIP2 = 1 << 30, // [RH] More Quake-like noclip
} cheat_t;
#define WPIECE1 1
@ -439,6 +440,14 @@ inline void AActor::SetFriendPlayer(player_t *player)
}
}
inline bool AActor::IsNoClip2() const
{
if (player != NULL && player->mo == this)
{
return (player->cheats & CF_NOCLIP2) != 0;
}
return false;
}
#define CROUCHSPEED (FRACUNIT/12)

View file

@ -218,7 +218,8 @@ enum ECheatCommand
CHT_GIMMIEI,
CHT_GIMMIEJ,
CHT_GIMMIEZ,
CHT_BUDDHA
CHT_BUDDHA,
CHT_NOCLIP2
};
void StartChunk (int id, BYTE **stream);

View file

@ -106,6 +106,20 @@ void cht_DoCheat (player_t *player, int cheat)
msg = GStrings("STSTR_NCOFF");
break;
case CHT_NOCLIP2:
player->cheats ^= CF_NOCLIP2;
if (player->cheats & CF_NOCLIP2)
{
player->cheats |= CF_NOCLIP;
msg = GStrings("STSTR_NC2ON");
}
else
{
player->cheats &= ~CF_NOCLIP;
msg = GStrings("STSTR_NCOFF");
}
break;
case CHT_NOVELOCITY:
player->cheats ^= CF_NOVELOCITY;
if (player->cheats & CF_NOVELOCITY)

View file

@ -501,7 +501,11 @@ int P_GetFriction (const AActor *mo, int *frictionfactor)
const msecnode_t *m;
const sector_t *sec;
if (mo->flags2 & MF2_FLY && mo->flags & MF_NOGRAVITY)
if (mo->IsNoClip2())
{
// The default values are fine for noclip2 mode
}
else if (mo->flags2 & MF2_FLY && mo->flags & MF_NOGRAVITY)
{
friction = FRICTION_FLY;
}
@ -1298,7 +1302,7 @@ bool P_CheckPosition (AActor *thing, fixed_t x, fixed_t y, FCheckPosition &tm, b
#ifdef _3DFLOORS
//Check 3D floors
if(newsec->e->XFloor.ffloors.Size())
if (!thing->IsNoClip2() && newsec->e->XFloor.ffloors.Size())
{
F3DFloor* rover;
fixed_t delta1;
@ -1605,7 +1609,7 @@ void P_FakeZMovement (AActor *mo)
mo->z += mo->FloatSpeed;
}
}
if (mo->player && mo->flags&MF_NOGRAVITY && (mo->z > mo->floorz))
if (mo->player && mo->flags&MF_NOGRAVITY && (mo->z > mo->floorz) && !mo->IsNoClip2())
{
mo->z += finesine[(FINEANGLES/80*level.maptime)&FINEMASK]/8;
}

View file

@ -1985,7 +1985,9 @@ explode:
}
if (mo->z > mo->floorz && !(mo->flags2 & MF2_ONMOBJ) &&
(!(mo->flags2 & MF2_FLY) || !(mo->flags & MF_NOGRAVITY)) && !mo->waterlevel)
!mo->IsNoClip2() &&
(!(mo->flags2 & MF2_FLY) || !(mo->flags & MF_NOGRAVITY)) &&
!mo->waterlevel)
{ // [RH] Friction when falling is available for larger aircontrols
if (player != NULL && level.airfriction != FRACUNIT)
{
@ -2227,8 +2229,11 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz)
}
}
if (mo->player && (mo->flags & MF_NOGRAVITY) && (mo->z > mo->floorz))
{
if (!mo->IsNoClip2())
{
mo->z += finesine[(FINEANGLES/80*level.maptime)&FINEMASK]/8;
}
mo->velz = FixedMul (mo->velz, FRICTION_FLY);
}
if (mo->waterlevel && !(mo->flags & MF_NOGRAVITY))

View file

@ -1625,7 +1625,11 @@ void P_CalcHeight (player_t *player)
// it causes bobbing jerkiness when the player moves from ice to non-ice,
// and vice-versa.
if ((player->mo->flags & MF_NOGRAVITY) && !onground)
if (player->cheats & CF_NOCLIP2)
{
player->bob = 0;
}
else if ((player->mo->flags & MF_NOGRAVITY) && !onground)
{
player->bob = FRACUNIT / 2;
}
@ -1750,7 +1754,7 @@ void P_MovePlayer (player_t *player)
mo->angle += cmd->ucmd.yaw << 16;
}
onground = (mo->z <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF);
onground = (mo->z <= mo->floorz) || (mo->flags2 & MF2_ONMOBJ) || (mo->BounceFlags & BOUNCE_MBF) || (player->cheats & CF_NOCLIP2);
// killough 10/98:
//
@ -2131,7 +2135,11 @@ void P_PlayerThink (player_t *player)
player->inventorytics--;
}
// No-clip cheat
if (player->cheats & CF_NOCLIP || (player->mo->GetDefault()->flags & MF_NOCLIP))
if ((player->cheats & (CF_NOCLIP | CF_NOCLIP2)) == CF_NOCLIP2)
{ // No noclip2 without noclip
player->cheats &= ~CF_NOCLIP2;
}
if (player->cheats & (CF_NOCLIP | CF_NOCLIP2) || (player->mo->GetDefault()->flags & MF_NOCLIP))
{
player->mo->flags |= MF_NOCLIP;
}
@ -2139,6 +2147,14 @@ void P_PlayerThink (player_t *player)
{
player->mo->flags &= ~MF_NOCLIP;
}
if (player->cheats & CF_NOCLIP2)
{
player->mo->flags |= MF_NOGRAVITY;
}
else if (!(player->mo->flags2 & MF2_FLY) && !(player->mo->GetDefault()->flags & MF_NOGRAVITY))
{
player->mo->flags &= ~MF_NOGRAVITY;
}
cmd = &player->cmd;
// Make unmodified copies for ACS's GetPlayerInput.
@ -2359,7 +2375,7 @@ void P_PlayerThink (player_t *player)
{
cmd->ucmd.upmove = ksgn (cmd->ucmd.upmove) * 0x300;
}
if (player->mo->waterlevel >= 2 || (player->mo->flags2 & MF2_FLY))
if (player->mo->waterlevel >= 2 || (player->mo->flags2 & MF2_FLY) || (player->cheats & CF_NOCLIP2))
{
player->mo->velz = cmd->ucmd.upmove << 9;
if (player->mo->waterlevel < 2 && !(player->mo->flags & MF_NOGRAVITY))
@ -2477,7 +2493,7 @@ void P_PlayerThink (player_t *player)
{
if (player->mo->waterlevel < 3 ||
(player->mo->flags2 & MF2_INVULNERABLE) ||
(player->cheats & CF_GODMODE))
(player->cheats & (CF_GODMODE | CF_NOCLIP2)))
{
player->mo->ResetAirSupply ();
}

View file

@ -280,6 +280,7 @@ STSTR_KFAADDED = "Very Happy Ammo Added";
STSTR_FAADDED = "Ammo (no keys) Added";
STSTR_NCON = "No Clipping Mode ON";
STSTR_NCOFF = "No Clipping Mode OFF";
STSTR_NC2ON = "No Clipping Mode 2 ON";
STSTR_BEHOLD = "inVuln, Str, Inviso, Rad, Allmap, or Lite-amp";
STSTR_BEHOLDX = "Power-up Toggled";
STSTR_CHOPPERS = "... doesn't suck - GM";