------------------------- ST_Commander Make decisions about who should go where, etc. FIXME: leader (group-decision-making) AI? FIXME: need alternate routes! FIXME: more group voice interaction FIXME: work in pairs? ------------------------- */
| 1851 | ------------------------- |
| 1852 | */ |
| 1853 | void ST_Commander( void ) |
| 1854 | { |
| 1855 | int i;//, j; |
| 1856 | int cp, cpFlags; |
| 1857 | AIGroupInfo_t *group = NPCInfo->group; |
| 1858 | gentity_t *member;//, *buddy; |
| 1859 | qboolean enemyLost = qfalse; |
| 1860 | float avoidDist; |
| 1861 | |
| 1862 | group->processed = qtrue; |
| 1863 | |
| 1864 | if ( group->enemy == NULL || group->enemy->client == NULL ) |
| 1865 | {//hmm, no enemy...?! |
| 1866 | return; |
| 1867 | } |
| 1868 | |
| 1869 | //FIXME: have this group commander check the enemy group (if any) and see if they have |
| 1870 | // superior numbers. If they do, fall back rather than advance. If you have |
| 1871 | // superior numbers, advance on them. |
| 1872 | //FIXME: find the group commander and have him occasionally give orders when there is speech |
| 1873 | //FIXME: start fleeing when only a couple of you vs. a lightsaber, possibly give up if the only one left |
| 1874 | |
| 1875 | SaveNPCGlobals(); |
| 1876 | |
| 1877 | if ( group->lastSeenEnemyTime < level.time - 180000 ) |
| 1878 | {//dissolve the group |
| 1879 | ST_Speech( NPC, SPEECH_LOST, 0.0f ); |
| 1880 | group->enemy->waypoint = NAV::GetNearestNode(group->enemy); |
| 1881 | for ( i = 0; i < group->numGroup; i++ ) |
| 1882 | { |
| 1883 | member = &g_entities[group->member[i].number]; |
| 1884 | SetNPCGlobals( member ); |
| 1885 | if ( Q3_TaskIDPending( NPC, TID_MOVE_NAV ) ) |
| 1886 | {//running somewhere that a script requires us to go, don't break from that |
| 1887 | continue; |
| 1888 | } |
| 1889 | if ( !(NPCInfo->scriptFlags&SCF_CHASE_ENEMIES) ) |
| 1890 | {//not allowed to doMove on my own |
| 1891 | continue; |
| 1892 | } |
| 1893 | //Lost enemy for three minutes? go into search mode? |
| 1894 | G_ClearEnemy( NPC ); |
| 1895 | NPC->waypoint = NAV::GetNearestNode(group->enemy); |
| 1896 | if ( NPC->waypoint == WAYPOINT_NONE ) |
| 1897 | { |
| 1898 | NPCInfo->behaviorState = BS_DEFAULT;//BS_PATROL; |
| 1899 | } |
| 1900 | else if ( group->enemy->waypoint == WAYPOINT_NONE || (NAV::EstimateCostToGoal( NPC->waypoint, group->enemy->waypoint ) >= Q3_INFINITE) ) |
| 1901 | { |
| 1902 | NPC_BSSearchStart( NPC->waypoint, BS_SEARCH ); |
| 1903 | } |
| 1904 | else |
| 1905 | { |
| 1906 | NPC_BSSearchStart( group->enemy->waypoint, BS_SEARCH ); |
| 1907 | } |
| 1908 | } |
| 1909 | group->enemy = NULL; |
| 1910 | RestoreNPCGlobals(); |
no test coverage detected