CalcTargetMovementOffset: better integer calculation for max tiles penalty.

SOLDIERTYPE::initialize: initialize additional data.
EVENT_FireSoldierWeapon: if shooting soldier is invisible, locate screen to target spot.
CancelAIAction: reset next AI action.
FindBestPath: improved gas avoiding code.
InGas: improved code, also check the spot itself.
LegalNPCDestination: disabled additional checks to prevent AI deadlock.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8695 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Sevenfm
2019-10-03 16:49:04 +00:00
parent 54e7c1e24d
commit 30df6c350a
7 changed files with 83 additions and 29 deletions
+27 -5
View File
@@ -1114,6 +1114,19 @@ void SOLDIERTYPE::initialize( )
memset( &newdrugs, 0, sizeof(DRUGS) );
memset( &stats, 0, sizeof(STRUCT_Statistics) );
memset( &pathing, 0, sizeof(STRUCT_Pathing) );
// sevenfm:initialize additional data
this->ubLastShock = 0;
this->ubLastSuppression = 0;
this->ubLastAP = 0;
this->ubLastMorale = 0;
this->ubLastShockFromHit = 0;
this->ubLastMoraleFromHit = 0;
this->ubLastAPFromHit = 0;
this->iLastBulletImpact = 0;
this->iLastArmourProtection = 0;
this->usQuickItemId = 0;
this->ubQuickItemSlot = 0;
}
bool SOLDIERTYPE::exists( )
@@ -5084,12 +5097,21 @@ void SOLDIERTYPE::EVENT_FireSoldierWeapon( INT32 sTargetGridNo )
}
else
{
// Set flag indicating we are about to shoot once destination direction is hit
this->flags.fTurningToShoot = TRUE;
if ( this->bTeam != gbPlayerNum && this->bVisible != -1 )
if (this->bTeam != gbPlayerNum)
{
LocateSoldier( this->ubID, DONTSETLOCATOR );
if (this->bVisible != -1)
{
LocateSoldier(this->ubID, DONTSETLOCATOR);
}
else if (!TileIsOutOfBounds(sTargetGridNo) && !GridNoOnScreen(sTargetGridNo))
{
INT16 sNewCenterWorldX = CenterX(sTargetGridNo);
INT16 sNewCenterWorldY = CenterY(sTargetGridNo);
SetRenderCenter(sNewCenterWorldX, sNewCenterWorldY);
// Plot new path!
gfPlotNewMovement = TRUE;
}
}
}
}