Commit graph

891 commits

Author SHA1 Message Date
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
c183143ec6 - SW: Clear out the local input buffer while paused like Duke does. 2020-09-06 21:57:33 +10:00
Mitchell Richters
07d4c78e1f - SW: Manually remove call to MoveScrollMode2D() in anticipation of branch automap being merged. 2020-09-06 21:55:37 +10:00
Mitchell Richters
46a12cf58a - SW: Clean up gi->GetInput() by removing some unneeded local variables. 2020-09-06 21:47:00 +10:00
Mitchell Richters
dfc3a13428 - SW: Finalise cleanup from remaining code in getinput() to processWeapopn(). 2020-09-06 21:46:26 +10:00
Mitchell Richters
e94bd9da04 - SW: Replace use of scaleAdjustmentToInterval() in lieu of backend solution from 290e615807. 2020-09-06 21:30:47 +10:00
Mitchell Richters
256e23673d - SW: Clean up all the game's scaling stuff in processMovement(). 2020-09-06 21:21:12 +10:00
Mitchell Richters
348be65399 - SW: Commence re-factoring getinput() into processMovement(), starting with top-most code. 2020-09-06 21:03:27 +10:00
Mitchell Richters
dd4251da09 - SW: Split getinput()'s input bits code into its own static function. 2020-09-06 20:52:58 +10:00
Mitchell Richters
ce160f7ac1 - SW: Split getinput()'s weapon code into its own static function. 2020-09-06 20:49:21 +10:00
Christoph Oelckers
809f8b5d4b - hooked up the new automap framework. 2020-09-06 12:44:58 +02:00
Mitchell Richters
0ef9da6a0c - SW: Make game's local input buffer static within input.cpp. 2020-09-06 20:19:29 +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
a6c92aec64 - removed all automap code from SW and the flat drawer from the backend.
This should have been the last parts of automap code.
Now on to rebuild this thing in a cleaner fashion...
2020-09-06 12:14:08 +02:00
Mitchell Richters
677efb20ba - SW: Don't check SB_RUN as player action in ChopsCheck().
Fixes #312.
2020-09-06 19:18:14 +10:00
Mitchell Richters
d73ea118df - SW: Get cl_syncinput 0 (default) working properly.
* Joystick input probably not appropriately scaled. Refactor is coming but lets just get the game workable for now.
* Fixes #328.
2020-09-06 19:17:58 +10:00
Christoph Oelckers
7dbae8b8f4 - enabled autosaves.
Fixes #55
This only creates them but does not auto-resume from them.
2020-09-05 22:39:27 +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
b54fd2f054 - fixed: Entering the menu from SW's intro may not stop the sound.
This is a singular special case, everything else must do it.
Fixes #335
2020-09-05 00:07:06 +02:00
Christoph Oelckers
b7db8b988d - SW: Ignore follow mode setting when not on the automap.
Fixes #311.
2020-09-04 22:54:11 +02:00
Christoph Oelckers
2e8b808683 - added a C_ClearMessages function for the console and fixed game restart after death.
Fixes #322
2020-09-04 22:23:38 +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
5bc80d2468 - macro cleanup 2020-09-04 21:17:24 +02:00
Christoph Oelckers
fd2ce0321e - transitioned SW to level change event system 2020-09-04 21:15:15 +02:00
Christoph Oelckers
b8d2d626ca - cleaned out some leftover network variables 2020-09-04 20:48:29 +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
8f0a885f63 - route 'give' through the network for all games. 2020-09-03 17:39:41 +02:00
Christoph Oelckers
fb334e7f1a - transitioned Blood's give command and changed SW's not to call the cheat handler. 2020-09-03 16:31:31 +02:00
Christoph Oelckers
3e5e956b72 - run most cheats through the network.
The remaining excpetions are the "give" CCMD and any level change action.
Unfortunately the implementation of most cheats is not multiplayer safe so right now it'd only be useful for demo recording (assuming that worked to begin with... ;))
2020-09-03 01:32:51 +02:00
Christoph Oelckers
a0874a26a7 - noclip cheat and splitting of Exhumed's cheat code into its own file. 2020-09-03 00:41:32 +02:00
Christoph Oelckers
66bf8113b8 - implemented the 'god' cheat as a network command.
This was mainly chosen as something simple to get the basics set up.
2020-09-03 00:29:17 +02:00
Christoph Oelckers
a222a7d7c9 - transitioned Shadow Warrior to new main loop.
Problem: Does not work yet with cl_syncinput = 0. Something about those angle and horizon settings is not right yet.
2020-09-02 20:58:37 +02:00
Christoph Oelckers
141b5c00cd - cleanup. 2020-09-02 20:58:37 +02:00
Christoph Oelckers
4d5e2f5bda - dead data removal in network.cpp and the player struct. 2020-09-02 20:58:21 +02:00
Christoph Oelckers
b3d4bab4dd - deleted sync.cpp. 2020-09-02 20:57:03 +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
e19923ce4b - removed setGameClockStart.
This won't be needed anymore.
2020-09-02 20:57:03 +02:00
Christoph Oelckers
aabbbcb2ff - reset the network timer after lengthy operations.
This includes loading a level and busy-waiting for a sound to play.
Also block these loops and the sounds they wait for in network games to avoid problems from longer delays here.
The problem seems to be directly inherited from ZDoom which shows the same issue with screen wipes.

