mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
EstimatePathCostToLocation: safety checks.
Main Red AI: fixed decision weight calculation. Player mercs should avoid moving into gas/fire when in autobandage mode or under AI control. IsLocationSittable, IsLocationSittableExcludingPeople: return FALSE if location on roof does not exist. NWSS: play room effect for first shot only. AI inventory choosing: more variety for mortar shells, improved hand/GL grenade choosing code. Red AI: improved mortar use code: use next action to fire mortar after stepping back. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8920 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1164,12 +1164,16 @@ void ChooseGrenadesForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bGrena
|
||||
// return here in any case
|
||||
if (itemMortar > 0 )
|
||||
{
|
||||
usItem = PickARandomLaunchable ( itemMortar );
|
||||
if ( usItem > 0 )
|
||||
// sevenfm: more variety for mortar shells
|
||||
for (int i = 0; i < bGrenades; i++)
|
||||
{
|
||||
CreateItems( usItem, (INT8) (80 + Random(21)), bGrenades, &gTempObject );
|
||||
gTempObject.fFlags |= OBJECT_UNDROPPABLE;
|
||||
PlaceObjectInSoldierCreateStruct( pp, &gTempObject );
|
||||
usItem = PickARandomLaunchable(itemMortar);
|
||||
if (usItem > 0)
|
||||
{
|
||||
CreateItems(usItem, (INT8)(80 + Random(21)), 1, &gTempObject);
|
||||
gTempObject.fFlags |= OBJECT_UNDROPPABLE;
|
||||
PlaceObjectInSoldierCreateStruct(pp, &gTempObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1214,9 +1218,7 @@ void ChooseGrenadesForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bGrena
|
||||
//do this for every 1-2 grenades so that we can get more variety
|
||||
while ( bGrenades > 0 )
|
||||
{
|
||||
count = Random(3);
|
||||
if ( count > bGrenades )
|
||||
count = bGrenades;
|
||||
count = min(1 + Random(2), bGrenades);
|
||||
|
||||
usItem = PickARandomLaunchable ( itemGrenadeLauncher );
|
||||
if ( usItem > 0 && count > 0 )
|
||||
@@ -1236,9 +1238,7 @@ void ChooseGrenadesForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bGrena
|
||||
//do this for every 1-2 grenades so that we can get more variety
|
||||
while ( bGrenades > 0 )
|
||||
{
|
||||
count = Random(3);
|
||||
if ( count > bGrenades )
|
||||
count = bGrenades;
|
||||
count = min(1 + Random(2), bGrenades);
|
||||
|
||||
usItem = PickARandomItem ( GRENADE, pp->ubSoldierClass, bGrenadeClass, FALSE );
|
||||
if ( usItem > 0 && count > 0 )
|
||||
|
||||
+12
-4
@@ -5343,12 +5343,17 @@ BOOLEAN IsLocationSittable( INT32 iMapIndex, BOOLEAN fOnRoof )
|
||||
{
|
||||
STRUCTURE *pStructure;
|
||||
INT16 sDesiredLevel;
|
||||
|
||||
if( WhoIsThere2( iMapIndex, 0 ) != NOBODY )
|
||||
return FALSE;
|
||||
|
||||
//Locations on roofs without a roof is not possible, so
|
||||
//we convert the onroof intention to ground.
|
||||
if( fOnRoof && !FlatRoofAboveGridNo( iMapIndex ) )
|
||||
fOnRoof = FALSE;
|
||||
// sevenfm: return FALSE if location on roof does not exist
|
||||
if (fOnRoof && !FlatRoofAboveGridNo(iMapIndex))
|
||||
return FALSE;
|
||||
//fOnRoof = FALSE;
|
||||
|
||||
// Check structure database
|
||||
if( gpWorldLevelData[ iMapIndex ].pStructureHead )
|
||||
{
|
||||
@@ -5373,8 +5378,11 @@ BOOLEAN IsLocationSittableExcludingPeople( INT32 iMapIndex, BOOLEAN fOnRoof )
|
||||
|
||||
//Locations on roofs without a roof is not possible, so
|
||||
//we convert the onroof intention to ground.
|
||||
if( fOnRoof && !FlatRoofAboveGridNo( iMapIndex ) )
|
||||
fOnRoof = FALSE;
|
||||
// sevenfm: return FALSE if location on roof does not exist
|
||||
if (fOnRoof && !FlatRoofAboveGridNo(iMapIndex))
|
||||
return FALSE;
|
||||
//fOnRoof = FALSE;
|
||||
|
||||
// Check structure database
|
||||
if( gpWorldLevelData[ iMapIndex ].pStructureHead )
|
||||
{
|
||||
|
||||
+1
-1
@@ -3159,7 +3159,7 @@ if(!GridNoOnVisibleWorldTile(iDestination))
|
||||
}
|
||||
|
||||
// sevenfm: skip gas if not in gas already
|
||||
if (!(s->flags.uiStatusFlags & SOLDIER_PC) &&
|
||||
if ((!(s->flags.uiStatusFlags & SOLDIER_PC) || gTacticalStatus.fAutoBandageMode || s->flags.uiStatusFlags & SOLDIER_PCUNDERAICONTROL) &&
|
||||
InGasSpot(s, newLoc, bLevel) &&
|
||||
!InGasSpot(s, s->sGridNo, bLevel))
|
||||
{
|
||||
|
||||
@@ -2027,7 +2027,11 @@ void PlayWeaponSound(SOLDIERTYPE *pSoldier, OBJECTTYPE *pObjHand, OBJECTTYPE *pO
|
||||
bTerrainType = FLAT_FLOOR;
|
||||
if (pSector)
|
||||
ubSectorType = pSector->ubTraversability[THROUGH_STRATEGIC_MOVE];
|
||||
if (InARoom(pSoldier->sGridNo, NULL) && pSoldier->pathing.bLevel == 0 && bTerrainType == FLAT_FLOOR && CheckRoof(pSoldier->sGridNo))
|
||||
if (InARoom(pSoldier->sGridNo, NULL) &&
|
||||
pSoldier->pathing.bLevel == 0 &&
|
||||
bTerrainType == FLAT_FLOOR &&
|
||||
CheckRoof(pSoldier->sGridNo) &&
|
||||
pSoldier->bDoBurst <= 1)
|
||||
fRoom = TRUE;
|
||||
if (pSoldier->ubAttackingHand == HANDPOS)
|
||||
fMainHand = TRUE;
|
||||
|
||||
Reference in New Issue
Block a user