diff --git a/doomsday/client/include/world/bspleaf.h b/doomsday/client/include/world/bspleaf.h index 21e9e15257..9f1df5dfec 100644 --- a/doomsday/client/include/world/bspleaf.h +++ b/doomsday/client/include/world/bspleaf.h @@ -181,6 +181,8 @@ class BspLeaf : public de::MapElement */ void setSector(Sector *newSector); +#ifdef __CLIENT__ + /** * Determines whether the BSP leaf has a positive world volume. For this * to be true the following criteria must be met: @@ -195,6 +197,8 @@ class BspLeaf : public de::MapElement */ bool hasWorldVolume(bool useVisualHeights = true) const; +#endif // __CLIENT__ + /** * Returns @c true iff at least one polyobj is linked to the BSP leaf. */ diff --git a/doomsday/client/include/world/map.h b/doomsday/client/include/world/map.h index 422d210339..6bcbbc617d 100644 --- a/doomsday/client/include/world/map.h +++ b/doomsday/client/include/world/map.h @@ -99,8 +99,10 @@ class Map typedef QList BspLeafs; typedef QList Segments; +#ifdef __CLIENT__ typedef QSet PlaneSet; typedef QSet SurfaceSet; +#endif public: /// @todo make private: Uri _uri; @@ -406,20 +408,6 @@ class Map return pathTraverse(from, to, flags, callback, parameters); } - coord_t skyFix(bool ceiling) const; - - inline coord_t skyFixFloor() const { return skyFix(false /*the floor*/); } - inline coord_t skyFixCeiling() const { return skyFix(true /*the ceiling*/); } - - void setSkyFix(bool ceiling, coord_t newHeight); - - inline void setSkyFixFloor(coord_t newHeight) { - setSkyFix(false /*the floor*/, newHeight); - } - inline void setSkyFixCeiling(coord_t newHeight) { - setSkyFix(true /*the ceiling*/, newHeight); - } - /** * Link the specified @a bspLeaf in internal data structures for * bookkeeping purposes. @@ -479,6 +467,20 @@ class Map EntityDatabase &entityDatabase() const; #ifdef __CLIENT__ + coord_t skyFix(bool ceiling) const; + + inline coord_t skyFixFloor() const { return skyFix(false /*the floor*/); } + inline coord_t skyFixCeiling() const { return skyFix(true /*the ceiling*/); } + + void setSkyFix(bool ceiling, coord_t newHeight); + + inline void setSkyFixFloor(coord_t newHeight) { + setSkyFix(false /*the floor*/, newHeight); + } + inline void setSkyFixCeiling(coord_t newHeight) { + setSkyFix(true /*the ceiling*/, newHeight); + } + /** * Retrieve a pointer to the Generators collection for the map. If no collection * has yet been constructed a new empty collection will be initialized. @@ -560,8 +562,6 @@ class Map */ SurfaceSet /*const*/ &glowingSurfaces(); -#endif // __CLIENT__ - /** * $smoothmatoffset: interpolate the visual offset. */ @@ -592,6 +592,8 @@ class Map */ PlaneSet /*const*/ &trackedPlanes(); +#endif // __CLIENT__ + /** * Helper function for returning the relevant line side index for @a lineIndex * and @a backSide. @@ -692,6 +694,7 @@ class Map */ void initPolyobjs(); +#ifdef __CLIENT__ /** * Fixing the sky means that for adjacent sky sectors the lower sky * ceiling is lifted to match the upper sky. The raising only affects @@ -699,7 +702,6 @@ class Map */ void initSkyFix(); -#ifdef __CLIENT__ void buildSurfaceLists(); /** diff --git a/doomsday/client/include/world/plane.h b/doomsday/client/include/world/plane.h index 2546f3af73..5bd6dee45c 100644 --- a/doomsday/client/include/world/plane.h +++ b/doomsday/client/include/world/plane.h @@ -146,6 +146,8 @@ class Plane : public de::MapElement */ coord_t speed() const; +#ifdef __CLIENT__ + /** * Returns the current interpolated visual height of the plane in the map * coordinate space. @@ -183,6 +185,8 @@ class Plane : public de::MapElement */ void updateHeightTracking(); +#endif // __CLIENT__ + /** * Change the normal of the plane to @a newNormal (which if necessary will * be normalized before being assigned to the plane). diff --git a/doomsday/client/include/world/r_world.h b/doomsday/client/include/world/r_world.h index 030dbb93e0..3d04e32e19 100644 --- a/doomsday/client/include/world/r_world.h +++ b/doomsday/client/include/world/r_world.h @@ -1,4 +1,4 @@ -/** @file world/r_world.h World Setup. +/** @file world/r_world.h World map utilities. * * @authors Copyright © 2003-2013 Jaakko Keränen * @authors Copyright © 2006-2013 Daniel Swanson @@ -31,6 +31,8 @@ void R_SetRelativeHeights(Sector const *front, Sector const *back, int planeIndex, coord_t *fz = 0, coord_t *bz = 0, coord_t *bhz = 0); +#ifdef __CLIENT__ + /** * Determine the map space Z coordinates of a wall section. * @@ -45,6 +47,8 @@ void R_SetRelativeHeights(Sector const *front, Sector const *back, int planeInde void R_SideSectionCoords(Line::Side const &side, int section, bool skyClip = true, coord_t *bottom = 0, coord_t *top = 0, de::Vector2f *materialOrigin = 0); +#endif // __CLIENT__ + /** * Find the "sharp" Z coordinate range of the opening between sectors @a frontSec * and @a backSec. The open range is defined as the gap between foor and ceiling on @@ -72,6 +76,8 @@ inline coord_t R_OpenRange(Line::Side const &side, coord_t *bottom = 0, coord_t return R_OpenRange(side, side.sectorPtr(), side.back().sectorPtr(), bottom, top); } +#ifdef __CLIENT__ + /** * Same as @ref R_OpenRange() but works with the "visual" (i.e., smoothed) plane * height coordinates rather than the "sharp" coordinates. @@ -98,8 +104,6 @@ inline coord_t R_VisOpenRange(Line::Side const &side, coord_t *bottom = 0, coord return R_VisOpenRange(side, side.sectorPtr(), side.back().sectorPtr(), bottom, top); } -#ifdef __CLIENT__ - /** * @param side Line::Side instance. * @param ignoreOpacity @c true= do not consider Material opacity. diff --git a/doomsday/client/src/render/r_main.cpp b/doomsday/client/src/render/r_main.cpp index 6c098445eb..160d195b85 100644 --- a/doomsday/client/src/render/r_main.cpp +++ b/doomsday/client/src/render/r_main.cpp @@ -784,11 +784,13 @@ void R_NewSharpWorld() R_CheckViewerLimits(vd->lastSharp, &sharpView); } +#ifdef __CLIENT__ if(App_World().hasMap()) { App_World().map().updateTrackedPlanes(); App_World().map().updateScrollingSurfaces(); } +#endif } void R_CreateMobjLinks() diff --git a/doomsday/client/src/render/r_things.cpp b/doomsday/client/src/render/r_things.cpp index 326b5c1b82..423a5316cb 100644 --- a/doomsday/client/src/render/r_things.cpp +++ b/doomsday/client/src/render/r_things.cpp @@ -774,6 +774,8 @@ float R_MovementXYZPitch(float momx, float momy, float momz) return R_MovementPitch(mom); } +#ifdef __CLIENT__ + typedef struct { vissprite_t *vis; mobj_t const *mo; @@ -804,8 +806,6 @@ int RIT_VisMobjZ(Sector *sector, void *parameters) return false; // Continue iteration. } -#ifdef __CLIENT__ - static void setupSpriteParamsForVisSprite(rendspriteparams_t *params, float x, float y, float z, float distance, float visOffX, float visOffY, float visOffZ, float /*secFloor*/, float /*secCeil*/, float /*floorClip*/, float /*top*/, diff --git a/doomsday/client/src/world/bspleaf.cpp b/doomsday/client/src/world/bspleaf.cpp index 608f0459b9..a4e3f95e7b 100644 --- a/doomsday/client/src/world/bspleaf.cpp +++ b/doomsday/client/src/world/bspleaf.cpp @@ -413,17 +413,6 @@ void BspLeaf::setSector(Sector *newSector) d->sector = newSector; } -bool BspLeaf::hasWorldVolume(bool useVisualHeights) const -{ - if(isDegenerate()) return false; - if(!hasSector()) return false; - - coord_t const floorHeight = useVisualHeights? d->sector->floor().visHeight() : d->sector->floor().height(); - coord_t const ceilHeight = useVisualHeights? d->sector->ceiling().visHeight() : d->sector->ceiling().height(); - - return (ceilHeight - floorHeight > 0); -} - Polyobj *BspLeaf::firstPolyobj() const { return d->polyobj; @@ -446,6 +435,17 @@ void BspLeaf::setValidCount(int newValidCount) #ifdef __CLIENT__ +bool BspLeaf::hasWorldVolume(bool useVisualHeights) const +{ + if(isDegenerate()) return false; + if(!hasSector()) return false; + + coord_t const floorHeight = useVisualHeights? d->sector->floor().visHeight() : d->sector->floor().height(); + coord_t const ceilHeight = useVisualHeights? d->sector->ceiling().visHeight() : d->sector->ceiling().height(); + + return (ceilHeight - floorHeight > 0); +} + HEdge *BspLeaf::fanBase() const { if(d->needUpdateFanBase) diff --git a/doomsday/client/src/world/map.cpp b/doomsday/client/src/world/map.cpp index 2dc578e811..85b91be33f 100644 --- a/doomsday/client/src/world/map.cpp +++ b/doomsday/client/src/world/map.cpp @@ -114,18 +114,19 @@ DENG2_PIMPL(Map) QScopedPointer lineBlockmap; QScopedPointer bspLeafBlockmap; +#ifdef __CLIENT__ PlaneSet trackedPlanes; SurfaceSet scrollingSurfaces; -#ifdef __CLIENT__ + SurfaceSet decoratedSurfaces; SurfaceSet glowingSurfaces; QScopedPointer generators; QScopedPointer lightGrid; -#endif coord_t skyFloorHeight; coord_t skyCeilingHeight; +#endif // Current LOS trace state. /// @todo Does not belong here. @@ -135,9 +136,11 @@ DENG2_PIMPL(Map) Instance(Public *i) : Base (i), editingEnabled (true), - bspRoot (0), - skyFloorHeight (DDMAXFLOAT), + bspRoot (0) +#ifdef __CLIENT__ + , skyFloorHeight(DDMAXFLOAT), skyCeilingHeight(DDMINFLOAT) +#endif { zap(traceOpening); zap(traceLine); @@ -515,8 +518,6 @@ DENG2_PIMPL(Map) } } -#endif // __CLIENT__ - void updateMapSkyFixForSector(Sector const §or) { if(!sector.sideCount()) return; @@ -586,6 +587,8 @@ DENG2_PIMPL(Map) } } +#endif // __CLIENT__ + /** * Locate a polyobj in the map by sound emitter. * @@ -884,35 +887,6 @@ int Map::ambientLightLevel() const return _ambientLightLevel; } -void Map::initSkyFix() -{ - Time begunAt; - - LOG_AS("Map::initSkyFix"); - - d->skyFloorHeight = DDMAXFLOAT; - d->skyCeilingHeight = DDMINFLOAT; - - // Update for sector plane heights and mobjs which intersect the ceiling. - foreach(Sector *sector, d->sectors) - { - d->updateMapSkyFixForSector(*sector); - } - - LOG_INFO(String("Completed in %1 seconds.").arg(begunAt.since(), 0, 'g', 2)); -} - -coord_t Map::skyFix(bool ceiling) const -{ - return ceiling? d->skyCeilingHeight : d->skyFloorHeight; -} - -void Map::setSkyFix(bool ceiling, coord_t newHeight) -{ - if(ceiling) d->skyCeilingHeight = newHeight; - else d->skyFloorHeight = newHeight; -} - int Map::toSideIndex(int lineIndex, int backSide) // static { DENG_ASSERT(lineIndex >= 0); @@ -1735,6 +1709,23 @@ BspLeaf *Map::bspLeafAtPoint_FixedPrecision(Vector2d const &point) const return bspElement->castTo(); } +void Map::updateSurfacesOnMaterialChange(Material &material) +{ + if(ddMapSetup) return; + +#ifdef __CLIENT__ + foreach(Surface *surface, d->decoratedSurfaces) + { + if(&material == surface->materialPtr()) + { + surface->markAsNeedingDecorationUpdate(); + } + } +#endif +} + +#ifdef __CLIENT__ + void Map::lerpScrollingSurfaces(bool resetNextViewer) { if(resetNextViewer) @@ -1829,22 +1820,34 @@ Map::PlaneSet &Map::trackedPlanes() return d->trackedPlanes; } -void Map::updateSurfacesOnMaterialChange(Material &material) +void Map::initSkyFix() { - if(ddMapSetup) return; + Time begunAt; -#ifdef __CLIENT__ - foreach(Surface *surface, d->decoratedSurfaces) + LOG_AS("Map::initSkyFix"); + + d->skyFloorHeight = DDMAXFLOAT; + d->skyCeilingHeight = DDMINFLOAT; + + // Update for sector plane heights and mobjs which intersect the ceiling. + foreach(Sector *sector, d->sectors) { - if(&material == surface->materialPtr()) - { - surface->markAsNeedingDecorationUpdate(); - } + d->updateMapSkyFixForSector(*sector); } -#endif + + LOG_INFO(String("Completed in %1 seconds.").arg(begunAt.since(), 0, 'g', 2)); } -#ifdef __CLIENT__ +coord_t Map::skyFix(bool ceiling) const +{ + return ceiling? d->skyCeilingHeight : d->skyFloorHeight; +} + +void Map::setSkyFix(bool ceiling, coord_t newHeight) +{ + if(ceiling) d->skyCeilingHeight = newHeight; + else d->skyFloorHeight = newHeight; +} Generators &Map::generators() { diff --git a/doomsday/client/src/world/p_maputil.cpp b/doomsday/client/src/world/p_maputil.cpp index 11a5aaa346..76df29943f 100644 --- a/doomsday/client/src/world/p_maputil.cpp +++ b/doomsday/client/src/world/p_maputil.cpp @@ -339,10 +339,19 @@ DENG_EXTERN_C void P_MobjLink(mobj_t *mo, byte flags) Sector §or = player->mo->bspLeaf->sector(); player->inVoid = true; - if(P_IsPointInSector(player->mo->origin, sector) && - (player->mo->origin[VZ] < sector.ceiling().visHeight() + 4 && - player->mo->origin[VZ] >= sector.floor().visHeight())) - player->inVoid = false; + if(P_IsPointInSector(player->mo->origin, sector)) + { +#ifdef __CLIENT__ + if(player->mo->origin[VZ] < sector.ceiling().visHeight() + 4 && + player->mo->origin[VZ] >= sector.floor().visHeight()) +#else + if(player->mo->origin[VZ] < sector.ceiling().height() + 4 && + player->mo->origin[VZ] >= sector.floor().height()) +#endif + { + player->inVoid = false; + } + } } } diff --git a/doomsday/client/src/world/p_players.cpp b/doomsday/client/src/world/p_players.cpp index ce4e896b9d..d11016b4d7 100644 --- a/doomsday/client/src/world/p_players.cpp +++ b/doomsday/client/src/world/p_players.cpp @@ -124,6 +124,7 @@ boolean P_IsInVoid(player_t *player) { Sector &sec = ddpl->mo->bspLeaf->sector(); +#ifdef __CLIENT__ if(sec.ceilingSurface().hasSkyMaskedMaterial()) { coord_t const skyCeil = App_World().map().skyFixCeiling(); @@ -131,10 +132,14 @@ boolean P_IsInVoid(player_t *player) return true; } else if(ddpl->mo->origin[VZ] > sec.ceiling().visHeight() - 4) +#else + if(ddpl->mo->origin[VZ] > sec.ceiling().height() - 4) +#endif { return true; } +#ifdef __CLIENT__ if(sec.floorSurface().hasSkyMaskedMaterial()) { coord_t const skyFloor = App_World().map().skyFixFloor(); @@ -142,6 +147,9 @@ boolean P_IsInVoid(player_t *player) return true; } else if(ddpl->mo->origin[VZ] < sec.floor().visHeight() + 4) +#else + if(ddpl->mo->origin[VZ] < sec.floor().height() + 4) +#endif { return true; } diff --git a/doomsday/client/src/world/plane.cpp b/doomsday/client/src/world/plane.cpp index e273b4a74a..431dbcec29 100644 --- a/doomsday/client/src/world/plane.cpp +++ b/doomsday/client/src/world/plane.cpp @@ -91,6 +91,7 @@ DENG2_PIMPL(Plane) ~Instance() { +#ifdef __CLIENT__ Map &map = App_World().map(); // If this plane is currently being watched, remove it. @@ -101,8 +102,6 @@ DENG2_PIMPL(Plane) /// @todo Map should observe Deletion. map.scrollingSurfaces().remove(&surface); -#ifdef __CLIENT__ - // If this plane's surface is in the glowing list, remove it. /// @todo Map should observe Deletion. map.glowingSurfaces().remove(&surface); @@ -147,6 +146,7 @@ DENG2_PIMPL(Plane) // Notify interested parties of the change. notifyHeightChanged(oldHeight); +#ifdef __CLIENT__ /// @todo Map should observe. if(!ddMapSetup) { @@ -155,10 +155,9 @@ DENG2_PIMPL(Plane) App_World().map().trackedPlanes().insert(&self); } -#ifdef __CLIENT__ markDependantSurfacesForDecorationUpdate(); -#endif } +#endif } #ifdef __CLIENT__ @@ -278,6 +277,8 @@ coord_t Plane::speed() const return d->speed; } +#ifdef __CLIENT__ + coord_t Plane::visHeight() const { // $smoothplane @@ -298,9 +299,7 @@ void Plane::lerpVisHeight() // Visible plane height. d->visHeight = d->height + d->visHeightDelta; -#ifdef __CLIENT__ d->markDependantSurfacesForDecorationUpdate(); -#endif } void Plane::resetVisHeight() @@ -309,9 +308,7 @@ void Plane::resetVisHeight() d->visHeightDelta = 0; d->visHeight = d->oldHeight[0] = d->oldHeight[1] = d->height; -#ifdef __CLIENT__ d->markDependantSurfacesForDecorationUpdate(); -#endif } void Plane::updateHeightTracking() @@ -330,6 +327,8 @@ void Plane::updateHeightTracking() } } +#endif // __CLIENT__ + void Plane::setNormal(Vector3f const &newNormal) { d->surface.setNormal(newNormal); // will normalize diff --git a/doomsday/client/src/world/r_world.cpp b/doomsday/client/src/world/r_world.cpp index f91fae5635..90e2cecb50 100644 --- a/doomsday/client/src/world/r_world.cpp +++ b/doomsday/client/src/world/r_world.cpp @@ -68,7 +68,11 @@ void R_SetRelativeHeights(Sector const *front, Sector const *back, int planeInde { if(front) { +#ifdef __CLIENT__ *fz = front->plane(planeIndex).visHeight(); +#else + *fz = front->plane(planeIndex).height(); +#endif if(planeIndex != Plane::Floor) *fz = -(*fz); } @@ -81,7 +85,11 @@ void R_SetRelativeHeights(Sector const *front, Sector const *back, int planeInde { if(back) { +#ifdef __CLIENT__ *bz = back->plane(planeIndex).visHeight(); +#else + *bz = back->plane(planeIndex).height(); +#endif if(planeIndex != Plane::Floor) *bz = -(*bz); } @@ -95,7 +103,11 @@ void R_SetRelativeHeights(Sector const *front, Sector const *back, int planeInde if(back) { int otherPlaneIndex = planeIndex == Plane::Floor? Plane::Ceiling : Plane::Floor; +#ifdef __CLIENT__ *bhz = back->plane(otherPlaneIndex).visHeight(); +#else + *bhz = back->plane(otherPlaneIndex).height(); +#endif if(planeIndex != Plane::Floor) *bhz = -(*bhz); } @@ -106,6 +118,8 @@ void R_SetRelativeHeights(Sector const *front, Sector const *back, int planeInde } } +#ifdef __CLIENT__ + void R_SideSectionCoords(Line::Side const &side, int section, bool skyClip, coord_t *retBottom, coord_t *retTop, Vector2f *retMaterialOrigin) { @@ -315,6 +329,8 @@ void R_SideSectionCoords(Line::Side const &side, int section, bool skyClip, if(retTop) *retTop = top; } +#endif // __CLIENT__ + coord_t R_OpenRange(Line::Side const &side, Sector const *frontSec, Sector const *backSec, coord_t *retBottom, coord_t *retTop) { @@ -347,6 +363,8 @@ coord_t R_OpenRange(Line::Side const &side, Sector const *frontSec, return top - bottom; } +#ifdef __CLIENT__ + coord_t R_VisOpenRange(Line::Side const &side, Sector const *frontSec, Sector const *backSec, coord_t *retBottom, coord_t *retTop) { @@ -379,8 +397,6 @@ coord_t R_VisOpenRange(Line::Side const &side, Sector const *frontSec, return top - bottom; } -#ifdef __CLIENT__ - bool R_SideBackClosed(Line::Side const &side, bool ignoreOpacity) { if(!side.hasSections()) return false; diff --git a/doomsday/client/src/world/surface.cpp b/doomsday/client/src/world/surface.cpp index c07bcce360..fccd13b782 100644 --- a/doomsday/client/src/world/surface.cpp +++ b/doomsday/client/src/world/surface.cpp @@ -130,15 +130,16 @@ DENG2_PIMPL(Surface) i->materialOriginChanged(self, oldMaterialOrigin, changedComponents); } +#ifdef __CLIENT__ if(!ddMapSetup && self.isAttachedToMap()) { -#ifdef __CLIENT__ /// @todo Replace with a de::Observer-based mechanism. self._decorationData.needsUpdate = true; -#endif + /// @todo Do not assume surface is from the CURRENT map. App_World().map().scrollingSurfaces().insert(&self); } +#endif } void notifyMaterialOriginChanged(Vector2f const &oldMaterialOrigin) @@ -312,11 +313,11 @@ bool Surface::setMaterial(Material *newMaterial, bool isMissingFix) d->materialIsMissingFix = false; } +#ifdef __CLIENT__ if(isAttachedToMap()) { if(!ddMapSetup) { -#ifdef __CLIENT__ Map &map = App_World().map(); /// @todo Do not assume surface is from the CURRENT map. // If this plane's surface is in the decorated list, remove it. @@ -324,11 +325,9 @@ bool Surface::setMaterial(Material *newMaterial, bool isMissingFix) // If this plane's surface is in the glowing list, remove it. map.glowingSurfaces().remove(this); -#endif // __CLIENT__ if(newMaterial) { -#ifdef __CLIENT__ if(newMaterial->hasGlow()) { map.glowingSurfaces().insert(this); @@ -346,10 +345,10 @@ bool Surface::setMaterial(Material *newMaterial, bool isMissingFix) P_SpawnPlaneParticleGen(def, d->owner.castTo()); } -#endif // __CLIENT__ } } } +#endif // __CLIENT__ d->material = newMaterial; diff --git a/doomsday/client/src/world/world.cpp b/doomsday/client/src/world/world.cpp index 99d4bd743a..726b343a91 100644 --- a/doomsday/client/src/world/world.cpp +++ b/doomsday/client/src/world/world.cpp @@ -410,20 +410,15 @@ DENG2_PIMPL(World) map->_effectiveGravity = map->_globalGravity; + // Init the thinker lists (public and private). + map->initThinkerLists(0x1 | 0x2); + #ifdef __CLIENT__ Rend_RadioInitForMap(); -#endif map->initSkyFix(); - // Init the thinker lists (public and private). - map->initThinkerLists(0x1 | 0x2); - -#ifdef __CLIENT__ - if(isClient) - { - map->clMobjReset(); - } + map->clMobjReset(); // Tell shadow bias to initialize the bias light sources. SB_InitForMap(map->oldUniqueId()); @@ -531,6 +526,7 @@ bool World::loadMap(de::Uri const &uri) return d->map != 0; } +#ifdef __CLIENT__ static void resetAllMapPlaneVisHeights(Map &map) { foreach(Sector *sector, map.sectors()) @@ -539,6 +535,7 @@ static void resetAllMapPlaneVisHeights(Map &map) plane->resetVisHeight(); } } +#endif static void updateAllMapSectors(Map &map) { @@ -570,12 +567,17 @@ void World::setupMap(int mode) case DDSMM_AFTER_LOADING: DENG_ASSERT(d->map); +#ifdef __CLIENT__ // Update everything again. Its possible that after loading we now have // more HOMs to fix, etc.. d->map->initSkyFix(); +#endif updateAllMapSectors(*d->map); + +#ifdef __CLIENT__ resetAllMapPlaneVisHeights(*d->map); +#endif d->map->initPolyobjs(); DD_ResetTimer(); @@ -597,20 +599,20 @@ void World::setupMap(int mode) Sv_InitPools(); #endif + d->map->initPolyobjs(); + #ifdef __CLIENT__ // Recalculate the light range mod matrix. Rend_UpdateLightModMatrix(); -#endif - d->map->initPolyobjs(); -#ifdef __CLIENT__ P_MapSpawnPlaneParticleGens(); #endif updateAllMapSectors(*d->map); - resetAllMapPlaneVisHeights(*d->map); #ifdef __CLIENT__ + resetAllMapPlaneVisHeights(*d->map); + d->map->buildSurfaceLists(); Time begunPrecacheAt; @@ -659,8 +661,13 @@ void World::setupMap(int mode) { if(BspLeaf *bspLeaf = d->map->bspLeafAtPoint(mo->origin)) { +#ifdef __CLIENT__ if(mo->origin[VZ] >= bspLeaf->sector().floor().visHeight() && mo->origin[VZ] < bspLeaf->sector().ceiling().visHeight() - 4) +#else + if(mo->origin[VZ] >= bspLeaf->sector().floor().height() && + mo->origin[VZ] < bspLeaf->sector().ceiling().height() - 4) +#endif { ddpl.inVoid = false; }