- Added AndroidXP fixes for Sniper Deadlock and Grenade AP loss

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@797 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
lalien
2007-03-25 15:20:25 +00:00
parent c2528cab4f
commit 6664b92b25
7 changed files with 107 additions and 62 deletions
+2 -2
View File
@@ -23,12 +23,12 @@ INT16 zVersionLabel[256] = { L"Beta v. 0.98" };
#else
//RELEASE BUILD VERSION
wchar_t zVersionLabel[256] = { L"Release v1.13.781" };
wchar_t zVersionLabel[256] = { L"Release v1.13.797" };
#endif
INT8 czVersionNumber[16] = { "Build 07.03.13" }; //YY.MM.DD
INT8 czVersionNumber[16] = { "Build 07.03.25" }; //YY.MM.DD
wchar_t zTrackingNumber[16] = { L"Z" };
+1 -1
View File
@@ -546,7 +546,7 @@
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libexpatMT.lib winmm.lib smackw32.lib mss32.lib fmodvc.lib"
OutputFile="D:\games\Jagged Alliance 2 v1.13\ja2 v1.13.767_EN.exe"
OutputFile="D:\games\Jagged Alliance 2 v1.13\ja2 v1.13.797_EN.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories=".\..\..\Standard Gaming Platform\"
+58 -47
View File
@@ -975,7 +975,6 @@ UINT8 CalcTotalAPsToAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTur
}
else
{
sAPCost += bAimTime;
}
}
@@ -1083,7 +1082,7 @@ UINT8 CalcTotalAPsToAttack( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTur
}
// Add aim time...
sAPCost += bAimTime;
sAPCost += bAimTime;
}
@@ -2129,54 +2128,66 @@ INT16 MinAPsToThrow( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurningCos
INT32 iFullAPs;
INT32 iAPCost = AP_MIN_AIM_ATTACK;
UINT16 usInHand;
UINT16 usTargID;
UINT32 uiMercFlags;
UINT8 ubDirection;
UINT16 usTargID;
UINT32 uiMercFlags;
UINT8 ubDirection;
// make sure the guy's actually got a throwable item in his hand!
usInHand = pSoldier->inv[ HANDPOS ].usItem;
if ( ( !(Item[ usInHand ].usItemClass & IC_GRENADE) ) )
if ( ( !(Item[ usInHand ].usItemClass & IC_GRENADE) ) )
{
//AXP 25.03.2007: See if we are about to throw grenade (grenade was not in hand, but in temp object)
if ( pSoldier->pTempObject != NULL && pSoldier->pThrowParams != NULL &&
pSoldier->pThrowParams->ubActionCode == THROW_ARM_ITEM && (Item[ pSoldier->pTempObject->usItem ].usItemClass & IC_GRENADE) )
{
//nothing here
}
else
{
#ifdef JA2TESTVERSION
ScreenMsg( MSG_FONT_YELLOW, MSG_DEBUG, L"MinAPsToThrow - Called when in-hand item is %s", usInHand );
ScreenMsg( MSG_FONT_YELLOW, MSG_DEBUG, L"MinAPsToThrow - Called when in-hand item is %s", usInHand );
#endif
return(0);
return(0);
}
}
if ( sGridNo != NOWHERE )
{
// Given a gridno here, check if we are on a guy - if so - get his gridno
if ( FindSoldier( sGridNo, &usTargID, &uiMercFlags, FIND_SOLDIER_GRIDNO ) )
{
if ( sGridNo != NOWHERE )
{
// Given a gridno here, check if we are on a guy - if so - get his gridno
if ( FindSoldier( sGridNo, &usTargID, &uiMercFlags, FIND_SOLDIER_GRIDNO ) )
{
sGridNo = MercPtrs[ usTargID ]->sGridNo;
}
}
// OK, get a direction and see if we need to turn...
if (ubAddTurningCost)
{
ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
// OK, get a direction and see if we need to turn...
if (ubAddTurningCost)
{
ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
// Is it the same as he's facing?
if ( ubDirection != pSoldier->bDirection )
// Is it the same as he's facing?
if ( ubDirection != pSoldier->bDirection )
{
//iAPCost += GetAPsToLook( pSoldier );
//Lalien: disabled it again
//AXP 25.03.2007: Reenabled look cost
//iAPCost += GetAPsToLook( pSoldier );
}
}
}
else
{
}
}
else
{
// Assume we need to add cost!
//iAPCost += GetAPsToLook( pSoldier );
}
}
// if attacking a new target (or if the specific target is uncertain)
if ( ( sGridNo != pSoldier->sLastTarget ) )
{
iAPCost += AP_CHANGE_TARGET;
}
// if attacking a new target (or if the specific target is uncertain)
//AXP 25.03.2007: Aim-at-same-tile AP cost/bonus doesn't make any sense for thrown objects
//if ( ( sGridNo != pSoldier->sLastTarget ) )
//{
// iAPCost += AP_CHANGE_TARGET;
//}
iAPCost += GetAPsToChangeStance( pSoldier, ANIM_STAND );
iAPCost += GetAPsToChangeStance( pSoldier, ANIM_STAND );
// Calculate default top & bottom of the magic "aiming" formula)
@@ -2188,29 +2199,29 @@ INT16 MinAPsToThrow( SOLDIERTYPE *pSoldier, INT16 sGridNo, UINT8 ubAddTurningCos
iTop = 2 * iFullAPs;
// if it's anything but a mortar
// if ( usInHand != MORTAR)
// tosses per turn is for max dexterity, drops down to 1/2 at dexterity = 0
// bottom = (TOSSES_PER_10TURNS * (50 + (ptr->dexterity / 2)) / 10);
//else
iBottom = ( TOSSES_PER_10TURNS * (50 + ( pSoldier->bDexterity / 2 ) ) / 10 );
// if ( usInHand != MORTAR)
// tosses per turn is for max dexterity, drops down to 1/2 at dexterity = 0
// bottom = (TOSSES_PER_10TURNS * (50 + (ptr->dexterity / 2)) / 10);
//else
iBottom = ( TOSSES_PER_10TURNS * (50 + ( pSoldier->bDexterity / 2 ) ) / 10 );
// add minimum aiming time to the overall minimum AP_cost
// This here ROUNDS UP fractions of 0.5 or higher using integer math
// This works because 'top' is 2x what it really should be throughout
// add minimum aiming time to the overall minimum AP_cost
// This here ROUNDS UP fractions of 0.5 or higher using integer math
// This works because 'top' is 2x what it really should be throughout
iAPCost += ( ( ( 100 * iTop ) / iBottom) + 1) / 2;
// the minimum AP cost of ANY throw can NEVER be more than merc has APs!
if ( iAPCost > iFullAPs )
iAPCost = iFullAPs;
// the minimum AP cost of ANY throw can NEVER be more than merc has APs!
if ( iAPCost > iFullAPs )
iAPCost = iFullAPs;
// this SHOULD be impossible, but nevertheless...
if ( iAPCost < 1 )
iAPCost = 1;
// this SHOULD be impossible, but nevertheless...
if ( iAPCost < 1 )
iAPCost = 1;
return ( (INT16)iAPCost );
return ( (INT16)iAPCost );
}
UINT16 GetAPsToDropBomb( SOLDIERTYPE *pSoldier )
+1
View File
@@ -963,6 +963,7 @@ BOOLEAN AdjustToNextAnimationFrame( SOLDIERTYPE *pSoldier )
// ATE: If we are armmed...
if ( pSoldier->pThrowParams->ubActionCode == THROW_ARM_ITEM )
{
//AXP 25.03.2007: MinAPsToThrow now actually returns the real cost, not 0
// ATE: Deduct points!
DeductPoints( pSoldier, MinAPsToThrow( pSoldier, pSoldier->sTargetGridNo, FALSE ), 0 );
}
+8
View File
@@ -9391,6 +9391,14 @@ void HaultSoldierFromSighting( SOLDIERTYPE *pSoldier, BOOLEAN fFromSightingEnemy
{
// Place it back into inv....
AutoPlaceObject( pSoldier, pSoldier->pTempObject, FALSE );
//AXP 25.03.2007: Not needed anymore, grenade costs are only deducted on throwing the object
//AXP 24.03.2007: Give APs back if we wanted to throw grenade, but interrupt/spotting occured
//if ( pSoldier->pThrowParams->ubActionCode == THROW_ARM_ITEM )
//{
// DeductPoints( pSoldier, -MinAPsToAttack( pSoldier, pSoldier->sTargetGridNo, FALSE ), 0 );
//}
MemFree( pSoldier->pTempObject );
pSoldier->pTempObject = NULL;
pSoldier->usPendingAnimation = NO_PENDING_ANIMATION;
+12 -1
View File
@@ -2586,6 +2586,17 @@ BOOLEAN UseThrown( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo )
CalculateLaunchItemParamsForThrow( pSoldier, sTargetGridNo, pSoldier->bTargetLevel, (INT16)(pSoldier->bTargetLevel * 256 ), &(pSoldier->inv[ HANDPOS ] ), (INT8)(uiDiceRoll - uiHitChance), THROW_ARM_ITEM, 0 );
//AXP 25.03.2007: Cleaned up throwing AP costs. Now only turning + stance change AP
// costs are deducted. Final throw cost is deducted on creating the grenade object
if ( (UINT8)GetDirectionFromGridNo( sTargetGridNo, pSoldier ) != pSoldier->bDirection )
sAPCost += (INT16)GetAPsToLook( pSoldier );
sAPCost += (INT16)GetAPsToChangeStance( pSoldier, ANIM_STAND );
HandleSoldierThrowItem( pSoldier, pSoldier->sTargetGridNo );
DeductPoints( pSoldier, sAPCost, 0 );
RemoveObjs( &(pSoldier->inv[ HANDPOS ] ), 1 );
/*
// Madd: Next 2 lines added: Deduct points!
sAPCost = CalcTotalAPsToAttack( pSoldier, sTargetGridNo, FALSE, pSoldier->bAimTime );
@@ -2597,7 +2608,7 @@ BOOLEAN UseThrown( SOLDIERTYPE *pSoldier, INT16 sTargetGridNo )
// Kaiden: Deducting points too early, moving the line down
DeductPoints( pSoldier, sAPCost, 0 );
RemoveObjs( &(pSoldier->inv[ HANDPOS ] ), 1 );
*/
return( TRUE );
}
+25 -11
View File
@@ -1142,7 +1142,7 @@ void ActionDone(SOLDIERTYPE *pSoldier)
{
#ifdef TESTAI
DebugMsg( TOPIC_JA2AI, DBG_LEVEL_3,
String("Cancelling actiondone: our action %d, desdir %d dir %d",pSoldier->bAction,pSoldier->bDesiredDirection,pSoldier->bDirection) );
String("Cancelling actiondone: our action %d, desdir %d dir %d",pSoldier->bAction,pSoldier->bDesiredDirection,pSoldier->bDirection) );
#endif
}
@@ -1157,23 +1157,30 @@ void ActionDone(SOLDIERTYPE *pSoldier)
// cancel any turning & movement by making current settings desired ones
pSoldier->sFinalDestination = pSoldier->sGridNo;
if ( !pSoldier->fNoAPToFinishMove )
{
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
AdjustNoAPToFinishMove( pSoldier, FALSE );
}
if ( !pSoldier->fNoAPToFinishMove )
{
EVENT_StopMerc( pSoldier, pSoldier->sGridNo, pSoldier->bDirection );
AdjustNoAPToFinishMove( pSoldier, FALSE );
}
//Lalien: moved later in ExecuteAction() case AI_ACTION_RAISE_GUN:
//AXP 23.03.2007: Sniper deadlock fix
//if ( pSoldier->bOrders == SNIPER && pSoldier->bAction == AI_ACTION_RAISE_GUN && pSoldier->bLastAction == AI_ACTION_RAISE_GUN)
//{
// pSoldier->bNextAction = AI_ACTION_END_TURN;
//}
// cancel current action
pSoldier->bLastAction = pSoldier->bAction;
pSoldier->bAction = AI_ACTION_NONE;
pSoldier->usActionData = NOWHERE;
pSoldier->bLastAction = pSoldier->bAction;
pSoldier->bAction = AI_ACTION_NONE;
pSoldier->usActionData = NOWHERE;
pSoldier->bActionInProgress = FALSE;
pSoldier->fDelayedMovement = FALSE;
/*
/*
if ( pSoldier->bLastAction == AI_ACTION_CHANGE_STANCE || pSoldier->bLastAction == AI_ACTION_COWER || pSoldier->bLastAction == AI_ACTION_STOP_COWERING )
{
SoldierGotoStationaryStance( pSoldier );
SoldierGotoStationaryStance( pSoldier );
}
*/
@@ -2561,6 +2568,13 @@ INT8 ExecuteAction(SOLDIERTYPE *pSoldier)
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);
//AXP 23.03.2007: Sniper deadlock fix
if ( pSoldier->bOrders == SNIPER && pSoldier->bLastAction == AI_ACTION_RAISE_GUN)
{
pSoldier->bNextAction = AI_ACTION_END_TURN;
}
ActionDone( pSoldier );
break;