- A_ZoomFactor now scales turning with the FOV by default. ZOOM_NOSCALETURNING

will leave it unaltered.


SVN r1694 (trunk)
This commit is contained in:
Randy Heit 2009-06-30 22:37:40 +00:00
parent bbebed61f5
commit 37b6e547cd
5 changed files with 27 additions and 6 deletions

View file

@ -1,4 +1,6 @@
June 30, 2009 June 30, 2009
- A_ZoomFactor now scales turning with the FOV by default. ZOOM_NOSCALETURNING
will leave it unaltered.
- Added Gez's PowerInvisibility changes. - Added Gez's PowerInvisibility changes.
- Fixed: clearflags did not clear flags6. - Fixed: clearflags did not clear flags6.
- Added A_SetAngle, A_SetPitch, A_ScaleVelocity, and A_ChangeVelocity. - Added A_SetAngle, A_SetPitch, A_ScaleVelocity, and A_ChangeVelocity.

View file

@ -695,6 +695,12 @@ void G_AddViewPitch (int look)
return; return;
} }
look <<= 16; 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()) if (!level.IsFreelookAllowed())
{ {
LocalViewPitch = 0; LocalViewPitch = 0;
@ -735,7 +741,14 @@ void G_AddViewAngle (int yaw)
{ {
return; 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) if (yaw != 0)
{ {
LocalKeyboardTurner = smooth_mouse; LocalKeyboardTurner = smooth_mouse;

View file

@ -1710,11 +1710,14 @@ DEFINE_ACTION_FUNCTION_PARAMS(AWeapon, A_ZoomFactor)
if (self->player != NULL && self->player->ReadyWeapon != NULL) if (self->player != NULL && self->player->ReadyWeapon != NULL)
{ {
zoom = 1 / clamp(zoom, 0.1f, 50.f); zoom = 1 / clamp(zoom, 0.1f, 50.f);
self->player->ReadyWeapon->FOVScale = zoom;
if (flags & 1) if (flags & 1)
{ { // Make the zoom instant.
// Make the zoom instant.
self->player->FOV = self->player->DesiredFOV * zoom; self->player->FOV = self->player->DesiredFOV * zoom;
} }
if (flags & 2)
{ // Disable pitch/yaw scaling.
zoom = -zoom;
}
self->player->ReadyWeapon->FOVScale = zoom;
} }
} }

View file

@ -2002,7 +2002,9 @@ void P_PlayerThink (player_t *player)
player->ReadyWeapon != NULL && // No adjustment if no weapon. player->ReadyWeapon != NULL && // No adjustment if no weapon.
player->ReadyWeapon->FOVScale != 0) // No adjustment if the adjustment is zero. 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) if (player->FOV != desired)
{ {
@ -2087,7 +2089,7 @@ void P_PlayerThink (player_t *player)
{ {
int crouchdir = player->crouching; int crouchdir = player->crouching;
if (crouchdir==0) if (crouchdir == 0)
{ {
crouchdir = (player->cmd.ucmd.buttons & BT_CROUCH)? -1 : 1; crouchdir = (player->cmd.ucmd.buttons & BT_CROUCH)? -1 : 1;
} }

View file

@ -327,6 +327,7 @@ Actor Weapon : Inventory native
action native A_ZoomFactor(float scale = 1, int flags = 0); action native A_ZoomFactor(float scale = 1, int flags = 0);
const int ZOOM_INSTANT = 1; const int ZOOM_INSTANT = 1;
const int ZOOM_NOSCALETURNING = 2;
} }
ACTOR WeaponGiver : Weapon native ACTOR WeaponGiver : Weapon native