[Add] System names are now viewable in starmap.
This commit is contained in:
parent
4e2f8aa56d
commit
5221a51241
73
src/map.c
73
src/map.c
@ -154,40 +154,47 @@ static void map_render(double bx, double by, double w, double h) {
|
|||||||
if(sys == cur_system) COLOUR(cRadar_targ);
|
if(sys == cur_system) COLOUR(cRadar_targ);
|
||||||
else if(sys->nplanets == 0) COLOUR(cInert);
|
else if(sys->nplanets == 0) COLOUR(cInert);
|
||||||
else COLOUR(cYellow);
|
else COLOUR(cYellow);
|
||||||
gl_drawCircleInRect(x + sys->pos.x*map_zoom,
|
|
||||||
y + sys->pos.y*map_zoom,
|
|
||||||
r, bx, by, w, h);
|
|
||||||
|
|
||||||
// Draw the hyperspace paths.
|
gl_drawCircleInRect(x + sys->pos.x*map_zoom,
|
||||||
glShadeModel(GL_SMOOTH);
|
y + sys->pos.y*map_zoom,
|
||||||
// Cheaply use transparency instead of actually
|
r, bx, by, w, h);
|
||||||
// calculating from x to y the line must go. :)
|
|
||||||
for(j = 0; j < sys->njumps; j++) {
|
// Draw the system name.
|
||||||
// Set the colours, is the route the current one?
|
gl_printMax(&gl_smallFont, (bx+w)-(x+7. + sys->pos.x * map_zoom),
|
||||||
if(((cur_system == sys) && (j == hyperspace_target)) ||
|
x + 7. + sys->pos.x * map_zoom + gl_screen.w/2.,
|
||||||
((cur_system == &systems_stack[sys->jumps[j]]) &&
|
y - 5. + sys->pos.y * map_zoom + gl_screen.h/2.,
|
||||||
(sys = &systems_stack[cur_system->jumps[hyperspace_target]])))
|
&cWhite, sys->name);
|
||||||
col = &cRed;
|
|
||||||
else col = &cInert;
|
// Draw the hyperspace paths.
|
||||||
glBegin(GL_LINE_STRIP);
|
glShadeModel(GL_SMOOTH);
|
||||||
ACOLOUR(*col, 0.);
|
// Cheaply use transparency instead of actually
|
||||||
tx = x + sys->pos.x * map_zoom;
|
// calculating from x to y the line must go. :)
|
||||||
ty = y + sys->pos.y * map_zoom;
|
for(j = 0; j < sys->njumps; j++) {
|
||||||
if(!((tx < bx) || (tx > bx + w) || (ty < by) || (ty > by+h)))
|
// Set the colours, is the route the current one?
|
||||||
glVertex2d(tx, ty);
|
if(((cur_system == sys) && (j == hyperspace_target)) ||
|
||||||
COLOUR(*col);
|
((cur_system == &systems_stack[sys->jumps[j]]) &&
|
||||||
tx += (systems_stack[sys->jumps[j]].pos.x - sys->pos.x)/2. * map_zoom;
|
(sys = &systems_stack[cur_system->jumps[hyperspace_target]])))
|
||||||
ty += (systems_stack[sys->jumps[j]].pos.y - sys->pos.y)/2. * map_zoom;
|
col = &cRed;
|
||||||
if(!((tx < bx) || (tx > bx+w) || (ty < by) || (ty > by+h)))
|
else col = &cDarkBlue;
|
||||||
glVertex2d(tx, ty);
|
glBegin(GL_LINE_STRIP);
|
||||||
ACOLOUR(*col, 0.);
|
ACOLOUR(*col, 0.);
|
||||||
tx = x + systems_stack[sys->jumps[j]].pos.x * map_zoom;
|
tx = x + sys->pos.x * map_zoom;
|
||||||
ty = y + systems_stack[sys->jumps[j]].pos.y * map_zoom;
|
ty = y + sys->pos.y * map_zoom;
|
||||||
if(!((tx < bx) || (tx > bx+w) || (ty < by) || (ty > by+h)))
|
if(!((tx < bx) || (tx > bx + w) || (ty < by) || (ty > by+h)))
|
||||||
glVertex2d(tx, ty);
|
glVertex2d(tx, ty);
|
||||||
glEnd();
|
COLOUR(*col);
|
||||||
}
|
tx += (systems_stack[sys->jumps[j]].pos.x - sys->pos.x)/2. * map_zoom;
|
||||||
glShadeModel(GL_FLAT);
|
ty += (systems_stack[sys->jumps[j]].pos.y - sys->pos.y)/2. * map_zoom;
|
||||||
|
if(!((tx < bx) || (tx > bx+w) || (ty < by) || (ty > by+h)))
|
||||||
|
glVertex2d(tx, ty);
|
||||||
|
ACOLOUR(*col, 0.);
|
||||||
|
tx = x + systems_stack[sys->jumps[j]].pos.x * map_zoom;
|
||||||
|
ty = y + systems_stack[sys->jumps[j]].pos.y * map_zoom;
|
||||||
|
if(!((tx < bx) || (tx > bx+w) || (ty < by) || (ty > by+h)))
|
||||||
|
glVertex2d(tx, ty);
|
||||||
|
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