Commit graph

11989 commits

Author SHA1 Message Date
Kp 55af651200 Pass d_level_unique_object_state context to create_omega_blobs 2022-07-02 18:10:45 +00:00
Kp a40ab08bd0 Remove write-only field fcd_data::csd
This value was written when cache entries were created, but is never
read back.
2022-07-02 18:10:45 +00:00
Kp 3230b23bb9 Rework find_connected_distance cache
- Inline MAX_FCD_CACHE into the definition of Fcd_cache, then rely on
  Fcd_cache.size() later.
- Make Fcd_index unsigned.  As an index, a negative number is invalid.
- Change flush_fcd_cache to update Last_fcd_flush_time, rather than
  requiring callers to do it.  Most callers did not update this.
- Change add_to_fcd_cache to validate and reset Fcd_index before use,
  rather than resetting after increment.  This allows Fcd_index to
  become invalid after a write, but it will be reset to a valid value
  before it is used again.
- Fix original game bug in add_to_fcd_cache that caused the cache
  expiration path to clear the wrong cache entry.
2022-07-02 18:10:45 +00:00
Kp e25b476de7 Use enum for segnum_t
Add checked conversions for sites which load from external integers.
2022-07-02 18:10:45 +00:00
Kp fca59adb53 Split out creating OBJ_WEAPON objects 2022-07-02 18:10:45 +00:00
Kp e2509fc840 Move d_robot_info_array out of d_level_shared_robot_info_state
Embedding it in d_level_shared_robot_info_state is reasonable from a
relational perspective, but interferes with referencing
d_robot_info_array when only a forward declaration of
d_level_shared_robot_info_state is available.
2022-07-02 18:10:45 +00:00
Kp e51c11587b Change multi_do_kill to skip copying MULTI_KILL_CLIENT opcode
The opcode will be set to MULTI_KILL_HOST before sending, so do not set
it to MULTI_KILL_CLIENT initially.
2022-07-02 18:10:45 +00:00
Kp 25d0ae8f65 Use an explicitly defaulted exact_type<T>::operator==
clang-13 needed an operator==(const exact_type<T>&) defined to avoid an
ambiguity.  Now that C++20 mode is enabled, switch to a
compiler-generated operator== instead of manually defining the
equivalent function.
2022-07-02 18:10:45 +00:00
Kp aee963c015 Switch dialect to C++20
Future commits will introduce tests for and uses of C++20 features.
2022-07-02 18:10:45 +00:00
Kp 1bcc5c40d0 Work around clang-13 ambiguous operator==
In C++ 20 mode, clang-13 gets confused about how to handle operator==.
Rewrite the test to encourage it to pick the correct version.

```
common/include/gr.h:129:12: error: use of overloaded operator '==' is ambiguous (with operand types 'dcx::grs_main_bitmap *' and 'exact_type<dcx::grs_bitmap>')
        if (this == &r)
            ~~~~ ^  ~~
common/include/pack.h:31:17: note: candidate function (with reversed parameter order)
    constexpr bool operator==(const T *rhs) const { return p == rhs; }
                   ^
common/include/gr.h:129:12: note: built-in candidate operator==(struct dcx::grs_bitmap *, struct dcx::grs_bitmap *)
        if (this == &r)
```
2022-07-02 18:10:45 +00:00
Kp 33d938ac06 Prepare exact_type for clang-13 in C++20 mode
clang-13 in C++20 mode fails:

```
similar/main/newmenu.cpp:202:18: error: ISO C++20 considers use of overloaded operator '==' (with operand types 'exact_type<const dcx::grs_font>' and 'exact_
type<const dcx::grs_font>') to be ambiguous despite there being a unique best viable function [-Werror,-Wambiguous-reversed-operator]
    return &cv_font == &game_font ? "\202" : "\207";  // 135
	   ~~~~~~~~ ^  ~~~~~~~~~~
common/include/pack.h:31:17: note: ambiguity is between a regular call to this operator and a call with the argument order reversed
    constexpr bool operator==(const T *rhs) const { return p == rhs; }
		   ^
```

