qbsp: fix areaportals
This commit is contained in:
parent
7275155d62
commit
5cae1919ce
|
|
@ -26,6 +26,8 @@
|
|||
#include <common/aabb.hh>
|
||||
#include <optional>
|
||||
|
||||
class mapentity_t;
|
||||
|
||||
struct brush_t
|
||||
{
|
||||
/**
|
||||
|
|
@ -39,6 +41,7 @@ struct brush_t
|
|||
contentflags_t contents; /* BSP contents */
|
||||
short lmshift; /* lightmap scaling (qu/lightmap pixel), passed to the light util */
|
||||
std::optional<uint32_t> outputnumber; /* only set for original brushes */
|
||||
mapentity_t *func_areaportal;
|
||||
|
||||
void update_bounds();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -326,7 +326,6 @@ struct face_t : face_fragment_t
|
|||
twosided<contentflags_t> contents;
|
||||
twosided<int16_t> lmshift;
|
||||
|
||||
mapentity_t *src_entity; // source entity
|
||||
qvec3d origin;
|
||||
vec_t radius;
|
||||
|
||||
|
|
|
|||
|
|
@ -376,7 +376,6 @@ static std::vector<face_t> CreateBrushFaces(const mapentity_t *src, hullbrush_t
|
|||
|
||||
f.texinfo = hullnum > 0 ? 0 : mapface.texinfo;
|
||||
f.planenum = FindPlane(plane, &f.planeside);
|
||||
f.src_entity = const_cast<mapentity_t *>(src); // FIXME: get rid of consts on src in the callers?
|
||||
|
||||
CheckFace(&f, mapface);
|
||||
UpdateFaceSphere(&f);
|
||||
|
|
@ -942,6 +941,10 @@ static void Brush_LoadEntity(mapentity_t *dst, const mapentity_t *src, const int
|
|||
|
||||
brush->lmshift = lmshift;
|
||||
|
||||
if (classname == std::string_view("func_areaportal")) {
|
||||
brush->func_areaportal = const_cast<mapentity_t *>(src); // FIXME: get rid of consts on src in the callers?
|
||||
}
|
||||
|
||||
if (brush->contents.is_solid(options.target_game)) {
|
||||
stats.solid++;
|
||||
} else if (brush->contents.is_sky(options.target_game)) {
|
||||
|
|
|
|||
|
|
@ -78,7 +78,6 @@ face_t *NewFaceFromFace(const face_t *in)
|
|||
newf->planeside = in->planeside;
|
||||
newf->contents = in->contents;
|
||||
newf->lmshift = in->lmshift;
|
||||
newf->src_entity = in->src_entity;
|
||||
|
||||
newf->origin = in->origin;
|
||||
newf->radius = in->radius;
|
||||
|
|
|
|||
|
|
@ -426,7 +426,8 @@ static void FloodAreas_r(node_t *node)
|
|||
{
|
||||
if (node->planenum == PLANENUM_LEAF && node->contents.native == Q2_CONTENTS_AREAPORTAL) {
|
||||
// grab the func_areanode entity
|
||||
mapentity_t *entity = node->markfaces[0]->src_entity;
|
||||
mapentity_t *entity = node->original_brushes.at(0)->func_areaportal;
|
||||
Q_assert(entity != nullptr);
|
||||
|
||||
// this node is part of an area portal;
|
||||
// if the current area has allready touched this
|
||||
|
|
@ -523,7 +524,7 @@ static void SetAreaPortalAreas_r(node_t *node)
|
|||
return; // already set
|
||||
|
||||
// grab the func_areanode entity
|
||||
mapentity_t *entity = node->markfaces[0]->src_entity;
|
||||
mapentity_t *entity = node->original_brushes.at(0)->func_areaportal;
|
||||
|
||||
node->area = entity->portalareas[0];
|
||||
if (!entity->portalareas[1]) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue