From aa0aa4e6ac09630b33633ffba420eb966fe00d9c Mon Sep 17 00:00:00 2001 From: tankefugl Date: Sat, 19 Nov 2005 16:29:07 +0000 Subject: [PATCH] - Reworked jump: Pressing and holding jump now allows the player to jump once when hitting the ground next time. git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@358 67975925-1194-0748-b3d5-c16f83f1a3a1 --- dev/3.2-movements/source/pm_shared/pm_shared.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/dev/3.2-movements/source/pm_shared/pm_shared.cpp b/dev/3.2-movements/source/pm_shared/pm_shared.cpp index 1351ff93..0037a619 100644 --- a/dev/3.2-movements/source/pm_shared/pm_shared.cpp +++ b/dev/3.2-movements/source/pm_shared/pm_shared.cpp @@ -310,6 +310,7 @@ static char grgchTextureType[CTEXTURESMAX]; int g_onladder[MAX_CLIENTS]; bool gIsJetpacking[MAX_CLIENTS]; +bool gCanJump[MAX_CLIENTS]; // Borrowed from Quake1. @@ -4659,7 +4660,9 @@ bool PM_LeapMove() vec3_t forward, right, up; AngleVectors(pmove->angles, forward, right, up); + gCanJump[pmove->player_index] = true; PM_Jump(); + gCanJump[pmove->player_index] = false; vec3_t theAbilityVelocity; VectorScale(forward, theScalar, theAbilityVelocity); @@ -5186,6 +5189,11 @@ void PM_Jump (void) qboolean tfc = false; qboolean cansuperjump = false; + + if ((pmove->cmd.buttons & IN_JUMP) && !(pmove->oldbuttons & IN_JUMP)) + { + gCanJump[pmove->player_index] = true; + } if (pmove->dead || GetHasUpgrade(pmove->iuser4, MASK_ENSNARED)) { @@ -5307,7 +5315,8 @@ void PM_Jump (void) // if ( pmove->oldbuttons & IN_JUMP && (pmove->velocity[0] == 0 || !theIsAlien || pmove->iuser3 == AVH_USER3_ALIEN_PLAYER3) ) //return; // don't pogo stick - if ( pmove->oldbuttons & IN_JUMP ) +// if ( pmove->oldbuttons & IN_JUMP ) + if (gCanJump[pmove->player_index] == false) return; // don't pogo stick // In the air now. @@ -5356,6 +5365,7 @@ void PM_Jump (void) { pmove->velocity[2] = sqrt(2 * 800 * 45.0); // Flag that we jumped. + gCanJump[pmove->player_index] = false; } pmove->oldbuttons |= IN_JUMP; // don't jump again until released