diff --git a/src/actor.h b/src/actor.h index a0fd4578e..751e3579e 100644 --- a/src/actor.h +++ b/src/actor.h @@ -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(); diff --git a/src/c_cmds.cpp b/src/c_cmds.cpp index 9c7b781d2..b1f3a1561 100644 --- a/src/c_cmds.cpp +++ b/src/c_cmds.cpp @@ -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 ()) diff --git a/src/d_player.h b/src/d_player.h index e5307fd28..67f03db44 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -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) diff --git a/src/d_protocol.h b/src/d_protocol.h index b3d72a4ca..028ad1606 100644 --- a/src/d_protocol.h +++ b/src/d_protocol.h @@ -218,7 +218,8 @@ enum ECheatCommand CHT_GIMMIEI, CHT_GIMMIEJ, CHT_GIMMIEZ, - CHT_BUDDHA + CHT_BUDDHA, + CHT_NOCLIP2 }; void StartChunk (int id, BYTE **stream); diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index 2d836327d..d639ec514 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -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) diff --git a/src/p_map.cpp b/src/p_map.cpp index 632607da2..5b54be076 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -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; } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index f0788bb31..4ccd669f7 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -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) { @@ -2228,7 +2230,10 @@ void P_ZMovement (AActor *mo, fixed_t oldfloorz) } if (mo->player && (mo->flags & MF_NOGRAVITY) && (mo->z > mo->floorz)) { - mo->z += finesine[(FINEANGLES/80*level.maptime)&FINEMASK]/8; + 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)) diff --git a/src/p_user.cpp b/src/p_user.cpp index f3cab9236..b8dfd339c 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -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 (); } diff --git a/wadsrc/static/language.enu b/wadsrc/static/language.enu index 2f9f7509e..ceecfd1c0 100644 --- a/wadsrc/static/language.enu +++ b/wadsrc/static/language.enu @@ -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";