Commit graph

3828 commits

Author SHA1 Message Date
Kp 1be7344d56 Pass player_info to auto_select_secondary_weapon 2016-10-02 00:34:43 +00:00
Kp 00ccd3f6f6 Move Delayed_secondary into Secondary_weapon 2016-10-02 00:34:43 +00:00
Kp e6b44ffef1 Pass player_info to delayed_autoselect 2016-10-02 00:34:43 +00:00
Kp f148eee01a Pass player powerup_flags to PLAYER_MAX_AMMO 2016-10-02 00:34:42 +00:00
Kp 04eeda8486 Pass local player to skip_create_egg_powerup 2016-10-02 00:34:42 +00:00
Kp e9eaf53c8a Pass player powerup_flags to ai_door_is_openable 2016-10-02 00:34:42 +00:00
Kp 89cec10270 Pass player powerup_flags to compute_vis_and_vec 2016-10-02 00:34:42 +00:00
Kp 5e30489943 Pass player powerup_flags to do_firing_stuff 2016-10-02 00:34:42 +00:00
Kp cae992db5b Factor out move_around_player multiplications 2016-10-02 00:34:42 +00:00
Kp c029d47825 Pass player powerup_flags to move_around_player 2016-10-02 00:34:41 +00:00
Kp bb65d3ce97 Pass player powerup_flags to ai_fire_laser_at_player 2016-10-02 00:34:41 +00:00
Kp 8cfa1508b6 Pass player powerup_flags to escort_set_goal_object 2016-10-02 00:34:41 +00:00
Kp 147af3d4f5 Use array<> for pick_connected_segment arrays 2016-10-02 00:34:41 +00:00
Kp e6e00debba Pass only segidx to pick_connected_segment
A full object is not necessary.
2016-10-02 00:34:41 +00:00
Kp a62cc369ab Expand get_local_player_shields
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.
2016-10-02 00:34:40 +00:00
Kp fe99fe232b Expand get_local_player_vulcan_ammo
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.
2016-10-02 00:34:40 +00:00
Kp ce65735c04 Expand get_local_player_flags
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.
2016-10-02 00:34:40 +00:00
Kp 1b321ac0c6 Expand get_local_player_secondary_ammo
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.
2016-10-02 00:34:40 +00:00
Kp b422db5500 Expand get_local_player_cloak_time
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.
2016-10-02 00:34:39 +00:00
Kp 194d258e59 Condense buddy key check 2016-10-02 00:34:39 +00:00
Kp f3865db4cb Use implicit range of vtrgptr 2016-10-02 00:34:39 +00:00
Kp 1ab55f7551 Cast maybe_select_weapon_by_type input to weapon enum
All callers provide a value which must be a valid weapon number.  Cast
the result to a weapon enum so that called helpers can be converted to
expect an enum.
2016-10-02 00:34:39 +00:00
Kp 437d1717d8 Combine automap add_one_edge flags 2016-09-30 01:49:57 +00:00
Kp cd4e5441ba Rename WORDS_BIGENDIAN to DXX_WORDS_BIGENDIAN
Rename symbol WORDS_BIGENDIAN to DXX_WORDS_BIGENDIAN to show that it is a DXX
symbol, not one inherited from a library.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -wl WORDS_BIGENDIAN -- '*.h' '*.cpp' | xargs sed -i -e 's/^\s*#ifdef \(WORDS_BIGENDIAN\)\>/#if DXX_\1/' -e 's/\s*#\(el\)\?if \(.*\)defined(\(WORDS_BIGENDIAN\))/#\1if \2DXX_\3/' -e 's/^\s*#ifndef \(WORDS_BIGENDIAN\)\>/#if !DXX_\1/'
2016-09-30 01:49:57 +00:00
Kp 6efd304118 Merge branch 'button_pointers' into master 2016-09-28 02:09:25 +00:00
Kp 8d25cf4162 Define newmenu_item::*_specific_type::nm_type
The *_specific_type structures have a static member `nm_type`.  In -O0
builds, an out-of-line definition of this member is required, but was
not present.  In -O2 builds, the optimizer happened to remove all
references to the out-of-line definition, so the link succeeded despite
not having a definition.  Add that definition.
2016-09-28 01:56:12 +00:00
Chris Taylor dd1a6cc7b9 Save more unique_ptr's to UI_GADGET_BUTTON's
Save unique_ptr's to UI_GADGET_BUTTON's in similar/editor/med.cpp and similar/editor/medwall.cpp. Fixes compile errors and resolves a crash when attempting to access both dialogs' gadgets (input event processing is the first attempt).
2016-09-27 15:11:50 +08:00
Kp 10f4f87a36 Fix _g3_draw_poly declaration/definition inconsistency
_g3_draw_poly uses type cg3s_point which is const in OGL and non-const
in SDL.  gcc-6 with LTO reports a One Definition Rule violation for this
mismatch:

    typedef const int cint;
    void f(cint *);
    void f(const int *) {}

The code ran correctly as it was, but the fix is trivial and has no
effect on the generated code, so fix it to satisfy the compiler.
2016-09-26 00:50:09 +00:00
Kp 56e4f6b6f7 Factor out set_color_by_model_light color
Optimizing compilers tend to factor out color automatically.  Move it up
to the caller to ensure that it is computed once even if the compiler
does not optimize aggressively.
2016-09-26 00:50:09 +00:00
Kp cc2fd7071d Fold endlevel_render_mine g3_set_view_matrix call 2016-09-26 00:50:09 +00:00
Kp d0c3f03d54 Remove unnecessary nullptr test on nonnull parameter in select_file_recursive2
gcc-6 warns about this test because the caller is not permitted to pass
nullptr here, so the test is unnecessary.
2016-09-26 00:50:09 +00:00
Kp ef6f803200 Remove unnecessary nullptr test on nonnull parameter
gcc-6 warns about this test because the caller is not permitted to pass
nullptr here, so the test is unnecessary.
2016-09-26 00:50:09 +00:00
Kp bf7995ade2 Fold render call to g3_set_view_matrix
Remove support for JOHN_ZOOM.  It was present in the initial release,
but never activated.
2016-09-26 00:50:08 +00:00
Kp 4894117d70 Rename MAX_HATS_PER_JOYSTICK to DXX_MAX_HATS_PER_JOYSTICK
Rename symbol MAX_HATS_PER_JOYSTICK to DXX_MAX_HATS_PER_JOYSTICK
to show that it is a DXX symbol, not one inherited from a library.

