Code:
bool IsGroupOfEnemies (bot_t *pBot, Vector vLocation)
{
......
// search the world for enemy players...
for (i = 1; i <= gpGlobals->maxClients; i++) // BUG
{
if (!ThreatTab[i].IsUsed || !ThreatTab[i].IsAlive || (ThreatTab[i].pEdict == pEdict))
continue;
The ThreatTab range is [0, gpGlobals->maxClients) so this is wrong
it should be:
for (i = 0; i < gpGlobals->maxClients; i++)
Code:
if (!(pEdict->v.button & (IN_LEFT | IN_RIGHT)))
{
if (pBot->f_sidemove_speed > 0)
pEdict->v.button |= IN_RIGHT;
else
pEdict->v.button |= IN_LEFT;
}
The buttons should be IN_MOVELEFT and IN_MOVERIGHT. IN_LEFT and IN_RIGHT means "look left" and "look right" (Anyway I don't think this button thing is necessary)
Code:
if (pBot->iCampDirection < 1)
{
v_dest.x = paths[pBot->curr_wpt_index]->fcampstartx;
v_dest.y = paths[pBot->curr_wpt_index]->fcampstarty;
v_dest.z = 0;
}
.
.
.
MAKE_VECTORS (v_dest);
pBot->vecCamp = paths[pBot->curr_wpt_index]->origin + gpGlobals->v_forward * 500;
The fcampstartx, fcampstarty, fcampendx, fcampendy aren't angles. Take a look at this in waypoint.cpp...
Code:
case 5: // Camping Point
p->flags |= W_FL_CROSSING;
p->flags |= W_FL_CAMP;
p->flags |= W_FL_NOHOSTAGE;
MAKE_VECTORS (pHostEdict->v.v_angle);
v_forward = pHostEdict->v.origin + pHostEdict->v.view_ofs + gpGlobals->v_forward * 640;
p->fcampstartx = v_forward.x;
p->fcampstarty = v_forward.y;
WaypointDrawBeam (start, end, 30, 0, 0, 255, 255, 250, 5);
break;
This camping direction bug is too difficult to handle, and I haven't found a good way to fix it without changing the waypoint format to add "fcampstartz" and "fcampendz" and redo all waypoints... well, IMHO the PB waypoint format is really bad, it just limits the max connections to 8 waypoints, so I can't reflect the old RealBot waypoint system without changing waypoint format
Code:
if (*fAngle >= 180)
*fAngle -= 360 * ((int) (*fAngle / 360) + 1);
if (*fAngle < -180)
*fAngle += 360 * ((int) (-*fAngle / 360) + 1); // don't forget the "-" (bugfix by Myung Jee)
...You shouldn't have been reading that "Myung Jee"'s email carefully
That "Myung Jee" should have mailed you this...
Quote:
You code won't work if the angle is 360, 720, 1080, etc.
eg. 360 - 360 * ((int)(360 / 360) + 1) = 360 - 720 = -360
|
...and:
Code:
float WrapAngle (float angle_to_wrap)
{
static float angle;
angle = angle_to_wrap;
if (angle >= 180.0)
angle -= 360.0 * ((int)(angle / 360 + 0.5));
if (angle < -180.0)
angle += 360.0 * ((int)(-angle / 360 + 0.5));
return (angle);
}
(P.S. If you don't know why I know that "Myung Jee"'s email so much, take a look at botman's forum archive (all the names shown in it are login names instead of display names), the post #5006 in developer forum is post by "him"
)