Commit graph

73 commits

Author SHA1 Message Date
Kp 12b57e84e6 Switch most in-tree http:// links to https://
For each link given as http://, verify that the site is accessible over
https:// and, if so, switch to it.  These domains were converted:

* llvm.org
* clang.llvm.org
* en.cppreference.com
* www.dxx-rebirth.com
* www.libsdl.org
* www.scons.org
2018-09-02 00:57:29 +00:00
Kp bba8a327a0 Remove use of -Wno-implicit-fallthrough 2018-08-24 02:58:21 +00:00
Kp 524f042659 SDL2: MVE: fix noise from reading undefined sound data
Commit 07245a0bc2 added the SDL_mixer backend for MVE audio.  That
commit set the length of the converted sound equal to the size of the
buffer that SDL requested as a work area.  No one ever touched that
logic, until now.  In SDL1, that choice worked fine.  In SDL2, this
causes garbage to play after the sound, because SDL2 considers the
buffer to be defined only up to the length returned in
`SDL_AudioCVT::cvt_len`.  Bytes beyond that length are undefined[1], and
in practice contain garbage.  Fix the noise by setting the sound length
equal to the length returned by SDL2, so that the undefined bytes are
not treated as sound.  SDL1 also maintains this length value, so no
version-specific logic is required.

[1]: https://wiki.libsdl.org/SDL_ConvertAudio

Reported-by: andrew-strong <https://github.com/dxx-rebirth/dxx-rebirth/issues/398>
2018-08-01 01:18:11 +00:00
Kp 01e1b28d71 Replace useless printf with puts 2017-12-05 05:29:55 +00:00
Kp e035fb215a Cache width in libmve decoder 2017-10-14 17:10:31 +00:00
Kp d4e8a92932 Apply SoundFx control to in-game movies
lukeman3000 asked how to control the volume of the in-game movies.
Prior to this commit, there was no in-game solution to this.  This
change scales movie audio by the SoundFx slider.

Thanks to lukeman3000 for inspiring this change.  Thanks to Ryusei117
for explaining what videos needed to be affected, and for testing an
earlier iteration of the change.

Requested-by: lukeman3000 <https://forum.dxx-rebirth.com/showthread.php?tid=986>
2017-10-01 20:31:34 +00:00
Chris Taylor cc3f35649f Change all occurrences of "Couldn't" to "Could not" for consistency ("Could not" is more common and wins).
Not touching TXT_COULDNT because it's stored separately in hog file.
2016-11-13 13:27:18 +08: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 ea153a60fa Switch libmve to C++ casts 2016-09-04 00:02:52 +00:00
Kp 439d82955f Switch mveplay.cpp to reinterpret_cast 2016-09-04 00:02:52 +00:00
Kp bbdecad649 Add helper macro to handle printf .* conversion for 32/64
Field width conversion `.*` always takes an `int`.

On Win32, casting `long` to `int` triggers a `-Wuseless-cast` warning.
Omitting the cast works correctly.

On Linux/amd64, casting `long` to `int` works correctly.
Omitting the cast triggers a `-Wformat` warning.

Add a macro that conditionally expands to `static_cast<int>` or to ``,
as necessary for the target platform.
2016-08-19 03:41:41 +00:00
Kp 9be68f4e99 Add SConf test for struct timespec 2016-08-19 03:41:40 +00:00
Kp cb99240c2c Remove useless casts in d2x-rebirth/libmve/decoder8.cpp 2016-08-17 04:44:22 +00:00
Kp 7f3b725c40 Use std::swap to exchange mveplay back buffer pointers 2016-08-17 04:44:22 +00:00
Kp c636dc4b98 Convert various static const expressions to constexpr 2016-07-16 16:52:04 +00:00
Kp b0a2205a4e Convert various pointer casts to reinterpret_cast 2016-07-06 01:54:24 +00:00
Kp 19f31eb420 Rewrite simple pointer casts from C style to reinterpret_cast<>
This pass only targets int8_t and uint8_t.

s/(\s*\(u\?int8_t\s*\*\+\)\s*)\s*(/reinterpret_cast<\1>(/g
2016-07-03 00:54:14 +00:00
Kp a7ceee3c03 Add parentheses around target of simple unsigned char casts
C casts do not require parentheses.  C++ casts require grouping around
the target.  Prepare for conversion to C++ casts by adding otherwise
unnecessary parentheses around the target of simple C casts.

s/(\s*unsigned\s\+char\s*\(\*\+\)\s*)\s*\([&+-]\?\)\([[:alnum:]_.]\+\s*->\s*\)*\([[:alnum:]_.]\+\)\(\s*\([];+>)*\/^%,|&<>]\)\|$\|\(\s*-\s*[^>]\)\)/(uint8_t \1)(\2\3\4)\5/g
2016-07-03 00:54:14 +00:00
Kp 3469ff8c34 Change (short*) to (int16_t*)
Uses of `(short*)` usually want exactly a 16-bit signed integer.  Most
platforms provide that as `short`, but that is not guaranteed.

s/(short \(*\+\)\s*)/(int16_t \1)/g
2016-06-27 04:11:13 +00:00
Kp 65f68877aa Rewrite simple integer casts from C style to static_cast<>
This pass only targets commonly used standard types.

