Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a LookScale weapon variable to adjust view sensitivity from ZScript #780

Merged
merged 3 commits into from Mar 7, 2019

Conversation

@caligari87
Copy link
Contributor

caligari87 commented Mar 7, 2019

As it stands, adjusting the view sensitivity for a player can be done in a roundabout way by fiddling with a weapon's FOVScale and DesiredFOV to "trick" the engine into thinking the player has a higher or lower FOV than they actually do.

This pull request implements a canonical way to do the same without "hacks" by adding a simple multiplier LookScale to the weapon. Example:

class PistolTest : Pistol {
	override void PostBeginPlay() {
		super.PostBeginPlay();
		LookScale = 0.1;    //10% look sensitivity
	}
}
caligari87 added 2 commits Mar 7, 2019
This variable allows a weapon to set a custom look sensitivity multiplier without fiddling with FOVScale / DesiredFOV hacks.
Turns out the entire thing was getting shortcutted because FOVScale is 0 unless set explicitly or via A_ZoomFactor.
Copy link
Owner

coelckers left a comment

This should have a property being added

@madame-rachelle

This comment has been minimized.

Copy link
Collaborator

madame-rachelle commented Mar 7, 2019

This should have a property being added

double LookScale; // Multiplier for look sensitivity (like FOV scaling but without the zooming)

What do you mean by property? I am confused.

As requested by @coelckers.
@madame-rachelle

This comment has been minimized.

Copy link
Collaborator

madame-rachelle commented Mar 7, 2019

Nevermind, I guess the commit that appeared after my comment answers my question.

@caligari87

This comment has been minimized.

Copy link
Contributor Author

caligari87 commented Mar 7, 2019

Added the weapon property as requested, this allows setting the weapon's lookscale by default, e.g.

class PistolTest : Pistol {
	default {
		Weapon.LookScale 0.1;
	}
}

(note I am committing this last one remotely over SSH so I wasn't able to test graphically ingame but it does compile and load with no errors)

@coelckers coelckers merged commit cabe0c5 into coelckers:master Mar 7, 2019
1 of 2 checks passed
1 of 2 checks passed
continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.