From 0cd4983b6aee5199e120910d1237a0e7d8c22fea Mon Sep 17 00:00:00 2001 From: puzl Date: Sun, 30 Jul 2006 10:19:58 +0000 Subject: [PATCH] o Alien flashlight does not reset at death. o Mantis 517: Changed the web render settings to values that work irrespective of alien flashlight setting. o Changed the behaviour of hive/MC teleportation - Friendly fire never triggers 'the hive is under attack'. - Aliens must +use a growing hive to trigger 'the enemy approaches'. git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@555 67975925-1194-0748-b3d5-c16f83f1a3a1 --- .../3.2.0/source/mod/AvHAlienEquipment.cpp | 2 +- releases/3.2.0/source/mod/AvHEntities.cpp | 8 ++++++- releases/3.2.0/source/mod/AvHGamerules.cpp | 15 +----------- releases/3.2.0/source/mod/AvHGamerules.h | 2 +- releases/3.2.0/source/mod/AvHHive.cpp | 23 +++++++++++++++---- releases/3.2.0/source/mod/AvHHive.h | 4 ++++ releases/3.2.0/source/mod/AvHParasiteGun.cpp | 2 +- releases/3.2.0/source/mod/AvHPlayer.cpp | 4 ++-- 8 files changed, 36 insertions(+), 24 deletions(-) diff --git a/releases/3.2.0/source/mod/AvHAlienEquipment.cpp b/releases/3.2.0/source/mod/AvHAlienEquipment.cpp index 2eddb0d..8f40f0a 100644 --- a/releases/3.2.0/source/mod/AvHAlienEquipment.cpp +++ b/releases/3.2.0/source/mod/AvHAlienEquipment.cpp @@ -607,7 +607,7 @@ void AvHMovementChamber::TeleportUse(CBaseEntity* inActivator, CBaseEntity* inCa { bool theHiveIsUnderAttack = GetGameRules()->GetIsEntityUnderAttack(theEntity->entindex()); - if(theEntity->GetIsActive() || theHiveIsUnderAttack) + if(theEntity->GetIsActive() || theHiveIsUnderAttack || theEntity->GetEmergencyUse() ) { float theCurrentDistance = VectorDistance(theEntity->pev->origin, inActivator->pev->origin); bool theHiveIsFarther = (theCurrentDistance > theFarthestDistance); diff --git a/releases/3.2.0/source/mod/AvHEntities.cpp b/releases/3.2.0/source/mod/AvHEntities.cpp index 9e610d8..cf7bd88 100644 --- a/releases/3.2.0/source/mod/AvHEntities.cpp +++ b/releases/3.2.0/source/mod/AvHEntities.cpp @@ -1693,7 +1693,7 @@ void AvHWebStrand::Precache(void) void AvHWebStrand::Setup(const Vector& inPointOne, const Vector& inPointTwo) { // Create a new entity with CBeam private data - this->BeamInit(kWebStrandSprite, kWebStrandWidth); + this->BeamInit(kWebStrandSprite, 40); //kWebStrandWidth); this->PointsInit(inPointOne, inPointTwo); this->SetColor( 255, 255, 255 ); @@ -1703,6 +1703,9 @@ void AvHWebStrand::Setup(const Vector& inPointOne, const Vector& inPointTwo) this->SetBrightness( 8 ); this->pev->classname = MAKE_STRING(kesTeamWebStrand); + this->pev->rendermode = kRenderNormal; + this->pev->renderfx = kRenderFxFlickerFast; + this->pev->renderamt = 20; } void AvHWebStrand::Spawn(void) @@ -1737,6 +1740,9 @@ void AvHWebStrand::StrandThink() this->SetColor( 255, 255, 255 ); this->SetFrame(1); this->mSolid=true; + this->pev->rendermode = kRenderTransAdd; + this->pev->renderfx = kRenderFxNone; + this->pev->renderamt = 30; SetThink(NULL); } void AvHWebStrand::StrandExpire() diff --git a/releases/3.2.0/source/mod/AvHGamerules.cpp b/releases/3.2.0/source/mod/AvHGamerules.cpp index 284e385..4b10903 100644 --- a/releases/3.2.0/source/mod/AvHGamerules.cpp +++ b/releases/3.2.0/source/mod/AvHGamerules.cpp @@ -977,7 +977,7 @@ BOOL AvHGamerules::FPlayerCanRespawn( CBasePlayer *pPlayer ) return theCanRespawn; } -bool AvHGamerules::CanEntityDoDamageTo(const CBaseEntity* inAttacker, const CBaseEntity* inReceiver, float* outScalar, bool triggerHiveDefend) +bool AvHGamerules::CanEntityDoDamageTo(const CBaseEntity* inAttacker, const CBaseEntity* inReceiver, float* outScalar) { bool theCanDoDamage = false; @@ -1071,19 +1071,6 @@ bool AvHGamerules::CanEntityDoDamageTo(const CBaseEntity* inAttacker, const CBas { *outScalar = theScalar; } - - if ( triggerHiveDefend ) { - if(!theTeamsAreDifferent && !AvHSUGetIsExternalClassName(STRING(inReceiver->pev->classname)) && theGameHasStarted ) - { - AvHHive *theHive=(AvHHive *)dynamic_cast(inReceiver); - if ( theHive != NULL ) { - theCanDoDamage=false; - if ( !this->GetIsEntityUnderAttack(theHive->entindex()) ) - GetGameRules()->TriggerAlert((AvHTeamNumber)inAttacker->pev->team, ALERT_HIVE_DEFEND, theHive->entindex()); - } - } - } - } return theCanDoDamage; } diff --git a/releases/3.2.0/source/mod/AvHGamerules.h b/releases/3.2.0/source/mod/AvHGamerules.h index 700cc4d..177c8be 100644 --- a/releases/3.2.0/source/mod/AvHGamerules.h +++ b/releases/3.2.0/source/mod/AvHGamerules.h @@ -186,7 +186,7 @@ public: virtual BOOL FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity *pAttacker ); // TODO: Add splash damage parameter and outgoing float percentage damage? This way splash damage could do some damage in non-tourny mode? - virtual bool CanEntityDoDamageTo(const CBaseEntity* inAttacker, const CBaseEntity* inReceiver, float* outScalar = NULL, bool triggerHiveDefend = true); + virtual bool CanEntityDoDamageTo(const CBaseEntity* inAttacker, const CBaseEntity* inReceiver, float* outScalar = NULL); //virtual edict_t* GetPlayerSpawnSpot( CBasePlayer *pPlayer ); virtual void PlayerThink( CBasePlayer *pPlayer ); diff --git a/releases/3.2.0/source/mod/AvHHive.cpp b/releases/3.2.0/source/mod/AvHHive.cpp index 3f6bda0..73373ee 100644 --- a/releases/3.2.0/source/mod/AvHHive.cpp +++ b/releases/3.2.0/source/mod/AvHHive.cpp @@ -114,7 +114,8 @@ AvHHive::AvHHive() : AvHBaseBuildable(TECH_HIVE, ALIEN_BUILD_HIVE, kesTeamHive, this->mTechnology = MESSAGE_NULL; this->mEnergy = 0.0f; this->mLastTimeScannedHives=-1.0f; - this->mTeleportHiveIndex=-1;; + this->mTimeEmergencyUseEnabled=-1.0f; + this->mTeleportHiveIndex=-1; } @@ -676,7 +677,8 @@ int AvHHive::TakeDamage( entvars_t *pevInflictor, entvars_t *pevAttacker, float } else { - GetGameRules()->TriggerAlert((AvHTeamNumber)this->pev->team, ALERT_UNDER_ATTACK, this->entindex()); + if ( pevAttacker->team != this->pev->team ) + GetGameRules()->TriggerAlert((AvHTeamNumber)this->pev->team, ALERT_UNDER_ATTACK, this->entindex()); } if((this->mTimeLastWoundSound == -1) || ((this->mTimeLastWoundSound + kWoundSoundInterval) < gpGlobals->time)) @@ -904,10 +906,23 @@ void AvHHive::HiveTouch(CBaseEntity* inOther) AvHBaseBuildable::BuildableTouch(inOther); } +void AvHHive::SetEmergencyUse() { + if ( !this->GetEmergencyUse() ) { + GetGameRules()->TriggerAlert((AvHTeamNumber)this->pev->team, ALERT_HIVE_DEFEND, this->entindex()); + } + this->mTimeEmergencyUseEnabled=gpGlobals->time; +} + +bool AvHHive::GetEmergencyUse() const { + return ( this->mTimeEmergencyUseEnabled > gpGlobals->time - 5.0f ); //BALANCE_VAR(kHiveEmergencyInterval) +} + void AvHHive::TeleportUse(CBaseEntity* inActivator, CBaseEntity* inCaller, USE_TYPE inUseType, float inValue) { - if ( this->GetIsSpawning() ) + if ( this->GetIsSpawning() ) { + this->SetEmergencyUse(); return; + } const float kHiveScanInterval = 1.0f; @@ -928,7 +943,7 @@ void AvHHive::TeleportUse(CBaseEntity* inActivator, CBaseEntity* inCaller, USE_T { bool theHiveIsUnderAttack = GetGameRules()->GetIsEntityUnderAttack(theEntity->entindex()); // allow teleport to any built hive, or unbuilt hives under attack. - if(!theEntity->GetIsSpawning() || ( theEntity->GetIsSpawning() && theHiveIsUnderAttack ) ) + if(!theEntity->GetIsSpawning() || ( theEntity->GetIsSpawning() && ( theHiveIsUnderAttack || theEntity->GetEmergencyUse()) ) ) { theHives.push_back(theEntity->entindex()); if ( theHiveIsUnderAttack ) diff --git a/releases/3.2.0/source/mod/AvHHive.h b/releases/3.2.0/source/mod/AvHHive.h index d9c294f..27177ca 100644 --- a/releases/3.2.0/source/mod/AvHHive.h +++ b/releases/3.2.0/source/mod/AvHHive.h @@ -156,6 +156,9 @@ public: virtual void Spawn(); + virtual void SetEmergencyUse(); + virtual bool GetEmergencyUse() const; + void EXPORT TeleportUse(CBaseEntity* inActivator, CBaseEntity* inCaller, USE_TYPE inUseType, float inValue); //virtual void UpdateReinforcements(); @@ -182,6 +185,7 @@ private: float mTimeOfNextUmbra; float mEnergy; float mLastTimeScannedHives; + float mTimeEmergencyUseEnabled; int mTeleportHiveIndex; }; diff --git a/releases/3.2.0/source/mod/AvHParasiteGun.cpp b/releases/3.2.0/source/mod/AvHParasiteGun.cpp index 50325b1..41f6e27 100644 --- a/releases/3.2.0/source/mod/AvHParasiteGun.cpp +++ b/releases/3.2.0/source/mod/AvHParasiteGun.cpp @@ -150,7 +150,7 @@ void AvHParasiteGun::FireProjectiles(void) { float theScalar = 1.0f; - bool theCanDoDamageTo = GetGameRules()->CanEntityDoDamageTo(this->m_pPlayer, theEntityHit, &theScalar, false); + bool theCanDoDamageTo = GetGameRules()->CanEntityDoDamageTo(this->m_pPlayer, theEntityHit, &theScalar); theScalar *= AvHPlayerUpgrade::GetAlienRangedDamageUpgrade(this->m_pPlayer->pev->iuser4); diff --git a/releases/3.2.0/source/mod/AvHPlayer.cpp b/releases/3.2.0/source/mod/AvHPlayer.cpp index 365a65c..d676073 100644 --- a/releases/3.2.0/source/mod/AvHPlayer.cpp +++ b/releases/3.2.0/source/mod/AvHPlayer.cpp @@ -856,7 +856,7 @@ void AvHPlayer::ClearRoleAbilities() this->pev->iuser4 &= ~MASK_ALIEN_EMBRYO; this->pev->iuser4 &= ~MASK_ALIEN_MOVEMENT; this->mIsScreaming = false; - this->mAlienSightActive = false; + //this->mAlienSightActive = false; this->mDesiredRoomType = 0; } @@ -4593,7 +4593,7 @@ void AvHPlayer::Killed( entvars_t *pevAttacker, int iGib ) this->mTimeToBeUnensnared = -1; this->mLastTimeEnsnared = -1; - this->mAlienSightActive = false; + //this->mAlienSightActive = false; this->mEvolution = MESSAGE_NULL; this->SetUsedKilled(false);