git grep -lzw MAX_HATS_PER_JOYSTICK -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_HATS_PER_JOYSTICK\>/DXX_&/g'
2016-09-25 04:52:49 +00:00
Kp 94937de128 Rename MAX_BUTTONS_PER_JOYSTICK to DXX_MAX_BUTTONS_PER_JOYSTICK
Rename symbol MAX_BUTTONS_PER_JOYSTICK to DXX_MAX_BUTTONS_PER_JOYSTICK
to show that it is a DXX symbol, not one inherited from a library.

git grep -lzw MAX_BUTTONS_PER_JOYSTICK -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_BUTTONS_PER_JOYSTICK\>/DXX_&/g'
2016-09-25 04:52:49 +00:00
Kp 7d38a9f0be Rename MAX_AXES_PER_JOYSTICK to DXX_MAX_AXES_PER_JOYSTICK
Rename symbol MAX_AXES_PER_JOYSTICK to DXX_MAX_AXES_PER_JOYSTICK to show
that it is a DXX symbol, not one inherited from a library.

git grep -lzw MAX_AXES_PER_JOYSTICK -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_AXES_PER_JOYSTICK\>/DXX_&/g'
2016-09-25 04:52:49 +00:00
Kp f24e9f836c Rename MAX_JOYSTICKS to DXX_MAX_JOYSTICKS
Rename symbol MAX_JOYSTICKS to DXX_MAX_JOYSTICKS to show that it is a DXX
symbol, not one inherited from a library.

git grep -lzw MAX_JOYSTICKS -- SConstruct '*.h' '*.cpp' | xargs -0 sed -i -e 's/\<MAX_JOYSTICKS\>/DXX_&/g'
2016-09-25 04:52:48 +00:00
Kp 69eec0d71f Save some editor gadget pointers 2016-09-24 18:06:11 +00:00
Kp 62b58e9890 Move OGL to dxxsconf.h; rename to DXX_USE_OGL
Rename symbol OGL to DXX_USE_OGL to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -lzw OGL -- '*.h' '*.cpp' | xargs -0 sed -i -e 's/\(\s*#\s*if\)def\s*OGL/\1 DXX_USE_OGL/' -e 's/\(\s*#\s*if\)ndef OGL/\1 !DXX_USE_OGL/' -e 's/\(\s*#\s*if !\?\)defined(OGL)/\1DXX_USE_OGL/'
2016-09-24 18:06:11 +00:00
Kp 3544ea097d Move OGLES to dxxsconf.h; rename to DXX_USE_OGLES
Rename symbol OGLES to DXX_USE_OGLES to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -lzw OGLES -- '*.h' '*.cpp' | xargs -0 sed -i -e 's/\(\s*#\s*if\)def\s*OGLES/\1 DXX_USE_OGLES/' -e 's/\(\s*#\s*if\)ndef OGLES/\1 !DXX_USE_OGLES/'
2016-09-24 18:06:11 +00:00
Kp 7a13d3f228 Include dxxsconf.h explicitly and earlier 2016-09-24 18:06:10 +00:00
zico 1e6a5ec528 Addition for 6c6a32ba92, allowing edge padding for overlaying level textures, disabling it for base textures. This isn't needed and improves visual appearence of base textures with transparency (fuelcenters, forcefields, grates, etc) when texture filtering is enabled. 2016-09-17 18:26:59 +02:00
zico 1f144f167c Addition for 6c6a32ba92, allowing edge padding for level and polymodel texturees only but disable it for sprites, fonts, hud images, etc. as those looked bad with this form of color bleeding in combination with various texture filtering mechanics. 2016-09-17 15:56:43 +02:00
Kp 8180fc34e8 Merge branch 'locale_header_directive' into unification/master
`std::use_facet` is provided by `<locale>`.  x86_64-pc-linux-gnu happens
to provide `std::use_facet` in inferno.cpp without explicitly including
`<locale>`.  kreator found that clang on OS X does not implicitly
provide `<locale>`.  `<locale>` must be included to make
`std::use_facet` available on OS X.  Although it worked without this on
Linux, it is the right thing to do everywhere.
2016-09-15 01:50:56 +00:00
Kp 0bff113335 Fix triangle rendering problem
Unlike many uses of index_sequence<N...>, this set of N... is not the
result of make_tree_index_sequence.  Some callers pass sequences with
`Nn != n` for some n, so vp is not initialized as a copy of all elements
of ovp in the same order as ovp.

