lerk gliding on ground

This commit is contained in:
pierow 2021-02-04 19:40:24 -05:00
parent b66afaeed0
commit 2586ec4c73
6 changed files with 41 additions and 8 deletions

View file

@ -122,10 +122,11 @@ cvar_t avh_combattime = {kvCombatTime, "10", FCVAR_SERVER};
cvar_t avh_mapvoteratio = {kvMapVoteRatio, ".6", FCVAR_SERVER};
cvar_t avh_blockscripts = {kvBlockScripts, "1", FCVAR_SERVER};
cvar_t avh_jumpmode = {kvJumpMode, "1", FCVAR_SERVER};
cvar_t avh_version = {kvVersion, "323", FCVAR_SERVER };
cvar_t avh_version = {kvVersion, "330", FCVAR_SERVER};
//playtest cvars
cvar_t avh_newsgspread = {kvNewsgspread, "1", FCVAR_SERVER };
cvar_t avh_fastjp = {kvfastjp, "0", FCVAR_SERVER };
cvar_t avh_newsgspread = {kvNewsgspread, "1", FCVAR_SERVER};
cvar_t avh_fastjp = {kvfastjp, "0", FCVAR_SERVER};
cvar_t avh_newlerk = {kvNewlerk, "1", FCVAR_SERVER};
#ifdef DEBUG
cvar_t avh_testing = {kvTesting, "0", FCVAR_SERVER};
#endif
@ -240,6 +241,7 @@ void GameDLLInit( void )
//playtest cvars
CVAR_REGISTER (&avh_newsgspread);
CVAR_REGISTER (&avh_fastjp);
CVAR_REGISTER (&avh_newlerk);
// TODO: Remove
CVAR_REGISTER (&avh_ironman);

View file

@ -3176,6 +3176,11 @@ void CBasePlayer::Spawn( void )
else
g_engfuncs.pfnSetPhysicsKeyValue(edict(), "jp2", "0");
if (avh_newlerk.value == 1 && avh_version.value > 321)
g_engfuncs.pfnSetPhysicsKeyValue(edict(), "nl", "1");
else
g_engfuncs.pfnSetPhysicsKeyValue(edict(), "nl", "0");
pev->fov = m_iFOV = 0;// init field of view.
m_iClientFOV = -1; // make sure fov reset is sent

View file

@ -341,6 +341,7 @@ AvHGamerules::AvHGamerules() : mTeamA(TEAM_ONE), mTeamB(TEAM_TWO)
//playtest cvars
RegisterServerVariable(&avh_newsgspread);
RegisterServerVariable(&avh_fastjp);
RegisterServerVariable(&avh_newlerk);
g_VoiceGameMgr.Init(&gVoiceHelper, gpGlobals->maxClients);

View file

@ -1520,6 +1520,7 @@ void AvHPlayer::GetAnimationForActivity(int inActivity, char outAnimation[64], b
bool theIsGestating = (this->GetUser3() == AVH_USER3_ALIEN_EMBRYO);
bool theIsDeathAnim = false;
bool theIsReloading = false;
bool theIsGlidingOnGround = (FBitSet(this->pev->flags, FL_ONGROUND) && (this->GetUser3() == AVH_USER3_ALIEN_PLAYER3) && this->pev->button & IN_JUMP && this->pev->oldbuttons & IN_JUMP);
int theDebugAnimations = BALANCE_VAR(kDebugAnimations);
//bool theIsBlinking = this->GetIsBlinking();
@ -1616,7 +1617,12 @@ void AvHPlayer::GetAnimationForActivity(int inActivity, char outAnimation[64], b
break;
case ACT_RUN:
if(inGaitSequence || !strcmp(this->m_szAnimExtention, ""))
if (theIsGlidingOnGround && CVAR_GET_FLOAT("sv_newlerk") != 0)
{
strcat(outAnimation, "jump");
break;
}
else if(inGaitSequence || !strcmp(this->m_szAnimExtention, ""))
{
strcat(outAnimation, "run");
}

View file

@ -99,6 +99,7 @@ extern cvar_t avh_version;
//playtest cvars
extern cvar_t avh_newsgspread;
extern cvar_t avh_fastjp;
extern cvar_t avh_newlerk;
char *ns_cvar_string(const cvar_t *cvar);
int ns_cvar_int(const cvar_t *cvar);
@ -151,4 +152,5 @@ float ns_cvar_float(const cvar_t *cvar);
//playtest cvars
#define kvNewsgspread "sv_newsgspread"
#define kvfastjp "sv_fastjp"
#define kvNewlerk "sv_newlerk"
#endif

View file

@ -2023,6 +2023,7 @@ void PM_PlayStepSound( int step, float fvol )
static int iSkipStep = 0;
int irand;
vec3_t hvel;
bool newlerk = atoi(pmove->PM_Info_ValueForKey(pmove->physinfo, "nl"));
pmove->iStepLeft = !pmove->iStepLeft;
@ -2040,6 +2041,12 @@ void PM_PlayStepSound( int step, float fvol )
return;
}
// Don't play footsteps if gliding
if (pmove->iuser3 == AVH_USER3_ALIEN_PLAYER3 && pmove->cmd.buttons & IN_JUMP && pmove->oldbuttons & IN_JUMP && newlerk)
{
return;
}
VectorCopy( pmove->velocity, hvel );
hvel[2] = 0.0;
@ -3719,7 +3726,10 @@ void PM_CategorizePosition (void)
pmove->onground = tr.ent; // Otherwise, point to index of ent under us.
}
if ( gIsJetpacking[pmove->player_index] == 0 ) {
bool isglidinglerk = (pmove->iuser3 == AVH_USER3_ALIEN_PLAYER3 && pmove->cmd.buttons & IN_JUMP && pmove->oldbuttons & IN_JUMP);
bool newlerk = atoi(pmove->PM_Info_ValueForKey(pmove->physinfo, "nl"));
if ( gIsJetpacking[pmove->player_index] == 0 && (!isglidinglerk && newlerk)) {
// If we are on something...
if (pmove->onground != -1)
@ -4601,8 +4611,12 @@ bool PM_FlapMove()
}
else
{
bool newlerk = atoi(pmove->PM_Info_ValueForKey(pmove->physinfo, "nl"));
// Added by mmcguire. Lerk gliding.
if (pmove->iuser3 == AVH_USER3_ALIEN_PLAYER3 && pmove->onground == -1)
//if (pmove->iuser3 == AVH_USER3_ALIEN_PLAYER3 && pmove->onground == -1)
//if (pmove->iuser3 == AVH_USER3_ALIEN_PLAYER3/* && pmove->onground == -1*/)
if (pmove->iuser3 == AVH_USER3_ALIEN_PLAYER3 && (newlerk || pmove->onground == -1))
{
// Compute the velocity not in the direction we're facing.
float theGlideAmount = min(0.2f, PM_GetHorizontalSpeed() / 1000);
@ -6722,9 +6736,12 @@ void PM_PlayerMove ( qboolean server )
pmove->flags &= ~FL_JUMPHELD;
}
bool isglidinglerk = (pmove->iuser3 == AVH_USER3_ALIEN_PLAYER3 && pmove->cmd.buttons & IN_JUMP && pmove->oldbuttons & IN_JUMP);
bool newlerk = atoi(pmove->PM_Info_ValueForKey(pmove->physinfo, "nl"));
// Fricion is handled before we add in any base velocity. That way, if we are on a conveyor,
// we don't slow when standing still, relative to the conveyor.
if ((pmove->onground != -1 && gIsJetpacking[pmove->player_index] == 0) || GetHasUpgrade(pmove->iuser4, MASK_WALLSTICKING))
if ((pmove->onground != -1 && gIsJetpacking[pmove->player_index] == 0 && (!isglidinglerk || !newlerk)) || GetHasUpgrade(pmove->iuser4, MASK_WALLSTICKING))
{
if(!GetHasUpgrade(pmove->iuser4, MASK_WALLSTICKING))
pmove->velocity[2] = 0.0;
@ -6735,7 +6752,7 @@ void PM_PlayerMove ( qboolean server )
PM_CheckVelocity();
// Are we on ground now
if ( (pmove->onground != -1 && gIsJetpacking[pmove->player_index] == 0) || GetHasUpgrade(pmove->iuser4, MASK_WALLSTICKING) )
if ( (pmove->onground != -1 && gIsJetpacking[pmove->player_index] == 0 && (!isglidinglerk || !newlerk)) || GetHasUpgrade(pmove->iuser4, MASK_WALLSTICKING) )
{
PM_WalkMove();
}