custom field of view for bots
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6317 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
+5
-4
@@ -108,7 +108,7 @@ can_search_items_in_combat 1
|
||||
|
||||
shoot_at_feet_percent 85
|
||||
max_hear_volume 75
|
||||
|
||||
field_of_view 120
|
||||
|
||||
[SKILL2]
|
||||
min_general_delay 0.035
|
||||
@@ -136,7 +136,7 @@ can_search_items_in_combat 1
|
||||
|
||||
shoot_at_feet_percent 60
|
||||
max_hear_volume 60
|
||||
|
||||
field_of_view 105
|
||||
|
||||
[SKILL3]
|
||||
min_x_aim_speed 190
|
||||
@@ -161,7 +161,7 @@ can_search_items_in_combat 0
|
||||
|
||||
shoot_at_feet_percent 25
|
||||
max_hear_volume 40
|
||||
|
||||
field_of_view 95
|
||||
|
||||
[SKILL4]
|
||||
min_x_aim_speed 155
|
||||
@@ -186,7 +186,7 @@ can_search_items_in_combat 0
|
||||
|
||||
shoot_at_feet_percent 10
|
||||
max_hear_volume 30
|
||||
|
||||
field_of_view 85
|
||||
|
||||
[SKILL5]
|
||||
min_x_aim_speed 60
|
||||
@@ -211,3 +211,4 @@ can_search_items_in_combat 0
|
||||
|
||||
shoot_at_feet_percent 0
|
||||
max_hear_volume 15
|
||||
field_of_view 75
|
||||
@@ -109,6 +109,7 @@ struct bot_skill_s
|
||||
short sShootAtFeetWithRLPercent; // Percent that a bot shoot with a rocket
|
||||
// launcher at the enemy feet.
|
||||
int iMaxHearVolume; // Max volume that bot can hear
|
||||
int iFov; // bots field of view
|
||||
bool bCanPredict; // Can this bot predict his enemy position?
|
||||
bool bCircleStrafe; // Can this bot circle strafe?
|
||||
bool bCanSearchItemsInCombat;
|
||||
|
||||
@@ -2024,22 +2024,21 @@ void CBot::HearSound(int n, vec *o)
|
||||
}
|
||||
}
|
||||
|
||||
VARP(botfov, -1, -1, 20);
|
||||
bool CBot::IsInFOV(const vec &o)
|
||||
{
|
||||
vec v2, forward, right, up;
|
||||
float flDot;
|
||||
float flDot, flAngle;
|
||||
|
||||
AnglesToVectors(GetViewAngles(), forward, right, up);
|
||||
|
||||
v2 = o;
|
||||
v2.sub(m_pMyEnt->o);
|
||||
v2.z = 0.0f; // Make 2D
|
||||
v2 = Normalize(v2);
|
||||
forward.z = 0; // Make 2D
|
||||
|
||||
flDot = v2.dot(forward);
|
||||
|
||||
return(flDot >= 0.5f); // sin2(0.5) == 60 degrees FOV
|
||||
flAngle = acos(flDot/(v2.magnitude() * forward.magnitude()));
|
||||
return (float)m_pBotSkill->iFov >= flAngle/RAD;
|
||||
}
|
||||
|
||||
// Code of CBot - End
|
||||
|
||||
@@ -625,6 +625,12 @@ void CBotManager::CreateSkillData()
|
||||
{
|
||||
m_BotSkills[SkillNr].bCanPredict = value!=0;
|
||||
}
|
||||
else if (strcasecmp(cmd, "field_of_view") == 0)
|
||||
{
|
||||
if (value < 60) value = 60;
|
||||
else if (value > 130) value = 130;
|
||||
m_BotSkills[SkillNr].iFov = (int)value;
|
||||
}
|
||||
else if (strcasecmp(cmd, "max_hear_volume") == 0)
|
||||
{
|
||||
if (value < 0) value = 0;
|
||||
@@ -664,6 +670,7 @@ void CBotManager::InitSkillData()
|
||||
m_BotSkills[0].sShootAtFeetWithRLPercent = 85;
|
||||
m_BotSkills[0].bCanPredict = true;
|
||||
m_BotSkills[0].iMaxHearVolume = 75;
|
||||
m_BotSkills[0].iFov = 120;
|
||||
m_BotSkills[0].bCircleStrafe = true;
|
||||
m_BotSkills[0].bCanSearchItemsInCombat = true;
|
||||
|
||||
@@ -685,6 +692,7 @@ void CBotManager::InitSkillData()
|
||||
m_BotSkills[1].sShootAtFeetWithRLPercent = 60;
|
||||
m_BotSkills[1].bCanPredict = true;
|
||||
m_BotSkills[1].iMaxHearVolume = 60;
|
||||
m_BotSkills[1].iFov = 105;
|
||||
m_BotSkills[1].bCircleStrafe = true;
|
||||
m_BotSkills[1].bCanSearchItemsInCombat = true;
|
||||
|
||||
@@ -706,6 +714,7 @@ void CBotManager::InitSkillData()
|
||||
m_BotSkills[2].sShootAtFeetWithRLPercent = 25;
|
||||
m_BotSkills[2].bCanPredict = false;
|
||||
m_BotSkills[2].iMaxHearVolume = 45;
|
||||
m_BotSkills[2].iFov = 95;
|
||||
m_BotSkills[2].bCircleStrafe = true;
|
||||
m_BotSkills[2].bCanSearchItemsInCombat = false;
|
||||
|
||||
@@ -727,6 +736,7 @@ void CBotManager::InitSkillData()
|
||||
m_BotSkills[3].sShootAtFeetWithRLPercent = 10;
|
||||
m_BotSkills[3].bCanPredict = false;
|
||||
m_BotSkills[3].iMaxHearVolume = 30;
|
||||
m_BotSkills[3].iFov = 85;
|
||||
m_BotSkills[3].bCircleStrafe = false;
|
||||
m_BotSkills[3].bCanSearchItemsInCombat = false;
|
||||
|
||||
@@ -748,6 +758,7 @@ void CBotManager::InitSkillData()
|
||||
m_BotSkills[4].sShootAtFeetWithRLPercent = 0;
|
||||
m_BotSkills[4].bCanPredict = false;
|
||||
m_BotSkills[4].iMaxHearVolume = 15;
|
||||
m_BotSkills[4].iFov = 75;
|
||||
m_BotSkills[4].bCircleStrafe = false;
|
||||
m_BotSkills[4].bCanSearchItemsInCombat = false;
|
||||
}
|
||||
@@ -961,7 +972,7 @@ COMMAND(addbot, ARG_3STR);
|
||||
|
||||
void addnbot(char *arg1, char *arg2, char *arg3)
|
||||
{
|
||||
if(!botmode()) return;
|
||||
if(!botmode()) return;
|
||||
if (!arg1 || !arg1[0]) return;
|
||||
|
||||
int i = atoi(arg1);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
|
||||
# Visual Studio 2008
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cube", "cube.vcproj", "{1FAF5BB4-C49A-4124-9F23-188528BAE7C8}"
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual C++ Express 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "cube", "cube.vcxproj", "{1FAF5BB4-C49A-4124-9F23-188528BAE7C8}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
||||
Reference in New Issue
Block a user