mirror of
https://github.com/ENSL/NS.git
synced 2025-06-02 10:01:04 +00:00
Branched for the performance test.
git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@219 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
parent
410d1ea62f
commit
3e025675b3
2811 changed files with 370563 additions and 0 deletions
154
dev/performance/source/mod/AvHMapExtents.cpp
Normal file
154
dev/performance/source/mod/AvHMapExtents.cpp
Normal file
|
@ -0,0 +1,154 @@
|
|||
#include "util/nowarnings.h"
|
||||
#include "types.h"
|
||||
#include "mod/AvHMapExtents.h"
|
||||
#include "mod/AvHConstants.h"
|
||||
|
||||
#ifdef AVH_SERVER
|
||||
#include "dlls/extdll.h"
|
||||
#include "dlls/util.h"
|
||||
#include "dlls/cbase.h"
|
||||
#include "engine/shake.h"
|
||||
#include "dlls/decals.h"
|
||||
#include "dlls/gamerules.h"
|
||||
#include "mod/AvHServerUtil.h"
|
||||
#endif
|
||||
|
||||
AvHMapExtents::AvHMapExtents()
|
||||
{
|
||||
this->ResetMapExtents();
|
||||
}
|
||||
|
||||
#ifdef AVH_SERVER
|
||||
void AvHMapExtents::CalculateMapExtents()
|
||||
{
|
||||
if(!this->mCalculatedMapExtents)
|
||||
{
|
||||
// Fetch from map extents entity if the map has one
|
||||
FOR_ALL_ENTITIES(kwsMapInfoClassName, AvHMapInfo*)
|
||||
*this = theEntity->GetMapExtents();
|
||||
END_FOR_ALL_ENTITIES(kwsMapInfoClassName)
|
||||
|
||||
this->mCalculatedMapExtents = true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void AvHMapExtents::ResetMapExtents()
|
||||
{
|
||||
// Set defaults
|
||||
this->mMaxViewHeight = kDefaultViewHeight;
|
||||
this->mMinViewHeight = kDefaultMinMapExtent;
|
||||
this->mMinMapX = this->mMinMapY = kDefaultMinMapExtent;
|
||||
this->mMaxMapX = this->mMaxMapY = kDefaultMaxMapExtent;
|
||||
this->mDrawMapBG = true;
|
||||
this->mCalculatedMapExtents = false;
|
||||
|
||||
#ifdef AVH_SERVER
|
||||
this->mTopDownCullDistance = kMaxRelevantCullDistance;
|
||||
#endif
|
||||
}
|
||||
|
||||
float AvHMapExtents::GetMinViewHeight() const
|
||||
{
|
||||
return this->mMinViewHeight;
|
||||
}
|
||||
|
||||
float AvHMapExtents::GetMaxViewHeight() const
|
||||
{
|
||||
return this->mMaxViewHeight;
|
||||
}
|
||||
|
||||
void AvHMapExtents::SetMinViewHeight(float inViewHeight)
|
||||
{
|
||||
this->mMinViewHeight = inViewHeight;
|
||||
}
|
||||
|
||||
void AvHMapExtents::SetMaxViewHeight(float inViewHeight)
|
||||
{
|
||||
this->mMaxViewHeight = inViewHeight;
|
||||
}
|
||||
|
||||
|
||||
|
||||
float AvHMapExtents::GetMinMapX() const
|
||||
{
|
||||
return this->mMinMapX;
|
||||
}
|
||||
|
||||
float AvHMapExtents::GetMaxMapX() const
|
||||
{
|
||||
return this->mMaxMapX;
|
||||
}
|
||||
|
||||
void AvHMapExtents::SetMinMapX(float inMapX)
|
||||
{
|
||||
this->mMinMapX = inMapX;
|
||||
if(this->mMinMapX < -kMaxMapDimension)
|
||||
{
|
||||
this->mMinMapX = -kMaxMapDimension;
|
||||
}
|
||||
}
|
||||
|
||||
void AvHMapExtents::SetMaxMapX(float inMapX)
|
||||
{
|
||||
this->mMaxMapX = inMapX;
|
||||
|
||||
if(this->mMaxMapX > kMaxMapDimension)
|
||||
{
|
||||
this->mMaxMapX = kMaxMapDimension;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float AvHMapExtents::GetMinMapY() const
|
||||
{
|
||||
return this->mMinMapY;
|
||||
}
|
||||
|
||||
float AvHMapExtents::GetMaxMapY() const
|
||||
{
|
||||
return this->mMaxMapY;
|
||||
}
|
||||
|
||||
void AvHMapExtents::SetMinMapY(float inMapY)
|
||||
{
|
||||
this->mMinMapY = inMapY;
|
||||
if(this->mMinMapY < -kMaxMapDimension)
|
||||
{
|
||||
this->mMinMapY = -kMaxMapDimension;
|
||||
}
|
||||
}
|
||||
|
||||
void AvHMapExtents::SetMaxMapY(float inMapY)
|
||||
{
|
||||
this->mMaxMapY = inMapY;
|
||||
if(this->mMaxMapY > kMaxMapDimension)
|
||||
{
|
||||
this->mMaxMapY = kMaxMapDimension;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool AvHMapExtents::GetDrawMapBG() const
|
||||
{
|
||||
return this->mDrawMapBG;
|
||||
}
|
||||
|
||||
void AvHMapExtents::SetDrawMapBG(bool inDrawMapBG)
|
||||
{
|
||||
this->mDrawMapBG = inDrawMapBG;
|
||||
}
|
||||
|
||||
#ifdef AVH_SERVER
|
||||
float AvHMapExtents::GetTopDownCullDistance() const
|
||||
{
|
||||
return this->mTopDownCullDistance;
|
||||
}
|
||||
|
||||
void AvHMapExtents::SetTopDownCullDistance(float inCullDistance)
|
||||
{
|
||||
ASSERT(inCullDistance > 0);
|
||||
this->mTopDownCullDistance = inCullDistance;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue