diff --git a/releases/3.2.0/source/mod/AvHAlienAbilityConstants.h b/releases/3.2.0/source/mod/AvHAlienAbilityConstants.h index d1e8e793..c2e9bf4a 100644 --- a/releases/3.2.0/source/mod/AvHAlienAbilityConstants.h +++ b/releases/3.2.0/source/mod/AvHAlienAbilityConstants.h @@ -65,6 +65,7 @@ const int kAlienStructureCloakAmount = 0; // :puzl const int kAlienSelfCloakingBaseOpacity = 130; +const int kAlienSelfCloakingMinOpacity = 186; const int kAlienCloakViewModelRenderMode = kRenderTransAdd; const int kAlienCloakViewModelAmount = 35; diff --git a/releases/3.2.0/source/mod/AvHHud.cpp b/releases/3.2.0/source/mod/AvHHud.cpp index ee73be58..a1a3821e 100644 --- a/releases/3.2.0/source/mod/AvHHud.cpp +++ b/releases/3.2.0/source/mod/AvHHud.cpp @@ -6382,12 +6382,12 @@ void AvHHud::UpdateViewModelEffects() theRenderMode = kAlienCloakViewModelRenderMode; theRenderAmount = 10; } - else if( theRenderAmount > kAlienSelfCloakingBaseOpacity && theRenderAmount < 186) + else if( theRenderAmount > kAlienSelfCloakingBaseOpacity && theRenderAmount < kAlienSelfCloakingMinOpacity) { theRenderMode = kAlienCloakViewModelRenderMode; theRenderAmount = 40; } - else if ( theRenderAmount == 186 ) { + else if ( theRenderAmount == kAlienSelfCloakingMinOpacity ) { theRenderMode = kAlienCloakViewModelRenderMode; theRenderAmount = 50; } diff --git a/releases/3.2.0/source/mod/AvHHud.h b/releases/3.2.0/source/mod/AvHHud.h index 23c3b24d..fcaac103 100644 --- a/releases/3.2.0/source/mod/AvHHud.h +++ b/releases/3.2.0/source/mod/AvHHud.h @@ -702,6 +702,7 @@ private: HSPRITE mMarineUIJetpackSprite; HSPRITE mAlienUIEnergySprite; + HSPRITE mAlienUICloakSprite; HSPRITE mMembraneSprite; HSPRITE mDigestingSprite; diff --git a/releases/3.2.0/source/mod/AvHHudRender.cpp b/releases/3.2.0/source/mod/AvHHudRender.cpp index 6a594ca6..410de8e5 100644 --- a/releases/3.2.0/source/mod/AvHHudRender.cpp +++ b/releases/3.2.0/source/mod/AvHHudRender.cpp @@ -138,6 +138,7 @@ #include "mod/AvHServerVariables.h" #include "mod/AvHSpriteAPI.h" #include "mod/AvHParticleEditorHandler.h" +#include "mod/AvHAlienAbilityConstants.h" #include #include "common/entity_types.h" @@ -3725,6 +3726,30 @@ void AvHHud::RenderAlienUI() AvHSpriteDraw(mAlienUIEnergySprite, 0, theX, theY, theX + theWidth, theY + theHeight * theFactor, 0, 0, 1, theFactor); AvHSpriteDraw(mAlienUIEnergySprite, 1, theX, theY + theHeight * theFactor, theX + theWidth, theY + theHeight, 0, theFactor, 1, 1); + } + + if (mAlienUICloakSprite) + { + cl_entity_s* theLocalPlayer = GetVisiblePlayer(); + if(theLocalPlayer ) { + theX = mViewport[2] - theWidth + mViewport[0]; + + int theAmount=kAlienSelfCloakingMinOpacity; + if ( theLocalPlayer->curstate.renderamt > 0 ) { + theAmount=min(kAlienSelfCloakingMinOpacity, max(kAlienSelfCloakingBaseOpacity,theLocalPlayer->curstate.renderamt)); + } + float theFactor = 1.0f -(float)(theAmount-kAlienSelfCloakingBaseOpacity)/float(kAlienSelfCloakingMinOpacity-kAlienSelfCloakingBaseOpacity); + + AvHSpriteSetColor(1,1,1); + AvHSpriteSetRenderMode(kRenderTransTexture); + + AvHSpriteDraw(mAlienUICloakSprite, 0, theX, theY, theX + theWidth, theY + theHeight * theFactor, 0, 0, 1, theFactor); + AvHSpriteDraw(mAlienUICloakSprite, 1, theX, theY + theHeight * theFactor, theX + theWidth, theY + theHeight, 0, theFactor, 1, 1); +// } +// else { +// int a=0; +// } + } } // Draw hive indicators. @@ -4281,6 +4306,8 @@ void AvHHud::VidInit(void) // Load alien energy sprite theSpriteName = UINameToSprite(kAlienEnergySprite, theScreenWidth); this->mAlienUIEnergySprite = Safe_SPR_Load(theSpriteName.c_str()); + theSpriteName = UINameToSprite(kAlienCloakSprite, theScreenWidth); + this->mAlienUICloakSprite = Safe_SPR_Load(theSpriteName.c_str()); // Load background for topdown mode this->mBackgroundSprite = Safe_SPR_Load(kTopDownBGSprite); diff --git a/releases/3.2.0/source/mod/AvHSprites.h b/releases/3.2.0/source/mod/AvHSprites.h index e4fed1be..1e7e001b 100644 --- a/releases/3.2.0/source/mod/AvHSprites.h +++ b/releases/3.2.0/source/mod/AvHSprites.h @@ -50,6 +50,7 @@ #define kJetpackSprite "jetpack" #define kAlienEnergySprite "a-energy" +#define kAlienCloakSprite "a-cloak" #define kAlienResourceSprite "a-resources" #define kCombatExperienceSprite "experience"