Kp
452a50f80b
Move WID_* constants into wall_is_doorway_result
...
This allows them to be reported symbolically in a debugger when a
variable is of type wall_is_doorway_result.
2023-02-18 14:30:59 +00:00
Kp
e3553586c1
Use enum class for bitmap_index
2022-12-31 16:21:47 +00:00
Kp
cb8303839c
Revert incorrect robot collision logic change
...
Commit 37132ab887
rearranged the special rules around robot-vs-robot
vector intersection based on an obsolete comment from Descent 1. In
Descent 2, robot-vs-robot collisions are always disabled, so that the
thief bot does not damage itself when flying past other robots.
Reported-by: Glumduk <https://github.com/dxx-rebirth/dxx-rebirth/issues/665 >
Fixes: 37132ab887
("Pass LevelSharedRobotInfoState in fvi_query")
2022-10-09 23:15:21 +00:00
Kp
37132ab887
Pass LevelSharedRobotInfoState in fvi_query
2022-07-09 13:39:29 +00:00
Kp
0dfd462c64
Change fvi_query to pass LevelUniqueObjectState if checking objects
...
Remove the definition of FQ_CHECK_OBJS and all uses of it. Add a new
fvi_query member d_level_unique_object_state *LevelUniqueObjectState.
If object checking is enabled, pass &LevelUniqueObjectState in that
member. If object checking is disabled, pass nullptr in that member.
Change fvi_sub to use this member to decide whether to perform object
checking.
2022-07-09 13:39:29 +00:00
Kp
4bc901b0a9
fvi_sub: validate object once at start of FQ_CHECK_OBJS
...
If FQ_CHECK_OBJS is used, a valid object is required. Copy the
icobjptridx_t from fvi_query into a local vcobjptridx_t to force a
validation, then use that validated copy for later work.
2022-07-09 13:39:29 +00:00
Kp
5d62df856d
Pass fvi_query to fvi_sub
...
Many of the input parameters are available in fvi_query, so pass a
reference to that instead of copying the parameters to the stack
individually.
2022-07-09 13:39:29 +00:00
Kp
4ab619b7c2
Restructure use of fvi_query
...
- Make all members constant, and pass an anonymous temporary fvi_query
to find_vector_intersection.
- Change `p0`/`p1` to `const vms_vector &`, since the positions are
mandatory. Callers can no longer pass `nullptr` or an uninitialized
value here.
- Change `thisobjnum` to `icobjptridx_t`. Calls to fvi_sub built an
objptridx at need, so moving it to the caller allows it to be
constructed once per find_vector_intersection call.
- Move `flags` and `rad` out of fvi_query, since calls to fvi_sub may
use other values than the ones in fvi_query. This prepares for
passing fvi_query to fvi_sub.
2022-07-09 13:39:29 +00:00
Kp
e25b476de7
Use enum for segnum_t
...
Add checked conversions for sites which load from external integers.
2022-07-02 18:10:45 +00:00
Kp
5be32a05c6
Reorder check_line_to_line to eliminate useless copy
...
Instead of copying the input v1/v2 into det.uvec, pass a reference for
v1/v2 directly to calc_det_value.
2022-06-05 17:44:53 +00:00
Kp
9071675a0d
Pass calc_det_value vectors separately
...
Pass 3 vectors rf/u instead of one vms_matrix. This may make the code
slightly worse in the short term, but it makes a later change clearer.
2022-06-05 17:44:52 +00:00
Kp
bfe7f2bb19
Reorder fvi_sub object type tests
...
Two tests in series examined the object for a type of OBJ_ROBOT. Fold
the test together.
The next test also examines ->type. Move that to an else since it
cannot be true if the first test was true.
2022-06-05 17:44:52 +00:00
Kp
33152640bc
Remove fvi_info::hit_type
...
Its value is always readily available as the return value of
find_vector_intersection, so remove the structure member and rely on the
returned value.
2022-06-05 17:44:52 +00:00
Kp
a8e7f6ad59
Use enum class for find_vector_intersection result
2022-05-24 02:32:58 +00:00
Kp
62635ec285
Use enum class for vm_magnitude_squared
2022-05-24 02:32:58 +00:00
Kp
edbdec361c
Check return value of check_line_to_line
2022-05-10 01:58:55 +00:00
Kp
2b36332228
Use enum class for intersection_type in fvi
2022-05-10 01:58:55 +00:00
Kp
2fe9a16613
Use dedicated type for mask of segment side numbers
2022-02-19 14:52:17 +00:00
Kp
f47a2c9f0d
Convert Side_to_verts to enumerated_array<..., sidenum_t>
2022-01-09 15:25:42 +00:00
Kp
fbe3bbd0fa
Use enum sidenum_t in more places
2022-01-09 15:25:42 +00:00
Kp
0044c010ad
Use structured bindings for create_abs_vertex_lists
2021-11-01 03:37:20 +00:00
Kp
e1aac6949a
Replace __attribute_warn_unused_result with C++17 [[nodiscard]]
...
This eliminates a configure test, and may help readers understand the
annotation more readily.
2021-06-28 03:37:51 +00:00
Kp
58a1d86c05
Fix return type of check_trans_wall lambda ( #588 )
...
The deduced return type is `grs_bitmap`, which is inefficient, but not
wrong on its own. However, `rle_expand_texture` uses the address of its
argument as a long-term cache key, so it must never be called with the
address of a stack-local variable. When the return type is
`grs_bitmap`, the argument to `rle_expand_texture` is a reference to a
stack-local variable. Fix this by setting the return type to
`const grs_bitmap &`, so that the argument to `rle_expand_texture` is a
reference to an element in the global GameBitmaps array.
AlumiuN proposed an initial fix, but based on analysis of why that fix
worked, I elected to use a different, smaller, fix instead.
Reported-by: CHILLYBUS <https://github.com/dxx-rebirth/dxx-rebirth/issues/588 >
Reported-by: KynikossDragonn <https://github.com/dxx-rebirth/dxx-rebirth/issues/588#issuecomment-825978696 >
Analyzed-by: AlumiuN <https://github.com/dxx-rebirth/dxx-rebirth/issues/588#issuecomment-826009993 >
Analyzed-by: 4C1T <https://github.com/dxx-rebirth/dxx-rebirth/issues/588#issuecomment-826016402 >
Proposed-fix-by: AlumiuN <c4d1f41946
>
Fixes: 61f186bc18
("Use enum class for texture1_value")
2021-04-24 17:32:47 +00:00
Kp
fc63029833
Move more symbols into namespaces
2020-12-26 21:17:29 +00:00
Kp
faa4d2ce34
Use enum class for vertnum_t
2020-12-26 21:17:29 +00:00
Kp
47c33cbd55
Use enum class for WALL_IS_DOORWAY_FLAG
...
This reduces the size of the debug information substantially.
2020-12-19 16:13:26 +00:00
Kp
c482d01be5
Move some fvi types to namespaces
2020-10-01 03:25:27 +00:00
Kp
61f186bc18
Use enum class for texture1_value
2020-09-11 03:08:02 +00:00
Kp
6d3dce4e16
Use enum class for tmap_num2
...
Define separate enum values for rotation data in both the high bits,
where it is usually kept, and the low bits, where it is sometimes used
for math or comparisons.
Define an enum value to represent the composite of the index and the
rotation, since the composite is not suitable for use as an array
subscript. Add helper functions to extract the component pieces.
2020-08-24 01:31:28 +00:00
Kp
de4efc4f46
Qualify more uses of shared_segment members
2020-08-24 01:31:28 +00:00
Kp
038c6aef4d
Move d_level_unique_object_state to a separate header
...
This is required to untangle the cross-inclusion of object.h and
morph.h.
2020-08-10 03:45:14 +00:00
Kp
4ef247e494
Use enum class for collision_result values
2020-08-06 03:47:56 +00:00
Kp
6285878c4c
Add color_palette_index type alias, to note palette-related uint8_t
2020-07-16 02:31:04 +00:00
Kp
a4f2edfaa9
Move LevelSharedVertexState into d_level_shared_segment_state
2020-05-17 23:35:25 +00:00
Kp
53761500f1
Qualify uses of std::array
2020-05-02 21:18:42 +00:00
Kp
c9b1b5b1ec
Use susegment for WALL_IS_DOORWAY
2019-12-27 02:02:23 +00:00
Kp
5dfd62c4f6
Use susegment
for references introduced by valptridx conversion
2019-12-22 05:34:08 +00:00
Kp
30091902af
Simplify valptridx types where possible
...
Switch valptridx::ptr to a reference type.
Switch valptridx::ptridx to a reference type or to ::ptr.
Fix up uses of operator-> accordingly.
2019-12-22 05:34:08 +00:00
Kp
28d9358b00
Expand local aliases to their target variables
...
This makes the code easier to read, at the price of a bit of churn.
2019-12-16 01:56:59 +00:00
Kp
1008ab397e
Move Objects to d_level_unique_object_state
2019-03-03 00:31:08 +00:00
Kp
12403a78f7
Pass vcvertptr to sphere_intersects_wall
2019-02-02 18:36:39 +00:00
Kp
ffb5e8821c
Flatten use of sphere_intersects_wall
2019-02-02 18:36:39 +00:00
Kp
0080a8b7c7
Remove unused object_intersects_wall
2019-01-01 04:54:35 +00:00
Kp
e84a65edc6
Move Robot_info into LevelSharedRobotInfoState
2018-12-30 00:43:59 +00:00
Kp
9be3c8e2e8
Move Walls into d_level_unique_wall_state
2018-12-30 00:43:58 +00:00
Kp
1a5844e218
Move Vertices out of global scope
2018-12-30 00:43:57 +00:00
Kp
2f537133e8
Use vcobjidx_t for fvi ignore_obj_list
...
Enforce that callers provide vcobjidx_t, instead of permitting any type
compatible with objnum_t.
2018-12-30 00:43:57 +00:00
Kp
706a704c6d
Move unique_side to unique_segment
2018-12-13 02:31:38 +00:00
Kp
f7ad4d9b1a
Pass segments to find_point_seg
2018-09-19 02:13:30 +00:00
Kp
30a83eec41
Eliminate some uses of valptridx::operator->
2018-06-24 05:06:15 +00:00