Fixes #297
2020-09-02 10:00:07 +02:00
Mitchell Richters
253d1a3989 - SW: Re-position actortime clocking.
I believe this is the right place and I got it wrong when doing e32cd81cc7. The change in this commit is more like where Duke times actortime.
2020-09-02 09:28:41 +10:00
Christoph Oelckers
e5612b82c7 - fixed: The tile manager created its backup arrays before loading .def files.
This could let such textures disappear with the new main loop.
2020-09-02 00:36:49 +02:00
Christoph Oelckers
8d63e735d0 - transitioned Blood to the new main loop.
Mostly working but interpolation is not correct yet and for some strange reason the numbers on the HUD are gone.
2020-09-01 23:34:04 +02:00
Mitchell Richters
3f886ad818 - SW: Fix change in 1354d52c05 that accidentally caused minor loss of precision in the panel code. 2020-09-01 23:35:00 +10:00
Mitchell Richters
9605e41f9f - SW: Fix Q16.16 operation not using m_fixed inlines. The one that got away... 2020-09-01 23:28:47 +10:00
Mitchell Richters
17da849add - SW: Get synchronised input going in a testable way. This is not a complete re-factor, just enough to get it going.
* Remove bool `PedanticMode`.
* Transition appropriate lines to `cl_syncinput`.
* Remove inlines added purely only to maintain DOS demo compatibility.
* Fix a few pedantic Q16.16 >> Int >> Q16.16 conversions.
2020-09-01 23:08:23 +10:00
Mitchell Richters
1354d52c05 - Major cleanup of Q16.16 utilisation within games and engine.
* Remove fix16.h/cpp and utilise library from m_fixed.h.
* Extend m_fixed.h with two inline functions for int to/from float operations.
* Replace fix16_floor operations with those from xs_Float.h
* Replace multiple Q16.16 conversions from 0 to just be 0.
* Replaced all found in-game bit-shifts and multiplications/divisions with inline functions from m_fixed.h
* Replaced many casts of FRACUNIT as double in SW's panel.cpp as it is converted to double by way of type promotion.
* Fixed missed precision fixes in SW's panel.cpp where some types weren't declared correctly.
* Replaced 100+ `Cos()/Sin() >> 16` operations for Blood with inline functions `CosScale16()/SinScale16()`.
2020-09-01 23:00:47 +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
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
b8258da997 - cleaning out some trash from compat.h.
The header from hell...
2020-08-30 23:34:40 +02:00
Christoph Oelckers
5136e7dc2d - SW: Moved the key display on the fullscreen HUD above the ammo display.
Space is a bit too tight when activating the clip display otherwise, especially on 4:3 screens.
2020-08-30 21:01:29 +02:00
Mitchell Richters
c0374cf890 - SW: Move static function DoReloadStatus() into the class as private function 2020-08-30 20:24:38 +02:00
Mitchell Richters
26ffc82cc0 - SW: Remove duplicated code from dd832aaea3f688b375c74643606f299c76d92f3b. 2020-08-30 20:24:38 +02:00
Mitchell Richters
10962e2193 - SW: Implement cl_showmagamt for the game's shotgun and uzi.
* SW does not have any special characters in its BigFont, so currently there's no divider between ammunition amounts. This is to be discussed on the PR.
2020-08-30 20:24:37 +02:00
Mitchell Richters
e32cd81cc7 - Unify stat fps for all games. 2020-08-30 20:24:36 +02:00
Christoph Oelckers
59a964bb83 - same for SW 2020-08-30 20:24:36 +02:00
Christoph Oelckers
ffe5b114f3 - the engine starts on the new main loop and is capable of running the intros and the menu, but not the game yet. 2020-08-30 12:49:21 +02:00
Christoph Oelckers
0c455acaa2 - more work to switch over to the new loop.
Mainly separation of ticker and render calls
2020-08-30 10:42:44 +02:00
Christoph Oelckers
1e0b8038e5 - removed I_ResetTime entirely and refactored SW's use of it. 2020-08-30 08:13:34 +02:00
Christoph Oelckers
d49aedacea - continued work on main loop - added a few new entry points to the game interface. 2020-08-30 00:55:49 +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
7659107b75 - removed SW's SK_AUTO_AIM for good.
When networking becomes a thing again this can be done as a server CVAR without such a messy approach.
2020-08-29 02:19:41 +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
d73bf62465 Revert "- Set frame-time as close to the buffer swap as possible, and calculate smoothratio for Duke/SW as late as possible."
This reverts commit 97feb483ab.
2020-08-28 08:25:51 +02:00
Mitchell Richters
97feb483ab - Set frame-time as close to the buffer swap as possible, and calculate smoothratio for Duke/SW as late as possible.
* Micro-optimisation, but was getting a very occasional jitter in Duke 3D that seems to have gone with this.
2020-08-28 15:27:16 +10: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
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
c7e667a17a - transition weapon selection in SW.
Thanks to the macro insanity for trivial operations in this code base this turned out to be a lot more troublesome than Duke...
2020-08-27 00:06:59 +02:00
Mitchell Richters
55f688b13f - SW: Rename q16horz to q16horiz and q16aimvel to q16horz for consistency and to avoid confusion down the track. 2020-08-27 08:00:50 +10:00
Christoph Oelckers
4e846f8d66 - do not print game init messages to the notify display. 2020-08-26 20:19:54 +02:00
Christoph Oelckers
abf715eace - unified the packet structures of all games.
Currently the bit fields are still separate and they have to be merged, but for now the added memory does not matter.
Having this structure in the common parts will allow work on consolidating the input code, though.
2020-08-26 17:12:48 +02:00
Mitchell Richters
4fcec5f6d3 - SW: Alt implementation for preparing a nuke.
* Given the original code in `pNukeAction()` (poorly named), the intent appeared to be that the weapon should go off-screen for preparation, returning once weapon initialised.
* Commit restores that behaviour behind a CVAR.

