Highlight all mission targets, not just the one the player is targetting.
This commit is contained in:
parent
414c12e48f
commit
ec72a5dd40
|
@ -22,8 +22,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
static void drawEntity(Entity *e);
|
static void drawEntity(Entity *e);
|
||||||
static void doEntity(void);
|
static void doEntity(void);
|
||||||
|
static void drawEntity(Entity *e);
|
||||||
static void activateEpicFighters(int n, int side);
|
static void activateEpicFighters(int n, int side);
|
||||||
static void restrictToGrid(Entity *e);
|
static void restrictToGrid(Entity *e);
|
||||||
|
static void drawTargetRects(Entity *e);
|
||||||
static int drawComparator(const void *a, const void *b);
|
static int drawComparator(const void *a, const void *b);
|
||||||
|
|
||||||
Entity *spawnEntity(void)
|
Entity *spawnEntity(void)
|
||||||
|
@ -204,10 +206,8 @@ void drawEntities(void)
|
||||||
|
|
||||||
candidates = getAllEntsWithin(battle.camera.x, battle.camera.y, SCREEN_WIDTH, SCREEN_HEIGHT, NULL);
|
candidates = getAllEntsWithin(battle.camera.x, battle.camera.y, SCREEN_WIDTH, SCREEN_HEIGHT, NULL);
|
||||||
|
|
||||||
for (i = 0, e = candidates[i] ; e != NULL ; i++, e = candidates[i])
|
/* count number of candidates for use with qsort */
|
||||||
{
|
for (i = 0, e = candidates[i] ; e != NULL ; i++, e = candidates[i]) {}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
qsort(candidates, i, sizeof(Entity*), drawComparator);
|
qsort(candidates, i, sizeof(Entity*), drawComparator);
|
||||||
|
|
||||||
|
@ -226,6 +226,8 @@ void drawEntities(void)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
drawTargetRects(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,6 +236,33 @@ static void drawEntity(Entity *e)
|
||||||
blitRotated(e->texture, e->x - battle.camera.x, e->y - battle.camera.y, e->angle);
|
blitRotated(e->texture, e->x - battle.camera.x, e->y - battle.camera.y, e->angle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void drawTargetRects(Entity *e)
|
||||||
|
{
|
||||||
|
SDL_Rect r;
|
||||||
|
|
||||||
|
if (e == player->target)
|
||||||
|
{
|
||||||
|
r.x = e->x - 32 - battle.camera.x;
|
||||||
|
r.y = e->y - 32 - battle.camera.y;
|
||||||
|
r.w = 64;
|
||||||
|
r.h = 64;
|
||||||
|
|
||||||
|
SDL_SetRenderDrawColor(app.renderer, 255, 0, 0, 255);
|
||||||
|
SDL_RenderDrawRect(app.renderer, &r);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((e == battle.missionTarget || e->flags & EF_MISSION_TARGET) && (e->flags & EF_NO_MT_BOX) == 0)
|
||||||
|
{
|
||||||
|
r.x = e->x - 28 - battle.camera.x;
|
||||||
|
r.y = e->y - 28 - battle.camera.y;
|
||||||
|
r.w = 56;
|
||||||
|
r.h = 56;
|
||||||
|
|
||||||
|
SDL_SetRenderDrawColor(app.renderer, 0, 255, 0, 255);
|
||||||
|
SDL_RenderDrawRect(app.renderer, &r);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void activateEntities(char *name)
|
void activateEntities(char *name)
|
||||||
{
|
{
|
||||||
Entity *e;
|
Entity *e;
|
||||||
|
|
|
@ -30,6 +30,7 @@ extern void addToGrid(Entity *e);
|
||||||
extern void removeFromGrid(Entity *e);
|
extern void removeFromGrid(Entity *e);
|
||||||
extern Entity **getAllEntsWithin(int x, int y, int w, int h, Entity *ignore);
|
extern Entity **getAllEntsWithin(int x, int y, int w, int h, Entity *ignore);
|
||||||
|
|
||||||
|
extern App app;
|
||||||
extern Battle battle;
|
extern Battle battle;
|
||||||
extern Entity *self;
|
extern Entity *self;
|
||||||
extern Entity *player;
|
extern Entity *player;
|
||||||
|
|
|
@ -29,7 +29,6 @@ static void drawObjectives(void);
|
||||||
static void drawDistancesInfo(void);
|
static void drawDistancesInfo(void);
|
||||||
static void drawHudMessages(void);
|
static void drawHudMessages(void);
|
||||||
static void drawPlayerSelect(void);
|
static void drawPlayerSelect(void);
|
||||||
static void drawTargetsRects(void);
|
|
||||||
|
|
||||||
static HudMessage hudMessageHead;
|
static HudMessage hudMessageHead;
|
||||||
static HudMessage *hudMessageTail;
|
static HudMessage *hudMessageTail;
|
||||||
|
@ -127,8 +126,6 @@ void drawHud(void)
|
||||||
|
|
||||||
drawPlayerTargeter();
|
drawPlayerTargeter();
|
||||||
|
|
||||||
drawTargetsRects();
|
|
||||||
|
|
||||||
drawWeaponInfo();
|
drawWeaponInfo();
|
||||||
|
|
||||||
drawNumFighters();
|
drawNumFighters();
|
||||||
|
@ -285,33 +282,6 @@ static void drawPlayerTargeter(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drawTargetsRects(void)
|
|
||||||
{
|
|
||||||
SDL_Rect r;
|
|
||||||
|
|
||||||
if (player->target)
|
|
||||||
{
|
|
||||||
r.x = player->target->x - 32 - battle.camera.x;
|
|
||||||
r.y = player->target->y - 32 - battle.camera.y;
|
|
||||||
r.w = 64;
|
|
||||||
r.h = 64;
|
|
||||||
|
|
||||||
SDL_SetRenderDrawColor(app.renderer, 255, 64, 0, 255);
|
|
||||||
SDL_RenderDrawRect(app.renderer, &r);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (battle.missionTarget && (battle.missionTarget->flags & EF_NO_MT_BOX) == 0)
|
|
||||||
{
|
|
||||||
r.x = battle.missionTarget->x - 28 - battle.camera.x;
|
|
||||||
r.y = battle.missionTarget->y - 28 - battle.camera.y;
|
|
||||||
r.w = 56;
|
|
||||||
r.h = 56;
|
|
||||||
|
|
||||||
SDL_SetRenderDrawColor(app.renderer, 64, 255, 0, 255);
|
|
||||||
SDL_RenderDrawRect(app.renderer, &r);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void drawNumFighters(void)
|
static void drawNumFighters(void)
|
||||||
{
|
{
|
||||||
/* Allies */
|
/* Allies */
|
||||||
|
|
Loading…
Reference in New Issue