Commit graph

2210 commits

Author SHA1 Message Date
Kp 43e1c841f0 Pass polymodel& to polymodel_read 2022-10-09 23:15:20 +00:00
Kp acae546a90 Pass polymodel& to draw_model_picture, draw_polygon_model 2022-10-09 23:15:20 +00:00
Kp 910ac7fd4a Use template alias for per-team arrays 2022-10-09 23:15:20 +00:00
Kp fcb6beb3e8 Add check that d_array<E> is not unsigned int or unsigned long
`std::size_t` is `unsigned int` on i686-pc-linux-gnu, but is `unsigned
long` on x86_64-pc-linux-gnu.  This mismatch allows d_array<E =
std::size_t> to be well-formed on x86_64, but trigger a duplicate
definition of operator[](E) on i686.  Add a requires() check that
forbids both types for E, so that code which would break the i686 build
is also diagnosed in the x86_64 build.
2022-10-09 23:15:20 +00:00
Kp f61db8ae7a Make enumerate() default to std::size_t for index_type
Change from `uint_fast32_t` to `std::size_t` for consistency with how
arrays are typically indexed.

Change the decltype() lookup to use a non-template function for the
fallback case.

Move the remove_reference logic into the caller, to allow fewer
instantiations of `array_index_type`.
2022-10-09 23:15:20 +00:00
Kp 9716d42ea0 Use enum class for pig_hamfile_version 2022-10-09 23:15:20 +00:00
Kp e385ff1c3b Use std::ranges::find_if instead of std::find_if
std::ranges::find_if permits use of a sentinel instead of a full
iterator, and supports std::ranges::find as an alternative to certain
simple uses of std::find_if.

Where possible, use the form that takes a range, rather than the form
that takes two iterators.

Add a declared, but not defined, default constructor for
self_return_iterator to satisfy the standard library's concept
`semiregular`, which insists that sentinels be default-constructible,
even for those functions that never need to do so.

Add a defined, but unused, operator++(postfix) for zip_iterator to
satisfy a standard library concept for `forward_iterator`.
2022-10-09 23:15:20 +00:00
Kp 7c0fb7b12a Use std::span for load_bitmap_replacements argument level_name 2022-10-09 23:15:20 +00:00
Kp 9c4c49fe5e Return std::unique_ptr from d_strdup 2022-10-09 23:15:20 +00:00
Kp 017e786139 Use explicitly defaulted font_scale_proportion::operator== 2022-10-09 23:15:19 +00:00
Kp 32e819a9e7 Remove unnecessary explicit definition of WALL_IS_DOORWAY_result_t::operator!= 2022-10-09 23:15:19 +00:00
Kp beb4cde9cb Remove definition of segment_object_range_t<T>::iterator::operator!= 2022-10-09 23:15:19 +00:00
Kp 49fccd64ad Use explicitly defaulted callsign_t::operator== 2022-10-09 23:15:19 +00:00
Kp 5d412f3c19 Remove unnecessary explicit definition of enumerated_iterator::operator!= 2022-10-09 23:15:19 +00:00
Kp c1a8a3b8e3 Explicitly default xrange_iterator::operator==
Replace operator!= with an implicitly defaulted definition, which will
use the new explicitly defaulted operator==.
2022-10-09 23:15:19 +00:00
Kp 01c07156bd Remove special case for 0 argument HUD_init_message
Fix the one remaining site that was redirected by this.  Remove the
redirection macro, so that the literal and variadic forms can have
differing types for their string field.
2022-10-02 19:51:36 +00:00
Kp aaac0e69fa Use std::span for piggy_new_pigfile argument pigname 2022-10-02 19:51:35 +00:00
Kp eca189e8aa Use enum class for SoundOffset
Change piggy_register_sound to take the sound offset as a parameter,
rather than assuming the caller will set SoundOffset accordingly.

Remove a spurious sound reset in piggy_register_bitmap.  Based on the
duplicated comment, this was probably incorrectly copied from
piggy_register_sound, where it made sense, into piggy_register_bitmap,
where it does not.
2022-10-02 19:51:35 +00:00
Kp 14bf2dc59a Pass std::span to piggy_register_bitmap 2022-10-02 19:51:35 +00:00
Kp f0d118ed42 Use std::span for PHYSFSX_fgets 2022-10-02 19:51:35 +00:00
Kp e3faab0899 Use alias template per_player_array for arrays that are MAX_PLAYERS long
This removes the need to repeat MAX_PLAYERS in every usage, and prepares
for a future change to use enumerated_array instead of std::array.
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 294a78a1aa Pass std::span to powerup_basic_str 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 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 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 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 a79ed84112 Use std::span in location_wrapper 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 17a0452001 Use std::span for nm_item_input 2022-09-24 17:47:51 +00:00
Kp e0300e1e30 Pass std::span to dispatch_table::send_data 2022-09-24 17:47:51 +00:00
Kp b8ed30235c Remove Multi_is_guided; handle setup directly
`Multi_is_guided` is only enabled in one place.  One code path set up
Guided_missile[] for the local player, and a different path handled
network players.  Remove `Multi_is_guided` and rearrange such that a
single site handles both local and network players.
2022-09-24 17:47:51 +00:00
Kp 232c648024 Add Windows version resource for Windows build 2022-09-11 17:00:45 +00:00
Kp 11a400ab8f Move upid sizes to constexpr variable 2022-09-11 17:00:45 +00:00
Kp 575bfe8a69 Use enum class for tracker_game_id 2022-09-11 17:00:44 +00:00
Kp eb8a7d8186 Use std::span for multi::send_data_direct 2022-09-11 17:00:44 +00:00
Kp 0512ea8d65 Use enum class for upid 2022-09-11 17:00:44 +00:00
Kp d32fc7acab Use enum class for kick_player_reason 2022-09-11 17:00:44 +00:00
Kp 366b048879 Merge commit 'refs/pull/657/head' into master 2022-08-23 02:13:01 +00:00
Kp 44cf8b83be Advise gcc to inline morph_data::operator new
This is only used in the file where it is defined, so it can be inlined
even though the definition is not in a header.  Enabling inlining
encourages gcc to see that the `operator new`/`operator delete` calls
are not mismatched.
2022-08-22 01:24:49 +00:00
Kp c64a584bfd Use enum class for robot_gun_number
Validate gun numbers on loading object data.  Factor out and normalize
the logic for advancing to a robot's next gun.
2022-08-22 01:24:49 +00:00
Kp 1fb55eebc2 Use enum class for robot_animation_state 2022-08-22 01:24:49 +00:00
Kp 26ab08d55f Add stub definitions of enum vertnum_t,wallnum_t
Given this code:

```
enum class X : unsigned;
X a{1};
```

gdb has an unfortunate behavior of reporting "incomplete type" and
refusing to show the underlying value of `a`, even when `a` is in scope.
Adding `enum class X : unsigned {}` fixes this and allows gdb to show
the value.
2022-08-22 01:24:49 +00:00
Tylor 6fee36638d Feat: Pitch unlocker 2022-08-21 16:16:40 -05:00
Kp 55bbc5f599 Pass std::span to multi_do_create_robot_powerups 2022-07-30 17:42:59 +00:00
Kp 4ce39a399e Pass std::span to multi_do_boss_create_robot 2022-07-30 17:42:59 +00:00