diff --git a/doomsday/engine/api/dd_share.h b/doomsday/engine/api/dd_share.h index d415ecb029..e9fea13e96 100644 --- a/doomsday/engine/api/dd_share.h +++ b/doomsday/engine/api/dd_share.h @@ -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]; diff --git a/doomsday/engine/portable/include/mapdata.hs b/doomsday/engine/portable/include/mapdata.hs index 2fb3e0f416..6f6f2e113e 100644 --- a/doomsday/engine/portable/include/mapdata.hs +++ b/doomsday/engine/portable/include/mapdata.hs @@ -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 diff --git a/doomsday/engine/portable/include/p_maptypes.h b/doomsday/engine/portable/include/p_maptypes.h index 1cc715ae28..1a14d240a7 100644 --- a/doomsday/engine/portable/include/p_maptypes.h +++ b/doomsday/engine/portable/include/p_maptypes.h @@ -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 diff --git a/doomsday/engine/portable/include/r_world.h b/doomsday/engine/portable/include/r_world.h index 324d8bb12c..3f39ca2ad2 100644 --- a/doomsday/engine/portable/include/r_world.h +++ b/doomsday/engine/portable/include/r_world.h @@ -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, diff --git a/doomsday/engine/portable/src/dam_file.c b/doomsday/engine/portable/src/dam_file.c index 8ad0775ba2..cc1c3f923c 100644 --- a/doomsday/engine/portable/src/dam_file.c +++ b/doomsday/engine/portable/src/dam_file.c @@ -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)); @@ -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())); diff --git a/doomsday/engine/portable/src/r_world.c b/doomsday/engine/portable/src/r_world.c index 569c270238..2d4ca174b4 100644 --- a/doomsday/engine/portable/src/r_world.c +++ b/doomsday/engine/portable/src/r_world.c @@ -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; @@ -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. diff --git a/doomsday/engine/portable/src/rend_decor.c b/doomsday/engine/portable/src/rend_decor.c index 1e0ac9d379..3a3ddbd2ff 100644 --- a/doomsday/engine/portable/src/rend_decor.c +++ b/doomsday/engine/portable/src/rend_decor.c @@ -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 ---------------------------------------------- @@ -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; diff --git a/doomsday/engine/portable/src/rend_main.c b/doomsday/engine/portable/src/rend_main.c index c5d630becf..f48374fb5a 100644 --- a/doomsday/engine/portable/src/rend_main.c +++ b/doomsday/engine/portable/src/rend_main.c @@ -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) { @@ -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) @@ -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,