Fixes: fa5475aa54 ("Remove unnecessary copy of vertex points")
2016-09-14 01:59:33 +00:00
kreatordxx b39cdac1fd Add include directive for <locale>
Add include directive for <locale>, fixing four compiler errors on Apple Clang.
2016-09-13 19:34:32 +08:00
Kp f11235147a Work around clang crash bug
clang crashes with a segmentation fault if asked to implicitly convert
1u to std::size_t in partial_range inline chain.  Add a conversion
outside the inline chain, which seems to avoid the bug.
2016-09-11 18:49:17 +00:00
Kp 72e9ed319c Rename VERSION to DXX_VERSION_STR
Rename symbol VERSION to DXX_VERSION_STR to show that it is a DXX
symbol, not one inherited from a library.
2016-09-11 18:49:16 +00:00
Kp 6a3ded191f Move EDITOR to dxxsconf.h; rename to DXX_USE_EDITOR
Rename symbol EDITOR to DXX_USE_EDITOR to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -wl EDITOR -- '*.h' '*.cpp' | xargs sed -i -e 's/^\s*#ifdef \(EDITOR\)\>/#if DXX_USE_\1/' -e 's/\s*#\(el\)\?if \(.*\)defined(\(EDITOR\))/#\1if \2DXX_USE_\3/' -e 's/^\s*#ifndef \(EDITOR\)\>/#if !DXX_USE_\1/'
2016-09-11 18:49:16 +00:00
Kp 0015b4282c Move IPv6 to dxxsconf.h; rename to DXX_USE_IPv6
Rename symbol IPv6 to DXX_USE_IPv6 to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -wl IPv6 -- '*.h' '*.cpp' | xargs sed -i -e 's/^\s*#ifdef \(IPv6\)$/#if DXX_USE_\1/' -e 's/\s*#\(el\)\?if \(.*\)defined(\(IPv6\))/#\1if \2DXX_USE_\3/'
2016-09-11 18:49:15 +00:00
Kp 435aa5a020 Move USE_UDP to dxxsconf.h; rename to DXX_USE_UDP
Rename symbol USE_UDP to DXX_USE_UDP to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -l USE_UDP -- '*.h' '*.cpp' | xargs sed -i -e 's/^\s*#ifdef \(USE_UDP\)$/#if DXX_\1/' -e 's/\s*#\(el\)\?if \(.*\)defined(\(USE_UDP\))/#\1if \2DXX_\3/'
2016-09-11 18:49:15 +00:00
Kp 7c8c2b5aa4 Move USE_TRACKER to dxxsconf.h; rename to DXX_USE_TRACKER
Rename symbol USE_TRACKER to DXX_USE_TRACKER to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct were
manual.

git grep -l USE_TRACKER -- '*.h' '*.cpp' | xargs sed -i -e 's/^#ifdef \(USE_TRACKER\)$/#if DXX_\1/' -e 's/#\(el\)\?if \(.*\)defined(\(USE_TRACKER\))/#\1if \2DXX_\3/'
2016-09-11 18:49:15 +00:00
Kp ddf888cd72 Move USE_SDLMIXER to dxxsconf.h; rename to DXX_USE_SDLMIXER
Rename symbol USE_SDLMIXER to DXX_USE_SDLMIXER to show that it is a DXX
symbol, not one inherited from a library.  Move it to dxxsconf.h to
shorten the command line.

This is a mostly automated transform, but the changes to SConstruct and
inferno.cpp were manual.

