]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - world.c
Don't bother setting anisotropy on textures twice during startup.
[xonotic/darkplaces.git] / world.c
diff --git a/world.c b/world.c
index 29a11b4b780b434d4157ff4a3de24339d69e01a8..60bd0937728f7a5e6275c8281bdcd4adca5cf17d 100644 (file)
--- a/world.c
+++ b/world.c
@@ -185,8 +185,11 @@ int World_EntitiesInBox(world_t *world, const vec3_t requestmins, const vec3_t r
        vec3_t paddedmins, paddedmaxs;
        int igrid[3], igridmins[3], igridmaxs[3];
 
-       VectorSet(paddedmins, requestmins[0] - 1.0f, requestmins[1] - 1.0f, requestmins[2] - 1.0f);
-       VectorSet(paddedmaxs, requestmaxs[0] + 1.0f, requestmaxs[1] + 1.0f, requestmaxs[2] + 1.0f);
+       // LordHavoc: discovered this actually causes its own bugs (dm6 teleporters being too close to info_teleport_destination)
+       //VectorSet(paddedmins, requestmins[0] - 1.0f, requestmins[1] - 1.0f, requestmins[2] - 1.0f);
+       //VectorSet(paddedmaxs, requestmaxs[0] + 1.0f, requestmaxs[1] + 1.0f, requestmaxs[2] + 1.0f);
+       VectorCopy(requestmins, paddedmins);
+       VectorCopy(requestmaxs, paddedmaxs);
 
        // FIXME: if areagrid_marknumber wraps, all entities need their
        // ent->priv.server->areagridmarknumber reset
@@ -327,14 +330,6 @@ void World_LinkEdict(world_t *world, prvm_edict_t *ent, const vec3_t mins, const
 // physics engine support
 //============================================================================
 
-#ifndef ODE_STATIC
-# define ODE_DYNAMIC 1
-#endif
-
-#if defined(ODE_STATIC) || defined(ODE_DYNAMIC)
-#define USEODE 1
-#endif
-
 #ifdef USEODE
 cvar_t physics_ode_quadtree_depth = {0, "physics_ode_quadtree_depth","5", "desired subdivision level of quadtree culling space"};
 cvar_t physics_ode_allowconvex = {0, "physics_ode_allowconvex", "0", "allow usage of Convex Hull primitive type on trimeshes that have custom 'collisionconvex' mesh. If disabled, trimesh primitive type are used."};
@@ -370,7 +365,7 @@ cvar_t physics_ode = {0, "physics_ode", "0", "run ODE physics (VERY experimental
 // LordHavoc: this large chunk of definitions comes from the ODE library
 // include files.
 
-#ifdef ODE_STATIC
+#ifdef LINK_TO_LIBODE
 #include "ode/ode.h"
 #else
 #ifdef WINAPI
@@ -1475,14 +1470,20 @@ dllhandle_t ode_dll = NULL;
 static void World_Physics_Init(void)
 {
 #ifdef USEODE
-#ifdef ODE_DYNAMIC
+#ifndef LINK_TO_LIBODE
        const char* dllnames [] =
        {
 # if defined(WIN32)
+               "libode3.dll",
+               "libode2.dll",
                "libode1.dll",
 # elif defined(MACOSX)
+               "libode.3.dylib",
+               "libode.2.dylib",
                "libode.1.dylib",
 # else
+               "libode.so.3",
+               "libode.so.2",
                "libode.so.1",
 # endif
                NULL
@@ -1519,14 +1520,14 @@ static void World_Physics_Init(void)
        Cvar_RegisterVariable(&physics_ode_allowconvex);
        Cvar_RegisterVariable(&physics_ode);
 
-#ifdef ODE_DYNAMIC
+#ifndef LINK_TO_LIBODE
        // Load the DLL
        if (Sys_LoadLibrary (dllnames, &ode_dll, odefuncs))
 #endif
        {
                dInitODE();
 //             dInitODE2(0);
-#ifdef ODE_DYNAMIC
+#ifndef LINK_TO_LIBODE
 # ifdef dSINGLE
                if (!dCheckConfiguration("ODE_single_precision"))
 # else
@@ -1558,12 +1559,12 @@ static void World_Physics_Init(void)
 static void World_Physics_Shutdown(void)
 {
 #ifdef USEODE
-#ifdef ODE_DYNAMIC
+#ifndef LINK_TO_LIBODE
        if (ode_dll)
 #endif
        {
                dCloseODE();
-#ifdef ODE_DYNAMIC
+#ifndef LINK_TO_LIBODE
                Sys_UnloadLibrary(&ode_dll);
                ode_dll = NULL;
 #endif
@@ -1615,7 +1616,7 @@ static void World_Physics_EnableODE(world_t *world)
        dVector3 center, extents;
        if (world->physics.ode)
                return;
-#ifdef ODE_DYNAMIC
+#ifndef LINK_TO_LIBODE
        if (!ode_dll)
                return;
 #endif
@@ -1721,9 +1722,9 @@ void World_Physics_RemoveFromEntity(world_t *world, prvm_edict_t *ed)
 
 void World_Physics_ApplyCmd(prvm_edict_t *ed, edict_odefunc_t *f)
 {
+#ifdef USEODE
        dBodyID body = (dBodyID)ed->priv.server->ode_body;
 
-#ifdef USEODE
        switch(f->type)
        {
        case ODEFUNC_ENABLE:
@@ -2113,9 +2114,8 @@ static void World_Physics_Frame_BodyFromEntity(world_t *world, prvm_edict_t *ed)
        prvm_prog_t *prog = world->prog;
        const float *iv;
        const int *ie;
-       dBodyID body = (dBodyID)ed->priv.server->ode_body;
+       dBodyID body;
        dMass mass;
-       dReal test;
        const dReal *ovelocity, *ospinvelocity;
        void *dataID;
        dp_model_t *model;
@@ -2150,6 +2150,7 @@ static void World_Physics_Frame_BodyFromEntity(world_t *world, prvm_edict_t *ed)
        vec_t radius;
        vec3_t scale;
        vec_t spinlimit;
+       vec_t test;
        qboolean gravity;
        qboolean geom_modified = false;
        edict_odefunc_t *func, *nextf;
@@ -2159,7 +2160,7 @@ static void World_Physics_Frame_BodyFromEntity(world_t *world, prvm_edict_t *ed)
        qboolean *mapped, *used, convex_compatible;
        int numplanes = 0, numpoints = 0, i;
 
-#ifdef ODE_DYNAMIC
+#ifndef LINK_TO_LIBODE
        if (!ode_dll)
                return;
 #endif
@@ -2734,17 +2735,17 @@ treatasbox:
        if (physics_ode_trick_fixnan.integer)
        {
                test = VectorLength2(origin) + VectorLength2(forward) + VectorLength2(left) + VectorLength2(up) + VectorLength2(velocity) + VectorLength2(spinvelocity);
-               if (IS_NAN(test))
+               if (VEC_IS_NAN(test))
                {
                        modified = true;
                        //Con_Printf("Fixing NAN values on entity %i : .classname = \"%s\" .origin = '%f %f %f' .velocity = '%f %f %f' .axis_forward = '%f %f %f' .axis_left = '%f %f %f' .axis_up = %f %f %f' .spinvelocity = '%f %f %f'\n", PRVM_NUM_FOR_EDICT(ed), PRVM_GetString(PRVM_gameedictstring(ed, classname)), origin[0], origin[1], origin[2], velocity[0], velocity[1], velocity[2], forward[0], forward[1], forward[2], left[0], left[1], left[2], up[0], up[1], up[2], spinvelocity[0], spinvelocity[1], spinvelocity[2]);
                        if (physics_ode_trick_fixnan.integer >= 2)
                                Con_Printf("Fixing NAN values on entity %i : .classname = \"%s\" .origin = '%f %f %f' .velocity = '%f %f %f' .angles = '%f %f %f' .avelocity = '%f %f %f'\n", PRVM_NUM_FOR_EDICT(ed), PRVM_GetString(prog, PRVM_gameedictstring(ed, classname)), origin[0], origin[1], origin[2], velocity[0], velocity[1], velocity[2], angles[0], angles[1], angles[2], avelocity[0], avelocity[1], avelocity[2]);
                        test = VectorLength2(origin);
-                       if (IS_NAN(test))
+                       if (VEC_IS_NAN(test))
                                VectorClear(origin);
                        test = VectorLength2(forward) * VectorLength2(left) * VectorLength2(up);
-                       if (IS_NAN(test))
+                       if (VEC_IS_NAN(test))
                        {
                                VectorSet(angles, 0, 0, 0);
                                VectorSet(forward, 1, 0, 0);
@@ -2752,10 +2753,10 @@ treatasbox:
                                VectorSet(up, 0, 0, 1);
                        }
                        test = VectorLength2(velocity);
-                       if (IS_NAN(test))
+                       if (VEC_IS_NAN(test))
                                VectorClear(velocity);
                        test = VectorLength2(spinvelocity);
-                       if (IS_NAN(test))
+                       if (VEC_IS_NAN(test))
                        {
                                VectorClear(avelocity);
                                VectorClear(spinvelocity);
@@ -3011,11 +3012,11 @@ static void nearCallback (void *data, dGeomID o1, dGeomID o2)
 
 void World_Physics_Frame(world_t *world, double frametime, double gravity)
 {
+#ifdef USEODE
        prvm_prog_t *prog = world->prog;
        double tdelta, tdelta2, tdelta3, simulationtime, collisiontime;
 
        tdelta = Sys_DirtyTime();
-#ifdef USEODE
        if (world->physics.ode && physics_ode.integer)
        {
                int i;