Commit graph

59 commits

Author SHA1 Message Date
Kp 43e1c841f0 Pass polymodel& to polymodel_read 2022-10-09 23:15:20 +00:00
Kp c64a584bfd Use enum class for robot_gun_number
Validate gun numbers on loading object data.  Factor out and normalize
the logic for advancing to a robot's next gun.
2022-08-22 01:24:49 +00:00
Kp 1fb55eebc2 Use enum class for robot_animation_state 2022-08-22 01:24:49 +00:00
Kp 21c530a3e2 Use enumerated_array for difficulty-level-specific arrays 2021-09-19 10:53:48 +00:00
Kp 1c13d3c8d3 Improve error reporting for PHYSFSX_openReadBuffered
Return the PHYSFS error code on failure, so that callers can report why
the open failed.
2021-07-25 23:00:56 +00:00
Kp a6abf76d0a Use enum class for index into ObjBitmaps 2020-10-07 03:59:14 +00:00
Kp 7e23ab554a Simplify custom_remove for loop
Iterate over a zipped range instead of explicitly maintaining an
index value and two pointers.
2020-08-24 01:31:28 +00:00
Kp 237106f31e Add warning that BitmapOriginal cannot be used directly 2020-08-24 01:31:28 +00:00
Kp b29f19da51 Use enum class for GameBitmapOffset
Values in GameBitmapOffset are only intended for use indexing within the
game's PIG file.  Give them a specific type to reflect that.
2020-08-24 01:31:28 +00:00
Kp 46d72a29c0 Retire compiler-begin.h
This was once a compatibility shim, but compiler support for std::begin
has been required since 5e434cbe95 and no
issues have been reported.  Flatten the include tree by removing this
header and using the STL names directly.
2020-06-10 02:25:32 +00:00
Kp 7b52b1fe1d Move grs_bitmap::avg_color into #if !DXX_USE_OGL
This field is used in the SDL build for rendering.  In the GL build, its
only purpose is for the editor to write it to a PIG file.  Change that
one use to compute the value as needed.  Move all other references
behind a preprocessor test for !DXX_USE_OGL.  This shrinks the size of
grs_bitmap by 1 pointer, since the compiler added padding after
avg_color up to the size of the next aligned pointer.
2020-05-22 02:40:26 +00:00
Kp db7b4b3f88 Refer to <memory> directly, not through "compiler-make_unique.h" 2020-05-02 21:18:43 +00:00
Kp cc38cdf4b8 Qualify uses of std::make_unique 2020-05-02 21:18:42 +00:00
Kp 53761500f1 Qualify uses of std::array 2020-05-02 21:18:42 +00:00
Kp 50efc4fdec Reduce scope of i in custom.cpp 2019-05-26 00:44:37 +00:00
Kp 42a2e3ab0b Avoid crash loading polymodels with invalid subcalls
Truncate the model at the first error.  This allows the level to load,
but makes some or all of the model invisible.
2019-03-06 05:03:48 +00:00
Kp a02ad8b164 Move Robot_joints to d_level_shared_robot_joint_state 2018-12-30 00:43:59 +00:00
Kp e84a65edc6 Move Robot_info into LevelSharedRobotInfoState 2018-12-30 00:43:59 +00:00
Kp 03fe3a6696 Move Polygon_models into LevelSharedPolygonModelState 2018-12-30 00:43:59 +00:00
Kp 12b57e84e6 Switch most in-tree http:// links to https://
For each link given as http://, verify that the site is accessible over
https:// and, if so, switch to it.  These domains were converted:

* llvm.org
* clang.llvm.org
* en.cppreference.com
* www.dxx-rebirth.com
* www.libsdl.org
* www.scons.org
2018-09-02 00:57:29 +00:00
Kp 4ea9ef5b0c Use reference for robot_info 2017-08-26 19:47:51 +00:00
Kp 764d20d4e1 Make grs_bitmap::bm_flags private 2017-01-15 00:03:13 +00:00
Kp bb135e546e Set Descent 1 paged out bitmaps to nullptr
Descent 2 sets nullptr in the bitmap data field.  Do the same in Descent
1 for consistency.
2016-11-19 17:24:52 +00:00
Kp 20ae1e2b4a Remove useless casts in d1 custom.cpp 2016-08-06 19:55:24 +00:00
Kp 96f78e1032 Use constexpr for MAX_BITMAP_FILES 2016-07-14 01:59:05 +00:00
Kp 59750d3c29 Rewrite declarations of ubyte * to standard uint8_t * 2016-07-14 01:59:02 +00:00
Kp 0b6af7fcbe Propagate MAX_OBJ_BITMAPS 2016-07-10 04:11:35 +00:00
Kp b6970e2a98 Simplify skipping unwanted hxm shorts 2016-07-10 04:11:35 +00:00
Kp a4967ffceb Move various robot data into namespaces 2016-06-25 23:21:36 +00:00
Kp 231223895d Rewrite simple pointer casts from C style to reinterpret_cast<>
This pass only targets commonly used standard types.

s/(\(\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\s*\*\)\s*)\s*(/reinterpret_cast<\1>(/g
2016-06-05 01:04:26 +00:00
Kp ebebda5f17 Fix piggy casts when sizeof(size_t) is not sizeof(void*) 2016-06-05 01:04:26 +00:00
Kp 7fdce88558 Add parentheses around target of simple casts
C casts do not require parentheses.  C++ casts require grouping around
the target.  Prepare for conversion to C++ casts by adding otherwise
unnecessary parentheses around the target of simple C casts.

This pass does not attempt to process expressions that involve
any subexpression that can nest arbitrarily, such as parentheses or
brackets.  It also works only on commonly used standard types.

	(int) a->b;	// changed
	(int) a[b];	// not changed

s/\((\s*\(\(un\)\?signed\|int\|char\|short\|long\|float\|double\|s\?size_t\|\(u\?int[[:digit:]]\+_t\)\)\s*\**\s*)\s*\)\([&+-]\?\)\([[:alnum:]_.]\+\s*->\s*\)*\([[:alnum:]_.]\+\)\(\s*\([];+>)*\/^%,|&<>]\)\|$\|\(\s*-\s*[^>]\)\)/\1(\5\6\7)\8/g
2016-06-05 01:04:25 +00:00
Kp b31446340c Rewrite cast of (ubyte*) to standard type uint8_t
s/(\s*ubyte\s*\*\s*)/(uint8_t *)/g
2016-06-05 01:04:25 +00:00
Kp 82a8f6ebb0 Pass bm_mode to gr_init_bitmap 2016-05-28 17:31:27 +00:00
Kp 86709f547b Fix capitalization of PHYSFS_File
Per comment in physfs.h, the spelling PHYSFS_file is deprecated.
Replace all instances with PHYSFS_File.
2016-01-09 16:38:14 +00:00
Kp b683b4cc68 Scope weapon type 2015-12-03 03:26:49 +00:00
Kp 17b1943c5e Mark various per-file structures as static 2015-08-12 03:11:46 +00:00
Kp 6b6eaef226 Include polyobj.h from robot.h
Swap the inclusion order since all robots are polyobjects, but not all
polyobjects are robots.
2015-04-02 02:36:57 +00:00
Kp 90fbebf8fd Convert most global arrays to array<> 2015-04-02 02:36:52 +00:00
Kp 66a70fd373 Prepare for global arrays to be array<> 2015-04-02 02:36:52 +00:00
Kp f7815810e8 Use RAIIPHYSFS_File to manage PHYSFS_File
Fixes a few leaks on error paths.
2015-01-17 18:31:42 +00:00
Kp da6632a917 Use array<> for Robot_joints 2014-12-18 04:12:38 +00:00
Kp e5acd8056d Pass gr_set_bitmap_flags arg by & 2014-11-30 22:09:21 +00:00
Kp 53ce29e789 Pass gr_init_bitmap arg by & 2014-11-30 22:09:20 +00:00
Kp 0672cdff1b Pass gr_set_bitmap_data grs_bitmap by & 2014-11-30 22:09:20 +00:00
Kp 97332b848c Pass gr_free_bitmap_data arg by & 2014-11-30 22:09:20 +00:00
Kp 44084ff261 Pass PHYSFSX_readVector vector by & 2014-10-26 22:08:58 +00:00
Kp 94550355a8 Use make_unique instead of bare new 2014-08-24 18:28:09 +00:00
Kp ade7dbc238 Use unique_ptr for pig/pog 2014-08-05 02:32:00 +00:00
Kp cc0ce764c2 Fix reading HXM polymodels on x64 2014-07-26 04:01:35 +00:00