Commit graph

987 commits

Author SHA1 Message Date
Christoph Oelckers
941c0850ba - Backend update from Raze.
Mainly optimizations for the sound system and texture manager.
2022-12-18 16:19:18 +01:00
Kevin Caccamo
6cf3dc045f Fix SNDINFO $rolloff always changing global rolloff
I investigated the issue a bit more by copying the grenade sounds from Wolfenstein: Blade of Agony and the definitions for the sounds from its SNDINFO lump, and then copying the entire SNDINFO lump from Wolfenstein: Blade of Agony into a small test mod, and disabling tags like $volume and $rolloff using sed. It turns out disabling $rolloff tags fixed the issue, and looking into the code, it seems as though the global rolloff was always being changed, or that rolloff was picking up a garbage pointer.

Fixes #1849
2022-11-27 21:02:07 +01:00
Christoph Oelckers
65a26d6779 - removed the string constructors from FSoundID.
Due to C++ conversion rules this was a bit too volatile. There's really not enough places where being able to pass a string directly into the sound API was beneficial - the two most frequent functions now got overloaded variants.
2022-11-24 23:52:52 +01:00
Christoph Oelckers
b89c4affae - removed the string assignment operators.
These all caught literal 0's as well
2022-11-24 23:52:52 +01:00
Christoph Oelckers
d173c0453c - handle all remaining places of sound ID conversions after removing the conversion operators. 2022-11-24 23:52:52 +01:00
Christoph Oelckers
160633a4a2 - migrate a large part of the sound code to FSoundIDs.
This has always been a wild mixture of IDs and ints.
2022-11-24 23:52:52 +01:00
Christoph Oelckers
1a6da52961 - use FSoundID in SoundEngine's interface. 2022-11-24 23:52:52 +01:00
Christoph Oelckers
d13f12cc37 - this should take care of the S_* interface. 2022-11-24 23:52:52 +01:00
Christoph Oelckers
7e8de9d1ba - made more use of FSoundID. 2022-11-24 23:52:52 +01:00
Christoph Oelckers
225399a1ef - use TMap for the playersound hashtable. 2022-11-24 23:52:51 +01:00
Christoph Oelckers
4d1b44d9e3 - eliminated GetSounds from the sound engine's interface. 2022-11-24 23:52:51 +01:00
Christoph Oelckers
419e593a4c - allow SNDINFO to declare sound mappings by using 'sounda = soundfle'.
This works similar to MAPINFO: The first definition in a file declares the format, all later ones must be the same.
This change in syntax increases robustness significantly because it avoids the problems with the original syntax not being able to detect badly formatted names.
2022-11-24 23:52:51 +01:00
Christoph Oelckers
453688ccc6 - reworked CVARs to not use a linked list and to be initialized manually.
This solves two problems:

* The linked list is too slow, a map is better. A map cannot be used with statically allocated CVARs because order of initialization is undefined.
* The current CVAR system is an unordered mishmash of static variables and dynamically allocated ones and the means of identification are unsafe. With this everything is allocated on the heap so it can all be handled the same by the cleanup code.
2022-10-21 18:56:43 +02:00
Christoph Oelckers
519005ff4d - snd_reset cannot be shared. 2022-10-02 20:22:23 +02:00
Christoph Oelckers
8aaab153fa - add a system interface for CheckCheatmode and moved some sound code to the backend. 2022-10-02 16:48:56 +02:00
Christoph Oelckers
d1caf3a471 - made TObjPtr as trivial as possible.
Mainly to avoid problems with Raze, but eliminating this constructor lets us catch erroneous local definitions via 'auto', which can cause major problems if left undetected.
2022-06-06 15:19:31 +02:00
Rachael Alexanderson
12ed24d066 - separate i_pauseinbackground and i_soundinbackground - they probably should ultimately be moved out of the sound code 2022-01-15 20:17:11 -05:00
Christoph Oelckers
32de663210 - fixed MBF21's A_SeekTracer.
This cannot directly call A_SeekerMissile because that has more parameters. It now maps to a wrapper that takes care of these.
2022-01-07 00:33:56 +01:00
Christoph Oelckers
64ef03428d - added proper range check to the main sound playing function.
We got a report where this crashed on a bad sound index.
2022-01-07 00:16:30 +01:00
Christoph Oelckers
77d74a11d1 - removed most templates.h includes. 2021-10-30 10:49:12 +02:00
Christoph Oelckers
07a181090b - missed some MAX's. 2021-10-30 10:45:58 +02:00
Christoph Oelckers
1d0aed219e - replaced MIN/MAX in all non-common code. 2021-10-30 10:16:52 +02:00
drfrag
d00c6e4ecc - Added missing null pointer check. 2021-07-17 23:23:32 +02:00
alexey.lysiuk
cf4c72d4a7 - fixed potential crash when sound sequence is destroyed
Level can be unset if sound sequence destruction happens after saved game loading failure

