o Movement abilities now play at a much lower sound volume in the readyroom

o Charge do no longer push players in the readyroom
o Fixed bug where movement abilities sometimes could be available after the needed hives have been destroyed
o Fixed issue with movement ability sounds playing more than they should

git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@502 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
tankefugl 2006-05-26 17:17:24 +00:00
parent 8bc8d3d6f0
commit e83f9ea546
7 changed files with 106 additions and 51 deletions

View File

@ -42,6 +42,8 @@ WeaponsResource gWR;
int g_weaponselect = 0;
extern bool gCanMove;
void IN_AttackDownForced(void);
void IN_AttackUpForced(void);
void IN_Attack2Down(void);
@ -830,6 +832,13 @@ int CHudAmmo::MsgFunc_CurWeapon(const char *pszName, int iSize, void *pbuf )
if( !bIsCurrent )
{ return 1; }
// char temp[255];
// sprintf(temp, "iState %d iId %d iClip %d\n", iState, iId, iClip);
// gEngfuncs.pfnConsolePrint(temp);
if (iId == 22 || iId == 11 || iId == 21)
gCanMove = pWeapon->iEnabled;
m_pWeapon = pWeapon;
if ( !(gHUD.m_iHideHUDDisplay & ( HIDEHUD_WEAPONS | HIDEHUD_ALL )) )
@ -882,6 +891,9 @@ int CHudAmmo::MsgFunc_WeaponList(const char *pszName, int iSize, void *pbuf )
// puzl: 497 - default value for enable state
Weapon.iEnabled = 0;
// if (Weapon.iId == 22 || Weapon.iId == 11 || Weapon.iId == 21)
// gCanMove = true; //Weapon.iEnabled;
gWR.AddWeapon( &Weapon );
return 1;
}

View File

@ -126,6 +126,7 @@ MULTIDAMAGE gMultiDamage;
#define TRACER_FREQ 4 // Tracers fire every fourth bullet
extern bool gCanMove[];
//=========================================================
// MaxAmmoCarry - pass in a name and this function will tell
@ -1171,6 +1172,9 @@ int CBasePlayerWeapon::UpdateClientData( CBasePlayer *pPlayer )
bSend = TRUE;
}
if (m_iId == 22 || m_iId == 11 || m_iId == 21)
gCanMove[pPlayer->entindex() - 1] = m_iEnabled;
if ( bSend )
{
NetMsg_CurWeapon( pPlayer->pev, state, m_iId, m_iClip );

View File

@ -125,12 +125,12 @@ void AvHBlinkGun::FireProjectiles(void)
thePlayer->TriggerUncloak();
}
#endif
if(this->mTimeOfNextBlinkEvent <= 0)
{
const float kEventDelay = 2.0f;
this->PlaybackEvent(this->mBlinkSuccessEvent, this->GetShootAnimation());
this->mTimeOfNextBlinkEvent = UTIL_WeaponTimeBase() + kEventDelay;
}
// if(this->mTimeOfNextBlinkEvent <= 0)
// {
// const float kEventDelay = 2.0f;
// this->PlaybackEvent(this->mBlinkSuccessEvent, this->GetShootAnimation());
// this->mTimeOfNextBlinkEvent = UTIL_WeaponTimeBase() + kEventDelay;
// }
}
bool AvHBlinkGun::GetMustPressTriggerForEachShot() const

View File

