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:
Kriplo
2013-10-03 20:22:35 +00:00
parent 0668d04e1f
commit d83f23ce2b
6 changed files with 133 additions and 64 deletions
+25 -8
View File
@@ -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 );
}