diff --git a/doomsday/client/src/map/bspleaf.cpp b/doomsday/client/src/map/bspleaf.cpp index cc9d2ed33d..e8bf767410 100644 --- a/doomsday/client/src/map/bspleaf.cpp +++ b/doomsday/client/src/map/bspleaf.cpp @@ -49,10 +49,12 @@ BspLeaf::~BspLeaf() { if(bsuf) { +#ifdef __CLIENT__ for(uint i = 0; i < sector->planeCount; ++i) { SB_DestroySurface(bsuf[i]); } +#endif Z_Free(bsuf); } @@ -99,6 +101,7 @@ biassurface_t* BspLeaf_BiasSurfaceForGeometryGroup(BspLeaf* leaf, uint groupId) { DENG2_ASSERT(leaf); if(!leaf->sector || groupId > leaf->sector->planeCount) return NULL; + DENG2_ASSERT(leaf->bsuf != 0); return leaf->bsuf[groupId]; } diff --git a/doomsday/client/src/map/hedge.cpp b/doomsday/client/src/map/hedge.cpp index 939e4a2d61..5a5bf8f0ff 100644 --- a/doomsday/client/src/map/hedge.cpp +++ b/doomsday/client/src/map/hedge.cpp @@ -50,6 +50,7 @@ HEdge::HEdge(HEdge const &other) : de::MapElement(DMU_HEDGE) HEdge::~HEdge() { +#ifdef __CLIENT__ for(uint i = 0; i < 3; ++i) { if(bsuf[i]) @@ -57,6 +58,7 @@ HEdge::~HEdge() SB_DestroySurface(bsuf[i]); } } +#endif } coord_t WallDivNode_Height(walldivnode_t* node) diff --git a/doomsday/client/src/map/p_data.cpp b/doomsday/client/src/map/p_data.cpp index 359bbafa90..7d32c57a38 100644 --- a/doomsday/client/src/map/p_data.cpp +++ b/doomsday/client/src/map/p_data.cpp @@ -147,12 +147,12 @@ DENG_EXTERN_C boolean P_LoadMap(char const* uriCString) // Init the thinker lists (public and private). GameMap_InitThinkerLists(map, 0x1 | 0x2); - // Tell shadow bias to initialize the bias light sources. - SB_InitForMap(GameMap_OldUniqueId(map)); - GameMap_ClMobjReset(map); #ifdef __CLIENT__ + // Tell shadow bias to initialize the bias light sources. + SB_InitForMap(GameMap_OldUniqueId(map)); + // Clear player data, too, since we just lost all clmobjs. Cl_InitPlayers(); diff --git a/doomsday/client/src/map/p_polyobjs.cpp b/doomsday/client/src/map/p_polyobjs.cpp index 9d0eef1d22..2d1f9cbfec 100644 --- a/doomsday/client/src/map/p_polyobjs.cpp +++ b/doomsday/client/src/map/p_polyobjs.cpp @@ -45,11 +45,13 @@ void P_PolyobjChanged(Polyobj* po) HEdge* hedge = line->L_frontside.hedgeLeft; int i; +#ifdef __CLIENT__ // Shadow bias must be told. for(i = 0; i < 3; ++i) { SB_SurfaceMoved(hedge->bsuf[i]); } +#endif } } diff --git a/doomsday/client/src/map/r_world.cpp b/doomsday/client/src/map/r_world.cpp index 0fa3ff6f8e..e5774f767a 100644 --- a/doomsday/client/src/map/r_world.cpp +++ b/doomsday/client/src/map/r_world.cpp @@ -392,6 +392,7 @@ Plane *R_NewPlaneForSector(Sector *sec) newList[n] = bspLeaf->bsuf[n]; } Z_Free(bspLeaf->bsuf); + bspLeaf->bsuf = 0; } if(!ddMapSetup) @@ -463,16 +464,19 @@ void R_DestroyPlaneOfSector(uint id, Sector *sec) // If this plane's surface is in the glowing list, remove it. R_SurfaceListRemove(GameMap_GlowingSurfaces(theMap), &plane->surface); +#ifdef __CLIENT__ // Destroy the biassurfaces for this plane. for(BspLeaf **bspLeafIter = sec->bspLeafs; *bspLeafIter; bspLeafIter++) { BspLeaf *bspLeaf = *bspLeafIter; + DENG2_ASSERT(bspLeaf->bsuf != 0); SB_DestroySurface(bspLeaf->bsuf[id]); if(id < sec->planeCount) { std::memmove(bspLeaf->bsuf + id, bspLeaf->bsuf + id + 1, sizeof(biassurface_t *)); } } +#endif // __CLIENT__ // Destroy the specified plane. delete plane; @@ -1566,6 +1570,7 @@ boolean R_UpdatePlane(Plane *pln, boolean forceUpdate) } } +#ifdef __CLIENT__ // Inform the shadow bias of changed geometry. if(sec->bspLeafs && *sec->bspLeafs) { @@ -1591,6 +1596,7 @@ boolean R_UpdatePlane(Plane *pln, boolean forceUpdate) SB_SurfaceMoved(bspLeaf->bsuf[pln->planeID]); } } +#endif // __CLIENT__ // We need the decorations updated. Surface_Update(&pln->surface); diff --git a/doomsday/client/src/render/rend_bias.cpp b/doomsday/client/src/render/rend_bias.cpp index 445f01e969..c6bf3d525f 100644 --- a/doomsday/client/src/render/rend_bias.cpp +++ b/doomsday/client/src/render/rend_bias.cpp @@ -424,6 +424,7 @@ void SB_InitForMap(const char* uniqueID) bsuf->illum = illums; illums += bsuf->size; + DENG2_ASSERT(leaf->bsuf != 0); leaf->bsuf[j] = bsuf; } } diff --git a/doomsday/server/include/server_dummies.h b/doomsday/server/include/server_dummies.h index e2100b3b1b..d4f48e03ec 100644 --- a/doomsday/server/include/server_dummies.h +++ b/doomsday/server/include/server_dummies.h @@ -151,10 +151,6 @@ DENG_EXTERN_C void Models_Init(); DENG_EXTERN_C void Models_Shutdown(); DENG_EXTERN_C void Models_CacheForState(int stateIndex); -DENG_EXTERN_C void SB_InitForMap(const char* uniqueID); -DENG_EXTERN_C void SB_SurfaceMoved(biassurface_t* bsuf); -DENG_EXTERN_C void SB_DestroySurface(struct biassurface_s* bsuf); - DENG_EXTERN_C void LG_SectorChanged(Sector* sector); DENG_EXTERN_C void Cl_InitPlayers(void); diff --git a/doomsday/server/src/server_dummies.cpp b/doomsday/server/src/server_dummies.cpp index 6917ab5d7a..9898e78ee5 100644 --- a/doomsday/server/src/server_dummies.cpp +++ b/doomsday/server/src/server_dummies.cpp @@ -591,21 +591,6 @@ void Models_CacheForState(int stateIndex) DENG_UNUSED(stateIndex); } -void SB_InitForMap(const char* uniqueID) -{ - DENG_UNUSED(uniqueID); -} - -void SB_SurfaceMoved(biassurface_t* bsuf) -{ - DENG_UNUSED(bsuf); -} - -void SB_DestroySurface(struct biassurface_s* bsuf) -{ - DENG_UNUSED(bsuf); -}; - void LG_SectorChanged(Sector* sector) { DENG_UNUSED(sector);