Commit graph

54 commits

Author SHA1 Message Date
Mitchell Richters
6894be4ad1 - Use the new isSWALL() wrapper everywhere. 2021-07-11 12:40:01 +10:00
Mitchell Richters
c076310e34 - 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.
* Fixes #287.
2021-04-01 13:46:16 +11:00
Christoph Oelckers
99f1f0952a - little bit of engine cleanup. 2021-02-25 12:16:21 +01:00
Mitchell Richters
25eaeff0db - Wrap all g_gameType & GAMEFLAG_BLOOD checks into isBlood() inline. 2021-01-02 14:46:58 +11:00
Mitchell Richters
4aae71f0ee - InputState::ClearAllInput(): Call resetTurnHeldAmt() when clearing input. 2021-01-02 10:00:29 +11:00
Christoph Oelckers
ae36ea88c3 - wrap all checks of cl_syncinput in an inline function. 2020-11-30 23:40:16 +01:00
Christoph Oelckers
ed8266df0b - fixed bad args check in WarpToCoords CCMD. 2020-11-29 16:06:15 +01:00
Christoph Oelckers
a34f5debe8 - route the shared control CCMDs through the game interface instead of registering local variants for each game. 2020-11-29 13:35:09 +01:00
Mitchell Richters
f9f365a593 - Ensure crouch_toggle bool from 6e3d414b3c is serialised when saving game, and cleared when InputState::ClearAllInput() is called. 2020-11-08 07:30:48 +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
c9708a5464 - CONTROL_GetInput(): Reverse polarity of dx/dz and update processMovement() appropriately. 2020-11-07 09:56:57 +11:00
Mitchell Richters
44e4c5ff78 - Fix joystick scaling following shift to fixedhoriz and binangle.
* Remove joystick scaling from `CONTROL_GetInput()`.
* Store turnspeed as constant at top of `processMovement()` and use it for joystick yaw/pitch scaling. This adds the advantage of having the out-of-box turning speed match the keyboard's turn speed and also attenuates when the player is not running.
2020-10-09 11:34:14 +11:00
Mitchell Richters
babd7b9556 - InputState: Proposed new sensitivity dividers now that mouse input is based on true pitch and true angle. 2020-10-07 23:25:36 +11:00
Christoph Oelckers
a558703740 - bumped up the vertical mouse movement factor to 1/5 from 1/8.
1/8 was far too low for an average mouse
2020-09-29 18:14:22 +02:00
Mitchell Richters
0bb9904338 - Tune mouse input following changes in b57e13ff62.
* Reduce `hidInput->mouseturny` to previous scaling (0.25 of incoming input).
* Change `hidInput->mouseturnx` to be 0.5 of incoming input (33% slower than b57e13ff62, but matches what other ports by providing a 2:1 scale).
* Remove further divisions beyond m_side and m_forward and adjust code in `processMovement()` accordingly.
* Change scaling for `mousevelscale` in `processMovement()` to be 1/160th of keymove. Slightly lower for Duke and a lot faster for Blood where it's needed.
2020-09-29 21:02:36 +10:00
Christoph Oelckers
b57e13ff62 - mouse code update.
May still need some tweaking of the factors.
2020-09-28 22:36:43 +02:00
Mitchell Richters
71d667cdc9 - ApplyGlobalInput(): Fix const issue. 2020-09-25 13:33:44 +10:00
Mitchell Richters
aa14ee1232 - InputState: Scale dyaw/dpitch with regards to ticrate. All testing on initial uplift was with Duke at 30Hz. SW running at 40Hz therefore is not at the same speed as the others. 2020-09-25 00:25:49 +10:00
Christoph Oelckers
d74d65bece - clear the 2D drawers in the correct place. 2020-09-15 21:52:02 +02:00
Christoph Oelckers
38cc094ac3 - adapt ClearAllInput to new globalized code. 2020-09-10 23:35:42 +02:00
Mitchell Richters
fa9fa88fce Merge branch 'back_to_basics2' into InputStuffs
# Conflicts:
#	source/core/gamestruct.h
#	source/games/duke/src/duke3d.h
#	source/sw/src/input.cpp
#	source/sw/src/player.cpp
2020-09-07 07:51:37 +10:00
Christoph Oelckers
18b39fd952 - first stage of generic automap code.
Lines and textures get rendered, not all colors are correct - sprites yet to do...
2020-09-06 20:49:43 +02:00
Mitchell Richters
290e615807 - Move Duke's input scaling for unsynchronised input to backend as InputScale(). 2020-09-06 20:19:26 +10:00
Mitchell Richters
722537a1f0 - InputState: Make CONTROL_GetInput() return an object instead of accepting a pointer and provide to games as a function parameter.
* Provide read-only/const results from `CONTROL_GetInput()` so games can't change received input.
* Change non-descript `info` to `hidInput` (Human Interface Device).
* Remove a few unused prototypes.
2020-09-06 20:18:26 +10:00
Christoph Oelckers
3204a3e5fc - negated the meaning of SB_AIMMODE.
This is because 'classic' aim mode will reset the view if the mouseaim key is not pressed.
The problem with this is that an empty input packet will trigger a view reset. If the meaning is inverted the default aim mode is free mouse view which doesn't try to alter any view state and is therefore preferable for an empty packet.

