]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'master' into terencehill/ca_ft_fixes
authorterencehill <piuntn@gmail.com>
Tue, 18 Jun 2013 15:33:00 +0000 (17:33 +0200)
committerterencehill <piuntn@gmail.com>
Tue, 18 Jun 2013 15:33:00 +0000 (17:33 +0200)
12 files changed:
.gitignore
balanceXPM.cfg
balanceXonotic.cfg
gamemodes.cfg
qcsrc/client/progs.src
qcsrc/common/command/generic.qc
qcsrc/common/test.qc [new file with mode: 0644]
qcsrc/common/test.qh [new file with mode: 0644]
qcsrc/menu/progs.src
qcsrc/server/cl_client.qc
qcsrc/server/progs.src
qcsrc/server/vehicles/bumblebee.qc

index 77433f6374c29c4437223195b77f85bda33a2146..2a4ad93a398acb5dc279416fa6fbd93e3cda5fae 100644 (file)
@@ -5,3 +5,4 @@ qcsrc/client/fteqcc.log
 qcsrc/menu/fteqcc.log
 qcsrc/server/fteqcc.log
 weapons.qc.tmp
+*.lno
index f8ffd03381281b57c46ffa236eb0a174956b6da0..9eebc5e867b11f4606ecca4aa7a02825bb374813 100644 (file)
@@ -530,7 +530,7 @@ set g_balance_nex_charge_minspeed 400
 set g_balance_nex_charge_maxspeed 800
 
 set g_balance_nex_switchdelay_drop 0.3
-set g_balance_nex_switchdelay_raise 0.3
+set g_balance_nex_switchdelay_raise 0.25
 
 set g_balance_nex_reload_ammo 0 //default: 25
 set g_balance_nex_reload_time 2
index ca9d32c1dddcce2c588bbdf4fe2ad369d13f4182..fa4795cbf8768d340af609ccaaf244ca497f79a5 100644 (file)
@@ -530,7 +530,7 @@ set g_balance_nex_charge_minspeed 400
 set g_balance_nex_charge_maxspeed 800
 
 set g_balance_nex_switchdelay_drop 0.3
-set g_balance_nex_switchdelay_raise 0.3
+set g_balance_nex_switchdelay_raise 0.25
 
 set g_balance_nex_reload_ammo 0 //default: 25
 set g_balance_nex_reload_time 2
index bd2a91c42d192df4dafe16bc953f0adfec1b3a5f..2b032f773f7ceeb17361678a0d41227cd154fb23 100644 (file)
@@ -89,7 +89,7 @@ seta g_nexball_goalleadlimit -1 "Nexball goal lead limit overriding the mapinfo
 // =================================
 // when variables are set to anything other than 0, they take over the global setting...
 // to force disable delay or waves, set them to 0.125
-set g_ctf_respawn_delay 0
+set g_ctf_respawn_delay 5
 set g_ctf_respawn_waves 0
 set g_ctf_weapon_stay 0
 set g_dm_respawn_delay 0
index 3b8aa1bace9adc8970b782b4388416bda44dadc5..114f0a5b5c77fdd666db5ae4953b653fa40302e5 100644 (file)
@@ -16,6 +16,7 @@ Defs.qc
 
 ../common/teams.qh
 ../common/util.qh
+../common/test.qh
 ../common/counting.qh
 ../common/items.qh
 ../common/explosion_equation.qh
@@ -99,6 +100,7 @@ prandom.qc
 bgmscript.qc
 noise.qc
 
+../common/test.qc
 ../common/util.qc
 ../common/notifications.qc
 ../common/command/markup.qc
index 3059916c61ba4445c9b0da907b187d36a817adc4..143f3bd78c03591919a40be9aebe3d90d479f172 100644 (file)
@@ -525,6 +525,32 @@ void GenericCommand_settemp_restore(float request, float argc)
        }
 }
 
+void GenericCommand_runtest(float request, float argc)
+{
+       switch(request)
+       {
+               case CMD_REQUEST_COMMAND:
+               {
+                       if(argc > 1)
+                       {
+                               float i;
+                               for(i = 1; i < argc; ++i)
+                                       TEST_Run(argv(i));
+                       }
+                       else
+                               TEST_RunAll();
+                       return;
+               }
+                       
+               default:
+               case CMD_REQUEST_USAGE:
+               {
+                       print(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " [function to run]"));
+                       return;
+               }
+       }
+}
+
 /* use this when creating a new command, making sure to place it in alphabetical order... also,
 ** ADD ALL NEW COMMANDS TO commands.cfg WITH PROPER ALIASES IN THE SAME FASHION!
 void GenericCommand_(float request)
@@ -565,6 +591,7 @@ void GenericCommand_(float request)
        GENERIC_COMMAND("rpn", GenericCommand_rpn(request, arguments, command), "RPN calculator") \
        GENERIC_COMMAND("settemp", GenericCommand_settemp(request, arguments), "Temporarily set a value to a cvar which is restored later") \
        GENERIC_COMMAND("settemp_restore", GenericCommand_settemp_restore(request, arguments), "Restore all cvars set by settemp command") \
+       GENERIC_COMMAND("runtest", GenericCommand_runtest(request, arguments), "Run unit tests") \
        /* nothing */
 
 void GenericCommand_macro_help()
