From 03d7418f51ac6016ea0b0ccf24a7b16475651ad2 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 21 Jan 2016 10:23:20 +0100 Subject: [PATCH] - fixed: Since sector movement is done after P_PlayerThink is called, any player position change induced by this is not factored into player_t::viewz and needs to be added explicitly. This fixes the infamous 'view squats down a bit when riding up an elevator' effect. It is also there in the other cases but far less pronounced. --- src/p_map.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/p_map.cpp b/src/p_map.cpp index 43c7f6af0..d096beb0d 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; + } } //=============================================================================