Commit graph

89 commits

Author SHA1 Message Date
Kp 1b57e9a5ff Pass canvas to show_fullscr 2017-01-01 00:45:43 +00:00
Kp 250bf58e51 Pass canvas to gr_bitmapm 2017-01-01 00:45:43 +00:00
Kp 99f5cfbb10 Pass canvas to ogl_ubitmapm_cs 2016-12-29 03:27:12 +00:00
Kp 1e1272fcf2 Cache temporaries in show_briefing_bitmap
Avoid recomputing the same width/height expressions.  This saves ~20
instructions and ~100 bytes on x86_64-pc-linux-gnu.
2016-12-29 03:27:11 +00:00
zico 3672bbd1f2 Made show_briefing_bitmap() properly consider HIRESMODE (i.e. Mac data), using scaling logic from show_animated_bitmap(). 2016-12-28 16:28:08 +01:00
Kp 47de4e2906 Pass grs_bitmap &to swap_0_255 2016-11-19 17:24:52 +00:00
Chris Taylor 143ed30fee Merging in unification/master, resolving conflict in similar/main/kmatrix.cpp 2016-11-06 14:20:18 +08:00
Kp 3081e69536 Pass grs_main_bitmap to gr_init_bitmap_alloc 2016-10-29 23:16:15 +00:00
Chris Taylor 7ac820248c Use new event_process_all() for event loops that check for window_event_result::deleted (which is most of them) 2016-10-29 20:06:01 +08:00
Chris Taylor 54dbe586ee Check for window_event_result::deleted for do_briefing_screens polling loop
This is instead of using window_exists, which could give a false positive if a new window was allocated with the same pointer value as a deleted one.
2016-10-28 15:45:40 +08:00
Chris Taylor f1548e075e Check for window_event_result::deleted for show_title_screen polling loop
This is instead of using window_exists, which could give a false positive if a new window was allocated with the same pointer value as a deleted one.
2016-10-28 15:40:50 +08:00
Chris Taylor 2d587de8dc Make call_default_handler return a window_event_result
Make call_default_handler return a window_event_result to inform the event system in future, particularly if a window was closed.
2016-10-27 16:36:24 +08:00
Kp 27d0a79acd Factor out reporting errors caused by bad levels 2016-10-17 03:49:32 +00:00
Kp 01f2932824 Pass grs_canvas &to window_create 2016-10-15 00:53:20 +00:00
Chris Taylor 60ac1eaad3 Replace delete dcx::window kludge with a better solution
Replace delete dcx::window kludge with a better solution: instead of requiring every handler to delete the window, add a window_event_result::deleted, which gets returned if the window was deleted by the handler, so window_close knows not to attempt to delete it again.
2016-10-04 14:05:44 +08:00
Chris Taylor 87617e8ac9 Allow dcx::window struct to be subclassed - step 3
Allow dcx::window struct to be subclassed step 3. This step adds the window destructor and both requires and implements the window to be deleted by the event handler/client in all cases.
2016-10-02 17:49:19 +08:00
Kp 62b58e9890 Move OGL to dxxsconf.h; rename to DXX_USE_OGL
Rename symbol OGL to DXX_USE_OGL 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 were
manual.

git grep -lzw OGL -- '*.h' '*.cpp' | xargs -0 sed -i -e 's/\(\s*#\s*if\)def\s*OGL/\1 DXX_USE_OGL/' -e 's/\(\s*#\s*if\)ndef OGL/\1 !DXX_USE_OGL/' -e 's/\(\s*#\s*if !\?\)defined(OGL)/\1DXX_USE_OGL/'
2016-09-24 18:06:11 +00:00
Kp 7a13d3f228 Include dxxsconf.h explicitly and earlier 2016-09-24 18:06:10 +00:00
Kp 6a3ded191f Move EDITOR to dxxsconf.h; rename to DXX_USE_EDITOR
Rename symbol EDITOR to DXX_USE_EDITOR 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 were
manual.

git grep -wl EDITOR -- '*.h' '*.cpp' | xargs sed -i -e 's/^\s*#ifdef \(EDITOR\)\>/#if DXX_USE_\1/' -e 's/\s*#\(el\)\?if \(.*\)defined(\(EDITOR\))/#\1if \2DXX_USE_\3/' -e 's/^\s*#ifndef \(EDITOR\)\>/#if !DXX_USE_\1/'
2016-09-11 18:49:16 +00:00
Kp 1402a21946 Reintroduce D1 title song bug
In past releases, D1X-Rebirth played the title song even when the user
specified `-notitles`.  Commit 29f79f0a6b
("Enable -notitles for Descent 2") fixed this.  Unfortunately, despite
being called SONG_TITLE, users believe this to be main menu music, not
title screen music.  This belief is reinforced by other code sites that
play the title song on returning to the main menu.  Reintroduce the bug
by moving the call above the test for `-notitles`.  This restores the
semantics that users expect.
2016-08-28 22:41:49 +00:00
Kp 1b2052e2bc Fold do_end_briefing_screens calls to songs_play_song 2016-08-28 22:41:47 +00:00
Kp ee1003f29f Move conditionally compiled code into namespace dsx 2016-08-25 04:05:32 +00:00
Kp dd483773e0 Factor out repeated HIRESMODE tests 2016-07-31 22:25:49 +00:00
Kp c636dc4b98 Convert various static const expressions to constexpr 2016-07-16 16:52:04 +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 dcc56e6b39 Propagate bm_mode::linear into iff_read_bitmap 2016-05-28 17:31:27 +00:00
Kp c00f918a8e Propagate bm_mode::linear into bald_guy_load 2016-05-28 17:31:26 +00:00
Kp 3fb16c1d7a Propagate bm_mode::linear into pcx_read_bitmap 2016-05-28 17:31:26 +00:00
Kp 398596c468 Use enum for bitmap mode 2016-05-28 17:31:26 +00:00
Kp b57f08c798 Use partial_const_range 2016-02-12 04:02:28 +00:00
Kp 1f91897f5d Move some game symbols to namespaces 2016-01-09 16:38:12 +00:00
Kp cbd2cd7c54 Move SysNoTitles to CArg 2015-12-24 04:01:27 +00:00
Kp 61fe046ba2 Reuse show_first_found_title_screen for Descent 1
This avoids an Error call if none of the titles are available.
2015-10-09 02:46:11 +00:00
Kp 29f79f0a6b Enable -notitles for Descent 2 2015-10-09 02:46:09 +00:00
Kp 6224b53581 Use operator?: for flash_cursor gr_set_fontcolor 2015-09-29 02:41:22 +00:00
Kp d9cef82f81 Allow nullptr for gr_get_string_size 2015-09-29 02:41:22 +00:00
Kp 17b1943c5e Mark various per-file structures as static 2015-08-12 03:11:46 +00:00
Kp 5573ed6bea Cache font scale X float 2015-06-13 22:42:20 +00:00
Kp 6792c1bc4b Enable -Wunused-parameter 2015-04-26 20:15:56 +00:00
Kp 6b6eaef226 Include polyobj.h from robot.h
Swap the inclusion order since all robots are polyobjects, but not all
polyobjects are robots.
2015-04-02 02:36:57 +00:00
Kp ae8b99ae7d Use RAIIdigi_sound for briefing printing_channel 2015-04-02 02:36:55 +00:00
Kp b60c603e21 Avoid redundant PHYSFSX_exists checks 2015-04-02 02:36:55 +00:00
Kp 61ee6463aa Remove unused show_title_screen return value 2015-04-02 02:36:55 +00:00
Kp b36ce28382 Remove unnecessary strcpy in titles.cpp 2015-04-02 02:36:55 +00:00
Kp 66806e1f34 Enable -Wmissing-braces
clang includes it in -Wall, so add it for gcc
2015-04-02 02:36:52 +00:00
Bradley Bell 51de6c80b5 Don't play chattering over D1 briefing music. 2015-02-08 12:26:36 -08:00
Bradley Bell 2b4aba341d Properly scale and simplify arithmetic for briefing bitmap.
Constrain by screen height, by just using rescale_y for width and height.
Then use show_fullscr to fill the destination canvas.
2015-02-07 22:48:04 -08:00
Bradley Bell 33f0731d11 Remap briefing bitmap. 2015-02-07 22:47:18 -08:00
Kp 99a4a0ed62 Capture range_for by-value temporaries as const
Modifying a by-value temporary does not affect the underlying container,
so modifying it is almost always a bug.  Require use of a by-reference
capture when modification is desired.

sed -i -e 's/range_for\s*(\s*\(const\s\+\)\?auto\s\+\([[:alpha:]_]\)/range_for (const auto \2/g'
2015-02-05 03:03:49 +00:00