Commit graph

12077 commits

Author SHA1 Message Date
Kp e377ac3caf Pass std::span to convert_pattern_array 2022-09-24 17:47:53 +00:00
Kp 0cb9ab58b0 Pass std::span to print_pattern_array 2022-09-24 17:47:53 +00:00
Kp 6de5587a06 Pass std::span to nd_read_string 2022-09-24 17:47:53 +00:00
Kp f91d0c404c Pass std::span to set_briefing_filename 2022-09-24 17:47:53 +00:00
Kp 9d238eedf8 Pass std::span to callsign_t::copy 2022-09-24 17:47:53 +00:00
Kp 81b77d2f28 Pass std::span to create_bfs_list 2022-09-24 17:47:53 +00:00
Kp 8811836e2e Make cstring_tie inherit from array
Switch to `using` the `begin` method instead of defining a wrapper.
2022-09-24 17:47:53 +00:00
Kp 294a78a1aa Pass std::span to powerup_basic_str 2022-09-24 17:47:53 +00:00
Kp 1b170fe880 Pass std::span to print_exit_message 2022-09-24 17:47:53 +00:00
Kp ea5d0136dc Pass std::span to msgbox_warning 2022-09-24 17:47:53 +00:00
Kp 6d0a5f5783 Pass std::span to location_value_wrapper::prepare_buffer 2022-09-24 17:47:53 +00:00
Kp 56a68f3c63 Pass std::span to con_force_puts 2022-09-24 17:47:53 +00:00
Kp 27ec8f41ba Pass std::span to con_add_buffer_line 2022-09-24 17:47:52 +00:00
Kp a76f5d9248 Use std::array for location_wrapper::scratch_buffer 2022-09-24 17:47:52 +00:00
Kp ae5e5c699a Use std::array for console_buffer::line 2022-09-24 17:47:52 +00:00
Kp 23315ebec2 Fix SDL-only g3_draw_sphere overflow test
PF_OVERFLOW is part of p3_flags, not p3_codes.  Testing p3_codes meant
that the disk would be drawn when CC_OFF_RIGHT was unset.  This seems
unlikely to be what was intended, so fix the mismatch by switching to
use p3_flags instead of switching the symbolic constant.
2022-09-24 17:47:52 +00:00
Kp b1da47a34b Compare d1 extra pig in place
Instead of creating a copy, modifying the copy, and comparing to it, use
std::span to pass down the maximum allowed length for comparison.
2022-09-24 17:47:52 +00:00
Kp c464ddeae1 Sanitize control center triggers on load
Descent 2: Vertigo level 10 has invalid data in its control center
triggers.  Sanitize invalid data at load to avoid problems in
memory-poisoning builds.
2022-09-24 17:47:52 +00:00
Kp ad7057be87 Add hack for case mismatch in Vertigo robot movies
PhysFS 3 is case-sensitive for movie filename lookup.  The consequence
of this was first reported in [1].  In [2], @icculus stated this was a
bug in PhysFS 3 that would be fixed in PhysFS 3.0.2.  However, [3] and
[4] assert that the fix was never included.  The existence of [5] seems
to support this.  The original problem was reported in 2019.  As of
2022, user @AlumiuN, running PhysFS 3.0.2, is affected.  Therefore, this
commit adds code to detect the relevant robot movies and adjust the case
in the Rebirth code.

