mirror of
https://github.com/unknownworlds/NS.git
synced 2025-02-20 18:52:39 +00:00
o Fixed bug with cl_labelhivesight where 0 and 1 was interchanged
o Progress bar now uses the experience bar git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@437 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
parent
0c118de14d
commit
5b8f78883e
5 changed files with 119 additions and 57 deletions
|
@ -2431,17 +2431,17 @@ void EV_Welder(struct event_args_s* inArgs)
|
|||
float thePercentage;
|
||||
AvHSHUGetBuildResearchState(thePhysEnt->iuser3, thePhysEnt->iuser4, thePhysEnt->fuser1, theIsBuilding, theIsResearching, thePercentage);
|
||||
|
||||
if(thePhysEnt->iuser3 == AVH_USER3_WELD)
|
||||
{
|
||||
if((thePercentage < 1.0f) && (thePercentage != -1))
|
||||
{
|
||||
gHUD.SetProgressStatus(thePercentage);
|
||||
}
|
||||
else
|
||||
{
|
||||
gHUD.HideProgressStatus();
|
||||
}
|
||||
}
|
||||
// if(thePhysEnt->iuser3 == AVH_USER3_WELD)
|
||||
// {
|
||||
// if((thePercentage < 1.0f) && (thePercentage != -1))
|
||||
// {
|
||||
// gHUD.SetProgressStatus(thePercentage);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// gHUD.HideProgressStatus();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
// Fire light smoke from muzzle
|
||||
|
|
|
@ -654,6 +654,9 @@ void AvHHud::ClearData()
|
|||
this->mDisplayOrderTime = 0;
|
||||
this->mDisplayOrderType = 0;
|
||||
// :tankefugl
|
||||
|
||||
this->mProgressBarDrawframe = PROGRESS_BAR_DEFAULT;
|
||||
this->mProgressBarLastDrawn = -10.0f;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2573,6 +2576,8 @@ void AvHHud::ResetGame(bool inMapChanged)
|
|||
this->mCenterText.clear();
|
||||
this->mCenterTextTime = -1;
|
||||
// :tankefugl
|
||||
|
||||
this->mProgressBarLastDrawn = -10.0f;
|
||||
}
|
||||
|
||||
BIND_MESSAGE(SetGmma);
|
||||
|
@ -3563,15 +3568,17 @@ bool AvHHud::GetMouseTwoDown() const
|
|||
|
||||
void AvHHud::HideProgressStatus()
|
||||
{
|
||||
if(this->mGenericProgressBar)
|
||||
{
|
||||
this->mGenericProgressBar->setVisible(false);
|
||||
}
|
||||
this->mProgressBarLastDrawn = -1.0f;
|
||||
|
||||
if(this->mAlienProgressBar)
|
||||
{
|
||||
this->mAlienProgressBar->setVisible(false);
|
||||
}
|
||||
// if(this->mGenericProgressBar)
|
||||
// {
|
||||
// this->mGenericProgressBar->setVisible(false);
|
||||
// }
|
||||
//
|
||||
// if(this->mAlienProgressBar)
|
||||
// {
|
||||
// this->mAlienProgressBar->setVisible(false);
|
||||
// }
|
||||
}
|
||||
|
||||
void AvHHud::HideResearchProgressStatus()
|
||||
|
@ -4430,32 +4437,37 @@ void AvHHud::SetAlienAbility(AvHMessageID inAlienAbility)
|
|||
this->mAlienAbility = inAlienAbility;
|
||||
}
|
||||
|
||||
void AvHHud::SetProgressStatus(float inPercentage)
|
||||
void AvHHud::SetProgressStatus(float inPercentage, int inProgressbarType)
|
||||
{
|
||||
if(this->mGenericProgressBar)
|
||||
{
|
||||
this->mGenericProgressBar->setVisible(false);
|
||||
}
|
||||
this->mProgressBarStatus = inPercentage;
|
||||
this->mProgressBarLastDrawn = this->GetTimeOfLastUpdate();
|
||||
this->mProgressBarDrawframe = inProgressbarType;
|
||||
|
||||
if(this->mAlienProgressBar)
|
||||
{
|
||||
this->mAlienProgressBar->setVisible(false);
|
||||
}
|
||||
// if(this->mGenericProgressBar)
|
||||
// {
|
||||
// this->mGenericProgressBar->setVisible(false);
|
||||
// }
|
||||
//
|
||||
// if(this->mAlienProgressBar)
|
||||
// {
|
||||
// this->mAlienProgressBar->setVisible(false);
|
||||
// }
|
||||
//
|
||||
// ProgressBar* theProgressBar = this->mGenericProgressBar;
|
||||
// if(this->GetIsAlien())
|
||||
// {
|
||||
// theProgressBar = this->mAlienProgressBar;
|
||||
// }
|
||||
//
|
||||
// if(theProgressBar)
|
||||
// {
|
||||
// theProgressBar->setVisible(true);
|
||||
//
|
||||
// int theNumSegments = theProgressBar->getSegmentCount();
|
||||
// int theSegment = inPercentage*theNumSegments;
|
||||
// theProgressBar->setProgress(theSegment);
|
||||
// }
|
||||
|
||||
ProgressBar* theProgressBar = this->mGenericProgressBar;
|
||||
if(this->GetIsAlien())
|
||||
{
|
||||
theProgressBar = this->mAlienProgressBar;
|
||||
}
|
||||
|
||||
if(theProgressBar)
|
||||
{
|
||||
theProgressBar->setVisible(true);
|
||||
|
||||
int theNumSegments = theProgressBar->getSegmentCount();
|
||||
int theSegment = inPercentage*theNumSegments;
|
||||
theProgressBar->setProgress(theSegment);
|
||||
}
|
||||
}
|
||||
|
||||
void AvHHud::SetReinforcements(int inReinforcements)
|
||||
|
@ -5696,7 +5708,7 @@ float AvHHud::GetTimeOfLastUpdate() const
|
|||
|
||||
void AvHHud::UpdateProgressBar()
|
||||
{
|
||||
this->HideProgressStatus();
|
||||
// this->HideProgressStatus();
|
||||
|
||||
float thePercentage;
|
||||
if(gMiniMap.GetIsProcessing(&thePercentage))
|
||||
|
@ -5746,9 +5758,10 @@ void AvHHud::UpdateProgressBar()
|
|||
}
|
||||
|
||||
thePercentage = theProgress/kNormalizationNetworkFactor;
|
||||
int theType = (this->GetIsAlien())? PROGRESS_BAR_ALIEN: PROGRESS_BAR_MARINE;
|
||||
if(thePercentage < 1.0f)
|
||||
{
|
||||
this->SetProgressStatus(thePercentage);
|
||||
this->SetProgressStatus(thePercentage, theType);
|
||||
}
|
||||
// else
|
||||
// {
|
||||
|
@ -5764,20 +5777,16 @@ void AvHHud::UpdateProgressBar()
|
|||
if(theEntity)
|
||||
{
|
||||
this->HideProgressStatus();
|
||||
this->HideResearchProgressStatus();
|
||||
//this->HideResearchProgressStatus();
|
||||
|
||||
bool theIsBuilding, theIsResearching;
|
||||
float thePercentage;
|
||||
AvHSHUGetBuildResearchState(theEntity->curstate.iuser3, theEntity->curstate.iuser4, theEntity->curstate.fuser1, theIsBuilding, theIsResearching, thePercentage);
|
||||
|
||||
if(theIsBuilding && (thePercentage > 0.0f) && (thePercentage < 1.0f))
|
||||
if(theIsResearching && (thePercentage > 0) && (thePercentage < 1.0f))
|
||||
{
|
||||
// Turned off progress bar now that we have circular build icons
|
||||
//this->SetGenericProgressStatus(thePercentage);
|
||||
}
|
||||
else if(theIsResearching && (thePercentage > 0) && (thePercentage < 1.0f))
|
||||
{
|
||||
this->SetResearchProgressStatus(thePercentage);
|
||||
this->SetProgressStatus(thePercentage, PROGRESS_BAR_DEFAULT);
|
||||
//this->SetResearchProgressStatus(thePercentage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -321,7 +321,7 @@ public:
|
|||
int GetMaxAlienResources() const;
|
||||
int GetNumActiveHives() const;
|
||||
void HideProgressStatus();
|
||||
void SetProgressStatus(float inPercentage);
|
||||
void SetProgressStatus(float inPercentage, int inProgressbarType = 0);
|
||||
|
||||
AvHVisibleBlipList& GetEnemyBlipList();
|
||||
AvHVisibleBlipList& GetFriendlyBlipList();
|
||||
|
@ -363,6 +363,7 @@ public:
|
|||
void RenderMarineUI();
|
||||
void RenderCommanderUI();
|
||||
void RenderAlienUI();
|
||||
void RenderProgressBar();
|
||||
void RenderMiniMap(int inX, int inY, int inWidth, int inHeight);
|
||||
|
||||
void RenderStructureRanges();
|
||||
|
@ -761,12 +762,17 @@ private:
|
|||
|
||||
int mProgressBarEntityIndex;
|
||||
int mProgressBarParam;
|
||||
float mProgressBarStatus;
|
||||
float mProgressBarLastDrawn;
|
||||
int mProgressBarDrawframe;
|
||||
|
||||
bool mFogActive;
|
||||
vec3_t mFogColor;
|
||||
float mFogStart;
|
||||
float mFogEnd;
|
||||
|
||||
HSPRITE mProgressBarSprite;
|
||||
|
||||
AvHBaseInfoLocationListType mInfoLocationList;
|
||||
string mLocationText;
|
||||
|
||||
|
|
|
@ -2764,6 +2764,8 @@ void AvHHud::Render()
|
|||
{
|
||||
RenderAlienUI();
|
||||
}
|
||||
|
||||
RenderProgressBar();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3026,10 +3028,9 @@ void AvHHud::RenderCommonUI()
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
// Draw the combat HUD.
|
||||
|
||||
if (this->GetIsCombatMode())
|
||||
// Draw the combat HUD.
|
||||
if (this->GetIsCombatMode())
|
||||
{
|
||||
// Now draw our current experience level, so people know how close they are to the next level
|
||||
// Load alien resource and energy sprites
|
||||
|
@ -3081,6 +3082,37 @@ void AvHHud::RenderCommonUI()
|
|||
|
||||
}
|
||||
|
||||
void AvHHud::RenderProgressBar()
|
||||
{
|
||||
// Draw the progress bars
|
||||
const float progressBarStayTime = 0.2f;
|
||||
if (this->mProgressBarLastDrawn + progressBarStayTime > this->GetTimeOfLastUpdate())
|
||||
{
|
||||
if (this->mProgressBarSprite)
|
||||
{
|
||||
const float kNormalizedWidth = .1f;
|
||||
const float kNormalizedYInset = .89f;
|
||||
const float kNormalizedHeight = .025f;
|
||||
|
||||
// Draw full background
|
||||
const int kXStart = mViewport[0] + (.5f - kNormalizedWidth/2.0f)*(mViewport[2] - mViewport[0]);
|
||||
const int kYStart = mViewport[1] + mViewport[3] - (1 - kNormalizedYInset)*ScreenHeight();
|
||||
|
||||
AvHSpriteSetColor(1,1,1);
|
||||
AvHSpriteSetRenderMode(kRenderTransAlpha);
|
||||
|
||||
AvHSpriteDraw(this->mProgressBarSprite, this->mProgressBarDrawframe + 1, kXStart, kYStart, kXStart + kNormalizedWidth*ScreenWidth(), kYStart + kNormalizedHeight*ScreenHeight(), 0, 0, 1, 1);
|
||||
|
||||
// Draw overlay showing progress
|
||||
float theProgress = this->mProgressBarStatus;
|
||||
if((theProgress >= 0.0f) && (theProgress <= 1.0f))
|
||||
{
|
||||
AvHSpriteDraw(this->mProgressBarSprite, this->mProgressBarDrawframe, kXStart, kYStart, kXStart + theProgress*kNormalizedWidth*ScreenWidth(), kYStart + kNormalizedHeight*ScreenHeight(), 0, 0, theProgress, 1.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AvHHud::RenderMiniMap(int inX, int inY, int inWidth, int inHeight)
|
||||
{
|
||||
|
||||
|
@ -4039,7 +4071,7 @@ void AvHHud::RenderAlienUI()
|
|||
|
||||
if(AvHCUWorldToScreen(theMessageWorldPos, (float*)&theScreenPos))
|
||||
{
|
||||
if((theBlipName != "") && (theBlipStatusText != "") && (theLocationName != "") && (CVAR_GET_FLOAT(kvLabelHivesight) == 0))
|
||||
if((theBlipName != "") && (theBlipStatusText != "") && (theLocationName != "") && (CVAR_GET_FLOAT(kvLabelHivesight) == 1))
|
||||
{
|
||||
// Find alpha for the blip-text based on position on the screen
|
||||
float screenWidth = ScreenWidth();
|
||||
|
@ -4362,6 +4394,8 @@ void AvHHud::VidInit(void)
|
|||
this->mTeammateOrderSprite = Safe_SPR_Load(kTeammateOrderSprite);
|
||||
// :tankefugl
|
||||
|
||||
this->mProgressBarSprite = Safe_SPR_Load(kProgressBarSprite);
|
||||
|
||||
this->mEnemyBlips.VidInit();
|
||||
this->mFriendlyBlips.VidInit();
|
||||
}
|
|
@ -93,6 +93,19 @@
|
|||
|
||||
#define kTeammateOrderSprite "sprites/query.spr"
|
||||
|
||||
#define kProgressBarSprite "sprites/640experience.spr"
|
||||
|
||||
#define PROGRESS_BAR_ALIEN 0
|
||||
#define PROGRESS_BAR_GESTATE PROGRESS_BAR_ALIEN
|
||||
#define PROGRESS_BAR_DEVOUR PROGRESS_BAR_ALIEN
|
||||
|
||||
#define PROGRESS_BAR_MARINE 2
|
||||
#define PROGRESS_BAR_RESEARCH PROGRESS_BAR_MARINE
|
||||
#define PROGRESS_BAR_RECYCLE PROGRESS_BAR_MARINE
|
||||
#define PROGRESS_BAR_WELD PROGRESS_BAR_MARINE
|
||||
|
||||
#define PROGRESS_BAR_DEFAULT PROGRESS_BAR_MARINE
|
||||
|
||||
//#define kOverwatchAimSprite "sprites/overwatch-aim.spr"
|
||||
|
||||
#define kMembraneSprite "sprites/membrane.spr"
|
||||
|
|
Loading…
Reference in a new issue