added a physics_ode_enable cvar. If set to 0 at qc start, physics will be disabled for that map.

If you don't have an ode library or whatever, it'll be forced to 0 or non-existent, as a way to test to see if its supported+usable:
if (cvar("physics_ode_enable")) physicswork();

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3492 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2010-01-10 23:42:57 +00:00
parent 77056f58ed
commit 91d856d72e

View file

@ -38,6 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//#define ODE_DYNAMIC 1
//#endif
cvar_t physics_ode_enable = SCVAR("physics_ode_enable", "1");
cvar_t physics_ode_quadtree_depth = CVARDP4(0, "physics_ode_quadtree_depth","5", "desired subdivision level of quadtree culling space");
cvar_t physics_ode_contactsurfacelayer = CVARDP4(0, "physics_ode_contactsurfacelayer","0", "allows objects to overlap this many units to reduce jitter");
cvar_t physics_ode_worldquickstep = CVARDP4(0, "physics_ode_worldquickstep","1", "use dWorldQuickStep rather than dWorldStep");
@ -1178,6 +1179,7 @@ void World_Physics_Init(void)
};
#endif
Cvar_Register(&physics_ode_enable, "ODE Physics Library");
Cvar_Register(&physics_ode_quadtree_depth, "ODE Physics Library");
Cvar_Register(&physics_ode_contactsurfacelayer, "ODE Physics Library");
Cvar_Register(&physics_ode_worldquickstep, "ODE Physics Library");
@ -1218,6 +1220,14 @@ void World_Physics_Init(void)
}
#endif
}
#ifdef ODE_DYNAMIC
if (!ode_dll)
{
physics_ode_enable.flags |= CVAR_NOSET;
Cvar_ForceSet(&physics_ode_enable, "0");
}
#endif
}
void World_Physics_Shutdown(void)
@ -1239,6 +1249,10 @@ static void World_Physics_EnableODE(world_t *world)
dVector3 center, extents;
if (world->ode.ode)
return;
if (!physics_ode_enable.ival)
return;
#ifdef ODE_DYNAMIC
if (!ode_dll)
return;
@ -1554,7 +1568,7 @@ static void World_Physics_Frame_JointFromEntity(world_t *world, wedict_t *ed)
dJointSetHingeAnchor(j, origin[0], origin[1], origin[2]);
dJointSetHingeAxis(j, forward[0], forward[1], forward[2]);
dJointSetHingeParam(j, dParamFMax, FMax);
dJointSetHingeParam(j, dParamHiStop, Stop);
dJointSetHingeParam(j, dParamHiStop, Stop);
dJointSetHingeParam(j, dParamLoStop, -Stop);
dJointSetHingeParam(j, dParamStopCFM, CFM);
dJointSetHingeParam(j, dParamStopERP, ERP);