Some bugs...
1. shield pickup.
else if (iPickType == PICKUP_SHIELD)
{
if ((pEdict->v.weapons & (1 << CS_WEAPON_ELITE)) || BotHasShield (pBot) || pBot->bIsVIP)
bCanPickup = FALSE;
else if (BotHasPrimaryWeapon (pBot))
{
if (!BotRateGroundWeapon (pBot, pent)) // BUG
bCanPickup = FALSE;
}
}
I have changed a little to the BotRateGroundWeapon function (mine returns bool, CF's returns int). In the original PODBot code it should be like this:
if (BotRateGroundWeapon(pBot, pent) <= 0))
2. two crash bugs.
BotThink (bot.cpp):
if ((pBot->iStates & STATE_SUSPECTENEMY) && pBot->bWantsToFire)
{
int iTask = pBot->pTasks->iTask; // BUG
// Don't allow shooting through walls when camping
if (iTask == TASK_PAUSE || iTask == TASK_CAMP)
pBot->bWantsToFire = FALSE;
}
BUG: pBot->pTasks may be NULL sometimes.
in the original PB code: GetBotSafeTask(pBot)->iTask. or you can also check "if (pBot->pTasks)" manually. In my code I moved this code to LastEnemyShootable() function.
SoundAttachToThreat (bot_sounds.cpp):
extern threat_t ThreatTab[32];
.......
iIndex = ENTINDEX (pEdict) - 1; // BUG
ThreatTab[iIndex].fHearingDistance = 800.0 * fVolume;
BUG: ENTINDEX(pEdict) - 1 sometimes may be "out of the range" and this will causes invalid memory access. So we had better change this as well....
(This might be what causes the hostage crash problem IMO)
Here is what I'm doing:
Vector vecPosition = pEdict->v.origin;
if (vecPosition == Vector(0, 0, 0))
vecPosition = VecBModelOrigin(pEdict);
int iIndex = ENTINDEX(pEdict) - 1;
if (iIndex < 0 || iIndex >= gpGlobals->maxClients)
iIndex = UTIL_GetNearestPlayerIndex(vecPosition);
// Hit/Fall Sound?
if (strncmp("player/bhit_flesh", pszSample, 17) == 0
|| strncmp("player/headshot", pszSample, 15) == 0)
{
// don't change iIndex here, and in any following code.....
ThreatTab[iIndex].fHearingDistance = 800.0 * fVolume;
ThreatTab[iIndex].fTimeSoundLasting = gpGlobals->time + 0.5;
ThreatTab[iIndex].vecSoundPosition = vecPosition;
}
3. weapon selecting bug.
BotSelectBestWeapon (bot_combat.cpp):
iChosenWeaponIndex %= 24; // BUG
select_index = iChosenWeaponIndex;
You have added support to new weapons, yeah? like this weapons after 24 will never be selected
You can change the 24 to "NUM_WEAPONS + 1"
Also it seems CF learnt BASIC first - he kept using abs() when he should use fabs() ;D
P.S. Thanks for your fix. Seems Valve has changed a lot from the initial release of CS 1.6..... I'll add them to my code. Thanks.
My CS 1.6 is still the old version (I copied the required files out of the steam cache with a binary editor in order to run offline. I just don't want to redownload all things with my slow modem). So I haven't any idea about the new CS 1.6....