pregame lifeform update

This commit is contained in:
pierow 2021-01-22 17:58:51 -05:00
parent 51685994d3
commit 03bcd1f167
4 changed files with 51 additions and 27 deletions

View file

@ -1210,6 +1210,7 @@ void AvHBasePlayerWeapon::UpdateInventoryEnabledState(int inNumActiveHives)
{
// Process here
int theEnabledState = 1;
bool theGameStarted = GetGameRules()->GetGameStarted();
ItemInfo theItemInfo;
if(this->GetItemInfo(&theItemInfo) != 0)
@ -1218,8 +1219,23 @@ void AvHBasePlayerWeapon::UpdateInventoryEnabledState(int inNumActiveHives)
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(this->m_pPlayer);
ASSERT(thePlayer);
// Pregame alien abilities
if (!theGameStarted)
{
if (!thePlayer->GetIsAbleToAct() ||
(thePlayer->pev->iuser3 == AVH_USER3_ALIEN_PLAYER5 && (theWeaponFlags & ONE_HIVE_REQUIRED)) ||
(theWeaponFlags & TWO_HIVES_REQUIRED) ||
(theWeaponFlags & THREE_HIVES_REQUIRED))
{
//// Allow leap
//if (!(thePlayer->pev->iuser3 == AVH_USER3_ALIEN_PLAYER1 && (theWeaponFlags & TWO_HIVES_REQUIRED)))
//{
theEnabledState = 0;
//}
}
}
// If we don't have the hives required, or we're ensnared
if (/*thePlayer->GetIsTemporarilyInvulnerable() ||*/
else if (/*thePlayer->GetIsTemporarilyInvulnerable() ||*/
!thePlayer->GetIsAbleToAct() ||
((inNumActiveHives < 1) && (theWeaponFlags & ONE_HIVE_REQUIRED)) ||
((inNumActiveHives < 2) && (theWeaponFlags & TWO_HIVES_REQUIRED)) ||
@ -1230,9 +1246,8 @@ void AvHBasePlayerWeapon::UpdateInventoryEnabledState(int inNumActiveHives)
theEnabledState = 0;
}
}
// : 497 save the state for when we send the CurWeapon message
this->m_iEnabled = theEnabledState;
// : 497 save the state for when we send the CurWeapon message
this->m_iEnabled = theEnabledState;
}
void AvHBasePlayerWeapon::KeyValue(KeyValueData* pkvd)

View file

