Mantis: 991

o Tranmit marine health and armour so marines can see armour ring when welding.


git-svn-id: https://unknownworlds.svn.cloudforge.com/ns1@333 67975925-1194-0748-b3d5-c16f83f1a3a1
This commit is contained in:
puzl 2005-09-26 16:53:29 +00:00
parent baf3208669
commit e5a83b647a
3 changed files with 27 additions and 8 deletions

View file

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

View file

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

View file

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