From: TimePath Date: Sun, 21 Dec 2014 06:28:47 +0000 (+1100) Subject: Add another jetpack mode X-Git-Tag: xonotic-v0.8.0~52^2~2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=e3127e2d7200bcd9f746a8e48725151d1cc064c6;p=xonotic%2Fxonotic-data.pk3dir.git Add another jetpack mode --- diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index 9e10fc194..a1e9091f2 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -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: diff --git a/qcsrc/menu/xonotic/dialog_settings_input.c b/qcsrc/menu/xonotic/dialog_settings_input.c index 0fb0e1ccd..12a662cf9 100644 --- a/qcsrc/menu/xonotic/dialog_settings_input.c +++ b/qcsrc/menu/xonotic/dialog_settings_input.c @@ -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) diff --git a/qcsrc/server/cl_physics.qc b/qcsrc/server/cl_physics.qc index 91c91476d..34e3e8f5d 100644 --- a/qcsrc/server/cl_physics.qc +++ b/qcsrc/server/cl_physics.qc @@ -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)