[Add] Map will draw hyperspace paths. :D
This commit is contained in:
parent
d31b9dad30
commit
dfb57c1775
32
src/map.c
32
src/map.c
@ -120,7 +120,7 @@ static void map_update(void) {
|
|||||||
|
|
||||||
// Render the map as a custom widget.
|
// Render the map as a custom widget.
|
||||||
static void map_render(double bx, double by, double w, double h) {
|
static void map_render(double bx, double by, double w, double h) {
|
||||||
int i;
|
int i, j;
|
||||||
double x, y, r;
|
double x, y, r;
|
||||||
StarSystem* sys;
|
StarSystem* sys;
|
||||||
|
|
||||||
@ -136,14 +136,36 @@ static void map_render(double bx, double by, double w, double h) {
|
|||||||
glVertex2d(bx+w, by);
|
glVertex2d(bx+w, by);
|
||||||
glEnd();
|
glEnd();
|
||||||
|
|
||||||
//COLOUR(cYellow);
|
|
||||||
// Render the star systems.
|
// Render the star systems.
|
||||||
for(i = 0; i < systems_nstack; i++) {
|
for(i = 0; i < systems_nstack; i++) {
|
||||||
if(&systems_stack[i] == cur_system) COLOUR(cRadar_targ);
|
sys = &systems_stack[i];
|
||||||
|
|
||||||
|
// Draw the system.
|
||||||
|
if(sys == cur_system) COLOUR(cRadar_targ);
|
||||||
|
else if(sys->nplanets == 0) COLOUR(cInert);
|
||||||
else COLOUR(cYellow);
|
else COLOUR(cYellow);
|
||||||
gl_drawCircleInRect(x + systems_stack[i].pos.x,
|
gl_drawCircleInRect(x + sys->pos.x,
|
||||||
y + systems_stack[i].pos.y,
|
y + sys->pos.y,
|
||||||
r, bx, by, w, h);
|
r, bx, by, w, h);
|
||||||
|
|
||||||
|
// Draw the hyperspace paths.
|
||||||
|
glShadeModel(GL_SMOOTH);
|
||||||
|
for(j = 0; j < sys->njumps; j++) {
|
||||||
|
// Cheaply use transparency instead of actually
|
||||||
|
// calculating from x to y the line must go. :)
|
||||||
|
glBegin(GL_LINE_STRIP);
|
||||||
|
COLOUR(cTrans);
|
||||||
|
glVertex2d(x+sys->pos.x, y+sys->pos.y);
|
||||||
|
COLOUR(cInert);
|
||||||
|
glVertex2d(
|
||||||
|
x+sys->pos.x+(systems_stack[sys->jumps[j]].pos.x-sys->pos.x)/2.,
|
||||||
|
y+sys->pos.y+(systems_stack[sys->jumps[j]].pos.y-sys->pos.y)/2.);
|
||||||
|
COLOUR(cTrans);
|
||||||
|
glVertex2d(x+systems_stack[sys->jumps[j]].pos.x,
|
||||||
|
y+systems_stack[sys->jumps[j]].pos.y);
|
||||||
|
glEnd();
|
||||||
|
}
|
||||||
|
glShadeModel(GL_FLAT);
|
||||||
}
|
}
|
||||||
// Selected planet.
|
// Selected planet.
|
||||||
sys = &systems_stack[map_selected];
|
sys = &systems_stack[map_selected];
|
||||||
|
Loading…
Reference in New Issue
Block a user