Kp
c636dc4b98
Convert various static const
expressions to constexpr
2016-07-16 16:52:04 +00:00
Kp
a0c2ac469a
Remove useless cast in font.cpp
2016-07-15 03:43:03 +00:00
Kp
59750d3c29
Rewrite declarations of ubyte *
to standard uint8_t *
2016-07-14 01:59:02 +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
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
27cef20eb3
Move namespace dsx handling to dsx-ns.h
2016-03-19 19:08:10 +00:00
Kp
6edab5ca0a
Pass cv_font to get_centered_x
2016-02-12 04:02:28 +00:00
Kp
a92ab4079f
Cache font extent while drawing
2016-02-12 04:02:28 +00:00
Kp
85129248c9
Combine gr_internal_string0_template VideoOffset updates
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
f235d6b12b
Pass color to gr_pixel
2016-02-12 04:02:28 +00:00
Kp
1c04cb70d9
Change ogl_ubitmapm_cs constant -1 to const white
2016-02-12 04:02:28 +00:00
Kp
e07c9a5f87
Combine ft_chars, ft_allocdata into one allocation
2016-02-12 04:02:28 +00:00
Kp
17c750a101
Cache font scale values at function scope
2016-02-10 03:58:05 +00:00
Kp
5c75d19dba
Fold ogl_internal_string calls to ogl_ubitmapm_cs
2016-02-10 03:58:05 +00:00
Kp
71d4c3a0e1
Reuse gr_init_font for gr_remap_font
2016-02-06 22:12:55 +00:00
Kp
5d9c64e8fc
Fuse gr_string test/add
2016-02-06 22:12:55 +00:00
Kp
499060ef4c
Use open_font[] only for color fonts
2016-01-10 21:18:09 +00:00
Kp
677c70c64e
Move font filename into grs_font
2016-01-10 21:18:09 +00:00
Kp
54d5ab84ca
Refactor gr_string delegation
2016-01-10 21:18:09 +00:00
Kp
609f4e9261
Remove vsprintf in 2d/font.cpp
2016-01-10 21:18:08 +00:00
Kp
5d4fff1534
Combine gr_printf/gr_uprintf into template
2016-01-10 21:18:08 +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
Kp
be04d3a4f9
Rewrite CLI
...
Remove artificial length limit on input.
Enable multi-line display of input.
2015-12-22 04:18:52 +00:00
Kp
8d7a78d448
Pass font to get_char_width
2015-12-22 04:18:50 +00:00
Kp
db9fb0ed42
Move more symbols into namespace dcx/dsx
2015-12-22 04:18:50 +00:00
Kp
e59fde57e7
Enable gr_remap_color_fonts in D1
...
This looks like a useful fix that was developed after Descent 1 was
released. Backport it. This reduces differences between the engines.
2015-12-18 04:08:24 +00:00
Kp
e0a88f4b7b
Move TexFilt to CCfg
2015-12-18 04:08:23 +00:00
Kp
26e948d5f1
Uninline namespace dsx
2015-12-13 18:00:49 +00:00
Kp
dc8c0323d8
Uninline namespace dcx
2015-12-13 18:00:49 +00:00
Kp
85d7c495e8
Use inline namespace dsx for similar/2d
2015-12-13 18:00:48 +00:00
Kp
aaaa7e6aa4
Make font datasize const after fixup
2015-12-04 03:36:32 +00:00
Kp
8a97c173a3
Remove useless gr_remap_mono_fonts
...
gr_remap_mono_fonts searches for fonts with !(font->ft_flags & FT_COLOR)
and calls gr_remap_font on any it finds.
gr_remap_font starts with:
if (!(font->ft_flags & FT_COLOR))
return;
2015-12-04 03:36:32 +00:00
Kp
f509073b65
Move font allocdata pointer to grs_font
2015-11-14 18:17:21 +00:00
Kp
74290b5150
Add some error checking to font loader
2015-11-14 18:17:21 +00:00
Kp
b36d95dccd
Use generate_n to initialize font chars
2015-10-09 02:46:09 +00:00
Kp
50f672ba34
Reuse computed string length
2015-09-29 02:41:22 +00:00
Kp
0c0c93ca34
Refactor gr_string clipping checks
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
609e6ca584
Flip direction of bit scan
...
Fixes: b1c112d121
("Fix -Og -Wuninitialized warning in gr_internal_string_clipped_template")
2015-09-24 03:05:16 +00:00
Kp
3c29742698
Flip direction of bit scan
...
Fixes: fc5611dc77
("Fix -Og -Wuninitialized warning in gr_internal_string0_template")
2015-09-24 03:05:16 +00:00
Kp
b1c112d121
Fix -Og -Wuninitialized warning in gr_internal_string_clipped_template
2015-09-13 21:02:19 +00:00
Kp
fc5611dc77
Fix -Og -Wuninitialized warning in gr_internal_string0_template
2015-09-13 21:02:19 +00:00
Kp
c4a8432081
Remove WORDS_NEED_ALIGNMENT memcpy src cast to const uint8_t*
...
The cast provokes a warning on systems that require alignment, so remove
it. memcpy takes const void* input, so the cast is unnecessary.
Reported-by: MattWatt <https://github.com/dxx-rebirth/dxx-rebirth/issues/119 >
2015-09-13 21:02:19 +00:00
Kp
17b1943c5e
Mark various per-file structures as static
2015-08-12 03:11:46 +00:00
Kp
c942d28197
Use accessor for grs_bitmap::bm_type
2015-07-25 23:10:47 +00:00
Kp
78f6dc29a6
Cache font scale Y float
2015-06-13 22:42:20 +00:00
Kp
869d0ffdc5
Optimize gr_get_string_size
...
Cache cv_font.
Defer updating longest_width.
Compute line height once at the end.
2015-06-13 22:42:20 +00:00
Kp
e57afde68b
Hoist store in gr_internal_string0_template
2015-05-09 17:39:02 +00:00
Kp
8ac92b098f
Cache variables in gr_internal_string0_template
2015-05-09 17:39:02 +00:00
Kp
bd5573356d
Reduce gr_internal_string0_template variable scope
2015-05-09 17:39:02 +00:00
Kp
4228ed2324
Switch gr_internal_string0_template to count down loop
2015-05-09 17:39:02 +00:00
Kp
6d9de0d177
Use partial_range for font width
2015-05-09 17:39:02 +00:00
Kp
d2cded3ad4
Combine gr_internal_string0{,m}
2015-05-09 17:39:01 +00:00
Kp
b1ed5b86e2
Return get_char_width results by value
2015-05-09 17:39:01 +00:00
Kp
21aed0488f
Hoist gr_setcolor in gr_internal_string_clipped_template
2015-05-09 17:39:00 +00:00
Kp
2fc4ca8d5a
Cache variables in gr_internal_string_clipped_template
2015-05-09 17:39:00 +00:00
Kp
bbadf1fe3e
Reduce gr_internal_string_clipped_template variable scope
2015-05-09 17:38:59 +00:00
Kp
9d238af808
Switch gr_internal_string_clipped_template to count down loops
2015-05-09 17:38:59 +00:00
Kp
2d423ca383
Combine gr_internal_string_clipped{_m}
2015-05-09 17:38:59 +00:00
Kp
aea5df067d
Cache locals in get_char_width
2015-05-09 17:38:59 +00:00
Kp
4b0f257698
Pass find_kern_entry grs_font by &
2015-05-09 17:38:59 +00:00
Kp
1017802e48
Combine get_char_width and get_char_width_f as template
2015-05-09 17:38:59 +00:00
Kp
c9ef463a16
Mark gr_message_color_level const
2015-05-09 17:38:59 +00:00
Kp
f668705f20
Use array<> for Computed_colors
2015-04-26 20:15:57 +00:00
Kp
67e5e8c6c1
Remove unused gr_make_blend_table
2015-04-26 20:15:57 +00:00
Kp
ace2235ad8
Remove unused gr_make_cthru_table
2015-04-26 20:15:57 +00:00
Kp
9274e56a41
Simplify gr_find_closest_color exit
2015-04-26 20:15: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
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
Kp
93589368c9
Move PHYSFSX_putc to the one file that uses it
2015-01-29 04:27:36 +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
49bf64c9b6
Use range_for in pcx_encode_line
2015-01-20 02:46:42 +00:00
Kp
f7815810e8
Use RAIIPHYSFS_File to manage PHYSFS_File
...
Fixes a few leaks on error paths.
2015-01-17 18:31:42 +00:00
Kp
68d705a85a
Use bool conversion to test PHYSFS_File pointer
2015-01-17 18:31:42 +00:00
Kp
6dc36deb74
Pass get_font_total_width arg by &
2014-12-02 03:35:01 +00:00
Kp
c89e3b7452
Pass gr_bitmapm arg as &
2014-12-02 03:35:01 +00:00
Kp
95539512d5
Pass pcx_read_bitmap arg by &
2014-12-02 03:35:01 +00:00
Kp
5eddc2c197
Make bitmap bm_data const where easy
2014-12-02 03:24:38 +00:00
Kp
0e63b3c300
Pass pcx_encode_line input as const
2014-11-30 22:09:22 +00:00
Kp
2697918223
Pass gr_bm_pixel arg by &
2014-11-30 22:09:22 +00:00
Kp
26f4aaa51b
Pass gr_set_transparent arg by &
2014-11-30 22:09:21 +00:00
Kp
efa7566821
Pass colormap as array<>
2014-11-30 22:09:21 +00:00
Kp
ef539be1ab
Pass gr_init_bitmap_data arg by &
2014-11-30 22:09:21 +00:00
Kp
f6dde1c593
Pass gr_init_bitmap_alloc arg by &
2014-11-30 22:09:21 +00:00
Kp
53ce29e789
Pass gr_init_bitmap arg by &
2014-11-30 22:09:20 +00:00
Kp
97332b848c
Pass gr_free_bitmap_data arg by &
2014-11-30 22:09:20 +00:00
Kp
a86313e746
Pass ogl_init_texture arg by &
2014-11-30 22:09:19 +00:00
Kp
166f15617d
Pass ogl_ubitmapm_cs arg by &
2014-11-30 22:09:18 +00:00
Kp
2e59c6f80a
Improve loops in font handling
2014-11-25 04:03:13 +00:00
Kp
841e037e15
Pass ogl_loadbmtexture_f arg by &
2014-11-13 03:42:41 +00:00
Kp
3bb04d0d07
Clear unowned font pointer when font is freed
2014-10-01 02:14:41 +00:00
Kp
55b0dea7c6
Propagate for variables in similar/2d/font.cpp
2014-09-26 02:42:12 +00:00
Kp
703f60ac3f
Fix -Wtype-limits warnings
2014-09-21 21:41:55 +00:00
Kp
94550355a8
Use make_unique instead of bare new
2014-08-24 18:28:09 +00:00
Kp
cb352968b8
Fix !OGL build in gr_internal_color_string
2014-08-08 02:52:56 +00:00
Kp
b276590998
Change gr_fade_table to array<array<>>
2014-08-08 02:50:27 +00:00
Kp
f47aa29cd9
Use color_t for color values
2014-08-08 02:07:47 +00:00
Kp
1560dd43e1
Use unique_ptr for font->ft_bitmaps
2014-08-07 03:09:28 +00:00
Kp
fd6a7c218e
Use unique_ptr for font->ft_chars
2014-08-07 03:05:48 +00:00
Kp
fbf1c1f413
Throw on too many fonts open
2014-07-22 23:48:23 +00:00
Kp
c1d184240d
Use unique_ptr to manage fonts
2014-07-22 23:48:23 +00:00
Kp
bd1c6d8c5d
Reduce header includes of physfsx.h
2014-07-22 23:48:23 +00:00
Kp
e63e46f8f0
List initialize PCX header
2014-07-04 03:46:40 +00:00
Kp
048d4bcc8f
List initialize bitmap
2014-07-04 03:45:35 +00:00
Matt Vandermeulen
28f307eb85
Fixes #5 - Byteswap header renamed to byteutil, plus sed magic
...
[Kp: switch to #pragma for byteutil.h]
2014-07-03 02:03:08 +00:00
Kp
7f3ad84094
Use std::swap instead of inline swap
2014-06-08 00:05:33 +00:00
zico
ad7cb106bc
Changed custom D1X license to GPLv3
2014-06-01 19:55:23 +02:00
zico
ab4975bab0
Reverted commit 347292d866
2014-06-01 19:08:17 +02:00
Kp
073f00974a
Eliminate uses of the typedef struct X { ... } X; pattern
...
C++ does not require this pattern.
import re, fileinput
to = re.compile(r'^typedef struct ([a-z_A-Z]+)\s*{')
tc = re.compile(r'^}(.*?)\s*([a-z_A-Z]+);$')
osn = None
for line in fileinput.input(inplace=True):
m = to.match(line)
if m:
osn = m.group(1)
print 'struct %s\n{' % osn
continue
if osn:
m = tc.match(line)
if m:
csn = m.group(2)
if osn == csn:
print '}%s;' % m.group(1)
osn = None
continue
else:
osn = None
print line,
2013-12-28 22:48:07 +00:00
Kp
b1c5307eb1
Use array for palette_array_t
2013-12-22 00:37:36 +00:00
Kp
e9f9cb676f
Centralize palette utilities
2013-12-22 00:05:13 +00:00
Kp
a3d66a3b37
Add typedef palette_array_t for palette data
2013-12-22 00:05:13 +00:00
Kp
1e8036bd24
Split compiler.h for PCH compatibility
2013-12-21 05:12:38 +00:00
Kp
c3c1695ba5
Use gr_ustring instead of gr_uprintf where possible
2013-12-17 04:03:34 +00:00
Kp
1bf3722670
Use gr_string instead of gr_printf where possible
2013-12-17 04:03:34 +00:00
Kp
3b9b5ebfb0
Use RAII to manage function-local heap objects
2013-12-08 19:04:52 +00:00
Kp
75c229c6bf
Normalize con_printf newline usage
2013-12-07 21:13:37 +00:00
Kp
61d8fe7cc8
Remove unused return value of gr_*printf / gr_*string
2013-12-07 18:44:07 +00:00
Kp
60727dd7d5
Add missing va_end calls
2013-12-07 18:42:50 +00:00
Kp
f6125b5f2d
Fix array overstep on invalid PCX error number
2013-12-07 18:41:40 +00:00
Kp
ff35f946a9
Move char_bm into gr_internal_color_string
2013-12-06 03:58:38 +00:00
Kp
2714679284
Mark private functions static
2013-11-02 04:23:55 +00:00
Kp
a6b1bd58a2
Use MALLOC consistently
2013-10-26 03:50:27 +00:00
Kp
c58c4e4d06
Move declarations to headers
2013-10-03 03:11:52 +00:00
Kp
f9899a9f20
Mark various functions static
2013-10-03 03:11:51 +00:00
Kp
4d026f8b69
Move similar/2d/pcx.c -> similar/2d/pcx.cpp
2013-10-01 02:53:09 +00:00
Kp
f4c25c4e9a
Move similar/2d/palette.c -> similar/2d/palette.cpp
2013-10-01 02:53:09 +00:00
Kp
381c2e0781
Move similar/2d/font.c -> similar/2d/font.cpp
2013-10-01 02:53:09 +00:00
Kp
a881ee455e
Remove fix.h
2013-08-08 03:01:48 +00:00
Kp
e23a06fb4f
Drop worthless font zeroing
...
BSS is initialized to zero. Explicitly zeroing it again wastes time and
space.
2013-08-08 03:01:47 +00:00
Kp
d10aaea55b
Mark various font functions static
2013-07-27 21:41:27 +00:00
Kp
934867aaf3
Ensure font allocation failure if tw/th not initialized
2013-07-27 21:41:09 +00:00
Kp
14f6b9baff
Use unsigned iteration counters in bald_guy_load
2013-07-21 21:42:09 +00:00
Kp
46664b522b
Fix probable infinite loop in bald_guy_load
2013-07-21 21:42:09 +00:00
Kp
d1e4a68a3b
Use MALLOC in bald_guy_load
2013-07-21 21:42:09 +00:00
Kp
4577dd3977
Merge branch 'd2x-rebirth/master' into unification/master
2013-07-21 21:34:46 +00:00
Kp
a1ba420031
Mark various parameters and variables as const
2013-07-20 23:12:24 +00:00
Kp
5648874a37
Merge branch d2x-rebirth/master into unification/master
2013-06-14 03:31:59 +00:00
Kp
544a07bffa
Move */2d/palette.c -> similar/2d/palette.c
2013-03-03 01:03:33 +00:00
Kp
61001e1d94
Move */2d/pcx.c -> similar/2d/pcx.c
2013-03-03 01:03:33 +00:00
Kp
606a455c88
Move */2d/font.c -> similar/2d/font.c
2013-03-03 01:03:33 +00:00