o Added hud icons for welder, mines and grenades.

o made alien upgrade sprites a little smaller.


git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@414 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
puzl 2006-04-25 22:21:19 +00:00
parent 3803fec124
commit df66303212
7 changed files with 90 additions and 3 deletions

View file

@ -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;

View file

@ -645,6 +645,10 @@ private:
int mNumSensory;
int mNumDefense;
bool mHasGrenades;
bool mHasWelder;
bool mHasMines;
int mSelectedNodeResourceCost;
float mCurrentUseableEnergyLevel;
float mVisualEnergyLevel;

View file

@ -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);

View file

@ -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<AvHBasePlayerWeapon*>(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<AvHBasePlayerWeapon*>(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");

View file

@ -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;

Binary file not shown.