Small visual changes (by Sevenfm)

see: http://www.bears-pit.com/board/ubbthreads.php/topics/172712/16/Code_Snippets.html

1) ENEMY_HIT_COUNT in ja2_options.ini accepts 2 new parameters:
  3 - show damage as white asterisks
  4 - show damage as red asterisks
  Number of asterisks is scaled (maximum 5): >0, >10, >30, >60, >100

2) Suppression tactical tooltip now shows suppression points from last attacks.
Previously it was always = 0 because ubSuppressionPoints value is cleared after each attack.

3) It is now possible to show suppression values above soldier, just as hit count.
There are new options in ja2_options.ini

Possible values:
 0 - do not show
 1 - show on moving hit counter
 2 - show above soldier
The values are color coded:
 Suppression is light gray
 Shock is yellow
 AP loss is blue
 Morale hit is green

SHOW_SUPPRESSION_COUNT = 0
SHOW_SHOCK_COUNT = 0
SHOW_AP_COUNT = 0
SHOW_MORALE_COUNT = 0

This option defines if values are shown as numbers or asterisks (1..5, using scale)
SHOW_SUPPRESSION_USE_ASTERISK = FALSE

This option defines if only 1 asterisk is shown or several (1..5) to represent value
SHOW_SUPPRESSION_SCALE_ASTERISK = TRUE

Show suppression above soldier during enemy attack. All other values are shown after attack, when HandleSuppressionFire function is calculated.
SHOW_SUPPRESSION_COUNT_ALT = TRUE

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6689 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2013-12-10 11:04:59 +00:00
parent 467649c7a4
commit 534af956c8
9 changed files with 389 additions and 8 deletions
+40 -1
View File
@@ -8246,8 +8246,12 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
// To turn off the entire Suppression system, simply set the INI value to 0. (0% AP Loss)
// The default is obviously 100%. You can increase or decrease it, at will.
// PLEASE NOTE that AP loss governs ALL OTHER SUPPRESSION EFFECTS.
ubPointsLost = ( ubPointsLost * sFinalSuppressionEffectiveness ) / 100;
// sevenfm: commented out duplicated code: we don't want to apply ubFinalSuppressionEffectivness twice
// ubPointsLost = ( ubPointsLost * sFinalSuppressionEffectiveness ) / 100;
// This is an upper cap for the number of APs we can lose per attack.
// sevenfm: commented out duplicated code:
/*
if (usLimitSuppressionAPsLostPerAttack > 0)
{
if (ubPointsLost > usLimitSuppressionAPsLostPerAttack)
@@ -8257,6 +8261,7 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
ubPointsLost = __min(255,(UINT8)usLimitSuppressionAPsLostPerAttack);
}
}
*/
// INI-Controlled intensity. SuppressionEffectiveness acts as a percentage applied to the number of lost APs.
// To turn off the entire Suppression system, simply set the INI value to 0. (0% AP Loss)
@@ -8290,6 +8295,8 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
// difficult to perform certain manual tasks. Additionally, he also becomes harder to hit, because the fear
// causes him to hide as best as he can from incoming fire.
// Shock is sliced in half at the start of every turn. Also note that shock may cause "cowering" (see below).
pSoldier->ubLastShock = 0;
if (gGameExternalOptions.usSuppressionShockEffect > 0)
{
// Can't get shock if we haven't lost APs.
@@ -8314,6 +8321,7 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
// from suppression and/or wounds. It is possible to breach the maximum after a good suppressive
// attack.
UINT8 oldShock = pSoldier->aiData.bShock;
if ( pSoldier->aiData.bShock + bShockValue <= bShockLimit )
{
// Shock limit not yet breached. Add shock to character.
@@ -8324,6 +8332,8 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
// Original shock was lower than the limit, so add extra shock and breach the limit.
pSoldier->aiData.bShock = __min(127, pSoldier->aiData.bShock + bShockValue);
}
// sevenfm: update ubLastShock
pSoldier->ubLastShock = __min(255, pSoldier->aiData.bShock - oldShock );
// Else, original shock was already over the limit. No more shock is added.
}
// HEADROCK: Cowering is the panic that grips a character due to suffering too much suppression shock. If
@@ -8365,6 +8375,7 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
}
}
pSoldier->ubLastMorale = 0;
// Suppression reduces morale. For every X APs lost, morale goes down by a point. X is defined by INI.
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("HandleSuppressionFire: check for morale effects"));
if (APBPConstants[AP_LOST_PER_MORALE_DROP] > 0 && ubPointsLost > 0)
@@ -8372,6 +8383,8 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
for ( ubLoop2 = 0; ubLoop2 < (ubPointsLost / APBPConstants[AP_LOST_PER_MORALE_DROP]); ubLoop2++ )
{
HandleMoraleEvent( pSoldier, MORALE_SUPPRESSED, pSoldier->sSectorX, pSoldier->sSectorY, pSoldier->bSectorZ );
// sevenfm: update ubLastMorale
pSoldier->ubLastMorale++;
}
}
@@ -8587,6 +8600,32 @@ void HandleSuppressionFire( UINT8 ubTargetedMerc, UINT8 ubCausedAttacker )
pSoldier->flags.fDontChargeAPsForStanceChange = TRUE;
}
// sevenfm: update suppression, AP values for displaying above soldier
pSoldier->ubLastSuppression = pSoldier->ubSuppressionPoints;
pSoldier->ubLastAP = ubPointsLost;
// add suppression valued from hit to shock valued calculated in this function
pSoldier->ubLastShock += pSoldier->ubLastShockFromHit;
pSoldier->ubLastShockFromHit = 0;
pSoldier->ubLastAP += pSoldier->ubLastAPFromHit;
pSoldier->ubLastAPFromHit = 0;
pSoldier->ubLastMorale += pSoldier->ubLastMoraleFromHit;
pSoldier->ubLastMoraleFromHit = 0;
if( ubPointsLost > 0 )
{
if( pSoldier->flags.fDisplayDamage )
{
// prolongate damage show time
pSoldier->bDisplayDamageCount = 0;
}
else
{
// start new damage show counter
SetDamageDisplayCounter( pSoldier );
}
}
// HEADROCK HAM 3.5: After sufficient testing, suppression clearing now works immediately at the end of
// the attack. ubAPsLostToSuppression is only cleared at the end of the turn, but no longer plays a role
// in affecting the number of APs lost, so it is largely irrelevant now.