Combine K_FindRandomItems & K_FindEggboxes

This commit is contained in:
Sally Coolatta 2020-05-18 15:30:55 -04:00
parent c3a5193150
commit 1ec651ff00

View file

@ -270,10 +270,13 @@ fixed_t K_BotRubberband(player_t *player)
continue; continue;
} }
/*if (players[i].bot) #if 0
// Only rubberband up to players.
if (players[i].bot)
{ {
continue; continue;
}*/ }
#endif
if (firstplace == NULL || players[i].distancetofinish < firstplace->distancetofinish) if (firstplace == NULL || players[i].distancetofinish < firstplace->distancetofinish)
{ {
@ -413,36 +416,11 @@ fixed_t eggboxx, eggboxy;
UINT8 randomitems = 0; UINT8 randomitems = 0;
UINT8 eggboxes = 0; UINT8 eggboxes = 0;
static boolean K_FindRandomItems(mobj_t *thing)
{
fixed_t dist;
if (thing->type != MT_RANDOMITEM)
{
return true;
}
if (!thing->health)
{
return true;
}
dist = P_AproxDistance(thing->x - eggboxx, thing->y - eggboxy);
if (dist > distancetocheck)
{
return true;
}
randomitems++;
return true;
}
static boolean K_FindEggboxes(mobj_t *thing) static boolean K_FindEggboxes(mobj_t *thing)
{ {
fixed_t dist; fixed_t dist;
if (thing->type != MT_EGGMANITEM) if (thing->type != MT_RANDOMITEM && thing->type != MT_EGGMANITEM)
{ {
return true; return true;
} }
@ -459,7 +437,14 @@ static boolean K_FindEggboxes(mobj_t *thing)
return true; return true;
} }
if (thing->type == MT_RANDOMITEM)
{
randomitems++;
}
else
{
eggboxes++; eggboxes++;
}
return true; return true;
} }
@ -480,14 +465,6 @@ static UINT8 K_EggboxStealth(fixed_t x, fixed_t y)
BMBOUNDFIX(xl, xh, yl, yh); BMBOUNDFIX(xl, xh, yl, yh);
for (bx = xl; bx <= xh; bx++)
{
for (by = yl; by <= yh; by++)
{
P_BlockThingsIterator(bx, by, K_FindRandomItems);
}
}
for (bx = xl; bx <= xh; bx++) for (bx = xl; bx <= xh; bx++)
{ {
for (by = yl; by <= yh; by++) for (by = yl; by <= yh; by++)
@ -496,7 +473,7 @@ static UINT8 K_EggboxStealth(fixed_t x, fixed_t y)
} }
} }
return randomitems * eggboxes; return (randomitems * eggboxes);
} }
static inline boolean K_FindBlockingWalls(line_t *line) static inline boolean K_FindBlockingWalls(line_t *line)