Commit graph

10733 commits

Author SHA1 Message Date
Kp 6212b914cb Adjust freedata ebuild to block pre-unification ebuilds 2020-06-02 03:14:30 +00:00
Kp 91a5956b11 Update snapshot ebuild 2020-05-31 23:04:25 +00:00
Kp 3b964351d9 Update ebuild for scons-utils PYTHON_COMPAT requirement 2020-05-31 23:04:25 +00:00
Kp 1ac12b9ead Update ebuild to EAPI=7 2020-05-31 23:04:25 +00:00
Kp 17b9edcd47 Enable -Wredundant-decls when possible
Add an inclusion of <SDL.h> since, for Windows targets, this triggers a
chain of includes that leads to <intrin.h>, which causes
-Wredundant-decls to print a diagnostic.  This allows Windows targets to
declare -Wredundant-decls as unusable, while enabling it for non-Windows
targets.
2020-05-31 23:04:25 +00:00
Kp 68b47307b4 Remove useless SDL_RWops precision test in SDL2
SDL2 increased the range of the seek type, so truncation is no longer a
concern.
2020-05-31 23:04:25 +00:00
Kp 5c30b467bb Move jukebox_load, jukebox_hook_next to dcx 2020-05-31 23:04:25 +00:00
Kp 81119f0445 Use enum class for LevelMusicPlayOrder 2020-05-31 23:04:25 +00:00
Kp 2e1e142767 Factor out sound_function_table_t where possible
Move it to namespace dcx when this does not cause a dcx->dsx dependency.
2020-05-31 23:04:25 +00:00
Kp d06ad449b8 Always ignore from_hog_only
This fixes PCX loading in the non-editor build.  PCX loading broke in
3114874713 because it switched from PHYSFSX_openReadBuffered to a call
which did not handle the presence of the marker byte in the filename.

The from_hog_only flag has not been properly supported since the
introduction of PHYSFSX_openReadBuffered in
8b323e7214.  Editor builds ignored it on
purpose, and non-editor builds pretended to respect it, only to then
ignore it down inside PHYSFSX_openReadBuffered.  For consistency with
code paths that do not use PHYSFSX_openReadBuffered, disable the bypass
in PHYSFSX_openReadBuffered and remove the code in show_title_screen
that applied the flag.

Reported-by: Jayman2000 <https://github.com/dxx-rebirth/dxx-rebirth/issues/510>
Fixes: 3114874713 ("Delegate PCX loading to SDL_image")
2020-05-28 03:21:22 +00:00
Kp b08620292d Fix input handling in automap
The automap code keeps a mostly-private secondary copy of control_info.
The change to reset control_info before the event loop reset the main
copy of control_info for the automap, not the copy that the automap
actually used.  Fix this by passing the desired control_info to relevant
functions instead of always using the global variable Controls.

