当前位置: 首页>>代码示例>>C++>>正文


C++ BALANCE_VAR函数代码示例

本文整理汇总了C++中BALANCE_VAR函数的典型用法代码示例。如果您正苦于以下问题:C++ BALANCE_VAR函数的具体用法?C++ BALANCE_VAR怎么用?C++ BALANCE_VAR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了BALANCE_VAR函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: STRING

int AvHMine::GetItemInfo(ItemInfo *p) const
{
	p->iSlot = AVH_FIFTH_SLOT;
	p->iPosition = 1;

	p->pszName = STRING(pev->classname);
	p->pszAmmo1 = "MineAmmo";
	p->iMaxAmmo1 = 0;//BALANCE_VAR(kMineMaxAmmo);
	p->pszAmmo2 = NULL;
	p->iMaxAmmo2 = BALANCE_VAR(kMineDamage);
	p->iMaxClip = BALANCE_VAR(kMineMaxAmmo);
	p->iFlags = ITEM_FLAG_NOAUTOSWITCHEMPTY;//ITEM_FLAG_LIMITINWORLD | ITEM_FLAG_EXHAUSTIBLE;
	p->iId = AVH_WEAPON_MINE;
	p->iWeight = kDefaultTertiaryWeaponWeight;

//	p->pszName = STRING(pev->classname);
//	p->pszAmmo1 = "MineAmmo";
//	p->iMaxAmmo1 = kMineMaxAmmo;
//	p->pszAmmo2 = NULL;
//	p->iMaxAmmo2 = -1;
//	p->iMaxClip = WEAPON_NOCLIP;
//	p->iFlags = ITEM_FLAG_LIMITINWORLD | ITEM_FLAG_EXHAUSTIBLE;
//	p->iId = m_iId = AVH_WEAPON_MINE;
//	p->iWeight = 5;
	
	return 1;
}
开发者ID:tschumann,项目名称:naturalselection,代码行数:27,代码来源:AvHItemInfo.cpp

示例2: AvHMUUpdateAlienEnergy

void AvHMUUpdateAlienEnergy(float inTimePassed, int inUser3, int inUser4, float& ioFuser)
{
	if(	(inUser3 == AVH_USER3_ALIEN_PLAYER1) ||
		(inUser3 == AVH_USER3_ALIEN_PLAYER2) ||
		(inUser3 == AVH_USER3_ALIEN_PLAYER3) ||
		(inUser3 == AVH_USER3_ALIEN_PLAYER4) ||
		(inUser3 == AVH_USER3_ALIEN_PLAYER5) ||
		(inUser3 == AVH_USER3_ALIEN_PLAYER6))
	{
		if(!GetHasUpgrade(inUser4, MASK_PLAYER_STUNNED))
		{
			// Percentage (0-1) per second
			float theAlienEnergyRate = (float)BALANCE_VAR(kAlienEnergyRate);
			//float kFadeChargingDeplectionRate = -2.8f*kAlienEnergyRate;
			float kChargingDepletionRate = -BALANCE_VAR(kChargingEnergyScalar)*theAlienEnergyRate;

			const float kMultiplier = GetHasUpgrade(inUser4, MASK_BUFFED) ? (1.0f + BALANCE_VAR(kPrimalScreamEnergyFactor)) : 1.0f;
			float theEnergyRate = theAlienEnergyRate*kMultiplier;

			float theUpgradeFactor = 1.0f;
			int theNumLevels = AvHGetAlienUpgradeLevel(inUser4, MASK_UPGRADE_5);
			if(theNumLevels > 0)
			{

				theUpgradeFactor += theNumLevels*BALANCE_VAR(kAdrenalineEnergyPercentPerLevel);
			}

			float theCurrentEnergy = ioFuser/kNormalizationNetworkFactor;
			
			float theNewEnergy = theCurrentEnergy + inTimePassed*theAlienEnergyRate*theUpgradeFactor;

//			// If we're charging, reduce energy
//			// Removed: Charge only reduces energy when active
//			if(GetHasUpgrade(inUser4, MASK_ALIEN_MOVEMENT))
//			{
//				if(inUser3 == AVH_USER3_ALIEN_PLAYER4)
//				{
//					theNewEnergy += inTimePassed*kFadeChargingDeplectionRate;
//				}
//				else
//				{
//					theNewEnergy += inTimePassed*kChargingDepletionRate;
//				}
//			}
			
			theNewEnergy = min(max(theNewEnergy, 0.0f), 1.0f);
			
			ioFuser = theNewEnergy*kNormalizationNetworkFactor;
		}
	}
}
开发者ID:Bacsu,项目名称:NS,代码行数:51,代码来源:AvHMovementUtil.cpp

