Commit graph

10571 commits

Author SHA1 Message Date
SanskritFritz 40f344125e Archlinux PKGBUILD fixes. 2019-12-30 00:15:33 +01:00
Kp fafa07a456 Instruct git-archive to insert a commit ID in SConstruct 2019-12-29 22:24:20 +00:00
Kp 4a47e27f08 Apply .decode() to various objects that are embedded in vers_id
Python 2 byte sequences look best when not decoded.  Python 3 byte
sequences look best when decoded.  As Python 2 is near end of life and
most distributions have moved on to Python 3, switch to the style that
looks better in Python 3.  The code still runs in Python 2, but produces
a u'' wrapper around the text because the type is `unicode` in Python 2,
but `str` in Python 3.  This change eliminates the b'' wrapper around
the text in Python 3.
2019-12-29 22:24:20 +00:00
Kp e2a108bbf5 Use base32 instead of base64+extended-identifiers
Extended identifiers have proved to cause more problems than they solve.
Switch to base32 which, while less commonly supported, is available in
Python and uses an alphabet that is almost a subset of the C identifier
alphabet.  Padding characters are still a problem, but can be remapped
to a valid C identifier that is not a valid base32 character.
2019-12-29 22:24:20 +00:00
Kp e20152da11 Remove -Wredundant-decls from the default options
This is primarily a developer option, and it conflicts with some Windows
toolchains that choke on their own headers.  Remove it from the default
options, and rely on developers to set it locally.

Reported-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/473#issuecomment-554935866>
2019-12-28 21:26:37 +00:00
Kp 1d6d5234ea Add documentation warning not to use paths with spaces
Rebirth handles this as best it can, but some prerequisites print paths
without quoting.  Advise users to avoid the problem by avoiding paths
with embedded spaces.
2019-12-28 21:26:37 +00:00
Kp ff42ee719f Improve install documentation regarding header/library paths 2019-12-28 21:26:37 +00:00
Kp 05a54ef7c1 Merge pull #479 into master 2019-12-27 02:08:58 +00:00
Kp ce906560ab Use susegment for segment2_read 2019-12-27 02:02:23 +00:00
Kp 34366d84c2 Use susegment for dumpmine iteration 2019-12-27 02:02:23 +00:00
Kp c9b1b5b1ec Use susegment for WALL_IS_DOORWAY 2019-12-27 02:02:23 +00:00
ziplantil 398d9013ef Merge remote-tracking branch 'upstream/master' into vertigo-exit-fix 2019-12-24 01:49:11 +02:00
Kp dfae1c7203 Split object_move_all for game/endlevel
endlevel wants to freeze the console player's last in-mine position.
Instead of copying the position out and back, refactor the flow to let
endlevel skip the update of the position.
2019-12-22 05:34:08 +00:00
Kp 36873ec12d Simplify maybe_ai_do_actual_firing_stuff
The second parameter always points to a substructure in the first
parameter.  Remove the second parameter.
2019-12-22 05:34:08 +00:00
Kp 5dfd62c4f6 Use susegment for references introduced by valptridx conversion 2019-12-22 05:34:08 +00:00
Kp c93e7f44c3 Move object::last_pos to LevelUniqueObjectState
Only the console player's last position needs to be remembered across
frames.  Copy the console player's position out before processsing
object movement.  For all other objects, retain a temporary for use by
the position recovery code.
2019-12-22 05:34:08 +00:00
Kp 30091902af Simplify valptridx types where possible
Switch valptridx::ptr to a reference type.
Switch valptridx::ptridx to a reference type or to ::ptr.

