Commit Graph

12210 Commits

Author SHA1 Message Date
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
Kp ee68f43bb5 Remove SConf tests for curl, jsoncpp
These have been disabled since they were added in 2016, and the new HTTP
tracker they were meant to support was never put into service.  Remove
the tests.

Fixes: 9a8bd1aecb ("Add disabled tests for curl/jsoncpp")
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 2d46e020e0 Return length change from copy_from_ntstring
Switch from passing length by-reference to instead passing it in by
value and returning the change.  This lets callers keep the length in a
register.
2022-09-24 17:47:51 +00:00
Kp 95bb58a2fe Convert PUT_INTEL_* uses to operator[]
Switch away from operator+(uint8_t *, std::size_t), since future work
will use a type that defines operator[] and not operator+.
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
JohnnyonFlame c90ac3e611 Fix OpenGL ES build on SDL2. 2022-09-18 21:35:55 -03:00
Kp ad46235b67 Avoid spinning in multiplayer when the game window is hidden
When the host exits the game, guests switch the game window to be
non-visible, and raise a dialog box stating `Host has left the game!`.
Prior to this change, the guests would then busy loop until the dialog
was dismissed.  With this change, the game will sleep for each idle
event, minimizing CPU use during the period waiting for the player to
acknowledge the dialog box.
2022-09-11 17:00:45 +00:00
Kp 45362ac37b Fix guest loading of multiplayer saved games
Using `sav_objnum` caused the player to be restored into the object slot
of the pre-load level, in the object table of the post-load level.  This
was harmless when the slots were the same, and wrong when they were not.
It became noticeably wrong when more player data was moved into the
object.  After those changes, the player's data was stored into the
correct post-load slot, but the ship was assigned to the pre-load slot.

Remove the incorrect slot switch, and add an assert that the object
being overwritten is a player ghost.  With the incorrect switch present,
this assert will catch most (but not all)[1] cases of the incorrect
restore.  With the incorrect switch removed, this assert succeeds.

[1] In the unlikely case that the post-load slot was a player start, but
for a different player, the assert could succeed despite the slot
mismatch bug.  In the common case, the post-load slot would not be a
start of a different player; it would either be the correct player slot,
in which case `sav_objnum` was harmless, or it would be some other
object, such as a robot.
2022-09-11 17:00:45 +00:00
Kp d9f30ba10c Avoid spinning in net_udp_request_poll
If the guest is slow to respond, the host would enter a busy loop
polling for the guests to be ready.  Mitigate the CPU load by sleeping
for 50ms when guests are not yet ready.
2022-09-11 17:00:45 +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 70fd424599 Split net_udp_process_game_info to light/heavy variants
The two paths had nothing in common, so split them into separate
functions and call the appropriate version from each caller.
2022-09-11 17:00:44 +00:00
Kp 575bfe8a69 Use enum class for tracker_game_id 2022-09-11 17:00:44 +00:00
Kp 8f847c16bb Use std::span for csocket_data_buffer 2022-09-11 17:00:44 +00:00
Kp 763f1d4902 Use std::span for socket_data_buffer 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 53770489d8 Use std::span for net_udp_noloss_add_queue_pkt 2022-09-11 17:00:44 +00:00
Kp 2589ba9c60 Ignore invalid MULTI_START_TRIGGER messages 2022-09-11 17:00:44 +00:00