From 337682934cb1017b26059abdd53ba6f132626fdd Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 10 Feb 2015 23:40:53 +0100 Subject: [PATCH] - fixed: CF_FLY cannot be part of the player_t structure and be tracked properly. It needs to be part of the actor itself that has MF2_FLY set so it got moved to flags7. - removed some fudging code that tried to work around the shortcomings of CF_FLY but was ultimately causing more problems than it solved. --- src/actor.h | 1 + src/g_level.cpp | 9 --------- src/g_shared/a_artifacts.cpp | 3 ++- src/m_cheat.cpp | 3 +-- src/p_lnspec.cpp | 4 +++- src/p_mobj.cpp | 2 +- 6 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/actor.h b/src/actor.h index 0ab5891071..b7a8614a74 100644 --- a/src/actor.h +++ b/src/actor.h @@ -353,6 +353,7 @@ enum MF7_HITTARGET = 0x00004000, // The actor the projectile dies on is set to target, provided it's targetable anyway. MF7_HITMASTER = 0x00008000, // Same as HITTARGET, except it's master instead of target. MF7_HITTRACER = 0x00010000, // Same as HITTARGET, but for tracer. + MF7_FLYCHEAT = 0x00020000, // must be part of the actor so that it can be tracked properly diff --git a/src/g_level.cpp b/src/g_level.cpp index b6cc1cd84d..2d44bfc279 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1235,15 +1235,6 @@ void G_FinishTravel () pawn->AddToHash (); pawn->SetState(pawn->SpawnState); pawn->player->SendPitchLimits(); - // Sync the FLY flags. - if (pawn->flags2 & MF2_FLY) - { - pawn->player->cheats |= CF_FLY; - } - else - { - pawn->player->cheats &= ~CF_FLY; - } for (inv = pawn->Inventory; inv != NULL; inv = inv->Inventory) { diff --git a/src/g_shared/a_artifacts.cpp b/src/g_shared/a_artifacts.cpp index 21006776e1..14b2704355 100644 --- a/src/g_shared/a_artifacts.cpp +++ b/src/g_shared/a_artifacts.cpp @@ -997,7 +997,8 @@ void APowerFlight::EndEffect () { return; } - if (!(Owner->player->cheats & CF_FLY)) + + if (!(Owner->flags7 & MF7_FLYCHEAT)) { if (Owner->z != Owner->floorz) { diff --git a/src/m_cheat.cpp b/src/m_cheat.cpp index e48b79980a..f60131c8e5 100644 --- a/src/m_cheat.cpp +++ b/src/m_cheat.cpp @@ -149,8 +149,7 @@ void cht_DoCheat (player_t *player, int cheat) case CHT_FLY: if (player->mo != NULL) { - player->cheats ^= CF_FLY; - if (player->cheats & CF_FLY) + if ((player->mo->flags7 ^= MF7_FLYCHEAT) != 0) { player->mo->flags |= MF_NOGRAVITY; player->mo->flags2 |= MF2_FLY; diff --git a/src/p_lnspec.cpp b/src/p_lnspec.cpp index c170cacd3b..b550eeb770 100644 --- a/src/p_lnspec.cpp +++ b/src/p_lnspec.cpp @@ -2800,7 +2800,7 @@ FUNC(LS_SetPlayerProperty) mask = CF_INSTANTWEAPSWITCH; break; case PROP_FLY: - mask = CF_FLY; + //mask = CF_FLY; break; case PROP_TOTALLYFROZEN: mask = CF_TOTALLYFROZEN; @@ -2814,6 +2814,7 @@ FUNC(LS_SetPlayerProperty) it->player->cheats |= mask; if (arg2 == PROP_FLY) { + it->flags7 |= MF7_FLYCHEAT; it->flags2 |= MF2_FLY; it->flags |= MF_NOGRAVITY; } @@ -2823,6 +2824,7 @@ FUNC(LS_SetPlayerProperty) it->player->cheats &= ~mask; if (arg2 == PROP_FLY) { + it->flags7 &= ~MF7_FLYCHEAT; it->flags2 &= ~MF2_FLY; it->flags &= ~MF_NOGRAVITY; } diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index ce9fe722a2..b27c79d912 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -4477,7 +4477,7 @@ APlayerPawn *P_SpawnPlayer (FPlayerStart *mthing, int playernum, int flags) p->mo->ResetAirSupply(false); p->Uncrouch(); p->MinPitch = p->MaxPitch = 0; // will be filled in by PostBeginPlay()/netcode - p->cheats &= ~CF_FLY; + p->velx = p->vely = 0; // killough 10/98: initialize bobbing to 0.