@ -4272,8 +4272,9 @@ int AvHGamerules::GetBaseHealthForMessageID(AvHMessageID inMessageID) const
int AvHGamerules::GetBuildTimeForMessageID(AvHMessageID inMessageID) const
{
float time = 0.0f;
const float CO_Scalar = this->GetIsCombatMode() ? BALANCE_VAR(kCombatModeTimeScalar) : 1.0f;
const float CO_GScalar = this->GetIsCombatMode() ? BALANCE_VAR(kCombatModeGestationTimeScalar) : 1.0f;
bool theGameStarted = GetGameRules()->GetGameStarted();
const float CO_Scalar = (this->GetIsCombatMode() || !theGameStarted) ? BALANCE_VAR(kCombatModeTimeScalar) : 1.0f;
const float CO_GScalar = (this->GetIsCombatMode() || !theGameStarted) ? BALANCE_VAR(kCombatModeGestationTimeScalar) : 1.0f;
switch(inMessageID)
{
@ -4410,18 +4411,6 @@ int AvHGamerules::GetCostForMessageID(AvHMessageID inMessageID) const
break;
}
}
else if (!theGameStarted)
{
switch (inMessageID)
{
case ALIEN_LIFEFORM_TWO:
case ALIEN_LIFEFORM_THREE:
case ALIEN_LIFEFORM_FOUR:
case ALIEN_LIFEFORM_FIVE:
cost = 0;
break;
}
}
else
{
switch(inMessageID)
@ -4490,11 +4479,11 @@ int AvHGamerules::GetCostForMessageID(AvHMessageID inMessageID) const
case ALIEN_EVOLUTION_TWELVE: cost = BALANCE_VAR(kEvolutionCost); break;
// Alien Lifeforms
case ALIEN_LIFEFORM_ONE: cost = BALANCE_VAR(kSkulkCost); break;
case ALIEN_LIFEFORM_TWO: cost = BALANCE_VAR(kGorgeCost); break;
case ALIEN_LIFEFORM_THREE: cost = BALANCE_VAR(kLerkCost); break;
case ALIEN_LIFEFORM_FOUR: cost = BALANCE_VAR(kFadeCost); break;
case ALIEN_LIFEFORM_FIVE: cost = BALANCE_VAR(kOnosCost); break;
case ALIEN_LIFEFORM_ONE: cost = BALANCE_VAR(kSkulkCost) * theGameStarted; break;
case ALIEN_LIFEFORM_TWO: cost = BALANCE_VAR(kGorgeCost) * theGameStarted; break;
case ALIEN_LIFEFORM_THREE: cost = BALANCE_VAR(kLerkCost) * theGameStarted; break;
case ALIEN_LIFEFORM_FOUR: cost = BALANCE_VAR(kFadeCost) * theGameStarted; break;
case ALIEN_LIFEFORM_FIVE: cost = BALANCE_VAR(kOnosCost) * theGameStarted; break;
// Energy Costs
case BUILD_SCAN: cost = BALANCE_VAR(kScanEnergyCost); break;

View file

@ -8200,6 +8200,7 @@ void AvHPlayer::SetUser3(AvHUser3 inUser3, bool inForceChange, bool inGiveWeapon
this->SendMessageOnce(theMessage.c_str(), TOOLTIP);
}
this->LogEmitRoleChange();
//ALERT(at_console, "resetbehavior newvangle0:%f newvangle1:%f newvangle2:%f\n", this->pev->v_angle[0], this->pev->v_angle[1], this->pev->v_angle[2]);
}
}
@ -8395,6 +8396,8 @@ void AvHPlayer::StartTopDownMode()
VectorCopy(this->pev->angles, this->mAnglesBeforeTopDown);
VectorCopy(this->pev->v_angle, this->mViewAnglesBeforeTopDown);
VectorCopy(this->pev->view_ofs, this->mViewOfsBeforeTopDown);
//ALERT(at_console, "v_angle0:%f v_angle1:%f v_angle2:%f\n", this->pev->v_angle[0], this->pev->v_angle[1], this->pev->v_angle[2]);
//ALERT(at_console, "saving0:%f saving1:%f saving2:%f\n", this->mViewAnglesBeforeTopDown[0], this->mViewAnglesBeforeTopDown[1], this->mViewAnglesBeforeTopDown[2]);
this->mAnimExtensionBeforeTopDown = this->m_szAnimExtention;
this->HolsterCurrent();
@ -8824,6 +8827,9 @@ bool AvHPlayer::StopTopDownMode()
VectorCopy(this->mAnglesBeforeTopDown, this->pev->angles);
VectorCopy(this->mViewAnglesBeforeTopDown, this->pev->v_angle);
VectorCopy(this->mViewOfsBeforeTopDown, this->pev->view_ofs);
//ALERT(at_console, "saved0:%f saved1:%f saved2:%f\n", this->mViewAnglesBeforeTopDown[0], this->mViewAnglesBeforeTopDown[1], this->mViewAnglesBeforeTopDown[2]);
//ALERT(at_console, "newvangle0:%f newvangle1:%f newvangle2:%f\n", this->pev->v_angle[0], this->pev->v_angle[1], this->pev->v_angle[2]);
strcpy(this->m_szAnimExtention, this->mAnimExtensionBeforeTopDown.c_str());
VectorCopy(g_vecZero, this->pev->velocity);
@ -9933,6 +9939,7 @@ void AvHPlayer::UpdateTechNodes()
{
bool theIsCombatMode = GetGameRules()->GetIsCombatMode();
bool theIsNSMode = GetGameRules()->GetIsNSMode();
bool theGameStarted = GetGameRules()->GetGameStarted();
if((this->GetUser3() == AVH_USER3_COMMANDER_PLAYER) || theIsCombatMode || this->GetIsAlien())
{
AvHTeam* theTeam = this->GetTeamPointer();
@ -9940,7 +9947,7 @@ void AvHPlayer::UpdateTechNodes()
{
// Propagate and use local tech nodes in combat mode, else use team nodes in NS mode
AvHTechTree& theTechNodes = theIsCombatMode ? this->mCombatNodes : theTeam->GetTechNodes();
// Now customize nodes for aliens in NS
if(theIsNSMode && this->GetIsAlien())
{
@ -9983,8 +9990,8 @@ void AvHPlayer::UpdateTechNodes()
theTechNodes.SetIsResearchable(ALIEN_EVOLUTION_ELEVEN, true);
theTechNodes.SetIsResearchable(ALIEN_EVOLUTION_TWELVE, true);
// If not Gorge, set buildables to be unavailable
if(theLifeform != ALIEN_LIFEFORM_TWO)
// If not Gorge or the game hasn't started, set buildables to be unavailable
if(theLifeform != ALIEN_LIFEFORM_TWO || !theGameStarted)
{
theTechNodes.SetIsResearchable(ALIEN_BUILD_HIVE, false);
theTechNodes.SetIsResearchable(ALIEN_BUILD_RESOURCES, false);
@ -10052,7 +10059,10 @@ void AvHPlayer::UpdateTechNodes()
}
if(!AvHGetHasFreeUpgradeCategory(ALIEN_UPGRADE_CATEGORY_MOVEMENT, theUpgrades, this->pev->iuser4))
{
theTechNodes.SetIsResearchable(ALIEN_EVOLUTION_SEVEN, false);
//if (theGameStarted)
//{
theTechNodes.SetIsResearchable(ALIEN_EVOLUTION_SEVEN, false);
//}
theTechNodes.SetIsResearchable(ALIEN_EVOLUTION_EIGHT, false);
theTechNodes.SetIsResearchable(ALIEN_EVOLUTION_NINE, false);
}
@ -10064,6 +10074,15 @@ void AvHPlayer::UpdateTechNodes()
}
}
}
if (UpdatedCosts && !theGameStarted)
UpdatedCosts = false;
if (theGameStarted && !UpdatedCosts)
{
theTechNodes.processBalanceChange();
UpdatedCosts = true;
}
theTechNodes.GetDelta( this->mClientTechNodes,this->mClientTechDelta );
if( !mClientTechDelta.empty() )

View file

@ -692,6 +692,7 @@ private:
AvHTechTree mClientTechNodes;
MessageIDListType mClientTechDelta;
AvHTechSlotListType mClientTechSlotList;
bool UpdatedCosts;
AvHMessageID mClientResearchingTech;