https://forum.zdoom.org/viewtopic.php?t=72551
2021-06-14 09:30:51 +03:00
Christoph Oelckers
8b5847d4a2 - corrected the NUL checks in S_FindSkinnedSound. 2021-06-04 08:26:29 +02:00
Zandrewnum
acb4d89f52 APROP_Soundclass update again
- Just set init for SoundClass to empty.
- Removed code block from SetActorProperty for APROP_Soundclass that does nothing
- Lower-cased soundclass in FSerializer
- Created a new const char to read the player's soundclass. If the playerpawn returns NAME_None for it's default, then it will set defaultsoundclass to "player". After running the skin code, the function now returns defaultsoundclass or soundclass, depending if soundclass is empty or not.
- Renamed GetSoundClass to S_GetSoundClass
2021-05-28 20:22:37 +02:00
Zandrewnum
a5cf0c6605 Sound Class renovations
- SoundClass is instantiated to "" by default. Since this property is only used when it is not empty (otherwise GetSoundClass just defaults to player), we can get away with this.
- We may want the soundclass to remain the same if we explicitly set it to the same one that is currently used (say, we set SoundClass to "Caleb" so all other skins can use it)
- GetActorProperty for APROP_SoundClass just calls GetSoundClass,
- CheckActorProperty also just runs GetSoundClass
- GetSoundClass is no longer a static method. We needed to access it in other places.
- Made renovations to GetSoundClass. First of all, SoundClass is no longer instantiated there. Secondly, skinned sounds are now returned if SoundClass is empty. Thirdly, "sclass" in this method will return the default soundclass of the player pawn or SoundClass, depending on if SoundClass is empty. Finally, sclass will retrieve "player" if it is empty.
2021-05-28 20:22:37 +02:00
Zandrewnum
c7cd25cbcc Made S_FindSkinnedSound to use GetSoundClass again
- I couldn't simply init SoundClass to NAME_SoundClass, even after converting it to the appropriate type. Probably because NAME_SoundClass hasn't been parsed from decorate yet. Instead, I change it to NAME_SoundClass through GetSoundClass if it's valid and currently "player".
- The skin checker code in GetSoundClass now checks if the SoundClass is equal to NAME_SoundClass. This mechanism exists so that way reverting the SoundClass to NAME_SoundClass processes the skin soundclass code. If it's different, the code is not processed.
- Just returns sclass. This is never null, so there's no need to check if so.
- S_FindSkinnedSound just uses GetSoundClass. This makes sure skins are checked.
2021-05-28 20:22:37 +02:00
Zandrewnum
f6bdbfe535 APROP_SoundClass inits a default value and checks for null pointers
- Gave default init value to SoundClass as "Player"
- Changed SoundClass detection to use the if/else structure
- Checked for null pointer in S_FindSkinnedSound when reading the player's sound class
2021-05-28 20:22:37 +02:00
Zandrewnum
852a96497d Added APROP_SoundClass
- Added APROP_SoundClass to GetActorProperty, SetActorProperty, CheckActorProperty
2021-05-28 20:22:37 +02:00
Rachael Alexanderson
d3804911cf - Fix the previous commit
Revert "Fixed a missing parameter in S_Sound's ZScript prototype that was causing assertion failures."

