Commit graph

10104 commits

Author SHA1 Message Date
Kp e53e969d92 Update Gentoo ebuilds
- 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.
2017-11-25 01:56:51 +00:00
Kp d42fff397b Fix Windows exception log short stack
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.
2017-11-18 04:45:50 +00:00
Kp e5496d3aaf Consume trailing newline for Rebirth.rotate.robot directive 2017-11-18 04:45:50 +00:00
Kp 479ac8761f Add experimental D2 support for D1 style robot briefings 2017-11-13 01:59:49 +00:00
Kp 720e5661d6 Update INSTALL.markdown to reflect dropped support for <gcc-4.9
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
2017-11-11 18:03:08 +00:00
Kp 425b78b8a6 Fix clang build failure on flicker_timer_disabled
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")
2017-11-07 00:44:59 +00:00
Kp ff49e949d4 Fix savegame thumbnail previews
Transposed arguments to fill_n caused rls_stretch_scanline to write
garbage to the preview buffer.

Reported-by: Havner <https://github.com/dxx-rebirth/dxx-rebirth/issues/354>
Fixes: 8aadb4be5b ("Use fill_n instead of inline loop to write scanline")
2017-11-06 04:24:16 +00:00
Kp 09963e8b5a Remove write-only Seg_scale 2017-11-05 20:49:09 +00:00
Kp f742e44091 Simplify lighting test 2017-11-05 20:49:09 +00:00
Kp c33f343d0b Return side_none for openable_doors_in_segment failure path 2017-11-05 20:49:09 +00:00
Kp a4ed8d5c9c Hold morph_rate constexpr 2017-11-05 20:49:09 +00:00
Kp 7eadc218a6 Add debugging code to trace global canvas updates 2017-11-05 20:49:09 +00:00
Kp d049f738c8 Convert various gr_set_current_canvas calls to reference form 2017-11-05 20:49:08 +00:00
Kp 4f40b9de18 Assert that a canvas is not referenced when it is destroyed 2017-11-05 20:49:08 +00:00
Kp ca804d5186 Clear canvas to fix missing exit tunnel movie
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)
2017-11-05 20:49:08 +00:00
Kp 49c0cdae2e Simplify calls to gr_set_default_canvas
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();:'
2017-11-05 20:49:08 +00:00
Kp b7641e17eb Hide PF_UVS,PF_LS from OGL build
Only the SDL build uses them.  Preprocess them out of the OGL build.
2017-11-05 20:49:08 +00:00
Kp 6043168d51 Move various SDL-only texture mapping functions to !DXX_USE_OGL
The OGL build compiles, but does not use, various texture mapping
functions.  Move these to be built only for the SDL build.
2017-11-01 02:01:21 +00:00
Kp 87686e5962 Pass fade value to c_tmap_scanline_shaded as a parameter
Writing it to a global so that the called function can immediately read
it back is wasteful.  Pass it as a parameter.
2017-11-01 02:01:21 +00:00
Kp f598542f35 Simplify helix orientation calculation 2017-11-01 02:01:21 +00:00
Kp 5d4d3347e6 Remove unused found_poly 2017-11-01 02:01:20 +00:00
Kp 3fbc710ec5 Move various SDL-only scanline functions to !DXX_USE_OGL
The OGL build compiles, but does not use, various scanline functions.
Move these to be built only for the SDL build.
2017-11-01 02:01:20 +00:00
Kp 92c6196396 Remove long-dead SLEW_ON code
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`
2017-11-01 02:01:20 +00:00
Kp 8684cf5571 Remove unused gr_bitblt_dest_step_shift
It is always 0, and has been since it was imported in D2X.
2017-11-01 02:01:20 +00:00
Kp 5e563ca3c0 Remove unused OGL c_tmap_scanline_per
scanline.cpp defined two implementations, one in a `#if 1` and the other
in an else.  Keep the enabled one.  Delete the other.
2017-11-01 02:01:20 +00:00
Kp aa6ca60a03 Remove unused OGL c_tmap_scanline_lin
Keep the SDL c_tmap_scanline_lin, which is used.
2017-11-01 02:01:20 +00:00
Kp 3276590084 Merge branch 'psyke83/rpi' into master
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.
2017-10-26 02:02:50 +00:00
Kp 1eb29c6e71 Set raspberrypi EnumVariable ignorecase=2 to avoid user confusion
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")
2017-10-26 01:58:28 +00:00
Kp 8838b46e65 Suppress PhysFS deprecation errors
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>
2017-10-22 04:20:35 +00:00
Conn O'Griofa 166b1ecd4d RPI: update vendor library names & add Mesa VC4 build support
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"
2017-10-22 02:50:13 +00:00
Kp 8d80300e0a Remove obsolete D1 hostage editor code
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.
2017-10-14 17:10:31 +00:00
Kp 96bc6f2047 Use enumerate for medrobot AI mode boxes 2017-10-14 17:10:31 +00:00
Kp e035fb215a Cache width in libmve decoder 2017-10-14 17:10:31 +00:00
Kp 255655e8e7 Reduce scope of switch.cpp for loop variables 2017-10-14 17:10:31 +00:00
Kp 2e7dce83c6 Use enumerate for gamefont arrays 2017-10-14 17:10:31 +00:00
Kp 22b22a4a70 Use enumerate for verifying Effects 2017-10-14 17:10:31 +00:00
Kp e58956ddeb Simplify digi_audio_stop_all_channels 2017-10-14 17:10:31 +00:00
Kp 4d271f6d5e Simplify wiping Cyberman field 2017-10-14 17:10:30 +00:00
Kp 450d2f727c Use range_for for endlevel array stars 2017-10-14 17:10:30 +00:00
Kp 88832e3679 Use constexpr integral_constant for various magic numbers 2017-10-14 17:10:30 +00:00
Kp 666539b88f Define valptridx factory typedef earlier 2017-10-14 17:10:30 +00:00
Kp 3ad6972a03 Read pkg-config modversion before flags, not after
Reading modversion after flags can cause confusing output if the flags
load successfully, but the modversion call fails.
2017-10-14 17:10:30 +00:00
Kp 12369d2dd8 Add SConstruct modeline to set tabstop=4 2017-10-14 17:10:30 +00:00
Kp 8f4a20e65b Set Environment CXX earlier
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.
2017-10-14 17:10:30 +00:00
Kp 49da5bd5f7 Suppress blank builddir from CPPPATH 2017-10-14 17:10:30 +00:00
Kp e9d8c3c784 Only include linker version if linker path is available
If resolving the linker path fails, ld_path is not usable to run an
external program, but DXXProgram tried to use it as such.  Test ld_path
before using it.
2017-10-14 17:10:29 +00:00
Kp b9af2dbedb Only shlex.split pkg-config paths from user
Splitting auto-generated paths is wasteful, but almost always harmless
on Linux.  However, Windows uses backslash as a path separator, which
conflicts with its standard meaning as an escape character.  Using
shlex.split on a generated Windows path strips required backslashes,
causing a later failure to find the command.  Move the shlex.split call
to apply only to user-specified paths.

Reported-by: ef314159 <https://github.com/dxx-rebirth/dxx-rebirth/issues/349>
2017-10-14 17:10:29 +00:00
Kp d0f709381d Fix build break when using Windows as a host platform
ef314159 reports that running SCons on Windows fails with an
AttributeError exception.  `os.uname` is not available on Windows, but
SConstruct assumed it was.  Trap the error and report a machine of
`None`, since this is purely for logging.

Reported-by: ef314159 <https://github.com/dxx-rebirth/dxx-rebirth/issues/348#issuecomment-334657171>
Fixes: 1ed7cec714 ("Tighten __builtin_constant_p check to handle gcc-7")
2017-10-07 00:54:55 +00:00
Kp af863fdef7 Parenthesize SCons message() call to print
When print_function is imported (or Python 3 is used), print without
parentheses is an error.  Historically, SCons has used only Python 2 and
has not enabled print_function.  This may change, so add parentheses to
the one affected site.  None of the print_function features are used, so
this should work in both Python 2 and Python 3.
2017-10-07 00:54:55 +00:00
Kp 8291391b7f Fix D2 emulation of D1 boss teleport handling
Descent 1 bosses could always teleport, but were only placed in large
areas where free teleporting was always permitted.

Descent 2 boss 1 was placed in a confined segment and not permitted to
teleport out of it until it was opened.  This was implemented by a
two-part change relative to Descent 1 rules:

- Descent 1 bosses were always permitted to teleport to any teleport
  destination segment.  Descent 2 bosses were only permitted to teleport
  if the player was visible or the boss had recently been hit.
- When computing the permitted list of teleport destination segments,
  Descent 1 used directly connected accessible segments, then stopped.
  Descent 2 started with this rule, but if the list had at most 1 entry,
  then it would assume this is the confined boss and recompute the list
  with the first wall ignored.  This recomputed list allowed the boss to
  teleport to any segment in the larger arena outside its starting
  segment.

After D2X-Rebirth support for emulating Descent 1 bosses was enhanced in
28bd4c1650, Descent 1 bosses gained the ability to teleport out of a
confining cube early, but only in D2X-Rebirth when emulating Descent 1.
In D1X-Rebirth, when a boss is placed in a confining cube, it can always
teleport, but only to that confining cube.  In D2X-Rebirth, Descent 1
bosses retain the always-teleport rule of Descent 1, but gained the
Descent 2 rule for expanding its search to the surrounding arena.  It
should only use the expanded search when it also abides by the Descent 2
restriction not to teleport before the first wall is opened.  It did not
abide by that rule.  This commit adds that restriction for Descent 1
bosses.

Reported-by: ef314159 <https://github.com/dxx-rebirth/dxx-rebirth/issues/348>
Fixes: 28bd4c1650 ("Enable D1 boss behavior in d2x build. So we get correct boss behavior when emulating D1, and 3rd party mn2s can include D1 bosses.")
2017-10-06 01:59:09 +00:00