Commit graph

115 commits

Author SHA1 Message Date
Kp 10aa2e5106 Move some kconfig symbols into namespace dsx 2016-12-22 05:21:16 +00:00
Kp 0109355ae0 Switch kconfig_handler to D2 mouse button semantics
Presumably, D2 switched to EVENT_MOUSE_BUTTON_UP for a good reason.
Switch D1 to that rule too.
2016-12-22 05:21:16 +00:00
zico 8bd3eaad4c Fixed misleading indentations. 2016-10-31 11:36:48 +01:00
Kp 902e242194 Remove redundant store in kconfig_read_controls
Adjust the value as a local, then write it back when finished.
2016-10-28 03:39:40 +00:00
Kp a0d614e6b0 Use clamp_symmetric_value in kconfig_read_controls
Avoid open-coding the test.
2016-10-21 02:16:48 +00:00
Kp 01f2932824 Pass grs_canvas &to window_create 2016-10-15 00:53:20 +00:00
Kp e05603b0d7 Fold kconfig_draw gr_string label calls 2016-10-15 00:53:15 +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 4894117d70 Rename MAX_HATS_PER_JOYSTICK to DXX_MAX_HATS_PER_JOYSTICK
Rename symbol MAX_HATS_PER_JOYSTICK to DXX_MAX_HATS_PER_JOYSTICK
to show that it is a DXX symbol, not one inherited from a library.

git grep -lzw MAX_HATS_PER_JOYSTICK -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_HATS_PER_JOYSTICK\>/DXX_&/g'
2016-09-25 04:52:49 +00:00
Kp 94937de128 Rename MAX_BUTTONS_PER_JOYSTICK to DXX_MAX_BUTTONS_PER_JOYSTICK
Rename symbol MAX_BUTTONS_PER_JOYSTICK to DXX_MAX_BUTTONS_PER_JOYSTICK
to show that it is a DXX symbol, not one inherited from a library.

git grep -lzw MAX_BUTTONS_PER_JOYSTICK -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_BUTTONS_PER_JOYSTICK\>/DXX_&/g'
2016-09-25 04:52:49 +00:00
Kp 7d38a9f0be Rename MAX_AXES_PER_JOYSTICK to DXX_MAX_AXES_PER_JOYSTICK
Rename symbol MAX_AXES_PER_JOYSTICK to DXX_MAX_AXES_PER_JOYSTICK to show
that it is a DXX symbol, not one inherited from a library.

git grep -lzw MAX_AXES_PER_JOYSTICK -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_AXES_PER_JOYSTICK\>/DXX_&/g'
2016-09-25 04:52:49 +00:00
Kp f24e9f836c Rename MAX_JOYSTICKS to DXX_MAX_JOYSTICKS
Rename symbol MAX_JOYSTICKS to DXX_MAX_JOYSTICKS to show that it is a DXX
symbol, not one inherited from a library.

git grep -lzw MAX_JOYSTICKS -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_JOYSTICKS\>/DXX_&/g'
2016-09-25 04:52:48 +00: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 ee1003f29f Move conditionally compiled code into namespace dsx 2016-08-25 04:05:32 +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 34e608e14c Cache kconfig fspacx/fspacy values 2016-04-02 21:26:00 +00:00
Kp f319882e40 Factor out kc_drawinput BM_XRGB usage 2016-04-02 21:26:00 +00:00
Kp 1787a4c2c5 Fix color saturation in kconfig boxes
BM_XRGB doubles its inputs.  35a4736 doubled the inputs explicitly, but
passed them back to BM_XRGB, which doubled them again.  Switch to a
direct call to gr_find_closest_color to skip the second double pass.

Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/192>
Fixes: 35a4736df0 ("Pass color to gr_urect")
2016-04-02 21:25:59 +00:00
Kp cc18ad2b68 Fix some -Wshadow warnings 2016-02-12 04:02:28 +00:00
Kp f4e1ebb576 Remove unnecessary gr_setcolor calls 2016-02-12 04:02:28 +00:00
Kp 23047b1165 Pass color to gr_rect 2016-02-12 04:02:28 +00:00
Kp 35a4736df0 Pass color to gr_urect 2016-02-12 04:02:28 +00:00
Kp 86709f547b Fix capitalization of PHYSFS_File
Per comment in physfs.h, the spelling PHYSFS_file is deprecated.
Replace all instances with PHYSFS_File.
2016-01-09 16:38:14 +00:00
zico 731fb5204e Adjusted keyboard ramp scaling based on observation that the original game uses a keyboard ramp of 8 frames. Full sensitivity should reflect 60FPS behaviour, half sensitivity reflects 30FPS behaviour (give or take a frame). Ramping should be properly time-scaled now. 2015-12-14 15:19:59 +01:00
Kp 6111e5adbf Allow configuring max joysticks at build time 2015-11-01 21:15:40 +00:00
Kp add7a80bfc Fix binding mouse button to arm fusion/omega cannon
Commit 3adc5fe77a added the ability to
bind mouse buttons to change weapons, but a copying error bound the
fusion/omega entry to joystick instead of mouse.  Switch it to mouse as
clearly intended.

This fix is needed for any commit with the underlying feature, but only
applies cleanly to 0.58.1 after applying cleanup commits:

    00381b2652 ("Abstract out weapon names")
    d035fb258a ("Remove unused kc_item->id")
    fc1e00dae6 ("Pre-compute labelx+inputx")
    a4f3c93247 ("Separate mutable and const kconfig data")
    953a1888d7 ("Combine state pointer and count pointer")
    2bd302cddd ("Move Controls ubyte values into substructure")
    ff8db8d39e ("Reduce relocations for Controls members")
    593d0b25ff ("Remove duplicate kconfig labels")
    dc36ee3ab3 ("Store kconfig labels separately")

Fixes: 3adc5fe77a ("Saving  weapon keys in PLX like in D1X-Rebirth" ...)
2015-11-01 21:15:38 +00:00
Kp 3a4adbc917 Let kconfig skip zero-width kc_item cells 2015-11-01 21:15:38 +00:00
Kp 545b71c1cc Use enum class for kconfig subtype 2015-11-01 21:15:38 +00:00
Kp 50f672ba34 Reuse computed string length 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
zico f8f9843f35 Mouse overrun improvements: Reduced the range of Overrun (from 32 to 16) based on feedbach and restored original mouse base divisor for mouse X/Y axes (changed in 5a36ffdb17) 2015-09-25 12:07:30 +02:00
zico d3660207d2 Added Mouse Overrun Buffer option as proposed by kp 2015-09-24 16:31:10 +02:00
Kp 69e3762933 Return joystick axis values by reference 2015-09-19 23:04:34 +00:00
zico b5ac86c4f0 Slightly modified keyboard pitch and heading sensitivity so highest setting matches the original game running at ~60 FPS 2015-08-29 15:46:03 +02:00
Kp 17b1943c5e Mark various per-file structures as static 2015-08-12 03:11:46 +00:00
Kp bc7c469ab2 Use array<> for more globals 2015-08-12 03:11:46 +00:00
Kp c80d12319a Use unqualified begin/end
Most call sites use unqualified begin/end and rely on using declarations
to pick an appropriate implementation.  Fix the sites that explicitly
requested std::begin/std::end.
2015-08-03 03:11:25 +00:00
Kp 6bd93e466f Guard args.h for LTO -Wodr 2015-07-18 21:01:56 +00:00
Kp 241ea1722d Cache kconfig_read_controls FrameTime 2015-06-25 02:48:43 +00:00
Kp 83f1b1414b Cache speed_factor*FrameTime 2015-06-25 02:48:42 +00:00
Kp 882ffdebb0 Use operator?: in kconfig 2015-06-25 02:48:42 +00:00
Kp bc3a1402b2 Reduce wasted work in kconfig 2015-06-25 02:48:42 +00:00
Kp 0c106b67f2 Make convert_raw_joy_axis static 2015-06-23 03:04:47 +00:00
Kp 2d70cd65ea Cache font space results 2015-06-13 22:42:20 +00:00
Kp 78f6dc29a6 Cache font scale Y float 2015-06-13 22:42:20 +00:00
Kp 5573ed6bea Cache font scale X float 2015-06-13 22:42:20 +00:00
John Ackerman fe71a94d53 Implement Nonlinear Joystick Settings
[Kp: fix whitespace; squash fixes into main]
Requested-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/pull/84>
2015-06-11 01:41:26 +00:00