// other aliases
alias +hook +button6
alias -hook -button6
+alias +jetpack +button10
+alias -jetpack -button10
alias use "impulse 21"
// for backwards compatibility
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 = Stop when touching ground, 2 = Enable"
+
// must be at the bottom of this file:
set g_bugrigs 0
seta cl_gentle_messages 0 "client side gentle mode (only replaces frag messages/centerprints)"
seta cl_gentle_damage 0 "client side gentle mode (only replaces damage flash); when set to 1, a white flash replaces the blood image, when set to 2, a randomily colored flash is used instead"
-set g_jetpack 0 "Jetpack mutator (uses the hook's button, can't coexist with the offhand hook, but only with the onhand one)"
+set g_jetpack 0 "Jetpack mutator"
set g_running_guns 0 "... or wonder, till it drives you mad, what would have followed if you had."
set g_bastet 0 "don't try"
"+moveright" "strafe right"
"+jump" "jump / swim"
"+crouch" "crouch / sink"
-"+hook" "off-hand hook / jet pack"
+"+hook" "off-hand hook"
+"+jetpack" "jet pack"
"" ""
"" "Attacking"
"+fire" "primary fire"
"+moveright" "rechts"
"+jump" "springen / schwimmen"
"+crouch" "ducken / sinken"
-"+hook" "Enterhaken / Jetpack"
+"+hook" "Enterhaken"
+"+jetpack" "Jetpack"
"" ""
"" "Angriff"
"+fire" "1. Feuermodus"
"+moveright" "derecha"
"+jump" "saltar / nadar"
"+crouch" "agacharse / bajar"
-"+hook" "gancho / jet pack"
+"+hook" "gancho"
+"+jetpack" "jet pack"
"" ""
"" "Ataque"
"+fire" "ataque primario"
"+moveright" "droite"
"+jump" "sauter / nager"
"+crouch" "s'accroupir / couler"
-"+hook" "grappin / jet pack"
+"+hook" "grappin"
+"+jetpack" "jet pack"
"" ""
"" "Attaque"
"+fire" "tir primaire"
"+moveright" "jobbra lépés"
"+jump" "ugrás / úszás"
"+crouch" "guggolás / süllyedés"
-"+hook" "kézi kampó / rakéta puttony"
+"+hook" "kézi kampó"
+"+jetpack" "rakéta puttony"
"" ""
"" "Tüzelés"
"+fire" "Elsődleges"
"+moveright" "a destra"
"+jump" "salta / risalire in acqua"
"+crouch" "abbassarsi / scendere in acqua"
-"+hook" "off-hand hook / jet pack"
+"+hook" "off-hand hook"
+"+jetpack" "jet pack"
"" ""
"" "Attacco"
"+fire" "fuoco primario"
"+moveright" "вправо"
"+jump" "прыжок / плыть"
"+crouch" "пригнуться / погрузиться"
-"+hook" "крюк / реактивный ранец"
+"+hook" "крюк"
+"+jetpack" "реактивный ранец"
"" ""
"" "Нападение"
"+fire" "основной огонь"
"+moveright" "крок праворуч"
"+jump" "стрибок / плисти нагору"
"+crouch" "присідання / занурення"
-"+hook" "гак / реактивний ранець"
+"+hook" "гак"
+"+jetpack" "реактивний ранець"
"" ""
"" "Бій"
"+fire" "основний вогонь"
}
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))
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;
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)
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, 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)
{
// Wazat's grappling hook
SetGrappleHookBindings();
+ // Jetpack binds
+ stuffcmd(self, "alias +jetpack +button10\n");
+ stuffcmd(self, "alias -jetpack -button10\n");
+
// get version info from player
stuffcmd(self, "cmd clientversion $gameversion\n");
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;
player_multijump = doublejump;
player_jumpheight = mjumpheight;
if(MUTATOR_CALLHOOK(PlayerJump))
- return;
+ return TRUE;
doublejump = player_multijump;
mjumpheight = player_jumpheight;
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 *
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()
{
}
}
}
+
+.float jetpack_stopped;
+// Hack: shouldn't need to know about this
+.float multijump_count;
void CheckPlayerJump()
{
- if (self.BUTTON_JUMP)
- PlayerJump ();
+ 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)
+ {
+ 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 (was_flying) // TODO: ran out of fuel message
+ Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
+ else
+ Send_Notification(NOTIF_ONE, self, MSG_INFO, INFO_JETPACK_NOFUEL);
+ self.jetpack_stopped = TRUE;
+ self.items &= ~IT_USING_JETPACK;
+ }
+ else if (activate && !self.frozen)
+ self.items |= IT_USING_JETPACK;
+ }
else
+ {
+ self.jetpack_stopped = FALSE;
+ self.items &= ~IT_USING_JETPACK;
+ }
+ if (!self.BUTTON_JUMP)
self.flags |= FL_JUMPRELEASED;
if (self.waterlevel == WATERLEVEL_SWIMMING)
bot_think();
}
- self.items &= ~IT_USING_JETPACK;
-
if(IS_PLAYER(self))
{
if(self.race_penalty)
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)
{
//makevectors(self.v_angle_y * '0 1 0');
makevectors(self.v_angle);
#define BUTTON_USE buttonuse
#define BUTTON_DRAG button8
#define BUTTON_ZOOMSCRIPT button9
+#define BUTTON_JETPACK button10
// Globals
.float cvar_cl_handicap;
.float cvar_cl_clippedspectating;
.float cvar_cl_autoscreenshot;
+.float cvar_cl_jetpack_jump;
.float cvar_cl_movement_track_canjump;
.float cvar_cl_newusekeysupported;
//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);
GetCvars_handleFloat(s, f, autoswitch, "cl_autoswitch");
GetCvars_handleFloat(s, f, cvar_cl_autoscreenshot, "cl_autoscreenshot");
+ GetCvars_handleFloat(s, f, cvar_cl_jetpack_jump, "cl_jetpack_jump");
GetCvars_handleString(s, f, cvar_g_xonoticversion, "g_xonoticversion");
GetCvars_handleFloat(s, f, cvar_cl_handicap, "cl_handicap");
GetCvars_handleFloat(s, f, cvar_cl_clippedspectating, "cl_clippedspectating");
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"));
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;
}
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)
{
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
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)
{
void spawnfunc_item_jetpack(void)
{
- if(g_grappling_hook)
- return; // sorry, but these two can't coexist (same button); spawn fuel instead
if(!self.ammo_fuel)
self.ammo_fuel = g_pickup_fuel_jetpack;
if(start_items & IT_JETPACK)