Commit graph

101 commits

Author SHA1 Message Date
Kp fd1be66fa4 Pass std::span to draw_tmap, draw_tmap_flat 2022-09-24 17:47:52 +00:00
Kp d2478d0708 Require support for C++17 attribute [[fallthrough]] 2022-01-09 15:25:42 +00:00
Kp 5eaa53d220 Fix SDL-only build 2021-11-01 03:37:20 +00:00
Kp 1596fad557 Change c_tmap_scanline_shaded argument to gr_fade_level 2021-11-01 03:37:20 +00:00
Kp 7ac96996d3 Change type of pixptr to const color_palette_index* 2021-11-01 03:37:20 +00:00
Kp 494ded9e04 Expand cur_tmap_ macros inline
These date to when there was a choice.  Now, there is no choice.  The
target functions are always in C.
2021-11-01 03:37:20 +00:00
Kp 8839f538e0 Refer to <array> directly, not through "compiler-array.h" 2020-05-02 21:18:42 +00:00
Kp 53761500f1 Qualify uses of std::array 2020-05-02 21:18:42 +00:00
Kp b396445efa Require support for std::index_sequence, std::make_index_sequence
The minimum supported compiler versions now provide a depth-efficient
implementation of std::make_index_sequence, which removes the last
reason to carry a private implementation.  In the case of clang, it
appears to have a special compiler intrinsic used to implement its
std::make_index_sequence.

Switch to the compiler-provided version for both gcc and clang.
2020-04-26 17:26:23 +00:00
Kp 867223556c Fix fallthrough warning in ntmap.cpp [SDL only] 2019-07-07 22:00:02 +00:00
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 6043168d51 Move various SDL-only texture mapping functions to !DXX_USE_OGL
The OGL build compiles, but does not use, various texture mapping
functions.  Move these to be built only for the SDL build.
2017-11-01 02:01:21 +00:00
Kp 87686e5962 Pass fade value to c_tmap_scanline_shaded as a parameter
Writing it to a global so that the called function can immediately read
it back is wasteful.  Pass it as a parameter.
2017-11-01 02:01:21 +00:00
Kp 3fbc710ec5 Move various SDL-only scanline functions to !DXX_USE_OGL
The OGL build compiles, but does not use, various scanline functions.
Move these to be built only for the SDL build.
2017-11-01 02:01:20 +00:00
Kp 5e563ca3c0 Remove unused OGL c_tmap_scanline_per
scanline.cpp defined two implementations, one in a `#if 1` and the other
in an else.  Keep the enabled one.  Delete the other.
2017-11-01 02:01:20 +00:00
Kp aa6ca60a03 Remove unused OGL c_tmap_scanline_lin
Keep the SDL c_tmap_scanline_lin, which is used.
2017-11-01 02:01:20 +00:00
Kp 88832e3679 Use constexpr integral_constant for various magic numbers 2017-10-14 17:10:30 +00:00
Kp 8633b85ee4 Simplify draw_tmap interpolation
Prior changes removed most of what made the switch branches distinct.
Capitalize on that to combine identical code paths.
2017-03-10 01:22:24 +00:00
Kp 416954bbdf Pass canvas to gr_upoly_tmap 2017-02-11 21:42:40 +00:00
Kp 19151c12d9 Pass canvas to draw_tmap{,_flat} 2017-02-11 21:42:39 +00:00
Kp 2a403f74a0 Pass canvas to gr_upoly_tmap_ylr 2017-02-11 21:42:39 +00:00
Kp 742c463858 Pass canvas to texture_map_flat 2017-02-11 21:42:39 +00:00
Kp e288c20014 Pass canvas to tmap_scanline_flat 2017-02-11 21:42:39 +00:00
Kp bc91e8b789 Propagate function pointer into texture_map_flat 2017-02-11 21:42:38 +00:00
Kp 764d20d4e1 Make grs_bitmap::bm_flags private 2017-01-15 00:03:13 +00:00
zico dc46fb9528 Fixed compile-time error of software rendering build. 2016-10-31 11:44:22 +01: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 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 48dbd0333c Use static_cast for c_fp_tmap_scanline_per 2016-09-04 19:10:42 +00:00
Kp 99bbd0cf26 Mark global constants as constexpr
s/^const \([^*]*=.*;\)/constexpr \1/
2016-07-23 04:10:42 +00:00
Kp c636dc4b98 Convert various static const expressions to constexpr 2016-07-16 16:52:04 +00:00
Kp 81da15382b Remove useless cast in scanline 2016-07-15 03:43:02 +00:00
Kp 59750d3c29 Rewrite declarations of ubyte * to standard uint8_t * 2016-07-14 01:59:02 +00:00
Kp b0a2205a4e Convert various pointer casts to reinterpret_cast 2016-07-06 01:54:24 +00:00
Kp 275355994d Remove useless scanline casts 2016-07-06 01:54:24 +00:00
Kp efce2e50dc Rewrite simple integer casts from C style to static_cast<>
s/(\s*\(u\?int[[:digit:]]\+_t\s*\)\s*)\s*(/static_cast<\1>(/g
2016-07-03 00:54:15 +00:00
Kp 89ddc1b911 Add parentheses around casts of simple array subscripts
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*\(\(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(\5\6\7\8)\9/g
2016-06-25 23:21:36 +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 0cb099c5e4 Add parentheses around casts of simple function calls
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.

Exclude float|double from the second substitution.  Including it
rewrites medmisc.cpp in an incorrect way, and excluding it does not
exclude any valid rewrites.

s/(\(int\|signed\|float\|double\|long\|short\|unsigned\))\s*\(\w\+\s*(\s*\w\+\s*)\)/(\1)(\2)/
s/(\((\(int\|signed\|long\|short\|unsigned\))(\w\+\s*(\s*\w\+\s*))\))/\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 17d71ee0ae Rewrite cast of (uint) to standard type uint32_t
s/(uint)\s*\(\w\)/(uint32_t) \1/g
2016-06-12 03:45:37 +00:00
Kp 231223895d Rewrite simple pointer casts from C style to reinterpret_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*)\s*(/reinterpret_cast<\1>(/g
2016-06-05 01:04:26 +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 4324ed3771 Fix scanline casts when sizeof(size_t) is not sizeof(void*) 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 b31446340c Rewrite cast of (ubyte*) to standard type uint8_t
s/(\s*ubyte\s*\*\s*)/(uint8_t *)/g
2016-06-05 01:04:25 +00:00
Kp 27cef20eb3 Move namespace dsx handling to dsx-ns.h 2016-03-19 19:08:10 +00:00
Kp f4e1ebb576 Remove unnecessary gr_setcolor calls 2016-02-12 04:02:28 +00:00
Kp 6b9a03cf2d Pass color to gr_upoly_tmap 2016-02-12 04:02:28 +00:00
Kp 61821d0b42 Pass color to gr_upoly_tmap_ylr 2016-02-12 04:02:28 +00:00