From 925300716b796d95855eed8bc9bdc791e44458f2 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Thu, 19 May 2022 15:13:07 +0900 Subject: [PATCH] [mode] Go back to using dclipnode_t everywhere It was added only because FitzQuake used it in its pre-bsp2 large-map support. That support has been hidden in bspfile.c for some time now. This doesn't gain much other than having one less type to worry about. Well tested on Conflagrant Rodent (the map that caused the need for mclipnode_t in the first place). --- include/QF/model.h | 9 ++------- include/world.h | 2 +- libs/models/brush/model_brush.c | 4 ++-- libs/models/clip_hull.c | 8 ++++---- libs/models/portal.c | 2 +- libs/models/test/hulls.c | 24 ++++++++++++------------ libs/models/test/trace-id.c | 4 ++-- libs/models/test/trace-qf-bad.c | 2 +- libs/models/trace.c | 4 ++-- nq/source/world.c | 6 +++--- qw/source/pmovetst.c | 6 +++--- qw/source/world.c | 6 +++--- 12 files changed, 36 insertions(+), 41 deletions(-) diff --git a/include/QF/model.h b/include/QF/model.h index 89e0b8730..47a7a8baa 100644 --- a/include/QF/model.h +++ b/include/QF/model.h @@ -207,13 +207,8 @@ typedef struct mleaf_s { byte ambient_sound_level[NUM_AMBIENTS]; } mleaf_t; -typedef struct mclipnode_s { - unsigned planenum; - int children[2]; -} mclipnode_t; - typedef struct hull_s { - mclipnode_t *clipnodes; + dclipnode_t *clipnodes; plane_t *planes; int firstclipnode; int lastclipnode; @@ -256,7 +251,7 @@ typedef struct mod_brush_s { int *surfedges; unsigned numclipnodes; - mclipnode_t *clipnodes; + dclipnode_t *clipnodes; unsigned nummarksurfaces; msurface_t **marksurfaces; diff --git a/include/world.h b/include/world.h index 57bc973a6..cab559011 100644 --- a/include/world.h +++ b/include/world.h @@ -82,7 +82,7 @@ extern areanode_t sv_areanodes[AREA_NODES]; void SV_FreeAllEdictLeafs (void); -void SV_InitHull (hull_t *hull, mclipnode_t *clipnodes, plane_t *planes); +void SV_InitHull (hull_t *hull, dclipnode_t *clipnodes, plane_t *planes); void SV_ClearWorld (void); // called after the world model has been loaded, before linking any entities diff --git a/libs/models/brush/model_brush.c b/libs/models/brush/model_brush.c index 34863d573..0b88504ab 100644 --- a/libs/models/brush/model_brush.c +++ b/libs/models/brush/model_brush.c @@ -818,7 +818,7 @@ static void Mod_LoadClipnodes (model_t *mod, bsp_t *bsp) { dclipnode_t *in; - mclipnode_t *out; + dclipnode_t *out; hull_t *hull; int count, i; mod_brush_t *brush = &mod->brush; @@ -891,7 +891,7 @@ Mod_LoadClipnodes (model_t *mod, bsp_t *bsp) static void Mod_MakeHull0 (model_t *mod) { - mclipnode_t *out; + dclipnode_t *out; hull_t *hull; int count, i, j; mnode_t *in, *child; diff --git a/libs/models/clip_hull.c b/libs/models/clip_hull.c index 0a01b62f1..0c9820eff 100644 --- a/libs/models/clip_hull.c +++ b/libs/models/clip_hull.c @@ -45,7 +45,7 @@ MOD_Alloc_Hull (int nodes, int planes) int size, i; size = sizeof (hull_t); - size += sizeof (mclipnode_t) * nodes + sizeof (plane_t) * planes; + size += sizeof (dclipnode_t) * nodes + sizeof (plane_t) * planes; size *= MAX_MAP_HULLS; size += sizeof (clip_hull_t); @@ -55,11 +55,11 @@ MOD_Alloc_Hull (int nodes, int planes) ch->hulls[0] = (hull_t *) &ch[1]; for (i = 1; i < MAX_MAP_HULLS; i++) ch->hulls[i] = &ch->hulls[i - 1][1]; - ch->hulls[0]->clipnodes = (mclipnode_t *) &ch->hulls[i - 1][1]; + ch->hulls[0]->clipnodes = (dclipnode_t *) &ch->hulls[i - 1][1]; ch->hulls[0]->planes = (plane_t *) &ch->hulls[0]->clipnodes[nodes]; for (i = 1; i < MAX_MAP_HULLS; i++) { ch->hulls[i]->clipnodes = - (mclipnode_t *) &ch->hulls[i - 1]->planes[planes]; + (dclipnode_t *) &ch->hulls[i - 1]->planes[planes]; ch->hulls[i]->planes = (plane_t *) &ch->hulls[i]->clipnodes[nodes]; } return ch; @@ -74,7 +74,7 @@ MOD_Free_Hull (clip_hull_t *ch) static void recurse_clip_tree (hull_t *hull, int num, int depth) { - mclipnode_t *node; + dclipnode_t *node; if (num < 0) { if (depth > hull->depth) diff --git a/libs/models/portal.c b/libs/models/portal.c index ca09be139..2745277b9 100644 --- a/libs/models/portal.c +++ b/libs/models/portal.c @@ -111,7 +111,7 @@ add_portal (clipport_t *portal, clipleaf_t *front, clipleaf_t *back) static clipleaf_t * carve_leaf (hull_t *hull, nodeleaf_t *nodeleafs, clipleaf_t *leaf, int num) { - mclipnode_t *node; + dclipnode_t *node; plane_t *plane; winding_t *winding, *fw, *bw; clipport_t *portal; diff --git a/libs/models/test/hulls.c b/libs/models/test/hulls.c index 1b7fa39ba..02e2db43d 100644 --- a/libs/models/test/hulls.c +++ b/libs/models/test/hulls.c @@ -10,7 +10,7 @@ // |ss\ . // 0 1 -static mclipnode_t clipnodes_simple_wedge[] = { +static dclipnode_t clipnodes_simple_wedge[] = { { 0, { 1, CONTENTS_EMPTY}}, { 1, {CONTENTS_EMPTY, CONTENTS_SOLID}}, }; @@ -34,7 +34,7 @@ hull_t hull_simple_wedge = { // sss|sss| |sss // 0 1 2 -static mclipnode_t clipnodes_tpp1[] = { +static dclipnode_t clipnodes_tpp1[] = { { 0, { 1, CONTENTS_SOLID}}, { 1, { 2, CONTENTS_SOLID}}, { 2, {CONTENTS_SOLID, CONTENTS_EMPTY}}, @@ -60,7 +60,7 @@ hull_t hull_tpp1 = { // sss|sss| |sss // 1 0 2 -static mclipnode_t clipnodes_tpp2[] = { +static dclipnode_t clipnodes_tpp2[] = { { 0, { 2, 1}}, { 1, {CONTENTS_SOLID, CONTENTS_SOLID}}, { 2, {CONTENTS_SOLID, CONTENTS_EMPTY}}, @@ -86,7 +86,7 @@ hull_t hull_tpp2 = { // sss| |www|sss // 1 0 2 -static mclipnode_t clipnodes_tppw[] = { +static dclipnode_t clipnodes_tppw[] = { { 0, { 2, 1}}, { 1, {CONTENTS_EMPTY, CONTENTS_SOLID}}, { 2, {CONTENTS_SOLID, CONTENTS_WATER}}, @@ -112,7 +112,7 @@ hull_t hull_tppw = { // |sss // ---+--- 0 // ss0,0ss -static mclipnode_t clipnodes_step1[] = { +static dclipnode_t clipnodes_step1[] = { { 0, { 1, CONTENTS_SOLID}}, { 1, {CONTENTS_EMPTY, 2}}, { 2, {CONTENTS_SOLID, CONTENTS_EMPTY}}, @@ -139,7 +139,7 @@ hull_t hull_step1 = { // |sss // ---+sss 2 // ss0,0ss -static mclipnode_t clipnodes_step2[] = { +static dclipnode_t clipnodes_step2[] = { { 0, { 1, 2}}, { 1, {CONTENTS_EMPTY, CONTENTS_SOLID}}, { 2, {CONTENTS_EMPTY, CONTENTS_SOLID}}, @@ -166,7 +166,7 @@ hull_t hull_step2 = { // sss| // sss+--- 1 // ss0,0ss -static mclipnode_t clipnodes_step3[] = { +static dclipnode_t clipnodes_step3[] = { { 0, { 1, 2}}, { 1, {CONTENTS_EMPTY, CONTENTS_SOLID}}, { 2, {CONTENTS_EMPTY, CONTENTS_SOLID}}, @@ -195,7 +195,7 @@ hull_t hull_step3 = { // |sss // ---+--- 0 // ss0,0ss -static mclipnode_t clipnodes_covered_step[] = { +static dclipnode_t clipnodes_covered_step[] = { { 0, { 1, CONTENTS_SOLID}}, { 1, { 3, 2}}, { 2, {CONTENTS_SOLID, CONTENTS_EMPTY}}, @@ -225,7 +225,7 @@ hull_t hull_covered_step = { // 0,0+--- 1 // /ssss // 2 ssss -static mclipnode_t clipnodes_ramp[] = { +static dclipnode_t clipnodes_ramp[] = { { 0, { 1, 2}}, { 1, {CONTENTS_EMPTY, CONTENTS_SOLID}}, { 2, {CONTENTS_EMPTY, CONTENTS_SOLID}}, @@ -254,7 +254,7 @@ hull_t hull_ramp = { // ss|sss|ss // -8 8 // looking at plane 0: back of 0 is empty, front of 0 has above hole -static mclipnode_t clipnodes_hole[] = { +static dclipnode_t clipnodes_hole[] = { { 0, { 1, CONTENTS_EMPTY}}, { 1, {CONTENTS_SOLID, 2}}, { 2, { 3, CONTENTS_SOLID}}, @@ -284,7 +284,7 @@ hull_t hull_hole = { // |sss| // ---+---+--- 0 // ss0,0s8,0ss -static mclipnode_t clipnodes_ridge[] = { +static dclipnode_t clipnodes_ridge[] = { { 0, { 1, CONTENTS_SOLID}}, { 1, {CONTENTS_EMPTY, 2}}, { 2, { 3, CONTENTS_EMPTY}}, @@ -320,7 +320,7 @@ hull_t hull_ridge = { // 0 -------.------- -20 // sssssssssssssss // sssssssssssssss -static mclipnode_t clipnodes_cave[] = { +static dclipnode_t clipnodes_cave[] = { { 0, { 1, CONTENTS_SOLID}}, { 1, { 2, 3}}, { 2, {CONTENTS_SOLID, 4}}, diff --git a/libs/models/test/trace-id.c b/libs/models/test/trace-id.c index da85a01d0..52ccb2d37 100644 --- a/libs/models/test/trace-id.c +++ b/libs/models/test/trace-id.c @@ -5,7 +5,7 @@ static int HullPointContents (hull_t *hull, int num, const vec3_t p) { float d; - mclipnode_t *node; + dclipnode_t *node; mplane_t *plane; while (num >= 0) @@ -37,7 +37,7 @@ HullPointContents (hull_t *hull, int num, const vec3_t p) static qboolean SV_RecursiveHullCheck (hull_t *hull, int num, float p1f, float p2f, const vec3_t p1, const vec3_t p2, trace_t *trace) { - mclipnode_t *node; + dclipnode_t *node; mplane_t *plane; float t1, t2; float frac; diff --git a/libs/models/test/trace-qf-bad.c b/libs/models/test/trace-qf-bad.c index 05d31581b..0bf56bbb0 100644 --- a/libs/models/test/trace-qf-bad.c +++ b/libs/models/test/trace-qf-bad.c @@ -94,7 +94,7 @@ MOD_TraceLine (hull_t *hull, int num, int side, empty, solid; tracestack_t *tstack; tracestack_t tracestack[256]; - mclipnode_t *node; + dclipnode_t *node; mplane_t *plane, *split_plane; VectorCopy (start_point, start); diff --git a/libs/models/trace.c b/libs/models/trace.c index d65a06c9a..2ee7cf7a4 100644 --- a/libs/models/trace.c +++ b/libs/models/trace.c @@ -786,7 +786,7 @@ MOD_TraceLine (hull_t *hull, int num, int side; tracestack_t *tstack; tracestack_t *tracestack; - mclipnode_t *node; + dclipnode_t *node; plane_t *plane; clipleaf_t *leaf; trace_state_t trace_state; @@ -927,7 +927,7 @@ MOD_HullContents (hull_t *hull, int num, const vec3_t origin, trace_t *trace) // follow origin down the bsp tree to find the "central" leaf while (num >= 0) { vec_t d; - mclipnode_t *node; + dclipnode_t *node; plane_t *plane; node = hull->clipnodes + num; diff --git a/nq/source/world.c b/nq/source/world.c index b8b423d83..9926abd26 100644 --- a/nq/source/world.c +++ b/nq/source/world.c @@ -135,7 +135,7 @@ typedef struct { /* HULL BOXES */ static hull_t box_hull; -static mclipnode_t box_clipnodes[6]; +static dclipnode_t box_clipnodes[6]; static plane_t box_planes[6]; @@ -146,7 +146,7 @@ static plane_t box_planes[6]; can just be stored out and get a proper hull_t structure. */ void -SV_InitHull (hull_t *hull, mclipnode_t *clipnodes, plane_t *planes) +SV_InitHull (hull_t *hull, dclipnode_t *clipnodes, plane_t *planes) { int side, i; @@ -532,7 +532,7 @@ int SV_HullPointContents (hull_t *hull, int num, const vec3_t p) { float d; - mclipnode_t *node; + dclipnode_t *node; plane_t *plane; while (num >= 0) { diff --git a/qw/source/pmovetst.c b/qw/source/pmovetst.c index b79e860e0..b1f5fb84e 100644 --- a/qw/source/pmovetst.c +++ b/qw/source/pmovetst.c @@ -46,7 +46,7 @@ #include "world.h" static hull_t box_hull; -static mclipnode_t box_clipnodes[6]; +static dclipnode_t box_clipnodes[6]; static plane_t box_planes[6]; @@ -107,7 +107,7 @@ inline int PM_HullPointContents (hull_t *hull, int num, const vec3_t p) { float d; - mclipnode_t *node; + dclipnode_t *node; plane_t *plane; while (num >= 0) { @@ -132,7 +132,7 @@ PM_PointContents (const vec3_t p) { float d; int num; - mclipnode_t *node; + dclipnode_t *node; hull_t *hull; plane_t *plane; diff --git a/qw/source/world.c b/qw/source/world.c index 7024bca6c..1c0de0270 100644 --- a/qw/source/world.c +++ b/qw/source/world.c @@ -135,7 +135,7 @@ typedef struct { /* HULL BOXES */ static hull_t box_hull; -static mclipnode_t box_clipnodes[6]; +static dclipnode_t box_clipnodes[6]; static plane_t box_planes[6]; @@ -146,7 +146,7 @@ static plane_t box_planes[6]; can just be stored out and get a proper hull_t structure. */ void -SV_InitHull (hull_t *hull, mclipnode_t *clipnodes, plane_t *planes) +SV_InitHull (hull_t *hull, dclipnode_t *clipnodes, plane_t *planes) { int side, i; @@ -532,7 +532,7 @@ int SV_HullPointContents (hull_t *hull, int num, const vec3_t p) { float d; - mclipnode_t *node; + dclipnode_t *node; plane_t *plane; while (num >= 0) {