=============== NPC_ExecuteBState MCG NPC Behavior state thinking =============== */
| 1773 | =============== |
| 1774 | */ |
| 1775 | void NPC_ExecuteBState ( gentity_t *self)//, int msec ) |
| 1776 | { |
| 1777 | bState_t bState; |
| 1778 | |
| 1779 | NPC_HandleAIFlags(); |
| 1780 | |
| 1781 | //FIXME: these next three bits could be a function call, some sort of setup/cleanup func |
| 1782 | //Lookmode must be reset every think cycle |
| 1783 | if(NPC->delayScriptTime && NPC->delayScriptTime <= level.time) |
| 1784 | { |
| 1785 | G_ActivateBehavior( NPC, BSET_DELAYED); |
| 1786 | NPC->delayScriptTime = 0; |
| 1787 | } |
| 1788 | |
| 1789 | //Clear this and let bState set it itself, so it automatically handles changing bStates... but we need a set bState wrapper func |
| 1790 | NPCInfo->combatMove = qfalse; |
| 1791 | |
| 1792 | //Execute our bState |
| 1793 | if(NPCInfo->tempBehavior) |
| 1794 | {//Overrides normal behavior until cleared |
| 1795 | bState = NPCInfo->tempBehavior; |
| 1796 | } |
| 1797 | else |
| 1798 | { |
| 1799 | if(!NPCInfo->behaviorState) |
| 1800 | NPCInfo->behaviorState = NPCInfo->defaultBehavior; |
| 1801 | |
| 1802 | bState = NPCInfo->behaviorState; |
| 1803 | } |
| 1804 | |
| 1805 | //Pick the proper bstate for us and run it |
| 1806 | NPC_RunBehavior( self->client->playerTeam, bState ); |
| 1807 | |
| 1808 | |
| 1809 | // if(bState != BS_POINT_COMBAT && NPCInfo->combatPoint != -1) |
| 1810 | // { |
| 1811 | //level.combatPoints[NPCInfo->combatPoint].occupied = qfalse; |
| 1812 | //NPCInfo->combatPoint = -1; |
| 1813 | // } |
| 1814 | |
| 1815 | //Here we need to see what the scripted stuff told us to do |
| 1816 | //Only process snapshot if independant and in combat mode- this would pick enemies and go after needed items |
| 1817 | // ProcessSnapshot(); |
| 1818 | |
| 1819 | //Ignore my needs if I'm under script control- this would set needs for items |
| 1820 | // CheckSelf(); |
| 1821 | |
| 1822 | //Back to normal? All decisions made? |
| 1823 | |
| 1824 | //FIXME: don't walk off ledges unless we can get to our goal faster that way, or that's our goal's surface |
| 1825 | //NPCPredict(); |
| 1826 | |
| 1827 | if ( NPC->enemy ) |
| 1828 | { |
| 1829 | if ( !NPC->enemy->inuse ) |
| 1830 | {//just in case bState doesn't catch this |
| 1831 | G_ClearEnemy( NPC ); |
| 1832 | } |
no test coverage detected