Skip to content

Commit

Permalink
Let worldspawn decide world size
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikk155 committed Sep 26, 2024
1 parent 7b1e5d3 commit eb392b8
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
13 changes: 13 additions & 0 deletions src/data/entities/worldspawn.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,19 @@
"description": "worldspawn::MaxRange::description"
},

"minhullsize":
{
"variable": "vector",
"value": "-4096 -4096 -4096",
"title": "minhullsize"
},
"maxhullsize":
{
"variable": "vector",
"value": "4096 4096 4096",
"title": "maxhullsize"
},

"chaptertitle":
{
"variable": "string",
Expand Down
2 changes: 0 additions & 2 deletions src/game/server/entities/CBaseEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ enum PlayerSelector
// people gib if their health is <= this at the time of death
#define GIB_HEALTH_VALUE -30

#define WORLD_BOUNDS_LIMIT 4096

#define bits_CAP_DUCK (1 << 0) // crouch
#define bits_CAP_JUMP (1 << 1) // jump/leap
#define bits_CAP_STRAFE (1 << 2) // strafe ( walk/run sideways)
Expand Down
12 changes: 6 additions & 6 deletions src/game/server/entities/cbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -882,17 +882,17 @@ bool CBaseEntity::IsLockedByMaster()
bool CBaseEntity::IsInWorld()
{
// position
if (pev->origin.x >= WORLD_BOUNDS_LIMIT)
if (pev->origin.x >= CBaseEntity::World->m_CustomHullMax.x)
return false;
if (pev->origin.y >= WORLD_BOUNDS_LIMIT)
if (pev->origin.y >= CBaseEntity::World->m_CustomHullMax.y)
return false;
if (pev->origin.z >= WORLD_BOUNDS_LIMIT)
if (pev->origin.z >= CBaseEntity::World->m_CustomHullMax.z)
return false;
if (pev->origin.x <= -WORLD_BOUNDS_LIMIT)
if (pev->origin.x <= CBaseEntity::World->m_CustomHullMin.x)
return false;
if (pev->origin.y <= -WORLD_BOUNDS_LIMIT)
if (pev->origin.y <= CBaseEntity::World->m_CustomHullMin.y)
return false;
if (pev->origin.z <= -WORLD_BOUNDS_LIMIT)
if (pev->origin.z <= CBaseEntity::World->m_CustomHullMin.z)
return false;
// speed
if (pev->velocity.x >= 2000)
Expand Down
5 changes: 5 additions & 0 deletions src/game/server/entities/world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,11 @@ void CWorld::Precache()
else
CVAR_SET_FLOAT("sv_zmax", 4096);

if( !m_HasCustomHullMin )
m_CustomHullMin = Vector( -4096, -4096, -4096 );
if( !m_HasCustomHullMax )
m_CustomHullMax = Vector( 4096, 4096, 4096 );

if (!FStringNull(pev->netname))
{
Logger->debug("Chapter title: {}", GetNetname());
Expand Down

0 comments on commit eb392b8

Please sign in to comment.