示例3: SetUse

void AvHMovementChamber::EnergyAliensThink()
{
	// Don't teleport until it's "warmed up"
	SetUse(&AvHMovementChamber::TeleportUse);

	// Loop through all players
	CBaseEntity* theBaseEntity = NULL;
	int theNumEntsProcessed = 0;
	
	while(((theBaseEntity = UTIL_FindEntityInSphere(theBaseEntity, this->pev->origin, BALANCE_VAR(kMovementChamberEnergyRange))) != NULL) && (theNumEntsProcessed < BALANCE_VAR(kAlienChamberMaxPlayers)))
	{
		if(theBaseEntity->pev->team == this->pev->team)
		{
			float theEnergizeAmount = BALANCE_VAR(kMovementChamberEnergyAmount);
			AvHBaseBuildable* theBuildable = dynamic_cast<AvHBaseBuildable*>(theBaseEntity);
			AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(theBaseEntity);
			if(thePlayer && thePlayer->IsAlive())
			{
				if(thePlayer->Energize(theEnergizeAmount))
				{
					theNumEntsProcessed++;
				}
			}
			// Energize alien buildables
//			else if(theBuildable)
//			{
//				if(theBuildable->Energize(theEnergizeAmount))
//				{
//					theNumEntsProcessed++;
//				}
//			}
		}
	}

	// Play an animation (spin the arms if energizing)
	int theIdle = this->GetIdle2Animation();

	// Play sound
	if(theNumEntsProcessed > 0)
	{
		EMIT_SOUND(this->edict(), CHAN_AUTO, kAlienEnergySound, 1.0f, ATTN_NORM);

		theIdle = this->GetIdle1Animation();
	}

	this->PlayAnimationAtIndex(theIdle);
	
	// Set next think
	this->pev->nextthink = gpGlobals->time + BALANCE_VAR(kMovementChamberThinkInterval);
}
开发者ID:Arkshine,项目名称:NS,代码行数:50,代码来源:AvHAlienEquipment.cpp

示例4: SetThink

void AvHDefenseChamber::SetHasBeenBuilt()
{
	AvHAlienUpgradeBuilding::SetHasBeenBuilt();
	
	SetThink(&AvHDefenseChamber::RegenAliensThink);
	this->pev->nextthink = gpGlobals->time + BALANCE_VAR(kDefenseChamberThinkInterval);
}
开发者ID:Arkshine,项目名称:NS,代码行数:7,代码来源:AvHAlienEquipment.cpp

示例5: Precache

void AvHPistol::Spawn()
{
    AvHMarineWeapon::Spawn();

	Precache();

	this->m_iId = AVH_WEAPON_PISTOL;
	this->m_iDefaultAmmo = BALANCE_VAR(kHGMaxClip)*(BALANCE_VAR(kMarineSpawnClips) + 1);

    // Set our class name
	this->pev->classname = MAKE_STRING(kwsPistol);

	SET_MODEL(ENT(this->pev), kHGWModel);

	FallInit();// get ready to fall down.
}
开发者ID:tschumann,项目名称:naturalselection,代码行数:16,代码来源:AvHPistol.cpp

示例6: BALANCE_VAR

void AvHBaseBuildable::RecycleComplete()
{
	// Look at whether it has been built and health to determine how many points to give back
	float thePercentage = BALANCE_VAR(kRecycleResourcePercentage);

	if(!this->GetIsBuilt())
	{
		thePercentage = .8f;
	}

	// Make sure the building is still alive, can't get points back if it's dead
	if(this->pev->health <= 0)
	{
		thePercentage = 0.0f;
	}

	// Look up team
	AvHTeam* theTeam = GetGameRules()->GetTeam((AvHTeamNumber)this->pev->team);
	if(theTeam)
	{
		bool theIsEnergyTech = AvHSHUGetDoesTechCostEnergy(this->mMessageID);
		ASSERT(!theIsEnergyTech);

		float thePointsBack = GetGameRules()->GetCostForMessageID(this->mMessageID)*thePercentage;
		theTeam->SetTeamResources(theTeam->GetTeamResources() + thePointsBack);

        // Play "+ resources" event
        AvHSUPlayNumericEventAboveStructure(thePointsBack, this);

		// puzl: 980
		// Less smoke and more sparks  for recycled buildings
		this->Killed(this->pev, GIB_RECYCLED);
		// :puzl
	}
}
开发者ID:Arkshine,项目名称:NS,代码行数:35,代码来源:AvHBaseBuildable.cpp

