diff --git a/releases/3.2.0/source/Natural_Selection.suo b/releases/3.2.0/source/Natural_Selection.suo index fbde820a..40f5d051 100644 Binary files a/releases/3.2.0/source/Natural_Selection.suo and b/releases/3.2.0/source/Natural_Selection.suo differ diff --git a/releases/3.2.0/source/mod/AvHHud.cpp b/releases/3.2.0/source/mod/AvHHud.cpp index 556545c3..ee73be58 100644 --- a/releases/3.2.0/source/mod/AvHHud.cpp +++ b/releases/3.2.0/source/mod/AvHHud.cpp @@ -2874,6 +2874,12 @@ int AvHHud::SetUpgrades(const char* pszName, int iSize, void* pbuf) mask >>=2; this->mNumSensory=mask & 0x3; } + // Marines + else { + this->mHasWelder=mask & 0x1; + this->mHasMines=mask & 0x2; + this->mHasGrenades=mask & 0x4; + } return 1; } @@ -3656,6 +3662,10 @@ void AvHHud::Init(void) this->mNumMovement=0; this->mNumDefense=0; + this->mHasGrenades=false; + this->mHasWelder=false; + this->mHasMines=false; + this->mFogActive = false; this->mFogColor.x = this->mFogColor.y = this->mFogColor.z = 0; this->mFogStart = 0; diff --git a/releases/3.2.0/source/mod/AvHHud.h b/releases/3.2.0/source/mod/AvHHud.h index 5e5707cf..f2716139 100644 --- a/releases/3.2.0/source/mod/AvHHud.h +++ b/releases/3.2.0/source/mod/AvHHud.h @@ -645,6 +645,10 @@ private: int mNumSensory; int mNumDefense; + bool mHasGrenades; + bool mHasWelder; + bool mHasMines; + int mSelectedNodeResourceCost; float mCurrentUseableEnergyLevel; float mVisualEnergyLevel; diff --git a/releases/3.2.0/source/mod/AvHHudRender.cpp b/releases/3.2.0/source/mod/AvHHudRender.cpp index ce5ac427..df8cda50 100644 --- a/releases/3.2.0/source/mod/AvHHudRender.cpp +++ b/releases/3.2.0/source/mod/AvHHudRender.cpp @@ -3323,7 +3323,37 @@ void AvHHud::RenderMarineUI() } } + + bool frames[3] = { false, false, false}; + if ( this->mHasGrenades ) frames[0]=true; + if ( this->mHasMines ) frames[1]=true; + if ( this->mHasWelder ) frames[2]=true; + + for(int i = 0; i < 3; i++) + { + int theFrame=i+9; + if ( frames[i] == true ) { + const int kIconWidth = .05*ScreenWidth(); + const int kIconHeight = .05*ScreenHeight(); + const int kBaseX = ScreenWidth() - .05*ScreenWidth(); + const int kBaseY = .75*ScreenHeight(); + float theStartU = (theFrame % 4)*.25f; + float theStartV = (theFrame / 4)*.333f; + float theEndU = theStartU + .25f; + float theEndV = theStartV + .333f; + + float x1 = kBaseX; + float y1 = kBaseY - (i+1)*kIconHeight; + float x2 = x1 + kIconWidth; + float y2 = y1 + kIconHeight; + + AvHSpriteSetRenderMode(kRenderTransAdd); + AvHSpriteEnableClippingRect(false); + AvHSpriteSetColor(1, 1, 1, this->GetGammaSlope()); + AvHSpriteDraw(mMarineUpgradesSprite, theFrame, x1, y1, x2, y2, theStartU, theStartV, theEndU, theEndV); + } + } } void AvHHud::RenderCommanderUI() @@ -3809,7 +3839,7 @@ void AvHHud::RenderAlienUI() const int kVerticalUpgradeSpacing = kNormalizedSpacing*kAspectRatio*ScreenHeight(); int theUpgradeVar = this->GetHUDUpgrades(); const int kUpgradeFrame = 0; - const float kUpgradeSize = 0.05; + const float kUpgradeSize = 0.04; int theUpgradeWidth = kUpgradeSize*ScreenWidth(); int theUpgradeHeight = kUpgradeSize*kAspectRatio*ScreenHeight(); @@ -4271,7 +4301,6 @@ void AvHHud::VidInit(void) this->mAlienCursor = Safe_SPR_Load(kAlienCursorSprite); this->mMarineOrderIndicator = Safe_SPR_Load(kMarineOrderSprite); this->mMarineUpgradesSprite = Safe_SPR_Load(kMarineUpgradesSprite); - //this->mMappingTechSprite = Safe_SPR_Load("sprites/ns.spr"); this->mAlienBuildSprite = Safe_SPR_Load(kAlienBuildSprite); diff --git a/releases/3.2.0/source/mod/AvHPlayer.cpp b/releases/3.2.0/source/mod/AvHPlayer.cpp index f4a527a4..9a8fc77e 100644 --- a/releases/3.2.0/source/mod/AvHPlayer.cpp +++ b/releases/3.2.0/source/mod/AvHPlayer.cpp @@ -3566,6 +3566,7 @@ void AvHPlayer::Init() this->mCombatNodes.Clear(); this->mPurchasedCombatUpgrades.clear(); this->mGiveCombatUpgrades.clear(); + this->mMarineHUDUpgrades=0; } void AvHPlayer::InitializeFromTeam(float inHealthPercentage, float inArmorPercentage) @@ -9219,6 +9220,46 @@ void AvHPlayer::UpdateAlienUI() } } +void AvHPlayer::UpdateMarineUI() +{ + AvHTeam* theTeamPointer = this->GetTeamPointer(); + bool theIsMarine = false; + bool theIsAlien = false; + + if(this->GetIsAlien()) + { + return; + } + + int tmpUpgrades; + for(int i = 0; i < MAX_ITEM_TYPES; i++) + { + AvHBasePlayerWeapon* theActiveWeapon = dynamic_cast(this->m_rgpPlayerItems[i]); + while(theActiveWeapon) + { + ItemInfo ii; + theActiveWeapon->GetItemInfo(&ii); + switch ( ii.iId ) { + case AVH_WEAPON_WELDER: + tmpUpgrades |= 0x1; + break; + case AVH_WEAPON_MINE: + tmpUpgrades |= 0x2; + break; + case AVH_WEAPON_GRENADE: + tmpUpgrades |= 0x4; + break; + } + // Next weapon + theActiveWeapon = dynamic_cast(theActiveWeapon->m_pNext); + } + } + if ( tmpUpgrades != this->mMarineHUDUpgrades ) { + NetMsg_HUDSetUpgrades(this->pev, tmpUpgrades&0x7); + this->mMarineHUDUpgrades=tmpUpgrades; + } +} + // TODO: Send only changed blips, send only the changes for each blip. void AvHPlayer::UpdateBlips() { @@ -9264,7 +9305,9 @@ void AvHPlayer::UpdateClientData( void ) this->UpdateGamma(); this->UpdateBlips(); this->UpdateAlienUI(); + this->UpdateMarineUI(); this->UpdateFog(); + //this->UpdateDebugCSP(); } //UTIL_LogPrintf("UpdateClientData done.\n"); diff --git a/releases/3.2.0/source/mod/AvHPlayer.h b/releases/3.2.0/source/mod/AvHPlayer.h index 557eaed7..50f9c94a 100644 --- a/releases/3.2.0/source/mod/AvHPlayer.h +++ b/releases/3.2.0/source/mod/AvHPlayer.h @@ -560,6 +560,7 @@ private: //void UpdateArmor(); void UpdateAlienUI(); + void UpdateMarineUI(); void UpdateBlips(); void UpdateDebugCSP(); void UpdateEffectiveClassAndTeam(); @@ -832,7 +833,7 @@ private: int mLastModelIndex; string mNetworkID; - + int mMarineHUDUpgrades; struct ServerVariable { std::string mName; diff --git a/releases/3.2.0/sprites/upgrades.spr b/releases/3.2.0/sprites/upgrades.spr index bd71d657..160a1277 100644 Binary files a/releases/3.2.0/sprites/upgrades.spr and b/releases/3.2.0/sprites/upgrades.spr differ