qboolean NPC_FindEnemy( qboolean checkAlerts ) { gentity_t *newenemy; //We're ignoring all enemies for now //if( NPC->svFlags & SVF_IGNORE_ENEMIES ) if (0) //rwwFIXMEFIXME: support for flag { G_ClearEnemy( NPC ); return qfalse; } //we can't pick up any enemies for now if( NPCInfo->confusionTime > level.time ) { return qfalse; } //Don't want a new enemy //rwwFIXMEFIXME: support for locked enemy //if ( ( ValidEnemy( NPC->enemy ) ) && ( NPC->svFlags & SVF_LOCKEDENEMY ) ) // return qtrue; //See if the player is closer than our current enemy if ( NPC_CheckPlayerDistance() ) { return qtrue; } //Otherwise, turn off the flag // NPC->svFlags &= ~SVF_LOCKEDENEMY; //See if the player is closer than our current enemy if ( NPC->client->NPC_class != CLASS_RANCOR && NPC->client->NPC_class != CLASS_WAMPA //&& NPC->client->NPC_class != CLASS_SAND_CREATURE && NPC_CheckPlayerDistance() ) {//rancors, wampas & sand creatures don't care if player is closer, they always go with closest return qtrue; } //If we've gotten here alright, then our target it still valid if ( NPC_ValidEnemy( NPC->enemy ) ) return qtrue; newenemy = NPC_PickEnemyExt( checkAlerts ); //if we found one, take it as the enemy if( NPC_ValidEnemy( newenemy ) ) { G_SetEnemy( NPC, newenemy ); return qtrue; } return qfalse; }
qboolean NPC_FindEnemy( qboolean checkAlerts = qfalse ) { //We're ignoring all enemies for now if( NPC->svFlags & SVF_IGNORE_ENEMIES ) { G_ClearEnemy( NPC ); return qfalse; } //we can't pick up any enemies for now if( NPCInfo->confusionTime > level.time ) { return qfalse; } //Don't want a new enemy if ( ( ValidEnemy( NPC->enemy ) ) && ( NPC->svFlags & SVF_LOCKEDENEMY ) ) return qtrue; //See if the player is closer than our current enemy if ( NPC_CheckPlayerDistance() ) { return qtrue; } //Otherwise, turn off the flag NPC->svFlags &= ~SVF_LOCKEDENEMY; //If we've gotten here alright, then our target it still valid if ( NPC_ValidEnemy( NPC->enemy ) ) return qtrue; gentity_t *newenemy = NPC_PickEnemyExt( checkAlerts ); //if we found one, take it as the enemy if( NPC_ValidEnemy( newenemy ) ) { G_SetEnemy( NPC, newenemy ); return qtrue; } return qfalse; }
qboolean NPC_FindEnemy( qboolean checkAlerts ) {//RACC - checks to see if our enemy is still valid. Updates if it is not. gentity_t *newenemy; //[CoOp] SP Code //reenabling the IGNORE_ENEMIES flag if( NPC->NPC->scriptFlags & SCF_IGNORE_ENEMIES ) //We're ignoring all enemies for now //if( NPC->svFlags & SVF_IGNORE_ENEMIES ) //if (0) //rwwFIXMEFIXME: support for flag //[/CoOp] { G_ClearEnemy( NPC ); return qfalse; } //we can't pick up any enemies for now if( NPCInfo->confusionTime > level.time ) { //[CoOp] SP Code G_ClearEnemy( NPC ); //[/CoOp] return qfalse; } //[CoOp] SP Code //Don't want a new enemy if ( ( ValidEnemy( NPC->enemy ) ) && ( NPC->NPC->aiFlags & NPCAI_LOCKEDENEMY ) ) return qtrue; //See if the player is closer than our current enemy if ( NPC->client->NPC_class != CLASS_RANCOR && NPC->client->NPC_class != CLASS_WAMPA && NPC->client->NPC_class != CLASS_SAND_CREATURE && NPC_CheckPlayerDistance() ) {//rancors, wampas & sand creatures don't care if player is closer, they always go with closest return qtrue; } /* This shouldn't be here. SP Code //See if the player is closer than our current enemy if ( NPC_CheckPlayerDistance() ) { return qtrue; }*/ //Otherwise, turn off the flag since if we have a locked enemy at this point, //the enemy is invalid. NPC->NPC->aiFlags &= ~NPCAI_LOCKEDENEMY; // NPC->svFlags &= ~SVF_LOCKEDENEMY; /* Moved up. SP Code //See if the player is closer than our current enemy if ( NPC->client->NPC_class != CLASS_RANCOR && NPC->client->NPC_class != CLASS_WAMPA //&& NPC->client->NPC_class != CLASS_SAND_CREATURE && NPC_CheckPlayerDistance() ) {//rancors, wampas & sand creatures don't care if player is closer, they always go with closest return qtrue; } */ //[/CoOp] //If we've gotten here alright, then our target it still valid if ( NPC_ValidEnemy( NPC->enemy ) ) return qtrue; newenemy = NPC_PickEnemyExt( checkAlerts ); //if we found one, take it as the enemy if( NPC_ValidEnemy( newenemy ) ) { G_SetEnemy( NPC, newenemy ); return qtrue; } //[CoOp] SP Code. Remove enemy since they're not valid at this point. G_ClearEnemy( NPC ); //[/CoOp] return qfalse; }