Fixes: c621a970c6 ("Reset kconfig counters once, before the event loop")
2020-05-28 03:21:22 +00:00
Kp 511a3d6b9c Pump SDL events in batches 2020-05-27 03:07:17 +00:00
Kp ff50824418 Pass SDL events as const T *, not T * 2020-05-27 03:07:17 +00:00
Kp c621a970c6 Reset kconfig counters once, before the event loop 2020-05-27 03:07:17 +00:00
Kp 954a235d13 Discard decoded cockpit buffer when no longer needed 2020-05-27 03:07:17 +00:00
Kp 84fb6d499b Update snapshot ebuild 2020-05-23 00:31:37 +00:00
Kp 5a73a680f8 Change SRC_URI to download .tar.gz snapshots
Requested-by: dr-diem <https://github.com/dxx-rebirth/dxx-rebirth/issues/502#issuecomment-632475853>
2020-05-23 00:31:37 +00:00
Kp c8b44e2a2b Add convenience options to mk-ebuild-snapshot.bash
- -a: run `git add` on the new snapshot ebuild
- -n: only print the new ebuild, do not write it to disk
- -r: delete older snapshot ebuilds
2020-05-23 00:31:37 +00:00
Kp 5dbdc65ee6 Fix D2 crash on blank line in bitmaps.tbl
Reported-by: InsanityBringer <https://github.com/dxx-rebirth/dxx-rebirth/issues/464#issuecomment-632443732>
2020-05-22 02:40:26 +00:00
Kp c4c09963ae Use constexpr uint8_t for TRANSPARENCY_COLOR
This encourages std::fill_n to become memset.  When TRANSPARENCY_COLOR
is `#define`'d to 255, it is an integer literal of type `int`.
2020-05-22 02:40:26 +00:00
Kp 7b52b1fe1d Move grs_bitmap::avg_color into #if !DXX_USE_OGL
This field is used in the SDL build for rendering.  In the GL build, its
only purpose is for the editor to write it to a PIG file.  Change that
one use to compute the value as needed.  Move all other references
behind a preprocessor test for !DXX_USE_OGL.  This shrinks the size of
grs_bitmap by 1 pointer, since the compiler added padding after
avg_color up to the size of the next aligned pointer.
2020-05-22 02:40:26 +00:00
Kp 09eff19a66 Use stack arrays for texture mapping temporaries
The maximum length is small enough that stack arrays can easily handle
the largest values, and this avoids several heap allocations on a hot
path.
2020-05-22 02:40:26 +00:00
Kp 3d0f333b34 Unify object texture setup
Move the load of &GameBitmaps to the common loop used for paging in.
Add range checks on the loops.
2020-05-22 02:40:26 +00:00
Kp c1181b7be5 Move texture_list out of global scope 2020-05-22 02:40:26 +00:00
Kp 3d3db16c6f Move Canvas_width,Canvas_height to local scope 2020-05-22 02:40:26 +00:00
Kp 0b35d8e2ce Factor out std::max in event dispatching 2020-05-22 02:40:26 +00:00
Kp 727bc4b663 Flush events in bulk 2020-05-22 02:40:26 +00:00
Kp fe792055d6 Simplify current_music_t
Inherit unique_ptr instead of embedding it, so that its members can be
exposed via a `using` directive.
2020-05-22 02:40:26 +00:00
Kp b46ed29e82 Add PROPERTIES=live to 9999 ebuild
In issue #502, dr-diem mentioned adding PROPERTIES=live to the ebuild
that he planned to submit to Gentoo.  This looks like a good idea to
have in the ebuild tracked in the Rebirth source tree, so add it here
too.

Motivated-by: dr-diem <https://github.com/dxx-rebirth/dxx-rebirth/issues/502#issuecomment-629880896>
2020-05-18 00:08:16 +00:00
Kp bd3883ad73 Update snapshot ebuild 2020-05-17 23:35:26 +00:00
Kp 5c88587c01 Encourage std::fill to become memset
gcc has a special case to devolve to memset if both the pointed-at data
and the value to fill are considered a byte.  All uses of
DXX_POISON_MEMORY pass a value that fits in a byte, so change the
signature to be a byte, to encourage gcc to activate the special case.
2020-05-17 23:35:26 +00:00
Kp f413017317 Delegate bald_guy_load PCX to SDL image 2020-05-17 23:35:26 +00:00
Kp 83a9b32dc7 Simplify bald_guy_load
Close the file sooner.  Use std::transform with a reverse_iterator to
decode and transpose the blob.
2020-05-17 23:35:26 +00:00
Kp 3114874713 Delegate PCX loading to SDL_image
This adds a new dependency, but most systems likely already have
SDL_image installed.  Use of SDL_image can be disabled, but this is
discouraged, because various in-game interfaces assume the use of the
original background.

The old implementation automatically corrected for filename case.  The
new implementation expects that the supplied filename can be passed to
PYHSFS_openRead as-is.  All known uses in-game have been corrected to
satisfy this requirement.  If the new stricter match requirement becomes
a problem, a variant of PHYSFSRWOPS_openRead that adjusts filename case
could be created for use here.