示例7: Regenerate

bool AvHBaseBuildable::Regenerate(float inRegenerationAmount, bool inPlaySound, bool dcHealing)
{
	bool theDidHeal = false;
	if ( gpGlobals->time > this->mTimeOfLastDCRegeneration + BALANCE_VAR(kDefenseChamberThinkInterval) - 0.05f || (dcHealing == false)) {
		if ( dcHealing )
			this->mTimeOfLastDCRegeneration = gpGlobals->time;
		float theMaxHealth = this->mBaseHealth;

		if(!this->GetIsBuilt())
		{
			float theNormalizedBuildPercentage = this->GetNormalizedBuildPercentage();

			theMaxHealth = (kBaseHealthPercentage + theNormalizedBuildPercentage*(1.0f - kBaseHealthPercentage))*this->mBaseHealth;
		}

		// If we aren't at full health, heal health
		if(this->pev->health < theMaxHealth)
		{
			this->pev->health = min(theMaxHealth, this->pev->health + inRegenerationAmount);
			this->HealthChanged();
			theDidHeal = true;
		}
		
		// Play regen event
		if(theDidHeal)
		{
			if(inPlaySound)
			{
				// Play regeneration event
				PLAYBACK_EVENT_FULL(0, this->edict(), gRegenerationEventID, 0, this->pev->origin, (float *)&g_vecZero, 1.0f, 0.0, /*theWeaponIndex*/ 0, 0, 0, 0 );
			}
		}
	}
	return theDidHeal;
}
开发者ID:Arkshine,项目名称:NS,代码行数:35,代码来源:AvHBaseBuildable.cpp

示例8: while

void AvHDefenseChamber::RegenAliensThink()
{
	// Loop through all players
	CBaseEntity* theBaseEntity = NULL;
	int theNumEntsHealed = 0;
	
	while(((theBaseEntity = UTIL_FindEntityInSphere(theBaseEntity, this->pev->origin, BALANCE_VAR(kDefensiveChamberHealRange))) != NULL) && (theNumEntsHealed < BALANCE_VAR(kAlienChamberMaxPlayers)))
	{
		if(theBaseEntity->pev->team == this->pev->team)
		{
			AvHBaseBuildable* theBuildable = dynamic_cast<AvHBaseBuildable*>(theBaseEntity);
			AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(theBaseEntity);
			float thePercent=BALANCE_VAR(kDefensiveChamberRegenPercent)/100.0f;
			float amount=BALANCE_VAR(kDefensiveChamberRegenAmount) + (theBaseEntity->pev->max_health*thePercent);
			if(thePlayer && thePlayer->IsAlive())
			{
				if(thePlayer->Heal(amount, true, true))
				{
					theNumEntsHealed++;
				}
			}
			else if(theBuildable && theBuildable->GetIsBuilt() && (theBuildable != this))
			{
				if(theBuildable->Regenerate(amount, true, true))
				{
					theNumEntsHealed++;
				}
			}
		}
	}
	
	// Set next think
	this->pev->nextthink = gpGlobals->time + BALANCE_VAR(kDefenseChamberThinkInterval);
	
	// Play a random idle animation
	int theIdle = this->GetIdle1Animation();
	
	if(RANDOM_LONG(0, 1))
	{
		theIdle = this->GetIdle2Animation();
	}
	
	this->PlayAnimationAtIndex(theIdle);
}
开发者ID:Arkshine,项目名称:NS,代码行数:44,代码来源:AvHAlienEquipment.cpp

示例9: BALANCE_VAR

