}
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)
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()
{
}
}
}
+
+// 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 ();
}
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);
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
{
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)
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)
{