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