Add an operator== that exactly matches the input types so that clang
does not attempt a conversion.
2022-07-02 18:10:45 +00:00
Kp bdeca5687e Remove unused copy_diminish_palette
Fixes: f413017317 ("Delegate bald_guy_load PCX to SDL image")
2022-07-02 18:10:45 +00:00
Kp e45ff2da5e Use named enum types for netflag and netgrant 2022-07-02 18:10:45 +00:00
Kp e79af7c55f Restrict RAIIdmem to use on integral types
There are no remaining uses of RAIIdmem on structure types.  Restrict it
to integral types, to remove use of std::is_pod.
2022-07-02 18:10:45 +00:00
Kp a906f13c83 Replace deprecated std::is_pod in physfsx helpers
C++20 deprecates std::is_pod.  Expand std::is_pod to its equivalent long
form of std::is_standard_layout && std::is_trivial.
2022-07-02 18:10:45 +00:00
Kp fd7ab4388c Remove unused CALLOC code
TGA generation was the last user of CALLOC.  Remove it.
2022-07-02 18:10:45 +00:00
Kp d586fe91e4 Parenthesize gauge_key comma expression
C++20 deprecates `array_name[A,B]`.  For this use case, `A` is needed
for its side effects, but is not intended as an index operation.  Add
parentheses to satisfy the deprecation warning, without changing the
meaning of the code.
2022-07-02 18:10:45 +00:00
Kp 78fd6550ea Avoid unnecessary allocation in jukebox_play
If the song originates in an m3u playlist, no temporary buffer is
needed.  Avoid allocating and initializing one, and instead pass the
pointer directly from the CMLevelMusicPath field.
2022-07-02 18:10:45 +00:00
Kp 173d5559d7 Tighten TGA generation code
- Skip reading unused alpha channel in TGA screenshot path.  The alpha
  channel is discarded, so skip even retrieving it from OpenGL.
- Perform the red/blue swap in place, instead of copying into an
  additional buffer.
2022-07-02 18:10:45 +00:00
Kreeblah 1c8ff1ac0f
Fix gl.h include location for macOS 2022-06-24 23:06:27 -07:00
Kp d1ed53ebd9 Initialize IPv4/IPv6 broadcast addresses statically
These were computed by passing hardcoded inputs to a lookup function.
Initialize the structure at compile time instead.
2022-06-19 23:35:18 +00:00
Kp d1968fce82 Move num_active_udp_changed into netgame_list_game_menu 2022-06-19 23:35:18 +00:00
Kp 27f18be3ca Move num_active_udp_games into netgame_list_game_menu 2022-06-19 23:35:18 +00:00
Kp a1bdd81d41 Exclude unused code from D2 non-editor build
gamedata_read_tbl is only called if (D1 || (D2 && EDITOR)).  Exclude
defining it for (D2 && !EDITOR).  From there, also exclude defining or
reading the alias list, which is only written by a function
called by gamedata_read_tbl.

Reported-by: heftig <https://github.com/dxx-rebirth/dxx-rebirth/issues/642>
2022-06-11 15:00:02 +00:00
Kp 2f78951b02 Change underlying_value to use a deleted function for the bad case
This produces a better error message than a static_assert failure, since
gcc points directly to the call which resolved to the deleted overload.
When the caller is correct, this produces the same result as the prior
version.
2022-06-11 15:00:02 +00:00
Kp 1f263e30ae Update minimum supported tool versions in INSTALL.markdown 2022-06-11 15:00:02 +00:00
Kp 522c696af0 Remove unnecessary members in splitpath_t
splitpath_t is designed for MS-DOS paths, even though Rebirth now runs
on many platforms that never used DOS conventions.  Most of the members
of splitpath_t are unused on all platforms.  Remove them, and switch to
returning an initialized version of the structure.
2022-06-11 15:00:02 +00:00
Arne de Bruijn 0a5ecd77c6 Fix exit briefing animation speed
Undo change in e973dc0 which set the change animation direction delay
for every frame.
2022-06-06 10:15:27 +02:00
Kp 5545b32fee Do not reset_rear_view if dead when crossing exit trigger
Reported-by: ziplantil <https://github.com/dxx-rebirth/dxx-rebirth/issues/637>
Fixes: 8faed77f5f ("Properly record the event of reset_rear_view() while switching levels to make it work right when rewinding as well; Properly record Countdown seconds for each newdemo frame instead of second change to get display showing up right while playback and still preserving backwards compability; Suspend Game_wind when playing endlevel movie while demo playback")
2022-06-05 17:44:53 +00:00
Kp 346906ae9f Simplify UPID_QUIT_JOINING
The host only needs to check the source address.  Remove the check on
the callsign, and shrink the message accordingly.
2022-06-05 17:44:53 +00:00
Kp 68453cd86f Remove redundant net_udp_welcome_player checks
This loop is run once before the `if()` test, then again at the top of
both the true and false branches of the `if`.  Remove the runs inside
the conditional, since they should produce the same result as the run
that occurs before the conditional.
2022-06-05 17:44:53 +00:00
Kp 9816475706 Pass Object array to object_goto_next_viewer 2022-06-05 17:44:53 +00:00
Kp e66da397a5 Add dummy 'file' key to executable entry in compilation database
clang rejects the entire database if any entry lacks a 'file' key,
regardless of whether the entry is used.

Fixes: bc6d043f5d ("Extend SConstruct compilation_database support to cover Program()")
2022-06-05 17:44:53 +00:00
Kp c5de47b51e Add const qualifiers to some net_udp functions 2022-06-05 17:44:53 +00:00
Kp 3d7cb4abc7 Remove force_dump_ai_objects_all
It rotted because it is only ever used when PARALLAX is defined.  No one
has reported it broken, so remove it.
2022-06-05 17:44:53 +00:00
Kp 0faa33d3df Harden bm_read_player_ship against invalid model numbers
Eliminate an unnecessary internal copy.  Terminate the search early if
an invalid model number is used.
2022-06-05 17:44:53 +00:00
Kp 504e950b75 Simplify bm_read_player_ship last_model_num handling
The existing handling always wrote to slot 0, but did so in a convoluted
way.  The variable names suggest this was not intended, but no one has
ever reported it as broken, and some otherwise valid data files may
depend on this quirk.
2022-06-05 17:44:53 +00:00
Kp 1b13274a5e Combine D1/D2 bm_read_player_ship call to load_polygon_model
D1 and D2 used logically equivalent code, but it was not the same text,
so the unification project split this with a `#ifdef`.  Since the code
does the same thing in both games, combine it into a non-guarded
statement.
2022-06-05 17:44:53 +00:00
Kp 5be32a05c6 Reorder check_line_to_line to eliminate useless copy
Instead of copying the input v1/v2 into det.uvec, pass a reference for
v1/v2 directly to calc_det_value.
2022-06-05 17:44:53 +00:00
Kp 9071675a0d Pass calc_det_value vectors separately
Pass 3 vectors rf/u instead of one vms_matrix.  This may make the code
slightly worse in the short term, but it makes a later change clearer.
2022-06-05 17:44:52 +00:00
Kp bfe7f2bb19 Reorder fvi_sub object type tests
Two tests in series examined the object for a type of OBJ_ROBOT.  Fold
the test together.

The next test also examines ->type.  Move that to an else since it
cannot be true if the first test was true.
2022-06-05 17:44:52 +00:00
Kp e180375f97 Pass GameBitmaps to draw_object_blob 2022-06-05 17:44:52 +00:00
Kp cc2f3caa7e Split piggy.h -> fwd-piggy.h 2022-06-05 17:44:52 +00:00
Kp 6228b07b45 Fix check_header_includes=1 build of fvi.h 2022-06-05 17:44:52 +00:00
Kp 6e2ed26659 Pass object to init_player_object 2022-06-05 17:44:52 +00:00
Kp 9f207daf95 Pass player object to reset_player_object 2022-06-05 17:44:52 +00:00
Kp 11a0aae9ee Pass GameBitmaps to piggy_bitmap_page_in 2022-06-05 17:44:52 +00:00
Kp f36a8e015e Disable collecting segment list in see_object
The segment list is written to `hit_data`, but `hit_data` goes out of
scope before the segment list is read back.  Skip collecting it, since
it was effectively write-only on this path.
2022-06-05 17:44:52 +00:00
Kp 33152640bc Remove fvi_info::hit_type
Its value is always readily available as the return value of
find_vector_intersection, so remove the structure member and rely on the
returned value.
2022-06-05 17:44:52 +00:00
Kp 8c4adbc262 Show repaircenters on automap 2022-06-05 17:44:52 +00:00