diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index c1e6b724e..6c288744c 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -3591,6 +3591,12 @@ void UIHandleSoldierStanceChange( UINT8 ubSoldierID, INT8 bNewStance ) pSoldier->pathing.sFinalDestination = pSoldier->sGridNo; pSoldier->bGoodContPath = FALSE; + //dnl ch71 180913 when we go to crouch or prone for now there is no alternative fire mode option + if(pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD && bNewStance != ANIM_STAND) + { + ChangeScopeMode(pSoldier, 0); + ManLooksForOtherTeams(pSoldier); + } } else return; diff --git a/Tactical/Points.cpp b/Tactical/Points.cpp index e3092c463..2d56ace20 100644 --- a/Tactical/Points.cpp +++ b/Tactical/Points.cpp @@ -3242,7 +3242,7 @@ INT16 GetAPsToReadyWeapon( SOLDIERTYPE *pSoldier, UINT16 usAnimState ) if ( gGameExternalOptions.ubAllowAlternativeWeaponHolding ) { // If we are told to go to the alt weapon holding mode - if ( gAnimControl[ usAnimState ].uiFlags & ( ANIM_ALT_WEAPON_HOLDING ) ) + if ( gAnimControl[ usAnimState ].uiFlags & ( ANIM_ALT_WEAPON_HOLDING ) || (pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD && usAnimState == INVALID_ANIMATION) )//dnl ch71 180913 { if ( Item[ usItem ].twohanded ) { diff --git a/Tactical/Soldier Control.cpp b/Tactical/Soldier Control.cpp index 98db1761c..e16338f46 100644 --- a/Tactical/Soldier Control.cpp +++ b/Tactical/Soldier Control.cpp @@ -5349,7 +5349,27 @@ BOOLEAN SOLDIERTYPE::InternalSoldierReadyWeapon( UINT8 sFacingDir, BOOLEAN fEndR DebugMsg(TOPIC_JA2,DBG_LEVEL_3,String("InternalSoldierReadyWeapon: PickingAnimation")); usAnimState = PickSoldierReadyAnimation( this, fEndReady, fRaiseToHipOnly ); - + if(!fEndReady && this->ubDirection != sFacingDir)//dnl ch71 170913 + { + UINT16 usTrueAnimState = this->usAnimState; + switch(gAnimControl[this->usAnimState].ubEndHeight) + { + case ANIM_STAND: + this->usAnimState = STANDING; + if(this->flags.fDontChargeTurningAPs && !this->flags.fDontChargeReadyAPs && usAnimState == INVALID_ANIMATION) + usAnimState = PickSoldierReadyAnimation(this, FALSE, fRaiseToHipOnly);// someone introduced new cost system for turning and this means we must force gun raise + break; + case ANIM_CROUCH: + this->usAnimState = CROUCHING; + if(this->flags.fDontChargeTurningAPs && !this->flags.fDontChargeReadyAPs && usAnimState == INVALID_ANIMATION) + usAnimState = PickSoldierReadyAnimation(this, FALSE, FALSE);// force gun raise for proper APs deduction + break; + case ANIM_PRONE: + usAnimState = INVALID_ANIMATION;// we are turning in prone so raise gun will be done after turning + break; + } + this->usAnimState = usTrueAnimState; + } if ( usAnimState != INVALID_ANIMATION ) { if(is_networked) @@ -7827,6 +7847,20 @@ void SOLDIERTYPE::TurnSoldier( void ) // Else check if we are trying to shoot and once was prone, but am now crouched because we needed to turn... else if ( this->flags.bTurningFromPronePosition ) { + //dnl ch71 170913 + if(IsValidStance(this, ANIM_PRONE)) + { + UINT16 usTrueAnimState = this->usAnimState; + this->usAnimState = PRONE; + this->usPendingAnimation = PickSoldierReadyAnimation(this, FALSE, FALSE); + this->usAnimState = usTrueAnimState; + SendChangeSoldierStanceEvent(this, ANIM_PRONE); + } + else + this->EVENT_InitNewSoldierAnim(PickSoldierReadyAnimation(this, FALSE, FALSE), 0, FALSE); + this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; + return; +/* if ( IsValidStance( this, ANIM_PRONE ) ) { SendChangeSoldierStanceEvent( this, ANIM_PRONE ); @@ -7838,6 +7872,8 @@ void SOLDIERTYPE::TurnSoldier( void ) } this->flags.fTurningToShoot = FALSE; this->flags.bTurningFromPronePosition = TURNING_FROM_PRONE_OFF; + //} +*/ } } } diff --git a/TacticalAI/Attacks.cpp b/TacticalAI/Attacks.cpp index 94ef38abd..971c34fd1 100644 --- a/TacticalAI/Attacks.cpp +++ b/TacticalAI/Attacks.cpp @@ -449,8 +449,17 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns // consider alternate holding mode and different scopes for(pSoldier->bScopeMode=(gGameExternalOptions.ubAllowAlternativeWeaponHolding?USE_ALT_WEAPON_HOLD:USE_BEST_SCOPE); pSoldier->bScopeMode<=(gGameExternalOptions.fScopeModes?NUM_SCOPE_MODES-1:USE_BEST_SCOPE); pSoldier->bScopeMode++) { - if(pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD && (Item[pSoldier->usAttackingWeapon].usItemClass & IC_THROWING_KNIFE)) - continue; + //dnl ch71 180913 throwing knives cannot be use in fire from hip, also SANDRO said: if the gun is flagged as HeavyGun, then we can only fire it from hip, thus no scopes to use at all, not even iron sights + if(pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD) + { + if(Item[pSoldier->usAttackingWeapon].usItemClass & IC_THROWING_KNIFE) + continue; + } + else + { + if(Weapon[pSoldier->usAttackingWeapon].HeavyGun) + continue; + } if(pSoldier->bScopeMode == USE_ALT_WEAPON_HOLD || (pSoldier->bScopeMode >= USE_BEST_SCOPE && ObjList[pSoldier->bScopeMode] != NULL)) { usTrueState = pSoldier->usAnimState;// because is used in CalculateRaiseGunCost, CalcAimingLevelsAvailableWithAP, CalculateTurningCost @@ -467,6 +476,13 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns GetAPChargeForShootOrStabWRTGunRaises(pSoldier, pOpponent->sGridNo, TRUE, &fAddingTurningCost, &fAddingRaiseGunCost, 0); usTurningCost = CalculateTurningCost(pSoldier, pSoldier->usAttackingWeapon, fAddingTurningCost); usRaiseGunCost = CalculateRaiseGunCost(pSoldier, fAddingRaiseGunCost, pOpponent->sGridNo, 0); + if(fAddingTurningCost && fAddingRaiseGunCost)//dnl ch71 180913 + { + if(usRaiseGunCost > usTurningCost) + usTurningCost = 0; + else + usRaiseGunCost = 0; + } ubRawAPCost = MinAPsToShootOrStab(pSoldier, pOpponent->sGridNo, 0, FALSE, 2); ubMinAPcost = ubRawAPCost + usTurningCost + sStanceAPcost + usRaiseGunCost; if(pSoldier->bActionPoints-ubMinAPcost >= 0) @@ -516,6 +532,13 @@ void CalcBestShot(SOLDIERTYPE *pSoldier, ATTACKTYPE *pBestShot, BOOLEAN shootUns usTurningCost = CalculateTurningCost(pSoldier, pSoldier->usAttackingWeapon, fAddingTurningCost); } usRaiseGunCost = CalculateRaiseGunCost(pSoldier, fAddingRaiseGunCost, pOpponent->sGridNo, 0); + if(fAddingTurningCost && fAddingRaiseGunCost)//dnl ch71 180913 + { + if(usRaiseGunCost > usTurningCost) + usTurningCost = 0; + else + usRaiseGunCost = 0; + } ubRawAPCost = MinAPsToShootOrStab(pSoldier, pOpponent->sGridNo, 0, FALSE, 2); ubMinAPcost = ubRawAPCost + usTurningCost + sStanceAPcost + usRaiseGunCost; if(pSoldier->bActionPoints-ubMinAPcost >= 0)