mirror of
https://github.com/UberGames/rpgxEF.git
synced 2025-02-20 19:12:09 +00:00
Reduced scope of some variables
This commit is contained in:
parent
1a4235bf02
commit
872ac60650
3 changed files with 89 additions and 63 deletions
|
@ -46,7 +46,7 @@ BotPrintTeamGoal
|
|||
*/
|
||||
void BotPrintTeamGoal(bot_state_t *bs) {
|
||||
char netname[MAX_NETNAME];
|
||||
float t;
|
||||
float t = 0.0f;
|
||||
|
||||
ClientName(bs->client, netname, sizeof(netname));
|
||||
t = bs->teamgoal_time - trap_AAS_Time();
|
||||
|
@ -124,20 +124,25 @@ FIXME: add stuff like "upper rocket launcher"
|
|||
"the rl near the railgun", "lower grenade launcher" etc.
|
||||
==================
|
||||
*/
|
||||
int BotGetItemTeamGoal(char *goalname, bot_goal_t *goal) {
|
||||
int i;
|
||||
int32_t BotGetItemTeamGoal(char *goalname, bot_goal_t *goal) {
|
||||
int32_t i = -1;
|
||||
|
||||
if (strlen(goalname) == 0) {
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if (!strlen(goalname)) return qfalse;
|
||||
i = -1;
|
||||
do {
|
||||
i = trap_BotGetLevelItemGoal(i, goalname, goal);
|
||||
if (i > 0) {
|
||||
//do NOT defend dropped items
|
||||
if (goal->flags & GFL_DROPPED)
|
||||
if (goal->flags & GFL_DROPPED) {
|
||||
continue;
|
||||
}
|
||||
|
||||
return qtrue;
|
||||
}
|
||||
} while(i > 0);
|
||||
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
|
@ -146,13 +151,15 @@ int BotGetItemTeamGoal(char *goalname, bot_goal_t *goal) {
|
|||
BotGetMessageTeamGoal
|
||||
==================
|
||||
*/
|
||||
int BotGetMessageTeamGoal(bot_state_t *bs, char *goalname, bot_goal_t *goal) {
|
||||
int32_t BotGetMessageTeamGoal(bot_state_t *bs, char *goalname, bot_goal_t *goal) {
|
||||
bot_waypoint_t *cp;
|
||||
|
||||
if (BotGetItemTeamGoal(goalname, goal)) return qtrue;
|
||||
if (BotGetItemTeamGoal(goalname, goal)) {
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
cp = BotFindWayPoint(bs->checkpoints, goalname);
|
||||
if (cp) {
|
||||
if (cp != NULL) {
|
||||
memcpy(goal, &cp->goal, sizeof(bot_goal_t));
|
||||
return qtrue;
|
||||
}
|
||||
|
@ -174,10 +181,10 @@ float BotGetTime(bot_match_t *match) {
|
|||
trap_BotMatchVariable(match, TIME, timestring, MAX_MESSAGE_SIZE);
|
||||
//match it to find out if the time is in seconds or minutes
|
||||
if (trap_BotFindMatch(timestring, &timematch, MTCONTEXT_TIME)) {
|
||||
float t;
|
||||
float t = 0.0f;
|
||||
|
||||
if (timematch.type == MSG_FOREVER) {
|
||||
t = 99999999;
|
||||
t = 99999999.0f;
|
||||
} else {
|
||||
trap_BotMatchVariable(&timematch, TIME, timestring, MAX_MESSAGE_SIZE);
|
||||
if (timematch.type == MSG_MINUTES) t = atof(timestring) * 60;
|
||||
|
@ -185,7 +192,9 @@ float BotGetTime(bot_match_t *match) {
|
|||
else t = 0;
|
||||
}
|
||||
//if there's a valid time
|
||||
if (t > 0) return trap_AAS_Time() + t;
|
||||
if (t > 0.0f) {
|
||||
return trap_AAS_Time() + t;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -196,21 +205,25 @@ float BotGetTime(bot_match_t *match) {
|
|||
FindClientByName
|
||||
==================
|
||||
*/
|
||||
int FindClientByName(char *name) {
|
||||
int i;
|
||||
int32_t FindClientByName(char *name) {
|
||||
int32_t i = 0;
|
||||
char buf[MAX_INFO_STRING];
|
||||
static int maxclis;
|
||||
static int32_t maxclis;
|
||||
|
||||
if (!maxclis)
|
||||
if (maxclis == 0) {
|
||||
maxclis = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
||||
}
|
||||
|
||||
for (i = 0; i < maxclis && i < MAX_CLIENTS; i++) {
|
||||
ClientName(i, buf, sizeof(buf));
|
||||
if (!Q_stricmp(buf, name)) return i;
|
||||
if (Q_stricmp(buf, name) == 0) return i;
|
||||
}
|
||||
|
||||
for (i = 0; i < maxclis && i < MAX_CLIENTS; i++) {
|
||||
ClientName(i, buf, sizeof(buf));
|
||||
if (stristr(buf, name)) return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -219,23 +232,27 @@ int FindClientByName(char *name) {
|
|||
FindEnemyByName
|
||||
==================
|
||||
*/
|
||||
int FindEnemyByName(bot_state_t *bs, char *name) {
|
||||
int i;
|
||||
int32_t FindEnemyByName(bot_state_t *bs, char *name) {
|
||||
int32_t i = 0;
|
||||
char buf[MAX_INFO_STRING];
|
||||
static int maxclis;
|
||||
static int32_t maxclis;
|
||||
|
||||
if (!maxclis)
|
||||
if (maxclis == 0) {
|
||||
maxclis = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
||||
}
|
||||
|
||||
for (i = 0; i < maxclis && i < MAX_CLIENTS; i++) {
|
||||
if (BotSameTeam(bs, i)) continue;
|
||||
ClientName(i, buf, sizeof(buf));
|
||||
if (!Q_stricmp(buf, name)) return i;
|
||||
}
|
||||
|
||||
for (i = 0; i < maxclis && i < MAX_CLIENTS; i++) {
|
||||
if (BotSameTeam(bs, i)) continue;
|
||||
ClientName(i, buf, sizeof(buf));
|
||||
if (stristr(buf, name)) return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -244,13 +261,15 @@ int FindEnemyByName(bot_state_t *bs, char *name) {
|
|||
NumPlayersOnSameTeam
|
||||
==================
|
||||
*/
|
||||
int NumPlayersOnSameTeam(bot_state_t *bs) {
|
||||
int i, num;
|
||||
int32_t NumPlayersOnSameTeam(bot_state_t *bs) {
|
||||
int32_t i = 0;
|
||||
int32_t num = 0;
|
||||
char buf[MAX_INFO_STRING];
|
||||
static int maxclis;
|
||||
|
||||
if (!maxclis)
|
||||
if (maxclis == 0) {
|
||||
maxclis = trap_Cvar_VariableIntegerValue("sv_maxclients");
|
||||
}
|
||||
|
||||
num = 0;
|
||||
for (i = 0; i < maxclis && i < MAX_CLIENTS; i++) {
|
||||
|
@ -259,6 +278,7 @@ int NumPlayersOnSameTeam(bot_state_t *bs) {
|
|||
if (BotSameTeam(bs, i+1)) num++;
|
||||
}
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
|
@ -267,9 +287,9 @@ int NumPlayersOnSameTeam(bot_state_t *bs) {
|
|||
TeamPlayIsOn
|
||||
==================
|
||||
*/
|
||||
int BotGetPatrolWaypoints(bot_state_t *bs, bot_match_t *match) {
|
||||
int32_t BotGetPatrolWaypoints(bot_state_t *bs, bot_match_t *match) {
|
||||
char keyarea[MAX_MESSAGE_SIZE];
|
||||
int patrolflags;
|
||||
int32_t patrolflags;
|
||||
bot_waypoint_t *wp, *newwp, *newpatrolpoints;
|
||||
bot_match_t keyareamatch;
|
||||
bot_goal_t goal;
|
||||
|
@ -345,18 +365,25 @@ int BotGetPatrolWaypoints(bot_state_t *bs, bot_match_t *match) {
|
|||
BotAddressedToBot
|
||||
==================
|
||||
*/
|
||||
int BotAddressedToBot(bot_state_t *bs, bot_match_t *match) {
|
||||
int32_t BotAddressedToBot(bot_state_t *bs, bot_match_t *match) {
|
||||
char addressedto[MAX_MESSAGE_SIZE];
|
||||
char netname[MAX_MESSAGE_SIZE];
|
||||
char name[MAX_MESSAGE_SIZE];
|
||||
char botname[128];
|
||||
int client;
|
||||
int32_t client = 0;
|
||||
bot_match_t addresseematch;
|
||||
|
||||
trap_BotMatchVariable(match, NETNAME, netname, sizeof(netname));
|
||||
client = ClientFromName(netname);
|
||||
if (client < 0) return qfalse;
|
||||
if (!BotSameTeam(bs, client)) return qfalse;
|
||||
|
||||
if (client < 0) {
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
if (!BotSameTeam(bs, client)) {
|
||||
return qfalse;
|
||||
}
|
||||
|
||||
//if the message is addressed to someone
|
||||
if (match->subtype & ST_ADDRESSED) {
|
||||
trap_BotMatchVariable(match, ADDRESSEE, addressedto, sizeof(addressedto));
|
||||
|
@ -392,6 +419,7 @@ int BotAddressedToBot(bot_state_t *bs, bot_match_t *match) {
|
|||
//make sure not everyone reacts to this message
|
||||
if (random() > (float ) 1.0 / (NumPlayersOnSameTeam(bs)-1)) return qfalse;
|
||||
}
|
||||
|
||||
return qtrue;
|
||||
}
|
||||
|
||||
|
@ -400,9 +428,9 @@ int BotAddressedToBot(bot_state_t *bs, bot_match_t *match) {
|
|||
BotGPSToPosition
|
||||
==================
|
||||
*/
|
||||
int BotGPSToPosition(char *buf, vec3_t position) {
|
||||
int i, j = 0;
|
||||
int num, sign;
|
||||
int32_t BotGPSToPosition(char *buf, vec3_t position) {
|
||||
int32_t i, j = 0;
|
||||
int32_t num, sign;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
num = 0;
|
||||
|
@ -436,7 +464,7 @@ BotMatch_HelpAccompany
|
|||
==================
|
||||
*/
|
||||
void BotMatch_HelpAccompany(bot_state_t *bs, bot_match_t *match) {
|
||||
int client, other;
|
||||
int32_t client, other;
|
||||
char teammate[MAX_MESSAGE_SIZE], netname[MAX_MESSAGE_SIZE];
|
||||
char itemname[MAX_MESSAGE_SIZE];
|
||||
bot_match_t teammatematch;
|
||||
|
@ -611,7 +639,7 @@ BotMatch_Camp
|
|||
==================
|
||||
*/
|
||||
void BotMatch_Camp(bot_state_t *bs, bot_match_t *match) {
|
||||
int client, areanum;
|
||||
int32_t client, areanum;
|
||||
char netname[MAX_MESSAGE_SIZE];
|
||||
char itemname[MAX_MESSAGE_SIZE];
|
||||
aas_entityinfo_t entinfo;
|
||||
|
@ -766,7 +794,7 @@ BotMatch_TaskPreference
|
|||
void BotMatch_TaskPreference(bot_state_t *bs, bot_match_t *match) {
|
||||
char netname[MAX_NETNAME];
|
||||
char teammatename[MAX_MESSAGE_SIZE];
|
||||
int teammate, preference;
|
||||
int32_t teammate, preference;
|
||||
|
||||
ClientName(bs->client, netname, sizeof(netname));
|
||||
if (Q_stricmp(netname, bs->teamleader) != 0) return;
|
||||
|
@ -889,7 +917,7 @@ BotMatch_CheckPoint
|
|||
==================
|
||||
*/
|
||||
void BotMatch_CheckPoint(bot_state_t *bs, bot_match_t *match) {
|
||||
int areanum;
|
||||
int32_t areanum;
|
||||
char buf[MAX_MESSAGE_SIZE];
|
||||
vec3_t position;
|
||||
bot_waypoint_t *cp;
|
||||
|
@ -1008,7 +1036,7 @@ BotMatch_StopTeamLeaderShip
|
|||
==================
|
||||
*/
|
||||
void BotMatch_StopTeamLeaderShip(bot_state_t *bs, bot_match_t *match) {
|
||||
int client;
|
||||
int32_t client;
|
||||
char teammate[MAX_MESSAGE_SIZE];
|
||||
char netname[MAX_MESSAGE_SIZE];
|
||||
|
||||
|
@ -1146,7 +1174,7 @@ BotNearestVisibleItem
|
|||
==================
|
||||
*/
|
||||
float BotNearestVisibleItem(bot_state_t *bs, char *itemname, bot_goal_t *goal) {
|
||||
int i;
|
||||
int32_t i;
|
||||
char name[64];
|
||||
bot_goal_t tmpgoal;
|
||||
float dist, bestdist;
|
||||
|
@ -1180,7 +1208,7 @@ BotMatch_WhereAreYou
|
|||
*/
|
||||
void BotMatch_WhereAreYou(bot_state_t *bs, bot_match_t *match) {
|
||||
float dist, bestdist;
|
||||
int i, bestitem, redflagtt, blueflagtt;
|
||||
int32_t i, bestitem, redflagtt, blueflagtt;
|
||||
bot_goal_t goal;
|
||||
char *nearbyitems[] = {
|
||||
"Phaser Compression Rifle",
|
||||
|
@ -1246,7 +1274,7 @@ BotMatch_LeadTheWay
|
|||
void BotMatch_LeadTheWay(bot_state_t *bs, bot_match_t *match) {
|
||||
aas_entityinfo_t entinfo;
|
||||
char netname[MAX_MESSAGE_SIZE], teammate[MAX_MESSAGE_SIZE];
|
||||
int client, other;
|
||||
int32_t client, other;
|
||||
|
||||
if (!TeamPlayIsOn()) return;
|
||||
//if not addressed to this bot
|
||||
|
@ -1285,7 +1313,7 @@ void BotMatch_LeadTheWay(bot_state_t *bs, bot_match_t *match) {
|
|||
BotEntityInfo(client, &entinfo);
|
||||
//if info is valid (in PVS)
|
||||
if (entinfo.valid) {
|
||||
int areanum = BotPointAreaNum(entinfo.origin);
|
||||
int32_t areanum = BotPointAreaNum(entinfo.origin);
|
||||
if (areanum && trap_AAS_AreaReachability(areanum)) {
|
||||
bs->lead_teamgoal.entitynum = client;
|
||||
bs->lead_teamgoal.areanum = areanum;
|
||||
|
@ -1314,7 +1342,7 @@ BotMatch_Kill
|
|||
*/
|
||||
void BotMatch_Kill(bot_state_t *bs, bot_match_t *match) {
|
||||
char enemy[MAX_MESSAGE_SIZE];
|
||||
int client;
|
||||
int32_t client;
|
||||
|
||||
if (!TeamPlayIsOn()) return;
|
||||
//if not addressed to this bot
|
||||
|
@ -1386,7 +1414,7 @@ void BotMatch_CTF(bot_state_t *bs, bot_match_t *match) {
|
|||
BotMatchMessage
|
||||
==================
|
||||
*/
|
||||
int BotMatchMessage(bot_state_t *bs, char *message) {
|
||||
int32_t BotMatchMessage(bot_state_t *bs, char *message) {
|
||||
bot_match_t match;
|
||||
|
||||
match.type = 0;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
int BotMatchMessage(bot_state_t *bs, char *message);
|
||||
#include "g_local.h"
|
||||
|
||||
int32_t BotMatchMessage(bot_state_t *bs, char *message);
|
||||
void BotPrintTeamGoal(bot_state_t *bs);
|
||||
|
||||
|
|
|
@ -96,7 +96,6 @@ BotGetAirGoal
|
|||
int BotGetAirGoal(bot_state_t *bs, bot_goal_t *goal) {
|
||||
bsp_trace_t bsptrace;
|
||||
vec3_t end, mins = {-15, -15, -2}, maxs = {15, 15, 2};
|
||||
int areanum;
|
||||
|
||||
//trace up until we hit solid
|
||||
VectorCopy(bs->origin, end);
|
||||
|
@ -107,7 +106,7 @@ int BotGetAirGoal(bot_state_t *bs, bot_goal_t *goal) {
|
|||
BotAI_Trace(&bsptrace, end, mins, maxs, bs->origin, bs->entitynum, CONTENTS_WATER|CONTENTS_SLIME|CONTENTS_LAVA);
|
||||
//if we found the water surface
|
||||
if (bsptrace.fraction > 0) {
|
||||
areanum = BotPointAreaNum(bsptrace.endpos);
|
||||
int areanum = BotPointAreaNum(bsptrace.endpos);
|
||||
if (areanum) {
|
||||
VectorCopy(bsptrace.endpos, goal->origin);
|
||||
goal->origin[2] -= 2;
|
||||
|
@ -248,7 +247,6 @@ BotGetItemLongTermGoal
|
|||
==================
|
||||
*/
|
||||
int BotGetItemLongTermGoal(bot_state_t *bs, int tfl, bot_goal_t *goal) {
|
||||
qboolean botRoamsOnly = qtrue;
|
||||
//if the bot has no goal
|
||||
if (!trap_BotGetTopGoal(bs->gs, goal)) {
|
||||
//BotAI_Print(PRT_MESSAGE, "no ltg on stack\n");
|
||||
|
@ -261,6 +259,7 @@ int BotGetItemLongTermGoal(bot_state_t *bs, int tfl, bot_goal_t *goal) {
|
|||
}
|
||||
//if it is time to find a new long term goal
|
||||
if (bs->ltg_time < trap_AAS_Time()) {
|
||||
qboolean botRoamsOnly = qtrue;
|
||||
//pop the current goal from the stack
|
||||
trap_BotPopGoal(bs->gs);
|
||||
//BotAI_Print(PRT_MESSAGE, "%s: choosing new ltg\n", ClientName(bs->client, netname, sizeof(netname)));
|
||||
|
@ -759,14 +758,14 @@ BotLongTermGoal
|
|||
int BotLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal) {
|
||||
aas_entityinfo_t entinfo;
|
||||
char teammate[MAX_MESSAGE_SIZE];
|
||||
float dist;
|
||||
int areanum;
|
||||
vec3_t dir;
|
||||
|
||||
//FIXME: also have air long term goals?
|
||||
//
|
||||
//if the bot is leading someone and not retreating
|
||||
if (bs->lead_time > 0 && !retreat) {
|
||||
float dist;
|
||||
|
||||
if (bs->lead_time < trap_AAS_Time()) {
|
||||
//FIXME: add chat to tell the team mate that he/she's on his/her own
|
||||
bs->lead_time = 0;
|
||||
|
@ -782,7 +781,7 @@ int BotLongTermGoal(bot_state_t *bs, int tfl, int retreat, bot_goal_t *goal) {
|
|||
BotEntityInfo(bs->lead_teammate, &entinfo);
|
||||
//
|
||||
if (entinfo.valid) {
|
||||
areanum = BotPointAreaNum(entinfo.origin);
|
||||
int areanum = BotPointAreaNum(entinfo.origin);
|
||||
if (areanum && trap_AAS_AreaReachability(areanum)) {
|
||||
//update team goal
|
||||
bs->lead_teamgoal.entitynum = bs->lead_teammate;
|
||||
|
@ -1269,7 +1268,6 @@ int AINode_Seek_LTG(bot_state_t *bs)
|
|||
bot_goal_t goal;
|
||||
vec3_t target, dir;
|
||||
bot_moveresult_t moveresult;
|
||||
int range;
|
||||
//char buf[128];
|
||||
//bot_goal_t tmpgoal;
|
||||
|
||||
|
@ -1340,6 +1338,8 @@ int AINode_Seek_LTG(bot_state_t *bs)
|
|||
}
|
||||
//check for nearby goals periodicly
|
||||
if (bs->check_time < trap_AAS_Time()) {
|
||||
float range;
|
||||
|
||||
bs->check_time = trap_AAS_Time() + 0.5;
|
||||
//check if the bot wants to camp
|
||||
BotWantsToCamp(bs);
|
||||
|
@ -1600,7 +1600,6 @@ int AINode_Battle_Chase(bot_state_t *bs)
|
|||
bot_goal_t goal;
|
||||
vec3_t target, dir;
|
||||
bot_moveresult_t moveresult;
|
||||
float range;
|
||||
|
||||
if (BotIsObserver(bs)) {
|
||||
AIEnter_Observer(bs);
|
||||
|
@ -1662,8 +1661,9 @@ int AINode_Battle_Chase(bot_state_t *bs)
|
|||
}
|
||||
//check for nearby goals periodicly
|
||||
if (bs->check_time < trap_AAS_Time()) {
|
||||
float range = 150;
|
||||
bs->check_time = trap_AAS_Time() + 1;
|
||||
range = 150;
|
||||
|
||||
//
|
||||
if (BotNearbyGoal(bs, bs->tfl, &goal, range)) {
|
||||
//the bot gets 5 seconds to pick up the nearby goal item
|
||||
|
@ -1739,8 +1739,6 @@ int AINode_Battle_Retreat(bot_state_t *bs) {
|
|||
aas_entityinfo_t entinfo;
|
||||
bot_moveresult_t moveresult;
|
||||
vec3_t target, dir;
|
||||
float attack_skill, range;
|
||||
int areanum;
|
||||
|
||||
if (BotIsObserver(bs)) {
|
||||
AIEnter_Observer(bs);
|
||||
|
@ -1788,7 +1786,7 @@ int AINode_Battle_Retreat(bot_state_t *bs) {
|
|||
if (BotEntityVisible(bs->entitynum, bs->eye, bs->viewangles, 360, bs->enemy)) {
|
||||
bs->enemyvisible_time = trap_AAS_Time();
|
||||
//update the reachability area and origin if possible
|
||||
areanum = BotPointAreaNum(entinfo.origin);
|
||||
int areanum = BotPointAreaNum(entinfo.origin);
|
||||
if (areanum && trap_AAS_AreaReachability(areanum)) {
|
||||
VectorCopy(entinfo.origin, bs->lastenemyorigin);
|
||||
bs->lastenemyareanum = areanum;
|
||||
|
@ -1822,8 +1820,8 @@ int AINode_Battle_Retreat(bot_state_t *bs) {
|
|||
}
|
||||
//check for nearby goals periodicly
|
||||
if (bs->check_time < trap_AAS_Time()) {
|
||||
float range = 150;
|
||||
bs->check_time = trap_AAS_Time() + 1;
|
||||
range = 150;
|
||||
#ifdef CTF
|
||||
//if carrying a flag the bot shouldn't be distracted too much
|
||||
if (BotCTFCarryingFlag(bs)) range = 100;
|
||||
|
@ -1858,7 +1856,7 @@ int AINode_Battle_Retreat(bot_state_t *bs) {
|
|||
}
|
||||
else if (!(moveresult.flags & MOVERESULT_MOVEMENTVIEWSET) && !(bs->flags & BFL_IDEALVIEWSET) )
|
||||
{
|
||||
attack_skill = 1;
|
||||
float attack_skill = 1;
|
||||
//if the bot is skilled anough
|
||||
if (attack_skill > 0.3) {
|
||||
BotAimAtEnemy(bs);
|
||||
|
@ -1898,11 +1896,9 @@ AINode_Battle_NBG
|
|||
==================
|
||||
*/
|
||||
int AINode_Battle_NBG(bot_state_t *bs) {
|
||||
int areanum;
|
||||
bot_goal_t goal;
|
||||
aas_entityinfo_t entinfo;
|
||||
bot_moveresult_t moveresult;
|
||||
float attack_skill;
|
||||
vec3_t target, dir;
|
||||
|
||||
if (BotIsObserver(bs)) {
|
||||
|
@ -1945,7 +1941,7 @@ int AINode_Battle_NBG(bot_state_t *bs) {
|
|||
if (BotEntityVisible(bs->entitynum, bs->eye, bs->viewangles, 360, bs->enemy)) {
|
||||
bs->enemyvisible_time = trap_AAS_Time();
|
||||
//update the reachability area and origin if possible
|
||||
areanum = BotPointAreaNum(entinfo.origin);
|
||||
int areanum = BotPointAreaNum(entinfo.origin);
|
||||
if (areanum && trap_AAS_AreaReachability(areanum)) {
|
||||
VectorCopy(entinfo.origin, bs->lastenemyorigin);
|
||||
bs->lastenemyareanum = areanum;
|
||||
|
@ -1991,7 +1987,7 @@ int AINode_Battle_NBG(bot_state_t *bs) {
|
|||
}
|
||||
else if (!(moveresult.flags & MOVERESULT_MOVEMENTVIEWSET) && !(bs->flags & BFL_IDEALVIEWSET))
|
||||
{
|
||||
attack_skill = 1;
|
||||
float attack_skill = 1;
|
||||
//if the bot is skilled anough and the enemy is visible
|
||||
if (attack_skill > 0.3) {
|
||||
//&& BotEntityVisible(bs->entitynum, bs->eye, bs->viewangles, 360, bs->enemy)
|
||||
|
|
Loading…
Reference in a new issue