[Change] Planet target is rendered behind ships and weapons.
This commit is contained in:
parent
bf9d422150
commit
9773d9b19a
@ -211,6 +211,7 @@ static void update_space(void) {
|
|||||||
// Blitting order. (layers)
|
// Blitting order. (layers)
|
||||||
//
|
//
|
||||||
// BG | Stars and planets.
|
// BG | Stars and planets.
|
||||||
|
// | Background player stuff (planet targetting)
|
||||||
// | Background particles.
|
// | Background particles.
|
||||||
// | Back layer weapons.
|
// | Back layer weapons.
|
||||||
// X
|
// X
|
||||||
@ -226,6 +227,7 @@ static void render_space(void) {
|
|||||||
// BG.
|
// BG.
|
||||||
space_render(dt);
|
space_render(dt);
|
||||||
planets_render();
|
planets_render();
|
||||||
|
player_renderBG();
|
||||||
weapons_render(WEAPON_LAYER_BG);
|
weapons_render(WEAPON_LAYER_BG);
|
||||||
// N.
|
// N.
|
||||||
pilots_render();
|
pilots_render();
|
||||||
|
48
src/player.c
48
src/player.c
@ -209,13 +209,38 @@ void player_message(const char* fmt, ...) {
|
|||||||
msg_stack[0].t = SDL_GetTicks() + msg_timeout;
|
msg_stack[0].t = SDL_GetTicks() + msg_timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void player_renderBG(void) {
|
||||||
|
double x, y;
|
||||||
|
glColour* c;
|
||||||
|
Planet* planet;
|
||||||
|
|
||||||
|
if(planet_target >= 0) {
|
||||||
|
planet = &cur_system->planets[planet_target];
|
||||||
|
|
||||||
|
if(areEnemies(player->faction, planet->faction)) c = &cHostile;
|
||||||
|
else c = &cNeutral;
|
||||||
|
|
||||||
|
x = planet->pos.x - planet->gfx_space->sw/2.;
|
||||||
|
y = planet->pos.y + planet->gfx_space->sh/2.;
|
||||||
|
gl_blitSprite(gui.gfx_targetPlanet, x, y, 0, 0, c); // Top left.
|
||||||
|
|
||||||
|
x += planet->gfx_space->sw;
|
||||||
|
gl_blitSprite(gui.gfx_targetPlanet, x, y, 1, 0, c); // Top right.
|
||||||
|
|
||||||
|
y -= planet->gfx_space->sh;
|
||||||
|
gl_blitSprite(gui.gfx_targetPlanet, x, y, 1, 1, c); // Bottom right.
|
||||||
|
|
||||||
|
x -= planet->gfx_space->sw;
|
||||||
|
gl_blitSprite(gui.gfx_targetPlanet, x, y, 0, 1, c); // Bottom left.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Render the player.
|
// Render the player.
|
||||||
void player_render(void) {
|
void player_render(void) {
|
||||||
int i, j;
|
int i, j;
|
||||||
double x, y;
|
double x, y;
|
||||||
char str[10];
|
char str[10];
|
||||||
Pilot* p;
|
Pilot* p;
|
||||||
Planet* planet;
|
|
||||||
glColour* c;
|
glColour* c;
|
||||||
glFont* f;
|
glFont* f;
|
||||||
|
|
||||||
@ -240,27 +265,6 @@ void player_render(void) {
|
|||||||
x -= p->ship->gfx_space->sw * PILOT_SIZE_APROX;
|
x -= p->ship->gfx_space->sw * PILOT_SIZE_APROX;
|
||||||
gl_blitSprite(gui.gfx_targetPilot, x, y, 0, 1, c); // Bottom left.
|
gl_blitSprite(gui.gfx_targetPilot, x, y, 0, 1, c); // Bottom left.
|
||||||
}
|
}
|
||||||
// Render the planet target graphics.
|
|
||||||
if(planet_target >= 0) {
|
|
||||||
planet = &cur_system->planets[planet_target];
|
|
||||||
|
|
||||||
if(areEnemies(player->faction, planet->faction)) 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_targetPlanet, x, y, 0, 0, c); // Top left.
|
|
||||||
|
|
||||||
x += p->ship->gfx_space->sw * PILOT_SIZE_APROX;
|
|
||||||
gl_blitSprite(gui.gfx_targetPlanet, x, y, 1, 0, c); // Top right.
|
|
||||||
|
|
||||||
y -= p->ship->gfx_space->sh * PILOT_SIZE_APROX;
|
|
||||||
gl_blitSprite(gui.gfx_targetPlanet, x, y, 1, 1, c); // Bottom right.
|
|
||||||
|
|
||||||
x -= p->ship->gfx_space->sw * PILOT_SIZE_APROX;
|
|
||||||
gl_blitSprite(gui.gfx_targetPlanet, x, y, 0, 1, c); // Bottom left.
|
|
||||||
|
|
||||||
}
|
|
||||||
// Render the player.
|
// Render the player.
|
||||||
pilot_render(player);
|
pilot_render(player);
|
||||||
|
|
||||||
|
@ -27,6 +27,7 @@ void player_new(void);
|
|||||||
int gui_init(void);
|
int gui_init(void);
|
||||||
void gui_free(void);
|
void gui_free(void);
|
||||||
void player_render(void);
|
void player_render(void);
|
||||||
|
void player_renderBG(void); // Render BG layer.
|
||||||
|
|
||||||
// Misc.
|
// Misc.
|
||||||
void player_message(const char* fmt, ...);
|
void player_message(const char* fmt, ...);
|
||||||
|
Loading…
Reference in New Issue
Block a user