[Change] Render player ontop of target graphics.
This commit is contained in:
parent
266f502e49
commit
489b972879
57
src/player.c
57
src/player.c
@ -567,8 +567,39 @@ void player_renderBG(void) {
|
|||||||
|
|
||||||
/* Render the player. */
|
/* Render the player. */
|
||||||
void player_render(void) {
|
void player_render(void) {
|
||||||
if((player != NULL) && !player_isFlag(PLAYER_CREATING))
|
Pilot* p;
|
||||||
|
glColour* c;
|
||||||
|
double x, y;
|
||||||
|
|
||||||
|
if((player != NULL) && !player_isFlag(PLAYER_CREATING)) {
|
||||||
|
/* Render the player target graphics. */
|
||||||
|
if(player_target != PLAYER_ID) p = pilot_get(player_target);
|
||||||
|
else p = NULL;
|
||||||
|
if((p == NULL) || pilot_isFlag(p, PILOT_DEAD))
|
||||||
|
player_target = PLAYER_ID; /* No more pilot target. */
|
||||||
|
else {
|
||||||
|
/* There is still a pilot target. */
|
||||||
|
if(pilot_isDisabled(p)) c = &cInert;
|
||||||
|
else if(pilot_isFlag(p, PILOT_HOSTILE)) c = &cHostile;
|
||||||
|
else c = &cNeutral;
|
||||||
|
|
||||||
|
x = p->solid->pos.x - p->ship->gfx_space->sw * PILOT_SIZE_APROX/2.;
|
||||||
|
y = p->solid->pos.y + p->ship->gfx_space->sh * PILOT_SIZE_APROX/2.;
|
||||||
|
gl_blitSprite(gui.gfx_targetPilot, x, y, 0, 0, c); /* Top left. */
|
||||||
|
|
||||||
|
x += p->ship->gfx_space->sw * PILOT_SIZE_APROX;
|
||||||
|
gl_blitSprite(gui.gfx_targetPilot, x, y, 1, 0, c); /* Top right. */
|
||||||
|
|
||||||
|
y -= p->ship->gfx_space->sh * PILOT_SIZE_APROX;
|
||||||
|
gl_blitSprite(gui.gfx_targetPilot, x, y, 1, 1, c); /* Bottom right. */
|
||||||
|
|
||||||
|
x -= p->ship->gfx_space->sw * PILOT_SIZE_APROX;
|
||||||
|
gl_blitSprite(gui.gfx_targetPilot, x, y, 0, 1, c); /* Bottom left. */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Player is ontop of targeting graphic. */
|
||||||
pilot_render(player);
|
pilot_render(player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Render the player's GUI. */
|
/* Render the player's GUI. */
|
||||||
@ -598,30 +629,6 @@ void player_renderGUI(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(player == NULL) return;
|
if(player == NULL) return;
|
||||||
/* Render the player target graphics. */
|
|
||||||
if(player_target != PLAYER_ID) p = pilot_get(player_target);
|
|
||||||
else p = NULL;
|
|
||||||
if((p == NULL) || pilot_isFlag(p, PILOT_DEAD))
|
|
||||||
player_target = PLAYER_ID; /* No more pilot target. */
|
|
||||||
else {
|
|
||||||
/* There is still a pilot target. */
|
|
||||||
if(pilot_isDisabled(p)) c = &cInert;
|
|
||||||
else if(pilot_isFlag(p, PILOT_HOSTILE)) c = &cHostile;
|
|
||||||
else c = &cNeutral;
|
|
||||||
|
|
||||||
x = p->solid->pos.x - p->ship->gfx_space->sw * PILOT_SIZE_APROX/2.;
|
|
||||||
y = p->solid->pos.y + p->ship->gfx_space->sh * PILOT_SIZE_APROX/2.;
|
|
||||||
gl_blitSprite(gui.gfx_targetPilot, x, y, 0, 0, c); /* Top left. */
|
|
||||||
|
|
||||||
x += p->ship->gfx_space->sw * PILOT_SIZE_APROX;
|
|
||||||
gl_blitSprite(gui.gfx_targetPilot, x, y, 1, 0, c); /* Top right. */
|
|
||||||
|
|
||||||
y -= p->ship->gfx_space->sh * PILOT_SIZE_APROX;
|
|
||||||
gl_blitSprite(gui.gfx_targetPilot, x, y, 1, 1, c); /* Bottom right. */
|
|
||||||
|
|
||||||
x -= p->ship->gfx_space->sw * PILOT_SIZE_APROX;
|
|
||||||
gl_blitSprite(gui.gfx_targetPilot, x, y, 0, 1, c); /* Bottom left. */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Lockon warning. */
|
/* Lockon warning. */
|
||||||
if(player->lockons > 0)
|
if(player->lockons > 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user