Commit graph

84 commits

Author SHA1 Message Date
Mitchell Richters
5124c0daec - Amalgamate ksgn and sgn into Sgn in cmdlib.h, and remove pragmas.h. 2021-01-05 07:31:37 +11:00
Mitchell Richters
25eaeff0db - Wrap all g_gameType & GAMEFLAG_BLOOD checks into isBlood() inline. 2021-01-02 14:46:58 +11:00
Christoph Oelckers
5850c7b284 - let SyncInput return a combination of gamesetinput and cl_syncinput - also serialize gamesetinput. 2020-11-30 23:45:21 +01:00
Mitchell Richters
22f7fc93f4 - Exhumed/SW: Move code to trigger synchronised input for edge cases where its needed into gamecontrol. 2020-12-01 07:31:47 +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
32a1796728 - buildutils: Replace sintable[] use within Build with bsin()/bcos(), using bsinf()/bcosf() where appropriate.
* Includes a few header include shuffles to make it all come together.
2020-11-22 21:18:02 +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
Christoph Oelckers
1757ef2aa6 - split the game input code off gamecontrol.cpp into its own file. 2020-10-11 16:33:43 +02:00
Christoph Oelckers
8e1c71b867 Merge branch 'InputContinuation' 2020-10-11 15:24:51 +02:00
Christoph Oelckers
fc82b3bc8a - Duke: replaced the game type macros with inline functions. 2020-10-11 14:30:42 +02:00
Christoph Oelckers
fe2e96d3a6 Merge branch 'master' into InputContinuation
# Conflicts:
#	source/games/duke/src/duke3d.h
2020-10-10 21:39:27 +02:00
Christoph Oelckers
91e23b3ab5 - Exhumed: play the menu advance sound when starting a game 2020-10-10 13:30:23 +02:00
Christoph Oelckers
6ba06f5ed0 - ImageScroller WIP commit. 2020-10-08 22:20:41 +02:00
Mitchell Richters
f35bec4a5d - Fix interpolation issues and do other minor fixes following shift to fixedhoriz and binangle.
* When interpolating on the initial setup, when binangle reached an overflow point when going lower than zero, the engine was spinning the player around clockwise to the new angle (2047, for instance).
* Interpolating after casting as uint64_t with a workflow similar to the original games, the issue went away.
* Cleaned up other interpolation functions to be of a consistent workflow.
* Scale keyboard input turning down to degree speeds.
* Uplift some remaining Q16.16 code in `applylook()` to full BAM precision.
* Move static calculations of aim and look speeds for `sethorizon()` back into function since GameTicRate isn't set right before calculation is done.
* Simplify the angle target setup back to a basic value like before.
* Repair SW interpolation issues of weapon sprite drawer when rotating left/right.
* Fix SW death horizon constant values following change of horizon center to 0.
2020-10-08 21:12:21 +11:00
Mitchell Richters
9bcdeae6cd - InputPacket: Change q16avel to avel, changing type from fixed_t to float. 2020-10-08 14:47:30 +11:00
Mitchell Richters
e53d58bd42 - gamecontrol: Clean up remainder of legacy angle code. 2020-10-08 14:29:50 +11:00
Christoph Oelckers
2bb38f7d67 - get load and save game menus and related CCMDs working again. 2020-10-07 18:32:57 +02:00
Mitchell Richters
fca846272e - gamecontrol: Initial setup of PlayerAngle struct and deployment within Duke.
* Struct made up of binangle class units.
* Create signed clone of binangle for use with look_ang and rotscrnang.
* Append currently outgoing function names with `2` at the end to avoid conflict.
2020-10-07 23:13:29 +11:00
Mitchell Richters
0c55a533be - PlayerHorizon: Change struct functions to declarations and define code in gamecontrol.cpp to reduce binary size. 2020-10-07 18:25:50 +11:00
Mitchell Richters
6a30d6880e - InputPacket: Change q16horz to horz, changing type from fixed_t to float. 2020-10-07 18:22:07 +11:00
Mitchell Richters
d16b4651bb - gamecontrol: Remove old horizon code left behind while cutting over each game. 2020-10-07 18:12:09 +11:00
Mitchell Richters
6da756cc9f - Exhumed: Cut q16horiz over to PlayerHorizon struct. 2020-10-07 17:40:59 +11:00
Mitchell Richters
f39939d114 - gamecontrol: Initial setup of PlayerHorizon struct and deployment within Duke.
* Started with the most complicated game first.
* Struct made up of fixedhoriz class units.
* Append currently outgoing function names with `2` at the end to avoid conflict.
2020-10-07 17:12:48 +11:00
Mitchell Richters
082336e5f8 - buildhoriz: Implementation of pitch and BAM conversion code.
* Determined maximum horizon able to be handed by engine in Q16.16 format is 280039127.
* Re-did pitch math to work on this known maximum and standardised pitch around -90/90 degrees as it should be.
* Because pitch is now -90/90 and not ~-188/188, m_sensitivity_y probably requires re-scaling.
2020-10-07 13:29:04 +11: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
9b12675f4e - processMovement(): Re-arrange parameter variables somewhat so game-specific parameters are at the end and to allow some common defaults so they don't need specifying. 2020-09-25 22:26:50 +10:00
Mitchell Richters
73f52b2cee - SW: Fix turn scaling while pp->sop_control and specify !pp->sop to processMovement()s allowstrafe bool instead of an unconditional true. 2020-09-25 22:17:21 +10:00
Mitchell Richters
04af1d9ce8 - All Games: Unify processMovement(). 2020-09-24 22:32:37 +10:00
Mitchell Richters
d40a2d3e95 Merge branch 'back_to_basics2' into Blood_InputReworking
# Conflicts:
#	source/blood/src/hudsprites.cpp
#	source/exhumed/src/status.cpp
#	source/games/duke/src/game_misc.cpp
#	source/sw/src/draw.cpp
2020-09-22 07:34:39 +10:00
Mitchell Richters
9859571ded - DrawCrosshair(): Factor in Blood's adjustable horizon which defaults to 90.
* Fixes https://forum.zdoom.org/viewtopic.php?f=340&t=69920.
2020-09-22 07:29:52 +10:00
Mitchell Richters
59e4fae064 - Game input: Fix miscellaneous issues.
* Duke/RR: Fix `SB_CENTERVIEW` not clearing while `cl_syncinput 1`.
* Duke/RR: Remove superfluous call to `apply_seasick()`.
* RR: Change two calls from `playerSetAngle()` to `playerAddAngle()` Updated version of `playerSetAngle()` doesn't stop setting angle until target is reached, a bit too strict for this and compromised vehicle turning.
* `applylook()`: Remove dead flag. Was only used with Duke, no other game called the function when dead anyway. Since the input helpers are processed outside of `applylook()` now this is not needed.
* `applylook()`: Extend function with a bit of commentary.
2020-09-21 17:12:53 +10:00
Mitchell Richters
f806cdcec6 - Blood/Duke/RR/SW: Unify the player's angle/horizon helper functions. 2020-09-21 17:12:51 +10:00
Mitchell Richters
7bf1cacc7f - Blood/Duke/RR/SW: Unify the player's angle function.
* For Blood/SW, exposes `SB_LOOK_LEFT`/`SB_LOOK_RIGHT` to games, hooking up `q16look_ang` and `q16rotscrnang` within.
* For SW, use Duke & Blood's return to center function and remove `PF_TURN_180` bit.
* For RR, replace a few misused bits with some bools inside of `player_struct`.
* Since bulk of functionality is sourced from Duke (30Hz), apply proper scaling so SW speed matches (40Hz).
2020-09-21 17:12:26 +10:00
Mitchell Richters
0ab3b33a6c - Blood/Duke/RR/SW: Unify the player's horizon function.
* For Duke/SW, we continually apply `SB_CENTERVIEW` only if it was previously a toggled action, similar to Blood.
* For SW, we remove two SW-specific bits (`PF_LOCK_HORIZ` and `PF_LOOKING`) that are no longer needed.
* For Duke, we remove `return_to_center` and just use the `SB_CENTERVIEW` action bit as required.
* For `sethorizon()`, feature set and adjustment speeds are an averaged out accumulation across Duke/SW:
** GameTicRate is factored in for adjustment decisions to provide consistency for SW being the faster game.
** Adjustment amounts are half way between Duke/SW.
2020-09-20 20:01:36 +10:00
Mitchell Richters
1900cf1fcc - Move Duke's getincangle() function to the backend, create Q16.16 variant (getincangleq16()) and replace Shadow Warrior's discrete implementations shared versions.
* Need SW's input helpers available for Blood but therefore also need an angle delta function that does not seem to exist in Blood.
* Realise that gamecontrol.h/cpp might not be the most appropriate place, but it's a shared location and these will go into binaryangle.h when its utilisation can be more realised.
* Because SW's logic was reversed, in that param #1 was the new angle and param #2 was the current, all calls have been reversed.
* By happenstance, also fixes an issue with multiple 180° turns in quick succession.
2020-09-20 16:21:13 +10:00
Christoph Oelckers
6776508239 - widescreen asset setup and consolidation of .def file loading. 2020-09-16 19:13:06 +02: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
Christoph Oelckers
809f8b5d4b - hooked up the new automap framework. 2020-09-06 12:44:58 +02:00
Christoph Oelckers
8f6f368445 - cleaned out the remaining parts of automap handling in Duke and Exhumed. 2020-09-06 10:42:39 +02:00
Christoph Oelckers
c1a995822d - took all automap related code out of Duke's game module. 2020-09-06 10:08:47 +02:00
Christoph Oelckers
c1786001b2 - route all game state changes through game actions.
This is to avoid problems with the main loop not calling Ticker and Render in sync.
2020-09-05 15:43:34 +02:00
Christoph Oelckers
32ec9ff369 - consolidated crosshair drawing and added ZDoom's crosshair code.
For Exhumed this is the default, for the other games it is an option.
Fixes #269.
2020-09-05 13:57:26 +02:00
Christoph Oelckers
adbedd30c4 - consolidated the 4 functions for handling the automap zoom. 2020-09-05 00:58:25 +02:00
Christoph Oelckers
8114309e89 - compat.h cleanup.
* use static_assert directly. Raze is C++17, no need for that macro shit.
* removed CONSTEXPR - I seriously fail to see the use here, many of the functions marked as CONSTEXPR cannot possibly even be constant evaluated so the declaration makes no sense. Removed most of these and replaced the valid ones with the official constexpr keyword.
* got rid of EDUKE_PREDICT_FALSE - this makes zero sense in script parsing code, at best it will save a few microseconds. Clean code wins.
* replaced Blrintf with xs_CRoundToInt. Shitty name is shitty name, even if derived from POSIX.
* replaced Bstr*casecmp with str*icmp. As these get defined in the CMake project based on actual compiler checks they are preferable here.
* removed lots of other stuff that is not needed with a minimum compiler requirement of C++17.
2020-09-04 21:24:48 +02:00
Christoph Oelckers
e5e8c02f1d - WIP level transition refactored to a game independent event system. 2020-09-04 19:43:35 +02:00
Christoph Oelckers
b49e050baf - transitioned Exhumed to the new main loop.
Fixed #301
2020-09-02 22:55:57 +02:00
Christoph Oelckers
621a1e0b3d - removed the packet averaging code.
This is also part of the backend code and won't be needed here anymore.
2020-09-02 20:57:03 +02:00
Christoph Oelckers
007c6e122d - gameclock abstraction
This may need more work to have a reliable timer
2020-08-31 00:16:43 +02:00
Christoph Oelckers
2f05a93547 Merge branch 'Packet' into back_to_basics2
# Conflicts:
#	source/core/gamestruct.h
#	source/games/duke/src/gameloop.cpp
#	source/games/duke/src/player_d.cpp
2020-08-31 00:09:56 +02:00
Christoph Oelckers
3a7b23f655 remove unused stuff 2020-08-30 20:23:48 +02:00