- 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
commit a505352da3
9 changed files with 72 additions and 11 deletions

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 ();
}