mirror of
https://github.com/1dot13/source.git
synced 2026-07-22 13:40:22 +02:00
Brief: //dnl ch73
- Fixing bad APs deduction when using blade or blunt weapons and punching in general from different stances when need turn to your target. Details: - Fix wrong APs deduction and animation change when go to attack with knife or punch from prone. - Fix no APs cost for martial artist when perform turning. - When target was prone there was several problems in defining turnover and stance cost as range to them could vary depending of obstacles between, and as punch or stub in general use same logic put all stubbing and punching under one function MinAPsToPunch which should solve current problems with APs calculations. - Still there are no turning cost when going to stub or punch from moving, but this problem is not related with MinAPsToAttack but with UIPlotPath which don't add turning cost, hope someone in the future will add this feature which never exist. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6465 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -533,7 +533,7 @@ ANIMCONTROLTYPE gAnimControl[ NUMANIMATIONSTATES ] =
|
||||
|
||||
"NINJA GOTO BREATH" , 0, 70, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_FASTTURN | ANIM_NORESTART | ANIM_NONINTERRUPT | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1,
|
||||
|
||||
"NINJA BREATH" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON, ANIM_STAND, ANIM_STAND, -1,
|
||||
"NINJA BREATH" , 0, 0, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_FIREREADY, ANIM_STAND, ANIM_STAND, -1,//dnl ch73 280913
|
||||
|
||||
"NINJA LOWKICK" , 0, 50, (FLOAT)0, ANIM_STATIONARY | ANIM_TURNING | ANIM_NONINTERRUPT | ANIM_LIGHT_EFFORT | ANIM_NOCHANGE_WEAPON | ANIM_NORESTART | ANIM_ATTACK, ANIM_STAND, ANIM_STAND, -1,
|
||||
|
||||
|
||||
+32
-10
@@ -702,9 +702,9 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
|
||||
if ( Item[ usHandItem ].usItemClass == IC_PUNCH )
|
||||
{
|
||||
//INT16 sCnt;
|
||||
INT32 sSpot;
|
||||
UINT8 ubGuyThere;
|
||||
INT32 sGotLocation = NOWHERE;
|
||||
INT32 sSpot;
|
||||
UINT8 ubGuyThere;
|
||||
INT32 sGotLocation = NOWHERE;
|
||||
BOOLEAN fGotAdjacent = FALSE;
|
||||
|
||||
for ( INT8 sCnt = 0; sCnt < NUM_WORLD_DIRECTIONS; sCnt++ )
|
||||
@@ -725,12 +725,12 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
|
||||
// We've got a guy here....
|
||||
// Who is the one we want......
|
||||
sGotLocation = sSpot;
|
||||
sAdjustedGridNo = pTargetSoldier->sGridNo;
|
||||
ubDirection = ( UINT8 )sCnt;
|
||||
sAdjustedGridNo = pTargetSoldier->sGridNo;
|
||||
ubDirection = ( UINT8 )sCnt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (TileIsOutOfBounds(sGotLocation))
|
||||
{
|
||||
// See if we can get there to punch
|
||||
@@ -1537,6 +1537,7 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
|
||||
//USING THE BLADE
|
||||
if ( Item[ usHandItem ].usItemClass == IC_BLADE )
|
||||
{
|
||||
BOOLEAN fGotAdjacent = TRUE;//dnl ch73 290913
|
||||
// See if we can get there to stab
|
||||
if ( pSoldier->ubBodyType == BLOODCAT )
|
||||
{
|
||||
@@ -1552,15 +1553,37 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
|
||||
}
|
||||
else
|
||||
{
|
||||
sActionGridNo = FindAdjacentGridEx( pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE );
|
||||
//dnl ch73 290913
|
||||
fGotAdjacent = FALSE;
|
||||
sActionGridNo = NOWHERE;
|
||||
if(pTargetSoldier)
|
||||
for(INT8 sCnt=0; sCnt<NUM_WORLD_DIRECTIONS; sCnt++)
|
||||
{
|
||||
INT32 sSpot = NewGridNo(pSoldier->sGridNo, DirectionInc(sCnt));
|
||||
if(gubWorldMovementCosts[sSpot][sCnt][bLevel] >= TRAVELCOST_BLOCKED)
|
||||
continue;
|
||||
if(WhoIsThere2(sSpot, pSoldier->pathing.bLevel) == pTargetSoldier->ubID)
|
||||
{
|
||||
sActionGridNo = sSpot;
|
||||
sAdjustedGridNo = pTargetSoldier->sGridNo;
|
||||
ubDirection = (UINT8)sCnt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(TileIsOutOfBounds(sActionGridNo))
|
||||
{
|
||||
sActionGridNo = FindAdjacentGridEx(pSoldier, sGridNo, &ubDirection, &sAdjustedGridNo, TRUE, FALSE);
|
||||
if(sActionGridNo != NOWHERE)
|
||||
fGotAdjacent = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( sActionGridNo != -1 )
|
||||
if ( sActionGridNo != NOWHERE )
|
||||
{
|
||||
pSoldier->aiData.usActionData = sActionGridNo;
|
||||
|
||||
// CHECK IF WE ARE AT THIS GRIDNO NOW
|
||||
if ( pSoldier->sGridNo != sActionGridNo )
|
||||
if ( pSoldier->sGridNo != sActionGridNo && fGotAdjacent )//dnl ch73 290913
|
||||
{
|
||||
// SEND PENDING ACTION
|
||||
pSoldier->aiData.ubPendingAction = MERC_KNIFEATTACK;
|
||||
@@ -1595,7 +1618,6 @@ INT32 HandleItem( SOLDIERTYPE *pSoldier, INT32 sGridNo, INT8 bLevel, UINT16 usHa
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( Item[ usHandItem ].usItemClass == IC_TENTACLES )
|
||||
{
|
||||
// See if we can get there to stab
|
||||
|
||||
@@ -4232,16 +4232,20 @@ INT8 DrawUIMovementPath( SOLDIERTYPE *pSoldier, INT32 usMapPos, UINT32 uiFlags )
|
||||
sGotLocation = sActionGridNo;
|
||||
fGotAdjacent = TRUE;
|
||||
}
|
||||
|
||||
|
||||
if (!TileIsOutOfBounds(sGotLocation))
|
||||
{
|
||||
#if 0//dnl ch73 021013 don't add turnover cost if we are moving, in the future this should be calculated by UIPlotPath
|
||||
sAPCost += MinAPsToAttack( pSoldier, sAdjustedGridNo, TRUE, pSoldier->aiData.bShownAimTime, 0 );
|
||||
|
||||
// WANNE: Turn around APs were missing, I think ....
|
||||
//sAPCost += APsToTurnAround(pSoldier, sAdjustedGridNo);
|
||||
|
||||
sAPCost += UIPlotPath( pSoldier, sGotLocation, NO_COPYROUTE, fPlot, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints);
|
||||
|
||||
#else
|
||||
sAPCost = UIPlotPath(pSoldier, sGotLocation, NO_COPYROUTE, fPlot, TEMPORARY, (UINT16)pSoldier->usUIMovementMode, NOT_STEALTH, FORWARD, pSoldier->bActionPoints);
|
||||
sAPCost += MinAPsToAttack(pSoldier, sAdjustedGridNo, sAPCost>0?FALSE:TRUE, pSoldier->aiData.bShownAimTime, 0);
|
||||
#endif
|
||||
if ( sGotLocation != pSoldier->sGridNo && fGotAdjacent )
|
||||
{
|
||||
gfUIHandleShowMoveGrid = TRUE;
|
||||
|
||||
+68
-43
@@ -1724,7 +1724,7 @@ INT16 CalcTotalAPsToAttack( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubAddTur
|
||||
//sAPCost = 5;
|
||||
}
|
||||
|
||||
if ( uiItemClass == IC_PUNCH || ( uiItemClass == IC_BLADE && uiItemClass != IC_THROWING_KNIFE ) )
|
||||
if ( uiItemClass == IC_PUNCH || uiItemClass == IC_BLADE )//dnl ch73 031013
|
||||
{
|
||||
// IF we are at this gridno, calc min APs but if not, calc cost to goto this lication
|
||||
if ( pSoldier->sGridNo != sGridNo )
|
||||
@@ -1810,7 +1810,7 @@ INT16 CalcTotalAPsToAttack( SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubAddTur
|
||||
pSoldier->sWalkToAttackGridNo = sGridNo;
|
||||
|
||||
// Add points to attack
|
||||
sAPCost += MinAPsToAttack( pSoldier, sAdjustedGridNo, ubAddTurningCost, bAimTime, 0 );
|
||||
sAPCost += MinAPsToAttack(pSoldier, sAdjustedGridNo, sAPCost>0?FALSE:ubAddTurningCost, bAimTime, 0);//dnl ch73 031013
|
||||
//sAPCost += APsToTurnAround(pSoldier, sAdjustedGridNo);
|
||||
}
|
||||
else
|
||||
@@ -1857,7 +1857,7 @@ INT16 MinAPsToAttack(SOLDIERTYPE *pSoldier, INT32 sGridno, UINT8 ubAddTurningCos
|
||||
// LOOK IN BUDDY'S HAND TO DETERMINE WHAT TO DO HERE
|
||||
uiItemClass = Item[ undbarItem ].usItemClass;
|
||||
}
|
||||
|
||||
#if 0//dnl ch73 290913
|
||||
// bare fist or with brass knuckles
|
||||
if ( !(pSoldier->inv[HANDPOS].exists()) || Item[pSoldier->inv[HANDPOS].usItem].brassknuckles )
|
||||
{
|
||||
@@ -1875,7 +1875,14 @@ INT16 MinAPsToAttack(SOLDIERTYPE *pSoldier, INT32 sGridno, UINT8 ubAddTurningCos
|
||||
// for exceptions
|
||||
else
|
||||
sAPCost = MinAPsToPunch( pSoldier, sGridno, ubAddTurningCost );
|
||||
|
||||
#else
|
||||
if(uiItemClass & (IC_GUN | IC_LAUNCHER | IC_THROWING_KNIFE))
|
||||
sAPCost = MinAPsToShootOrStab(pSoldier, sGridno, bAimTime, ubAddTurningCost, ubForceRaiseGunCost);
|
||||
else if(uiItemClass & (IC_GRENADE | IC_THROWN))
|
||||
sAPCost = MinAPsToThrow(pSoldier, sGridno, ubAddTurningCost);
|
||||
else
|
||||
sAPCost = MinAPsToPunch(pSoldier, sGridno, ubAddTurningCost);
|
||||
#endif
|
||||
return sAPCost;
|
||||
}
|
||||
|
||||
@@ -2161,7 +2168,7 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime,
|
||||
UINT16 usItem;
|
||||
UINT16 usRaiseGunCost = 0;
|
||||
UINT16 usTurningCost = 0;
|
||||
UINT16 usRange;
|
||||
//UINT16 usRange;
|
||||
|
||||
UINT16 usUBItem = 0;
|
||||
if ( pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO )
|
||||
@@ -2176,6 +2183,8 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime,
|
||||
// Flugente: we need a secon temnr in case we are using an underbarrel weapon. Not all checks should apply for that one, as aiming is still done with the main weapon
|
||||
usUBItem = pSoldier->GetUsedWeaponNumber(&pSoldier->inv[HANDPOS]);
|
||||
}
|
||||
if(Item[usUBItem].usItemClass == IC_PUNCH || Item[usUBItem].usItemClass == IC_BLADE || Item[usUBItem].usItemClass == IC_TENTACLES)//dnl ch73 021013 punch and stub generally use identical logic so put all necessary stuff to MinAPsToPunch
|
||||
return(MinAPsToPunch(pSoldier, sGridNo, ubAddTurningCost));
|
||||
|
||||
OBJECTTYPE* pObjUsed = pSoldier->GetUsedWeapon( &(pSoldier->inv[HANDPOS]) );
|
||||
|
||||
@@ -2195,7 +2204,7 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime,
|
||||
{
|
||||
sGridNo = MercPtrs[ usTargID ]->sGridNo;
|
||||
}
|
||||
usRange = GetRangeFromGridNoDiff( pSoldier->sGridNo, sGridNo );
|
||||
//usRange = GetRangeFromGridNoDiff( pSoldier->sGridNo, sGridNo );
|
||||
}
|
||||
|
||||
if ( pSoldier->bWeaponMode == WM_ATTACHED_GL || pSoldier->bWeaponMode == WM_ATTACHED_GL_BURST || pSoldier->bWeaponMode == WM_ATTACHED_GL_AUTO )
|
||||
@@ -2278,11 +2287,13 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime,
|
||||
{
|
||||
bAPCost = (INT16)((bAPCost * (100 - gSkillTraitValues.ubAWFiringSpeedBonusLMGs ) / 100)+ 0.5);
|
||||
}
|
||||
#if 0//dnl ch73 021013 relocate this to MinAPsToPunch
|
||||
// Decreased APs needed for melee attacks - Melee (Blade only)
|
||||
else if ( Item[ usUBItem ].usItemClass == IC_BLADE && ( HAS_SKILL_TRAIT( pSoldier, MELEE_NT ) ) )
|
||||
{
|
||||
bAPCost = (INT16)((bAPCost * (100 - gSkillTraitValues.ubMEBladesAPsReduction ) / 100)+ 0.5);
|
||||
}
|
||||
#endif
|
||||
// Decreased APs needed for throwing knives - Throwing
|
||||
else if ( Item[ usUBItem ].usItemClass == IC_THROWING_KNIFE && ( HAS_SKILL_TRAIT( pSoldier, THROWING_NT ) ) )
|
||||
{
|
||||
@@ -2330,6 +2341,7 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime,
|
||||
// Do we need to stand up?
|
||||
bAPCost += GetAPsToChangeStance( pSoldier, ANIM_STAND );
|
||||
}
|
||||
#if 0//dnl ch73 021013 relocate this to MinAPsToPunch
|
||||
// blunt weapons & blades
|
||||
else if ( Item[ usUBItem ].usItemClass == IC_PUNCH || Item[ usUBItem ].usItemClass == IC_BLADE )
|
||||
{
|
||||
@@ -2342,6 +2354,7 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime,
|
||||
bAPCost += GetAPsToChangeStance( pSoldier, ANIM_STAND );
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else if(Item[usItem].rocketlauncher || Item[usItem].grenadelauncher || Item[usItem].mortar)//dnl ch72 260913 move this here from bottom, need to change as rocketlaucher could be fired from crouch too
|
||||
{
|
||||
if(gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_PRONE || Item[usItem].mortar && gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_STAND)
|
||||
@@ -2359,8 +2372,10 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime,
|
||||
//Calculate usTurningCost
|
||||
if (!TileIsOutOfBounds(sGridNo))
|
||||
{
|
||||
#if 0//dnl ch73 021013 relocate this to MinAPsToPunch
|
||||
// Buggler: actual melee ap deduction for turning applies only when target is 1 tile away
|
||||
if ( !( ( Item[ usUBItem ].usItemClass == IC_PUNCH || Item[ usUBItem ].usItemClass == IC_BLADE ) && usRange > 1 ) )
|
||||
#endif
|
||||
{
|
||||
if(Item[usItem].rocketlauncher || Item[usItem].grenadelauncher || Item[usItem].mortar)//dnl ch72 260913
|
||||
{
|
||||
@@ -2395,10 +2410,10 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime,
|
||||
}
|
||||
else
|
||||
bAPCost += (usTurningCost + usRaiseGunCost);
|
||||
|
||||
|
||||
// if attacking a new target (or if the specific target is uncertain)
|
||||
// Added check if the weapon is throwing knife/melee weapons - otherwise it would add APs for change target on cursor but not actually deduct them afterwards - SANDRO
|
||||
if ( ubForceRaiseGunCost == TRUE || (( sGridNo != pSoldier->sLastTarget ) && !Item[usUBItem].rocketlauncher && ( Item[ usUBItem ].usItemClass != IC_THROWING_KNIFE ) && ( Item[ usUBItem ].usItemClass != IC_PUNCH ) && ( Item[ usUBItem ].usItemClass != IC_BLADE ) ) )//dnl ch69 140913
|
||||
if ( ubForceRaiseGunCost == TRUE || (( sGridNo != pSoldier->sLastTarget ) && !Item[usUBItem].rocketlauncher && ( Item[ usUBItem ].usItemClass != IC_THROWING_KNIFE )/* && ( Item[ usUBItem ].usItemClass != IC_PUNCH ) && ( Item[ usUBItem ].usItemClass != IC_BLADE )*/ ) )//dnl ch69 140913 //dnl ch73 290913
|
||||
{
|
||||
if ( pSoldier->IsValidAlternativeFireMode( bAimTime, sGridNo ) )
|
||||
bAPCost += (APBPConstants[AP_CHANGE_TARGET] / 2);
|
||||
@@ -2417,54 +2432,64 @@ INT16 MinAPsToShootOrStab(SOLDIERTYPE *pSoldier, INT32 sGridNo, INT16 bAimTime,
|
||||
return bAPCost;
|
||||
}
|
||||
|
||||
|
||||
INT16 MinAPsToPunch(SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubAddTurningCost)
|
||||
INT16 MinAPsToPunch(SOLDIERTYPE *pSoldier, INT32 sGridNo, UINT8 ubAddTurningCost)//dnl ch73 290913
|
||||
{
|
||||
UINT8 bAPCost = 0;
|
||||
UINT16 usTargID;
|
||||
UINT8 ubDirection;
|
||||
UINT16 usRange;
|
||||
|
||||
// bAimSkill = ( pSoldier->stats.bDexterity + pSoldier->stats.bAgility) / 2;
|
||||
if (!TileIsOutOfBounds(sGridNo))
|
||||
INT16 bAPCost = APBPConstants[AP_MIN_AIM_ATTACK];
|
||||
if(!TileIsOutOfBounds(sGridNo))
|
||||
{
|
||||
usTargID = WhoIsThere2( sGridNo, pSoldier->bTargetLevel );
|
||||
usRange = GetRangeFromGridNoDiff( pSoldier->sGridNo, sGridNo );
|
||||
|
||||
OBJECTTYPE *pObjUsed = pSoldier->GetUsedWeapon(&pSoldier->inv[HANDPOS]);
|
||||
UINT16 usItem = pObjUsed->usItem;
|
||||
INT16 bFullAPs = pSoldier->CalcActionPoints();
|
||||
INT16 bAimSkill = CalcAimSkill(pSoldier, pSoldier->inv[HANDPOS].usItem);
|
||||
if(usItem == NONE/* || Item[usItem].brassknuckles*/)
|
||||
bAPCost += ApsToPunch(pSoldier);// SANDRO - changed this to direct us to specific calc function
|
||||
else
|
||||
{
|
||||
bAPCost += BaseAPsToShootOrStab(bFullAPs, bAimSkill, pObjUsed, pSoldier);
|
||||
// Decreased APs needed for melee attacks - Melee (Blade only)
|
||||
if(Item[usItem].usItemClass == IC_BLADE && (HAS_SKILL_TRAIT(pSoldier, MELEE_NT)))
|
||||
bAPCost = (INT16)((bAPCost * (100 - gSkillTraitValues.ubMEBladesAPsReduction) / 100) + 0.5);
|
||||
}
|
||||
UINT16 usTargID = WhoIsThere2(sGridNo, pSoldier->bTargetLevel);
|
||||
// Given a gridno here, check if we are on a guy - if so - get his gridno
|
||||
if ( usTargID != NOBODY )
|
||||
if(usTargID != NOBODY)
|
||||
{
|
||||
// Check if target is prone, if so, calc cost...
|
||||
if ( gAnimControl[ MercPtrs[ usTargID ]->usAnimState ].ubEndHeight == ANIM_PRONE )
|
||||
bAPCost += GetAPsToChangeStance( pSoldier, ANIM_CROUCH );
|
||||
if(gAnimControl[MercPtrs[usTargID]->usAnimState].ubEndHeight == ANIM_PRONE)
|
||||
bAPCost += GetAPsToChangeStance(pSoldier, ANIM_CROUCH);
|
||||
else
|
||||
bAPCost += GetAPsToChangeStance( pSoldier, ANIM_STAND );
|
||||
bAPCost += GetAPsToChangeStance(pSoldier, ANIM_STAND);
|
||||
}
|
||||
|
||||
if (ubAddTurningCost)
|
||||
if(ubAddTurningCost)
|
||||
{
|
||||
// Buggler: actual melee ap deduction for turning applies only when target is 1 tile away
|
||||
if ( usRange == 1 )
|
||||
{
|
||||
// ATE: Use standing turn cost....
|
||||
ubDirection = (UINT8)GetDirectionFromGridNo( sGridNo, pSoldier );
|
||||
|
||||
// Is it the same as he's facing?
|
||||
if ( ubDirection != pSoldier->ubDirection )
|
||||
// ATE: Use standing turn cost....
|
||||
UINT8 ubDirection = GetDirectionFromGridNo(sGridNo, pSoldier);
|
||||
INT32 sSpot = sGridNo;
|
||||
if(usTargID != NOBODY && gAnimControl[MercPtrs[usTargID]->usAnimState].ubEndHeight == ANIM_PRONE)
|
||||
for(INT8 sCnt=0; sCnt<NUM_WORLD_DIRECTIONS; sCnt++)
|
||||
{
|
||||
// SANDRO - Athletics trait check added
|
||||
if (HAS_SKILL_TRAIT( pSoldier, MARTIAL_ARTS_NT ) && gGameOptions.fNewTraitSystem )
|
||||
bAPCost += max( 1, (INT16)((GetAPsToLook( pSoldier ) * (100 - gSkillTraitValues.ubMAApsTurnAroundReduction * NUM_SKILL_TRAITS( pSoldier, MARTIAL_ARTS_NT ))/100) + 0.5 ));
|
||||
else
|
||||
bAPCost += GetAPsToLook( pSoldier );
|
||||
sSpot = NewGridNo(pSoldier->sGridNo, DirectionInc(sCnt));
|
||||
if(gubWorldMovementCosts[sSpot][sCnt][pSoldier->bTargetLevel] >= TRAVELCOST_BLOCKED)
|
||||
continue;
|
||||
if(WhoIsThere2(sSpot, pSoldier->bTargetLevel) == usTargID)
|
||||
{
|
||||
ubDirection = (UINT8)sCnt;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Is it the same as he's facing?
|
||||
// Buggler: actual melee ap deduction for turning applies only when target is 1 tile away
|
||||
//UINT16 usRange = GetRangeFromGridNoDiff(pSoldier->sGridNo, sSpot);
|
||||
if(/*usRange == 1 && */ubDirection != pSoldier->ubDirection)
|
||||
{
|
||||
if(gAnimControl[pSoldier->usAnimState].ubEndHeight == ANIM_PRONE)
|
||||
bAPCost += CalculateTurningCost(pSoldier, usItem, TRUE, ANIM_CROUCH);
|
||||
else
|
||||
bAPCost += CalculateTurningCost(pSoldier, usItem, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bAPCost += ApsToPunch( pSoldier ); // SANDRO - changed this to direct us to specific calc function
|
||||
|
||||
return ( bAPCost );
|
||||
return(bAPCost);
|
||||
}
|
||||
|
||||
// SANDRO - added function
|
||||
|
||||
@@ -7258,7 +7258,7 @@ void EVENT_InternalSetSoldierDesiredDirection( SOLDIERTYPE *pSoldier, UINT8 ubNe
|
||||
|
||||
if ( pSoldier->pathing.bDesiredDirection != pSoldier->ubDirection )
|
||||
{
|
||||
if ( (gAnimControl[ usAnimState ].uiFlags & ( ANIM_BREATH | ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_FIREREADY ) || usForceAnimState != INVALID_ANIMATION) && !fInitalMove && !pSoldier->flags.fDontChargeTurningAPs )//dnl ch70 160913
|
||||
if ( (gAnimControl[ usAnimState ].uiFlags & ( ANIM_BREATH | ANIM_OK_CHARGE_AP_FOR_TURN | ANIM_FIREREADY/* | ANIM_TURNING*/ ) || usForceAnimState != INVALID_ANIMATION) && !fInitalMove && !pSoldier->flags.fDontChargeTurningAPs )//dnl ch70 160913 //dnl ch73 290913 in some bright future when UIPlotPath will calculate turning cost then ANIM_TURNING should be turn on as this solve many problems when APs was not deducted during turnoff
|
||||
{
|
||||
// SANDRO: hey, we have a function for this around, why not to use it, hm?
|
||||
// silversurfer: we better don't do that. GetAPsToLook( ... ) will charge APs for getting to crouched/prone position
|
||||
@@ -8026,6 +8026,11 @@ void SOLDIERTYPE::TurnSoldier( void )
|
||||
}
|
||||
}
|
||||
|
||||
if(this->flags.bTurningFromPronePosition == TURNING_FROM_PRONE_FOR_PUNCH_OR_STUB)//dnl ch73 290913
|
||||
{
|
||||
this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_OFF;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -11752,12 +11757,17 @@ void SOLDIERTYPE::EVENT_SoldierBeginBladeAttack( INT32 sGridNo, UINT8 ubDirectio
|
||||
// gTacticalStatus.ubAttackBusyCount++;
|
||||
DebugMsg( TOPIC_JA2, DBG_LEVEL_3, String("Begin blade attack: ATB %d", gTacticalStatus.ubAttackBusyCount) );
|
||||
DebugAttackBusy( String( "Begin blade attack: ATB %d\n", gTacticalStatus.ubAttackBusyCount) );
|
||||
|
||||
//}
|
||||
|
||||
// CHANGE DIRECTION AND GOTO ANIMATION NOW
|
||||
this->EVENT_SetSoldierDesiredDirection( ubDirection );
|
||||
this->EVENT_SetSoldierDirection( ubDirection );
|
||||
//dnl ch73 290913
|
||||
if(this->usAnimState != CRAWLING && gAnimControl[this->usAnimState].ubEndHeight == ANIM_PRONE)
|
||||
usForceAnimState = CROUCHING;
|
||||
this->EVENT_SetSoldierDesiredDirection(ubDirection);
|
||||
this->EVENT_SetSoldierDirection(ubDirection);
|
||||
if(this->flags.bTurningFromPronePosition)
|
||||
this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_FOR_PUNCH_OR_STUB;
|
||||
usForceAnimState = INVALID_ANIMATION;
|
||||
// CHANGE TO ANIMATION
|
||||
|
||||
// DETERMINE ANIMATION TO PLAY
|
||||
@@ -11811,9 +11821,10 @@ void SOLDIERTYPE::EVENT_SoldierBeginBladeAttack( INT32 sGridNo, UINT8 ubDirectio
|
||||
// Flugente: if we attack with a bayonet, we don't need to change stance if even if we are stadning and the target is prone...
|
||||
// so we simulate here that the target is still standing
|
||||
UINT8 targetheight = gAnimControl[ pTSoldier->usAnimState ].ubEndHeight;
|
||||
#if 0//dnl ch73 031013 several reasons why disabling this; 1. no animation for bayonet, 2. if target is prone it look ridicules to swing through air instead stub target, 3. incorrect APs calculation
|
||||
if ( this->bWeaponMode == WM_ATTACHED_BAYONET )
|
||||
targetheight = ANIM_STAND;
|
||||
|
||||
#endif
|
||||
// Look at stance of target
|
||||
switch( targetheight )
|
||||
{
|
||||
@@ -11970,8 +11981,14 @@ void SOLDIERTYPE::EVENT_SoldierBeginPunchAttack( INT32 sGridNo, UINT8 ubDirectio
|
||||
if ( fChangeDirection )
|
||||
{
|
||||
// CHANGE DIRECTION AND GOTO ANIMATION NOW
|
||||
this->EVENT_SetSoldierDesiredDirection( ubDirection );
|
||||
this->EVENT_SetSoldierDirection( ubDirection );
|
||||
//dnl ch73 290913
|
||||
if(this->usAnimState != CRAWLING && gAnimControl[this->usAnimState].ubEndHeight == ANIM_PRONE)
|
||||
usForceAnimState = CROUCHING;
|
||||
this->EVENT_SetSoldierDesiredDirection(ubDirection);
|
||||
this->EVENT_SetSoldierDirection(ubDirection);
|
||||
if(this->flags.bTurningFromPronePosition)
|
||||
this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_FOR_PUNCH_OR_STUB;
|
||||
usForceAnimState = INVALID_ANIMATION;
|
||||
}
|
||||
|
||||
// Are we a martial artist? - SANDRO - added new/old traits check
|
||||
@@ -12235,7 +12252,7 @@ void SOLDIERTYPE::EVENT_SoldierBeginPunchAttack( INT32 sGridNo, UINT8 ubDirectio
|
||||
// SET TARGET GRIDNO
|
||||
this->sTargetGridNo = sGridNo;
|
||||
this->bTargetLevel = this->pathing.bLevel;
|
||||
this->sLastTarget = sGridNo;
|
||||
//this->sLastTarget = sGridNo;//dnl ch73 021013
|
||||
this->ubTargetID = WhoIsThere2( sGridNo, this->bTargetLevel );
|
||||
}
|
||||
|
||||
|
||||
@@ -200,6 +200,7 @@ INT8 NUM_SKILL_TRAITS( SOLDIERTYPE * pSoldier, UINT8 uiSkillTraitNumber );
|
||||
#define TURNING_FROM_PRONE_ON 1
|
||||
#define TURNING_FROM_PRONE_START_UP_FROM_MOVE 2
|
||||
#define TURNING_FROM_PRONE_ENDING_UP_FROM_MOVE 3
|
||||
#define TURNING_FROM_PRONE_FOR_PUNCH_OR_STUB 4//dnl ch73 290913
|
||||
|
||||
//ENUMERATIONS FOR ACTIONS
|
||||
enum
|
||||
|
||||
Reference in New Issue
Block a user