git grep -l USE_SDLMIXER -- '*.h' '*.cpp' | xargs sed -i -e 's/^#ifdef \(USE_SDLMIXER\)$/#if DXX_\1/' -e 's/#\(el\)\?if \(.*\)defined(\(USE_SDLMIXER\))/#\1if \2DXX_\3/'
2016-09-11 18:49:15 +00:00
Kp 0249358ccc Fold render_face flashing light tests 2016-09-11 18:49:15 +00:00
Kp 2952857461 Unify calculating green/blue when control_center_destroyed 2016-09-11 18:49:14 +00:00
Kp 4ed4ceece6 Cache references to array elements in render_face
Make the code easier to read by assuring the reader that each array
is always accessed at exactly one index per pass of the loop.
2016-09-11 18:49:14 +00:00
Kp 090852d6cd Defer initializing dyn_light in render_face
Cloaked faces do not require dyn_light.  Defer it to a later loop that
covers the same extents.
2016-09-11 18:49:14 +00:00
Kp 1f1be05d10 Simplify bm2 initialization in render_face 2016-09-11 18:49:14 +00:00
Kp fa5475aa54 Remove unnecessary copy of vertex points 2016-09-11 18:49:14 +00:00
Kp 8e3a07f99d Remove laser.cpp inclusion of unused header reverse.h 2016-09-11 18:49:14 +00:00
Kp 4864f533cf Pass object_base &to fly_init 2016-09-11 18:49:13 +00:00
Kp 198b068da6 Expand get_local_player_energy
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.
2016-09-11 18:49:13 +00:00
zico 8e097e79f0 Fixed byte offset in string for SDL_DISABLE_LOCK_KEYS, putting the 1 in place of the 0 instead on the terminator. 2016-09-05 11:31:22 +02:00
Kp 3fc1441b3f Remove unused Win32 OpenGL indirections 2016-09-04 19:10:43 +00:00
Kp 1e34dae94d Switch Win32 net_udp socket broadcast to C++ cast 2016-09-04 19:10:43 +00:00
Kp c7041a9b26 Use reinterpret_cast for digi magic value (void*)-1 2016-09-04 19:10:43 +00:00
Kp 4293227a54 Move strutil qsort comparator casts into function 2016-09-04 19:10:42 +00:00
Kp e6a082776d Fold write_key_text printf calls 2016-09-04 19:10:42 +00:00
Kp a966136424 Switch newdemo shareware workaround to C++ cast 2016-09-04 19:10:42 +00:00
Kp 39dca0999e Move aipath qsort comparator casts into function 2016-09-04 19:10:42 +00:00
Kp 11609fcdc4 Switch playsave.cpp to static_cast 2016-09-04 00:02:53 +00:00
Kp 848b99376d Switch songs.cpp to reinterpret_cast 2016-09-04 00:02:53 +00:00
Kp 2967b121b3 Switch net_udp.cpp to C++ casts 2016-09-04 00:02:53 +00:00
Kp 3308b1a554 Switch morph.cpp to reinterpret_cast 2016-09-04 00:02:53 +00:00
Kp dfef81e999 Switch laser.cpp to static_cast 2016-09-04 00:02:53 +00:00
Kp 1ca872c555 Switch seguvs.cpp to static_cast 2016-09-04 00:02:53 +00:00
Kp 53196ec990 Switch similar/arch/ogl to C++ casts 2016-09-04 00:02:53 +00:00
Kp 0e5e1a68a9 Switch interp.cpp to static_cast 2016-09-04 00:02:52 +00:00
Kp 976e4206c0 Switch multi.cpp to C++ casts 2016-09-04 00:02:52 +00:00
Kp d9a0afdcba Remove unnecessary long cast in dist_2d 2016-09-04 00:02:52 +00:00
Kp 67bf0ea1b5 Switch newdemo.cpp to C++ casts 2016-09-04 00:02:51 +00:00
Kp 5a98beae64 Switch font.cpp to static_cast 2016-09-04 00:02:51 +00:00
Kp 30a7c28cc5 Switch gr.cpp write_bmp to static_cast 2016-09-04 00:02:51 +00:00
Kp 5cdd3c60a2 Switch med_save_situation to static_cast 2016-09-04 00:02:51 +00:00
Kp 89eff29df5 Switch netmisc_calc_checksum to reinterpret_cast 2016-09-04 00:02:51 +00:00
Kp c285637cc9 Reduce scope of convert_ilbm_to_pbm rowptr 2016-09-04 00:02:51 +00:00
Kp 9a06543781 Switch terrain.cpp light cast to static_cast 2016-09-04 00:02:51 +00:00
Kp 12ee279800 Switch fireball.cpp timer cast to static_cast 2016-09-04 00:02:51 +00:00
Kp a61370ddca Check segment index in do_ambient_sounds 2016-09-04 00:02:50 +00:00
Kp 00ebdcec4a Cache Segment subscript operation in materialization handling 2016-09-04 00:02:50 +00:00
Kp ec27044f3a Check segment index in game_setup recovery code 2016-09-04 00:02:50 +00:00
Kp a4e01c3bfc Use none_of in do_controlcen_frame search of segment children
This makes the purpose of the code clearer.
2016-09-04 00:02:50 +00:00
Kp 7f264f779b Check segment index values in compress_segments 2016-09-03 17:30:18 +00:00
Kp 25a1dbe70c Cache temporaries in check_segment_connections type rewrite 2016-09-03 17:30:18 +00:00
Kp 2df93a7e88 Use range_for to iterate choose_drop_segment controlcen check 2016-09-03 17:30:18 +00:00
Kp 0104f4f938 Fix invalid access on very short exit tunnels 2016-09-03 17:30:18 +00:00
Kp 8d019a63fb Fold glTexParameteri calls 2016-09-03 17:30:18 +00:00
Kp 9d2fd0ebfa Fold glScalef calls 2016-09-03 17:30:17 +00:00
zico 8907a2bee4 Updated INSTALL.txt, README.txt, RELEASE-NOTES.txt, d1x.ini, d2x.ini for upcoming release. Updated Debian build to not include obsolete patch (it may still be broken, needs to be verified). Fixed small parsing typo in inferno.cpp help output. 2016-08-30 13:15:55 +02:00
zico b2cad09c26 Added new texture filtering options based on patch of user 'beware' 2016-08-29 20:53:10 +02:00
zico 6c6a32ba92 Added patch by user 'beware' to remove dark edges around textures and added command-line/INI option to disable this patch if desired (nostalgia). Fixed misleading indentation in ogl.cpp along the way. 2016-08-29 17:07:30 +02:00
zico ff331732ba Re-enabled timer_delay2 for general menu handlers and adjusted them to sleep according to set FPS and not sleep at all for Multiplayer since calc_frame_time() is active in that case. Modified sleeping towards 1ms in calc_frame_time() to allow for more precise target FPS and be able to relay packets in multiplayer with less delay. 2016-08-29 16:04:46 +02:00
Kp 1402a21946 Reintroduce D1 title song bug
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.
2016-08-28 22:41:49 +00:00
Kp c484c55153 Expand get_local_player_invulnerable_time
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.
2016-08-28 22:41:49 +00:00
Kp 4e556efa1b Extend newdemo cloak_time hack to cover invulnerable_time
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.
2016-08-28 22:41:49 +00:00
Kp 335f24ac31 Move Primary_weapon to player_info 2016-08-28 22:41:49 +00:00
Kp bfcf851f5f Remove default argument for get_mapped_weapon_index
Pass the weapon explicitly.
2016-08-28 22:41:48 +00:00
Kp 4af4f00d4b Fix weapon_id_type mismatch in do_laser_firing_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.
2016-08-28 22:41:48 +00:00
Kp 10ff2b9ea2 Change Primary_weapon_to_weapon_info key to weapon_id_type
Fix incorrect ID in D1 Primary_weapon_to_weapon_info.  Testing suggests
that both the correct and incorrect ID produce the same results.
2016-08-28 22:41:48 +00:00
Kp b7a5f65d5b Move Secondary_weapon to player_info 2016-08-28 22:41:48 +00:00
Kp 4ebf66ae7f Avoid recomputing object* in say_totals 2016-08-28 22:41:48 +00:00
Kp e7b881e5e6 Move Secondary_last_was_super into player_info 2016-08-28 22:41:48 +00:00
Kp adf5e57b47 Move Primary_last_was_super into player_info 2016-08-28 22:41:47 +00:00
Kp 8248438ffa Move Omega_charge to player_info 2016-08-28 22:41:47 +00:00
Kp dc8608cc3c Factor out player-hit-powerup logic 2016-08-28 22:41:47 +00:00
Kp 007963faad Factor out player-hit-flag handling 2016-08-28 22:41:47 +00:00
Kp 1b2052e2bc Fold do_end_briefing_screens calls to songs_play_song 2016-08-28 22:41:47 +00:00
Kp f8568d1d5f Fold proximity mine calls to multi_send_robot_fire 2016-08-25 23:31:37 +00:00
Kp 0b781e021d Use ={} to clear robot velocity 2016-08-25 23:31:37 +00:00
Kp 35928f942c Unify robot-next-gun logic
Old code:

if (condition) {
	x;
	y;
} else {
	y;
}

Change it to be:

if (condition) {
	x;
}
y;
2016-08-25 23:31:37 +00:00
Kp d75de6e705 Reduce scope of object_create_explosion_sub vforce2
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.
2016-08-25 23:31:37 +00:00
Kp ee1003f29f Move conditionally compiled code into namespace dsx 2016-08-25 04:05:32 +00:00
Kp c8ffe5d1ce Move various trigger functions into namespace dsx 2016-08-25 04:05:32 +00:00
Kp 7c348056c1 Inline triggers_frame_process 2016-08-25 04:05:32 +00:00
Kp 8409e2735c Clean whitespace in net_udp_get_new_player_num
net_udp_get_new_player_num used a strange indent convention.
Normalize the whitespace to make parsing easier.
2016-08-25 04:05:32 +00:00
Kp 3693b2317d Move HUD_render_message_frame into namespace dsx 2016-08-25 04:05:32 +00:00
Kp 6d311a97e9 Move hud weapon functions into namespace dsx 2016-08-25 04:05:32 +00:00
Kp 854907aa1b Move find_hitpoint_uv into namespace dsx 2016-08-25 04:05:32 +00:00
Kp 38b8a34d19 Normalize function return type placement
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.
2016-08-25 04:05:31 +00:00
Kp 18a479a308 Change multi_send_macro to handle invalid inputs
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.
2016-08-25 04:05:31 +00:00
zico 89a2df0e18 Restored object_is_trackable to its original version for D2X. Restored conditions in track_track_goal to their original version. Scale homing_missile_turn_towards_velocity by HOMING_TURN_TIME if NEWHOMER since it may not be called in every frame. 2016-08-22 13:55:09 +02:00
Kp 3d6108ae09 Include inttypes.h in playsave.cpp
Mako88 reports that an unspecified environment fails to build
playsave.cpp.  The failure is because PRIuFAST32 is undefined.  In most
environments, SDL automatically includes inttypes.h, which provides
PRIuFAST32.  In this unspecified environment, SDL does not include
inttypes.h.  Include it explicitly to ensure the definition is
available.
2016-08-20 22:28:43 +00:00
Kp 7bb3a5605b Remove useless cast in similar/editor/info.cpp 2016-08-20 22:28:43 +00:00
Kp 6691a1ff33 Split credits_show special case into dedicated functions 2016-08-19 03:41:42 +00:00
Kp 2eda0d98ee Add workaround for Win32 array::size() triggering -Wuseless-cast
As described in commit 674a921 ("Add workaround for Win32 wrong type for
size_t"), std::array on Win32 returns type std::size_t, which is
`unsigned int` instead of the `unsigned long` seen on Linux.  Calling
std::min requires both arguments to have the same type.  On Linux, this
required casting the result of size() to `unsigned` to match the other
input.  On Win32, that cast provokes a -Wuseless-cast warning.  Add a
workaround by removing the cast and instead explicitly setting the type
of std::min's arguments to `unsigned`, then relying on the compiler to
perform an implicit conversion from `unsigned long` to `unsigned int`
on Linux.  The value is always small enough to fit in an `unsigned int`,
so no precision loss will occur.
2016-08-19 03:41:42 +00:00
Kp e3ecc0715c Remove useless cast in similar/main/net_udp.cpp 2016-08-19 03:41:42 +00:00
Kp bbdecad649 Add helper macro to handle printf .* conversion for 32/64
Field width conversion `.*` always takes an `int`.

On Win32, casting `long` to `int` triggers a `-Wuseless-cast` warning.
Omitting the cast works correctly.

On Linux/amd64, casting `long` to `int` works correctly.
Omitting the cast triggers a `-Wformat` warning.

Add a macro that conditionally expands to `static_cast<int>` or to ``,
as necessary for the target platform.
2016-08-19 03:41:41 +00:00
Kp 7f0f269aec Switch write_netgame_profile to use inttypes format macros
Most 64-bit systems use `unsigned long` for `uint_fast32_t`.  Some
32-bit systems use `unsigned int` for `uint_fast32_t`.  To handle this,
write_netgame_profile used casts to `unsigned` and a format string of
`%u`.  Switch to inttypes format macros so that the format strings are
correct without requiring a cast to handle systems where `uint_fast32_t`
is not `unsigned`.
2016-08-19 03:41:41 +00:00
Kp d554b01e45 Remove useless casts in similar/editor/meddraw.cpp 2016-08-19 03:41:41 +00:00
Kp fca91b78c7 Remove useless casts in similar/main/multi.cpp 2016-08-19 03:41:41 +00:00
Kp b9399c5048 Switch multi_process_bigdata to use inttypes format macros
Most 64-bit systems use `unsigned long` for `uint_fast32_t`.  Some
32-bit systems use `unsigned int` for `uint_fast32_t`.  To handle this,
multi_process_bigdata used casts to `unsigned long` and a format string
of `%lu`.  Switch to inttypes format macros so that the format strings
are correct without requiring a cast to handle systems where
`uint_fast32_t` is not `unsigned long`.
2016-08-19 03:41:41 +00:00
zico dad3e953e9 Retored historically accurate versions of homing tracking and lifeleft calculations for D1X and D2X based on their original source code releases instead of mixing them together. Further encabsuled NEWHOMER code to disable unused functions and variables if NEWHOMER is disabled. 2016-08-17 13:43:01 +02:00
Kp 9e31914e6a Remove useless casts in similar/main/playsave.cpp 2016-08-17 04:44:22 +00:00
Kp cc74c91c89 Remove useless casts in similar/main/newdemo.cpp 2016-08-17 04:44:22 +00:00
Kp 70df47da32 Remove useless casts in similar/main/multibot.cpp 2016-08-17 04:44:22 +00:00
Kp 37fed077ee Remove useless casts in similar/arch/ogl/ogl.cpp 2016-08-17 04:44:22 +00:00
Kp 9b3adfb020 Remove useless casts in similar/arch/ogl/gr.cpp 2016-08-17 04:44:22 +00:00
Kp 6dc16bf468 Remove useless cast in similar/2d/pcx.cpp 2016-08-17 04:44:22 +00:00
Kp b1d88fd378 Remove useless cast in similar/main/iff.cpp 2016-08-17 04:44:22 +00:00
Kp 4b92942bb6 Switch newdemo.cpp to cast Secondary_weapon like Primary_weapon
Both Primary_weapon and Secondary_weapon should use the underlying enum
type.  Primary_weapon uses its enum type now.  Secondary_weapon will use
its enum type eventually.  Add appropriate casts to newdemo.cpp to keep
it working when those changes are made.
2016-08-17 04:44:22 +00:00
Kp 1d1f3f6568 Allocate fewer jukebox pointers for small files 2016-08-08 00:07:19 +00:00
Kp 7ac89d0a14 Update jukebox song count at end of read_m3u 2016-08-08 00:07:19 +00:00
Kp 2885070ba8 Remove unnecessary ~jukebox_songs
The storage is managed by a unique_ptr, so the default destructor is
sufficient.
2016-08-08 00:07:19 +00:00
Kp 68ac4acd10 Combine jukebox allocations 2016-08-06 19:55:26 +00:00
Kp 8247713850 Use RAII for m3u FILE* 2016-08-06 19:55:26 +00:00
Kp 66422a2ea3 Combine PHYSFSX_isNewPath calls in select_file_recursive2 2016-08-06 19:55:26 +00:00
Kp 5b71faacda Use RAII to remove temporary PHYSFS search path 2016-08-06 19:55:25 +00:00
Kp a09dce6ead Remove char[N] overload for PHYSFSX_getRealPath 2016-08-06 19:55:25 +00:00
Kp a98510b17e Move CMLevelMusicTrack to CCfg 2016-08-06 19:55:25 +00:00
Kp 771665835d Move LastMission to CCfg 2016-08-06 19:55:25 +00:00
Kp ac8232caca Move CMMiscMusic to CCfg 2016-08-06 19:55:25 +00:00
Kp 50599c0dad Move CMLevelMusicPath to CCfg 2016-08-06 19:55:25 +00:00
Kp b449986ea8 Use make_unique to reset editor's Current_mission 2016-08-06 19:55:25 +00:00
Kp 53deef077a Prefer make_unique over raw new 2016-08-06 19:55:24 +00:00
Kp a1ab71f5ad Avoid calling make_unique<...>({})
The compiler may or may not recognize that the temporary T{} passed to
make_unique can be omitted.  Help it by passing nothing, then explicitly
clearing the returned data as a separate step.
2016-08-06 19:55:24 +00:00
Kp cbeb42e48c Flatten some newmenu type hierarchy 2016-08-06 19:55:24 +00:00
Kp 6b4e639f65 Flatten newmenu_subfunction_t type 2016-08-06 19:55:24 +00:00
Kp c772385f81 Fix check_header_includes=1 Linux build 2016-08-06 19:55:24 +00:00
Kp 1774676571 Use class to wrap Primary_weapon+Delayed_primary 2016-08-06 19:55:23 +00:00
Kp 7128141c55 Use enum for newmenu item type 2016-08-05 04:12:21 +00:00
Kp 3f051100a5 Move newmenu_item text_len into union 2016-07-31 22:25:51 +00:00
Kp 52d0ded9ee Cache change_res resolution computations 2016-07-31 22:25:50 +00:00
Kp f5c6b0fbf6 Move newmenu_item min_value into union 2016-07-31 22:25:50 +00:00
Kp c9aba5b04e Move newmenu_item max_value into union 2016-07-31 22:25:50 +00:00
Kp 26904ea6b3 Use range_for for newmenu_create_structure radio reset 2016-07-31 22:25:50 +00:00
Kp 344a567d1b Move newmenu_item group into union 2016-07-31 22:25:50 +00:00
Kp dd483773e0 Factor out repeated HIRESMODE tests 2016-07-31 22:25:49 +00:00
Kp 35ce30eb94 Simplify net_udp_send_fly_thru_triggers 2016-07-31 22:25:49 +00:00
Kp a230d24226 Allow trailing comments after num_levels and num_secrets 2016-07-30 21:56:31 +00:00
Kp 66e0fb1a6e Cache some get_local_player_cloak_time references 2016-07-25 03:48:09 +00:00
Kp 23a85cae27 Cache some get_local_player_invulnerable_time references 2016-07-25 03:48:09 +00:00
Kp 3a86bc6f40 Simplify various multi loops 2016-07-25 03:48:09 +00:00
Kp e30ed3621a Fold show_one_extra_view do_cockpit_window_view calls 2016-07-25 03:48:09 +00:00
Kp db42c2bc56 Fold game_draw_multi_message gr_printf calls 2016-07-25 03:48:09 +00:00
Kp 21ad09ef3d Fold show_netplayerinfo gr_string calls 2016-07-25 03:48:08 +00:00
Kp 582fef2a37 Fold show_netplayerinfo gr_printf calls 2016-07-25 03:48:08 +00:00
Kp ea65c74ba9 Move last_player_bump into player_info.Last_bumped_local_player 2016-07-25 03:48:08 +00:00
Kp f671e6781d Narrow scope of random vectors 2016-07-24 04:04:25 +00:00
Kp 8a46462846 Move lavafall_hiss_playing into player_info 2016-07-24 04:04:25 +00:00
Kp 8fef6a07b4 Pass const object_base to obj_unlink 2016-07-23 04:10:43 +00:00
Kp 139741ec40 Pass const object_base to Laser_render 2016-07-23 04:10:42 +00:00
Kp 176c0efdae Cache Muzzle_data reference 2016-07-23 04:10:42 +00:00
Kp 99bbd0cf26 Mark global constants as constexpr
s/^const \([^*]*=.*;\)/constexpr \1/
2016-07-23 04:10:42 +00:00
Kp acac40bc25 Mark global constants as constexpr
s/^const \([^*=]*{};\)/constexpr \1/
2016-07-23 04:10:42 +00:00
Kp b0821cff55 Fix inverted sense of -use_players_dir
Fixes: 4d483ca88f ("Simplify use of SysUsePlayersDir")
2016-07-22 02:25:17 +00:00
Kp d67ada45ef Coerce pilot names to lowercase on startup
Mako88 reports that using `-pilot Mixed` on Windows causes crashes
during multiplayer setup, but `-pilot mixed` does not crash.  This is
not reproducible on case sensitive filesystems, probably because case
sensitive systems recognize that `Mixed.plr` and `mixed.plr` are not the
same file.  In both cases, the underlying plr file name was all
lowercase.  Coerce the pilot name to lowercase when it is converted to a
plr file name.  This also fixes a minor bug where the check for a
user-specified extension of `.plr` would recognize `-pilot alice.plr`,
but not recognize `-pilot alice.PLR`.

This is a workaround for a bug in the network code, which becomes
confused and crashes when the player's callsign contains mixed case.

Reported-by: Mako88 <https://github.com/dxx-rebirth/dxx-rebirth/issues/188>
2016-07-21 01:43:23 +00:00
Kp 4d483ca88f Simplify use of SysUsePlayersDir 2016-07-21 01:43:22 +00:00
Kp a940edcf77 Fix longstanding unbalanced quote in help text
Fixes: 6b8f64cca2 ("If it can't find descent2.hog/d2demo.hog, still print some useful info")
2016-07-21 01:43:22 +00:00
Kp 39dc9db869 Use range_for for demo iteration 2016-07-21 01:43:22 +00:00
Kp e446965511 Remove unnecessary wall number check in kill_stuck_objects
Callers are expected to filter out invalid numbers.  Even if they do
not, the only use of the number is to match entries in Stuck_objects.
An invalid match could cause a call to vobjptr() with an invalid index,
but that would be diagnosed by the valptridx checking, so no invalid
memory access will occur.
2016-07-21 01:43:22 +00:00
Kp 278c10dec0 Move flush_fcd_cache calls up from kill_stuck_objects
Many callers of kill_stuck_objects call it twice, once for each of two
walls.  Move the flush_fcd_cache up to occur only once, rather than once
per wall.
2016-07-21 01:43:21 +00:00
Kp 82e6ab130b Remove kill_stuck_objects() in wall_illusion_off
Objects cannot become stuck in illusionary walls, so there is nothing to
kill.
2016-07-21 01:43:21 +00:00
Kp 0cfd7c8dbd Remove unused variable SOF_PLAYING 2016-07-21 01:43:21 +00:00
Kp 24f59cc9d0 Add stub flush_fcd_cache for D1 2016-07-21 01:43:21 +00:00
Kp b1bdf4aa53 Unify D1/D2 remove_obsolete_stuck_objects
After fixing the bogus lifeleft assignment, the D2 version is equivalent
to a more thorough version of the D1 version.  Delete the D1 version and
use the D2 version for both games.
2016-07-21 01:43:21 +00:00
Kp 7d926f0741 Remove bogus remove_obsolete_stuck_objects lifeleft change
This assignment looks bogus.  If the signature saved when the object
became stuck is different from the signature of the object currently
using that slot, then remove_obsolete_stuck_objects kills the object
using that slot.  Signatures are defined to change when the object slot
is freed and reused.  Therefore, this statement kills the new object
that took the slot of the obsolete object.  This new object may be
important, such as a spawned robot or a weapon.
2016-07-21 01:43:21 +00:00
Kp f29630bd4a Propagate MAX_STUCK_OBJECTS 2016-07-21 01:43:21 +00:00
Kp c854c25d44 Fix wall_remove_side bogus use of IS_CHILD on wallnum
IS_CHILD is for segments, not walls.
2016-07-21 01:43:20 +00:00
Kp 7bb63324bd Remove useless cast in newdemo.cpp 2016-07-16 16:52:04 +00:00
Kp 3550f2d7ff Flatten render type hierarchy 2016-07-16 16:52:04 +00:00
Kp c636dc4b98 Convert various static const expressions to constexpr 2016-07-16 16:52:04 +00:00
Kp f2ecb6401a Simplify do_powerup_frame tests 2016-07-16 16:52:04 +00:00
Kp 5963ff747b Use fallthrough for abandoning marker input 2016-07-15 03:43:04 +00:00
Kp 674a9213f8 Add workaround for Win32 wrong type for size_t
GCC std::array uses std::size_t for its size_type.  On Linux/amd64,
`std::size_t` is `unsigned long`.  On Win32, `std::size_t` is
`unsigned int`.  This provokes format string warnings because an
unsigned int is passed where the format string declares an unsigned
long.  On Win32, `unsigned int` and `unsigned long` are the same size,
so `unsigned long` could have been used to avoid this problem by
maintaining consistency with Linux, but it was not.  This may have been
an attempt to achieve bug compatibility with Microsoft's types.

Add a workaround by defining a macro DXX_PRI_size_type in the style of
inttypes.h PRI* macros.  Use an SConf test to determine the correct
value by inspecting which compilation runs succeed.  Currently, Linux
needs "l", Win32 needs "", and Win64 needs "I64".
2016-07-15 03:43:03 +00:00
Kp f892ace24b Remove useless cast in multibot.cpp 2016-07-15 03:43:03 +00:00
Kp a274ea0ee8 Remove useless cast in multi.cpp 2016-07-15 03:43:03 +00:00
Kp 68dd57021c Remove useless cast in mine.cpp 2016-07-15 03:43:03 +00:00
Kp 14c7683afa Remove useless cast in gameseq.cpp 2016-07-15 03:43:03 +00:00
Kp a0c2ac469a Remove useless cast in font.cpp 2016-07-15 03:43:03 +00:00
Kp 12ff40bd93 Remove useless cast in gamefont 2016-07-15 03:43:02 +00:00
Kp 279dc555dd Propagate digiobj MAX_Q 2016-07-15 03:43:02 +00:00
Kp 3ebf1f009f Reorder digiobj channel clear 2016-07-15 03:43:02 +00:00
Kp 946e7bd4ee Move some digi symbols to dcx 2016-07-15 03:43:02 +00:00
Kp 74299f7e88 Encourage tail call optimizations in digiobj 2016-07-15 03:43:01 +00:00
Kp aa95cbfccc Move set_thrust_from_velocity to dcx 2016-07-15 03:43:01 +00:00
Kp 96f78e1032 Use constexpr for MAX_BITMAP_FILES 2016-07-14 01:59:05 +00:00
Kp 6905b5bd1d Use constexpr for MAX_SOUNDS 2016-07-14 01:59:04 +00:00
Kp dcdff564f4 Fold newdemo_record_primary_ammo in draw_hud 2016-07-14 01:59:04 +00:00
Kp 3894c66b9b Fold do_missile_firing calls to multi_send_fire 2016-07-14 01:59:04 +00:00
Kp ec19c2ba89 Allow player to grab invulnerability powerup when FakingInvul
Previously, if the player was invulnerable, it was impossible to grab an
invulnerability powerup.  Relax this by allowing a spawn-induced fake
invulnerability not to count as invulnerable for this test.  Players
still cannot grab an invulnerability powerup if they are still under the
influence of a prior invulnerability powerup.
2016-07-14 01:59:04 +00:00
Kp ed7376c695 Pass object & to update_item_state::process_powerup 2016-07-14 01:59:04 +00:00
Kp d5a64c4f33 Factor out object count tests
An optimizing compiler should inline these tests.  Moving them out makes
the code easier to read, since the statements can focus on what is
updated, rather than how it is done.
2016-07-14 01:59:04 +00:00
Kp 663d6df312 Use ?: for MultiLevelInv_CountPlayerInventory flag increment 2016-07-14 01:59:03 +00:00
Kp 023ed08c1c Switch to vcobjptr for MultiLevelInv_CountPlayerInventory player
The index is not needed and the player should not be modified by the
scan.
2016-07-14 01:59:03 +00:00
Kp e65b93b750 Cache reference to MultiLevelInv.Current
Modify MultiLevelInv_CountPlayerInventory to ease conversion to a member
function.
2016-07-14 01:59:03 +00:00
Kp 96d9ae4e4a Optimize initial MultiLevelInv clear
Change the clearing of MultiLevelInv during initialization to reduce
wasted stores.  MultiLevelInv has three fields.

Field ::Initial is not accessed by MultiLevelInv_CountLevelPowerups, and
is overwritten immediately afterward, so it does not need to be cleared
first.

Field ::Current is unconditionally cleared by
MultiLevelInv_CountLevelPowerups, so it does not need to be cleared
first.

Field ::RespawnTimer is not accessed by
MultiLevelInv_CountLevelPowerups, but needs to be cleared.  Add a clear
of field .RespawnTimer and remove the clear of the entire structure.
2016-07-14 01:59:03 +00:00
Kp 5af44fa27a Refactor to propagate MultiLevelInv_Count initial
All callers of MultiLevelInv_Count passed a constant value.  Factor
out the top level blocks of MultiLevelInv_Count into helper functions,
then create two new functions corresponding to MultiLevelInv_Count(0)
and MultiLevelInv_Count(1), implemented by calling the appropriate new
helper functions.
2016-07-14 01:59:03 +00:00
Kp 1d568fa56e Move MultiLevelInv_Count for vulcan/gauss to use fallthrough 2016-07-14 01:59:03 +00:00
Kp 05db30a6ff Fix piggy cast when sizeof(size_t) != sizeof(void *) 2016-07-14 01:59:02 +00:00
Kp 39895e5643 Rewrite declarations of ushort * to standard uint16_t * 2016-07-14 01:59:02 +00:00
Kp 59750d3c29 Rewrite declarations of ubyte * to standard uint8_t * 2016-07-14 01:59:02 +00:00
Kp 613a7ecbbb Rewrite parenthesized uses of uint to standard unsigned 2016-07-14 01:59:02 +00:00
Kp 0b6af7fcbe Propagate MAX_OBJ_BITMAPS 2016-07-10 04:11:35 +00:00
Kp ca18195390 Propagate MAX_TEXTURES 2016-07-10 04:11:35 +00:00
Kp 6580c37b6e Propagate MAX_STOLEN_ITEMS 2016-07-10 04:11:34 +00:00
Kp 71ab00beb8 Propagate MAX_BOSS_TELEPORT_SEGS 2016-07-10 04:11:34 +00:00
Kp 1486a5a01b Move Robot_sound_volume to dcx 2016-07-09 17:58:36 +00:00
Kp 1bd32fedb5 Remove unused STRING_LENGTH 2016-07-09 17:58:35 +00:00
Kp a63fe62cb3 Add typedef for multi_allow_powerup_text type 2016-07-09 17:58:35 +00:00
Kp 2713baf5d3 Move HUD_MESSAGE_LENGTH to hud.cpp 2016-07-09 17:58:35 +00:00