mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
-enabled snipers to turn in place in random directions in green status
-spreadsheet update git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@222 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -2549,12 +2549,15 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier)
|
||||
|
||||
case AI_ACTION_LOWER_GUN:
|
||||
// for now, just do "action done"
|
||||
InternalSoldierReadyWeapon(pSoldier,pSoldier->bDirection,TRUE);
|
||||
HandleSight(pSoldier, SIGHT_LOOK );
|
||||
ActionDone( pSoldier );
|
||||
break;
|
||||
|
||||
case AI_ACTION_RAISE_GUN: //Madd: action added for snipers to ready weapon and use vision range bonuses
|
||||
SoldierReadyWeapon(pSoldier);
|
||||
HandleSight(pSoldier, SIGHT_LOOK | SIGHT_RADIO);
|
||||
ActionDone( pSoldier );
|
||||
break;
|
||||
|
||||
case AI_ACTION_CLIMB_ROOF:
|
||||
|
||||
+34
-25
@@ -677,7 +677,7 @@ INT8 DecideActionGreen(SOLDIERTYPE *pSoldier)
|
||||
STR16 tempstr;
|
||||
#endif
|
||||
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen"));
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen, orders = %d",pSoldier->bOrders));
|
||||
|
||||
BOOLEAN fCivilian = (PTR_CIVILIAN && (pSoldier->ubCivilianGroup == NON_CIV_GROUP || pSoldier->bNeutral || (pSoldier->ubBodyType >= FATCIV && pSoldier->ubBodyType <= CRIPPLECIV) ) );
|
||||
BOOLEAN fCivilianOrMilitia = PTR_CIV_OR_MILITIA;
|
||||
@@ -1154,7 +1154,7 @@ BOOLEAN fCivilian = (PTR_CIVILIAN && (pSoldier->ubCivilianGroup == NON_CIV_GROUP
|
||||
// SNIPERS LIKE TO CROUCH (even in green)
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Snipers like to crouch"));
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Snipers like to crouch, sniper = %d",pSoldier->sniper));
|
||||
// if not in water and not already crouched, try to crouch down first
|
||||
if (pSoldier->bOrders == SNIPER && !PTR_CROUCHED && IsValidStance( pSoldier, ANIM_CROUCH ) )
|
||||
{
|
||||
@@ -1167,6 +1167,30 @@ BOOLEAN fCivilian = (PTR_CIVILIAN && (pSoldier->ubCivilianGroup == NON_CIV_GROUP
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// SNIPER - RAISE WEAPON TO SCAN AREA
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Snipers like to raise weapons, sniper = %d",pSoldier->sniper));
|
||||
if ( pSoldier->bOrders == SNIPER && pSoldier->sniper == 0 ) //for some reason this check doesn't work: && pSoldier->usAnimState != PickSoldierReadyAnimation( pSoldier, FALSE ) )
|
||||
{
|
||||
if (!gfTurnBasedAI || GetAPsToReadyWeapon( pSoldier, READY_RIFLE_CROUCH ) <= pSoldier->bActionPoints)
|
||||
{
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Sniper is raising weapon, soldier = %d, sniper = %d",pSoldier->ubID,pSoldier->sniper));
|
||||
pSoldier->sniper = 1;
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Sniper = %d",pSoldier->sniper));
|
||||
return(AI_ACTION_RAISE_GUN);
|
||||
}
|
||||
}
|
||||
//else if ( pSoldier->sniper == 1 )
|
||||
//{
|
||||
// DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Sniper is lowering weapon, sniper = %d",pSoldier->sniper));
|
||||
// pSoldier->sniper = 0;
|
||||
// DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Sniper = %d",pSoldier->sniper));
|
||||
// return(AI_ACTION_LOWER_GUN);
|
||||
//}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// LOOK AROUND: determine %chance for man to turn in place
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
@@ -1200,13 +1224,13 @@ BOOLEAN fCivilian = (PTR_CIVILIAN && (pSoldier->ubCivilianGroup == NON_CIV_GROUP
|
||||
// if man has a LEGAL dominant facing, and isn't facing it, he will turn
|
||||
// back towards that facing 50% of the time here (normally just enemies)
|
||||
if ((pSoldier->bDominantDir >= 0) && (pSoldier->bDominantDir <= 8) &&
|
||||
(pSoldier->bDirection != pSoldier->bDominantDir) && PreRandom(2))
|
||||
(pSoldier->bDirection != pSoldier->bDominantDir) && PreRandom(2) && pSoldier->bOrders != SNIPER )
|
||||
{
|
||||
pSoldier->usActionData = pSoldier->bDominantDir;
|
||||
}
|
||||
else
|
||||
{
|
||||
pSoldier->usActionData = (UINT16)PreRandom(8);
|
||||
pSoldier->usActionData = (UINT16)Random(8);
|
||||
}
|
||||
} while (pSoldier->usActionData == pSoldier->bDirection);
|
||||
|
||||
@@ -1216,39 +1240,24 @@ BOOLEAN fCivilian = (PTR_CIVILIAN && (pSoldier->ubCivilianGroup == NON_CIV_GROUP
|
||||
AIPopMessage(tempstr);
|
||||
#endif
|
||||
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Trying to turn - checking stance validity, sniper = %d",pSoldier->sniper));
|
||||
if ( InternalIsValidStance( pSoldier, (INT8) pSoldier->usActionData, gAnimControl[ pSoldier->usAnimState ].ubEndHeight ) )
|
||||
{
|
||||
|
||||
if (!gfTurnBasedAI)
|
||||
if ( !gfTurnBasedAI )
|
||||
{
|
||||
// wait after this...
|
||||
pSoldier->bNextAction = AI_ACTION_WAIT;
|
||||
pSoldier->usNextActionData = RealtimeDelay( pSoldier );
|
||||
}
|
||||
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Soldier is turning"));
|
||||
return(AI_ACTION_CHANGE_FACING);
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Soldier is turning"));
|
||||
return(AI_ACTION_CHANGE_FACING);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// SNIPER - RAISE WEAPON TO SCAN AREA
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Snipers like to raise weapons"));
|
||||
if ( pSoldier->bOrders == SNIPER && pSoldier->sniper == 0 ) //for some reason this check doesn't work: && pSoldier->usAnimState != PickSoldierReadyAnimation( pSoldier, FALSE ) )
|
||||
{
|
||||
if (!gfTurnBasedAI || GetAPsToReadyWeapon( pSoldier, READY_RIFLE_CROUCH ) <= pSoldier->bActionPoints)
|
||||
{
|
||||
DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("DecideActionGreen: Sniper is raising weapon"));
|
||||
pSoldier->sniper = 1;
|
||||
return(AI_ACTION_RAISE_GUN);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// NONE:
|
||||
@@ -1340,7 +1349,7 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
|
||||
if ((pSoldier->bOrders == STATIONARY) || (pSoldier->bOrders == ONGUARD))
|
||||
iChance = 50;
|
||||
else if ( pSoldier->bOrders == SNIPER )
|
||||
iChance = 80;
|
||||
iChance = 90;
|
||||
else // all other orders
|
||||
iChance = 25;
|
||||
|
||||
@@ -2643,7 +2652,7 @@ DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"decideactionred: radio red alert?");
|
||||
case FARPATROL: bSeekPts += 0; bHelpPts += 0; bHidePts += 0; bWatchPts += 0; break;
|
||||
case ONCALL: bSeekPts += 0; bHelpPts += +1; bHidePts += -1; bWatchPts += 0; break;
|
||||
case SEEKENEMY: bSeekPts += +1; bHelpPts += 0; bHidePts += -1; bWatchPts += -1; break;
|
||||
case SNIPER: bSeekPts += -3; bHelpPts += -1; bHidePts += +2; bWatchPts += +1; break;
|
||||
case SNIPER: bSeekPts += -1; bHelpPts += -2; bHidePts += +1; bWatchPts += +2; break;
|
||||
}
|
||||
|
||||
// modify tendencies according to attitude
|
||||
|
||||
Reference in New Issue
Block a user