[Add] System names are now viewable in starmap.

This commit is contained in:
Allanis 2013-03-10 18:59:54 +00:00
parent 4e2f8aa56d
commit 5221a51241

View File

@ -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, gl_drawCircleInRect(x + sys->pos.x*map_zoom,
r, bx, by, w, h); y + sys->pos.y*map_zoom,
r, bx, by, w, h);
// Draw the hyperspace paths. // Draw the system name.
glShadeModel(GL_SMOOTH); gl_printMax(&gl_smallFont, (bx+w)-(x+7. + sys->pos.x * map_zoom),
// Cheaply use transparency instead of actually x + 7. + sys->pos.x * map_zoom + gl_screen.w/2.,
// calculating from x to y the line must go. :) y - 5. + sys->pos.y * map_zoom + gl_screen.h/2.,
for(j = 0; j < sys->njumps; j++) { &cWhite, sys->name);
// Set the colours, is the route the current one?
if(((cur_system == sys) && (j == hyperspace_target)) || // Draw the hyperspace paths.
((cur_system == &systems_stack[sys->jumps[j]]) && glShadeModel(GL_SMOOTH);
(sys = &systems_stack[cur_system->jumps[hyperspace_target]]))) // Cheaply use transparency instead of actually
col = &cRed; // calculating from x to y the line must go. :)
else col = &cInert; for(j = 0; j < sys->njumps; j++) {
glBegin(GL_LINE_STRIP); // Set the colours, is the route the current one?
ACOLOUR(*col, 0.); if(((cur_system == sys) && (j == hyperspace_target)) ||
tx = x + sys->pos.x * map_zoom; ((cur_system == &systems_stack[sys->jumps[j]]) &&
ty = y + sys->pos.y * map_zoom; (sys = &systems_stack[cur_system->jumps[hyperspace_target]])))
if(!((tx < bx) || (tx > bx + w) || (ty < by) || (ty > by+h))) col = &cRed;
glVertex2d(tx, ty); else col = &cDarkBlue;
COLOUR(*col); glBegin(GL_LINE_STRIP);
tx += (systems_stack[sys->jumps[j]].pos.x - sys->pos.x)/2. * map_zoom; ACOLOUR(*col, 0.);
ty += (systems_stack[sys->jumps[j]].pos.y - sys->pos.y)/2. * map_zoom; tx = x + sys->pos.x * map_zoom;
if(!((tx < bx) || (tx > bx+w) || (ty < by) || (ty > by+h))) ty = y + sys->pos.y * map_zoom;
glVertex2d(tx, ty); if(!((tx < bx) || (tx > bx + w) || (ty < by) || (ty > by+h)))
ACOLOUR(*col, 0.); glVertex2d(tx, ty);
tx = x + systems_stack[sys->jumps[j]].pos.x * map_zoom; COLOUR(*col);
ty = y + systems_stack[sys->jumps[j]].pos.y * map_zoom; tx += (systems_stack[sys->jumps[j]].pos.x - sys->pos.x)/2. * map_zoom;
if(!((tx < bx) || (tx > bx+w) || (ty < by) || (ty > by+h))) ty += (systems_stack[sys->jumps[j]].pos.y - sys->pos.y)/2. * map_zoom;
glVertex2d(tx, ty); if(!((tx < bx) || (tx > bx+w) || (ty < by) || (ty > by+h)))
glEnd(); glVertex2d(tx, ty);
} ACOLOUR(*col, 0.);
glShadeModel(GL_FLAT); 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];