Skip to content

Commit

Permalink
Refactor: Renamed subsector_t as BspLeaf
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Mar 10, 2012
1 parent fa77ecf commit 670854c
Show file tree
Hide file tree
Showing 100 changed files with 1,115 additions and 1,129 deletions.
16 changes: 8 additions & 8 deletions doomsday/engine/api/dd_maptypes.h
Expand Up @@ -11,18 +11,18 @@
#define DMT_HEDGE_V DDVT_PTR // [Start, End] of the segment.
#define DMT_HEDGE_LINEDEF DDVT_PTR
#define DMT_HEDGE_SEC DDVT_PTR
#define DMT_HEDGE_SUBSECTOR DDVT_PTR
#define DMT_HEDGE_BSPLEAF DDVT_PTR
#define DMT_HEDGE_TWIN DDVT_PTR
#define DMT_HEDGE_ANGLE DDVT_ANGLE
#define DMT_HEDGE_SIDE DDVT_BYTE // 0=front, 1=back
#define DMT_HEDGE_FLAGS DDVT_BYTE
#define DMT_HEDGE_LENGTH DDVT_FLOAT // Accurate length of the segment (v1 -> v2).
#define DMT_HEDGE_OFFSET DDVT_FLOAT

#define DMT_SUBSECTOR_HEDGECOUNT DDVT_UINT
#define DMT_SUBSECTOR_HEDGES DDVT_PTR // [hedgeCount] size.
#define DMT_SUBSECTOR_POLYOBJ DDVT_PTR // NULL, if there is no polyobj.
#define DMT_SUBSECTOR_SECTOR DDVT_PTR
#define DMT_BSPLEAF_HEDGECOUNT DDVT_UINT
#define DMT_BSPLEAF_HEDGES DDVT_PTR // [hedgeCount] size.
#define DMT_BSPLEAF_POLYOBJ DDVT_PTR // NULL, if there is no polyobj.
#define DMT_BSPLEAF_SECTOR DDVT_PTR

#define DMT_MATERIAL_FLAGS DDVT_SHORT
#define DMT_MATERIAL_WIDTH DDVT_INT
Expand Down Expand Up @@ -51,8 +51,8 @@
#define DMT_SECTOR_MOBJLIST DDVT_PTR // List of mobjs in the sector.
#define DMT_SECTOR_LINEDEFCOUNT DDVT_UINT
#define DMT_SECTOR_LINEDEFS DDVT_PTR // [lineDefCount+1] size.
#define DMT_SECTOR_SUBSECTORCOUNT DDVT_UINT
#define DMT_SECTOR_SUBSECTORS DDVT_PTR // [subsectorCount+1] size.
#define DMT_SECTOR_BSPLEAFCOUNT DDVT_UINT
#define DMT_SECTOR_BSPLEAFS DDVT_PTR // [bspLeafCount+1] size.
#define DMT_SECTOR_SOUNDORG DDVT_PTR
#define DMT_SECTOR_PLANECOUNT DDVT_UINT
#define DMT_SECTOR_REVERB DDVT_FLOAT
Expand All @@ -75,6 +75,6 @@
#define DMT_LINEDEF_DY DDVT_FLOAT

#define DMT_BSPNODE_BBOX DDVT_FLOAT // Bounding box for each child.
#define DMT_BSPNODE_CHILDREN DDVT_UINT // If NF_SUBSECTOR it's a subsector.
#define DMT_BSPNODE_CHILDREN DDVT_UINT // If NF_LEAF it's a BspLeaf.

