]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add another jetpack mode
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 21 Dec 2014 06:28:47 +0000 (17:28 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 21 Dec 2014 06:28:47 +0000 (17:28 +1100)
defaultXonotic.cfg
qcsrc/menu/xonotic/dialog_settings_input.c
qcsrc/server/cl_physics.qc

index 9e10fc194d3482a3fe0297da90c2760cb0f468c7..a1e9091f26e437927de8fe1d6dd64ed0b1e07581 100644 (file)
@@ -1026,7 +1026,7 @@ seta cl_clippedspectating 1 "movement collision for spectators so that you can't
 
 seta cl_autoscreenshot 1 "Take a screenshot upon the end of a match... 0 = Disable completely, 1 = Allow sv_autoscreenshot to take a screenshot when requested, 2 = Always take an autoscreenshot anyway."
 
-seta cl_jetpack_jump 1 "Activate jetpack by pressing jump in the air. 0 = Disable, 1 = Enable"
+seta cl_jetpack_jump 1 "Activate jetpack by pressing jump in the air. 0 = Disable, 1 = Stop when touching ground, 2 = Enable"
 
 // must be at the bottom of this file:
 
index 0fb0e1ccdee14f68aba283d734a5bdf59659c0db..12a662cf9ea74df91c918cb67f5cbaaf50b5e52a 100644 (file)
@@ -89,7 +89,12 @@ void XonoticInputSettingsTab_fill(entity me)
                me.TD(me, 1, 3, e = makeXonoticCheckBox(1, "cl_movement_track_canjump", _("Automatically repeat jumping if holding jump")));
                        e.sendCvars = TRUE;
        me.TR(me);
-               me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "cl_jetpack_jump", _("Activate jetpack by pressing jump in the air")));
+               me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Jetpack on jump:")));
+               me.TD(me, 1, 2, e = makeXonoticTextSlider("cl_jetpack_jump"));
+                       e.addValue(e, _("Disabled"), "0");
+                       e.addValue(e, _("Air only"), "1");
+                       e.addValue(e, _("All"), "2");
+                       e.configureXonoticTextSliderValues(e);
                        e.sendCvars = TRUE;
        me.TR(me);
                if(cvar_type("joy_enable") & CVAR_TYPEFLAG_ENGINE)
index 91c91476d245279d72271104370bafcd3666d3ca..34e3e8f5d2791f7705bb70a24eade0e751a2ebaa 100644 (file)
@@ -159,24 +159,28 @@ void CheckWaterJump()
 .float multijump_count;
 void CheckPlayerJump()
 {
+       float was_flying = self.items & IT_USING_JETPACK;
+
+       if (self.cvar_cl_jetpack_jump < 2)
+               self.items &= ~IT_USING_JETPACK;
+
        if (self.BUTTON_JUMP || self.BUTTON_JETPACK)
        {
-               if (self.BUTTON_JUMP && (!PlayerJump() || self.multijump_count > 0) || self.BUTTON_JETPACK)
+               float air_jump = !PlayerJump() || self.multijump_count > 0; // PlayerJump() has important side effects
+               float activate = self.cvar_cl_jetpack_jump && air_jump && self.BUTTON_JUMP || self.BUTTON_JETPACK;
+               float has_fuel = !autocvar_g_jetpack_fuel || self.ammo_fuel || self.items & IT_UNLIMITED_WEAPON_AMMO;
+               if (self.jetpack_stopped) { }
+               else if (!has_fuel)
                {
-                       if (self.cvar_cl_jetpack_jump || self.BUTTON_JETPACK)
-                       if (!self.jetpack_stopped && (!autocvar_g_jetpack_fuel || self.ammo_fuel > 0 || self.items & IT_UNLIMITED_WEAPON_AMMO) && !self.frozen)
-                       {
-                               self.items |= IT_USING_JETPACK;
-                       }
+                       if (was_flying)
+                               sprint(self, "You ran out of fuel for the ^2Jetpack\n");
                        else
-                       {
-                               // we get here if we ran out of ammo
-                               if (!self.jetpack_stopped)
-                                       sprint(self, "You don't have any fuel for the ^2Jetpack\n");
-                               self.jetpack_stopped = TRUE;
-                               self.items &= ~IT_USING_JETPACK;
-                       }
+                               sprint(self, "You don't have any fuel for the ^2Jetpack\n");
+                       self.jetpack_stopped = TRUE;
+                       self.items &= ~IT_USING_JETPACK;
                }
+               else if (activate && !self.frozen)
+                       self.items |= IT_USING_JETPACK;
        }
        else
        {
@@ -780,8 +784,6 @@ void SV_PlayerPhysics()
                bot_think();
        }
 
-       self.items &= ~IT_USING_JETPACK;
-
        if(IS_PLAYER(self))
        {
                if(self.race_penalty)