Commit graph

6488 commits

Author SHA1 Message Date
derhass b73407e791 Prevent digi_mixer_start_sound() from trying to play nonexisting sounds.
There is a an out-of-bounds access in digi_mixer_start_sound() when
soundnum is < 0. The bounds check I added here is already present in
digi_audio_start_sound().

This bug was triggered on the RPi d2x built when trying to show the
briefing screen because briefing_new_screen() tries to play
SOUND_BRIEFING_HUM, which digi_xlat_sound() translated to -1 in this
situation. The game finally crashed in mixdigi_convert_sound() because
GameSounds[-1] happened to contain some non-zero data (on my Linux desktop,
that memory seems to be always 0 by accident...). This was also the reason
why the pi version tried to allocate lots of memory before it crashed in
memcpy().
2015-03-21 23:45:42 +01:00
Kp 3da8a85ec3 Remove constexpr on rgb_array_wrapper::operator[]
OS X clang (but not Linux clang) rejects constexpr
on rgb_array_wrapper::operator[].

Reported-by: btb <b414758505 (commitcomment-10330686)>
Fixes: b414758505 ("Add stub for player color remapping")
2015-03-21 21:11:12 +00:00
Christian e7470731e9 Merge pull request #51 from derhass/unification/rpi
RPi on unification
2015-03-21 18:22:51 +01:00
derhass a8283a9d45 Merge branch 'unification/master' into unification/rpi
Kp already incorporated some small changes I made in my rpi branch into
unification/master. However, besides making the rpi helper functions
static as I did, he also changed the prototype from (void) parameters
to C++ style (). I've incorporated his version here.

Conflicts:
	similar/arch/ogl/gr.cpp
2015-03-21 18:02:16 +01:00
derhass 6d4ee7a329 RPi: use CPPFLAGS instead of CXXFLAGS for -isystem
Suggested by Kp.
2015-03-21 17:54:04 +01:00
derhass beda132361 RPi: use SConstruct's message() function for the RPi build message 2015-03-21 17:53:58 +01:00
derhass f46e4a2a7c RPi: use -isystem for the VideoCore library header path
Rebirth builds with -Werror=redundant-decls -Werror=undef, which are
triggered by the bcm_host.h. Making gcc treat those paths as
system headers avoids these issues. This was suggested by Kp.
2015-03-21 17:53:13 +01:00
Matt Vandermeulen a59daa64c6 ಠ_ಠ 2015-03-20 17:31:22 -04:00
Kp cf687a9a0a Make RPi OGL functions static 2015-03-20 03:30:20 +00:00
Kp 3a37b41192 Fix startup trap with D1 shareware data
D1 shareware models handle textures in a way that requires starting
highest_texture_num at -1.

Reported-by: derhass <https://github.com/dxx-rebirth/dxx-rebirth/issues/46>
Fixes: 68be3baeca ("Track highest_texture_num locally")
2015-03-20 03:30:20 +00:00
Kp 69af920e09 Fix Win64 startup crash
Fixes: 5bafa16e7f ("Fix level load hang on >=mingw32-gcc-4.7")
2015-03-19 02:31:22 +00:00
derhass c1a38e4433 RPi: Use explicit type casts for DISPMANX_TRANSFORM_T 2015-03-18 21:30:50 +01:00
derhass 7ce066cb8b GLES/RPi: Declare internal helper functions static 2015-03-18 21:07:57 +01:00
derhass c23c98562b GLES: Fix const correctness and for TestEGLError() 2015-03-18 21:05:34 +01:00
Kp 2458078987 Skip digi_sync_sounds loop if !Viewer
If a sound is used, it may dereference Viewer.  If Viewer is null, this
will crash.  In 630f11945e,
digi_sync_sounds changed to assume Viewer is valid.  This crashes during
early startup when not using the SDL_mixer backend, even though no
sounds are in use.

Reported-by: derhass <https://github.com/dxx-rebirth/dxx-rebirth/issues/45>
Fixes: 630f11945e ("Cache Viewer in digiobj")
2015-03-15 18:52:52 +00:00
Kp ac39b6cb40 Fix -Wunused-variable warning in sound_menuset for !USE_SDLMIXER
Only cache citem if USE_SDLMIXER.  It is unused if !USE_SDLMIXER.

