o Updated sprite for generic progressbar.

git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@545 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
puzl 2006-06-29 18:08:09 +00:00
parent 8c99c749c9
commit bbc19e4e4b
4 changed files with 18 additions and 8 deletions

View file

@ -363,7 +363,7 @@ public:
void RenderMarineUI();
void RenderCommanderUI();
void RenderAlienUI();
void RenderProgressBar();
void RenderProgressBar(char *spriteName);
void RenderMiniMap(int inX, int inY, int inWidth, int inHeight);
void RenderStructureRanges();
@ -772,6 +772,7 @@ private:
float mFogStart;
float mFogEnd;
HSPRITE mExperienceBarSprite;
HSPRITE mProgressBarSprite;
AvHBaseInfoLocationListType mInfoLocationList;

View file

@ -2726,7 +2726,7 @@ void AvHHud::Render()
DrawWarpedOverlaySprite(mDigestingSprite, 4, 3, .02, .02, .3, .15);
}
RenderProgressBar();
RenderProgressBar(kProgressBarSprite);
}
else
{
@ -2766,7 +2766,7 @@ void AvHHud::Render()
RenderAlienUI();
}
RenderProgressBar();
RenderProgressBar(kProgressBarSprite);
}
}
@ -3093,13 +3093,20 @@ void AvHHud::RenderCommonUI()
}
void AvHHud::RenderProgressBar()
void AvHHud::RenderProgressBar(char *spriteName)
{
// Draw the progress bars
const float progressBarStayTime = 0.2f;
if (this->mProgressBarLastDrawn + progressBarStayTime > this->GetTimeOfLastUpdate())
{
if (this->mProgressBarSprite)
HSPRITE currentSprite=0;
if ( spriteName && ( strcmp(spriteName, kExperienceBarSprite) == 0 ) ) {
currentSprite=this->mExperienceBarSprite;
}
if ( spriteName && ( strcmp(spriteName, kProgressBarSprite) == 0 ) ) {
currentSprite=this->mProgressBarSprite;
}
if (currentSprite)
{
const float kNormalizedWidth = .1f;
const float kNormalizedYInset = .89f;
@ -3112,13 +3119,13 @@ void AvHHud::RenderProgressBar()
AvHSpriteSetColor(1,1,1);
AvHSpriteSetRenderMode(kRenderTransAlpha);
AvHSpriteDraw(this->mProgressBarSprite, this->mProgressBarDrawframe + 1, kXStart, kYStart, kXStart + kNormalizedWidth*ScreenWidth(), kYStart + kNormalizedHeight*ScreenHeight(), 0, 0, 1, 1);
AvHSpriteDraw(currentSprite, 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);
AvHSpriteDraw(currentSprite, this->mProgressBarDrawframe, kXStart, kYStart, kXStart + theProgress*kNormalizedWidth*ScreenWidth(), kYStart + kNormalizedHeight*ScreenHeight(), 0, 0, theProgress, 1.0f);
}
}
}
@ -4405,6 +4412,7 @@ void AvHHud::VidInit(void)
this->mTeammateOrderSprite = Safe_SPR_Load(kTeammateOrderSprite);
// :tankefugl
this->mExperienceBarSprite = Safe_SPR_Load(kExperienceBarSprite);
this->mProgressBarSprite = Safe_SPR_Load(kProgressBarSprite);
this->mEnemyBlips.VidInit();

View file

@ -93,7 +93,8 @@
#define kTeammateOrderSprite "sprites/query.spr"
#define kProgressBarSprite "sprites/640experience.spr"
#define kExperienceBarSprite "sprites/640experience.spr"
#define kProgressBarSprite "sprites/640progress.spr"
#define PROGRESS_BAR_ALIEN 0
#define PROGRESS_BAR_GESTATE PROGRESS_BAR_ALIEN

Binary file not shown.