/* ------------------------- Remote_Patrol ------------------------- */ void Remote_Patrol( void ) { Remote_MaintainHeight(); //If we have somewhere to go, then do that if (!NPC->enemy) { if ( UpdateGoal() ) { //start loop sound once we move ucmd.buttons |= BUTTON_WALKING; NPC_MoveToGoal( qtrue ); } } NPC_UpdateAngles( qtrue, qtrue ); }
/* ------------------------- Remote_Attack ------------------------- */ void Remote_Attack( void ) { float distance; qboolean visible; float idealDist; qboolean advance; qboolean retreat; if ( TIMER_Done(NPC,"spin") ) { TIMER_Set( NPC, "spin", Q_irand( 250, 1500 ) ); NPCInfo->desiredYaw += Q_irand( -200, 200 ); } // Always keep a good height off the ground Remote_MaintainHeight(); // If we don't have an enemy, just idle if ( NPC_CheckEnemyExt(qfalse) == qfalse ) { Remote_Idle(); return; } // Rate our distance to the target, and our visibilty distance = (int) DistanceHorizontalSquared( NPC->r.currentOrigin, NPC->enemy->r.currentOrigin ); visible = NPC_ClearLOS4( NPC->enemy ); //[CoOp] idealDist = MIN_DISTANCE_SQR+(MIN_DISTANCE_SQR*Q_flrand( 0, 1 )); //idealDist = MIN_DISTANCE_SQR+(MIN_DISTANCE_SQR*flrand( 0, 1 )); //[/CoOp] advance = (qboolean)(distance > idealDist*1.25); retreat = (qboolean)(distance < idealDist*0.75); // If we cannot see our target, move to see it if ( visible == qfalse ) { if ( NPCInfo->scriptFlags & SCF_CHASE_ENEMIES ) { Remote_Hunt( visible, advance, retreat ); return; } } Remote_Ranged( visible, advance, retreat ); }
/* ------------------------- Remote_Idle ------------------------- */ void Remote_Idle( void ) { Remote_MaintainHeight(); NPC_BSIdle(); }