=============== NPC_ExecuteBState MCG NPC Behavior state thinking =============== */
| 2159 | =============== |
| 2160 | */ |
| 2161 | void NPC_ExecuteBState ( gentity_t *self)//, int msec ) |
| 2162 | { |
| 2163 | bState_t bState; |
| 2164 | |
| 2165 | NPC_HandleAIFlags(); |
| 2166 | |
| 2167 | //FIXME: these next three bits could be a function call, some sort of setup/cleanup func |
| 2168 | //Lookmode must be reset every think cycle |
| 2169 | if(NPC->delayScriptTime && NPC->delayScriptTime <= level.time) |
| 2170 | { |
| 2171 | G_ActivateBehavior( NPC, BSET_DELAYED); |
| 2172 | NPC->delayScriptTime = 0; |
| 2173 | } |
| 2174 | |
| 2175 | //Clear this and let bState set it itself, so it automatically handles changing bStates... but we need a set bState wrapper func |
| 2176 | NPCInfo->combatMove = qfalse; |
| 2177 | |
| 2178 | //Execute our bState |
| 2179 | bState = G_CurrentBState( NPCInfo ); |
| 2180 | |
| 2181 | //Pick the proper bstate for us and run it |
| 2182 | NPC_RunBehavior( self->client->playerTeam, bState ); |
| 2183 | |
| 2184 | |
| 2185 | // if(bState != BS_POINT_COMBAT && NPCInfo->combatPoint != -1) |
| 2186 | // { |
| 2187 | //level.combatPoints[NPCInfo->combatPoint].occupied = qfalse; |
| 2188 | //NPCInfo->combatPoint = -1; |
| 2189 | // } |
| 2190 | |
| 2191 | //Here we need to see what the scripted stuff told us to do |
| 2192 | //Only process snapshot if independant and in combat mode- this would pick enemies and go after needed items |
| 2193 | // ProcessSnapshot(); |
| 2194 | |
| 2195 | //Ignore my needs if I'm under script control- this would set needs for items |
| 2196 | // CheckSelf(); |
| 2197 | |
| 2198 | //Back to normal? All decisions made? |
| 2199 | |
| 2200 | //FIXME: don't walk off ledges unless we can get to our goal faster that way, or that's our goal's surface |
| 2201 | //NPCPredict(); |
| 2202 | |
| 2203 | if ( NPC->enemy ) |
| 2204 | { |
| 2205 | if ( !NPC->enemy->inuse ) |
| 2206 | {//just in case bState doesn't catch this |
| 2207 | G_ClearEnemy( NPC ); |
| 2208 | } |
| 2209 | } |
| 2210 | |
| 2211 | if ( NPC->client->ps.saberLockTime && NPC->client->ps.saberLockEnemy != ENTITYNUM_NONE ) |
| 2212 | { |
| 2213 | NPC_SetLookTarget( NPC, NPC->client->ps.saberLockEnemy, level.time+1000 ); |
| 2214 | } |
| 2215 | else if ( !NPC_CheckLookTarget( NPC ) ) |
| 2216 | { |
| 2217 | if ( NPC->enemy ) |
| 2218 | { |
no test coverage detected