]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add an option to override the default physics set (useful for using cvar based physic...
authorMario <zacjardine@y7mail.com>
Wed, 15 Apr 2015 23:58:45 +0000 (09:58 +1000)
committerMario <zacjardine@y7mail.com>
Wed, 15 Apr 2015 23:58:45 +0000 (09:58 +1000)
physics.cfg
qcsrc/server/autocvars.qh
qcsrc/server/cl_physics.qc

index 0c442ad950f51378965a474efbbd2f9e27fa7f66..3acf0001b8524d680a286e4d9ddbb2868d40e246 100644 (file)
@@ -6,10 +6,11 @@
 // ==============
 //  main options
 // ==============
-seta cl_physics default "client selected physics set"
+seta cl_physics "default" "client selected physics set"
 
 set g_physics_clientselect 0 "allow clients to select their physics set"
 set g_physics_clientselect_options "xonotic nexuiz quake warsow defrag quake3 vecxis quake2"
+set g_physics_clientselect_default "" "override default physics"
 
 // =========
 //  Xonotic
index 5107bd5a9d8e28ce4d4cc04980770f2b7f8a214f..4696827b27769ae6213b84a1920e2fa06953cae9 100644 (file)
@@ -836,6 +836,7 @@ float autocvar_g_spawn_near_teammate_ignore_spawnpoint_check_health;
 float autocvar_g_spawn_near_teammate_ignore_spawnpoint_closetodeath;
 float autocvar_g_physics_clientselect;
 string autocvar_g_physics_clientselect_options;
+string autocvar_g_physics_clientselect_default;
 float autocvar_g_buffs_waypoint_distance;
 float autocvar_g_buffs_randomize;
 float autocvar_g_buffs_random_lifetime;
index 81c3cfd8b2719b9a66fd837950b210c6c9cd45fd..574d7f54b53fa0c9a38a64853bd5b8fb1735a4ac 100644 (file)
 // client side physics
 float Physics_Valid(string thecvar)
 {
-       if(!autocvar_g_physics_clientselect) { return FALSE; }
+       if(!autocvar_g_physics_clientselect) { return false; }
 
        string l = strcat(" ", autocvar_g_physics_clientselect_options, " ");
 
        if(strstrofs(l, strcat(" ", thecvar, " "), 0) >= 0)
-               return TRUE;
+               return true;
 
-       return FALSE;
+       return false;
 }
 
 float Physics_ClientOption(entity pl, string option)
 {
-       if (Physics_Valid(pl.cvar_cl_physics))
+       if(Physics_Valid(pl.cvar_cl_physics))
        {
                string var = sprintf("g_physics_%s_%s", pl.cvar_cl_physics, option);
-               if (cvar_type(var) & 1)
+               if(cvar_type(var) & 1)
+                       return cvar(var);
+       }
+       if(autocvar_g_physics_clientselect && autocvar_g_physics_clientselect_default)
+       {
+               string var = sprintf("g_physics_%s_%s", autocvar_g_physics_clientselect_default, option);
+               if(cvar_type(var) & 1)
                        return cvar(var);
        }
        return cvar(strcat("sv_", option));