Fixes #292
2020-08-31 20:51:22 +02:00
Christoph Oelckers
765f211e05 - things are mostly working again.
Rendering produces an image again, input gets properly processed, but unsynchronised mouse input isn't properly applied yet.
2020-08-30 19:59:46 +02:00
Christoph Oelckers
367b4ce051 - this should be all we need from GZDoom to hook up the main loop. 2020-08-30 09:32:34 +02:00
Christoph Oelckers
e3839b01bc - removed in_mousesmoothing.
This not only was redundant with m_filter, even worse, it was in the wrong place.
Control_GetInput is used to read the current input state from the backend and can get called at uneven intervals, or even multiple times during the same frame, so smoothing the movement here can lead to erratic behavior.
With this change CONTROL_GetInput will return the same data unless it gets updated between calls.
2020-08-29 18:37:22 +02:00
Christoph Oelckers
56d0647412 - migrated the last 3 remaining UI controls to CCMDs. 2020-08-29 17:49:15 +02:00
Christoph Oelckers
694444b62a - converted the remaining input bits.
Looks like it is working in all games except Blood (not that it surprises me that it's Blood again which has issues...)
2020-08-29 13:32:55 +02:00
Christoph Oelckers
dc1f56e8f9 Merge remote-tracking branch 'remotes/Github_private/back_to_basics2' into Packet
# Conflicts:
#	source/core/inputstate.cpp
#	source/exhumed/src/exhumed.h
2020-08-29 01:19:48 +02:00
Christoph Oelckers
fe7f3a2f9e - handle the run key. 2020-08-29 00:57:07 +02:00
Christoph Oelckers
b9e0f493b2 - transitioned the 5 primary action keys: Open, Jump, Crouch and Fire/AltFire. 2020-08-28 23:25:08 +02:00
Christoph Oelckers
847fa48724 - cleaned out the remaining parts of baselayer.h
In particular this means to remove the option to disable widescreen aspect ratios. The way this was handled makes no sense with the current render backend.

The aspect ratio code will have to be redone entirely to properly obey the backend's settings.
2020-08-28 09:06:49 +02:00
Christoph Oelckers
d62d2eaec7 - processed all remaining local input CCMDs and removed some bits only needed for multiplayer.
These MP bits should be reimplemented as network commands later, they only take up valuable space in the bit field.
2020-08-28 00:03:35 +02:00
Christoph Oelckers
ee7d558282 - removed the remains of sending pause with the input packets.
None of this was really working anymore, but will have to be rethought once a network stream exists again.
But even then, this is better sent as a separate command, and in MP only.
2020-08-27 22:38:52 +02:00
Christoph Oelckers
447573aa36 - consolidation of invprev, invnext and invuse. 2020-08-27 22:19:24 +02:00
Christoph Oelckers
43de0d8312 - consolidation of inventory item activation through hotkeys.
This also adds hotkeys for Exhumed which never implemented them.
2020-08-27 21:25:09 +02:00
Mitchell Richters
8bb13bc4c2 - InputState: Exclude volume keys from setting AnyKeyStatus to true. 2020-08-27 13:05:05 +02:00
Christoph Oelckers
10df3e094a - rework of weapon input to use common features in shared code.
This also adds stubs for all unimplemented features in the games for easier addition.
2020-08-27 00:53:35 +02:00
Christoph Oelckers
f597f7c265 - made the GameFunc constants global again.
With most of the more specific features being migrated to CCMDs the list is relatively clean now, with merely 2 buttons that are game specific.
2020-08-27 00:25:59 +02:00
Christoph Oelckers
8256b54005 - applied a few fixes:
* removed the timer callback stuff that came back through the backdoor.
* do not use gameclock in the UI code - use the underlying timer directly.
* UpdateSounds must still use totalclock, until this can be refactored in its entirety.
2020-08-25 20:20:35 +02:00
Mitchell Richters
d3b506eb2b - Duke (and Engine): Eliminate use of totalclock for game.
* Breaks every other game except Duke unless/until they get migrated. Done for the purpose of demonstrating PR #244.

# Conflicts:
#	source/build/src/timer.cpp
#	source/games/duke/src/game.cpp
2020-08-25 19:51:12 +02:00
Christoph Oelckers
76811a1881 - InputState cleanup
This removes most of the InputState class because it is no longer used.
The only remaining places still checking scan codes are the modifiers for sizeup and sizedown.
All the rest was remapped to safer methods. The multiplayer taunts are currently inoperable, they will need support of shift-bindings to get proper support.
2020-08-24 20:34:18 +02:00
Christoph Oelckers
b88a279a57 - removed the mouse wheel up event hackery
With the weapon cycling commands being done as CCMDs this is no longer needed.
2020-08-24 20:26:32 +02:00
Christoph Oelckers
ef78e8602a - major cleanup and consolidation of the screen/hud resizing code.
This is now being handled by the backend, except for the processing of the key bindings which cannot be done yet.
2020-08-16 02:55:50 +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
a0cd407632 - cleanup on pausing code. 2020-07-15 18:10:31 +02:00
Mitchell Richters
c70cc474a0 - change mouse input from int to float and adjust games accordingly.
* Calculate game-side mousex/mousey divisions into the calculations performed in `InputState::GetMouseDelta()`.
* Fix mouse speed when `in_mousesmoothing` is true (wasn't factoring in / 3.f division used in non-true vector.
* Standard mouse forward/side movement speeds in Exhumed & SW with that of other games.
* Remove `strafeyaw` code from Duke/Exhumed/RR as it's not necessary and was leading to situations where the player would continually keep moving sideways even without input.
* Change mouse forward/side velocities to -= current value as is done with controller input and the player's angle/aim velocities.
2020-07-04 18:28:00 +02:00
Mitchell Richters
8c723f52d1 - make controller input identical across all games.
* Convert axes in ControlInfo struct from int32_t to float as what's received from the backend.
* Remove all the scale up/down math since we don't need that with floats and replace with float constants that match old behaviour.
* Store q16mlook scaling as a constant for use with mouse and upcoming controller code.
* Add required controller code to Blood as the only game not to have working controllers.
* Fix typos in (gInput.forward > input.forward) for `ctrlGetInput()` in Blood.
* Remove use of `scaleAdjustmentToInterval()` on Exhumed and Shadow Warrior as they only process forward/side velocities within the game's ticrate.
* Repair angvel/aimvel scaling mistakes from d79a5d256d.
* Scale dyaw and dpitch by 25% for Shadow Warrior as the game runs 25% faster than the other games, leading to faster input.
2020-06-24 20:08:56 +02:00