# Conflicts:
#	source/core/gamecvars.cpp
#	source/core/gamecvars.h
2020-08-26 17:00:19 +02:00
Christoph Oelckers
b76168f673 - moved the main event processing functions into the global main loop.
Now, with all the Build timer stuff removed these calls were all identical between games.
2020-08-26 16:59:41 +02:00
Mitchell Richters
a9f556c1bd - SW: Restore random element to player's weapon left/right bobbing behind a CVAR.
# Conflicts:
#	source/core/gamecvars.cpp
#	source/core/gamecvars.h
2020-08-26 16:45:42 +02:00
Mitchell Richters
50793184ee - SW: Remove random element from player's weapon left/right bobbing causing bob value to be between 24-48 and lock to 36. 2020-08-26 16:45:42 +02:00
Christoph Oelckers
ddd6a300ab - added UpdateSounds calls to the blocking loops in Duke's and SW's StartGame functions. 2020-08-26 04:15:33 +02:00
Christoph Oelckers
cc5e6d19c3 - fixed sound updating by moving the engine's UpdateSound call into the main loop.
This needs to be called unconditionally for every frame being rendered, not all of the game modules did that.
Placing this call here ensures that it is independent of anything the games do.
2020-08-26 04:10:16 +02:00
Christoph Oelckers
de871c9ab9 - use the game timer, not the Build timer for the sound eviction delay.
This is supposed to wait for two game frames to be on the safe side.
2020-08-26 03:50:07 +02:00
Mitchell Richters
4eec9dca63 - Duke/SW: Use I_GetBuildTime() instead of gameclock in game-side sound code.
* Code is called where `gameclock` might not be set.
2020-08-26 10:09:02 +10:00
Mitchell Richters
e0aaaf1f60 - All Games: Move gameclock and lastTic to gamecontrol. 2020-08-26 09:49:44 +10:00
Mitchell Richters
76776d24d7 - All Games: Remove use of ClockTicks and replace with int. 2020-08-26 09:49:42 +10:00
Mitchell Richters
aba5c4c134 - All Games: Remove use of timerGetHiTicks(). 2020-08-26 09:49:36 +10:00
Mitchell Richters
b883204f6a - All Games: Remove remaining use of totalclock and associated timing code. 2020-08-26 09:49:34 +10:00
Mitchell Richters
76b05dbcd6 - Build (and games): Remove totalclocklock. 2020-08-26 09:48:56 +10:00
Mitchell Richters
40739d9176 - SW: Add ogameclock and use in places where ototalclock was used.
* Duke used `ototalclock` only to keep track of when the game ticked. SW uses it in the rendering code for differentials between tics so we should preserve that to prevent issues down the track.
2020-08-26 09:48:51 +10:00
Christoph Oelckers
84b6af24d3 - renamed the fields in SW's packet structure to match Duke's.
Preparation for moving the packet management into public code.
2020-08-25 22:06:01 +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
c888bc802d - SW: Make a bit more use of the calculated smooth ratio. 2020-08-25 19:51:32 +02:00
Mitchell Richters
386661f1ba - SW: Migrate to GZDoom time code like Duke. 2020-08-25 19:51:32 +02:00
Christoph Oelckers
cf36e7d770 - SW: stop cutscene sound before going to the summary screen. 2020-08-25 18:28:50 +02:00
Christoph Oelckers
7d30218d8e - fixed: In SW the automap follow mode blocked all game input, even when the automap was off. 2020-08-25 18:09:57 +02:00