Commit Graph

55 Commits

Author SHA1 Message Date
Mitchell Richters 736811e864 - properly tune `sethorizon()` so that 'frominput' bool can be removed. Returning to centre function is essentially consistent between input states now. 2020-08-05 17:59:01 +10:00
Mitchell Richters 0ee3ab4df8 - revert most of e474ebc2b7 and adjust player's angle/horizon in a way that's compatible with `cl_syncinput 0` and `cl_syncinput 1`.
Previous attempts at leveraging `applylook()` and `sethorizon()` in different spots had pros and cons, but ultimately changing where these functions were called from was a net negative and had hard to diagnose issues.

Maintaining two types of player input is considerable work. Lessons have been learned and will be beneficial when it comes time to re-doing the other games. Ideas from PR #98 for optimising RRRA vehicle experience while `cl_syncinput 0` is in use have been implemented here.
2020-08-05 17:53:41 +10:00
Mitchell Richters bc103595ce - force `scaleAdjust` to be 1 when `cl_syncinput` is 1.
* Above calculation has some micro variances to it which were leading to strange behaviour like the bike's tilting not working properly with `cl_syncinput 1`.
2020-08-04 17:11:32 +10:00
Mitchell Richters 293c1af4c2 - interpolate `p->TiltStatus` for RR(RA). 2020-08-04 17:11:00 +10:00
Mitchell Richters cdb8e5b94e - do these in the order that `processinput()` does them in. 2020-08-04 16:30:20 +10:00
Mitchell Richters a2a668cd7b - fix vehicle turning issues following `cl_syncinput` changes/fixes in e474ebc2b7. 2020-08-04 16:28:57 +10:00
Mitchell Richters cb93560a4a - fix regression from e474ebc2b7 by which the player could adjust their angle on a camera while `cl_syncinput 0` (default) was set.
* Issue doesn't occur with `cl_syncinput 1` because `processinput()` returns when p->newowner >= 0 before `applylook()` is called from within it.
* Fixes #96.
2020-08-04 13:02:19 +10:00
Mitchell Richters e474ebc2b7 - multiple input fixes for both games, and for both `cl_syncinput 0` and `cl_syncinput 1` modes.
* For RR, `processweapon_r()` was performing angle and horizon changes directly which provided a harsh experience with the default `cl_syncinput 0` mode.
* Added `angAdjust` variable to `player_struct` for use with ticrate angle adjustments.
* Renamed `horizAngleAdjust` to `horizAdjust` so that there is less confusion with the new `angAdjust` variable.
* Removed `horizSkew` variable, can just use `horizAdjust` for this.
* Replaced all calls to `addang()` and `addhoriz()` with the appropriate additions/subtractions to `angAdjust` and `horizAdjust` respectively.
* Removed now unused `addang()` and `addhoriz()` setters from `player_struct`.
* Define new function `resetinputhelpers()` to eliminate code duplication between `processinput_d()` and `processinput_r()` functions.
* Remove `p->q16ang` and `p->q16horiz` direct setting from `FinalizeInput()`.
* Change `applylook()` to accept an `fixed_t adjustment` for changing the player's angle. This can either be `input.q16avel` when `cl_syncinput` is 0, or `sync[snum].q16angvel` when `cl_syncinput` is 1.
* Change `sethorizon()` to accept an `fixed_t adjustment` for changing the player's horizon. This can either be `input.q16horz` when `cl_syncinput` is 0, or `sync[snum].q16horz` when `cl_syncinput` is 1.
* Re-work `sethorizon()` to always adjust `p->q16horiz` using the true pitch code. This closer resembles the EDuke32 implementation as per SVN 7342.
* Re-work returning to center to work off the true pitch code and always ensure that the player returns to center.
* Implement work-around for RR where we need to call `sethorizon()` before the call to `fi.doincrements()` like the original game, but also after the call to `processweapon()` to apply any angle or horizon changes due to weapon recoil, etc. We work around this by calling `sethorizon()` from within `doincrements_r()` only if `cl_syncinput` is 1 and only if `doincrements_r()` is to return 1.
2020-08-03 21:19:45 +10:00
Mitchell Richters 6ad3237b62 - backup `p->kickback_pic` in prep for interpolation and tidy up other weapon interpolation variables. 2020-08-03 15:06:25 +10:00
Mitchell Richters 0bcb37860a - interpolate `p->weapon_pos` for smooth switching of weapons. 2020-08-02 21:20:54 +02:00
Christoph Oelckers 0958bccade Disabled all adult censoring in Duke and RR.
Aside from being "authentic" the parental lock is just a stupid feature with often unwanted side effects.
2020-07-29 22:43:06 +02:00
Christoph Oelckers d531f4b029 - reduce message spam when holding down the quick_kick button.
If not kept in check this will flood the console with endless messages.
2020-07-28 20:43:33 +02:00
Mitchell Richters 158fd46581 - change Duke's `synchronized_input` to CVAR `cl_syncinput`. 2020-07-28 21:38:28 +10:00
Mitchell Richters ea98978ae7 - move `p->wackedbyactor` chase-cam code into `applylook()` for increased smoothness. 2020-07-28 12:30:09 +10:00
Christoph Oelckers aea6467d00 - call D_ProcessEvents in Blood's main loop. 2020-07-27 19:12:49 +02:00
Christoph Oelckers 654391a278 - fixed layout for classic Duke fullscreen HUD. 2020-07-25 15:41:11 +02:00
Christoph Oelckers f9d48e1f68 - removed all the intermediate variables for the status bar size.
hud_size now gets used directly by the status bar code.
2020-07-25 13:26:56 +02:00
Christoph Oelckers a0cc798c9c - cleaned up the sound system interface to have consistent naming and no aliases. 2020-07-25 09:32:54 +02:00
Mitchell Richters 0d0636b0a7 - set `p->TiltStatus` in `motoApplyTurn()` to 0 if less than factor, not previous hard-coded constant.
* Backport of same fix in d0f839060e.
2020-07-25 09:51:52 +10:00
Christoph Oelckers b9f0e35d4b - fixed the crosshair. 2020-07-24 19:43:33 +02:00
Mitchell Richters d0f839060e - set `p->TiltStatus` in `boatApplyTurn()` to 0 if less than factor, not previous hard-coded constant. 2020-07-24 21:38:11 +10:00
Mitchell Richters 4bf5c3d6b5 - uplift `boatApplyTurn()` with changes from e0bc2c6c97.
* Handle button-mashing to provide a better experience.
* Rename `bike_turn` to `boat_turn`.
* Move application of scale to returning value within `boatApplyTurn()`.
* Use doubled return values like Rednukem (20 -> 40, 10 -> 20, 6 -> 12, 3 -> 6, 2 -> 4, 1 -> 2).
* Return `p->TiltStatus` towards 0 if `p->MotoSpeed` == 0 and `p->NotOnWater`.
* Always test if `p->TiltStatus` < `0.025`.
2020-07-24 21:27:47 +10:00
Mitchell Richters e0bc2c6c97 - handle button-mashing in `motoApplyTurn()`.
* If player was turning left and right, only left was returned. Now, both apply (effectively cancelling each other out.
* Move application of scale to returning value within `motoApplyTurn()`.
2020-07-24 20:46:20 +10:00
Mitchell Richters 230332338c - make RRRA motorbike turning speed consistent with varying framerates.
* Multiply returned value with scaleAdjust.
* Use doubled return values like Rednukem (20 -> 40, 10 -> 20, 3 -> 6).
2020-07-24 19:50:28 +10:00
Mitchell Richters 5bb7c7a647 - adjust `elapsedInputTicks` in `GetInput()` to be `1000.0 / REALGAMETICSPERSEC`.
* 1000 / 30 = 33.333~. This ensures that if 33.333 is the minimum value, the calculation for scaleAdjust always equals 1.0 (no scaling).
2020-07-24 19:38:09 +10:00
Mitchell Richters 25ca23f2e2 - fix keyboard input fvel/svel more in line with Graf's coding style.
* Essentially reverts e41041074d and moves the use of `abs()` from keymove to fvel/svel itself.
2020-07-24 18:32:01 +10:00
Christoph Oelckers be9094cb97 Silenced lots of warnings pointed out by XCode. 2020-07-23 17:02:59 +02:00
Mitchell Richters eadb31f9cd - use `REALGAMETICSPERSEC` as maximum value for `elapsedInputTicks` in `GetInput()`.
Hard-coded value of `10.0` was too low and was always being used instead of the value of `(now - lastCheck)`. This made `scaleAdjust` inaccurate and not fast enough.
2020-07-23 19:16:51 +10:00
Mitchell Richters e41041074d - ensure keyboard fvel/svel input never exceeds the range of keymove.
Repairs issue where keyboard input was accelerating to a value of 90 which was not possible in the original game.
2020-07-22 20:42:05 +10:00
Christoph Oelckers 61f5247b71 -let's hope this will solve the pausing problem for good.
The checks for game pause were totally inconsistent, so now there is a utility function that tells whether the game is supposed to run or not.
pause can also take 3 values now - 0 for no pause, 1 for pause from opening the menu or console or 2 for hitting the pause button.
2020-07-21 22:46:26 +02:00
Christoph Oelckers 16efa87701 - started sorting variables in globals.h and removed player.h after cleaning it out. 2020-07-20 18:43:50 +02:00
Christoph Oelckers 3028b3f3fd - merged game.h into global.h and game.cpp into global.cpp.
Meaning that all global declarations are in one file now.
2020-07-20 18:43:50 +02:00
Mitchell Richters 2ce612e8ab - remove multiplier when finalising player's angle in `FinalizeInput()`.
Not sure how this came to be but was causing rather accelerated angle adjustments compared to the stock game.
2020-07-20 20:38:38 +10:00
Christoph Oelckers c767ead84f - properly route gameexitfrommenu through the callbacks. 2020-07-18 21:28:57 +02:00
Christoph Oelckers 36d61fc662 - make sure that the static time counters in the input code do not accumulate while not in use.
The one for holding the turn key needs to be reset any time there is no turning and everything needs to be cleared when the input state is cleared. And all need to check for the case where the static state is not set yet.
2020-07-18 13:27:24 +02:00
Christoph Oelckers f9e76ba178 - merged the last two functions of the input code with input.cpp. 2020-07-18 09:59:16 +02:00
Christoph Oelckers 47a0b14b43 - the main input function is also free of conflicts. That leaves 3 functions with roughly 4kb of code that cannot be redone without using EDuke code. 2020-07-18 00:59:10 +02:00
Christoph Oelckers 6c2600df51 - cleanup of the main input code.
Only 8 kb code left that is clearly recognizable as coming from EDuke32.
2020-07-18 00:34:20 +02:00
Christoph Oelckers 1d685d24e9 - fixed handling of BitsToSend. 2020-07-17 22:19:22 +02:00
Christoph Oelckers 7bc2befc84 - consolidated the finalizing parts of the input code and fully merged most of the bike/boat handlers.
Turned out that the only major difference was already split off into subfunctions.
2020-07-17 22:09:01 +02:00
Christoph Oelckers 29e107ad24 - use CCMDs for weapon and inventory selection, courtesy of ZDuke. 2020-07-17 20:56:10 +02:00
Christoph Oelckers 01d3ca870d - more consolidation between old and new input paths.
This also simplifies the one_eighty handling to be closer to the original idea.
2020-07-17 11:46:23 +02:00
Christoph Oelckers 7ba4e4de97 - weapon selection offloaded and cleaned up. 2020-07-16 23:32:00 +02:00
Christoph Oelckers 43c4c5eb5e - consolidated some parts common to the 3 input routines. 2020-07-16 22:49:26 +02:00
Christoph Oelckers ff9e2c3f5e - same procedure for the motorcycle - and again roughly 10% of the input code down. 2020-07-16 19:16:56 +02:00
Christoph Oelckers fca4bdcafb - split out the main movement calculation out of P_PlayerInputBoat and used the original code for providing a replacement. 2020-07-16 18:58:31 +02:00
Christoph Oelckers a066c5bc4b - make everything compile again. 2020-07-16 00:27:09 +02:00
Christoph Oelckers d139720607 - cleaned up the setup code and consolidated everything in a separate file. 2020-07-15 21:11:23 +02:00
Christoph Oelckers ea6c74d0e6 - transitioned the local input handler.
There wasn't anything EDuke32-specific in there - nearly everything mapped perfectly to JFDuke.
2020-07-15 19:48:04 +02:00
Christoph Oelckers a0cd407632 - cleanup on pausing code. 2020-07-15 18:10:31 +02:00