diff --git a/src/actor.h b/src/actor.h index 3a97ef49a..f8b583101 100644 --- a/src/actor.h +++ b/src/actor.h @@ -764,6 +764,10 @@ public: return (PalEntry)GetClass()->Meta.GetMetaInt(AMETA_BloodColor); } + // These also set CF_INTERPVIEW for players. + void SetPitch(int p); + void SetAngle(angle_t ang); + const PClass *GetBloodType(int type = 0) const { const PClass *bloodcls; diff --git a/src/d_player.h b/src/d_player.h index f6f7674d7..22f01f490 100644 --- a/src/d_player.h +++ b/src/d_player.h @@ -198,6 +198,7 @@ typedef enum CF_INSTANTWEAPSWITCH= 1 << 11, // [RH] Switch weapons instantly CF_TOTALLYFROZEN = 1 << 12, // [RH] All players can do is press +use CF_PREDICTING = 1 << 13, // [RH] Player movement is being predicted + CF_INTERPVIEW = 1 << 14, // [RH] view was changed outside of input, so interpolate one frame CF_DRAIN = 1 << 16, // Player owns a drain powerup CF_HIGHJUMP = 1 << 18, // more Skulltag flags. Implementation not guaranteed though. ;) CF_REFLECTION = 1 << 19, diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 21e0d5c0b..d70cc2c0b 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -8250,7 +8250,9 @@ scriptwait: if (STACK(2) == 0) { if (activator != NULL) - activator->angle = STACK(1) << 16; + { + activator->SetAngle(STACK(1) << 16); + } } else { @@ -8259,7 +8261,7 @@ scriptwait: while ( (actor = iterator.Next ()) ) { - actor->angle = STACK(1) << 16; + actor->SetAngle(STACK(1) << 16); } } sp -= 2; @@ -8269,7 +8271,9 @@ scriptwait: if (STACK(2) == 0) { if (activator != NULL) - activator->pitch = STACK(1) << 16; + { + activator->SetPitch(STACK(1) << 16); + } } else { @@ -8278,7 +8282,7 @@ scriptwait: while ( (actor = iterator.Next ()) ) { - actor->pitch = STACK(1) << 16; + actor->SetPitch(STACK(1) << 16); } } sp -= 2; diff --git a/src/p_mobj.cpp b/src/p_mobj.cpp index 492dd3389..69d4203fe 100644 --- a/src/p_mobj.cpp +++ b/src/p_mobj.cpp @@ -2962,6 +2962,30 @@ void AActor::SetShade (int r, int g, int b) fillcolor = MAKEARGB(ColorMatcher.Pick (r, g, b), r, g, b); } +void AActor::SetPitch(int p) +{ + if (p != pitch) + { + pitch = p; + if (player != NULL) + { + player->cheats |= CF_INTERPVIEW; + } + } +} + +void AActor::SetAngle(angle_t ang) +{ + if (ang != angle) + { + angle = ang; + if (player != NULL) + { + player->cheats |= CF_INTERPVIEW; + } + } +} + // // P_MobjThinker // diff --git a/src/p_user.cpp b/src/p_user.cpp index 901f6cfaa..938c7727f 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -2252,6 +2252,9 @@ void P_PlayerThink (player_t *player) { player->inventorytics--; } + // Don't interpolate the view for more than one tic + player->cheats &= ~CF_INTERPVIEW; + // No-clip cheat if ((player->cheats & (CF_NOCLIP | CF_NOCLIP2)) == CF_NOCLIP2) { // No noclip2 without noclip diff --git a/src/r_utility.cpp b/src/r_utility.cpp index 0b51578ed..606cca840 100644 --- a/src/r_utility.cpp +++ b/src/r_utility.cpp @@ -581,6 +581,7 @@ void R_InterpolateView (player_t *player, fixed_t frac, InterpolationViewer *ivi viewy = iview->oviewy + FixedMul (frac, iview->nviewy - iview->oviewy); viewz = iview->oviewz + FixedMul (frac, iview->nviewz - iview->oviewz); if (player != NULL && + !(player->cheats & CF_INTERPVIEW) && player - players == consoleplayer && camera == player->mo && !demoplayback && diff --git a/src/thingdef/thingdef_codeptr.cpp b/src/thingdef/thingdef_codeptr.cpp index 9faeb7442..d48b18a2a 100644 --- a/src/thingdef/thingdef_codeptr.cpp +++ b/src/thingdef/thingdef_codeptr.cpp @@ -3935,7 +3935,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetAngle) { ACTION_PARAM_START(1); ACTION_PARAM_ANGLE(angle, 0); - self->angle = angle; + self->SetAngle(angle); } //=========================================================================== @@ -3973,8 +3973,7 @@ DEFINE_ACTION_FUNCTION_PARAMS(AActor, A_SetPitch) } pitch = clamp(pitch, min, max); } - - self->pitch = pitch; + self->SetPitch(pitch); } //===========================================================================