----------------------------------
| 445 | |
| 446 | //---------------------------------- |
| 447 | static void Howler_Combat( void ) |
| 448 | { |
| 449 | qboolean faced = qfalse; |
| 450 | float distance; |
| 451 | qboolean advance = qfalse; |
| 452 | if ( NPC->client->ps.groundEntityNum == ENTITYNUM_NONE ) |
| 453 | {//not on the ground |
| 454 | if ( NPC->client->ps.legsAnim == BOTH_JUMP1 |
| 455 | || NPC->client->ps.legsAnim == BOTH_INAIR1 ) |
| 456 | {//flying through the air with the greatest of ease, etc |
| 457 | Howler_TryDamage( 10, qfalse, qfalse ); |
| 458 | } |
| 459 | } |
| 460 | else |
| 461 | {//not in air, see if we should attack or advance |
| 462 | // If we cannot see our target or we have somewhere to go, then do that |
| 463 | if ( !NPC_ClearLOS( NPC->enemy ) )//|| UpdateGoal( )) |
| 464 | { |
| 465 | NPCInfo->goalEntity = NPC->enemy; |
| 466 | NPCInfo->goalRadius = MAX_DISTANCE; // just get us within combat range |
| 467 | |
| 468 | if ( NPCInfo->localState == LSTATE_BERZERK ) |
| 469 | { |
| 470 | NPC_Howler_Move( 3 ); |
| 471 | } |
| 472 | else |
| 473 | { |
| 474 | NPC_Howler_Move( 10 ); |
| 475 | } |
| 476 | NPC_UpdateAngles( qfalse, qtrue ); |
| 477 | return; |
| 478 | } |
| 479 | |
| 480 | distance = DistanceHorizontal( NPC->currentOrigin, NPC->enemy->currentOrigin ); |
| 481 | |
| 482 | if ( NPC->enemy && NPC->enemy->client && PM_InKnockDown( &NPC->enemy->client->ps ) ) |
| 483 | {//get really close to knocked down enemies |
| 484 | advance = (qboolean)( distance > MIN_DISTANCE ? qtrue : qfalse ); |
| 485 | } |
| 486 | else |
| 487 | { |
| 488 | advance = (qboolean)( distance > MAX_DISTANCE ? qtrue : qfalse );//MIN_DISTANCE |
| 489 | } |
| 490 | |
| 491 | if (( advance || NPCInfo->localState == LSTATE_WAITING ) && TIMER_Done( NPC, "attacking" )) // waiting monsters can't attack |
| 492 | { |
| 493 | if ( TIMER_Done2( NPC, "takingPain", qtrue )) |
| 494 | { |
| 495 | NPCInfo->localState = LSTATE_CLEAR; |
| 496 | } |
| 497 | else if ( TIMER_Done( NPC, "standing" ) ) |
| 498 | { |
| 499 | faced = Howler_Move( qtrue ); |
| 500 | } |
| 501 | } |
| 502 | else |
| 503 | { |
| 504 | Howler_Attack( distance ); |
no test coverage detected