Fix up uses of operator-> accordingly.
2019-12-22 05:34:08 +00:00
Kp c3265f6b90 Convert segment & to susegment where possible 2019-12-22 05:34:08 +00:00
Kp 00d09b2bdb Move free_object_slots predicates to dcx 2019-12-22 05:34:08 +00:00
Kp cc144647b5 Make kconfig.ui-table.cpp compile when freestanding
Special macros are used to pass information to
`generate-kconfig-udlr.py`.  Provide default definitions for these
macros in `kconfig.ui-table.cpp`, and override them in the one build
where they need to be special.  This enables `kconfig.ui-table.cpp` to
build cleanly when invoked from the command line in the compilation
database.
2019-12-22 05:34:08 +00:00
Kp f26d91bbe2 Change kconfig type/state fields to enums 2019-12-22 05:34:08 +00:00
Kp d2f2f98850 Use symbolic STATE_NONE for kconfig entries with no state bit 2019-12-22 05:34:08 +00:00
Kp 3eedd9234e Add susegment to pair references to shared_segment/unique_segment
Various functions need to access both `shared_segment` and
`unique_segment` data.  Using `segment &` for this blocks eliminating
the `segment` type.  Add `susegment` and type aliases to it.
`susegment` records a reference to a `shared_segment` and a
`unique_segment` together, so that users cannot accidentally mismatch
`shared_segment` #1 with `unique_segment` #2 when passing references
down to a function which needs both `shared_segment` and
`unique_segment`.
2019-12-22 05:34:08 +00:00
ziplantil 4cb06c43f7 revert to old load behavior when emulating D1 2019-12-21 23:42:04 +02:00
ziplantil e5c7d47199 adjust exit bitmap indexes for hatch models 2019-12-19 15:33:58 +02:00
ziplantil 0a21784aa7 some changes as per comments in #479 2019-12-18 13:44:43 +02:00
Kp 065bcb3da8 Escape more characters when quoting for the command line
Inserting the compile command for vers_id.cpp into a compilation
database does not quote a string with embedded whitespace, although this
string is correctly quoted when used to invoke a shell.  Remove
whitespace from the character whitelist, so that it is always escaped.
2019-12-17 05:01:38 +00:00
Kp b037cd556f Explicitly default valptridx<T>::strong_typedef
gcc considers strong_typedef to be POD both with and without the
explicit default.  clang considers it to be POD only if the constructor
is explicitly defaulted.
2019-12-17 05:01:38 +00:00
Kp 0d9b488be4 Support building valptridx without slice checking
For correctness, valptridx::ptridx instances must not be sliced down to
their component ::ptr or ::idx base classes.  Previously, this was done
with a dummy template parameter to ensure that a bare ::idx had a
different type than the idx base of a ::ptridx.  This extra distinction
complicates analysis of the code, and is not needed when the code is
already correct.  Add the ability to build without slice checking.
2019-12-16 01:57:00 +00:00
Kp 6b637e856b Copy last_hitobj to a temporary before passing it to reset_hitobj
obj_rw is a packed structure, so configurations where reset_hitobj takes
its parameter by reference (or where its parameter requires passing
through a constructor that takes its input by reference) fail because
gcc refuses to bind a reference to a member of a packed structure.  Copy
the member variable into a local, which gcc will bind.
2019-12-16 01:56:59 +00:00
Kp 3f74084c0f Include segment.h for terrain.cpp to handle over-eager instantiation
In some configurations, gcc (but not clang) instantiate
valptridx<segment>::array_managed_type too eagerly, then fail if the
sizeof(segment) is unknown.  Include segment.h so that the size is
available.
2019-12-16 01:56:59 +00:00
Kp 219a3fcd11 Move laser_info::get_last_hitobj out of line
It is only used in two places, neither of which are hot paths.  Move it
out of line so that other files do not need to parse it.
2019-12-16 01:56:59 +00:00
Kp 28d9358b00 Expand local aliases to their target variables
This makes the code easier to read, at the price of a bit of churn.
2019-12-16 01:56:59 +00:00
Kp 148fe47d82 Split checked/unchecked valptridx converting constructor logic
This allows the caller to omit filename/line information for calls that
will never need it.
2019-12-16 01:56:59 +00:00
Kp 5950485a6c Fix ptridx move constructor delegating to ptr copy constructor
Fix a bug where the ptridx converting move constructor delegated to the
ptr converting copy constructor, since the ptr copy constructor had
filename/line arguments, the ptr move constructor did not, and the
ptridx move constructor always passed filename/line.
2019-12-16 01:56:59 +00:00
ziplantil 341c622e69 that verbose one is no longer needed 2019-12-12 17:42:53 +02:00
ziplantil ed88836e9d make sure there is enough space to load exit data 2019-12-12 17:34:42 +02:00
ziplantil cb2b844af3 do not free extra models when loading exit stuff on D2 2019-12-12 17:25:11 +02:00
Kp ca383c1fe7 Fix Win32 build of scores.cpp
Fixes: 0b8f32d744 ("Set player name in Players[] at single-player game start")
2019-11-19 02:42:24 +00:00
Kp 5f0e99b472 Update installation documentation
- Recommend Python 3.  Python2 will be end of life soon.
- Recommend PhysFS 3.
- Update link for SCons to current version.
-- Remove the obsolete note disclaiming Python3 support.
- Remove the obsolete note disclaiming SDL2 support.  SDL2 works well
  now.
- Recommend libpng, since SConstruct will try to use it in the default
  configuration.
- Note the presence of Linux packaging files for Arch, RPM systems, and
  Gentoo.

Reported-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/473>
2019-11-18 05:05:56 +00:00
Kp b399794a53 Remove test for unconverted characters after a superx= line
Historically, Descent ignored any trailing unconverted characters.  The
logic in Descent 1 was tightened in 3368390f37, and then the logic in
Descent 2 was made to mirror Descent 1 in 19699037ce.  Restore the lax
parsing logic in both games.