@ -3016,7 +3016,7 @@ void EV_Leap(struct event_args_s* inArgs)
{
char* theSoundToPlay = kLeapSound;
gEngfuncs.pEventAPI->EV_PlaySound(inArgs->entindex, inArgs->origin, CHAN_WEAPON, theSoundToPlay, inArgs->fparam1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ));
// gEngfuncs.pEventAPI->EV_PlaySound(inArgs->entindex, inArgs->origin, CHAN_WEAPON, theSoundToPlay, inArgs->fparam1, ATTN_NORM, 0, 94 + gEngfuncs.pfnRandomLong( 0, 0xf ));
if (EV_IsLocal(inArgs->entindex))
{

View File

@ -3593,6 +3593,8 @@ void AvHPlayer::Init()
this->mNumSensory=0;
this->mNumMovement=0;
this->mNumDefense=0;
this->mTimeOfLastMovementSound = -1.0f;
}
void AvHPlayer::InitializeFromTeam(float inHealthPercentage, float inArmorPercentage)
@ -6802,51 +6804,91 @@ void AvHPlayer::InternalPreThink()
// Charge pushback
void AvHPlayer::InternalMovementThink()
{
// Ensure that we do leap damage
if(GetHasUpgrade(this->pev->iuser4, MASK_ALIEN_MOVEMENT) && (GetUser3() == AVH_USER3_ALIEN_PLAYER1))
this->StartLeap();
const char *theSoundToPlay;
bool thePlaySound = false;
float theSoundDelay = 0.0f;
// Check whether we're in a charge
// SKULK
if(GetHasUpgrade(this->pev->iuser4, MASK_ALIEN_MOVEMENT) && (GetUser3() == AVH_USER3_ALIEN_PLAYER1))
{
thePlaySound = true;
theSoundDelay = kLeapROF;
theSoundToPlay = kLeapSound;
// Ensure that we do leap damage
this->StartLeap();
}
// FADE
if(GetHasUpgrade(this->pev->iuser4, MASK_ALIEN_MOVEMENT) && (GetUser3() == AVH_USER3_ALIEN_PLAYER4))
{
thePlaySound = true;
theSoundDelay = 2.0f;
theSoundToPlay = kBlinkSound;
}
// ONOS
if(GetHasUpgrade(this->pev->iuser4, MASK_ALIEN_MOVEMENT) && (GetUser3() == AVH_USER3_ALIEN_PLAYER5))
{
thePlaySound = true;
theSoundDelay = 2.0f;
theSoundToPlay = "weapons/charge2.wav";
// Push back players
CBaseEntity* theEntity = NULL;
float radius = (float)BALANCE_VAR(kChargePushbackRadius);
float maxpushbackspeedfactor = (float)BALANCE_VAR(kChargeMaxPushbackSpeedFactor);
float pushbackfactor = (float)BALANCE_VAR(kChargeMaxPushbackForce);
// Find all entities around the onos
while((theEntity = UTIL_FindEntityInSphere(theEntity, this->pev->origin, radius)) != NULL)
{
if (theEntity->IsPlayer() && theEntity->IsAlive())
// Ensure that we don't push back players in the readyroom
if (this->GetPlayMode() == PLAYMODE_PLAYING)
{
// Find all entities around the onos
while((theEntity = UTIL_FindEntityInSphere(theEntity, this->pev->origin, radius)) != NULL)
{
float distance = VectorDistance(this->pev->origin, theEntity->pev->origin);
if (distance > 0.0f)
if (theEntity->IsPlayer() && theEntity->IsAlive())
{
float factor = pushbackfactor / (radius / distance);
vec3_t direction, heading;
VectorSubtract(theEntity->pev->origin, this->pev->origin, direction);
VectorNormalize(direction);
VectorCopy(this->pev->velocity, heading);
VectorNormalize(heading);
float dot = DotProduct(heading, direction);
if (dot > 0.0f)
float distance = VectorDistance(this->pev->origin, theEntity->pev->origin);
if (distance > 0.0f)
{
VectorScale(direction, factor * dot, direction);
VectorAdd(theEntity->pev->velocity, direction, theEntity->pev->velocity);
theEntity->pev->velocity[2] = max(181, theEntity->pev->velocity[2]);
if (Length(theEntity->pev->velocity) > theEntity->pev->maxspeed * maxpushbackspeedfactor)
{
VectorNormalize(theEntity->pev->velocity);
VectorScale(theEntity->pev->velocity, theEntity->pev->maxspeed * maxpushbackspeedfactor, theEntity->pev->velocity);
}
}
float factor = pushbackfactor / (radius / distance);
vec3_t direction, heading;
VectorSubtract(theEntity->pev->origin, this->pev->origin, direction);
VectorNormalize(direction);
// ALERT(at_console, UTIL_VarArgs("direction %f %f %f heading %f %f %f endvel %f %f %f\n", direction[0], direction[1], direction[2], heading[0], heading[1], heading[2], theEntity->pev->velocity[0], theEntity->pev->velocity[1], theEntity->pev->velocity[2]));
VectorCopy(this->pev->velocity, heading);
VectorNormalize(heading);
float dot = DotProduct(heading, direction);
if (dot > 0.0f)
{
VectorScale(direction, factor * dot, direction);
VectorAdd(theEntity->pev->velocity, direction, theEntity->pev->velocity);
theEntity->pev->velocity[2] = max(181, theEntity->pev->velocity[2]);
if (Length(theEntity->pev->velocity) > theEntity->pev->maxspeed * maxpushbackspeedfactor)
{
VectorNormalize(theEntity->pev->velocity);
VectorScale(theEntity->pev->velocity, theEntity->pev->maxspeed * maxpushbackspeedfactor, theEntity->pev->velocity);
}
}
// ALERT(at_console, UTIL_VarArgs("direction %f %f %f heading %f %f %f endvel %f %f %f\n", direction[0], direction[1], direction[2], heading[0], heading[1], heading[2], theEntity->pev->velocity[0], theEntity->pev->velocity[1], theEntity->pev->velocity[2]));
}
}
}
}
}
}
if (thePlaySound && (mTimeOfLastMovementSound + theSoundDelay < gpGlobals->time))
{
float theVolumeScalar = this->GetAlienAdjustedEventVolume();
if (this->GetPlayMode() != PLAYMODE_PLAYING)
theVolumeScalar *= 0.2f;
float thePitch = 94.0f + (float)RANDOM_LONG(0, 16);
EMIT_SOUND_DYN(ENT(this->pev), CHAN_WEAPON, theSoundToPlay, theVolumeScalar, ATTN_NORM, 0, 100);
this->mTimeOfLastMovementSound = gpGlobals->time;
}
}

