Consider centering when gathering entities.
This commit is contained in:
parent
3d90352fbc
commit
484afee9ef
|
@ -166,7 +166,7 @@ static void findTarget(void)
|
||||||
|
|
||||||
dist = closest = (!battle.epic) ? 2000 : MAX_TARGET_RANGE;
|
dist = closest = (!battle.epic) ? 2000 : MAX_TARGET_RANGE;
|
||||||
|
|
||||||
candidates = getAllEntsWithin(self->x - dist / 2, self->y - dist / 2, self->w + dist, self->h + dist, self);
|
candidates = getAllEntsWithin(self->x - (self->w / 2) - (dist / 2), self->y - (self->h / 2) - (dist / 2), self->w + dist, self->h + dist, self);
|
||||||
|
|
||||||
self->target = NULL;
|
self->target = NULL;
|
||||||
|
|
||||||
|
@ -403,7 +403,7 @@ static int nearExtractionPoint(void)
|
||||||
int i;
|
int i;
|
||||||
Entity *e, **candidates;
|
Entity *e, **candidates;
|
||||||
|
|
||||||
candidates = getAllEntsWithin(self->x - 500, self->y - 500, 1000, 1000, self);
|
candidates = getAllEntsWithin(self->x - (self->w / 2) - 500, self->y - (self->h / 2) - 500, 1000, 1000, self);
|
||||||
|
|
||||||
self->target = NULL;
|
self->target = NULL;
|
||||||
|
|
||||||
|
@ -435,7 +435,7 @@ static int nearEnemies(void)
|
||||||
int i, numEnemies;
|
int i, numEnemies;
|
||||||
Entity *e, **candidates;
|
Entity *e, **candidates;
|
||||||
|
|
||||||
candidates = getAllEntsWithin(self->x - 1000, self->y - 1000, 2000, 2000, self);
|
candidates = getAllEntsWithin(self->x - (self->w / 2) - 1000, self->y - (self->h / 2) - 1000, 2000, 2000, self);
|
||||||
|
|
||||||
self->target = NULL;
|
self->target = NULL;
|
||||||
self->targetLocation.x = self->targetLocation.y = 0;
|
self->targetLocation.x = self->targetLocation.y = 0;
|
||||||
|
|
|
@ -112,7 +112,7 @@ static void checkCollisions(Bullet *b)
|
||||||
Entity *e, **candidates;
|
Entity *e, **candidates;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
candidates = getAllEntsWithin(b->x, b->y, b->w, b->h, NULL);
|
candidates = getAllEntsWithin(b->x - (b->w / 2), b->y - (b->h / 2), b->w, b->h, NULL);
|
||||||
|
|
||||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||||
{
|
{
|
||||||
|
|
|
@ -56,7 +56,7 @@ static void handleFleeingEntities(void)
|
||||||
Entity *e, **candidates;
|
Entity *e, **candidates;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
candidates = getAllEntsWithin(self->x - self->w / 2, self->y - self->h / 2, self->w, self->h, self);
|
candidates = getAllEntsWithin(self->x - (self->w / 2), self->y - (self->h / 2), self->w, self->h, self);
|
||||||
|
|
||||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||||
{
|
{
|
||||||
|
|
|
@ -300,7 +300,7 @@ static void separate(void)
|
||||||
count = 0;
|
count = 0;
|
||||||
force = 0;
|
force = 0;
|
||||||
|
|
||||||
candidates = getAllEntsWithin(self->x, self->y, self->w, self->h, self);
|
candidates = getAllEntsWithin(self->x - (self->w / 2), self->y - (self->h / 2), self->w, self->h, self);
|
||||||
|
|
||||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,7 +27,7 @@ void attachRope(void)
|
||||||
|
|
||||||
if ((self->flags & EF_HAS_ROPE) && self->towing == NULL)
|
if ((self->flags & EF_HAS_ROPE) && self->towing == NULL)
|
||||||
{
|
{
|
||||||
candidates = getAllEntsWithin(self->x, self->y, self->w, self->h, self);
|
candidates = getAllEntsWithin(self->x - (self->w / 2), self->y - (self->h / 2), self->w, self->h, self);
|
||||||
|
|
||||||
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
for (i = 0, e = candidates[i] ; e != NULL ; e = candidates[++i])
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue