Commit graph

32 commits

Author SHA1 Message Date
Kp 028f4f8a56 Use structured bindings to access enumerated ranges 2021-06-28 03:37:50 +00:00
Kp 6e12644620 Remove write-only field digi_sound::bits 2021-06-28 03:37:49 +00:00
Dmitry Grigoryev fbd05a1592 optimize include files (include what you use) 2021-02-06 21:38:50 +01:00
Kp 696141eabf Use enum class for weapon_info::bounce 2020-12-20 20:39:07 +00:00
Kp e261ca2884 Use enum class for weapon_info::matter 2020-12-20 20:39:07 +00:00
Kp a6abf76d0a Use enum class for index into ObjBitmaps 2020-10-07 03:59:14 +00:00
Kp 24497fa085 Use enum class for bmread mode selector 2020-10-07 03:59:14 +00:00
Kp 636978db4b Move Marker_model_num to d_level_shared_polygon_model_state 2020-08-24 01:31:28 +00:00
Kp 514c63efad Expose both MAX_SOUNDS in both games 2020-08-24 01:31:28 +00:00
Kp 8e81726ac5 Use enum class for laser_level
Remove stored_laser_level, which existed primarily to enforce type
separate.  `enum class` can do that without the need for a separate
class type.
2020-08-24 01:31:28 +00:00
Kp 5dbdc65ee6 Fix D2 crash on blank line in bitmaps.tbl
Reported-by: InsanityBringer <https://github.com/dxx-rebirth/dxx-rebirth/issues/464#issuecomment-632443732>
2020-05-22 02:40:26 +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 53761500f1 Qualify uses of std::array 2020-05-02 21:18:42 +00:00
Kp 714c13b3c1 Move WallAnims into d_game_shared_state 2020-04-04 19:30:22 +00:00
Kp bcff9e6aaa Simplify wall flag assignment
Move the tests up and keep the flags ready to assign.
2020-04-04 19:30:22 +00:00
Kp edc8819409 Add hint about range of bitmap indices
When building with AddressSanitizer, gcc warns that `i` may not fit,
because the compiler fails to adequately constrain the possible values
for `i`.  Add a control-flow hint to inform gcc about valid values.
2020-02-06 03:22:45 +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 3bd10610fc Use xrange for loops with zero start and simple identifier end
s/for\s*(\s*\(\w\+\)\s\+\(\w\+\)\s*=\s*0\+u\?\s*;\s*\2\s*!=\s*\([A-Za-z_0-9]\+\)u\?\s*;\s*\(++\s*\2\|\2\s*++\s*\))/range_for (const \1 \2, xrange(\3))/
2019-05-04 18:27:37 +00:00
Kp 699030606e Move Effects to d_level_unique_effects_clip_state 2019-03-03 00:31:09 +00:00
Kp 1e549a02d4 Move Num_tmaps to d_level_unique_tmap_info_state 2018-12-30 00:43:59 +00:00
Kp 1f18db3c39 Move TmapInfo to d_level_unique_tmap_info_state 2018-12-30 00:43:59 +00:00
Kp 12c06e59aa Move N_robot_types into LevelSharedRobotInfoState 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 1d550ec0df Fix check_header_includes=1 build 2018-12-13 02:31:38 +00:00
Kp a0ed5cb283 Pass Vclip as context 2018-10-21 00:24:07 +00:00
Kp 991f72a775 Add fwd-vclip.h 2018-10-21 00:24:07 +00:00
Kp ec1cf005b6 Enable -Wformat-truncation
Add macro cf_assert ("control flow" assert) to hint to gcc that certain
conditions are impossible.  Use it to avoid generating range checks for
situations that never happen.  If the event did happen, the only
consequence would be truncated UI text, rather than a correctness
problem.
2018-08-26 18:10:36 +00:00
Kp 047ddaf9ea Prevent buffer overrun in removeext 2018-08-26 18:10:36 +00:00
Kp 19699037ce Move d2x-rebirth/main/bmread.cpp -> similar/main/bmread.cpp 2018-07-18 04:39:28 +00:00
Renamed from d2x-rebirth/main/bmread.cpp (Browse further)