Fixes: cc508be34c ("Pass selection for EVENT_NEWMENU_SELECTED")
2015-03-15 18:45:53 +00:00
Kp e1ff8afc88 Use ntstring for newmenu_item saved_text 2015-03-12 02:21:21 +00:00
Kp fd2cbdbb39 Use range_for in newmenu.cpp 2015-03-12 02:21:21 +00:00
Kp 13d85fa38e Make d1x=value imply d2x=0 and vice versa 2015-03-12 02:21:21 +00:00
Kp d1b60c2324 Pass uint_fast32_t for newmenu_* items 2015-03-12 02:21:21 +00:00
Kp 67d5bcdcef Factor out menu scroll stepping 2015-03-12 02:21:21 +00:00
Kp 45c4e09370 Cache menu->items[menu->citem] 2015-03-12 02:21:21 +00:00
Kp 65eb652895 Reduce writes in strip_end_whitespace 2015-03-12 02:21:20 +00:00
Kp 9b0a97f9d4 Flip sense of char_allowed 2015-03-12 02:21:20 +00:00
Kp 94d153e5cd Reorder ' '->'_' check 2015-03-12 02:21:20 +00:00
Kp 65810d5c77 Skip sqrt in check_vector_to_sphere_1 2015-03-12 02:21:20 +00:00
Kp 707b69220d Skip sqrt,square in check_vector_to_sphere_1 2015-03-12 02:21:20 +00:00
Kp f89262054f Skip sqrt in check_sphere_to_face 2015-03-12 02:21:20 +00:00
Kp 5f409c4948 Move quick checks up in check_sphere_to_face 2015-03-12 02:21:20 +00:00
Kp 337837ec15 Skip sqrt in special_check_line_to_face 2015-03-12 02:21:20 +00:00
Kp 76d383261c Return vm_distance_squared from check_vector_to_sphere_1 2015-03-12 02:21:20 +00:00
Kp 2c09f9fa90 Propagate special types for distance/magnitude 2015-03-12 02:21:19 +00:00
Kp f7d0c853ba Use special types for distance/magnitude 2015-03-12 02:21:19 +00:00
Kp c5bbaaaf87 Remove unused advance_sound 2015-03-11 02:19:15 +00:00
Kp 4840ddcd22 Support overriding build date/time
Help the reproducible build effort by letting the builder set a specific
date and time.
2015-03-11 02:19:15 +00:00
Kp 9f6cbbe0e0 Move Vertex_list to local scope 2015-03-11 02:19:15 +00:00
Kp b69a9438a7 Fix SDL graphics menu build failure
Fixes: a84a05c701 ("Move graphics menu to macro")
2015-03-11 02:19:15 +00:00
Kp b414758505 Add stub for player color remapping 2015-03-09 03:33:07 +00:00
Kp 72a01bf56c Add indirection for player color lookup 2015-03-09 03:33:07 +00:00
Kp 0f9aa2e94e Refactor multi_do_message 2015-03-09 03:33:07 +00:00
Kp cbe6661cee Fix effecting/affecting 2015-03-09 03:33:07 +00:00
Kp ddd9d71633 Reset object size when bashed to shield
Drakona noted in Retro that objects retain their original size when
converted to shields.  Fixed in Retro as "Objects turned into shields
were sometimes the wrong size."

Reported-by: Drakona <catherine.e.darrow@gmail.com>
2015-03-09 03:33:07 +00:00
Kp dcb2fc6524 Factor out UDP broadcast lookup 2015-03-07 17:20:41 +00:00
Kp 650831c0fe Set -O2 for debug builds
Enable optimization by default for all builds.  Users can pass -O0 if an
unoptimized build is needed.
2015-03-07 17:20:41 +00:00
Kp a84a05c701 Move graphics menu to macro 2015-03-07 17:20:41 +00:00
Kp d39d765208 Move sandbox menu to macro 2015-03-07 17:20:41 +00:00
Kp 1762470b3a Move options menu to macro 2015-03-07 17:20:40 +00:00
Kp 7349a90cc8 Remove unused multi_send_message_dialog 2015-03-03 04:36:16 +00:00
Kp cb83156132 Fix -O0 build
btb reports that clang fails to link
<77ec36b9c3 (commitcomment-9992820)>.
When building at -O0, static member glow_num has its address referenced
because the compiler does not inline non-static method
glow_num_stub::operator=.  Add a definition of this symbol.

Fixes: 77ec36b9c3 ("Convert g3_draw_morphing_model to class")
2015-03-03 04:36:16 +00:00
Kp 1f5190bcfd Fix resource leak closing SDL RW ops
Leak introduced in b3d134a6b7 ("merged
physfs branch"), but this fix only applies after the conversion to RAII.
An equivalent change from SDL_FreeRW->SDL_RWclose is needed for pre-RAII
code.

Fixes: d0de0cf963 ("Use unique_ptr for SDL_RWops")
2015-02-28 22:34:07 +00:00