Commit Graph
178 Commits
Author SHA1 Message Date
Gleb Mazovetskiy 6327e713e0 Lowercase all file paths
We want to be able to use unpacked MPQs on low-end platforms
(PS2/rg99/etc).

This is tricky on case-sensitive filesystems. Avoids case issues by
lowercasing all paths in the code (then we'll just need lowercased
listfiles).
2022-08-20 23:49:23 +01:00
Gleb Mazovetskiy 04c3d85179 Remove MAX_PATH
Rather than using the Windows-like `MAX_PATH`, what we really want is 2
things:

1. Maximum path of a file in an MPQ. This is now `MaxMpqPathSize`.
2. Max size for the known monster paths. This is now 64 for sounds and
   TRNs, which is more than enough (picked arbitrarily).
2022-07-16 11:14:16 +01:00
Gleb Mazovetskiy f9f6949af2 Clean up effects_play_sound, gfnSoundFunction 2022-07-16 10:59:40 +01:00
Gleb Mazovetskiy 643c707c55 Remove strncmp 2022-07-16 10:59:40 +01:00
Anders Jenbo 16b65120ea Clean up LevelMonsterTypes related code 2022-07-15 19:36:47 +02:00
Mikołaj Piróg 262fa9ac2d Rename MonsterData members (#5000) 2022-07-15 16:20:13 +02:00
Gleb Mazovetskiy 33ac2cca8e ♻️ Make Monster counters size_t 2022-07-12 03:04:53 +01:00
Anders Jenbo 2d21fc372e Remove more miniwin code 2022-07-10 21:13:39 +02:00
Gleb Mazovetskiy 53975d9264 monstdat: Simplify paths
1. Remove `Monsters\` from `sndfile` and `TransFile`.
2. Where `sndfile` is the same as `GraphicType`, set `sndfile` to
   `nullptr`.
2022-07-10 06:14:58 +02:00
Gleb Mazovetskiy 197e1180b2 Add StrCat and StrAppend
Adds simple string / integer concatenation functions.

Many of the uses of `fmt::format` are simply concatenation
of a few strings and integers.

`StrCat` is an easier-to-read alternative to such uses of `fmt`.
2022-07-10 06:14:58 +02:00
Mikołaj Piróg 7cab074aa5 Correct members' names in monster.h (#4850)
* Fix case in AnimStruct
* Rename CMonster members
2022-07-01 23:34:32 +02:00
Gleb Mazovetskiy 3178dd5158 Replace most uses of sprintf with fmt (#4837) 2022-07-01 17:02:56 +02:00
Mikołaj Piróg 2e7ff45fbf Monster global constants cleanup (#4827)
* Change #defines to constexpr const, add constexpr where applicable, fix typos
2022-07-01 00:43:03 +02:00
Anders Jenbo 99181fd709 Move more files to the engine folder 2022-06-24 11:08:15 +02:00
qndel 354e329644 Players[MyPlayerId] -> MyPlayer 2022-05-31 05:35:52 +02:00
Gleb Mazovetskiy 7f695c2835 Use SoundSample for music
Unifies audio handling between sound effects and music.
2022-04-14 03:11:37 +02:00
Gleb Mazovetskiy b312edee49 Fix snd_deinit called even if snd_init failed
We were previously setting `was_sound_init` to true unconditionally
after calling `snd_init`.

However, `snd_init` can fail. Use `gbSndInited` instead.
2022-04-12 00:45:02 +02:00
qndel d3995736b9 fix spawning unique monsters 2022-02-23 22:37:12 +01:00
qndel e087b109ea fix hellfire shareware monk 2021-11-06 17:20:53 +01:00
Juliano Leal Goncalves 6146b828e9 🚚 Rename 'MonsterData' global to 'MonstersData'
This avoids conflicts with the struct name as we'll be renaming that next.
2021-09-02 21:57:50 +02:00
qndel e82dc72d12 put commented out enums next to sounds 2021-08-24 12:30:18 +02:00
Anders Jenbo 77b72da276 ♻️Use monster by reference when possible 2021-07-14 20:22:35 -07:00
Anders Jenbo 74b57558c9 🚚 Move local code to anonymous namespace 2021-07-10 17:30:15 -07:00
Anders Jenbo 352a0ca510 Place local symbols in an anonymous namespace 2021-07-09 16:54:01 -07:00
Anders Jenbo 903d4bd2e1 Scope all for loops
This caused 7 of the loops to be rewriteen using range by clang-tidy
2021-07-08 08:14:03 -07:00
Anders Jenbo 96bf75b502 Rename player globals 2021-07-08 02:01:14 -07:00
Anders Jenbo 07ad083fda Rename monster globals 2021-07-08 02:01:14 -07:00
Anders Jenbo bc0d1f7ac0 clang-tidy/Android Stuidio cleanups 3 2021-07-04 16:09:32 -07:00
Anders Jenbo bc59218d0d More clang-tidy/Android Studio cleanups 2021-07-04 19:34:37 +02:00
Anders Jenbo ecea12fc15 Clang-tidy: ParameterCase 2021-07-03 15:46:39 -07:00
Anders Jenbo a350fb0b15 Clang-tidy: FunctionCase part 1 2021-07-03 03:45:33 +02:00
Anders Jenbo b1d237c823 More init clean up (#2262) 2021-06-29 06:37:38 +02:00
Juliano Leal Goncalves cbb84199c2 ♻️ Replace Point addition with 'Point + Displacement' 2021-06-28 20:37:44 -07:00
Anders Jenbo 8e07ef8fe5 Clang-tidy: misc-unused-parameters 2021-06-27 17:34:32 +02:00
ephphatha 357f6f1dc3 Move RNG functions to their own header/source files 2021-06-27 03:09:41 -07:00
Anders Jenbo 8a4d38dd74 Stabalize clang-tidy runs 2021-06-27 03:42:51 +02:00
ephphatha f4f6a8a51e Refactor PlaySfxLoc to take a Point instead of x/y params
Because of the heavy usage of this function in objects.cpp and the mixed use of aliases and direct references to the active object in Operate*Door functions I've done some refactoring of those areas beyond what is strictly necessary. Hopefully this makes sense and is reasonable to include in this change.
2021-06-26 10:12:28 -07:00
ephphatha bccf88dd8e Refactor PlaySFX_priv to take a Point instead of x/y params 2021-06-26 10:12:28 -07:00
ephphatha 15c285c879 Refactor calc_snd_position to take a Point instead of x/y params
Appears this function is only called internally despite being in the effects header.
2021-06-26 10:12:28 -07:00
Anders Jenbo 22b632f04a ♻️Clean up implicit bool conversions 2021-06-26 08:57:59 -07:00
Anders Jenbo 1cc0eb25ca ♻️Use ranges for loops (clang-tidy) 2021-06-25 13:22:08 +02:00
Gleb Mazovetskiy f9f301b054 🚚 engine.h: Extract Point, Direction, clamp
`engine.h` is getting quite bloated. Moves this code to their own files.
2021-06-21 01:36:20 -07:00
Anders Jenbo 8a7ec56d3a Player by reference part 2
This mostly change player to be by reference instead of by index.
But additionally it does stript checks for gold in the belt, move some
value types to the initialization and short circute a few functiongs.
2021-05-24 21:00:32 +02:00
Anders Jenbo 4a7ba94702 🎨 Run clang-format 2021-05-07 23:26:39 +02:00
thebigMuh 24f32a1d53 Fix sound volume/panning attenuation (#1789)
* Fixing volume adjustment and scaling
2021-05-03 02:11:22 +02:00
Gleb Mazovetskiy 559229dea1 🐞 Duplicate sounds: Fix data race
This fixes a data race by deleting the sound exactly when it finishes
playing.

Previously, a data race could happen in
`CleanupFinishedDuplicateSounds`, where the sound would be destroyed
while Aulib was reading from its buffer.
2021-05-02 14:15:35 +01:00
Anders Jenbo 93f9b852a2 🐛 Do not stop music when calling sound_stop()
Fixes #1782
2021-05-02 00:47:27 +02:00
Gleb Mazovetskiy 7bdfb0655c 🐞 Support multiple playback of the same sound 2021-05-02 00:36:36 +02:00
Vladimir Olteanu 7aad72f96d Use automatic memory management for sound stuff (#1771) 2021-04-30 09:02:07 +02:00
Gleb Mazovetskiy acee2ef14c 🎉 Switch from SDL_mixer to SDL_audiolib
SDL_mixer can only stream a single music track
SDL_audiolib has unlimited streams.

With this change, we finally have streaming sounds (respecting
sfx_STREAM).

Audio options can now also be set via diablo.ini, which should help us
better diagnose the static noise issues.
2021-04-27 00:54:50 +01:00