mirror of
https://github.com/astromaddie/HaloCE-VR.git
synced 2026-10-20 03:00:13 +02:00
January's decals copy of the bsp3d_get_plane_from_designator inline branches on the sign bit (jns), matching the punpckhdq upstream spelling. Full build: decals::_bsp3d_get_plane_from_designator exact (112 padded), 0 regressions across all bsp3d.h consumers, parks clean. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
66 lines
1.0 KiB
C
66 lines
1.0 KiB
C
/*
|
|
BSP3D.H
|
|
|
|
header included in hcex build.
|
|
*/
|
|
|
|
#ifndef __BSP3D_H
|
|
#define __BSP3D_H
|
|
#pragma once
|
|
|
|
|
|
/* ---------- headers */
|
|
|
|
#include "tag_files/tag_groups.h"
|
|
#include "math/real_math.h"
|
|
|
|
/* ---------- constants */
|
|
|
|
/* ---------- macros */
|
|
|
|
/* ---------- structures */
|
|
|
|
struct bsp3d
|
|
{
|
|
struct tag_block nodes;
|
|
struct tag_block planes;
|
|
};
|
|
|
|
struct bsp3d_node
|
|
{
|
|
long plane_designator;
|
|
long children[2];
|
|
};
|
|
|
|
typedef char bsp3d_node_size_check[
|
|
sizeof(struct bsp3d_node) == 0xC ? 1 : -1];
|
|
|
|
/* ---------- prototypes/BSP3D.C */
|
|
|
|
long bsp3d_test_point(struct bsp3d const *bsp, long node_index, union real_point3d const *point);
|
|
|
|
/* ---------- globals */
|
|
|
|
/* ---------- public code */
|
|
|
|
__inline real_plane3d *bsp3d_get_plane_from_designator(
|
|
struct bsp3d const *bsp,
|
|
long plane_designator,
|
|
real_plane3d *result)
|
|
{
|
|
real_plane3d* plane = TAG_BLOCK_GET_ELEMENT(&bsp->planes, plane_designator & LONG_MAX, real_plane3d);
|
|
|
|
if (plane_designator & LONG_MIN)
|
|
{
|
|
plane3d_negate(plane, result);
|
|
}
|
|
else
|
|
{
|
|
*result = *plane;
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
#endif // __BSP3D_H
|