Skip to content

Commit

Permalink
document api functions in physics.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
no-lex committed Feb 17, 2025
1 parent 373d7c0 commit 290a8a4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/engine/world/physics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1183,6 +1183,8 @@ static CollisionInfo octacollide(const physent *d, const vec &dir, float cutoff,

// all collision happens here
//

//used in iengine
bool collide(const physent *d, vec *cwall, const vec &dir, float cutoff, bool insideplayercol)
{
collideinside = 0;
Expand Down Expand Up @@ -1211,6 +1213,7 @@ bool collide(const physent *d, vec *cwall, const vec &dir, float cutoff, bool in
}
}

//used in iengine
void recalcdir(const physent *d, const vec &oldvel, vec &dir)
{
float speed = oldvel.magnitude();
Expand All @@ -1223,6 +1226,7 @@ void recalcdir(const physent *d, const vec &oldvel, vec &dir)
}
}

//used in iengine
void slideagainst(physent *d, vec &dir, const vec &obstacle, bool foundfloor, bool slidecollide)
{
vec wall(obstacle);
Expand All @@ -1241,6 +1245,7 @@ void slideagainst(physent *d, vec &dir, const vec &obstacle, bool foundfloor, bo
recalcdir(d, oldvel, dir);
}

//used in iengine
void avoidcollision(physent *d, const vec &dir, const physent *obstacle, float space)
{
float rad = obstacle->radius+d->radius;
Expand Down Expand Up @@ -1278,6 +1283,7 @@ void avoidcollision(physent *d, const vec &dir, const physent *obstacle, float s
}
}

//used in iengine
bool movecamera(physent *pl, const vec &dir, float dist, float stepdist)
{
int steps = static_cast<int>(ceil(dist/stepdist));
Expand All @@ -1300,7 +1306,7 @@ bool movecamera(physent *pl, const vec &dir, float dist, float stepdist)
return true;
}

bool droptofloor(vec &o, float radius, float height)
static bool droptofloor(vec &o, float radius, float height)
{
static struct dropent : physent
{
Expand Down Expand Up @@ -1356,11 +1362,13 @@ float dropheight(const entity &e)
}
}

//used in iengine
void dropenttofloor(entity *e)
{
droptofloor(e->o, 1.0f, dropheight(*e));
}

//used in iengine
void vecfromyawpitch(float yaw, float pitch, int move, int strafe, vec &m)
{
if(move)
Expand Down Expand Up @@ -1391,6 +1399,7 @@ void vecfromyawpitch(float yaw, float pitch, int move, int strafe, vec &m)
}
}

//used in iengine
bool entinmap(dynent *d, bool avoidplayers) // brute force but effective way to find a free spawn spot in the map
{
d->o.z += d->eyeheight; // pos specified is at feet
Expand Down

0 comments on commit 290a8a4

Please sign in to comment.