| 5680 | |
| 5681 | extern void RT_JetPackEffect( int duration ); |
| 5682 | void RT_CheckJump( void ) |
| 5683 | { |
| 5684 | int jumpEntNum = ENTITYNUM_NONE; |
| 5685 | vec3_t jumpPos = {0,0,0}; |
| 5686 | |
| 5687 | if ( !NPCInfo->goalEntity ) |
| 5688 | { |
| 5689 | if ( NPC->enemy ) |
| 5690 | { |
| 5691 | //FIXME: debounce this? |
| 5692 | if ( TIMER_Done( NPC, "roamTime" ) |
| 5693 | && Q_irand( 0, 9 ) ) |
| 5694 | {//okay to try to find another spot to be |
| 5695 | int cpFlags = (CP_CLEAR|CP_HAS_ROUTE);//must have a clear shot at enemy |
| 5696 | float enemyDistSq = DistanceHorizontalSquared( NPC->currentOrigin, NPC->enemy->currentOrigin ); |
| 5697 | //FIXME: base these ranges on weapon |
| 5698 | if ( enemyDistSq > (2048*2048) ) |
| 5699 | {//hmm, close in? |
| 5700 | cpFlags |= CP_APPROACH_ENEMY; |
| 5701 | } |
| 5702 | else if ( enemyDistSq < (256*256) ) |
| 5703 | {//back off! |
| 5704 | cpFlags |= CP_RETREAT; |
| 5705 | } |
| 5706 | int sendFlags = cpFlags; |
| 5707 | int cp = NPC_FindCombatPointRetry( NPC->currentOrigin, |
| 5708 | NPC->currentOrigin, |
| 5709 | NPC->currentOrigin, |
| 5710 | &sendFlags, |
| 5711 | 256, |
| 5712 | NPCInfo->lastFailedCombatPoint ); |
| 5713 | if ( cp == -1 ) |
| 5714 | {//try again, no route needed since we can rocket-jump to it! |
| 5715 | cpFlags &= ~CP_HAS_ROUTE; |
| 5716 | cp = NPC_FindCombatPointRetry( NPC->currentOrigin, |
| 5717 | NPC->currentOrigin, |
| 5718 | NPC->currentOrigin, |
| 5719 | &cpFlags, |
| 5720 | 256, |
| 5721 | NPCInfo->lastFailedCombatPoint ); |
| 5722 | } |
| 5723 | if ( cp != -1 ) |
| 5724 | { |
| 5725 | NPC_SetMoveGoal( NPC, level.combatPoints[cp].origin, 8, qtrue, cp ); |
| 5726 | } |
| 5727 | else |
| 5728 | {//FIXME: okay to do this if have good close-range weapon... |
| 5729 | //FIXME: should we really try to go right for him?! |
| 5730 | //NPCInfo->goalEntity = NPC->enemy; |
| 5731 | jumpEntNum = NPC->enemy->s.number; |
| 5732 | VectorCopy( NPC->enemy->currentOrigin, jumpPos ); |
| 5733 | //return; |
| 5734 | } |
| 5735 | TIMER_Set( NPC, "roamTime", Q_irand( 3000, 12000 ) ); |
| 5736 | } |
| 5737 | else |
| 5738 | {//FIXME: okay to do this if have good close-range weapon... |
| 5739 | //FIXME: should we really try to go right for him?! |
no test coverage detected