diff --git a/doomsday/client/include/map/linedef.h b/doomsday/client/include/map/linedef.h index 929185ed24..40def80c9d 100644 --- a/doomsday/client/include/map/linedef.h +++ b/doomsday/client/include/map/linedef.h @@ -113,11 +113,6 @@ class LineDef : public de::MapElement struct Side { public: /// @todo make private: - /// Sound emitters. - ddmobj_base_t _middleSoundEmitter; - ddmobj_base_t _bottomSoundEmitter; - ddmobj_base_t _topSoundEmitter; - /// Sector on this side. Sector *_sector; @@ -133,6 +128,28 @@ class LineDef : public de::MapElement /// Framecount of last time shadows were drawn on this side. int _shadowVisCount; + /// Sound emitters. + ddmobj_base_t _middleSoundEmitter; + ddmobj_base_t _bottomSoundEmitter; + ddmobj_base_t _topSoundEmitter; + +#ifdef __CLIENT__ + /// @todo Does not belong here - move to the map renderer. -ds + struct FakeRadioData + { + /// Frame number of last update + int updateCount; + + shadowcorner_t topCorners[2]; + shadowcorner_t bottomCorners[2]; + shadowcorner_t sideCorners[2]; + + /// [left, right] + edgespan_t spans[2]; + } _fakeRadioData; + +#endif // __CLIENT__ + public: Side(Sector *sector = 0); @@ -174,6 +191,28 @@ class LineDef : public de::MapElement */ inline SideDef *sideDefPtr() const { return hasSideDef()? &sideDef() : 0; } +#ifdef __CLIENT__ + + /** + * Returns the FakeRadio data for the side. + */ + FakeRadioData &fakeRadioData(); + + /// @copydoc fakeRadioData() + FakeRadioData const &fakeRadioData() const; + +#endif // __CLIENT__ + + /** + * Returns the left-most HEdge for the side. + */ + HEdge &leftHEdge() const; + + /** + * Returns the right-most HEdge for the side. + */ + HEdge &rightHEdge() const; + /** * Returns the sound emitter for the middle surface. */ @@ -219,22 +258,12 @@ class LineDef : public de::MapElement */ void updateTopSoundEmitterOrigin(); - /** - * Returns the left-most HEdge for the side. - */ - HEdge &leftHEdge() const; - - /** - * Returns the right-most HEdge for the side. - */ - HEdge &rightHEdge() const; - /** * Update the side's sound emitter origins according to the points defined by * the LineDef's vertices and the plane heights of the Sector on this side. * If no SideDef is associated this is a no-op. */ - void updateSoundEmitterOrigins(); + void updateAllSoundEmitterOrigins(); /** * Update the tangent space normals of the side's surfaces according to the diff --git a/doomsday/client/include/map/sidedef.h b/doomsday/client/include/map/sidedef.h index 79286e6eaf..238e079c8a 100644 --- a/doomsday/client/include/map/sidedef.h +++ b/doomsday/client/include/map/sidedef.h @@ -94,24 +94,6 @@ class SideDef : public de::MapElement int refCount; } _buildData; -#ifdef __CLIENT__ - - /// @todo Does not belong here - move to the map renderer. -ds - struct FakeRadioData - { - /// Frame number of last update - int updateCount; - - shadowcorner_t topCorners[2]; - shadowcorner_t bottomCorners[2]; - shadowcorner_t sideCorners[2]; - - /// [left, right] - edgespan_t spans[2]; - } _fakeRadioData; - -#endif // __CLIENT__ - public: SideDef(); ~SideDef(); @@ -160,18 +142,6 @@ class SideDef : public de::MapElement */ short flags() const; -#ifdef __CLIENT__ - - /** - * Returns the FakeRadio data for the sidedef. - */ - FakeRadioData &fakeRadioData(); - - /// @copydoc fakeRadioData() - FakeRadioData const &fakeRadioData() const; - -#endif // __CLIENT__ - /** * Get a property value, selected by DMU_* name. * diff --git a/doomsday/client/src/map/gamemap.cpp b/doomsday/client/src/map/gamemap.cpp index 3b357e4562..23deb5699e 100644 --- a/doomsday/client/src/map/gamemap.cpp +++ b/doomsday/client/src/map/gamemap.cpp @@ -165,7 +165,7 @@ DENG2_PIMPL(GameMap) for(int i = 0; i < 2; ++i) { line->side(i).updateSurfaceNormals(); - line->side(i).updateSoundEmitterOrigins(); + line->side(i).updateAllSoundEmitterOrigins(); } } diff --git a/doomsday/client/src/map/linedef.cpp b/doomsday/client/src/map/linedef.cpp index c5a60ac1ce..ae61d848c6 100644 --- a/doomsday/client/src/map/linedef.cpp +++ b/doomsday/client/src/map/linedef.cpp @@ -52,6 +52,14 @@ LineDef::Side::Side(Sector *sector) std::memset(&_middleSoundEmitter, 0, sizeof(_middleSoundEmitter)); std::memset(&_bottomSoundEmitter, 0, sizeof(_bottomSoundEmitter)); std::memset(&_topSoundEmitter, 0, sizeof(_topSoundEmitter)); + +#ifdef __CLIENT__ + _fakeRadioData.updateCount = 0; + std::memset(_fakeRadioData.topCorners, 0, sizeof(_fakeRadioData.topCorners)); + std::memset(_fakeRadioData.bottomCorners, 0, sizeof(_fakeRadioData.bottomCorners)); + std::memset(_fakeRadioData.sideCorners, 0, sizeof(_fakeRadioData.sideCorners)); + std::memset(_fakeRadioData.spans, 0, sizeof(_fakeRadioData.spans)); +#endif } bool LineDef::Side::hasSector() const @@ -84,6 +92,18 @@ SideDef &LineDef::Side::sideDef() const throw LineDef::MissingSideDefError("LineDef::Side::sideDef", "No sidedef is configured"); } +HEdge &LineDef::Side::leftHEdge() const +{ + DENG_ASSERT(_leftHEdge != 0); + return *_leftHEdge; +} + +HEdge &LineDef::Side::rightHEdge() const +{ + DENG_ASSERT(_rightHEdge != 0); + return *_rightHEdge; +} + ddmobj_base_t &LineDef::Side::middleSoundEmitter() { return _middleSoundEmitter; @@ -91,7 +111,7 @@ ddmobj_base_t &LineDef::Side::middleSoundEmitter() ddmobj_base_t const &LineDef::Side::middleSoundEmitter() const { - return const_cast(const_cast(*this).middleSoundEmitter()); + return const_cast(const_cast(*this).middleSoundEmitter()); } void LineDef::Side::updateMiddleSoundEmitterOrigin() @@ -123,7 +143,7 @@ ddmobj_base_t &LineDef::Side::bottomSoundEmitter() ddmobj_base_t const &LineDef::Side::bottomSoundEmitter() const { - return const_cast(const_cast(*this).bottomSoundEmitter()); + return const_cast(const_cast(*this).bottomSoundEmitter()); } void LineDef::Side::updateBottomSoundEmitterOrigin() @@ -159,7 +179,7 @@ ddmobj_base_t &LineDef::Side::topSoundEmitter() ddmobj_base_t const &LineDef::Side::topSoundEmitter() const { - return const_cast(const_cast(*this).topSoundEmitter()); + return const_cast(const_cast(*this).topSoundEmitter()); } void LineDef::Side::updateTopSoundEmitterOrigin() @@ -188,24 +208,7 @@ void LineDef::Side::updateTopSoundEmitterOrigin() } } -HEdge &LineDef::Side::leftHEdge() const -{ - DENG_ASSERT(_leftHEdge != 0); - return *_leftHEdge; -} - -HEdge &LineDef::Side::rightHEdge() const -{ - DENG_ASSERT(_rightHEdge != 0); - return *_rightHEdge; -} - -int LineDef::Side::shadowVisCount() const -{ - return _shadowVisCount; -} - -void LineDef::Side::updateSoundEmitterOrigins() +void LineDef::Side::updateAllSoundEmitterOrigins() { if(!_sideDef) return; @@ -235,6 +238,25 @@ void LineDef::Side::updateSurfaceNormals() topSurface.setNormal(normal); } +#ifdef __CLIENT__ + +LineDef::Side::FakeRadioData &LineDef::Side::fakeRadioData() +{ + return _fakeRadioData; +} + +LineDef::Side::FakeRadioData const &LineDef::Side::fakeRadioData() const +{ + return const_cast(const_cast(this)->fakeRadioData()); +} + +#endif // __CLIENT__ + +int LineDef::Side::shadowVisCount() const +{ + return _shadowVisCount; +} + DENG2_PIMPL(LineDef) { /// Vertexes: diff --git a/doomsday/client/src/map/p_dmu.cpp b/doomsday/client/src/map/p_dmu.cpp index 825704e75f..1372f24797 100644 --- a/doomsday/client/src/map/p_dmu.cpp +++ b/doomsday/client/src/map/p_dmu.cpp @@ -1405,7 +1405,6 @@ static int getProperty(void *ptr, void *context) case DMU_ALPHA: case DMU_BLENDMODE: case DMU_FLAGS: - case DMU_BASE: elem = &elem->castTo()->surface(); args->type = DMU_SURFACE; DENG2_ASSERT(elem->type() == args->type); diff --git a/doomsday/client/src/map/sector.cpp b/doomsday/client/src/map/sector.cpp index 3188131d32..2fd51b1970 100644 --- a/doomsday/client/src/map/sector.cpp +++ b/doomsday/client/src/map/sector.cpp @@ -396,8 +396,8 @@ void Sector::planeHeightChanged(Plane &plane, coord_t oldHeight) // Update the sound emitter origins for all dependent wall surfaces. foreach(LineDef *line, d->lines) { - line->front().updateSoundEmitterOrigins(); - line->back().updateSoundEmitterOrigins(); + line->front().updateAllSoundEmitterOrigins(); + line->back().updateAllSoundEmitterOrigins(); } #ifdef __CLIENT__ diff --git a/doomsday/client/src/map/sidedef.cpp b/doomsday/client/src/map/sidedef.cpp index 0d30bd3df6..256f95e68a 100644 --- a/doomsday/client/src/map/sidedef.cpp +++ b/doomsday/client/src/map/sidedef.cpp @@ -35,14 +35,6 @@ SideDef::SideDef() _line = 0; _flags = 0; std::memset(&_buildData, 0, sizeof(_buildData)); - -#ifdef __CLIENT__ - _fakeRadioData.updateCount = 0; - std::memset(_fakeRadioData.topCorners, 0, sizeof(_fakeRadioData.topCorners)); - std::memset(_fakeRadioData.bottomCorners, 0, sizeof(_fakeRadioData.bottomCorners)); - std::memset(_fakeRadioData.sideCorners, 0, sizeof(_fakeRadioData.sideCorners)); - std::memset(_fakeRadioData.spans, 0, sizeof(_fakeRadioData.spans)); -#endif } SideDef::~SideDef() @@ -76,20 +68,6 @@ short SideDef::flags() const return _flags; } -#ifdef __CLIENT__ - -SideDef::FakeRadioData &SideDef::fakeRadioData() -{ - return _fakeRadioData; -} - -SideDef::FakeRadioData const &SideDef::fakeRadioData() const -{ - return const_cast(const_cast(this)->fakeRadioData()); -} - -#endif // __CLIENT__ - int SideDef::property(setargs_t &args) const { switch(args.prop) diff --git a/doomsday/client/src/render/rend_fakeradio.cpp b/doomsday/client/src/render/rend_fakeradio.cpp index b4257587b0..fcf00d60b4 100644 --- a/doomsday/client/src/render/rend_fakeradio.cpp +++ b/doomsday/client/src/render/rend_fakeradio.cpp @@ -86,7 +86,7 @@ void Rend_RadioUpdateLine(LineDef &line, int backSide) if(!line.hasSector(backSide)) return; // Have already determined the shadow properties on this side? - SideDef::FakeRadioData &frData = line.sideDef(backSide).fakeRadioData(); + LineDef::Side::FakeRadioData &frData = line.side(backSide).fakeRadioData(); if(frData.updateCount == frameCount) return; // Not yet - Calculate now. diff --git a/doomsday/client/src/render/rend_main.cpp b/doomsday/client/src/render/rend_main.cpp index 9e89deaef6..9f2a434027 100644 --- a/doomsday/client/src/render/rend_main.cpp +++ b/doomsday/client/src/render/rend_main.cpp @@ -1222,7 +1222,6 @@ static boolean doRenderHEdge(HEdge *hedge, Vector3f const &normal, MaterialSnapshot const &ms, boolean isTwosidedMiddle) { - SideDef *sideDef = hedge->hasLine()? hedge->lineSide().sideDefPtr() : 0; rvertex_t *rvertices; // Init the params. @@ -1298,7 +1297,7 @@ static boolean doRenderHEdge(HEdge *hedge, Vector3f const &normal, radioParams.line = hedge->linePtr(); - SideDef::FakeRadioData &frData = sideDef->fakeRadioData(); + LineDef::Side::FakeRadioData &frData = hedge->lineSide().fakeRadioData(); radioParams.botCn = frData.bottomCorners; radioParams.topCn = frData.topCorners; radioParams.sideCn = frData.sideCorners;