[1]: https://github.com/dxx-rebirth/dxx-rebirth/issues/379
[2]: https://github.com/dxx-rebirth/dxx-rebirth/issues/379#issuecomment-389400528
[3]: https://github.com/dxx-rebirth/dxx-rebirth/issues/379#issuecomment-462083489
[4]: https://github.com/dxx-rebirth/dxx-rebirth/issues/379#issuecomment-477790175
[5]: https://github.com/dxx-rebirth/dxx-rebirth/issues/644
2022-09-24 17:47:52 +00:00
Kp 9fa97573c4 Move RoboFile to briefing scope 2022-09-24 17:47:52 +00:00
Kp 00c428b4fc Use compiler std::endian instead of union-based punning 2022-09-24 17:47:52 +00:00
Kp af8efbf830 Clear GameSounds, SoundOffset in bulk 2022-09-24 17:47:52 +00:00
Kp 9cad6c0eaa Use std::span for sound_slot samples 2022-09-24 17:47:52 +00:00
Kp ceef174418 Cache strlen call result 2022-09-24 17:47:52 +00:00
Kp f175a4508b Pass std::span to ogl_extensions is_ext_supported
This avoids the need to recompute the string's length later.
2022-09-24 17:47:52 +00:00
Kp 5eb41816f3 Use std::span for CREDITS_FILE 2022-09-24 17:47:52 +00:00
Kp a79ed84112 Use std::span in location_wrapper 2022-09-24 17:47:52 +00:00
Kp e4e8259253 Reduce scope of callback_handler newpath
If select_file_recursive is not called again, then the handler returns
without reading newpath.  Skip defining it if it will not be read.
2022-09-24 17:47:52 +00:00
Kp c09899f457 Pass std::span to load_mus_data 2022-09-24 17:47:52 +00:00
Kp e911d14808 Reduce scope of mix_play_file full_path
It is only set or used when expanding home directory references.  Reduce
its scope accordingly.
2022-09-24 17:47:52 +00:00
Kp fd1be66fa4 Pass std::span to draw_tmap, draw_tmap_flat 2022-09-24 17:47:52 +00:00
Kp a48e6ab56b Pass std::span to _g3_draw_tmap 2022-09-24 17:47:52 +00:00
Kp ad8325b63c Pass std::span to _g3_draw_tmap_2 2022-09-24 17:47:52 +00:00
Kp 491d23e2d9 Pass std::span to _g3_draw_poly 2022-09-24 17:47:52 +00:00
Kp 97f0c5a6d0 Pass std::span to decode_data 2022-09-24 17:47:52 +00:00
Kp 0b91da6d9c Use span methods to construct dxx_sendto input 2022-09-24 17:47:52 +00:00
Kp 9faa3d912d Pass std::span to pcx_encode_line 2022-09-24 17:47:52 +00:00
Kp e69f219539 Pass std::span to g3_validate_polygon_model 2022-09-24 17:47:52 +00:00
Kp 928834fdf8 Pass std::span to g3_init_polygon_model 2022-09-24 17:47:52 +00:00
Kp 76643ed432 Change trace_segs not to recompute children on every pass
`oldsegnum` is `const`, so the address computed from it cannot change.
Lift the computation of `auto &children` out of the loop.

Reduce the scope of `biggest_val`, since it does not need to outlive the
loop.
2022-09-24 17:47:52 +00:00
Kp ce0c183737 Change valptridx allow_end_construction to avoid assertion
gcc libstdc++ built with -D_GLIBCXX_DEBUG includes in
std::array::operator[] an assertion of the form:

```
	assert(index < size());
```

The valptridx allow_end_construction constructor, when given a
completely full array, will call operator[](size()), which causes the
assertion to fail.  Rework the constructor to compute an end iterator
without using operator[].  valptridx allow_end_construction expects that
the resulting iterator may be the end iterator and shall not be
dereferenced.
2022-09-24 17:47:52 +00:00
Kp d797072596 Make vector magnitude constant in more cases
Introduce a helper to obtain both the magnitude of a vector and the
corresponding normalized vector.  Use it to capture both values as const
when possible.
2022-09-24 17:47:52 +00:00
Kp f599ad90b4 Make create_omega_blobs::omega_delta_vector const 2022-09-24 17:47:52 +00:00
Kp 781ca0c97d Reorder endlevel exit_side initialization to fix -Wmaybe-uninitialized
gcc-11.3.0 issues a -Wmaybe-uninitialized warning for `exit_side`.
Reorder the code to eliminate this warning.  Also, fix a potential
out-of-bounds read if `matt_find_connect_side` returned `side_none`.
Before, this would lead to a read of `Side_opposite[side_none]` before
the test that `entry_side` is not `side_none`.  Now, if
`matt_find_connect_side` returns `side_none`, the read of
`Side_opposite` is skipped and logic goes directly to finding a proper
exit side.
2022-09-24 17:47:52 +00:00
Kp d1354911fc Reorder nm_string_inputbox to avoid -Wmaybe-uninitialized
gcc-11.3.0 with -Og may issue a -Wmaybe-uninitialized warning for `w1`
because it fails to prove that every path sets the variable.  Reorder
the logic to use a local lambda to ensure that every path assigns a
value.
2022-09-24 17:47:52 +00:00
Kp 2ecad00e90 Pass std::span to load_palette 2022-09-24 17:47:52 +00:00
Kp 805d71de6b Move Shareware_level_names,Registered_level_names to dumpmine.cpp
They are only used in this file, so move them there and make them
static.
2022-09-24 17:47:52 +00:00
Kp cbe6c94f1e Pass std::span to file_getdirlist 2022-09-24 17:47:52 +00:00
Kp 8f1055ca6b Use std::span for poison helper functions 2022-09-24 17:47:51 +00:00
Kp 17a0452001 Use std::span for nm_item_input 2022-09-24 17:47:51 +00:00