Commit graph

13789 commits

Author SHA1 Message Date
Mitchell Richters
3c82014d0e - Move ApplyGlobalInput() into gameinput.cpp.
* Doesn't really belong in inputstate.cpp, it was just placed there in 2020 for lack of a better spot at the time.
2023-04-02 18:32:38 +10:00
Mitchell Richters
9e1ca0cb8f - Make the turbo turn functions static within gameinput.cpp. 2023-04-02 18:32:38 +10:00
Mitchell Richters
359371527b - Move Duke's vehicle input processor into gameinput.cpp. 2023-04-02 18:32:36 +10:00
Mitchell Richters
563c79322d - Duke: Make vehicle input code work generically for possible reusage. 2023-04-02 18:25:04 +10:00
Mitchell Richters
5e153d6404 - Duke: Merge vehicle input code into one function. 2023-04-02 18:24:05 +10:00
Mitchell Richters
03eb105df1 - Duke: Move RRRA vehicle tilting out of the input code and into the playsim. 2023-04-02 18:24:05 +10:00
Mitchell Richters
c13745efc8 - Remove the mouse input negation out of the event handler. 2023-04-02 18:24:05 +10:00
Mitchell Richters
b340807a6b - Remove now-unneeded inline wrapper getHidInput(). 2023-04-02 18:24:05 +10:00
Mitchell Richters
46b5977a6a - Recover two ESyncBit values for other uses.
* By masking aiming+centering, we have look bits :)
2023-04-02 18:24:05 +10:00
Christoph Oelckers
e1ea0492e1 - savegame version bump. 2023-04-02 08:50:05 +02:00
Christoph Oelckers
1e7850b17e - fixed last commit 2023-04-01 12:27:48 +02:00
Christoph Oelckers
a64f19c16d - had to apply the RapidJson NaN workaround to another place.
So instead of fixing the bug they actually replicated it into a second function. :(
It's too bad that we cannot enable proper writing of NaNs and Infs because it makes most JSON formatters emit an error on this undefined extension of the format.
2023-04-01 10:26:51 +02:00
Christoph Oelckers
5f3065d9f1 - Duke: fixed weapon spread with non-pistol hitscan weapons. 2023-04-01 09:49:22 +02:00
Mitchell Richters
86711f666b - Exhumed: Tidy up StartDeathSeq(). 2023-03-29 19:41:05 +11:00
Mitchell Richters
3e4dd94fe5 - Exhumed: Tidy up a bunch of small player functions. 2023-03-29 19:40:42 +11:00
Mitchell Richters
0467b02393 - Exhumed: Mark all player static arrays as const. 2023-03-29 19:39:54 +11:00
Mitchell Richters
daf63ce209 Revert "- InputState::ClearAllInput(): Only clear crouch_toggle bool if outside of a level, and resend SB_CROUCH sync bit if inside a level and crouch_toggle is true."
This reverts commit c076310e34.

* It's no longer needed with 70706d3da8.
2023-03-29 13:21:14 +11:00
Mitchell Richters
70706d3da8 - Don't stop getting input when we're paused.
* This is the cause of the long-standing crouch toggle issues, as well as a few other things.
2023-03-29 13:20:55 +11:00
Mitchell Richters
7feb5a9a9b Revert "- Duke: Temporary workaround for last commit so the player returns to centre on level load."
This reverts commit 2b22e49a9b.

* It's no longer needed with 06dd971291.
2023-03-29 13:20:55 +11:00
Mitchell Richters
06dd971291 - When the gameaction is ga_level, return and don't break.
* This was causing the first input packet to only be sent to the playsim after the first tic occurred.
* Previous: player 1 of 1 (1 nodes); E1L1: Hollywood Holocaust; PlayClock: 4; PlayClock: 4; PlayClock: 12;, etc.
* Current: player 1 of 1 (1 nodes); E1L1: Hollywood Holocaust; PlayClock: 0; PlayClock: 4; PlayClock: 8;, etc.
* Fixes #900.
2023-03-29 13:20:47 +11:00
Mitchell Richters
7caec5fa69 - Clean out where inputState.ClearAllInput() is called.
* We can do this from just a few places and achieve the same result as having it sprinkled everywhere did.
2023-03-29 09:05:49 +11:00
Mitchell Richters
9f8cda4be3 - Move call to I_GetInputFrac() to ensure we're never stalled waiting for a tic. 2023-03-29 09:04:40 +11:00
Mitchell Richters
d665037075 - Clean out where Net_ClearFifo() is called.
* We can do this from one place and achieve the same result as having it sprinkled everywhere did.
2023-03-29 09:04:38 +11:00
Mitchell Richters
96055fbc03 - Clean out all games setting gameaction = ga_level and do it centrally. 2023-03-29 03:10:16 +11:00
Mitchell Richters
9618ba1e78 - Don't serialise player angles twice. 2023-03-28 09:15:58 +11:00
Mitchell Richters
72be2623c3 - Exhumed: Remove useless sectortype extern pointer. 2023-03-28 08:51:51 +11:00
Mitchell Richters
c6a53265eb - Exhumed: Misc tidy-ups.
* The setting of `Player::bIsFiring` needs to be done before setting a new weapon.
* Tidy up some weird reverse engineering `while (1)` loop which GDX doesn't do.
2023-03-28 08:45:14 +11:00
Mitchell Richters
42d791e7c2 - Exhumed: Fix clip calculation setup.
* Since game maintains its own clip capacities, we need to use them instead of the generic handler for the games that do not.
* Clean up the game-side code in `CheckClip()` to use `min()`.
* Repair issue with pistol clip calculation that was using modulo when it shouldn't. A full weapon with 300 will divide into 6 with no remainder, therefore nothing in the clip.
* Fixes #906.
2023-03-27 22:05:35 +11:00
Mitchell Richters
892dde030f - Tidy up nested branch in calcChaseCamPos(). 2023-03-27 20:43:55 +11:00
Mitchell Richters
6c2717fcde - Avoid testing if we're synchronising input twice in getInput(). 2023-03-27 20:01:56 +11:00
Mitchell Richters
79745668a6 - Exhumed: Take advantage of getWrappedIndex() in updatePlayerInventory() as well. 2023-03-27 18:47:30 +11:00
Mitchell Richters
1ed655e0e7 - Exhumed: Further clean up updatePlayerWeapon().
* Rename a few variables for better clarity as to what's going on.
* Add new inline to the backend `getWrappedIndex()` that properly wraps around negative values based on the supplied maximum using modulo.
* Directly set the weapon when doing the next/prev tests to avoid unnecessary tests to see whether the player has the weapon or not.
2023-03-27 18:47:05 +11:00
Mitchell Richters
ebedf46434 - Exhumed: Reset view pitch back to 0 when doing Ramses, using game's formula.
* Ensure's a smooth return to 0 so the player's actual pitch can be targeted towards Ramses.
* In situations where the player had their view pitch changed in the ticker, this would have never reset.
2023-03-27 18:08:56 +11:00
Mitchell Richters
0594a5cb91 - Exhumed: Properly repair height test after reviewing GDX.
* The code in this game is so much tidier to understand what's what...
2023-03-27 18:08:55 +11:00
Mitchell Richters
bd8b033120 - Exhumed: Logic fixes to some underwater tests following review of GDX.
* Necessitated a little bit of rearranging in the player ticker but the grouping of all inputs into one function makes sense.
2023-03-27 18:08:55 +11:00
Mitchell Richters
94f188c926 - Exhumed: Restore original grenade pickup code.
* When I read this against the generic weapon pickup code, it looked similar enough but the grenade's logic is reversed. That is, after picking up the weapon, equip the player. The generic weapon handler equips the player, then gives them ammo.
* Fixes #904.
2023-03-27 18:08:55 +11:00
Mitchell Richters
99e23a8d24 - Exhumed: Move Player::nCurrentItem usage into the right spot.
* Originally, `updatePlayerInventory()` was in the main loop and not the player ticker. Now that it's been relocated, this makes sense.
2023-03-27 18:06:35 +11:00
Mitchell Richters
d66f97e5dc - Exhumed: Clean up weapon selection code a bit.
* Concentrate it all in the `updatePlayerWeapon()` function.
2023-03-27 17:08:59 +11:00
Mitchell Richters
cb3fec39df - Exhumed: Move a line out of doPlayerMovement() and into updatePlayerViewSector().
* It needs to come after the function it's been moved into, but its confusing why its calculating a new pos delta when there's one on the stack.
* By directly nesting it in, it's a lot clearer.
2023-03-27 08:36:04 +11:00
Mitchell Richters
d858856e06 - Exhumed: Store a pos delta on the stack in `doPlayerMovement().
* We need this in a few places.
* Z is inverted because pitch is negated. Previously I just swapped the operation around.
2023-03-27 08:32:52 +11:00
Mitchell Richters
4fa12a9e30 - Exhumed/SW: Make sure the pitch keys are done after the slope tilting.
* Pitch key code does player horizon bounding.
2023-03-27 08:28:32 +11:00
Mitchell Richters
4bf2f70d7b - Exhumed: Remove Player::nDestVertPan entirely.
* We can just pass the needed value into `doPlayerPitch()`.
* For Ramses, no need to set `nDestVertPan` to the map value, just use the map value.
* Avoids an excess `atan2()` call by way of `maphoriz()`.
2023-03-27 08:14:42 +11:00
Mitchell Richters
b5123ac69f - Exhumed: Split pitch and yaw input again.
* They need to be called in different places inside of `doPlayerMovement()`.
2023-03-27 08:03:35 +11:00
Mitchell Richters
6aceb7bda3 - Exhumed: Clean up some of the repeated sector gets in doPlayerMovement(). 2023-03-27 08:03:14 +11:00
Mitchell Richters
d45be79c24 - Exhumed: Adjust yaw adjustment for Ramses to use the same formula as pitch.
* Rather than just snapping the angle, the player's yaw and pitch move evenly towards Ramses.
2023-03-26 22:13:57 +11:00
Mitchell Richters
b5a9085aed - Exhumed: Restore more accurate pitch adjustment for Ramses.
* Use `maphoriz(-11)` instead of some voodoo degree amount so it's clear when comparing sources.
* Don't stop interpolating while doing Ramses.
* Apply Ramses pitch amount to `nVertDestPan`, just like the original.
* Don't reset all angles when initialising Ramses, just set the yaw angle.
* Don't return player's view to center when doing Ramses, use the delta between `nDestVertPan` and the player's pitch, using same formula as original.
* Comment in how normal/non-ramses `nDestVertPan` setting should be 8x the sprite Z move delta, not 2x. I know it's not correct, but its been this way for a long time and we probably should CVAR it.
* When doing the player's death pitch, it's 40.156 degrees (horizon of 108), not 38 degrees (horizon of 100). This was a misread of mine way back when.
2023-03-26 22:13:57 +11:00
Christoph Oelckers
b6da4ecddf - backend update from GZDoom. 2023-03-26 11:45:25 +02:00
Mitchell Richters
0840e547b7 - Exhumed: Reset the player actor's pitch with the rest of the actor resets. 2023-03-26 20:12:59 +11:00
Mitchell Richters
1888b7ee9f - Exhumed: Ensure we back up the player actor's location after doing everything and not mid-way through a reset. 2023-03-26 20:09:43 +11:00
Mitchell Richters
950f4c2c38 - Exhumed: Restore nStandHeight global and move to Player struct.
* Was dropped in 572869f502.
* Game's crouch testing necessitates that this value be pre-cached.
* Interestingly, this value is 62.5 whereas the game's view height is 55. Change in late development to make the world feel larger?
2023-03-26 20:06:25 +11:00