When `apply_force_damage` was called to damage a robot, it tested if the
`ctype.laser_info.parent_signature` of the other object matched
`ConsoleObject->signature` and, if so, awarded points to the console
player. This allowed the player to sometimes get points for ramming a
robot to death, but was buggy. When the player rams a robot, the player
is the other object, so accessing `ctype.laser_info` is wrong.
Historically, the player's signature was zero and player
`ctype.laser_info.parent_signature` (an inactive and therefore incorrect
branch of the union) happened to be zero, so the test succeeded. Commit
44753209d6 changed the layout of
`struct player_info` such that
`ConsoleObject->ctype.laser_info.parent_signature` was not zero, causing
the player not to be his own parent. Prior to this commit, the player
could still wrongly fail the test if the `player_info` member that
aliased `laser_info.parent_signature` was nonzero. In the commit
preceding the obvious break, `player_info.player_flags` aliased
`laser_info.parent_signature`, so a player with certain flags (such as
invulnerability) would wrongly fail the test. The exact manifestation
has changed over time as `struct player_info` gained members.
Restructure the test so that a ramming kill always awards points,
without checking ancestry.
Reported-by: Descender1032 <https://forum.dxx-rebirth.com/showthread.php?tid=1006> (no commit identifiers given)
Fixes: 44753209d6 ("Move homing_object_dist to object.ctype.player_info")
GOG.com resumed selling Descent 1 and Descent 2, albeit as separate SKUs
rather than the historical bundled SKU. Restore the GOG reference in
INSTALL.markdown.
Reported-by: derhass <https://forum.dxx-rebirth.com/showthread.php?tid=1004>
`Descent 2: Counterstrike` level 9 specifies a control center trigger on
a side with no wall. This is not valid. In normal play, wall_toggle
silently ignored this, and newdemo_pop_ctrlcen_triggers had undefined
behavior. Add a warning in wall_toggle to report levels like this. Add
handling in newdemo_pop_ctrlcen_triggers to detect and suppress this
bogus data.
`Descent 2: Counterstrike` level 11 specifies a control center trigger
on a side with no child segment. This is not valid, so
newdemo_pop_ctrlcen_triggers again had undefined behavior. Add handling
to detect and suppress this bogus data.
Reported-by: Descender1032 <https://forum.dxx-rebirth.com/showthread.php?tid=992>
- Add descentX-freedata-1.ebuild to manage the freely downloadable
music, German briefings, and (for Descent 1 only) higher resolution
textures. These can be added/removed without rebuilding the game, so
they get a separate ebuild. This prevents reinstalling these
resources on game upgrades, and permits using these resources with
live ebuilds.
- Fix $LICENSE to reflect Rebirth 2014 license change.
- Add USE=+joystick. When unset, SDL joystick support is unnecessary
and Rebirth is built without joystick support. This reduces
code size, which may be important on constrained targets. When
USE=joystick is set, SDL joystick support is now required.
- Add blockers for co-installation with <d1x-rebirth-0.59.100,
<d2x-rebirth-0.59.100, as these install files of the same name and
would otherwise collide with this package. Compiling while the older
version is installed is safe, so this is only an RDEPEND blocker.
- Add USE flags for the various descentX-freedata features, and depend
on a descentX-freedata with those flags enabled. When all such flags
are clear, there is no dependency, since descentX-freedata with USE=-*
installs no files.
- Add commented out IUSE_RUNTIME to record which USE flags are
runtime-only. When Portage implements IUSE_RUNTIME, this definition
should be uncommented.
- Mirror xdg integration from main Gentoo Portage ebuild for Rebirth.
Also match layout with that ebuild where possible, to simplify sharing
changes. Notable differences remaining:
- Gentoo Portage ebuild handles freedata assets inline.
- Gentoo Portage ebuild disallows enabling both music pack USE flags,
even though the files install to separate names. Rebirth freedata
ebuild permits both to be enabled.
- Gentoo Portage ebuild hard-enables joystick support and
hard-requires SDL joystick support. Rebirth ebuild makes it
optional via USE=joystick.
- Gentoo Portage ebuild is less strict about SDL_mixer features.
- Gentoo Portage ebuild has USE=+data to control whether game data is
a required dependency. Rebirth ebuild hard-depends on game data
(but still provides a choice of demo data or retail data).
- Gentoo Portage ebuild hard-blocks _all_ d1x-rebirth, d2x-rebirth
package versions. Rebirth ebuild hard-blocks only such packages
that would cause a file collision, so that the transition
meta-packages can be installed.
- Gentoo Portage ebuild carries two useless patches.
- $P-flags.patch removes default CXXFLAGS flags, even though
SConstruct adds them to the left of the user's CXXFLAGS, so that
user CXXFLAGS override default flags.
- $P-sharepath.patch changes the sharepath by patching SConstruct.
Rebirth ebuild changes the sharepath by passing an appropriate
`sharepath=` argument to the `scons` call.
- Gentoo Portage ebuild lacks USE=editor and associated build of Descent
editor mode.
- Gentoo Portage ebuild does not export PKG_CONFIG.
The Windows exception handler probes the stack to determine how much can
be safely dumped, up to a fixed maximum number of bytes. A logic error
caused the probe function to start its stack probe lower than intended,
so the eventual dump code logs fewer pre-exception bytes than intended.
Fix that error so that the dump shows more pre-exception bytes.
Also, log the address of the ud2 instruction, so that the effective load
address of the module can be determined. Without this, ASLR makes
reading the dumps needlessly difficult.
Using <gcc-4.9 has been unsupported since introduction of `extern
constexpr` variables broke using gcc-4.8. Update the install
instructions accordingly.
When referencing 4.9, qualify it as 4.9.4 due to gcc bug #66501 [1]
(present in 4.9.2, fixed in 4.9.4). As discussed in "Socket error upon
hosting or joining a second multiplayer game"
<https://github.com/dxx-rebirth/dxx-rebirth/issues/289>, this bug caused
a strange miscompilation in Rebirth. Although that specific
miscompilation has been worked around, there is no guarantee that the
code is and will remain free of other constructs that gcc-4.9.2
mishandles due to that bug. Using 4.9.2 (as Debian Jessie did) mostly
works, but there is no sense encouraging users to use a known buggy
compiler when a fixed version is readily available.
[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66501
clang rejects 0x80000000 as a non-type template argument of type `int`
due to narrowing. Use `INT32_MIN` instead, which has the same numeric
value, and should be accepted without requiring narrowing.
Reported-by: Havner <https://github.com/dxx-rebirth/dxx-rebirth/issues/353>
Fixes: 88832e3679 ("Use constexpr integral_constant for various magic numbers")
Global variable `grd_curcanv` is set to a variety of canvases, some of
which are local stack variables. Use of global variables in this way is
fragile, but works as long as the global is not used beyond the life of
the backing local.
Unfortunately, some existing uses do access the canvas beyond the
lifetime of the backing local. Playing movies sets the font of the
current canvas. If the current canvas is an expired stack variable,
setting the font overwrites other stack data. This data corruption
causes various symptoms, such as inability to play the escape tunnel
movie.
Prior to 03cca2b3dc, the corruption on
playing the endlevel movie had no user-visible effect. That commit
created a large local variable, which changed stack layout. Starting
with that commit, the corruption causes the movie to play as all black.
Fix this, and protect against some other data corruption possiblities,
by clearing the global when the local goes out of scope.
Reported-by: Havner <https://github.com/dxx-rebirth/dxx-rebirth/issues/345> (only as cutscene failure to play, not as the underlying corruption issue)
Rather than use an inline wrapper and rely on the compiler optimizer to
redirect gr_set_current_canvas(nullptr) to gr_set_default_canvas,
rewrite all relevant calls directly in the source.
git grep -l 'gr_set_current_canvas' | xargs sed -i -e 's:gr_set_current_canvas(\s*NULL\|nullptr\s*);:gr_set_default_canvas();:'
Defining SLEW_ON breaks the build due to use of member variable names
not used since before the D2X import in 2001.
`unifdef -USLEW_ON -m -- similar/main/endlevel.cpp`
psyke83 reports that Debian distributions for Raspberry Pi now require a
different name for some video libraries. Merge psyke83's SCons
enhancements to add support for the new names while retaining support
for the old names.
ignorecase=1 coerces the user's input only for validation, but retains
the original case for later processing.
ignorecase=2 coerces the user's input for all purposes, and retains the
coerced form for later processing.
Since other code compares the `raspberrypi` variable to specific values
from the whitelist, user input must be mapped to that whitelist both for
SCons validation and for that later code. With ignorecase=1, a user
could set `raspberrypi=MESA`, which would pass SCons validation, but
then not be treated as equal to `mesa` when computing default values.
With ignorecase=2, `raspberrypi=MESA` will be recorded as `mesa` and
compute the desired default value.
Fixes: 166b1ecd4d ("RPI: update vendor library names & add Mesa VC4 build support")
PhysFS 2.0 only offers PHYSFS_read/PHYSFS_write for I/O. PhysFS 3.0
deprecates PHYSFS_read / PHYSFS_write and offers PHYSFS_readBytes /
PHYSFS_writeBytes. Converting Rebirth to use the new API is somewhat
invasive, and would require dropping support for PhysFS 2.0.
For now, for compatibility with PhysFS 2.0, disable the deprecation
errors and continue to use the older functions.
Reported-by: gabeotisbenson <https://github.com/dxx-rebirth/dxx-rebirth/issues/352>
Vendor library has new names to avoid conflicts with Mesa. Update
raspberrypi argument to use new libraries and support Mesa VC4 driver.
* raspberrypi=1 will build against the (newly named) vendor libraries
* raspberrypi=mesa will target building against the VC4 driver.
Both will select GLES by default, but you can target GL for the VC4 driver
via "raspberrypi=mesa opengles=0"
This code was part of a feature abandoned before retail. It cannot be
usefully used in campaigns. Remove it to reduce code size and simplify
later changes.
SCons tries to probe the compiler designated by CXX before Environment()
returns. Set CXX in the call to Environment so that it probes the
correct tool.