From: Mario Date: Tue, 19 Jul 2016 19:58:50 +0000 (+1000) Subject: Implement reverse thrusting with jetpack when crouching (disabled by default) X-Git-Tag: xonotic-v0.8.2~700^2~58 X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=dded21838e133d00611a7cdd57e8ee0827452bf2 Implement reverse thrusting with jetpack when crouching (disabled by default) --- diff --git a/balance-mario.cfg b/balance-mario.cfg index 544ad03372..9995e5ec5c 100644 --- a/balance-mario.cfg +++ b/balance-mario.cfg @@ -208,6 +208,7 @@ set g_jetpack_maxspeed_side 1200 "max speed of the jetpack in xy direction" set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction" set g_jetpack_fuel 8 "fuel per second for jetpack" set g_jetpack_attenuation 2 "jetpack sound attenuation" +set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack" set g_grappling_hook_tarzan 2 // 2: can also pull players set g_balance_grapplehook_speed_fly 1800 diff --git a/balance-nexuiz25.cfg b/balance-nexuiz25.cfg index f49e50cce2..ebce2fabe7 100644 --- a/balance-nexuiz25.cfg +++ b/balance-nexuiz25.cfg @@ -208,6 +208,7 @@ set g_jetpack_maxspeed_side 1500 "max speed of the jetpack in xy direction" set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction" set g_jetpack_fuel 8 "fuel per second for jetpack" set g_jetpack_attenuation 2 "jetpack sound attenuation" +set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack" set g_grappling_hook_tarzan 2 // 2: can also pull players set g_balance_grapplehook_speed_fly 1800 diff --git a/balance-overkill.cfg b/balance-overkill.cfg index 1a4b9bb940..7571001c67 100644 --- a/balance-overkill.cfg +++ b/balance-overkill.cfg @@ -208,6 +208,7 @@ set g_jetpack_maxspeed_side 1200 "max speed of the jetpack in xy direction" set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction" set g_jetpack_fuel 8 "fuel per second for jetpack" set g_jetpack_attenuation 2 "jetpack sound attenuation" +set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack" set g_grappling_hook_tarzan 2 // 2: can also pull players set g_balance_grapplehook_speed_fly 1800 diff --git a/balance-samual.cfg b/balance-samual.cfg index 08e38f1671..58a0f37584 100644 --- a/balance-samual.cfg +++ b/balance-samual.cfg @@ -208,6 +208,7 @@ set g_jetpack_maxspeed_side 1200 "max speed of the jetpack in xy direction" set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction" set g_jetpack_fuel 8 "fuel per second for jetpack" set g_jetpack_attenuation 2 "jetpack sound attenuation" +set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack" set g_grappling_hook_tarzan 2 // 2: can also pull players set g_balance_grapplehook_speed_fly 1800 diff --git a/balance-xdf.cfg b/balance-xdf.cfg index e816f89abd..ff2ec18716 100644 --- a/balance-xdf.cfg +++ b/balance-xdf.cfg @@ -208,6 +208,7 @@ set g_jetpack_maxspeed_side 1200 "max speed of the jetpack in xy direction" set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction" set g_jetpack_fuel 8 "fuel per second for jetpack" set g_jetpack_attenuation 2 "jetpack sound attenuation" +set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack" set g_grappling_hook_tarzan 2 // 2: can also pull players set g_balance_grapplehook_speed_fly 1800 diff --git a/balance-xonotic.cfg b/balance-xonotic.cfg index aafb810449..e9fb9994dd 100644 --- a/balance-xonotic.cfg +++ b/balance-xonotic.cfg @@ -208,6 +208,7 @@ set g_jetpack_maxspeed_side 1200 "max speed of the jetpack in xy direction" set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction" set g_jetpack_fuel 8 "fuel per second for jetpack" set g_jetpack_attenuation 2 "jetpack sound attenuation" +set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack" set g_grappling_hook_tarzan 2 // 2: can also pull players set g_balance_grapplehook_speed_fly 1800 diff --git a/balance-xpm.cfg b/balance-xpm.cfg index 342d3e068e..0c24cf2067 100644 --- a/balance-xpm.cfg +++ b/balance-xpm.cfg @@ -208,6 +208,7 @@ set g_jetpack_maxspeed_side 1200 "max speed of the jetpack in xy direction" set g_jetpack_maxspeed_up 600 "max speed of the jetpack in z direction" set g_jetpack_fuel 8 "fuel per second for jetpack" set g_jetpack_attenuation 2 "jetpack sound attenuation" +set g_jetpack_reverse_thrust 0 "if not 0, downward acceleration when crouching with the jetpack" set g_grappling_hook_tarzan 2 // 2: can also pull players set g_balance_grapplehook_speed_fly 1800 diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index d68c26ceab..2bec587e04 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -1013,11 +1013,15 @@ void PM_jetpack(entity this, float maxspd_mod) float a_up = PHYS_JETPACK_ACCEL_UP(this); float a_add = PHYS_JETPACK_ANTIGRAVITY(this) * PHYS_GRAVITY(this); + if(PHYS_JETPACK_REVERSE_THRUST(this) && PHYS_INPUT_BUTTON_CROUCH(self)) { a_up = PHYS_JETPACK_REVERSE_THRUST(this); } + wishvel_x *= a_side; wishvel_y *= a_side; wishvel_z *= a_up; wishvel_z += a_add; + if(PHYS_JETPACK_REVERSE_THRUST(this) && PHYS_INPUT_BUTTON_CROUCH(self)) { wishvel_z *= -1; } + float best = 0; ////////////////////////////////////////////////////////////////////////////////////// // finding the maximum over all vectors of above form diff --git a/qcsrc/common/physics/player.qh b/qcsrc/common/physics/player.qh index fd1b610de6..de76bb8d8c 100644 --- a/qcsrc/common/physics/player.qh +++ b/qcsrc/common/physics/player.qh @@ -67,6 +67,7 @@ bool IsFlying(entity a); #define PHYS_JETPACK_FUEL(s) STAT(JETPACK_FUEL, s) #define PHYS_JETPACK_MAXSPEED_SIDE(s) STAT(JETPACK_MAXSPEED_SIDE, s) #define PHYS_JETPACK_MAXSPEED_UP(s) STAT(JETPACK_MAXSPEED_UP, s) +#define PHYS_JETPACK_REVERSE_THRUST(s) STAT(JETPACK_REVERSE_THRUST, s) #define PHYS_JUMPSPEEDCAP_DISABLE_ONRAMPS(s) STAT(MOVEVARS_JUMPSPEEDCAP_DISABLE_ONRAMPS, s) #define PHYS_JUMPSTEP(s) STAT(MOVEVARS_JUMPSTEP, s) diff --git a/qcsrc/common/stats.qh b/qcsrc/common/stats.qh index 2c471f0db3..2ed679e30f 100644 --- a/qcsrc/common/stats.qh +++ b/qcsrc/common/stats.qh @@ -227,6 +227,7 @@ REGISTER_STAT(JETPACK_ANTIGRAVITY, float, autocvar_g_jetpack_antigravity) REGISTER_STAT(JETPACK_FUEL, float, autocvar_g_jetpack_fuel) REGISTER_STAT(JETPACK_MAXSPEED_SIDE, float, autocvar_g_jetpack_maxspeed_side) REGISTER_STAT(JETPACK_MAXSPEED_UP, float, autocvar_g_jetpack_maxspeed_up) +REGISTER_STAT(JETPACK_REVERSE_THRUST, float, autocvar_g_jetpack_reverse_thrust) REGISTER_STAT(MOVEVARS_HIGHSPEED, float, autocvar_g_movement_highspeed) diff --git a/qcsrc/server/autocvars.qh b/qcsrc/server/autocvars.qh index 314858780b..937a6e2a87 100644 --- a/qcsrc/server/autocvars.qh +++ b/qcsrc/server/autocvars.qh @@ -197,6 +197,7 @@ float autocvar_g_jetpack_antigravity; int autocvar_g_jetpack_fuel; float autocvar_g_jetpack_maxspeed_side; float autocvar_g_jetpack_maxspeed_up; +float autocvar_g_jetpack_reverse_thrust; #define autocvar_g_maplist cvar_string("g_maplist") bool autocvar_g_maplist_check_waypoints; int autocvar_g_maplist_index;