No network clip in client prediction

This commit is contained in:
def 2021-01-11 18:02:52 +01:00
parent 460f2190f5
commit f9aae5d53a
5 changed files with 0 additions and 35 deletions

View file

@ -234,9 +234,3 @@ bool CProjectile::Match(CProjectile *pProj)
return false; return false;
return true; return true;
} }
int CProjectile::NetworkClipped(vec2 ViewPos)
{
float Ct = (GameWorld()->GameTick() - m_StartTick) / (float)GameWorld()->GameTickSpeed();
return ((CEntity *)this)->NetworkClipped(GetPos(Ct), ViewPos);
}

View file

@ -40,7 +40,6 @@ public:
const int &GetOwner() { return m_Owner; } const int &GetOwner() { return m_Owner; }
const int &GetStartTick() { return m_StartTick; } const int &GetStartTick() { return m_StartTick; }
CProjectile(CGameWorld *pGameWorld, int ID, CNetObj_Projectile *pProj); CProjectile(CGameWorld *pGameWorld, int ID, CNetObj_Projectile *pProj);
virtual int NetworkClipped(vec2 ViewPos);
private: private:
vec2 m_Direction; vec2 m_Direction;

View file

@ -33,24 +33,6 @@ CEntity::~CEntity()
GameWorld()->RemoveEntity(this); GameWorld()->RemoveEntity(this);
} }
int CEntity::NetworkClipped(vec2 ViewPos)
{
return NetworkClipped(m_Pos, ViewPos);
}
int CEntity::NetworkClipped(vec2 CheckPos, vec2 ViewPos)
{
float dx = ViewPos.x - CheckPos.x;
float dy = ViewPos.y - CheckPos.y;
if(absolute(dx) > 1000.0f || absolute(dy) > 800.0f)
return 1;
if(distance(ViewPos, CheckPos) > 4000.0f)
return 1;
return 0;
}
bool CEntity::GameLayerClipped(vec2 CheckPos) bool CEntity::GameLayerClipped(vec2 CheckPos)
{ {
return round_to_int(CheckPos.x) / 32 < -200 || round_to_int(CheckPos.x) / 32 > Collision()->GetWidth() + 200 || return round_to_int(CheckPos.x) / 32 < -200 || round_to_int(CheckPos.x) / 32 > Collision()->GetWidth() + 200 ||

View file

@ -54,8 +54,6 @@ public:
virtual void TickDefered() {} virtual void TickDefered() {}
bool GameLayerClipped(vec2 CheckPos); bool GameLayerClipped(vec2 CheckPos);
virtual int NetworkClipped(vec2 ViewPos);
virtual int NetworkClipped(vec2 CheckPos, vec2 ViewPos);
float m_ProximityRadius; float m_ProximityRadius;
vec2 m_Pos; vec2 m_Pos;
int m_Number; int m_Number;

View file

@ -485,14 +485,6 @@ void CGameWorld::NetObjEnd(int LocalID)
pHookedChar->m_KeepHooked = true; pHookedChar->m_KeepHooked = true;
pHookedChar->m_MarkedForDestroy = false; pHookedChar->m_MarkedForDestroy = false;
} }
// keep entities that are out of view for a short while, for some entity types
if(CCharacter *pLocal = GetCharacterByID(LocalID))
for(int i : {ENTTYPE_CHARACTER, ENTTYPE_PROJECTILE, ENTTYPE_LASER})
for(CEntity *pEnt = FindFirst(i); pEnt; pEnt = pEnt->TypeNext())
if(pEnt->m_MarkedForDestroy)
if(pEnt->m_SnapTicks < 2 * SERVER_TICK_SPEED || (i != ENTTYPE_CHARACTER && pEnt->m_SnapTicks < 5 * SERVER_TICK_SPEED))
if(pEnt->NetworkClipped(pLocal->m_Core.m_Pos))
pEnt->m_MarkedForDestroy = false;
RemoveEntities(); RemoveEntities();
// Update character IDs and pointers // Update character IDs and pointers