diff --git a/src/engine/bih.cc b/src/engine/bih.cc index 3d3f453..12e77db 100644 --- a/src/engine/bih.cc +++ b/src/engine/bih.cc @@ -1,3 +1,4 @@ +#include "physics.hh" #include "rendermodel.hh" // loadmapmodel #include "stain.hh" #include "texture.hh" diff --git a/src/engine/dynlight.cc b/src/engine/dynlight.cc index d331652..22b20d0 100644 --- a/src/engine/dynlight.cc +++ b/src/engine/dynlight.cc @@ -1,5 +1,6 @@ #include "dynlight.hh" +#include "physics.hh" // collide #include "pvs.hh" #include "rendergl.hh" // camera1 #include "renderva.hh" diff --git a/src/engine/octaedit.cc b/src/engine/octaedit.cc index db99a41..1a8397c 100644 --- a/src/engine/octaedit.cc +++ b/src/engine/octaedit.cc @@ -7,6 +7,7 @@ #include "material.hh" #include "octa.hh" #include "octarender.hh" +#include "physics.hh" #include "pvs.hh" #include "rendergl.hh" #include "renderlights.hh" diff --git a/src/engine/physics.hh b/src/engine/physics.hh index 37b0caf..e6665ca 100644 --- a/src/engine/physics.hh +++ b/src/engine/physics.hh @@ -3,10 +3,36 @@ #include +struct dynent; +struct physent; struct extentity; +struct entity; + +extern vec collidewall; +extern int collideinside; +extern physent *collideplayer; bool overlapsdynent(const vec &o, float radius); void rotatebb(vec ¢er, vec &radius, int yaw, int pitch, int roll = 0); float shadowray(const vec &o, const vec &ray, float radius, int mode, extentity *t = NULL); +void moveplayer(physent *pl, int moveres, bool local); +bool moveplayer(physent *pl, int moveres, bool local, int curtime); +void crouchplayer(physent *pl, int moveres, bool local); +bool collide(physent *d, const vec &dir = vec(0, 0, 0), float cutoff = 0.0f, bool playercol = true, bool insideplayercol = false); +bool bounce(physent *d, float secs, float elasticity, float waterfric, float grav); +bool bounce(physent *d, float elasticity, float waterfric, float grav); +void avoidcollision(physent *d, const vec &dir, physent *obstacle, float space); +bool movecamera(physent *pl, const vec &dir, float dist, float stepdist); +void physicsframe(); +void dropenttofloor(entity *e); +bool droptofloor(vec &o, float radius, float height); + +void vecfromyawpitch(float yaw, float pitch, int move, int strafe, vec &m); +void vectoyawpitch(const vec &v, float &yaw, float &pitch); +void updatephysstate(physent *d); +void cleardynentcache(); +void updatedynentcache(physent *d); +bool entinmap(dynent *d, bool avoidplayers = false); + #endif diff --git a/src/engine/rendergl.cc b/src/engine/rendergl.cc index 6736de4..44c53b0 100644 --- a/src/engine/rendergl.cc +++ b/src/engine/rendergl.cc @@ -9,6 +9,7 @@ #include "pvs.hh" #include "octaedit.hh" #include "octarender.hh" // valist +#include "physics.hh" // movecamera #include "rendergl.hh" #include "renderlights.hh" #include "rendermodel.hh" diff --git a/src/engine/rendermodel.cc b/src/engine/rendermodel.cc index 8e77900..854c804 100644 --- a/src/engine/rendermodel.cc +++ b/src/engine/rendermodel.cc @@ -5,6 +5,7 @@ #include "console.hh" /* conoutf */ #include "main.hh" // loadprogress, renderprogress #include "octarender.hh" +#include "physics.hh" // collidewall #include "pvs.hh" #include "rendergl.hh" #include "renderva.hh" diff --git a/src/game/game.cc b/src/game/game.cc index 54975a1..b350036 100644 --- a/src/game/game.cc +++ b/src/game/game.cc @@ -1,6 +1,7 @@ #include "cube.hh" #include +#include #include #include diff --git a/src/shared/iengine.hh b/src/shared/iengine.hh index 90f8840..55c819f 100644 --- a/src/shared/iengine.hh +++ b/src/shared/iengine.hh @@ -84,29 +84,3 @@ extern void loopend(ident *id, identstack &stack); #define loopstart(id, stack) if((id)->type != ID_ALIAS) return; identstack stack; static inline void loopiter(ident *id, identstack &stack, int i) { tagval v; v.setint(i); loopiter(id, stack, v); } static inline void loopiter(ident *id, identstack &stack, float f) { tagval v; v.setfloat(f); loopiter(id, stack, v); } - -// physics -extern vec collidewall; -extern int collideinside; -extern physent *collideplayer; - -extern void moveplayer(physent *pl, int moveres, bool local); -extern bool moveplayer(physent *pl, int moveres, bool local, int curtime); -extern void crouchplayer(physent *pl, int moveres, bool local); -extern bool collide(physent *d, const vec &dir = vec(0, 0, 0), float cutoff = 0.0f, bool playercol = true, bool insideplayercol = false); -extern bool bounce(physent *d, float secs, float elasticity, float waterfric, float grav); -extern bool bounce(physent *d, float elasticity, float waterfric, float grav); -extern void avoidcollision(physent *d, const vec &dir, physent *obstacle, float space); -extern bool overlapsdynent(const vec &o, float radius); -extern bool movecamera(physent *pl, const vec &dir, float dist, float stepdist); -extern void physicsframe(); -extern void dropenttofloor(entity *e); -extern bool droptofloor(vec &o, float radius, float height); - -extern void vecfromyawpitch(float yaw, float pitch, int move, int strafe, vec &m); -extern void vectoyawpitch(const vec &v, float &yaw, float &pitch); -extern void updatephysstate(physent *d); -extern void cleardynentcache(); -extern void updatedynentcache(physent *d); -extern bool entinmap(dynent *d, bool avoidplayers = false); -extern void findplayerspawn(dynent *d, int forceent = -1, int tag = 0); diff --git a/src/shared/igame.hh b/src/shared/igame.hh index ff50705..037986a 100644 --- a/src/shared/igame.hh +++ b/src/shared/igame.hh @@ -54,7 +54,6 @@ namespace game extern void updateworld(); extern void initclient(); extern void physicstrigger(physent *d, bool local, int floorlevel, int waterlevel, int material = 0); - extern void bounced(physent *d, const vec &surface); extern void edittrigger(const selinfo &sel, int op, int arg1 = 0, int arg2 = 0, int arg3 = 0, const VSlot *vs = NULL); extern void vartrigger(ident *id); extern void dynentcollide(physent *d, physent *o, const vec &dir);