void AvHHive::ProcessHealing()
{
	// Regenerate nearby friendly aliens
	CBaseEntity* theEntity = NULL;
	const int theHiveHealRadius = BALANCE_VAR(kHiveHealRadius);

	while((theEntity = UTIL_FindEntityInSphere(theEntity, this->pev->origin, theHiveHealRadius)) != NULL)
	{
		AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(theEntity);
		if(thePlayer)
		{
			if(thePlayer->GetIsRelevant() && (thePlayer->GetTeam() == this->GetTeamNumber()) && !thePlayer->GetIsBeingDigested())
			{
                // Hive heals percentage of player health
                float theRegenPercentage = BALANCE_VAR(kHiveRegenerationPercentage);
                int theMaxHealth = AvHPlayerUpgrade::GetMaxHealth(thePlayer->pev->iuser4, (AvHUser3)thePlayer->pev->iuser3, thePlayer->GetExperienceLevel());
                float theRegenAmount = (theRegenPercentage*theMaxHealth);
                thePlayer->Heal(theRegenAmount, true);
			}
		}
	}
	
	// Regenerate self
	bool theDidHeal = false;
	
	// If we aren't at full health, heal health
	if(this->pev->health < this->mMaxHitPoints)
	{
        float theHiveRegenAmount = BALANCE_VAR(kHiveRegenerationAmount);
        float theCombatModeScalar = /*GetGameRules()->GetIsCombatMode() ? (1.0f/BALANCE_VAR(kCombatModeTimeScalar)) :*/ 1.0f;

		this->pev->health = min((float)this->mMaxHitPoints, this->pev->health + theHiveRegenAmount*theCombatModeScalar);
		theDidHeal = true;
	}
	
	// Play regen event
	if(theDidHeal)
	{
		// Play regeneration event
		PLAYBACK_EVENT_FULL(0, this->edict(), gRegenerationEventID, 0, this->pev->origin, (float *)&g_vecZero, 1.0f, 0.0, /*theWeaponIndex*/ 0, 0, 0, 0 );
	}
}
开发者ID:Arkshine,项目名称:NS,代码行数:42,代码来源:AvHHive.cpp

示例10: BALANCE_VAR

float AvHMarineWeapon::ComputeAttackInterval() const
{
    float theROF = this->GetRateOfFire();

    int theUser4 = this->m_pPlayer->pev->iuser4;

    // Speed attack if in range of primal scream
    if(GetHasUpgrade(theUser4, MASK_BUFFED))
    {
        float theCatalystROFFactor = 1.0f + BALANCE_VAR(kCatalystROFFactor);
        theROF /= theCatalystROFFactor;
    }

    return theROF;

}
开发者ID:Arkshine,项目名称:NS,代码行数:16,代码来源:AvHMarineWeapon.cpp

示例11: ASSERT

void AvHSonicGun::FireProjectiles(void)
{
	Vector vecSrc	 = m_pPlayer->GetGunPosition( );
	Vector vecAiming = m_pPlayer->GetAutoaimVector( AUTOAIM_5DEGREES );
	
	ASSERT(this->m_iPrimaryAmmoType >= 0);
	//int theNumBullets = min(kSGBulletsPerShot, this->m_iClientClip);

	float theDamageMultiplier;
	AvHPlayerUpgrade::GetWeaponUpgrade(this->m_pPlayer->pev->iuser3, this->m_pPlayer->pev->iuser4, &theDamageMultiplier);
	float theDamage = this->mDamage*theDamageMultiplier;
	
    // Fire the bullets and apply damage
	//this->m_pPlayer->FireBullets(kSGBulletsPerShot, vecSrc, vecAiming, this->GetProjectileSpread(), this->mRange, 0, 0, theDamage);
	this->m_pPlayer->FireBulletsPlayer(BALANCE_VAR(kSGBulletsPerShot), vecSrc, vecAiming, this->GetProjectileSpread(), this->mRange, BULLET_PLAYER_BUCKSHOT, 0, theDamage, 0, this->m_pPlayer->random_seed);
}
开发者ID:tschumann,项目名称:naturalselection,代码行数:16,代码来源:AvHSonicGun.cpp

示例12: BALANCE_VAR

char* AvHAlienResourceTower::GetActiveSoundList() const
{
	char* theActiveSoundList = NULL;

	// Don't play active sounds until kAlienResourceTowerSoundDelayTime seconds have passed, to prevent marines from knowing where aliens start
	int theTimeToWaitBeforeSounds = BALANCE_VAR(kAlienResourceTowerSoundDelayTime);
	int theGameTime = GetGameRules()->GetGameTime();
	if((theGameTime > 0) && (theGameTime >= theTimeToWaitBeforeSounds))
	{
		theActiveSoundList = kAlienResourceTowerSoundList;
	}
	else
	{
		int a = 0;
	}

	return theActiveSoundList;
}
开发者ID:Arkshine,项目名称:NS,代码行数:18,代码来源:AvHAlienEquipment.cpp


注:本文中的BALANCE_VAR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。