- Update install instructions
- Update ebuild
- Update Arch PKGBUILD
2020-05-17 23:35:26 +00:00
Kp 71ca1a7553 Do not abort on failure to load PCX
Using assert to check for conditions that can be caused by improper
configuration is wrong.  If the load failed, return.
2020-05-17 23:35:26 +00:00
Kp 16ae2e7b8e Correct case of map PCX files 2020-05-17 23:35:26 +00:00
Kp 699c9bc283 Fix check_header_includes=1 build 2020-05-17 23:35:25 +00:00
Kp df9a2bacf1 Handle gcc-10 truncation warnings in net_udp.cpp
gcc-10 warns that the game information text may be truncated, because it
overestimates the maximum possible length of some strings.  Handle the
warning by changing the format string to explicitly truncate these
strings at their maximum legal lengths.
2020-05-17 23:35:25 +00:00
Kp f30b77c116 Handle gcc-10 truncation warning in mission.cpp
gcc-10 warns that if immediate_directories were very large, the sprintf
result would be truncated.  This is true, but a user is extremely
unlikely to have enough directories to trigger this code path.  Handle
the warning by explicitly returning an empty string if truncation would
otherwise occur.  This is not strictly correct, but it can be handled
with very little code, eliminates the warning, and is unlikely to matter
in practice.
2020-05-17 23:35:25 +00:00
Kp a4f2edfaa9 Move LevelSharedVertexState into d_level_shared_segment_state 2020-05-17 23:35:25 +00:00
Kp f577788665 Use C++17 fold expressions to simplify serialization code 2020-05-17 23:35:25 +00:00
Kp 99a03b21ce Simplify serial:process_buffer self-selection filter
Use std::enable_if, so that the second argument becomes part of the
parameter pack instead of requiring explicit handling.
2020-05-17 23:35:25 +00:00
Kp 72c5221e0b Use if constexpr instead of std::enable_if
This reduces the size of the generated debug information, but produces
the same code.
2020-05-17 23:35:25 +00:00
Kp 9ed64013bc Decorate SConf C++ standard tests
Add per-test comments to ease identifying which test is responsible for
a given section.
2020-05-17 23:35:25 +00:00
Kp 6a4a8a62c9 Add unit tests for serialization code 2020-05-17 23:35:25 +00:00
Kp fc46e9a97c Only reduce laser power in D2 mode
As reported in pull #507, the D1 implementation of the reduction was
incorrect and never reduced laser power.  Therefore, when D2 emulates
D1, D2 should emulate the effect of the bug, by not reducing laser
power.
2020-05-06 03:04:45 +00:00
Kp 44c4f0bde0 Move is_laser_weapon_type into #ifdef D2
The preceding commit eliminates the only use of is_laser_weapon_type by
D1 code, so now the function can be moved into a #ifdef D2 block.
2020-05-06 03:04:45 +00:00
AlumiuN 072bb54ff2 Exclude D1 player lasers from the quad laser damage reduction
The code that provides the 0.75x multiplier to laser bolts when they're fired
using the quad laser is present in D1 as in D2, however it is incorrect and
results in it not being applied. As such, it is more accurate to exclude the
multiplier when compiling D1.

Thanks to SaladBadger for the tip.
2020-05-04 20:20:41 +12:00
Kp 2f3a76ab15 Revert laser weapon type checking to 0.58.1
Commit 2bcc7bb371 restricted
Laser_create_new to only create lasers for known weapon types.  This
seemed like a good idea, but broke custom levels that use undocumented
laser types.  It also replaced logic that coerced invalid weapon numbers
into a type 1 laser with logic that prevented firing such weapons at
all.  This rendered robots with unknown or broken weapon data unable to
fire.

Commit 0c30fa7cf3 relaxed the logic to
prevent firing only in editor builds, but allow firing unknown or
invalid weapon types in release builds.  Firing unknown weapon types may
work.  Firing invalid weapon types may cause the game to crash when data
is accessed beyond the end of the defined weapon data.  This caused the
crash reported in issue #506.

Revert to the 0.58.1 rule that invalid weapons are coerced to be a
player level 1 laser.  Add a diagnostic when such a weapon is fired,
since the level author should have requested that weapon explicitly if
that was intended.

Reported-by: heftig <https://github.com/dxx-rebirth/dxx-rebirth/issues/506>
Fixes: 2bcc7bb371 ("Only create lasers for known weapon types")
2020-05-02 21:18:43 +00:00
Kp 399aee8d49 Use dedicated type for object render_type
Check conversions.  On invalid input, coerce to RT_NONE and print a
warning.
2020-05-02 21:18:43 +00:00