#endif
8 changes: 4 additions & 4 deletions doomsday/engine/api/dd_share.h
Expand Up @@ -277,7 +277,7 @@ enum {
DD_SIDE_COUNT,
DD_VERTEX_COUNT,
DD_HEDGE_COUNT,
DD_SUBSECTOR_COUNT,
DD_BSPLEAF_COUNT,
DD_BSPNODE_COUNT,
DD_POLYOBJ_COUNT,
DD_XGFUNC_LINK, ///< XG line classes
Expand Down Expand Up @@ -656,7 +656,7 @@ enum {
DMU_LINEDEF,
DMU_SIDEDEF,
DMU_BSPNODE,
DMU_SUBSECTOR,
DMU_BSPLEAF,
DMU_SECTOR,
DMU_PLANE,
DMU_SURFACE,
Expand Down Expand Up @@ -1029,7 +1029,7 @@ typedef struct aaboxf_s {
nodeindex_t lineRoot; /* lines to which this is linked */ \
struct mobj_s* sNext, **sPrev; /* links in sector (if needed) */ \
\
struct subsector_s* subsector; /* subsector in which this resides */ \
struct bspleaf_s* bspLeaf; /* bspLeaf in which this resides */ \
float mom[3]; \
angle_t angle; \
spritenum_t sprite; /* used to find patch_t and flip value */ \
Expand Down Expand Up @@ -1069,7 +1069,7 @@ typedef struct aaboxf_s {
#define DD_BASE_POLYOBJ_ELEMENTS() \
DD_BASE_DDMOBJ_ELEMENTS() \
\
struct subsector_s* subsector; /* subsector in which this resides */ \
struct bspleaf_s* bspLeaf; /* bspLeaf in which this resides */ \
unsigned int idx; /* Idx of polyobject. */ \
int tag; /* Reference tag. */ \
int validCount; \
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/api/dd_types.h
Expand Up @@ -209,7 +209,7 @@ struct vertex_s;
struct linedef_s;
struct side_s;
struct hedge_s;
struct subsector_s;
struct bspleaf_s;
struct sector_s;
struct polyblock_s;
struct polyobj_s;
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/api/doomsday.def
Expand Up @@ -449,12 +449,12 @@ EXPORTS
P_TraceLOS @829 NONAME
P_TraceOpening @828 NONAME
P_SetTraceOpening @64 NONAME
P_SubsectorAtPointXY @102 NONAME
P_BspLeafAtPointXY @102 NONAME
P_MobjsBoxIterator @346 NONAME
P_LinesBoxIterator @435 NONAME
P_AllLinesBoxIterator @347 NONAME
P_PolyobjsBoxIterator @348 NONAME
P_SubsectorsBoxIterator @345 NONAME
P_BspLeafsBoxIterator @345 NONAME
P_LineMobjsIterator @73 NONAME
P_SectorTouchingMobjsIterator @74 NONAME
P_PathTraverse @692 NONAME
Expand Down
8 changes: 4 additions & 4 deletions doomsday/engine/api/doomsday.h
Expand Up @@ -70,7 +70,7 @@ extern "C" {
typedef struct linedef_s { int type; } linedef_t;
typedef struct sidedef_s { int type; } sidedef_t;
typedef struct hedge_s { int type; } HEdge;
typedef struct subsector_s { int type; } subsector_t;
typedef struct bspleaf_s { int type; } BspLeaf;
typedef struct sector_s { int type; } sector_t;
typedef struct plane_s { int type; } plane_t;
typedef struct material_s { int type; } material_t;
Expand Down Expand Up @@ -427,7 +427,7 @@ boolean ClMobj_LocalActionsEnabled(struct mobj_s* mo);
TraceOpening* P_TraceOpening(void);
void P_SetTraceOpening(struct linedef_s* linedef);

struct subsector_s* P_SubsectorAtPointXY(float x, float y);
struct bspleaf_s* P_BspLeafAtPointXY(float x, float y);

// Object in bounding box iterators.
int P_MobjsBoxIterator(const AABoxf* box,
Expand All @@ -439,8 +439,8 @@ boolean ClMobj_LocalActionsEnabled(struct mobj_s* mo);
int P_AllLinesBoxIterator(const AABoxf* box,
int (*func) (struct linedef_s*, void*),
void* data);
int P_SubsectorsBoxIterator(const AABoxf* box, sector_t* sector,
int (*func) (subsector_t*, void*),
int P_BspLeafsBoxIterator(const AABoxf* box, sector_t* sector,
int (*func) (BspLeaf*, void*),
void* data);
int P_PolyobjsBoxIterator(const AABoxf* box,
int (*func) (struct polyobj_s*, void*),
Expand Down
6 changes: 3 additions & 3 deletions doomsday/engine/data/cphelp.txt
Expand Up @@ -637,7 +637,7 @@ desc = 1=Display lumobj debug display.
desc = 1=Display particle generator indices.

[rend-dev-blockmap]
desc = Enable drawing of the blockmap debug display: 1=Mobjs, 2=Linedefs, 3=Subsectors, 4=Polyobjs.
desc = Enable drawing of the blockmap debug display: 1=Mobjs, 2=Linedefs, 3=BspLeafs, 4=Polyobjs.

[rend-dev-blockmap-size]
desc = Scale multiplier for the blockmap debug display.
Expand Down Expand Up @@ -1071,8 +1071,8 @@ desc = Halo dimming relative end distance.
[rend-dev-freeze]
desc = 1=Stop updating rendering lists.

[rend-dev-cull-subsectors]
desc = 1=Disable non-visible subsector culling.
[rend-dev-cull-leafs]
desc = 1=Disable non-visible bsp leaf culling.

[rend-dev-mobj-bbox]
desc = 1=Render mobj bounding boxes (as used for collision detection).
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/include/bsp_edge.h
Expand Up @@ -78,7 +78,7 @@ typedef struct bsp_hedge_s {
int index;

// The superblock that contains this half-edge, or NULL if the half-edge
// is no longer in any superblock (e.g. now in a subsector).
// is no longer in any superblock (e.g. now in a leaf).
struct superblock_s* block;

// Precomputed data for faster calculations.
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/include/dam_main.h
Expand Up @@ -36,7 +36,7 @@ enum {
ML_SIDEDEFS, // SideDefs, from editing
ML_VERTEXES, // Vertices, edited and BSP splits generated
ML_SEGS, // LineSegs, from LineDefs split by BSP
ML_SSECTORS, // Subsectors, list of LineSegs
ML_SSECTORS, // Subsectors (BSP leafs), list of LineSegs
ML_NODES, // BSP nodes
ML_SECTORS, // Sectors, from editing
ML_REJECT, // LUT, sector-sector visibility
Expand Down
60 changes: 30 additions & 30 deletions doomsday/engine/portable/include/gamemap.h
Expand Up @@ -87,8 +87,8 @@ typedef struct gamemap_s {
uint numSectors;
sector_t* sectors;

uint numSubsectors;
subsector_t* subsectors;
uint numBspLeafs;
BspLeaf* bspLeafs;

uint numBspNodes;
BspNode* bspNodes;
Expand All @@ -112,7 +112,7 @@ typedef struct gamemap_s {
struct blockmap_s* mobjBlockmap;
struct blockmap_s* polyobjBlockmap;
struct blockmap_s* lineDefBlockmap;
struct blockmap_s* subsectorBlockmap;
struct blockmap_s* bspLeafBlockmap;

nodepile_t mobjNodes, lineNodes; // All kinds of wacky links.
nodeindex_t* lineLinks; // Indices to roots.
Expand Down Expand Up @@ -234,13 +234,13 @@ sidedef_t* GameMap_SideDef(GameMap* map, uint idx);
sector_t* GameMap_Sector(GameMap* map, uint idx);

/**
* Lookup a Subsector by its unique index.
* Lookup a BspLeaf by its unique index.
*
* @param map GameMap instance.
* @param idx Unique index of the subsector.
* @return Pointer to Subsector with this index else @c NULL if @a idx is not valid.
* @param idx Unique index of the bsp leaf.
* @return Pointer to BspLeaf with this index else @c NULL if @a idx is not valid.
*/
subsector_t* GameMap_Subsector(GameMap* map, uint idx);
BspLeaf* GameMap_BspLeaf(GameMap* map, uint idx);

/**
* Lookup a HEdge by its unique index.
Expand Down Expand Up @@ -297,13 +297,13 @@ int GameMap_SideDefIndex(GameMap* map, sidedef_t* side);
int GameMap_SectorIndex(GameMap* map, sector_t* sector);

/**
* Lookup the unique index for @a subsector.
* Lookup the unique index for @a bspLeaf.
*
* @param map GameMap instance.
* @param subsector Subsector to lookup.
* @return Unique index for the Subsector else @c -1 if not present.
* @param bspLeaf BspLeaf to lookup.
* @return Unique index for the BspLeaf else @c -1 if not present.
*/
int GameMap_SubsectorIndex(GameMap* map, subsector_t* subsector);
int GameMap_BspLeafIndex(GameMap* map, BspLeaf* bspLeaf);

/**
* Lookup the unique index for @a hedge.
Expand Down Expand Up @@ -356,12 +356,12 @@ uint GameMap_SideDefCount(GameMap* map);
uint GameMap_SectorCount(GameMap* map);

/**
* Retrieve the number of Subsector instances owned by this.
* Retrieve the number of BspLeaf instances owned by this.
*
* @param map GameMap instance.
* @return Number Subsector.
* @return Number BspLeaf.
*/
uint GameMap_SubsectorCount(GameMap* map);
uint GameMap_BspLeafCount(GameMap* map);

/**
* Retrieve the number of HEdge instances owned by this.
Expand Down Expand Up @@ -633,26 +633,26 @@ int GameMap_AllLineDefsBoxIterator(GameMap* map, const AABoxf* box,
int (*callback) (linedef_t*, void*), void* parameters);

/**
* Construct an initial (empty) Subsector Blockmap for this map.
* Construct an initial (empty) BspLeaf Blockmap for this map.
*
* @param min Minimal coordinates for the map.
* @param max Maximal coordinates for the map.
*/
void GameMap_InitSubsectorBlockmap(GameMap* map, const_pvec2_t min, const_pvec2_t max);
void GameMap_InitBspLeafBlockmap(GameMap* map, const_pvec2_t min, const_pvec2_t max);

void GameMap_LinkSubsectorInBlockmap(GameMap* map, subsector_t* subsector);
void GameMap_LinkBspLeafInBlockmap(GameMap* map, BspLeaf* bspLeaf);

int GameMap_IterateCellSubsectors(GameMap* map, const uint coords[2],
int GameMap_IterateCellBspLeafs(GameMap* map, const uint coords[2],
sector_t* sector, const AABoxf* box, int localValidCount,
int (*callback) (subsector_t*, void*), void* parameters);
int GameMap_IterateCellBlockSubsectors(GameMap* map, const struct gridmapblock_s* blockCoords,
int (*callback) (BspLeaf*, void*), void* parameters);
int GameMap_IterateCellBlockBspLeafs(GameMap* map, const struct gridmapblock_s* blockCoords,
sector_t* sector, const AABoxf* box, int localValidCount,
int (*callback) (subsector_t*, void*), void* parameters);
int (*callback) (BspLeaf*, void*), void* parameters);

int GameMap_SubsectorsBoxIterator(GameMap* map, const AABoxf* box, sector_t* sector,
int (*callback) (subsector_t*, void*), void* parameters);
int GameMap_BspLeafsBoxIterator(GameMap* map, const AABoxf* box, sector_t* sector,
int (*callback) (BspLeaf*, void*), void* parameters);

int GameMap_SubsectorIterator(GameMap* map, int (*callback) (subsector_t*, void*), void* parameters);
int GameMap_BspLeafIterator(GameMap* map, int (*callback) (BspLeaf*, void*), void* parameters);

/**
* Construct an initial (empty) Polyobj Blockmap for this map.
Expand Down Expand Up @@ -706,18 +706,18 @@ int GameMap_PathXYTraverse(GameMap* map, float fromX, float fromY, float toX, fl
int flags, traverser_t callback);

/**
* Determine the BSP leaf (subsector) on the back side of the BS partition that
* lies in front of the specified point within the map's coordinate space.
* Determine the BSP leaf on the back side of the BS partition that lies in front
* of the specified point within the map's coordinate space.
*
* @note Always returns a valid subsector although the point may not actually lay
* @note Always returns a valid BspLeaf although the point may not actually lay
* within it (however it is on the same side of the space partition)!
*
* @param map GameMap instance.
* @param x X coordinate of the point to test.
* @param y Y coordinate of the point to test.
* @return Subsector instance for that BSP node's leaf.
* @return BspLeaf instance for that BSP node's leaf.
*/
subsector_t* GameMap_SubsectorAtPoint(GameMap* map, float point[2]);
subsector_t* GameMap_SubsectorAtPointXY(GameMap* map, float x, float y);
BspLeaf* GameMap_BspLeafAtPoint(GameMap* map, float point[2]);
BspLeaf* GameMap_BspLeafAtPointXY(GameMap* map, float x, float y);

#endif /// LIBDENG_GAMEMAP_H
18 changes: 9 additions & 9 deletions doomsday/engine/portable/include/mapdata.hs
Expand Up @@ -90,7 +90,7 @@ struct seg
PTR vertex_s*[2] v // [Start, End] of the segment.
PTR linedef_s* lineDef
PTR sector_s*[2] sec
PTR subsector_s* subsector
PTR bspleaf_s* bspLeaf
PTR hedge_s* twin
ANGLE angle_t angle
BYTE byte side // 0=front, 1=back
Expand All @@ -102,10 +102,10 @@ struct seg
end

internal
#define SUBF_MIDPOINT 0x80 // Midpoint is tri-fan centre.
#define BLF_MIDPOINT 0x80 ///< Midpoint is tri-fan centre.
end

struct subsector
struct BspLeaf
UINT uint hedgeCount
PTR hedge_s** hedges // [hedgeCount] size.
PTR polyobj_s* polyObj // NULL, if there is no polyobj.
Expand Down Expand Up @@ -179,7 +179,7 @@ internal

typedef struct surfacedecor_s {
float pos[3]; // World coordinates of the decoration.
subsector_t* subsector;
BspLeaf* bspLeaf;
const struct ded_decorlight_s* def;
} surfacedecor_t;
end
Expand Down Expand Up @@ -318,10 +318,10 @@ struct sector
PTR mobj_s* mobjList // List of mobjs in the sector.
UINT uint lineDefCount
PTR linedef_s** lineDefs // [lineDefCount+1] size.
UINT uint subsectorCount
PTR subsector_s** subsectors // [subsectorCount+1] size.
- uint numReverbSubsectorAttributors
- subsector_s** reverbSubsectors // [numReverbSubsectorAttributors] size.
UINT uint bspLeafCount
PTR bspleaf_s** bspLeafs // [bspLeafCount+1] size.
- uint numReverbBspLeafAttributors
- bspleaf_s** reverbBspLeafs // [numReverbBspLeafAttributors] size.
PTR ddmobj_base_t soundOrg
UINT uint planeCount
- plane_s** planes // [planeCount+1] size.
Expand Down Expand Up @@ -513,5 +513,5 @@ end
struct BspNode
- partition_t partition
FLOAT float[2][4] bBox // Bounding box for each child.
UINT uint[2] children // If NF_SUBSECTOR it's a subsector.
UINT uint[2] children // If NF_LEAF it's a BspLeaf.
end

0 comments on commit 670854c

Please sign in to comment.