|
102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
|
#include <stdbool.h>#include <stddef.h>#include <stdint.h>#include <dttr_core.h>#include <dttr_pcdogs.h>#include <dttr_util_mem.h>Go to the source code of this file.
Macros | |
| #define | DTTR_UTIL_COLLISION_Q12_ONE 4096 |
| Collision node transform matrices use this Q12 fixed-point unit. | |
| #define | DTTR_UTIL_COLLISION_VERTEX_WORLD_SCALE 64 |
| #define | DTTR_UTIL_COLLISION_MAX_VERTICES 4096u |
| #define | DTTR_UTIL_COLLISION_MAX_POLYGONS 8192u |
| #define | DTTR_UTIL_COLLISION_ADJ_FACE_MIN_SIZE 0x14u |
| #define | DTTR_UTIL_COLLISION_VERTEX_WALL_TAG_OFFSET 0x0bu |
| #define DTTR_UTIL_COLLISION_ADJ_FACE_MIN_SIZE 0x14u |
A face-plane record must be readable through at least this size, which covers the header through the adjacency words at +0xC.
Definition at line 41 of file dttr_util_collision.h.
Referenced by DTTR_Util_CollisionAdjacentPolygon().
| #define DTTR_UTIL_COLLISION_MAX_POLYGONS 8192u |
Definition at line 37 of file dttr_util_collision.h.
Referenced by DTTR_Util_CollisionPolygonInNode().
| #define DTTR_UTIL_COLLISION_MAX_VERTICES 4096u |
Bounds for node array counts. Live nodes stay far below these values; larger counts usually mean a stale or misread node.
Definition at line 36 of file dttr_util_collision.h.
Referenced by DTTR_Util_CollisionPolygonInNode().
| #define DTTR_UTIL_COLLISION_Q12_ONE 4096 |
Collision node transform matrices use this Q12 fixed-point unit.
Helpers for decoding live collision nodes, polygons, edge adjacency, and wall edges.
This header is exposed through dttr_sdk.h only when DTTR_SDK_ENABLE_UNSTABLE is set. It depends on PCDOGS layouts that are still being mapped, so source and ABI details may change without notice.
Definition at line 27 of file dttr_util_collision.h.
Referenced by DTTR_Util_CollisionVertexWorld().
| #define DTTR_UTIL_COLLISION_VERTEX_WALL_TAG_OFFSET 0x0bu |
The per-vertex wall tag sits at this byte offset within a collision vertex record.
Definition at line 45 of file dttr_util_collision.h.
Referenced by dttr_util_collision_vertex_wall_tag().
| #define DTTR_UTIL_COLLISION_VERTEX_WORLD_SCALE 64 |
Raw collision vertex components are local units at 1/64 of world fixed point, so a world position is the node origin plus the (optionally rotated) raw vertex times this scale.
Definition at line 32 of file dttr_util_collision.h.
Referenced by DTTR_Util_CollisionVertexWorld().
|
inlinestatic |
Definition at line 200 of file dttr_util_collision.h.
References DTTR_PCDOGS_T_Collision_Node::vertex_count, and DTTR_PCDOGS_T_Collision_Polygon::vertex_indices.
Referenced by DTTR_Util_CollisionEdgeIsWall(), and DTTR_Util_CollisionWallEdgeQuad().
|
inlinestatic |
Definition at line 223 of file dttr_util_collision.h.
References DTTR_UTIL_COLLISION_VERTEX_WALL_TAG_OFFSET.
Referenced by DTTR_Util_CollisionEdgeIsWall().
|
inlinestatic |
Decode a polygon's packed edge adjacency locally and return the neighbor.
The packed words live at +0xC of the polygon's face-plane record: the low two bits hold the neighbor edge, and the rest is a one-based index into the owning node's polygon array. Local decoding avoids the native helper's stale-record crashes and leaves walkability filtering to callers.
Definition at line 164 of file dttr_util_collision.h.
References DTTR_PCDOGS_T_Collision_Polygon::adj_face_ptr, DTTR_UTIL_COLLISION_ADJ_FACE_MIN_SIZE, DTTR_Util_MemReadable(), NULL, DTTR_PCDOGS_T_Collision_Node::polygon_count, and DTTR_PCDOGS_T_Collision_Node::polygons.
Referenced by DTTR_Util_CollisionEdgeIsWall().
|
inlinestatic |
Return whether a polygon edge is a wall, per the engine's rule in Collision_ProcessActorGroundCheck. Make sure you validate polygon membership with DTTR_Util_CollisionPolygonInNode first.
A wall edge belongs to a boundary polygon (flags 0x4000), has at least one endpoint with a nonzero wall tag (byte +0xB of the vertex record), and its neighbor across the edge is missing or not walkable (neighbor flags bit 0x4 clear), unless flags 0x400 plus bit 0 of the face-plane record mark it as a one-way or disabled barrier. The engine only extrudes such edges into vertical planes near a touching actor, while this predicate classifies them anywhere.
Definition at line 240 of file dttr_util_collision.h.
References dttr_util_collision_edge_vertices(), dttr_util_collision_vertex_wall_tag(), DTTR_Util_CollisionAdjacentPolygon(), DTTR_Util_CollisionPolygonEdgeCount(), DTTR_Util_MemReadable(), DTTR_PCDOGS_T_Collision_Polygon::flags, NULL, DTTR_PCDOGS_T_Collision_Polygon::plane_data, and DTTR_PCDOGS_T_Collision_Node::vertices.
|
inlinestatic |
Return a polygon's edge count, which is 4 unless flags bit 0x1 marks a triangle. The polygon must be readable.
Definition at line 49 of file dttr_util_collision.h.
References DTTR_PCDOGS_T_Collision_Polygon::flags.
Referenced by DTTR_Util_CollisionEdgeIsWall(), and DTTR_Util_CollisionWallEdgeQuad().
|
inlinestatic |
Report whether a polygon pointer belongs to a node's polygon array and the node's vertex array can satisfy the polygon's indices.
A zero polygon_count is normal on live nodes, in which case vertex_count stands in as the membership upper bound.
Definition at line 111 of file dttr_util_collision.h.
References DTTR_UTIL_COLLISION_MAX_POLYGONS, DTTR_UTIL_COLLISION_MAX_VERTICES, DTTR_Util_MemReadable(), DTTR_PCDOGS_T_Collision_Node::polygon_count, DTTR_PCDOGS_T_Collision_Node::polygons, DTTR_PCDOGS_T_Collision_Node::vertex_count, DTTR_PCDOGS_T_Collision_Polygon::vertex_indices, and DTTR_PCDOGS_T_Collision_Node::vertices.
|
inlinestatic |
Convert a raw collision vertex to world fixed-point coordinates (Y is the vertical axis).
The node's Q12 rotation matrix is applied first when node flags 0x22 request transformed coordinates, then the raw-to-world scale and the node origin, matching the engine's own vertex handling in collision tests.
Definition at line 62 of file dttr_util_collision.h.
References DTTR_UTIL_COLLISION_Q12_ONE, DTTR_UTIL_COLLISION_VERTEX_WORLD_SCALE, DTTR_PCDOGS_T_Collision_Node::flags, DTTR_PCDOGS_T_Math_Matrix3x3I16::m00, DTTR_PCDOGS_T_Math_Matrix3x3I16::m01, DTTR_PCDOGS_T_Math_Matrix3x3I16::m02, DTTR_PCDOGS_T_Math_Matrix3x3I16::m10, DTTR_PCDOGS_T_Math_Matrix3x3I16::m11, DTTR_PCDOGS_T_Math_Matrix3x3I16::m12, DTTR_PCDOGS_T_Math_Matrix3x3I16::m20, DTTR_PCDOGS_T_Math_Matrix3x3I16::m21, DTTR_PCDOGS_T_Math_Matrix3x3I16::m22, DTTR_PCDOGS_T_Collision_Node::origin, DTTR_PCDOGS_T_Collision_Node::transform_matrix, DTTR_PCDOGS_T_Collision_Vertex::x, DTTR_PCDOGS_T_Math_Vec3I32::x, x, DTTR_PCDOGS_T_Collision_Vertex::y, DTTR_PCDOGS_T_Math_Vec3I32::y, y, DTTR_PCDOGS_T_Collision_Vertex::z, DTTR_PCDOGS_T_Math_Vec3I32::z, and z.
Referenced by DTTR_Util_CollisionWallEdgeQuad().
|
inlinestatic |
Build a vertical world-space quad over a wall edge. The base follows the edge, and the top is height_fp world fixed-point units above it.
Definition at line 277 of file dttr_util_collision.h.
References dttr_util_collision_edge_vertices(), DTTR_Util_CollisionPolygonEdgeCount(), DTTR_Util_CollisionVertexWorld(), DTTR_PCDOGS_T_Collision_Node::vertices, DTTR_PCDOGS_T_Math_Vec3I32::x, DTTR_PCDOGS_T_Math_Vec3I32::y, and DTTR_PCDOGS_T_Math_Vec3I32::z.