Bots treat all offroad as wall

Rather than only strong offroad.
This commit is contained in:
Sally Coolatta 2022-11-26 18:57:05 -05:00
parent 63ae0ea6bd
commit bd337d1494
2 changed files with 14 additions and 3 deletions

View file

@ -149,7 +149,7 @@ static boolean K_BotHatesThisSectorsSpecial(player_t *player, sector_t *sec)
return true; return true;
} }
if (sec->offroad > FRACUNIT) // Only care about strong offroad. if (sec->offroad > 0)
{ {
return !K_BotCanTakeCut(player); return !K_BotCanTakeCut(player);
} }

View file

@ -334,6 +334,12 @@ static boolean P_CanTraceBlockingLine(seg_t *seg, divline_t *divl, register los_
(void)divl; (void)divl;
if (!(line->flags & ML_TWOSIDED))
{
// stop because it is not two sided anyway
return false;
}
if (P_IsLineBlocking(line, los->compareThing) == true) if (P_IsLineBlocking(line, los->compareThing) == true)
{ {
// This line will always block us // This line will always block us
@ -380,11 +386,16 @@ static boolean P_CanBotTraverse(seg_t *seg, divline_t *divl, register los_t *los
if (los->compareThing->player != NULL && los->alreadyHates == false) if (los->compareThing->player != NULL && los->alreadyHates == false)
{ {
// Treat damage sectors like walls, if you're not already in a bad sector. // Treat damage sectors like walls, if you're not already in a bad sector.
const sector_t *front, *back;
vertex_t pos; vertex_t pos;
P_ClosestPointOnLine(los->compareThing->x, los->compareThing->y, line, &pos); P_ClosestPointOnLine(los->compareThing->x, los->compareThing->y, line, &pos);
if (K_BotHatesThisSector(los->compareThing->player, line->frontsector, pos.x, pos.y) front = seg->frontsector;
|| K_BotHatesThisSector(los->compareThing->player, line->backsector, pos.x, pos.y)) back = seg->backsector;
if (K_BotHatesThisSector(los->compareThing->player, front, pos.x, pos.y)
|| K_BotHatesThisSector(los->compareThing->player, back, pos.x, pos.y))
{ {
// This line does not block us, but we don't want to be in it. // This line does not block us, but we don't want to be in it.
return false; return false;