diff --git a/docs/rh-log.txt b/docs/rh-log.txt index bcc61e95a5..be3ebda459 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,6 @@ June 30, 2009 +- A_ZoomFactor now scales turning with the FOV by default. ZOOM_NOSCALETURNING + will leave it unaltered. - Added Gez's PowerInvisibility changes. - Fixed: clearflags did not clear flags6. - Added A_SetAngle, A_SetPitch, A_ScaleVelocity, and A_ChangeVelocity. diff --git a/src/g_game.cpp b/src/g_game.cpp index d160f9c455..038e2bded9 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -695,6 +695,12 @@ void G_AddViewPitch (int look) return; } look <<= 16; + if (players[consoleplayer].playerstate != PST_DEAD && // No adjustment while dead. + players[consoleplayer].ReadyWeapon != NULL && // No adjustment if no weapon. + players[consoleplayer].ReadyWeapon->FOVScale > 0) // No adjustment if it is non-positive. + { + look = int(look * players[consoleplayer].ReadyWeapon->FOVScale); + } if (!level.IsFreelookAllowed()) { LocalViewPitch = 0; @@ -735,7 +741,14 @@ void G_AddViewAngle (int yaw) { return; } - LocalViewAngle -= yaw << 16; + yaw <<= 16; + if (players[consoleplayer].playerstate != PST_DEAD && // No adjustment while dead. + players[consoleplayer].ReadyWeapon != NULL && // No adjustment if no weapon. + players[consoleplayer].ReadyWeapon->FOVScale > 0) // No adjustment if it is non-positive. + { + yaw = int(yaw * players[consoleplayer].ReadyWeapon->FOVScale); + } + LocalViewAngle -= yaw; if (yaw != 0) { LocalKeyboardTurner = smooth_mouse; diff --git a/src/g_shared/a_weapons.cpp b/src/g_shared/a_weapons.cpp index 5a0dc376e5..b7543c4db5 100644 --- a/src/g_shared/a_weapons.cpp +++ b/src/g_shared/a_weapons.cpp @@ -1710,11 +1710,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AWeapon, A_ZoomFactor) if (self->player != NULL && self->player->ReadyWeapon != NULL) { zoom = 1 / clamp(zoom, 0.1f, 50.f); - self->player->ReadyWeapon->FOVScale = zoom; if (flags & 1) - { - // Make the zoom instant. + { // Make the zoom instant. self->player->FOV = self->player->DesiredFOV * zoom; } + if (flags & 2) + { // Disable pitch/yaw scaling. + zoom = -zoom; + } + self->player->ReadyWeapon->FOVScale = zoom; } } diff --git a/src/p_user.cpp b/src/p_user.cpp index 9b1ceddc19..2921cac7ba 100644 --- a/src/p_user.cpp +++ b/src/p_user.cpp @@ -2002,7 +2002,9 @@ void P_PlayerThink (player_t *player) player->ReadyWeapon != NULL && // No adjustment if no weapon. player->ReadyWeapon->FOVScale != 0) // No adjustment if the adjustment is zero. { - desired *= player->ReadyWeapon->FOVScale; + // A negative scale is used top prevent G_AddViewAngle/G_AddViewPitch + // from scaling with the FOV scale. + desired *= fabs(player->ReadyWeapon->FOVScale); } if (player->FOV != desired) { @@ -2087,7 +2089,7 @@ void P_PlayerThink (player_t *player) { int crouchdir = player->crouching; - if (crouchdir==0) + if (crouchdir == 0) { crouchdir = (player->cmd.ucmd.buttons & BT_CROUCH)? -1 : 1; } diff --git a/wadsrc/static/actors/shared/inventory.txt b/wadsrc/static/actors/shared/inventory.txt index 68b98ff32e..95deef2a9e 100644 --- a/wadsrc/static/actors/shared/inventory.txt +++ b/wadsrc/static/actors/shared/inventory.txt @@ -327,6 +327,7 @@ Actor Weapon : Inventory native action native A_ZoomFactor(float scale = 1, int flags = 0); const int ZOOM_INSTANT = 1; + const int ZOOM_NOSCALETURNING = 2; } ACTOR WeaponGiver : Weapon native