diff --git a/qcsrc/common/test.qc b/qcsrc/common/test.qc
new file mode 100644 (file)
index 0000000..15193fd
--- /dev/null
@@ -0,0 +1,56 @@
+float TEST_failed;
+float TEST_ok;
+
+void TEST_Fail(string cond)
+{
+       print(sprintf("Assertion failed: ", cond));
+       //backtrace();
+       ++TEST_failed;
+}
+
+void TEST_OK()
+{
+       TEST_ok = TRUE;
+}
+
+float TEST_RunAll()
+{
+       float f = 0;
+       float n = numentityfields();
+       float i;
+       for(i = 0; i < n; ++i)
+       {
+               string name = entityfieldname(i);
+               if(substring(name, 0, 6) == "_TEST_")
+                       if(!TEST_Run(substring(name, 6, -1)))
+                               ++f;
+       }
+       if(f)
+       {
+               print(sprintf("%d tests failed\n", f));
+               return 1;
+       }
+       else
+       {
+               print(sprintf("All tests OK\n", f));
+               return 0;
+       }
+}
+
+float TEST_Run(string s)
+{
+       print(sprintf("%s: testing...\n", s));
+       TEST_failed = TEST_ok = 0;
+       callfunction(strcat("_TEST_", s));
+       if(TEST_failed > 0)
+       {
+               print(sprintf("%s: %d items failed.\n", s, TEST_failed));
+               return 0;
+       }
+       else if(!TEST_ok)
+       {
+               print(sprintf("%s: did not complete.\n", s));
+               return 0;
+       }
+       return 1;
+}
diff --git a/qcsrc/common/test.qh b/qcsrc/common/test.qh
new file mode 100644 (file)
index 0000000..ff442ce
--- /dev/null
@@ -0,0 +1,7 @@
+#define TEST_Check(cond) do { if(!(cond)) TEST_Fail(#cond); } while(0)
+
+void TEST_OK();
+void TEST_Fail(string cond);
+
+float TEST_RunAll();
+float TEST_Run(string test);
index 36905e17ad5be250f3fd0838cb4ed118a8850928..3036278c1fcfbe09ed31da9f56795e2be7f8dbe6 100644 (file)
@@ -10,6 +10,7 @@ config.qh
 
 ../warpzonelib/mathlib.qh
 ../common/util.qh
+../common/test.qh
 
 oo/base.h
 
@@ -37,6 +38,7 @@ oo/implementation.h
        classes.c
 
 ../common/util.qc
+../common/test.qc
 ../common/command/markup.qc
 ../common/command/rpn.qc
 ../common/command/generic.qc
index 036bb45fb6dc48f029212faead961db052d00d12..c687c4502c33ae7c7ec9c8c69fc95559f6d2a788 100644 (file)
@@ -1418,7 +1418,7 @@ void player_powerups (void)
 
        self.effects &~= (EF_RED | EF_BLUE | EF_ADDITIVE | EF_FULLBRIGHT | EF_FLAME | EF_NODEPTHTEST);
 
-       if(self.alpha < 0 || self.deadflag) // don't apply the flags if the player is gibbed
+       if((self.alpha < 0 || self.deadflag) && !self.vehicle) // don't apply the flags if the player is gibbed
                return;
 
        Fire_ApplyDamage(self);
index df5623f0535a42bd3c5b1a4b04baa0b516aa57b8..367e8609ded2741ab10a74503dbf7888a82bd1a6 100644 (file)
@@ -15,6 +15,7 @@ sys-post.qh
 ../common/constants.qh
 ../common/teams.qh
 ../common/util.qh
+../common/test.qh
 ../common/counting.qh
 ../common/items.qh
 ../common/explosion_equation.qh
@@ -256,6 +257,7 @@ mutators/mutator_touchexplode.qc
 ../warpzonelib/server.qc
 
 ../common/animdecide.qc
+../common/test.qc
 ../common/util.qc
 ../common/notifications.qc
 
index a530680632592cb5158e8d430b938e57fe30beb8..4330966dc7894f2b959b4c51ceedaa302e56e4f4 100644 (file)
@@ -685,43 +685,14 @@ void bumb_exit(float eject)
        
        spot = vehicles_findgoodexit(spot);
        
+       // Hide beam
+       if(self.gun3.enemy || !wasfreed(self.gun3.enemy)) {
+               self.gun3.enemy.effects |= EF_NODRAW;
+    }
 
        self.owner.velocity = 0.75 * self.vehicle.velocity + normalize(spot - self.vehicle.origin) * 200;
        self.owner.velocity_z += 10;
        setorigin(self.owner, spot);
-
-       /*if(eject)
-       {
-           spot = self.origin + v_forward * 100 + '0 0 64';
-           spot = vehicles_findgoodexit(spot);
-           //setorigin(self.owner , spot);
-           self.owner.velocity = (v_up + v_forward * 0.25) * 250;
-           self.owner.oldvelocity = self.owner.velocity;
-       }
-       else
-       {
-               if(vlen(self.velocity) > autocvar_g_vehicle_bumblebee_speed_forward * 0.5)              
-               {
-                       if(vlen(self.velocity) > autocvar_sv_maxairspeed)
-                               self.owner.velocity = normalize(self.velocity) * autocvar_sv_maxairspeed;
-                       else
-                               self.owner.velocity = self.velocity + v_forward * 100;
-                       
-                       self.owner.velocity_z += 200;
-                       spot = self.origin + v_forward * 128 + '0 0 32';
-                       spot = vehicles_findgoodexit(spot);
-               }
-               else
-               {
-                       self.owner.velocity = self.velocity * 0.5;
-                       self.owner.velocity_z += 10;
-                       spot = self.origin - v_forward * 300 + '0 0 32';
-                       spot = vehicles_findgoodexit(spot);
-               }
-           self.owner.oldvelocity = self.owner.velocity;
-           //setorigin(self.owner , spot);
-       }
-       */
        
        antilag_clear(self.owner);
     self.owner = world;