Attached Files | hparmor.diff [^] (4,642 bytes) 2015-02-15 00:36 [Show Content] [Hide Content]diff -r 3e26f5eca137 src/g_shared/shared_sbar.cpp
--- a/src/g_shared/shared_sbar.cpp Sun Oct 05 21:47:04 2014 +0200
+++ b/src/g_shared/shared_sbar.cpp Sat Feb 14 18:24:14 2015 -0600
@@ -1706,61 +1706,100 @@
if (( NETWORK_GetState( ) == NETSTATE_CLIENT ) && ( CLIENT_GetConnectionState( ) == CTS_RECEIVINGSNAPSHOT ))
return;
- if (( CPlayer->bSpectating ) && ( lastmanstanding || teamlms ) && ( LASTMANSTANDING_GetState( ) == LMSS_INPROGRESS ))
- return;
+ // [Cata] Commented out the statement below as there is no logical reason for this to be here.
+ //if (( CPlayer->bSpectating ) && ( lastmanstanding || teamlms ) && ( LASTMANSTANDING_GetState( ) == LMSS_INPROGRESS ))
+ // return;
// Look for players directly in front of the player.
if ( camera )
{
- player_t *pTargetPlayer;
+ player_t *targetPlayer;
ULONG ulTextColor;
char szString[64];
DHUDMessageFadeOut *pMsg;
-
// Search for a player directly in front of the camera. If none are found, exit.
- pTargetPlayer = P_PlayerScan( camera );
- if ( pTargetPlayer == NULL )
+ targetPlayer = P_PlayerScan( camera );
+ if ( targetPlayer == NULL )
return;
// Build the string and text color;
ulTextColor = CR_GRAY;
// [RC] Assume everyone's your enemy to create consistency, even in deathmatch when you have no allies.
- char szDiplomacyStatus[9];
- strcpy(szDiplomacyStatus, "\\crEnemy");
+
+ // [Cata] Identify target also shows health and armor now.
+ FString targetInfoMsg;
- // Attempt to use the team color.
- if ( GAMEMODE_GetFlags( GAMEMODE_GetCurrentMode( )) & GMF_PLAYERSONTEAMS )
- {
- if( pTargetPlayer->mo->IsTeammate( players[consoleplayer].mo) )
- strcpy(szDiplomacyStatus, "\\cqAlly");
-
- if ( pTargetPlayer->bOnTeam )
- ulTextColor = TEAM_GetTextColor( pTargetPlayer->ulTeam );
+ // [Cata] Grabs player starting health and current armor.
+ ABasicArmor *armor = targetPlayer->mo->FindInventory<ABasicArmor> ();
+ int health = targetPlayer->mo->GetMaxHealth();
+
+ // [Cata] Health divisor; < 25% = red; < 50% = orange; < 75% = yellow; < 100% = green; Above 100% = light blue.
+ int healthDiv = health/4;
+
+ // [Cata] Max armor depends on what armor you have. Generally < 100% green; < 200% blue; otherwise red.
+ int armorDiv = 100;
+
+ if ( targetPlayer->mo->IsTeammate(players[consoleplayer].mo) )
+ {
+ targetInfoMsg += "\\cqAlly\\n\\c";
+
+ if ( targetPlayer->health <= healthDiv )
+ targetInfoMsg += "a";
+ else if ( targetPlayer->health <= healthDiv * 2)
+ targetInfoMsg += "i";
+ else if ( targetPlayer->health <= healthDiv * 3)
+ targetInfoMsg += "f";
+ else if ( targetPlayer->health <= healthDiv * 4)
+ targetInfoMsg += "d";
+ else
+ targetInfoMsg += "n";
+
+ targetInfoMsg.AppendFormat("%d%%", targetPlayer->health);
+
+ if ( armor->Amount > 0 )
+ {
+ targetInfoMsg += " \\cj/ \\c";
+ if ( armor->Amount <= armorDiv )
+ targetInfoMsg += "d";
+ else if ( armor->Amount <= armorDiv * 2)
+ targetInfoMsg += "n";
+ else
+ targetInfoMsg += "a";
+
+ targetInfoMsg.AppendFormat("%d%%", armor->Amount);
+ }
}
else
- {
- // If this player is carrying the terminator artifact, display his name in red.
- if ( (terminator) && (pTargetPlayer->cheats2 & CF2_TERMINATORARTIFACT) )
- ulTextColor = CR_RED;
- }
+ targetInfoMsg += "\\crEnemy";
- // In cooperative modes, all players are allies.
- if(GAMEMODE_GetFlags( GAMEMODE_GetCurrentMode( )) & GMF_COOPERATIVE)
- strcpy(szDiplomacyStatus, "\\cqAlly");
+ // Attempt to use the team color.
+ if ( GAMEMODE_GetFlags( GAMEMODE_GetCurrentMode( )) & GMF_PLAYERSONTEAMS )
+ {
+ if ( targetPlayer->bOnTeam )
+ ulTextColor = TEAM_GetTextColor( targetPlayer->ulTeam );
+ }
+ else
+ {
+ // If this player is carrying the terminator artifact, display his name in red.
+ if ( (terminator) && (targetPlayer->cheats2 & CF2_TERMINATORARTIFACT) )
+ ulTextColor = CR_RED;
+ }
// [BB] Be sure not to use szString as destination and as part of the argument!
- sprintf(szString, "%s\\n%s", pTargetPlayer->userinfo.netname, szDiplomacyStatus);
+ sprintf(szString, "%s\\n%s", targetPlayer->userinfo.netname, targetInfoMsg.GetChars());
+
V_ColorizeString(szString);
+ // [Cata] I adjusted some values to make the message feel more responsive.
pMsg = new DHUDMessageFadeOut( SmallFont, szString,
1.5f,
- gameinfo.gametype == GAME_Doom ? 0.96f : 0.95f,
+ 0.9f,
0,
0,
(EColorRange)ulTextColor,
- 2.f,
- 0.35f );
+ 1.0f,
+ 0.25f);
AttachMessage( pMsg, MAKE_ID('P','N','A','M') );
}
|