diff --git a/src/p_map.cpp b/src/p_map.cpp index 43c7f6af09..d096beb0d6 100644 --- a/src/p_map.cpp +++ b/src/p_map.cpp @@ -5268,6 +5268,7 @@ int P_PushDown(AActor *thing, FChangePosition *cpos) void PIT_FloorDrop(AActor *thing, FChangePosition *cpos) { fixed_t oldfloorz = thing->floorz; + fixed_t oldz = thing->Z(); P_AdjustFloorCeil(thing, cpos); @@ -5297,6 +5298,10 @@ void PIT_FloorDrop(AActor *thing, FChangePosition *cpos) P_CheckFakeFloorTriggers(thing, oldz); } } + if (thing->player && thing->player->mo == thing) + { + thing->player->viewz += thing->Z() - oldz; + } } //============================================================================= @@ -5348,6 +5353,10 @@ void PIT_FloorRaise(AActor *thing, FChangePosition *cpos) thing->SetZ(oldz); break; } + if (thing->player && thing->player->mo == thing) + { + thing->player->viewz += thing->Z() - oldz; + } } //============================================================================= @@ -5359,6 +5368,7 @@ void PIT_FloorRaise(AActor *thing, FChangePosition *cpos) void PIT_CeilingLower(AActor *thing, FChangePosition *cpos) { bool onfloor; + fixed_t oldz = thing->Z(); onfloor = thing->Z() <= thing->floorz; P_AdjustFloorCeil(thing, cpos); @@ -5395,6 +5405,10 @@ void PIT_CeilingLower(AActor *thing, FChangePosition *cpos) break; } } + if (thing->player && thing->player->mo == thing) + { + thing->player->viewz += thing->Z() - oldz; + } } //============================================================================= @@ -5406,6 +5420,7 @@ void PIT_CeilingLower(AActor *thing, FChangePosition *cpos) void PIT_CeilingRaise(AActor *thing, FChangePosition *cpos) { bool isgood = P_AdjustFloorCeil(thing, cpos); + fixed_t oldz = thing->Z(); if (thing->flags4 & MF4_ACTLIKEBRIDGE) return; // do not move bridge things @@ -5432,6 +5447,10 @@ void PIT_CeilingRaise(AActor *thing, FChangePosition *cpos) thing->SetZ( MIN(thing->ceilingz - thing->height, onmobj->Top())); } } + if (thing->player && thing->player->mo == thing) + { + thing->player->viewz += thing->Z() - oldz; + } } //=============================================================================