]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Change jetpack to activate when pressing jump in the air
authorTimePath <andrew.hardaker1995@gmail.com>
Wed, 17 Dec 2014 09:03:49 +0000 (20:03 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Wed, 17 Dec 2014 09:03:49 +0000 (20:03 +1100)
qcsrc/common/weapons/w_hook.qc
qcsrc/server/cl_physics.qc
qcsrc/server/g_hook.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/mutators/mutator_multijump.qc
qcsrc/server/mutators/mutator_nades.qc

index 931d3e0ad17b13b7e0641f35026e097bea0265ef..3713ca9c75c417fe91dddbd2f3b44d0fc24e696e 100644 (file)
@@ -186,7 +186,7 @@ float W_Hook(float req)
                }
                case WR_THINK:
                {
-                       if(self.BUTTON_ATCK || (!(self.items & IT_JETPACK) && self.BUTTON_HOOK))
+                       if(self.BUTTON_ATCK || self.BUTTON_HOOK)
                        {
                                if(!self.hook)
                                if(!(self.hook_state & HOOK_WAITING_FOR_RELEASE))
@@ -260,7 +260,7 @@ float W_Hook(float req)
                        if(self.BUTTON_CROUCH)
                        {
                                self.hook_state &= ~HOOK_PULLING;
-                               if(self.BUTTON_ATCK || (!(self.items & IT_JETPACK) && self.BUTTON_HOOK))
+                               if(self.BUTTON_ATCK || self.BUTTON_HOOK)
                                        self.hook_state &= ~HOOK_RELEASING;
                                else
                                        self.hook_state |= HOOK_RELEASING;
@@ -270,7 +270,7 @@ float W_Hook(float req)
                                self.hook_state |= HOOK_PULLING;
                                self.hook_state &= ~HOOK_RELEASING;
 
-                               if(self.BUTTON_ATCK || (!(self.items & IT_JETPACK) && self.BUTTON_HOOK))
+                               if(self.BUTTON_ATCK || self.BUTTON_HOOK)
                                {
                                        // already fired
                                        if(self.hook)
index 1d47536608b3446f97663a2d4906b7091bb0412c..9d67174d2b35e158e12f845752f760c5fc8a37ac 100644 (file)
 PlayerJump
 
 When you press the jump key
+returns TRUE if handled
 =============
 */
-void PlayerJump (void)
+float PlayerJump (void)
 {
        if(self.frozen)
-               return; // no jumping in freezetag when frozen
+               return TRUE; // no jumping in freezetag when frozen
 
        if(self.player_blocked)
-               return; // no jumping while blocked
+               return TRUE; // no jumping while blocked
 
        float doublejump = FALSE;
        float mjumpheight = autocvar_sv_jumpvelocity;
@@ -31,7 +32,7 @@ void PlayerJump (void)
        player_multijump = doublejump;
        player_jumpheight = mjumpheight;
        if(MUTATOR_CALLHOOK(PlayerJump))
-               return;
+               return TRUE;
 
        doublejump = player_multijump;
        mjumpheight = player_jumpheight;
@@ -54,16 +55,16 @@ void PlayerJump (void)
        if (self.waterlevel >= WATERLEVEL_SWIMMING)
        {
                self.velocity_z = self.stat_sv_maxspeed * 0.7;
-               return;
+               return TRUE;
        }
 
        if (!doublejump)
                if (!(self.flags & FL_ONGROUND))
-                       return;
+                       return !(self.flags & FL_JUMPRELEASED);
 
        if(self.cvar_cl_movement_track_canjump)
                if (!(self.flags & FL_JUMPRELEASED))
-                       return;
+                       return TRUE;
 
        // sv_jumpspeedcap_min/sv_jumpspeedcap_max act as baseline
        // velocity bounds.  Final velocity is bound between (jumpheight *
@@ -122,6 +123,7 @@ void PlayerJump (void)
 
        self.restart_jump = -1; // restart jump anim next time
        // value -1 is used to not use the teleport bit (workaround for tiny hitch when re-jumping)
+       return TRUE;
 }
 void CheckWaterJump()
 {
@@ -151,13 +153,23 @@ void CheckWaterJump()
                }
        }
 }
+
+// Hack: shouldn't need to know about this
+.float multijump_count;
 void CheckPlayerJump()
 {
        if (self.BUTTON_JUMP)
-               PlayerJump ();
+       {
+               if (!PlayerJump() || self.multijump_count > 0)
+               {
+                       self.items |= IT_USING_JETPACK;
+               }
+       }
        else
+       {
                self.flags |= FL_JUMPRELEASED;
-
+               self.items &= ~IT_USING_JETPACK;
+       }
        if (self.waterlevel == WATERLEVEL_SWIMMING)
                CheckWaterJump ();
 }
@@ -1018,7 +1030,7 @@ void SV_PlayerPhysics()
                        PM_Accelerate(wishdir, wishspeed, wishspeed, autocvar_sv_accelerate*maxspd_mod, 1, 0, 0, 0);
                }
        }
