From 8d501fdb9f1003ba839f697ec4c27dc9d5dc8f4c Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Wed, 22 Apr 2015 23:22:27 -0500 Subject: [PATCH] Fix some issues with changing player viewheight at runtime - Viewheight change was delayed: Viewheight must be copied to player structure as well as the PlayerPawn. Not sure if should actually use deltaviewheight to spread the change out over a few tics instead of being instant. - Viewheight not preserved when travelling: player->viewheight must be restored from pawn->ViewHeight, because the temporary player set it back to the default viewheight. --- src/fragglescript/t_cmd.cpp | 1 + src/g_level.cpp | 1 + src/p_acs.cpp | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/src/fragglescript/t_cmd.cpp b/src/fragglescript/t_cmd.cpp index 190c6b984d..74f3663579 100644 --- a/src/fragglescript/t_cmd.cpp +++ b/src/fragglescript/t_cmd.cpp @@ -169,6 +169,7 @@ void FS_EmulateCmd(char * string) { // No, this is not correct. But this is the way Legacy WADs expect it to be handled! if (players[i].mo != NULL) players[i].mo->ViewHeight = playerviewheight; + players[i].viewheight = playerviewheight; players[i].Uncrouch(); } while (sc.GetString()) diff --git a/src/g_level.cpp b/src/g_level.cpp index fd6d8049a6..713205f6fb 100644 --- a/src/g_level.cpp +++ b/src/g_level.cpp @@ -1229,6 +1229,7 @@ void G_FinishTravel () pawn->lastenemy = NULL; pawn->player->mo = pawn; pawn->player->camera = pawn; + pawn->player->viewheight = pawn->ViewHeight; pawn->flags2 &= ~MF2_BLASTED; DObject::StaticPointerSubstitution (oldpawn, pawn); oldpawn->Destroy(); diff --git a/src/p_acs.cpp b/src/p_acs.cpp index 111fb99bac..43d7c7bd53 100644 --- a/src/p_acs.cpp +++ b/src/p_acs.cpp @@ -3899,7 +3899,13 @@ void DLevelScript::DoSetActorProperty (AActor *actor, int property, int value) case APROP_ViewHeight: if (actor->IsKindOf (RUNTIME_CLASS (APlayerPawn))) + { static_cast(actor)->ViewHeight = value; + if (actor->player != NULL) + { + actor->player->viewheight = value; + } + } break; case APROP_AttackZOffset: