Commit Graph

626 Commits

Author SHA1 Message Date
Christoph Oelckers 8d3199514d - removed some 'pragma' cruft. 2020-05-23 13:08:10 +02:00
Christoph Oelckers 8bd5f12b42 - matching sound backend code with GZDoom.
# Conflicts:
#	source/core/sound/s_soundinternal.h
2020-05-23 12:59:11 +02:00
Christoph Oelckers 6a8efb7520 - update of music code, in particular separating the engine-specific lookup from the backend.
# Conflicts:
#	source/core/music/music.cpp

# Conflicts:
#	source/build/src/palette.cpp
2020-05-23 12:37:47 +02:00
Christoph Oelckers d0406e27b6 - all base palette data has been transitioned to GPalette. 2020-05-23 12:31:05 +02:00
Christoph Oelckers 6f9ee4b60f - store palettes in the palette container. 2020-05-23 12:31:05 +02:00
NY00123 cf22b4da0a sw/src/demo.cpp:DemoPlayBack: Add a call to timerUpdateClock, which
is now required. Previously, it would be called from faketimerhandler,
which in turn is called from the engine.
2020-05-22 23:41:13 +02:00
NY00123 a69f738287 sw/src/copysect.cpp: Temporarily disable interpolation of sector object
if any of its sectors is impacted by CopySectorWalls. Fixes
a possible flicker with the drill at the end of level 2.
2020-05-22 23:41:11 +02:00
NY00123 ccf6722b70 SW: Don't interpolate a sector object if the corresponding lasttic value is 0 2020-05-22 23:41:10 +02:00
NY00123 37c3f1cc46 SW: Add the macro SO_EMPTY and use it instead of
separate checks of the form sop->xmid == INT32_MAX
2020-05-22 23:41:09 +02:00
NY00123 d510b9b95a sw/src/sync.cpp:SOSync: Remove commented out code 2020-05-22 23:41:08 +02:00
NY00123 d43bffd118 SW: Remove unused DoubleInitAWE32 variable 2020-05-22 23:41:07 +02:00
NY00123 f94b38b138 SW: Modify getinput to update oq16ang/oq16horiz with the same amount
of change that camq16ang/camq16horiz gets. Such an update is possible
after making sure that UpdateInputs (faketimerhandler) is
never called from domovethings.

# Conflicts:
#	source/sw/src/game.cpp
2020-05-22 23:41:05 +02:00
NY00123 6b5cf9525b sw/src/network.cpp: Remove from UpdateInputs the checks of totalclock
and ready2send and the call to timerUpdateClock, which are now done
before calling UpdateInputs itself from RunLevel.

# Conflicts:
#	source/sw/src/network.cpp
2020-05-22 23:40:00 +02:00
NY00123 ae2bcdd1a6 Rename faketimerhandler -> UpdateInputs and keep an empty
faketimerhandler stub in SW. This basically deprecates
the usage of faketimerhandler in the game.
2020-05-22 23:39:45 +02:00
NY00123 6daf42a959 sw/src/game.cpp:RunLevel: Call faketimerhandler in a loop, based on code
from EDuke32-OldMP. Main difference from EDuke32-OldMP is that this is
done even while staying in the menu; Behaviors will otherwise break.
We should also call timerUpdateClock() before the loop, especially
after removing the call to this function from faketimerhandler soon.
2020-05-22 23:39:43 +02:00
NY00123 25b5d69cab SW: Remove commented out code accessing non-existing variable
# Conflicts:
#	source/sw/src/network.cpp
2020-05-22 23:39:42 +02:00
NY00123 7e2484f603 SW: Remove FAKETIMERHANDLER and calls to faketimerhandler via this macro
# Conflicts:
#	source/sw/src/sprite.cpp
2020-05-22 23:39:28 +02:00
NY00123 916cd01550 SW: While not exactly a favorite of mine, this fixes the floorz updates
of the secret rotating pillar in level 1 with SO interpolation.
The drill in level 2 is also covered. So far, SetVatorActive seems
to be the only place where interpolation of ceiling/floorz
may be set, outside of the SO interpolation code.
2020-05-22 23:39:12 +02:00
Christoph Oelckers f53b348782 - stop the railgun's active sound if another weapon is selected. 2020-05-22 23:02:25 +02:00
Evan Ramos 71dc4ff5a4 SW: Fail gracefully from WarpToArea instead of aborting 2020-05-22 18:29:21 +02:00
Evan Ramos f318d2282a SW: Clear the background during cinematics
# Conflicts:
#	source/sw/src/anim.cpp
2020-05-22 18:29:20 +02:00
Mitchell Richters d98813f00f SW: Allow sector object interpolations to be disabled for debugging.
New code is causing some issues. Upstream allow it to be toggled, so let's do that also.
2020-05-22 16:43:34 +02:00
Mitchell Richters 45cc95401f SW: Make game compile after upstream backports. 2020-05-21 18:47:37 +02:00
Evan Ramos 0ab81904c2 SW: Allow Strafe Left and Right to turn vehicles 2020-05-21 18:47:37 +02:00
Evan Ramos 9d11c7dfb1 SW: Add FOV support. 2020-05-21 18:47:37 +02:00
Evan Ramos edccdccfb4 SW: Fall back gracefully if map mirror tags are not fully correct 2020-05-21 18:47:37 +02:00
Evan Ramos e6dd2741f3 SW: Instrument Saveables with debug_break 2020-05-21 18:47:37 +02:00
Evan Ramos 9eefd3d892 SW: Add PanelSpriteFunc values to saveables 2020-05-21 18:47:37 +02:00
NY00123 024d4e7297 SW: Afraid that we should disable almost all kinds of SOs in multiplayer
for now, due to possible jitters. Currently leaving remote-controlled SOs.
2020-05-21 18:47:37 +02:00
NY00123 ab99b3b79d SW: Call FunctionKeys from getinput only if the latter is called
from faketimerhandler. This should fix the timing of playing an
RTS file's sound and sending the corresponding message.
2020-05-21 18:47:37 +02:00
NY00123 75c76f073a SW: Fix aiming in coop view 2020-05-21 18:47:37 +02:00
NY00123 5baba6b9f3 SW: Don't interpolate a non-remote sector object controlled
by the player. Make sure looking up/down is still smooth.
2020-05-21 18:47:37 +02:00
NY00123 bdacab366a SW: Disable interpolation of sector objects that
don't move as smooth as possible in multiplayer
2020-05-21 18:47:37 +02:00
NY00123 f3654d80e7 Store sector object interpolation data in saved game 2020-05-21 18:47:37 +02:00
NY00123 27675d9f4f Remove the preceding sprite interpolation functions, not needed anymore 2020-05-21 18:47:37 +02:00
NY00123 221172311c SW: Let's make use of interpso.*. Still need to do a few more things. 2020-05-21 18:47:37 +02:00
NY00123 2b1e32bf3d SW: Add the currently-unused interpso.* files, enabling interpolation
of sector objects as whole groups of points and sprite angles.

The following goals are intended to be achieved with this code:
- Make it easy to let the user toggle sector object interpolation.
- Interpolate the angles of sprites carried by sector objects.
- Use the right amount of samples for interpolating a sector object,
depending on the players' locations, as done in the checks within
DoSector. Unfortunately, modifying DoSector itself to
unconditionally call MoveSectorObjects(sop, synctics) technically
changes the way sectors move (in the logical sense), and was
found out to make a specifically constructed user map unbeatable.
- Make it easy to disable interpolation of a whole sector object in
case of a need. This is especially important if such an object
is controlled by a player in multiplayer, mostly since this
isn't compatible with the way player prediction is working.
2020-05-21 18:47:37 +02:00
NY00123 f6a5572775 SW: Add the currently unused InterpolateSO option.
A known issue, which also applies to existing settings like the voxel
toggle, is that its value gets written to the saved game, and when such
a game is loaded, the its value gets overwritten by the one in the
saved game. Options should move to settings.cfg later, anyway.
2020-05-21 18:47:37 +02:00
NY00123 890a737152 SW: Add the oangdiff field to USER struct as suggested by Hendricks,
and use it in MovePoints. This will be used for interpolating
the angles of sprites carried by SOs soon.
2020-05-21 18:47:37 +02:00
NY00123 d467ce3eb8 SW: Interpolate the player's bob_z, based on suggestion by Striker.
Using pp instead of ppp seems to work better with prediction.
2020-05-21 18:47:37 +02:00
NY00123 10e4c3e121 sw/src/draw.cpp: Import from Duke3D the Polymost shadow drawing hacks 2020-05-21 18:47:37 +02:00
NY00123 33043b3b05 sw/src/network.cpp: Fix waitforeverybody in Master/Slave
modes. This uses SVN r1135 and r1143 as a reference.
2020-05-21 18:47:37 +02:00
NY00123 dea7c83361 sw/src/network.cpp: Fix sending of messages in Master/Slave.
Thanks Dynamo for spotting the bug.
2020-05-21 18:47:37 +02:00
NY00123 63743eea67 sw/src/draw.cpp:analyzesprites: Interpolate other players' sprites, in a
similar manner to what's done in Duke3D (with the addition of the angle).

