Commit graph

2763 commits

Author SHA1 Message Date
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 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 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 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 66422a2ea3 Combine PHYSFSX_isNewPath calls in select_file_recursive2 2016-08-06 19:55:26 +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