Commit graph

215 commits

Author SHA1 Message Date
Kp 8d1bd87b33 Pass canvas to ogl_internal_string 2017-01-08 22:31:58 +00:00
Kp 0905aefa0a Pass canvas to gr_rect 2017-01-01 00:45:45 +00:00
Kp 774dedd21d Pass canvas to gr_bm_pixel 2017-01-01 00:45:44 +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 ef06aa089a Pass canvas to gr_pixel 2016-12-29 03:27:09 +00:00
Kp 29c912d2da Fid -Wold-style-cast warning in SDL-only code 2016-12-29 03:27:08 +00:00
Kp b3809266a3 Use enumerate in more loops 2016-12-11 01:56:44 +00:00
Chris Taylor cc3f35649f Change all occurrences of "Couldn't" to "Could not" for consistency ("Could not" is more common and wins).
Not touching TXT_COULDNT because it's stored separately in hog file.
2016-11-13 13:27:18 +08:00
Kp 3081e69536 Pass grs_main_bitmap to gr_init_bitmap_alloc 2016-10-29 23:16:15 +00:00
Kp 88c73c010a Preserve type information on font-scaled floats 2016-10-15 00:53:15 +00:00
Kp b2f744f1f8 Remove unnecessary diminish_palette in pcx_write_bitmap
The variable is never read after that diminish_palette call, whether in
pcx_write_bitmap or in its sole caller.
2016-10-02 00:34:49 +00:00
Kp e11ac102a6 Cache bitmap properties in pcx_write_bitmap 2016-10-02 00:34:49 +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
zico 1f144f167c Addition for 6c6a32ba92, allowing edge padding for level and polymodel texturees only but disable it for sprites, fonts, hud images, etc. as those looked bad with this form of color bleeding in combination with various texture filtering mechanics. 2016-09-17 15:56:43 +02:00
Kp 5a98beae64 Switch font.cpp to static_cast 2016-09-04 00:02:51 +00:00
zico b2cad09c26 Added new texture filtering options based on patch of user 'beware' 2016-08-29 20:53:10 +02:00
Kp 6dc16bf468 Remove useless cast in similar/2d/pcx.cpp 2016-08-17 04:44:22 +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 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