Commit graph

53 commits

Author SHA1 Message Date
Mitchell Richters
b2ab64bb62 - Capitalise vec3_t z variable. 2021-12-30 09:57:03 +01:00
Mitchell Richters
68e2691be7 - Capitalise vec3_t y variable. 2021-12-30 09:57:03 +01:00
Mitchell Richters
c549cc5276 - Capitalise vec3_t x variable. 2021-12-30 09:57:02 +01:00
Christoph Oelckers
41506f35db - calcviewpitch 2021-12-26 23:08:40 +01:00
Mitch Richters
1906de5d0c - Adjust PlayerHorizon and PlayerAngle struct member scaletozero() to consistently return to zero at the same speed for synchronised and unsynchronised input at any framerate from 60 fps to at least 1000 fps. 2021-11-29 00:55:15 +01:00
Mitch Richters
b27f5e3be0 - gameinput.cpp/h: Internalise if statements used before calling PlayerHorizon and PlayerAngle class method scaletozero() into method itself. 2021-11-07 18:25:37 +11:00
Mitch Richters
72531e61db - gameinput.cpp/h: Consolidate all the return to zero code for angles and horizons into class members, using technique from horizoff as basis. 2021-11-07 11:37:12 +11:00
Mitch Richters
7499c84d0b - Add interpolatedhorizon() inlines to handle interpolating fixedhoriz objects without having to convert old and new values back to Q16.16 first. 2021-11-06 14:07:58 +11:00
Mitch Richters
5ec5321034 - gameinput.h/cpp: Abstract the angle/horizon adjustment math into a few inlines to avoid repetition and having to cast enums as doubles for C++20 compliance. 2021-11-06 14:07:53 +11:00
Mitch Richters
c424f7c8dd - processMovement(). Remove cl_exhumedoldturn CVAR and tidy up numeric literals in use.
* In our older codebase before the input code was refactored, Exhumed's turning was broken and was only applying the base factor of 12, significantly slower than the other games.
* Upon doing some testing in PCExhumed, I noticed their turning was faster as when the counter meets its target, the turn value is shifted left by 2, effectively making it 48: b90417ed8e/source/exhumed/src/player.cpp (L336-L337)
* Removed this CVAR because of this.
* Reworked turning code so that pressing left+right together cancel each other out and that pressing both doesn't call `updateTurnHeldAmt(scaleAdjust)` twice.
* Redid turn averages factoring in Exhumed's speeds, rounded off values and stored in an enum for clarity.
2021-11-06 09:28:47 +11:00
Mitch Richters
0fe5ac6a56 - gameinput.h: Correctly use targetset() in PlayerHorizon and PlayerAngle structs. 2021-10-30 17:30:01 +02:00
Mitch Richters
15c4d38694 - gameinput.h: Add initial structure for PlayerPosition as companion to PlayerAngle and PlayerHorizon structs. 2021-10-30 17:30:01 +02:00
Mitch Richters
7ee4f49649 - gameinput.h: Remove some of the verticality from the PlayerHorizon and PlayerAngle structs. 2021-10-30 17:30:01 +02:00
Christoph Oelckers
29769dd673 - fixed engine code warnings pointed out by XCode 13. 2021-10-08 19:06:41 +02:00
Mitchell Richters
ca65c4c9da - Allow ticker to lock input to player's angle and horizon without having to force use of synchronised input. 2021-07-18 19:25:41 +10:00
Mitchell Richters
93edeac791 - Clean-up of input functions.
* Remove unused `getincanglef()`.
* Remove unused `getincangleq16()`.
* In `PlayerHorizon` struct, clamp value when setting target in `__settarget()`, not each public `settarget()` overload.
* Rename `PlayerAngle` method `applylook()` to `applyinput()`.
* Rename `PlayerHorizon` method `sethorizon()` to `applyinput()`.
* In `PlayerHorizon::applylook()`, slightly clean return to centre code so it doesn't do math if already at 0.
* In `PlayerAngle::applylook()`, slightly clean rotscrnang/look_ang code so it doesn't do math if already at 0 and reposition where mouse input is applied so that if input is applied, the player never enters a spin.
* In `Duke3d::player_struct::apply_seasick()`, use `buildfang()` method instead of scaling float to BAM within function.
2021-04-21 20:41:04 +10:00
Mitchell Richters
d34070b8ae - gameinput.h: Remove precise bool from horizsumfrac(), look_anghalf() and looking_arc() added in a4895cb270.
* It looks terrible to have low precision math versions of look_anghalf and looking_arc since we always interpolate `look_ang` now, so lets just not.
2021-04-20 21:12:17 +10:00
Mitchell Richters
de06030ea0 - gameinput.cpp: Make sethorizon(), applylook() and calcviewpitch() class functions of PlayerHorizon and PlayerAngle where appropriate. 2021-04-19 20:50:10 +10:00
Mitchell Richters
a4895cb270 - All Games: Allow for HUD interpolation to be disabled.
* Requested by users, really don't know why...
* Interpolation values are guarded by the CVAR.
* For Blood, integer truncation is employed just like original game.
* For all games where more precise sine/cosine math has been utilised, no changes have been made.
2021-04-15 13:35:53 +10:00
Mitchell Richters
f343bd8d5e - Fix death camera issues stemming from f254eeb465.
* Adjustment in `__addadjustment()` needs to be signed.
* Output of `bvectangbam()` needs to be signed before Duke/SW left-shift the value.
2021-04-11 17:52:29 +10:00
Mitchell Richters
534271c62a - PlayerHorizon::interpolatedsum(): Cut over interpolation code to inline functions that was missed when doing e76f63e2c0. 2021-04-11 17:50:32 +10:00
Mitchell Richters
e76f63e2c0 - Consolidate all game interpolation code into inline functions. 2021-04-11 16:45:35 +10:00
Mitchell Richters
f254eeb465 - binaryangle.h: Remove lookangle class and replace use with binangle.
* Added in fca846272e to deal with signed adjustments but its just not needed.
* Made better use of `binangle`/`fixedhoriz` class getters and setters than before as well.
2021-04-11 15:45:53 +10:00
Mitchell Richters
ba90f444dd - PlayerAngle: Repair issues with addadjustment() method following changes in 4ffe004483 that were affecting negative input. 2021-04-05 21:41:11 +10:00
Mitchell Richters
9c01bde44e - gameinput.cpp: Block player input within sethorizon() and applylook() if target for each has been set by the ticker.
* Stops players having the ability to provide input and fight the system trying to set an input.
2021-04-02 22:47:19 +11:00
Mitchell Richters
4ffe004483 - Further work within PlayerAngle and PlayerHorizon structs following 39fe9efaff and bf2d8078a4.
* Reduce code repetition.
* Clamp incoming horizon when using `settarget()` methods.
* Eliminate double calculation that was occurring in `processhelpers()`.
2021-04-02 22:47:17 +11:00
Mitchell Richters
bf2d8078a4 - PlayerHorizon: Replicate changes to settarget() and processhelpers() methods from 39fe9efaff. 2021-03-31 19:44:50 +11:00
Mitchell Richters
39fe9efaff - PlayerAngle: Adjust how settarget() methods store angle for unsynchronised angle adjustments and adjust processhelpers() method accordingly.
* Repairs angle issues raised in https://forum.zdoom.org/viewtopic.php?f=340&p=1185365.
2021-03-31 19:43:41 +11:00
Mitchell Richters
7fcf1c94a1 - Exhumed: Minor fixes to panning code.
* Stop panning if underwater.
* Remove overload from PlayerHorizon from d32dcd5f8e that was causing problems for other games.
* Remove static bool `plrFalling` also from d32dcd5f8e and add `bIsFalling` to `Player` struct, hooking up with save code as well.
2021-01-05 17:07:56 +11:00
Mitchell Richters
d32dcd5f8e - Exhumed: Fix player panning when walking up/down steps while horizon is 0. 2021-01-05 11:01:41 +11:00
Mitchell Richters
36c25ee2a0 - gameinput.cpp: Break out processMovement()'s turnheldamt calculations into functions. 2021-01-02 09:53:03 +11:00
Mitchell Richters
3a801cbf5c - calcviewpitch(): Set scaleAdjust to default to 1 in prototype like other functions in gameinput.cpp. 2021-01-02 09:32:19 +11:00
Mitchell Richters
6d12159006 - Duke/SW: Consolidate each game's slopetilting function into backend solution.
* Based on SW's implementation purely for its commentary, but includes a fix from Duke's.
* Allow disabling Duke's slopetilting via `cl_slopetilting` like SW.
2021-01-02 00:30:11 +11:00
Christoph Oelckers
ae36ea88c3 - wrap all checks of cl_syncinput in an inline function. 2020-11-30 23:40:16 +01:00
Mitchell Richters
80ff918b17 - gameinput.h: For PlayerAngle struct methods settarget(), properly set target as angle + delta between angle & target within method and not game-side. 2020-11-26 17:26:29 +11:00
Mitchell Richters
e9e4590f6a - gameinput.h: For PlayerHorizon and PlayerAngle struct methods settarget(), always set the angle directly if backup set to true. 2020-11-26 16:42:07 +11:00
Mitchell Richters
b9e1cbb5de - gamecontrol.h: Move getHalfLookAng() into PlayerAngle struct as look_anghalf().
* Uses internal struct variables at full BAM precision.
2020-11-26 16:37:37 +11:00
Mitchell Richters
5ba2e7863d - binaryangle.h: Add asbuildf() method to all classes and use where appropriate. 2020-11-22 21:18:12 +01:00
Mitchell Richters
e57d6f8785 - Duke: Fix crane's angle settarget() call.
* Fixes #185.
2020-11-22 21:18:12 +01:00
Mitchell Richters
3b3e926fd3 - gameinput.h: For PlayerAngle struct, add int settarget() overload and change one true call with a float to bvectangf(). 2020-11-22 21:18:11 +01:00
Mitchell Richters
2341ed4e25 - gameinput.h: For PlayerAngle struct, add extra addadjustment() overloads to remove type conversions game-side, and when incoming. 2020-11-22 21:18:11 +01:00
Mitchell Richters
42689e02c4 - gameinput.cpp: Define getincanglebam() and slightly clean up other getincangle*() functions. 2020-11-22 21:18:11 +01:00
Mitchell Richters
ade1a80515 - gameinput.cpp: Remove crouch bool from applylook() since we can now just rely in the actions bitfield that's already incoming as required and default scaleAdjust in the prototype to 1. 2020-11-07 18:25:06 +11:00
Mitchell Richters
6e3d414b3c - inputstate.cpp: Move checkCrouchToggle() from gameinput.ccp into ApplyGlobalInput() and use static bool for crouch toggling vs. game-side bool. 2020-11-07 18:16:16 +11:00
Mitchell Richters
4ef0d20e0e - gameinput.cpp: Consolidate checkCrouchToggle() from Duke with discrete implementations from Blood in 7c8efde38c and Exhumed in 032db82f82 to unify the functionality. 2020-11-07 13:44:25 +11:00
Mitchell Richters
ff9c7bf0bb - binaryangle.h: Create osum() for PlayerHorizon and PlayerAngle structs and use within each struct's interpolatedsum() method.
* Already doubled up by calculating `sum()` again within `interpolatedsum()` and no point changing that out without an `osum()`.
2020-10-18 22:43:42 +11:00
Mitchell Richters
cd683e6511 - binaryangle.h: Add missed line from 4e07942cff to calculate interpolation ratio using multiply instead of divide. Hopefully in the future we can just use a true double between 0 and 1 like GZDoom... 2020-10-18 22:05:21 +11:00
Mitchell Richters
4e07942cff - binaryangle.h: Minor clean up of PlayerHorizon/PlayerAngle structs.
* Sync PlayerHorizon's `settarget()` with changes to PlayerAngle's from 19d9e1a947.
* For each struct's `addadjustment()`, multiply value by unit there rather than always within `processhelpers()`.
* Properly use `xs_CRoundToUInt()` within PlayerAngle's `processhelpers()` method instead of the signed version.
* Use `abs()` within PlayerAngle's `processhelpers()` like PlayerHorizon's.
2020-10-18 22:00:39 +11:00
Mitchell Richters
19d9e1a947 - binaryangle.h: Fix issues with PlayerAngle.settarget() following changes in bf5bd01164.
* Just was not working whatsoever, really...
2020-10-18 21:31:36 +11:00
Mitchell Richters
a792f329ca - binaryangle.h/PlayerAngle: Fix incorrect variable declaration on dang within interpolatedsum() method.
* Didn't seem to be causing an issue but better it be correct.
2020-10-12 16:28:05 +11:00