New background property: if <croucheddefense> is set, enemy CTH is modified if they fire on us while we are crouched against thick cover (size >= 2) in the direction of the shot.

Backgrounds.xml tag was added in GameDir r2267.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7933 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2015-07-25 12:49:37 +00:00
parent d682b28a31
commit 6aa4e1e6c6
15 changed files with 98 additions and 9 deletions
+9 -9
View File
@@ -15,9 +15,9 @@
#ifdef JA2EDITOR
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.7917 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Unfinished Business - Map Editor v1.13.7933 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.7917 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Map Editor v1.13.7933 (Development Build)" };
#endif
// ------------------------------
@@ -27,11 +27,11 @@
//DEBUG BUILD VERSION
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.7917 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: Unfinished Business - v1.13.7933 (Development Build)" };
#elif defined (JA113DEMO)
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.7917 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: JA2 Demo - v1.13.7933 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.7917 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Debug: v1.13.7933 (Development Build)" };
#endif
#elif defined CRIPPLED_VERSION
@@ -46,16 +46,16 @@
//RELEASE BUILD VERSION
#ifdef JA2UB
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.7917 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release Unfinished Business - v1.13.7933 (Development Build)" };
#elif defined (JA113DEMO)
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.7917 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release JA2 Demo - v1.13.7933 (Development Build)" };
#else
CHAR16 zVersionLabel[256] = { L"Release v1.13.7917 (Development Build)" };
CHAR16 zVersionLabel[256] = { L"Release v1.13.7933 (Development Build)" };
#endif
#endif
CHAR8 czVersionNumber[16] = { "Build 15.07.14" }; //YY.MM.DD
CHAR8 czVersionNumber[16] = { "Build 15.07.25" }; //YY.MM.DD
CHAR16 zTrackingNumber[16] = { L"Z" };
// SAVE_GAME_VERSION is defined in header, change it there
+2
View File
@@ -512,7 +512,9 @@ void AssignBackgroundHelpText( UINT16 ubNumber, MOUSE_REGION* pMouseregion )
else
swprintf( atStr, szBackgroundText_Value[strused + 1] );
wcscat( apStr, L" " );
wcscat( apStr, atStr );
wcscat( apStr, L"\n" );
// smoke has 2 texts, so extra increase of counter is needed
++strused;
+1
View File
@@ -194,6 +194,7 @@ enum {
BG_DISLIKEBG, // dislike any other background that has the negative of this value set
BG_SMOKERTYPE, // 0: doesnt care about smoking 1: will consume cigarettes, dislikes non-smokers 2: will refuse to smoke, dislikes smokers
BG_CROUCHEDDEFENSE, // lowers enemy cth if they fire at us while we are crouched against cover in the direction the shots come from
BG_MAX,
};
+51
View File
@@ -19049,6 +19049,57 @@ FLOAT SOLDIERTYPE::GetBodyWeight()
return 80.0f;
}
// Flugente: are we crouched against cover from a specific direction? WARNING: This does not suffice to determine our cover!
BOOLEAN SOLDIERTYPE::IsCrouchedAgainstCoverFromDir( UINT8 aDirection )
{
// we must be active
if ( !bActive )
return FALSE;
// only valid directions, please
if ( aDirection >= NUM_WORLD_DIRECTIONS )
return FALSE;
// only possible if crouched
if ( gAnimControl[this->usAnimState].ubEndHeight != ANIM_CROUCH )
return FALSE;
// we must be in a sector
if ( !bInSector )
return FALSE;
// this is odd - invalid GridNo...
if ( TileIsOutOfBounds( this->sGridNo ) )
return FALSE;
// not in a car...
if ( this->flags.uiStatusFlags & (SOLDIER_DRIVER | SOLDIER_PASSENGER) )
return FALSE;
// we test whether we are crouched against cover in a specific direction, so determine the gridno to test
INT32 covergridno = NewGridNo( this->sGridNo, DirectionInc( aDirection ) );
// this is odd - invalid GridNo...
if ( TileIsOutOfBounds( covergridno ) )
return FALSE;
// people don't count
if ( WhoIsThere2( covergridno, this->pathing.bLevel ) != NOBODY )
return FALSE;
// if we can sit there, then it's obviously not dense enough to for us to cover againt it
if ( IsLocationSittable( covergridno, this->pathing.bLevel ) )
return FALSE;
INT8 adjacenttileheight = GetTallestStructureHeight( covergridno, this->pathing.bLevel );
if ( adjacenttileheight >= 2 )
return TRUE;
return FALSE;
}
INT32 CheckBleeding( SOLDIERTYPE *pSoldier )
{
INT8 bBandaged; //,savedOurTurn;
+3
View File
@@ -1910,6 +1910,9 @@ public:
// Flugente: assumed character weight (without any items)
FLOAT GetBodyWeight();
// Flugente: are we crouched against cover from a specific direction? WARNING: This does not suffice to determine our cover!
BOOLEAN IsCrouchedAgainstCoverFromDir( UINT8 aDirection );
//////////////////////////////////////////////////////////////////////////////
}; // SOLDIERTYPE;
+18
View File
@@ -7255,6 +7255,15 @@ UINT32 CalcChanceToHitGun(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 ubAimTime,
}
}
// Flugente: backgrounds
if ( pTarget && pTarget->GetBackgroundValue( BG_CROUCHEDDEFENSE ) )
{
if ( pTarget->IsCrouchedAgainstCoverFromDir( GetDirectionFromGridNo( pSoldier->sGridNo, pTarget ) ) )
{
iChance += pTarget->GetBackgroundValue( BG_CROUCHEDDEFENSE );
}
}
// Flugente: check for scope mode
if ( Item[(&(pSoldier->inv[pSoldier->ubAttackingHand]))->usItem].usItemClass == IC_GUN && !pSoldier->IsValidAlternativeFireMode( ubAimTime, sGridNo ) )
{
@@ -13023,6 +13032,15 @@ FLOAT CalcNewChanceToHitBaseTargetBonus(SOLDIERTYPE *pSoldier, SOLDIERTYPE *pTar
// Target has high Agility or Experience and is therefore harder to hit
FLOAT fTempPenalty = (FLOAT)__max((pTarget->stats.bExpLevel*10), pTarget->stats.bAgility);
fBaseModifier += (fTempPenalty * gGameCTHConstants.BASE_AGILE_TARGET) / 100;
// Flugente: backgrounds
if ( pTarget->GetBackgroundValue( BG_CROUCHEDDEFENSE ) )
{
if ( pTarget->IsCrouchedAgainstCoverFromDir( GetDirectionFromGridNo( pSoldier->sGridNo, pTarget ) ) )
{
fBaseModifier += pTarget->GetBackgroundValue( BG_CROUCHEDDEFENSE );
}
}
}
// INVIS TARGET
+6
View File
@@ -131,6 +131,7 @@ backgroundStartElementHandle(void *userData, const XML_Char *name, const XML_Cha
strcmp(name, "ambush_radius" ) == 0 ||
strcmp(name, "dislikebackground" ) == 0 ||
strcmp(name, "smoker" ) == 0 ||
strcmp(name, "croucheddefense" ) == 0 ||
strcmp(name, "druguse") == 0 ||
strcmp(name, "xenophobic") == 0 ||
strcmp(name, "corruptionspread") == 0 ||
@@ -555,6 +556,11 @@ backgroundEndElementHandle(void *userData, const XML_Char *name)
pData->curElement = ELEMENT;
pData->curBackground.value[BG_SMOKERTYPE] = min( 2, max( 0, (INT16)atol( pData->szCharData ) ) );
}
else if ( strcmp( name, "croucheddefense" ) == 0 )
{
pData->curElement = ELEMENT;
pData->curBackground.value[BG_CROUCHEDDEFENSE] = min( 30, max( -30, (INT16)atol( pData->szCharData ) ) );
}
else if(strcmp(name, "druguse") == 0)
{
pData->curElement = ELEMENT;
+1
View File
@@ -8283,6 +8283,7 @@ STR16 szBackgroundText_Value[]=
L" dislikes some other backgrounds\n", // TODO.Translate
L"Smoker",
L"Nonsmoker",
L" %s%d%% enemy CTH if crouched against thick cover in their direction\n",
};
STR16 szBackgroundTitleText[] =
+1
View File
@@ -8296,6 +8296,7 @@ STR16 szBackgroundText_Value[]=
L" dislikes some other backgrounds\n", // TODO.Translate
L"Smoker",
L"Nonsmoker",
L" %s%d%% enemy CTH if crouched against thick cover in their direction\n",
};
STR16 szBackgroundTitleText[] = // TODO.Translate
+1
View File
@@ -8281,6 +8281,7 @@ STR16 szBackgroundText_Value[]=
L" dislikes some other backgrounds\n",
L"Smoker",
L"Nonsmoker",
L" %s%d%% enemy CTH if crouched against thick cover in their direction\n",
};
STR16 szBackgroundTitleText[] =
+1
View File
@@ -8282,6 +8282,7 @@ STR16 szBackgroundText_Value[]=
L" dislikes some other backgrounds\n", // TODO.Translate
L"Smoker",
L"Nonsmoker",
L" %s%d%% enemy CTH if crouched against thick cover in their direction\n",
};
STR16 szBackgroundTitleText[] =
+1
View File
@@ -8113,6 +8113,7 @@ STR16 szBackgroundText_Value[]=
L" dislikes some other backgrounds\n", // TODO.Translate
L"Smoker",
L"Nonsmoker",
L" %s%d%% enemy CTH if crouched against thick cover in their direction\n",
};
STR16 szBackgroundTitleText[] = // TODO.Translate
+1
View File
@@ -8291,6 +8291,7 @@ STR16 szBackgroundText_Value[]=
L" dislikes some other backgrounds\n", // TODO.Translate
L"Smoker",
L"Nonsmoker",
L" %s%d%% enemy CTH if crouched against thick cover in their direction\n",
};
STR16 szBackgroundTitleText[] = // TODO.Translate
+1
View File
@@ -8308,6 +8308,7 @@ STR16 szBackgroundText_Value[]=
L" dislikes some other backgrounds\n", // TODO.Translate
L"Smoker",
L"Nonsmoker",
L" %s%d%% enemy CTH if crouched against thick cover in their direction\n",
};
STR16 szBackgroundTitleText[] = // TODO.Translate
+1
View File
@@ -8281,6 +8281,7 @@ STR16 szBackgroundText_Value[]=
L" dislikes some other backgrounds\n", // TODO.Translate
L"Smoker",
L"Nonsmoker",
L" %s%d%% enemy CTH if crouched against thick cover in their direction\n",
};
STR16 szBackgroundTitleText[] =