diff --git a/releases/3.1/delta.lst b/releases/3.1/delta.lst index 583637de..1003a6aa 100644 --- a/releases/3.1/delta.lst +++ b/releases/3.1/delta.lst @@ -178,7 +178,7 @@ entity_state_player_t gamedll Player_Encode DEFINE_DELTA( spectator, DT_INTEGER, 1, 1.0 ), DEFINE_DELTA( iuser3, DT_INTEGER, 6, 1.0 ), // Need player info for AvHCommanderModeHandler::LookupClassNameForEntity DEFINE_DELTA( iuser4, DT_INTEGER, 32, 1.0 ), // NS custom parameter (needs 32 for AvHSpecialSound) - DEFINE_DELTA( fuser2, DT_FLOAT, 12, 1.0 ), // For player health (energy is predicted so this isn't needed for it) + DEFINE_DELTA( fuser2, DT_FLOAT, 14, 1.0 ), // For player health (energy is predicted so this isn't needed for it) DEFINE_DELTA( vuser1[0], DT_ANGLE, 8, 1.0 ), DEFINE_DELTA( vuser1[1], DT_ANGLE, 8, 1.0 ), DEFINE_DELTA( vuser1[2], DT_ANGLE, 8, 1.0 ), diff --git a/releases/3.1/source/mod/AvHHudRender.cpp b/releases/3.1/source/mod/AvHHudRender.cpp index ef0f2555..e59a58ed 100644 --- a/releases/3.1/source/mod/AvHHudRender.cpp +++ b/releases/3.1/source/mod/AvHHudRender.cpp @@ -2414,7 +2414,10 @@ void AvHHud::DrawBuildHealthEffectsForEntity(int inEntityIndex, float inAlpha) float theHealthPercentage = 0.0f; double theDistanceToEntity = 0; + cl_entity_s* theEntity = gEngfuncs.GetEntityByIndex(inEntityIndex); + bool theEntityIsPlayer = ((inEntityIndex > 0) && (inEntityIndex <= gEngfuncs.GetMaxClients())); + if(theEntity) { theUser3 = theEntity->curstate.iuser3; @@ -2435,7 +2438,17 @@ void AvHHud::DrawBuildHealthEffectsForEntity(int inEntityIndex, float inAlpha) theMins = theEntity->curstate.mins; theMaxs = theEntity->curstate.maxs; theHealthPercentage = theEntity->curstate.fuser2/kNormalizationNetworkFactor; - + // puzl: 991 transmit armour and health for marines + if ( GetIsMarine() && theEntityIsPlayer ) { + int tmpPercent=theEntity->curstate.fuser2; + if ( GetInTopDownMode() ) { + theHealthPercentage = (float)(tmpPercent&0x7F)/100; + } + else { + theHealthPercentage = (float)(tmpPercent >> 7)/100; + } + } + // :puzl theContinue = true; } @@ -2444,7 +2457,6 @@ void AvHHud::DrawBuildHealthEffectsForEntity(int inEntityIndex, float inAlpha) bool theDrewBuildInProgress = false; float theOversizeScalar = 1.0f; - bool theEntityIsPlayer = ((inEntityIndex > 0) && (inEntityIndex <= gEngfuncs.GetMaxClients())); bool theIsOnOurTeam = (theEntityTeam == (int)this->GetHUDTeam()); if(AvHSHUGetDrawRingsForUser3((AvHUser3)theUser3, theOversizeScalar)) diff --git a/releases/3.1/source/mod/AvHPlayer.cpp b/releases/3.1/source/mod/AvHPlayer.cpp index bb07b1fd..a62cd722 100644 --- a/releases/3.1/source/mod/AvHPlayer.cpp +++ b/releases/3.1/source/mod/AvHPlayer.cpp @@ -6522,13 +6522,20 @@ void AvHPlayer::InternalCommonThink() int theMaxArmor = AvHPlayerUpgrade::GetMaxArmorLevel(this->pev->iuser4, (AvHUser3)this->pev->iuser3); int theCurrentArmor = max(0.0f, this->pev->armorvalue); - // Draw ring to take into account health and armor for aliens, just health for marines (so gorge and comm know when to heal) - float theScalar = (float)theCurrentHealth/theMaxHealth; - if(this->GetIsAlien()) + // Draw ring to take into account health and armor for aliens, + // Send armor and health for marines + if(this->GetIsMarine()) { - theScalar = (theCurrentHealth + theCurrentArmor)/(float)(theMaxHealth + theMaxArmor); + // puzl: 991 use a composite for marine armour and health + int theCurrentArmorPercent=(theCurrentArmor*100)/theMaxArmor; + int theCurrentHealthPercent=(theCurrentHealth*100)/theMaxHealth; + this->pev->fuser2= (float)( ((theCurrentArmorPercent&0x7F) << 7 ) + (theCurrentHealthPercent & 0x7F)); } - this->pev->fuser2 = theScalar*kNormalizationNetworkFactor; + else + { + float theScalar = (float)(theCurrentHealth + theCurrentArmor)/(float)(theMaxHealth + theMaxArmor); + this->pev->fuser2 = theScalar*kNormalizationNetworkFactor; + } //float theRandomAngle = RANDOM_FLOAT(0, 50); //this->pev->v_angle.x = theRandomAngle;