-       else if ((self.items & IT_JETPACK) && self.BUTTON_HOOK && (!autocvar_g_jetpack_fuel || self.ammo_fuel >= 0.01 || self.items & IT_UNLIMITED_WEAPON_AMMO) && !self.frozen)
+       else if ((self.items & IT_USING_JETPACK) && (!autocvar_g_jetpack_fuel || self.ammo_fuel >= 0.01 || self.items & IT_UNLIMITED_WEAPON_AMMO) && !self.frozen)
        {
                //makevectors(self.v_angle_y * '0 1 0');
                makevectors(self.v_angle);
@@ -1119,7 +1131,7 @@ void SV_PlayerPhysics()
        else if (self.flags & FL_ONGROUND)
        {
                // we get here if we ran out of ammo
-               if((self.items & IT_JETPACK) && self.BUTTON_HOOK && !(buttons_prev & 32) && self.ammo_fuel < 0.01)
+               if((self.items & IT_USING_JETPACK) && !(buttons_prev & 2) && self.ammo_fuel < 0.01)
                        sprint(self, "You don't have any fuel for the ^2Jetpack\n");
 
                // walking
@@ -1188,7 +1200,7 @@ void SV_PlayerPhysics()
        {
                float wishspeed0;
                // we get here if we ran out of ammo
-               if((self.items & IT_JETPACK) && self.BUTTON_HOOK && !(buttons_prev & 32) && self.ammo_fuel < 0.01)
+               if((self.items & IT_USING_JETPACK) && !(buttons_prev & 2) && self.ammo_fuel < 0.01)
                        sprint(self, "You don't have any fuel for the ^2Jetpack\n");
 
                if(maxspd_mod < 1)
index 90b91ad3d0880158f339c8c344e9985a4688592f..eab482618bc3833d47cd74250cd706fbf827063b 100644 (file)
@@ -407,7 +407,7 @@ void GrapplingHookFrame()
                        //self.hook_state &= ~HOOK_RELEASING;
                }
        }
-       else if(!(self.items & IT_JETPACK) && !g_grappling_hook && self.switchweapon != WEP_HOOK)
+       else if(!g_grappling_hook && self.switchweapon != WEP_HOOK)
        {
                if(self.BUTTON_HOOK && !self.hook_switchweapon)
                        W_SwitchWeapon(WEP_HOOK);
index 71294f1942affd51f53f1c37183a580a63d8122f..7eec95d0322d5e302cc288f2b4b8d134ed1c6309 100644 (file)
@@ -862,7 +862,6 @@ void readplayerstartcvars()
 
        if ((start_items & IT_JETPACK) || (g_grappling_hook && (start_weapons & WEPSET_HOOK)))
        {
-               g_grappling_hook = 0; // these two can't coexist, as they use the same button
                start_items |= IT_FUEL_REGEN;
                start_ammo_fuel = max(start_ammo_fuel, cvar("g_balance_fuel_rotstable"));
                warmup_start_ammo_fuel = max(warmup_start_ammo_fuel, cvar("g_balance_fuel_rotstable"));
index 50741dc20b4f3cadd1d2d75ff1b0ce1f5180a4c5..868ddf246e0b5f0c88c93e7b594e412238110df7 100644 (file)
@@ -4,12 +4,7 @@
 MUTATOR_HOOKFUNCTION(multijump_PlayerPhysics)
 {
        if(self.flags & FL_ONGROUND)
-       {
-               if (autocvar_g_multijump > 0)
-                       self.multijump_count = 0;
-               else
-                       self.multijump_count = -2; // the cvar value for infinite jumps is -1, so this needs to be smaller
-       }
+               self.multijump_count = 0;
 
        return FALSE;
 }
@@ -21,7 +16,7 @@ MUTATOR_HOOKFUNCTION(multijump_PlayerJump)
        else
                self.multijump_ready = FALSE;
 
-       if(!player_multijump && self.multijump_ready && self.multijump_count < autocvar_g_multijump && self.velocity_z > autocvar_g_multijump_speed)
+       if(!player_multijump && self.multijump_ready && (autocvar_g_multijump == -1 || self.multijump_count < autocvar_g_multijump) && self.velocity_z > autocvar_g_multijump_speed)
        {
                if (autocvar_g_multijump)
                {
@@ -55,8 +50,7 @@ MUTATOR_HOOKFUNCTION(multijump_PlayerJump)
                                        self.velocity_y = wishdir_y * curspeed;
                                        // keep velocity_z unchanged!
                                }
-                               if (autocvar_g_multijump > 0)
-                                       self.multijump_count += 1;
+                               self.multijump_count += 1;
                        }
                }
                self.multijump_ready = FALSE; // require releasing and pressing the jump button again for the next jump
index 70c4578bd02baea2c19b7185add6ddaade69913b..ef66e713631d72e9ca0871138d0aec934954d4ad 100644 (file)
@@ -873,8 +873,8 @@ MUTATOR_HOOKFUNCTION(nades_PlayerPreThink)
        float key_pressed = self.BUTTON_HOOK;
        float time_score;
 
-       if(g_grappling_hook || client_hasweapon(self, WEP_HOOK, FALSE, FALSE) || (weaponsInMap & WEPSET_HOOK) || g_jetpack || self.items & IT_JETPACK)
-               key_pressed = self.button16; // if hook/jetpack is enabled, use an alternate key
+       if(g_grappling_hook || client_hasweapon(self, WEP_HOOK, FALSE, FALSE) || (weaponsInMap & WEPSET_HOOK))
+               key_pressed = self.button16; // if hook is enabled, use an alternate key
                
        if(self.nade)
        {