There seem to be some jitters with this, mostly in Master/Slave mode.
Decreasing PAKRATE in mmulti.cpp might also increase the frequency
of this occuring in Peer-2-Peer mode.
2020-05-21 18:47:37 +02:00
NY00123 5a6dd2224f sw/src/jsector.cpp:JS_DrawCameras: Make camera oscilation
less dependent on the frame rate.
It would probably be better to update this from the game loop side,
like in Duke3D, but it's still better than the preceding situation.
2020-05-21 18:47:37 +02:00
Mitchell Richters 471f0df69d SW: Q16.16 refinements in DoPlayerDeathFollowKiller. 2020-05-21 18:47:37 +02:00
Mitchell Richters 14273dd200 SW: Add GetDeltaQ16Angle. 2020-05-21 18:47:37 +02:00
NY00123 36e6dee64c Add PedanticQ16AngleFloor to sw/src/game.h and use it in DoPlayerTurn 2020-05-21 18:47:37 +02:00
NY00123 b84975e406 SW: Remove drive_oangvel from PLAYERstruct. We can use local variables instead. 2020-05-21 18:47:37 +02:00
NY00123 6aecd46dbc SW - Hopefully a better way to decide if getinput should call
DoPlayerTurn/DoPlayerHorizon while input is tied to the frame rate:
Introduce the new player flags PF2_INPUT_CAN_TURN and PF2_INPUT_CAN_AIM.
Set PF2_INPUT_CAN_TURN if DoPlayerTurn can be called outside
of getinput. Similarly set PF2_INPUT_CAN_AIM if DoPlayerHorizon
can be called in this manner.
getinput will only call DoPlayerTurn/DoPlayerHorizon
if PF2_INPUT_CAN_TURN/PF2_INPUT_CAN_AIM is set. These flags are reset
right before the call to the player's current DoPlayerAction function.

For one example in which this assists, it's not always the
case that DoPlayerDeathFollowKiller may call DoPlayerTurn,
even if we assume that pp->input.q16angvel is never zero.
2020-05-21 18:47:37 +02:00
NY00123 e3197d206d SW: Temporarily lock angle and horiz right upon player death 2020-05-21 18:47:37 +02:00
NY00123 bfd79d8bc2 sw/src/draw.cpp:drawscreen: Don't interpolate while the game is paused 2020-05-21 18:47:37 +02:00
NY00123 656e059c86 sw/src/game.cpp: Remove unused ReloadPromptMode variable 2020-05-21 18:47:37 +02:00
NY00123 8d748c19e4 Minor SW cleanup: Have a single declaration of
GamePaused within game.h. Do the same with ReloadPrompt.
2020-05-21 18:47:37 +02:00
NY00123 5a0e54b63e SW: Migrate the player's RevolveAng field to Q16.16 format.
This fixes truncations of q16ang in MovePlayer. One known
fixed issue is a minor micro-shaking effect, reproduced
while standing on a non-moving SO (e.g., the bus in level 1).
The latter is also related to the use of camq16ang.

Based in idea on patch from mjr4077au.
2020-05-21 18:47:37 +02:00
NY00123 ef85bc58c3 sw/src/draw.cpp:drawscreen: Use GetQ16AngleFromVect for pointing
at a remote-controlled SO. In case PedanticMode == FALSE, this
leads to small improvements with aiming at the car in EXAMPLE.MAP.
2020-05-21 18:47:37 +02:00
NY00123 207240f277 Add GetQ16AngleFromVect wrapper function to sw/src/game.h 2020-05-21 18:47:37 +02:00
NY00123 e2a789b8cc SW: Lock angle and horiz right after teleporting to sprite 2020-05-21 18:47:37 +02:00
NY00123 8e9130c31a sw/src/draw.cpp:drawscreen: Removing the check that pp->sop_control
is non-null seems to resolve the newly introduced interpolation
issue for looking up/down while controlling a sector object.
We can also remove the PF_DEAD test, since
game.cpp:getinput should lock any kind of aiming.

