Commit graph

590 commits

Author SHA1 Message Date
Christoph Oelckers
0a8f7e60b6 - fixed incompatibility of FindDistance3D with Shadow Warrior.
Fixes #200 and most likely many other issues as well.
2020-08-18 23:49:44 +02:00
Mitchell Richters
b03450f200 - Repair minor Duke3D regression where timerUpdateClock() was no longer called in newgame() once 7bb6b6a1ee removed `handleevents()'.
Repairs issue when starting new games and the clock isn't right (particularly noticable on E1L1 start).
2020-08-17 21:53:47 +10:00
Christoph Oelckers
7bb6b6a1ee - do not call handleEvents outside the main loop.
In other places I_GetEvent should be used to call the system's message pump and keep the app responsive, but all game side processing should be skipped.
2020-08-16 10:00:13 +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
8595b9fa47 -play SW's intro through the screen job framework. 2020-08-15 13:04:15 +02:00
Christoph Oelckers
3f9cc1412c - transitioning helper for screen jobs. 2020-08-15 10:55:21 +02:00
Christoph Oelckers
53cf248269 - added a few missing World Tour bits.
Looks like GDX missed the redefined new types of the old bosses.
Also guard the commentary sprites by a CVAR.
2020-08-15 10:25:30 +02:00
Christoph Oelckers
ff38cfe179 - open the in-game menu only when really inside a game and actually playing.
Fixes #182
This isn't foolproof but it's probably the best that can be done.
2020-08-14 22:41:32 +02:00
Christoph Oelckers
2403e8cb2c - fixed RRRA summary screens. 2020-08-14 22:31:54 +02:00
Christoph Oelckers
37ea207d5a - fixed another one of those stupidly badly designed iterator loops.
Fixes #176.
2020-08-14 21:49:12 +02:00
Christoph Oelckers
52ddac21b0 - fixed RR's transition to its final map. 2020-08-14 21:30:09 +02:00
Christoph Oelckers
3455610031 - base palette cleanup.
Avoid passing this anywhere in the client code. It should only be set right before rendering the 3D view and the only code using the base palette should be the 3D renderer and hud_drawsprite.
Also make the palette override CVARs 3D view only in debug mode.
2020-08-14 21:18:14 +02:00
Christoph Oelckers
66cb7f61a4 - fixed rendering on narrow screens with an aspect ratio less than 4:3 and removed some parts that are no longer needed. 2020-08-14 21:01:27 +02:00
Christoph Oelckers
9c40c2f6af - don't draw screenblends when not in a 3D view.
Fixed #174.
2020-08-12 22:52:41 +02:00
Christoph Oelckers
80d1b71899 - fixed sounds disappearing when the owning actor was deleted.
These sounds now get unlinked so that they can play out normally.

Fixes #119.
2020-08-12 20:15:02 +02:00
Christoph Oelckers
cbfa8abd34 - fixed some messed up conditionals in RR's switch code.
Fixes #166
2020-08-12 00:31:04 +02:00
Christoph Oelckers
4c01f1e073 - don't count chickens as kill.
Fixes #160.
2020-08-11 21:42:41 +02:00
Mitchell Richters
e083f78f8e - stop Duke screaming while falling if player puts the jet pack on.
No need to keep screaming if the player has saved themselves.
2020-08-11 15:40:02 +02:00
Christoph Oelckers
6a10a7f266 - changed the rules for dimming the menu to be more clear
It will no longer depend on the game state when the menu was opened but the current game state - only on the dedicated menu screen there's no dimming - everywhere else a dim gets applied.

Also renamed GS_DEMOSCREEN to GS_MENUSCREEN for clarity
2020-08-11 00:46:27 +02:00
Christoph Oelckers
000c00dc91 - block game input during intro cutscenes
Fixes #158
2020-08-11 00:42:08 +02:00
Christoph Oelckers
ca740ad709 - increase volume for summary screen's speeches in Duke.
Fixes #125
2020-08-10 20:59:04 +02:00
Mitchell Richters
a3a7a8f6be - repeat of cf548e055e for RR. 2020-08-09 16:41:42 +10:00
Mitchell Richters
fb6a58904a - Set glcycle_t class as active when stat fps is active.
Fixes #122.
2020-08-09 16:39:15 +10:00
Mitchell Richters
cf548e055e - clamp player sprite's xvel between 0 and 512 to stop it going into the negative with rapid posx/posy changes due to teleporting.
* With steroids and a controller (controllers have a slightly higher max fvel/svel than a keyboard), I could not get xvel to exceed 503.
* Fixes #123.
2020-08-09 16:24:48 +10:00
Christoph Oelckers
d731bf4e57 - fixed typo in floor damage check.
This rendered the boots ineffective on lava.
Fixes #114
2020-08-07 23:30:08 +02:00
Christoph Oelckers
dfa3519ebc - stop screaming sound when landing.
Fixes #116
2020-08-07 22:20:29 +02:00
Christoph Oelckers
596367f10f - Screenblend fixes. 2020-08-07 22:00:43 +02:00
Christoph Oelckers
f8c65839f0 - fixed broken jumping.
This was a nasty, but typical case for Duke where a variable did not contain what the name said and was carried along way too much code.

Fixes #112
2020-08-07 21:59:11 +02:00
Christoph Oelckers
4b69a181c3 - use symbolic constants for some statnums 2020-08-06 20:54:51 +02:00
Christoph Oelckers
4cfeb9b2cc - fixed bouncing flame in VACA2.
Taking a hint from EDuke32 here.
2020-08-06 20:54:02 +02:00
Mitchell Richters
47dbc46213 - fixed the interpolation issues while on a crane.
* Partially addresses issues discussed in #105 and #106.
2020-08-06 15:39:45 +10:00
Mitchell Richters
bbe05b0c81 - harden FinalizeInput() with else blocks on each if statement after checking whether all movement is blocked.
Fixes #105.
2020-08-06 07:25:04 +10:00
Christoph Oelckers
3e8ff96e6b - added workaround for DukeDC's ending cutscene which was abusing undefined behavior in the original code. 2020-08-05 22:57:45 +02:00
Christoph Oelckers
514c029e47 - this wasn't supposed to get committed. 2020-08-05 22:40:47 +02:00
Christoph Oelckers
a30933871e - fixed most end of game cutscenes. 2020-08-05 22:36:39 +02:00
Christoph Oelckers
ba3c353198 - use the correct code for the devastator in operateweapon.
The code present was from EDuke 2.1, I have no idea if it ever worked there. It was replaced with JFDuke's.
Fixes #104.
2020-08-05 22:36:38 +02:00
Christoph Oelckers
4a0e155637 - fixed starting of bonus screen music.
It must not be done in the constructor of the screen but when actually playing the first frame.
2020-08-05 22:36:38 +02:00
Mitchell Richters
ddd30e742c - ensure player's angle input while playing with cl_syncinput 0 is scaled appropriately when sector's lotag is ST_2_UNDERWATER. 2020-08-05 22:57:47 +10:00
Mitchell Richters
d1a68421bd - fix cl_weaponsway for Duke. 2020-08-05 20:04:14 +10:00
Mitchell Richters
2919cdcb44 - clamp the calculated horizAngle to -180/180 to stop overflowing if player moves the mouse stupidly quick while cl_syncinput 1 is set. 2020-08-05 19:56:49 +10:00
Mitchell Richters
03bccb3a06 - functionalise significant portions of 0ee3ab4df8. 2020-08-05 19:24:42 +10:00
Mitchell Richters
0142449d95 - clamp angle velocity as originally intended. 2020-08-05 17:59:46 +10:00
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
65428a2d1a - revert ea98978ae7 and baed75ff8a, and do in a more compatible way with synchronised and unsychronised input. 2020-08-05 17:43:14 +10:00
Mitchell Richters
bb0129c331 - add missed savegame addition when doing 9f8d50c0a1. 2020-08-05 17:39:02 +10:00
Mitchell Richters
9f8d50c0a1 - add horizAdjust after processing pitch adjustments and call sethorizon() in processinput_d() after dokneeattack().
Fixes #101.
2020-08-05 14:23:07 +10:00
Christoph Oelckers
454e0e36c9 - added a sound for advancing multi-screen menus.
Fixes #100.
2020-08-05 00:32:29 +02:00
Christoph Oelckers
f363aca1b7 - fixed the crane in Duke3D.
Fixes #92
2020-08-05 00:28:14 +02:00
Mitchell Richters
157933e902 - fixed regression from b9eef9c6a3 where the angle wouldn't apply if horizon was specified. 2020-08-04 23:13:22 +10:00
Mitchell Richters
b9eef9c6a3 - make ang and horiz optional on each game's warptocoords CCMD as suggested in commentary for 1dc6edfa56. 2020-08-04 22:33:17 +10:00
Mitchell Richters
24d847f4ec - create Duke dynamic CCMD warptocoords. 2020-08-04 18:04:02 +10:00
Mitchell Richters
2bdf5f38e5 - remove code meant to have been deleted when performing e474ebc2b7. Makes processinput_r() match processinput_d(). 2020-08-04 17:13:28 +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
Christoph Oelckers
d526c6401f - use the generic cheat system for Blood. 2020-08-03 20:51:31 +02:00
Christoph Oelckers
35a5c4e23c - undid hardcoded coupling of Mapinfo slots with episode/level pairs in Blood.
This both lifts the imposed limit of 16 levels and will allow dynamic management of global mapinfo data.
2020-08-03 20:11:30 +02:00
Christoph Oelckers
d87f0dc0b0 - uninitialized variable fixed 2020-08-03 20:07:23 +02:00
Mitchell Richters
7493d4e334 - remove unused getters from player_struct. 2020-08-03 23:01:53 +10:00
Mitchell Richters
aead65183c - draw the crosshair using getHalfLookAng() inline function, making use of its double precision and optionally interpolated result. 2020-08-03 22:56:43 +10:00
Mitchell Richters
d3d9bb0823 - partially revert 19e4393a4f by adding the player's mouse input after calculating the true pitch of p->q16horiz.
* Need to add `p->horizAdjust` in with `p->q16horiz` because the values passed to that variable are the same as what would have been directly added to `p->q16horiz` in `processinput()`.
* Leaving mouse input to apply after calculating the pitch lets us take advantage of the calculated pitch's accuracy to provide consistent mouse input across the pitch's range.
2020-08-03 22:39:09 +10:00
Mitchell Richters
1556e80dd2 - apply same RR horizon workaround from e474ebc2b7 for when cl_syncinput 1 is set for angle as well. 2020-08-03 22:31:44 +10:00
Mitchell Richters
19e4393a4f - add all the horizon values before converting into true pitch inside sethorizon(). 2020-08-03 22:13:10 +10:00
Mitchell Richters
573cb363ae - add new weapon interpolation variable from player_struct into savegame code. 2020-08-03 21:26:28 +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
d9fab07c31 - interpolate p->hard_landing for RR. 2020-08-03 17:27:09 +10:00
Mitchell Richters
c600295c93 - apply same fix from c63564eb7a for returning interpolated value for the player's q16horiz - q16horizoff if cl_syncinput is true.
* Also changed `gethalflookang()` to camel case `getHalfLookAng()` for easier reading.
* Also broke a very long if statement down into smaller chunks for readability.
2020-08-03 17:06:28 +10:00
Mitchell Richters
c63564eb7a - replace lookanghalf() player_struct getter with inline that can accept cl_syncinput as a bool for whether to return an interpolated calculation or not.
New HUD was being let down by using an uninterpolated `q16look_ang` regardless of whether `cl_syncinput` was true.
2020-08-03 16:27:14 +10:00
Mitchell Richters
6bd050e201 - fix some interpolation harshness with p->weapon_pos. 2020-08-03 15:06:25 +10:00
Mitchell Richters
7efa905a01 - fix some interpolation harshness with p->kickback_pic. 2020-08-03 15:06:25 +10:00
Mitchell Richters
531df48d38 - interpolate p->hard_landing for Duke 3D. 2020-08-03 15:06:25 +10:00
Mitchell Richters
43ff42b330 - interpolate p->random_club_frame for Duke 3D. 2020-08-03 15:06:25 +10:00
Mitchell Richters
038039eb3f - interpolate p->kickback_pic for Duke 3D. 2020-08-03 15:06:25 +10:00
Mitchell Richters
8cc4b5062a Revert "- remove duplicate line.". In hindsight, I believe this was by design.
This reverts commit 6fd6926d8d.
2020-08-03 15:06:25 +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
11a10c1d87 - change calc_smoothratio() inline function from int to double that was missed in 0c12436092. 2020-08-03 11:57:39 +10:00
Mitchell Richters
034d6e129a - always calculate smoothratio while paused, but only return it during play. This is so the time keeps elapsing and you don't get a large delta between the first call back to CalcSmoothRatio() after the previous call. 2020-08-03 11:54:59 +10:00
Mitchell Richters
5792a2389a - consistency cleanup with a use of calcSinTableView() use within hudweapon_d.cpp. 2020-08-03 11:07:55 +10:00
Mitchell Richters
80291f9cb7 - For RR, pass vehicle TiltStatus through to backend as the double that it is. 2020-08-03 11:06:23 +10:00
Mitchell Richters
8526bd6a17 - interpolate weapon HUD for RR and make full use of calcSinTableValue()'s double precision. 2020-08-03 11:05:41 +10:00
Mitchell Richters
70794df76c - remove bitwise & operations on calls to calcSinTableValue() since they're no longer necessary, and remove last use of sintable[] from hudweapon_d.cpp. 2020-08-03 09:19:14 +10:00
Christoph Oelckers
d083e12967 - added the "back" sound to the menu. 2020-08-02 22:14:58 +02:00
Christoph Oelckers
8acc4101be - simplified calcSinTableValue and inlined it.
There's no need for all this magic voodoo - the sin function already returns the proper values all by itself.
2020-08-02 22:03:22 +02:00
Christoph Oelckers
9606601554 - wraooed "q16look_ang / (2. * FRACUNIT)" in an inline function.
No need to write it out each time, this wpuld be a nightmare if it ever had to be refactored.
2020-08-02 21:45:57 +02:00
Mitchell Richters
0bcb37860a - interpolate p->weapon_pos for smooth switching of weapons. 2020-08-02 21:20:54 +02:00
Mitchell Richters
85dcffc442 - use new fmulscale16() static inline for high precision interpolation in place of manual code. 2020-08-02 21:20:54 +02:00
Mitchell Richters
9c8593018b - define new function calcSinTableValue() to calculate an equivalent sintable[] entry.
* Returns a true double result.
* Also supports fractional input for fractional input. That is, if `sintable[1]` = 50 and `sintable[2]` = 100, `calcSinTableValue(1.5)` = 75.
* Increased precision of `BANG2RAD` define to use double and not float.
* As such, revert addition of `sintablef[]`.
2020-08-02 21:20:54 +02:00
Mitchell Richters
abb23a7bd0 - fix remaining interpolation issue with weapon swaying when taking off again from a stand-still. 2020-08-02 21:20:53 +02:00
Mitchell Richters
6fd6926d8d - remove duplicate line. 2020-08-02 21:20:53 +02:00
Mitchell Richters
11b3f5a78a - increase precision of local variable x for displaypistol(). 2020-08-02 21:20:53 +02:00
Mitchell Richters
184465460e - make full use of sintablef[2048]. 2020-08-02 21:20:53 +02:00
Mitchell Richters
977ddc5aa8 - make full use of Q16.16 resolution for player's angle and horizon values. 2020-08-02 21:20:52 +02:00
Mitchell Richters
3a4a224877 - interpolate p->weapon_sway. 2020-08-02 21:20:52 +02:00
Mitchell Richters
4499e05b06 - pass smoothratio through to displayweapon(). 2020-08-02 21:20:52 +02:00
Mitchell Richters
0c12436092 - change returned value for CalcSmoothRatio() from int to double and pass through to displayrest() for future use with displayweapon().
* `displayrooms()` ultimately should be adjusted as well. For now, just relying on integer truncation as this is just a proof of concept.

# Conflicts:
#	source/core/gamecontrol.cpp
#	source/core/gamecontrol.h
2020-08-02 21:20:52 +02:00
Mitchell Richters
0aca26e197 - determine smoothRatio immediately after a potential change to ototalclock has occurred. 2020-08-02 20:57:08 +02:00
Mitchell Richters
1cf857e788 - create an enum for MaxSmoothRatio and replace multiple hard-coded uses of '65536' constant. 2020-08-02 20:57:08 +02:00