A_ZoomFactor New Flag To Only Scale Turning
Moderator: GZDoom Developers
- 22alpha22
- Posts: 303
- Joined: Fri Feb 21, 2014 5:04 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Montana, USA
A_ZoomFactor New Flag To Only Scale Turning
A new flag for A_ZoomFactor that will scale the player's turn-rate by the zoom value without actually changing the FOV (zooming in). There currently is no other way to just scale the player's turn rate through Decorate; trying to do it through ACS is messy, somewhat inaccurate, and not nearly as smooth as what could be achieved through A_ZoomFactor.
- Major Cooke
- Posts: 8175
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: A_ZoomFactor New Flag To Only Scale Turning
Doesn't belong to A_ZoomFactor in this case. What you propose is worth its own function.
- 22alpha22
- Posts: 303
- Joined: Fri Feb 21, 2014 5:04 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Montana, USA
Re: A_ZoomFactor New Flag To Only Scale Turning
I just figured that since A_ZoomFactor already scales the player's turn-rate by default, it would be easier just to add a flag that disables the FOV change, rather than make an entire new function, but whatever works I suppose.
- Caligari87
- Admin
- Posts: 6174
- Joined: Thu Feb 26, 2004 3:02 pm
- Preferred Pronouns: He/Him
- Contact:
Re: A_ZoomFactor New Flag To Only Scale Turning
Are the internals for A_ZoomFactor not exposed? Is it not possible to write zscript function to adjust the player's turn rate?
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49066
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: A_ZoomFactor New Flag To Only Scale Turning
Code: Select all
action void A_ZoomFactor(double zoom = 1, int flags = 0)
{
let player = self.player;
if (player != NULL && player.ReadyWeapon != NULL)
{
zoom = 1 / clamp(zoom, 0.1, 50.0);
if (flags & 1)
{ // 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;
}
}
- Caligari87
- Admin
- Posts: 6174
- Joined: Thu Feb 26, 2004 3:02 pm
- Preferred Pronouns: He/Him
- Contact:
Re: A_ZoomFactor New Flag To Only Scale Turning
After exploring the code a bit (still a newb at this), it seems that if FOVScale is set to negative it'll be used internally to also scale the player's pitch/yaw, correct? What are the chances of exporting or generalizing that scaling so we no longer have to deal with hacks with ChangeActorAngle (which generally runs the risk of causing jittering)?
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49066
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: A_ZoomFactor New Flag To Only Scale Turning
That's the entire use for FOVScale. But it's a weapon property, making it a bit restrictive.
- 22alpha22
- Posts: 303
- Joined: Fri Feb 21, 2014 5:04 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Montana, USA
Re: A_ZoomFactor New Flag To Only Scale Turning
My knowledge of C related languages is pretty much nill, but nonetheless I've been messing with this function trying to figure out how to scale the player's turn-rate without also invoking a FOV change, without success. I copied the A_ZoomFactor ZScript definition and named it A_ZoomFactorEx and got it working identically to the original in Decorate. After I verified that it worked, I began tweaking it, trying to get the turn-rate scale without the FOV change, and while I really don't understand how it all works, from what I can gather, FOVScale seems to be some internal function that can scale the player's FOV with or without scaling the player's turn-rate but the turn-rate cannot be scaled without changing the FOV.
Since the original request of this thread was given a [DIY], I assume there must be something I'm missing. I like to think my knowledge of Decorate and ACS is above average, but my skills with real programming languages is next to nill, so if there is a way to achieve the original request through ZScript, I'll need a little more explanation on how to do it.
Since the original request of this thread was given a [DIY], I assume there must be something I'm missing. I like to think my knowledge of Decorate and ACS is above average, but my skills with real programming languages is next to nill, so if there is a way to achieve the original request through ZScript, I'll need a little more explanation on how to do it.
- Graf Zahl
- Lead GZDoom+Raze Developer
- Posts: 49066
- Joined: Sat Jul 19, 2003 10:19 am
- Location: Germany
Re: A_ZoomFactor New Flag To Only Scale Turning
The thing is, all what you asked for is to isolate that one line of code. If that doesn't work, the entire request is invalid because you really need a new feature.
- 22alpha22
- Posts: 303
- Joined: Fri Feb 21, 2014 5:04 pm
- Graphics Processor: nVidia with Vulkan support
- Location: Montana, USA
Re: A_ZoomFactor New Flag To Only Scale Turning
I'm sorry if my ignorance about ZScript and and programming in general is getting on people's nerves. My misunderstanding led me to believe that a new flag for A_ZoomFactor would be the simplest and best solution. Then when you posted the function in ZScript and tagged the request [DIY], I thought you meant I could simply edit the function and add the flag I needed. So now if I'm on same page, I need to do what Major Cooke originally suggested and create a new request for a brand new function that can scale the player's turn-rate?