src/src/game.cpp:getinput: We now, however, need to further
lock turning here while controlling a sector object.
2020-05-21 18:47:37 +02:00
NY00123 4c73c11255 SW: Ensure the player's rendering angle is in sync with a rotating
sector. This re-introduces the angle interpolation in drawscreen
while sector object interpolation is in use.

A side-effect of this is that looking up/down is now less smooth
while controlling a sector object (e.g., a turret).
2020-05-21 18:47:37 +02:00
NY00123 0c4deb9298 sw/src/track.cpp:MovePlayer: We also need to update pp->camq16ang here.
Note that this angle is currently not interpolated,
as done for the sector.
2020-05-21 18:47:37 +02:00
NY00123 fd6df8e509 sw/src/track.cpp:MovePlayer: Missed this in preceding interpolation fixes 2020-05-21 18:47:37 +02:00
NY00123 1d1aa4581b sw/src/track.cpp: If interpolation is enabled, also cover
the SO's midpoint. Fixes aiming at a remote controlled SO.
2020-05-21 18:47:37 +02:00
Mitchell Richters 979c4846a4 SW: Fixes and cleanups following backporting upstream's input changes. 2020-05-20 14:43:03 +02:00
Mitchell Richters 2c0ad0dd12 SW: Fix compilation after backporting upstream's input changes. 2020-05-20 14:43:03 +02:00
NY00123 3913a05713 Use pragma pack in sw/src/network.h instead of the locally defined
PACKED macro. This is more consistent with the current Duke3D codebase,
and further fixes build with older versions of MinGW GCC, in which
attribute packed is broken without specifying -mno-ms-bitfields.
2020-05-20 14:43:03 +02:00
NY00123 ff49bc2209 SW: Remove unused wfe_Clock variable 2020-05-20 14:43:03 +02:00
NY00123 b0318afbdb Fix usage of possibly wrong address in sw/src/player.cpp:DoPlayerHorizon 2020-05-20 14:43:03 +02:00
NY00123 10a5120e40 sw/src/network.cpp: I think that it's safe to enable
the sync check on the slave side in Master/Slave mode.
2020-05-20 14:43:03 +02:00
NY00123 0f761cdc77 SW: This hopefully resolves issues with leaving multiplayer games 2020-05-20 14:43:03 +02:00
NY00123 7749b0f7b9 SW: Interpolate sector objects in non-demo, single player games.
Let's see if this is breaking anything.
2020-05-20 14:43:03 +02:00
NY00123 25be14ccc0 Another change modifying saved game format in SW:
Increase MAXINTERPOLATIONS from 1024 to MAXSPRITES.
2020-05-20 14:43:03 +02:00
NY00123 bf0ace3748 SW change breaking compatibility with existing saved games:
Remove startofdynamicinterpolations and short_startofdynamicinterpolations.
2020-05-20 14:43:03 +02:00
NY00123 18602d41c9 SW: Reset the number of interpolations on level load 2020-05-20 14:43:03 +02:00
NY00123 47ac981a3a SW: Let's replace the macro PEDANTIC_MODE with variable PedanticMode 2020-05-20 14:43:03 +02:00
NY00123 cc4f1f21f9 Interpolation fixes for SW:
draw.cpp: Fix the lack of interpolation while walking on a sector
object, like the bus roof or the floor of the train in Seppuku Station.
track.cpp: Make sure the player's location and angle aren't mistakenly
interpolated while standing on a moving sector object as a consequence.
2020-05-20 14:43:03 +02:00
NY00123 eaefc2576c SW: Rename q16avel -> q16angvel and q16horz -> q16aimvel.
While it is understandable that avel and horz came from Duke3D,
having both q16horiz and q16horz in the updated SW_PACKET struct
can be confusing, and the alternative notation is more consistent
with the original struct field names of angvel and aimvel, as well
as the differing uses of the name angvel still present in player.cpp.
2020-05-20 14:43:03 +02:00
NY00123 952c578957 SW (DoPlayerTurn): The 180-degrees turns should be clockwise 2020-05-20 14:43:03 +02:00
NY00123 d07470ec4a sw/src/player.cpp:PlayerAutoLook: Modify function to
test for PF_MOUSE_AIMING_ON only if PEDANTIC_MODE == FALSE
2020-05-20 14:43:03 +02:00
NY00123 6d9c657b11 SW: This is a better place for a slave which quits to set QuitFlag 2020-05-20 14:43:03 +02:00
NY00123 d50410f06b SW: With the input tied to frame rate, disable aiming while the
player is dead, and also disable horizontal aiming while on a ladder.
2020-05-20 14:43:03 +02:00
NY00123 820e9ef5f9 SW: Use the old interpolation path in drawscreen if player is dead 2020-05-20 14:43:03 +02:00
NY00123 701b33da0d SW: Make horiz centering a bit less immediate again 2020-05-20 14:43:03 +02:00
Mitchell Richters cba38c5cfc SW: Tie player input to frame rate. 2020-05-20 14:43:03 +02:00
Mitchell Richters 8b10f53450 SW: Add and use elapsedInputTicks and scaleAdjustmentToInterval
as one more step before tying input to frame rate.
2020-05-20 14:43:03 +02:00
NY00123 8085c8473d SW: Add the q16ang and q16horiz fields to SW_PACKET. These
will be filled by faketimerhandler with the current player's
most recent camq16ang and camq16horiz values, respectively.
2020-05-20 14:43:03 +02:00
NY00123 de0ed067f5 SW: Modify DoPlayerTurn/DoPlayerHorizon to make it possible
for them to modify the player's camq16ang/camq16horiz field
instead of q16ang/q16horiz. Additionally, pass to them the
change in angle/horiz via a parameter, as an alternative
to direct access to the corresponding player input field.
2020-05-20 14:43:03 +02:00
NY00123 1f9e319d39 SW - First step in tying player input to frame rate:
Add the camq16ang and camq16horiz fields to the player struct.
With the exception of DoPlayerTurn and DoPlayerHorizon, whenever
code in player.cpp updates player's q16ang/q16horiz, also write
the updated values to camq16ang/camq16horiz. These variables'
preceding values are never used in these functions.
2020-05-20 14:43:03 +02:00
NY00123 b447feef91 sw/src/game.cpp:LoadLevel: Rename q16ang -> ang 2020-05-20 14:43:03 +02:00
NY00123 a2a1642f3d SW: We can revert the change of siang to q16 now 2020-05-20 14:43:03 +02:00
NY00123 1d2aadd229 sw/src/draw.cpp:drawscreen: We can set the pp->si* fields just once,
a bit later.
2020-05-20 14:43:03 +02:00
NY00123 2d4766555c SW: Revert commented out horiz->q16horiz renames in DSPRINTF strings 2020-05-20 14:43:03 +02:00
NY00123 a8a47a9eb0 SW: Fix typo in DoPlayerTeleportToSprite, following the migration to q16 angles 2020-05-20 14:43:03 +02:00
NY00123 4a8ad9b550 Fix multiplayer desync after the change to q16 angle and horiz.
Note that this includes non-portable unaligned accesses, but this
already applies to surrounding code. Just add comments for now.
2020-05-20 14:43:03 +02:00
NY00123 6faa73286f SW: Trim q16 angle and horiz during demo playback/recording.
This uses the newly introduced PEDANTIC_MODE macro.
2020-05-20 14:43:03 +02:00
NY00123 8284fcba9a sw/src/player.cpp:DoPlayerTurn: Increase turning precision
with q16 angle. This uses the new NORM_Q16ANGLE macro.
2020-05-20 14:43:03 +02:00
NY00123 1a46afaf27 Fix compatibility with existing demo files after the migration
to q16 angle and horiz. The original SW_PACKET structure,
named OLD_SW_PACKET here, is used while accessing demo files.
2020-05-20 14:43:03 +02:00
Mitchell Richters 0431f5ffed SW: Refinements for Q16.16 implementation. 2020-05-20 14:43:03 +02:00
Mitchell Richters a4fdabd860 SW: Use Q16.16 for angle. 2020-05-20 14:43:03 +02:00
Mitchell Richters 2bf2055c65 SW: Use Q16.16 for horiz. 2020-05-20 14:43:03 +02:00