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 // Process here
int theEnabledState = 1; int theEnabledState = 1;
bool theGameStarted = GetGameRules()->GetGameStarted();
ItemInfo theItemInfo; ItemInfo theItemInfo;
if(this->GetItemInfo(&theItemInfo) != 0) if(this->GetItemInfo(&theItemInfo) != 0)
@ -1218,8 +1219,23 @@ void AvHBasePlayerWeapon::UpdateInventoryEnabledState(int inNumActiveHives)
AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(this->m_pPlayer); AvHPlayer* thePlayer = dynamic_cast<AvHPlayer*>(this->m_pPlayer);
ASSERT(thePlayer); 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 we don't have the hives required, or we're ensnared
if (/*thePlayer->GetIsTemporarilyInvulnerable() ||*/ else if (/*thePlayer->GetIsTemporarilyInvulnerable() ||*/
!thePlayer->GetIsAbleToAct() || !thePlayer->GetIsAbleToAct() ||
((inNumActiveHives < 1) && (theWeaponFlags & ONE_HIVE_REQUIRED)) || ((inNumActiveHives < 1) && (theWeaponFlags & ONE_HIVE_REQUIRED)) ||
((inNumActiveHives < 2) && (theWeaponFlags & TWO_HIVES_REQUIRED)) || ((inNumActiveHives < 2) && (theWeaponFlags & TWO_HIVES_REQUIRED)) ||
@ -1230,7 +1246,6 @@ void AvHBasePlayerWeapon::UpdateInventoryEnabledState(int inNumActiveHives)
theEnabledState = 0; theEnabledState = 0;
} }
} }
// : 497 save the state for when we send the CurWeapon message // : 497 save the state for when we send the CurWeapon message
this->m_iEnabled = theEnabledState; this->m_iEnabled = theEnabledState;
} }

View file