s/(\(\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\)\s*)\s*(/static_cast<\1>(/g
2016-06-16 03:56:44 +00:00
Kp 1b12a3f7ef Add parentheses around target of more complicated casts
C casts do not require parentheses.  C++ casts require grouping around
the target.  Prepare for conversion to C++ casts by adding otherwise
unnecessary parentheses around the target of some C casts.

This pass attempts to process expressions that involve parenthesized or
bracketed subexpressions, but only if those subexpressions do not
themselves contain parenthesized or bracketed subexpressions.

	(int) f(1);	// changed
	(int) f(g());	// not changed

perl -p -i -e 's/(\(\s*((?:un)?signed|int|char|short|long|float|double|s?size_t|(?:u?int[[:digit:]]+_t))\s*\**\s*\)\s*)([&+-]?)([[:alnum:]_.]+\s*->\s*)*([[:alnum:]_.]+)((?:\s*(?:\[[^][]*\])*|(?:\([^()]*\))*))(\s*([;+>*\/^%,|&<>])|$|(\s*-\s*[^>]))/\1\(\3\4\5\6\)\7/g'
2016-06-12 03:45:37 +00:00
Kp b282bea173 Rewrite simple integer casts from C style to static_cast<>
This pass only targets commonly used standard types.

s/(\(\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\)\s*)\s*(/static_cast<\1>(/g
2016-06-05 01:04:26 +00:00
Kp 7fdce88558 Add parentheses around target of simple casts
C casts do not require parentheses.  C++ casts require grouping around
the target.  Prepare for conversion to C++ casts by adding otherwise
unnecessary parentheses around the target of simple C casts.

This pass does not attempt to process expressions that involve
any subexpression that can nest arbitrarily, such as parentheses or
brackets.  It also works only on commonly used standard types.

	(int) a->b;	// changed
	(int) a[b];	// not changed

s/\((\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\s*\**\s*)\s*\)\([&+-]\?\)\([[:alnum:]_.]\+\s*->\s*\)*\([[:alnum:]_.]\+\)\(\s*\([];+>)*\/^%,|&<>]\)\|$\|\(\s*-\s*[^>]\)\)/\1(\5\6\7)\8/g
2016-06-05 01:04:25 +00:00
Kp 195c589e3f Move file-local classes into anonymous namespace 2016-03-04 04:12:35 +00:00
Kp a579f75d05 Move SndDisableSdlMixer to CGameArg 2015-11-24 04:05:36 +00:00
Kp edea687627 Remove HAVE_STRUCT_TIMEVAL
SConstruct defines it for all platforms.  It is only false on Mac OS 9,
which is no longer supported.
2015-10-27 03:04:49 +00:00
Kp 15fb75c1c7 Fix check_header_includes build 2015-07-25 23:10:45 +00:00
Kp ce72014e2e Always parse WORDS_BIGENDIAN and !WORDS_BIGENDIAN 2015-06-13 22:42:21 +00:00
Kp 7243e76c80 Fix gcc-4.6 decoder8 build
Fixes: 8a28f7e1c2 ("Use array<> for movie decoder")
2015-05-22 03:33:20 +00:00
Kp 6792c1bc4b Enable -Wunused-parameter 2015-04-26 20:15:56 +00:00
Kp f8ac14b737 Convert mvelib to vector<uint8_t> 2015-04-26 20:15:51 +00:00
Kp 8a28f7e1c2 Use array<> for movie decoder 2015-04-02 02:36:56 +00:00
Kp f900d4a5ee Remove RAIIdmem::operator pointer
Mac OS X defines uint_fast32_t to unsigned int, causing ambiguous
overloads between RAIIdmem::operator[](std::size_t) and
RAIIdmem::operator[](int).  Adding a disambiguating overload for OS X
breaks Windows.  Remove operator pointer and operator[].  Rely on the
inherited operator[] for indexing.  Require users to call ->get() to
convert to a simple pointer.

First btb ambiguity reported: https://github.com/dxx-rebirth/dxx-rebirth/pull/34
Second btb ambiguity reported: https://github.com/dxx-rebirth/dxx-rebirth/pull/43
2015-02-17 03:52:59 +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 ff4a0ccd70 Fix RAIIdmem array usage
Some RAIIdmem instances managed a T[], but were declared to manage a T.
2015-01-28 03:42:53 +00:00
Kp 786b7c35a5 Use unique_ptr for mve_audio_spec 2015-01-28 03:42:53 +00:00
Kp accd1db476 Use unique_ptr for mve_audio_buffers 2015-01-28 03:42:52 +00:00
Kp a3edc2b4f8 Use unique_ptr for MVEFILE::cur_chunk 2015-01-28 03:42:52 +00:00
Kp 84e3a03451 Remove unused parameters 2015-01-18 01:58:33 +00:00
Bradley Bell 3daa0f63b1 Add search SDL_mixer framework paths for headers instead of using <Framework/Header.h> notation 2014-12-03 15:14:18 -08:00
Kp 91a2eb8491 Include <vector> in mveplay.cpp for std::vector
Reported by btb: https://github.com/dxx-rebirth/dxx-rebirth/pull/12
Fixed by btb: f502740fdd
2014-11-30 17:01:39 +00:00
Kp ad527a7551 Use unique_ptr for MVEFILE 2014-11-01 15:04:30 +00:00
Kp a42e7c3db1 Use unique_ptr for MVESTREAM 2014-11-01 15:00:48 +00:00
Kp 279233cf24 Use std::vector for MVE buffer 2014-11-01 15:00:04 +00:00
Kp d8024d4d26 Use RAII to manage MVESTREAM 2014-10-29 02:59:08 +00:00
Kp 19bb554f31 Move MVESTREAM pointer up one layer 2014-10-29 02:57:52 +00:00
Kp 6934dc863c Fix gcc 4.6 build of libmve 2014-10-16 01:40:48 +00:00
Kp 4e368ac946 Make mve args const 2014-10-10 02:57:07 +00:00
Kp 6943024647 Fix signaure of mve_cb_Alloc 2014-10-10 02:43:40 +00:00
Kp 2d7ce50951 Propagate for variables in d2x-rebirth/libmve/mveplay.cpp 2014-09-26 02:42:16 +00:00