In past releases, D1X-Rebirth played the title song even when the user
specified `-notitles`. Commit 29f79f0a6b
("Enable -notitles for Descent 2") fixed this. Unfortunately, despite
being called SONG_TITLE, users believe this to be main menu music, not
title screen music. This belief is reinforced by other code sites that
play the title song on returning to the main menu. Reintroduce the bug
by moving the call above the test for `-notitles`. This restores the
semantics that users expect.
It was a convenient transition macro, but its presence was always
intended to be temporary. Expand it to ease the conversion of usage
sites that already have access to local player data through a local
variable.
Descent demos do not record the time remaining on cloak/invulnerability,
so the demo system tries to fake it by forcing any cloaked player to
have a time remaining of 50%. Extend that hack to do the same for
invulnerability. The local player needs that hack. Remote players do
not need it, but the logic is simpler with it in the loop than with a
special case for just the local player.
Per comment, MK meant for this test to match the Helix cannon, but the
implementation was wrong. Primary weapon indexes cannot be compared to
weapon ID types. The two use different number spaces. Using proper
enum types for each causes the compiler to report this mistake. Fix the
test.
Define it where it is first used.
Skip adjusting damage in cases where it will not be used.
Fix obvious copy&paste error from Parallax.
if (condition)
statement; statement; statement;
is parsed as:
if (condition)
{
statement;
}
statement;
statement;
In context, all three statements were supposed to be guarded by the
condition. Add braces accordingly.
Using "type\nfunction(args)" confuses some parsing scripts. Switch to
the standard "type function(args)" style. Fix sites where keyword
"static" was used after the return type.
No caller passes a key value other than [KEY_F9, KEY_F12]. If one did,
an invalid array reference would occur. Restructure the code to return
on invalid inputs. This fixes a flow control analysis warning.
Per request from Mako88, remove unused loadgl typedefs. loadgl.h
was imported from elsewhere and defines typedefs for many functions
that Descent does not use. Some of these are guarded by WINVER
conditionals and, in Mako88's unspecified environment, defining WINVER
to expose these results in a build failure because the guarded typedef
requires a type that is not defined by the environment.
Compensate for that by removing all unused gl typedefs.
# Save the results to a file, then run the file separately. This
# avoids any chance that sed might try to edit the file while later
# searches are still running.
git grep 'typedef .*OGLFUNCCALL \*' common/include/loadgl.h | sed -e 's/^.*OGLFUNCCALL \*//' -e 's/).*$//' | while read f; do
if ! git grep -q 'DEFVAR\s'"$f"'\>' -- common/include/loadgl.h; then
echo "/\\<$f\\>/d"
fi
done > unused.sed
sed -i common/include/loadgl.h -f unused.sed