Skip to content

Commit

Permalink
Refactor: Renamed sidedefsection_t as SideDefSection and moved to pub…
Browse files Browse the repository at this point in the history
…lic API

Note that the indices of the sections have also been changed to match
those used by the games when serializing material change thinkers to
saved games. The order of which does not matter as far as the engine
is concerned.

Also added an API helper macro for converting a SideDefSection to the
equivalent DMU property modifier flag.
  • Loading branch information
danij-deng committed Apr 22, 2012
1 parent f435a13 commit b4c8a74
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 25 deletions.
12 changes: 12 additions & 0 deletions doomsday/engine/api/dd_share.h
Expand Up @@ -804,6 +804,18 @@ enum {
NUM_REVERB_DATA
};

/// SideDef section indices. @ingroup map
typedef enum sidedefsection_e {
SS_MIDDLE,
SS_BOTTOM,
SS_TOP
} SideDefSection;

/// Helper macro for converting SideDefSection indices to their associated DMU flag. @ingroup map
#define DMU_FLAG_FOR_SIDEDEFSECTION(s) (\
(s) == SS_MIDDLE? DMU_MIDDLE_OF_SIDEDEF : \
(s) == SS_BOTTOM? DMU_BOTTOM_OF_SIDEDEF : DMU_TOP_OF_SIDEDEF)

typedef struct {
fixed_t origin[2];
fixed_t direction[2];
Expand Down
7 changes: 0 additions & 7 deletions doomsday/engine/portable/include/mapdata.hs
Expand Up @@ -313,13 +313,6 @@ struct Sector
end

internal
// Sections of a sidedef
typedef enum sidedefsection_e {
SS_MIDDLE,
SS_TOP,
SS_BOTTOM
} sidedefsection_t;

// Helper macros for accessing sidedef top/middle/bottom section data elements.
#define SW_surface(n) sections[(n)]
#define SW_surfaceflags(n) SW_surface(n).flags
Expand Down
7 changes: 0 additions & 7 deletions doomsday/engine/portable/include/p_maptypes.h
Expand Up @@ -296,13 +296,6 @@ typedef struct sector_s {
msector_t buildData;
} Sector;

// Sidedef sections.
typedef enum sidedefsection_e {
SS_MIDDLE,
SS_TOP,
SS_BOTTOM
} sidedefsection_t;

// Helper macros for accessing sidedef top/middle/bottom section data elements.
#define SW_surface(n) sections[(n)]
#define SW_surfaceflags(n) SW_surface(n).flags
Expand Down
2 changes: 1 addition & 1 deletion doomsday/engine/portable/include/r_world.h
Expand Up @@ -87,7 +87,7 @@ void R_MapInitSurfaceLists(void);

void R_OrderVertices(const LineDef* line, const Sector* sector,
Vertex* verts[2]);
boolean R_FindBottomTop(LineDef* lineDef, int side, sidedefsection_t section,
boolean R_FindBottomTop(LineDef* lineDef, int side, SideDefSection section,
coord_t matOffsetX, coord_t matOffsetY,
const Plane* ffloor, const Plane* fceil,
const Plane* bfloor, const Plane* bceil,
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/portable/src/dam_file.c
Expand Up @@ -329,7 +329,7 @@ static void writeSide(GameMap* map, uint idx)

for(i = 0; i < 3; ++i)
{
Surface* suf = &s->sections[3];
Surface* suf = &s->sections[i];

writeLong(suf->flags);
//writeLong(getMaterialDictID(materialDict, suf->material));
Expand Down Expand Up @@ -359,7 +359,7 @@ static void readSide(GameMap* map, uint idx)

for(i = 0; i < 3; ++i)
{
Surface* suf = &s->sections[3];
Surface* suf = &s->sections[i];

suf->flags = (int) readLong();
//Surface_SetMaterial(suf, lookupMaterialFromDict(materialDict, readLong()));
Expand Down
6 changes: 3 additions & 3 deletions doomsday/engine/portable/src/r_world.c
Expand Up @@ -1427,7 +1427,7 @@ boolean R_SectorContainsSkySurfaces(const Sector* sec)
* Non-animated materials are preferred.
* Sky materials are ignored.
*/
static material_t* chooseFixMaterial(SideDef* s, sidedefsection_t section)
static material_t* chooseFixMaterial(SideDef* s, SideDefSection section)
{
material_t* choice1 = NULL, *choice2 = NULL;

Expand Down Expand Up @@ -1462,9 +1462,9 @@ static material_t* chooseFixMaterial(SideDef* s, sidedefsection_t section)
return NULL;
}

static void updateSidedefSection(SideDef* s, sidedefsection_t section)
static void updateSidedefSection(SideDef* s, SideDefSection section)
{
Surface* suf;
Surface* suf;

if(section == SS_MIDDLE)
return; // Not applicable.
Expand Down
4 changes: 2 additions & 2 deletions doomsday/engine/portable/src/rend_decor.c
Expand Up @@ -72,7 +72,7 @@ typedef struct decorsource_s {

// PRIVATE FUNCTION PROTOTYPES ---------------------------------------------

static void updateSideSectionDecorations(SideDef* side, sidedefsection_t section);
static void updateSideSectionDecorations(SideDef* side, SideDefSection section);
static void updatePlaneDecorations(Plane* pln);

// EXTERNAL DATA DECLARATIONS ----------------------------------------------
Expand Down Expand Up @@ -560,7 +560,7 @@ static void updatePlaneDecorations(Plane* pln)
updateSurfaceDecorations2(suf, offsetS, offsetT, v1, v2, sec, suf->material? true : false);
}

static void updateSideSectionDecorations(SideDef* side, sidedefsection_t section)
static void updateSideSectionDecorations(SideDef* side, SideDefSection section)
{
LineDef* line;
Surface* suf;
Expand Down
6 changes: 3 additions & 3 deletions doomsday/engine/portable/src/rend_main.c
Expand Up @@ -596,7 +596,7 @@ static void applyWallHeightDivision(walldiv_t* divs, const HEdge* hedge,
}

static void selectSurfaceColors(const float** topColor,
const float** bottomColor, SideDef* side, sidedefsection_t section)
const float** bottomColor, SideDef* side, SideDefSection section)
{
switch(section)
{
Expand Down Expand Up @@ -1735,7 +1735,7 @@ static void Rend_RenderPlane(BspLeaf* bspLeaf, planetype_t type, coord_t height,
}
}

static boolean rendHEdgeSection(HEdge* hedge, BspLeaf* bspLeaf, sidedefsection_t section,
static boolean rendHEdgeSection(HEdge* hedge, BspLeaf* bspLeaf, SideDefSection section,
Surface* surface, coord_t const from[2], coord_t const to[2], coord_t bottom, coord_t top,
float const texOffset[2], Sector* frontsec, boolean softSurface, boolean addDLights,
boolean addMobjShadows, short sideFlags)
Expand Down Expand Up @@ -2009,7 +2009,7 @@ static boolean Rend_RenderHEdge(HEdge* hedge, BspLeaf* bspLeaf)
return solid;
}

boolean R_FindBottomTop(LineDef* lineDef, int side, sidedefsection_t section,
boolean R_FindBottomTop(LineDef* lineDef, int side, SideDefSection section,
coord_t matOffsetX, coord_t matOffsetY,
const Plane* ffloor, const Plane* fceil,
const Plane* bfloor, const Plane* bceil,
Expand Down

0 comments on commit b4c8a74

Please sign in to comment.