Reported-by: InsanityBringer <https://github.com/dxx-rebirth/dxx-rebirth/issues/464> (issue 5)
Fixes: 3368390f37 ("Check for valid SuperX number") (for Descent 1)
Fixes: 19699037ce ("Move d2x-rebirth/main/bmread.cpp -> similar/main/bmread.cpp") (for Descent 2)
2019-11-18 00:22:34 +00:00
Kp abb000177a Move bm_read_reactor object type check into if(D1)
In Descent 2, `type` is initialized at declaration time, then never
rewritten.  At the end of the function, `Error` is called if `type` has
not been rewritten.  Originally, `type` was hard reset to
`OL_CONTROL_CENTER`, but this reinitialization was removed when
`ObjType` and related data were removed from Descent 2.

Reported-by: InsanityBringer <https://github.com/dxx-rebirth/dxx-rebirth/issues/464> (issue 3)
Fixes: ea7ba7ae87 ("remove ObjType, ObjId, ObjStrength and OL_ constants; use "object" instead of "robot" in some places; draw and place reactors with correct modelnum")
2019-11-18 00:22:34 +00:00
Kp adf12be0be Clear bm_load_sub:fname before use
Later writes do not guarantee null termination.  Clear the entire buffer
first, since it is small.

Reported-by: InsanityBringer <https://github.com/dxx-rebirth/dxx-rebirth/issues/464> (issue 2)
2019-11-18 00:22:34 +00:00
Kp 075b14373a Change Difficulty_level_type from unsigned to signed
Difficulty_level_type is used in arithmetic expressions.  If
Difficulty_level_type is unsigned, then those expressions use unsigned
terms, but some of the expressions were designed to use signed terms and
produce incorrect results when used with unsigned terms.  There is no
strong reason to make Difficulty_level_type unsigned, so switch it to
signed instead of trying to fix every site that uses it.

Reported-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/471>
Fixes: 1eaaff3016 ("Move Difficulty_level to GameUniqueState")
2019-11-17 23:27:13 +00:00
Kp ba283fb036 Sort mission directories to the top of the list, behind builtin missions
This is an observable change, but hopefully is an improvement overall.
2019-11-17 01:42:09 +00:00
Kp 6f54229f5a Sort missions in subdirectories
Mission sorting is handled in a top-level function after the missions
have been found, so that the special case to promote built-in missions
is only applied at the top level.  Unfortunately, this meant that
subdirectories were not sorted.  Add an explicit sort in a path specific
to subdirectory handling.

Reported-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/472>
2019-11-17 01:35:08 +00:00
Kp 600dac43d8 Only count a robot as dropped after the object is created
If object creation fails, the counter is not decreased.  This creates an
imbalance by over counting the number of robots in existence.  Avoid
this imbalance by deferring the counter update until after the robot is
created.
2019-11-16 23:14:41 +00:00
Kp c6770c3dde Fix robot accounting when robots drop robots
When a robot drops a robot, the dropped robot is not added to the
level's running accumulated_robots counter, but when the player destroys
that robot, the destruction will be counted.  This imbalance allows the
expression counting the number of not-yet-destroyed robots to underflow,
which then confuses the matcen logic into not creating new robots.

Fix this by incrementing the accumulated_robots count as each dropped
robot is created.

Reported-by: ziplantil <https://github.com/dxx-rebirth/dxx-rebirth/issues/466>
2019-11-16 23:14:41 +00:00
Kp c8c5ed9b86 Merge branch osx-build into master
This change was proposed by an external user as a claimed fix for a
failure to build.  This change has not been tested by the core team.
However, it is a simple change and at worst will break the build.

The change is based in part on advice from recurring contributor
@MaddTheSane.  Neither @MaddTheSane nor @kreatordxx have commented on
the correctness of these changes, though the original author of the
commit, @Sottises, is listed as the origin of the most recent prebuilt
OS X package offered from
<https://www.dxx-rebirth.com/download-dxx-rebirth/>.

Reported-by: Sottises <https://github.com/dxx-rebirth/dxx-rebirth/issues/455>
2019-11-16 22:46:48 +00:00
Kp 93d3793b30 Fix crash entering secret level with music on, and no songs
If music is configured as built-in, and no secret songs are configured,
then BIMSecretSongs is set to a non-null pointer to a zero-element
array.  This triggers a divide-by-zero when the array length is used in
a modulus operation.

Fix this by adding a special case that initializing from an empty vector
calls `reset()`, which causes the underlying unique_ptr to store
`nullptr` instead of `new bim_song_info[0]`.

Reported-by: Daniel-Leontiev <https://github.com/dxx-rebirth/dxx-rebirth/issues/465>
Fixes: c355e207fe ("Refactor song loading")
2019-11-02 04:36:15 +00:00