This reverts commit 619f44decd.
2021-01-18 04:02:12 -05:00
Chronos Ouroboros
619f44decd Fixed a missing parameter in S_Sound's ZScript prototype that was causing assertion failures. 2021-01-17 22:22:40 -03:00
Rachael Alexanderson
476e59fbab - add sv_instantreaction dmflag 2021-01-13 07:04:18 -05:00
Rachael Alexanderson
65c7b77997 - update $musicalias to allow iwad remapping when used from game_support.pk3
- add music aliases for the unity version of Doom/Doom2 for digitized game soundtrack
- this fixes issue #1268
2021-01-06 06:32:04 -05:00
Christoph Oelckers
6f4dfd9a61 - added the option to look for music by using a truncated 8-character variant of the given name.
This workaround is needed because there's known old mods depending on this legacy behavior.
2020-12-11 11:39:24 +01:00
Christoph Oelckers
d4d187e27b - removed the limiter flags again and addressed the underlying problem properly.
The real issue is that the number of unattenuated sounds was unchecked and the near limit never kicked in.
To do this properly it is necessary to adjust the limit distance by the attenuation - zero attenuation must mean infinite distance and for high attenuations the distance must be lowered for limiting to work as intended.
The limit for the Doom boss sounds was increased to 4 to compensate for this change.

# Conflicts:
#	src/common/audio/sound/oalsound.cpp
2020-10-28 21:30:25 +01:00
Nikolay Ambartsumov
10c833f37e Raise SNDSEQ limit to 4096 sequences 2020-10-25 15:58:30 +01:00
Christoph Oelckers
a6842b6482 - ensure that sfxinfo_t is always fully initialized, regardless how the setup is performed.
The recent pitch additions did not do this on all possible paths.
2020-10-16 22:57:30 +02:00
Christoph Oelckers
cd6ef67209 - fixed sounds not stopping in sound sequences.
The sound sequence code used S_GetSoundPlayingInfo incorrectly, so let it check for a valid sound ID first to restore the old behavior.
2020-09-28 18:38:05 +02:00
Kyle Johnson
e281f992af Disallow sound to be played on destroyed actors
It's possible for an actor to call Destroy() in a ZScript method (such
as Tick()) and then subsequently call A_StartSound() to play a sound.
Generally speaking this doesn't happen within a given class, but with a
class hierarchy, Destroy() may be called unbeknownst to a mod developer.
Even though checking bDestroyed is likely good practice, this ensures
that sounds won't be started on actors flagged for cleanup.
2020-09-12 21:38:56 +02:00
MajorCooke
c57e669044
Added an optional extra float parameter to $pitchshift. (#1150)
- This allows for setting a randomized range for the pitch each time the sound is initialized.
2020-08-27 12:49:59 -04:00
Major Cooke
a85ee5826e Added $PitchSet <logical name> <float> for SNDINFO.
- Sets the direct pitch of the sound to the specific float. Default is 0.0, meaning do not set a specific pitch. Regular pitch is 1.0.
- Only works for direct sound definitions.
- Overrides $PitchShift unless value is <= 0.0
- Overridden by A_StartSound's pitch parameter if the value > 0.0.
2020-07-24 08:05:44 +02:00
Christoph Oelckers
248aa8b5a7 - moved s_reverbedit.cpp to 'common'. 2020-06-14 12:39:59 +02:00
Christoph Oelckers
712d80006a - split game dependent parts out of menudef.cpp. 2020-06-14 00:27:32 +02:00
Christoph Oelckers
9be63a5093 Merge branch 'master' into texture_rework 2020-04-29 08:04:15 +02:00
Christoph Oelckers
ddef3f7b98 - made video base code game independent 2020-04-28 22:54:53 +02:00
Christoph Oelckers
12e69adec3 - system backend cleanup.
This is mainly for running CI on Linux and macOS. Windws is already working.
2020-04-22 19:57:14 +02:00
alexey.lysiuk
426f40dd52 - fixed crash when loading saved game that has no music 2020-04-20 15:08:33 +03:00
alexey.lysiuk
5a56f209d3 - fixed conditions with SND_PlayerReserve flag
src/sound/s_advsound.cpp:953:9: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
src/sound/s_advsound.cpp:1264:20: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
src/sound/s_advsound.cpp:1426:6: warning: logical not is only applied to the left hand side of this bitwise operator [-Wlogical-not-parentheses]
2020-04-12 11:49:47 +03:00
Christoph Oelckers
ce4c2be3c7 - use the 2d drawer's size where appropriate. 2020-04-11 20:20:58 +02:00