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: https://git.rm.cloudns.org/?a=commitdiff_plain;h=dded21838e133d00611a7cdd57e8ee0827452bf2;p=xonotic%2Fxonotic-data.pk3dir.git Implement reverse thrusting with jetpack when crouching (disabled by default) --- diff --git a/balance-mario.cfg b/balance-mario.cfg index 544ad0337..9995e5ec5 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 f49e50cce..ebce2fabe 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 1a4b9bb94..7571001c6 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 08e38f167..58a0f3758 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 e816f89ab..ff2ec1871 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 aafb81044..e9fb9994d 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 342d3e068..0c24cf206 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 d68c26cea..2bec587e0 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 fd1b610de..de76bb8d8 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 2c471f0db..2ed679e30 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 314858780..937a6e2a8 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;