View File

@ -653,6 +653,8 @@ private:
float mTimeOfLastEnemySighting;
bool mEnemySighted;
float mTimeOfLastMovementSound;
bool mTriggerUncloak;
bool mHasLeftReadyRoom;

View File

@ -217,6 +217,12 @@ vec3_t gSurfaceNormal = { 0, 0, 0 };
bool canWallJump = false;
// :tankefugl
#ifdef AVH_SERVER
bool gCanMove[MAX_CLIENTS];
#else
bool gCanMove;
#endif
#ifdef AVH_CLIENT
extern vec3_t gPlayerAngles;
extern vec3_t gTargetPlayerAngles;
@ -4368,10 +4374,6 @@ bool PM_BlinkMove (void)
SetUpgradeMask(&pmove->iuser4, MASK_ALIEN_MOVEMENT, true);
int theSilenceUpgradeLevel = AvHGetAlienUpgradeLevel(pmove->iuser4, MASK_UPGRADE_6);
float theVolumeScalar = 1.0f - theSilenceUpgradeLevel/3.0f;
PM_NSPlaySound(CHAN_WEAPON, kBlinkSound, theVolumeScalar, ATTN_NORM, 0, 94 + pmove->RandomLong(0, 0xf));
vec3_t forward, right, up;
AngleVectors(pmove->angles, forward, right, up);
@ -4481,10 +4483,6 @@ bool PM_LeapMove()
SetUpgradeMask(&pmove->iuser4, MASK_ALIEN_MOVEMENT, true);
int theSilenceUpgradeLevel = AvHGetAlienUpgradeLevel(pmove->iuser4, MASK_UPGRADE_6);
float theVolumeScalar = 1.0f - theSilenceUpgradeLevel/3.0f;
PM_NSPlaySound(CHAN_WEAPON, kLeapSound, theVolumeScalar, ATTN_NORM, 0, 94 + pmove->RandomLong(0, 0xf));
vec3_t forward, right, up;
AngleVectors(pmove->angles, forward, right, up);
@ -4641,9 +4639,6 @@ bool PM_ChargeMove()
AvHMUDeductAlienEnergy(pmove->fuser3, theEnergyCost);
if (pmove->fuser4 == 0.0f)
{
int theSilenceUpgradeLevel = AvHGetAlienUpgradeLevel(pmove->iuser4, MASK_UPGRADE_6);
float theVolumeScalar = 1.0f - theSilenceUpgradeLevel/3.0f;
PM_NSPlaySound( CHAN_WEAPON, "weapons/charge2.wav", theVolumeScalar, ATTN_NORM, 0, PITCH_NORM );
pmove->fuser4 = 0.3f;
}
pmove->fuser4 += (float)pmove->frametime;
@ -4707,9 +4702,9 @@ void PM_AlienAbilities()
bool canmove = true;
#ifdef AVH_SERVER
//canmove = gCanMove[pmove->player_index];
canmove = gCanMove[pmove->player_index];
#else
//canmove = gCanMove;
canmove = gCanMove;
#endif
bool success = false;
if ((pmove->cmd.buttons & IN_ATTACK2) && (AvHGetIsAlien(pmove->iuser3)))