Commit graph

39 commits

Author SHA1 Message Date
Kp a70188e7a5 Move various static functions into anonymous namespace 2022-07-09 13:39:29 +00:00
Kp 1c13d3c8d3 Improve error reporting for PHYSFSX_openReadBuffered
Return the PHYSFS error code on failure, so that callers can report why
the open failed.
2021-07-25 23:00:56 +00:00
Dmitry Grigoryev fbd05a1592 optimize include files (include what you use) 2021-02-06 21:38:50 +01:00
Kp c0daa89ad5 Avoid reopening descent.sng
If !canUseExtensions, then fp is already open to descent.sng.  There is
no need to reopen it just to get its length.
2020-07-05 23:34:33 +00:00
Kp 81119f0445 Use enum class for LevelMusicPlayOrder 2020-05-31 23:04:25 +00:00
Kp db7b4b3f88 Refer to <memory> directly, not through "compiler-make_unique.h" 2020-05-02 21:18:43 +00:00
Kp cc38cdf4b8 Qualify uses of std::make_unique 2020-05-02 21:18:42 +00:00
Kp 93d3793b30 Fix crash entering secret level with music on, and no songs
If music is configured as built-in, and no secret songs are configured,
then BIMSecretSongs is set to a non-null pointer to a zero-element
array.  This triggers a divide-by-zero when the array length is used in
a modulus operation.

Fix this by adding a special case that initializing from an empty vector
calls `reset()`, which causes the underlying unique_ptr to store
`nullptr` instead of `new bim_song_info[0]`.

Reported-by: Daniel-Leontiev <https://github.com/dxx-rebirth/dxx-rebirth/issues/465>
Fixes: c355e207fe ("Refactor song loading")
2019-11-02 04:36:15 +00:00
ziplantil 2c5ab8e739 initial version of this, trying to catch MCI events 2019-10-27 02:47:45 +03:00
Kp c355e207fe Refactor song loading
Use an RAII object to manage allocations and keep the length and pointer
together.
2019-08-25 16:43:17 +00:00
ziplantil 6588bd6626 refactor secret level music code 2019-08-18 20:18:34 +03:00
ziplantil 79e0e2fdea dxx-r.sng: add !Rebirth.secret 2019-08-16 00:20:52 +03:00
Kp 726233e043 Fix sdlmixer=0 build of songs.cpp 2018-07-30 00:49:59 +00:00
Kp 20f1934312 Move Redbook audio behind DXX_USE_SDL_REDBOOK_AUDIO
Currently, DXX_USE_SDL_REDBOOK_AUDIO is an alias for !SDL2.  However,
this patch enables interested users to readily patch out Redbook even
for SDL1.

References: <https://github.com/dxx-rebirth/dxx-rebirth/issues/82>
2018-07-14 17:23:15 +00:00
Kp c60c0352f0 Fix songs_play_file use for sdlmixer=0 2017-11-25 01:56:51 +00:00
Kp ddf888cd72 Move USE_SDLMIXER to dxxsconf.h; rename to DXX_USE_SDLMIXER
Rename symbol USE_SDLMIXER to DXX_USE_SDLMIXER to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct and
inferno.cpp were manual.

git grep -l USE_SDLMIXER -- '*.h' '*.cpp' | xargs sed -i -e 's/^#ifdef \(USE_SDLMIXER\)$/#if DXX_\1/' -e 's/#\(el\)\?if \(.*\)defined(\(USE_SDLMIXER\))/#\1if \2DXX_\3/'
2016-09-11 18:49:15 +00:00
Kp 848b99376d Switch songs.cpp to reinterpret_cast 2016-09-04 00:02:53 +00:00
Kp ee1003f29f Move conditionally compiled code into namespace dsx 2016-08-25 04:05:32 +00:00
Kp a98510b17e Move CMLevelMusicTrack to CCfg 2016-08-06 19:55:25 +00:00
Kp ac8232caca Move CMMiscMusic to CCfg 2016-08-06 19:55:25 +00:00
Kp 9f1abe1910 Move SndNoMusic to CArg 2015-12-24 04:01:26 +00:00
Kp a579f75d05 Move SndDisableSdlMixer to CGameArg 2015-11-24 04:05:36 +00:00
Kp 927618e650 Remove useless PHYSFS_eof tests
Each test triggers a system seek call.  EOF will be signalled by
PHYSFSX_fgets returning nullptr.
2015-10-09 02:46:11 +00:00
Kp 1ecbeb6bf9 Remove redundant use of PHYSFSX_exists 2015-10-09 02:46:11 +00:00
Kp 7034b68357 Manage world time automatically where possible
For all cases where world time nests, use automatic management.  Some
sites disable time in one function and enable it elsewhere.  These are
untouched.
2015-10-09 02:46:09 +00:00
Kp f899aaeaca Move player callsign to player-callsign.h 2015-07-25 23:10:45 +00:00
Kp 91cc111295 Provide SndDisableSdlMixer=true if !USE_SDLMIXER
Accept -nosdlmixer as a no-op in !USE_SDLMIXER builds.
2015-02-08 17:43:29 +00:00
Kp f7815810e8 Use RAIIPHYSFS_File to manage PHYSFS_File
Fixes a few leaks on error paths.
2015-01-17 18:31:42 +00:00
Kp 68d705a85a Use bool conversion to test PHYSFS_File pointer 2015-01-17 18:31:42 +00:00
Kp 628156dbf7 Use array<ntstring> for CMMiscMusic 2014-12-22 04:35:48 +00:00
Kp 664e8abaac Fix !SDLMIXER build
Fixes: bd1c6d8c5d
2014-12-11 02:35:03 +00:00
Kp e8f4b20d1d Use special type for PHYSFSX_fgets 2014-09-07 20:07:20 +00:00
zico ad7cb106bc Changed custom D1X license to GPLv3 2014-06-01 19:55:23 +02:00
vobject 9529f60d5d Use correct type for diskid. The *_DISKID defines are larger than a 32bit signed integer. 2014-01-07 22:04:23 +01:00
Kp 094dfbf3d4 Reduce header inclusions 2013-12-31 03:22:03 +00:00
Kp 96bc008c72 Fix audio file matching broken by cb4fd7c1b4 2013-12-19 03:31:24 +00:00
Kp a2cec5d71f Switch PHYSFSX_fgets to auto-sized variant where possible 2013-12-07 18:39:19 +00:00
Kp 2714679284 Mark private functions static 2013-11-02 04:23:55 +00:00
Kp 6a7bd1527a Move similar/main/songs.c -> similar/main/songs.cpp 2012-11-11 22:12:51 +00:00
Renamed from similar/main/songs.c (Browse further)