@ -4272,8 +4272,9 @@ int AvHGamerules::GetBaseHealthForMessageID(AvHMessageID inMessageID) const
int AvHGamerules::GetBuildTimeForMessageID(AvHMessageID inMessageID) const int AvHGamerules::GetBuildTimeForMessageID(AvHMessageID inMessageID) const
{ {
float time = 0.0f; float time = 0.0f;
const float CO_Scalar = this->GetIsCombatMode() ? BALANCE_VAR(kCombatModeTimeScalar) : 1.0f; bool theGameStarted = GetGameRules()->GetGameStarted();
const float CO_GScalar = this->GetIsCombatMode() ? BALANCE_VAR(kCombatModeGestationTimeScalar) : 1.0f; 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) switch(inMessageID)
{ {
@ -4410,18 +4411,6 @@ int AvHGamerules::GetCostForMessageID(AvHMessageID inMessageID) const
break; 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 else
{ {
switch(inMessageID) switch(inMessageID)
@ -4490,11 +4479,11 @@ int AvHGamerules::GetCostForMessageID(AvHMessageID inMessageID) const
case ALIEN_EVOLUTION_TWELVE: cost = BALANCE_VAR(kEvolutionCost); break; case ALIEN_EVOLUTION_TWELVE: cost = BALANCE_VAR(kEvolutionCost); break;
// Alien Lifeforms // Alien Lifeforms
case ALIEN_LIFEFORM_ONE: cost = BALANCE_VAR(kSkulkCost); break; case ALIEN_LIFEFORM_ONE: cost = BALANCE_VAR(kSkulkCost) * theGameStarted; break;
case ALIEN_LIFEFORM_TWO: cost = BALANCE_VAR(kGorgeCost); break; case ALIEN_LIFEFORM_TWO: cost = BALANCE_VAR(kGorgeCost) * theGameStarted; break;
case ALIEN_LIFEFORM_THREE: cost = BALANCE_VAR(kLerkCost); break; case ALIEN_LIFEFORM_THREE: cost = BALANCE_VAR(kLerkCost) * theGameStarted; break;
case ALIEN_LIFEFORM_FOUR: cost = BALANCE_VAR(kFadeCost); break; case ALIEN_LIFEFORM_FOUR: cost = BALANCE_VAR(kFadeCost) * theGameStarted; break;
case ALIEN_LIFEFORM_FIVE: cost = BALANCE_VAR(kOnosCost); break; case ALIEN_LIFEFORM_FIVE: cost = BALANCE_VAR(kOnosCost) * theGameStarted; break;
// Energy Costs // Energy Costs
case BUILD_SCAN: cost = BALANCE_VAR(kScanEnergyCost); break; 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->SendMessageOnce(theMessage.c_str(), TOOLTIP);
} }
this->LogEmitRoleChange(); 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->angles, this->mAnglesBeforeTopDown);
VectorCopy(this->pev->v_angle, this->mViewAnglesBeforeTopDown); VectorCopy(this->pev->v_angle, this->mViewAnglesBeforeTopDown);
VectorCopy(this->pev->view_ofs, this->mViewOfsBeforeTopDown); 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->mAnimExtensionBeforeTopDown = this->m_szAnimExtention;
this->HolsterCurrent(); this->HolsterCurrent();
@ -8824,6 +8827,9 @@ bool AvHPlayer::StopTopDownMode()
VectorCopy(this->mAnglesBeforeTopDown, this->pev->angles); VectorCopy(this->mAnglesBeforeTopDown, this->pev->angles);
VectorCopy(this->mViewAnglesBeforeTopDown, this->pev->v_angle); VectorCopy(this->mViewAnglesBeforeTopDown, this->pev->v_angle);
VectorCopy(this->mViewOfsBeforeTopDown, this->pev->view_ofs); 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()); strcpy(this->m_szAnimExtention, this->mAnimExtensionBeforeTopDown.c_str());
VectorCopy(g_vecZero, this->pev->velocity); VectorCopy(g_vecZero, this->pev->velocity);
@ -9933,6 +9939,7 @@ void AvHPlayer::UpdateTechNodes()
{ {
bool theIsCombatMode = GetGameRules()->GetIsCombatMode(); bool theIsCombatMode = GetGameRules()->GetIsCombatMode();
bool theIsNSMode = GetGameRules()->GetIsNSMode(); bool theIsNSMode = GetGameRules()->GetIsNSMode();
bool theGameStarted = GetGameRules()->GetGameStarted();
if((this->GetUser3() == AVH_USER3_COMMANDER_PLAYER) || theIsCombatMode || this->GetIsAlien()) if((this->GetUser3() == AVH_USER3_COMMANDER_PLAYER) || theIsCombatMode || this->GetIsAlien())
{ {
AvHTeam* theTeam = this->GetTeamPointer(); AvHTeam* theTeam = this->GetTeamPointer();
@ -9983,8 +9990,8 @@ void AvHPlayer::UpdateTechNodes()
theTechNodes.SetIsResearchable(ALIEN_EVOLUTION_ELEVEN, true); theTechNodes.SetIsResearchable(ALIEN_EVOLUTION_ELEVEN, true);
theTechNodes.SetIsResearchable(ALIEN_EVOLUTION_TWELVE, true); theTechNodes.SetIsResearchable(ALIEN_EVOLUTION_TWELVE, true);
// If not Gorge, set buildables to be unavailable // If not Gorge or the game hasn't started, set buildables to be unavailable
if(theLifeform != ALIEN_LIFEFORM_TWO) if(theLifeform != ALIEN_LIFEFORM_TWO || !theGameStarted)
{ {
theTechNodes.SetIsResearchable(ALIEN_BUILD_HIVE, false); theTechNodes.SetIsResearchable(ALIEN_BUILD_HIVE, false);
theTechNodes.SetIsResearchable(ALIEN_BUILD_RESOURCES, false); theTechNodes.SetIsResearchable(ALIEN_BUILD_RESOURCES, false);
@ -10052,7 +10059,10 @@ void AvHPlayer::UpdateTechNodes()
} }
if(!AvHGetHasFreeUpgradeCategory(ALIEN_UPGRADE_CATEGORY_MOVEMENT, theUpgrades, this->pev->iuser4)) if(!AvHGetHasFreeUpgradeCategory(ALIEN_UPGRADE_CATEGORY_MOVEMENT, theUpgrades, this->pev->iuser4))
{ {
//if (theGameStarted)
//{
theTechNodes.SetIsResearchable(ALIEN_EVOLUTION_SEVEN, false); theTechNodes.SetIsResearchable(ALIEN_EVOLUTION_SEVEN, false);
//}
theTechNodes.SetIsResearchable(ALIEN_EVOLUTION_EIGHT, false); theTechNodes.SetIsResearchable(ALIEN_EVOLUTION_EIGHT, false);
theTechNodes.SetIsResearchable(ALIEN_EVOLUTION_NINE, false); theTechNodes.SetIsResearchable(ALIEN_EVOLUTION_NINE, false);
} }
@ -10065,6 +10075,15 @@ void AvHPlayer::UpdateTechNodes()
} }
} }
if (UpdatedCosts && !theGameStarted)
UpdatedCosts = false;
if (theGameStarted && !UpdatedCosts)
{
theTechNodes.processBalanceChange();
UpdatedCosts = true;
}
theTechNodes.GetDelta( this->mClientTechNodes,this->mClientTechDelta ); theTechNodes.GetDelta( this->mClientTechNodes,this->mClientTechDelta );
if( !mClientTechDelta.empty() ) if( !mClientTechDelta.empty() )
{ {

View file

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