diff --git a/dat/ssys.xml b/dat/ssys.xml index 1fe4ef8..e2b4239 100644 --- a/dat/ssys.xml +++ b/dat/ssys.xml @@ -71,6 +71,29 @@ SaraSys KonoSys + NCG-7292 + + + + + 67 + 20 + + + 230 + 0 + 0 + + + + + Merchant Ship + Merchant Mule + Pirate + Pirate + + + NCG-7291 diff --git a/src/colour.c b/src/colour.c index 625f459..0cce656 100644 --- a/src/colour.c +++ b/src/colour.c @@ -13,7 +13,6 @@ glColour cGrey20 = { .r = 0.20, .g = 0.20, .b = 0.20, .a = 1. }; glColour cGrey10 = { .r = 0.10, .g = 0.10, .b = 0.10, .a = 1. }; glColour cBlack = { .r = 0.00, .g = 0.00, .b = 0.00, .a = 1. }; -glColour cTrans = { .r = 1.00, .g = 1.00, .b = 1.00, .a = 0. }; glColour cGreen = { .r = 0.20, .g = 0.80, .b = 0.20, .a = 1. }; glColour cDarkRed = { .r = 0.60, .g = 0.10, .b = 0.10, .a = 1. }; glColour cRed = { .r = 0.80, .g = 0.20, .b = 0.20, .a = 1. }; diff --git a/src/colour.h b/src/colour.h index 18e29a0..a2b1e10 100644 --- a/src/colour.h +++ b/src/colour.h @@ -22,7 +22,6 @@ extern glColour cGrey30; extern glColour cGrey20; extern glColour cGrey10; -extern glColour cTrans; extern glColour cGreen; extern glColour cDarkRed; extern glColour cRed; diff --git a/src/map.c b/src/map.c index aff72b7..3b14bd3 100644 --- a/src/map.c +++ b/src/map.c @@ -22,8 +22,12 @@ static int map_selected = 0; static int map_drag = 0; // Is the user dragging the map? // Extern. +// space.c extern StarSystem* systems_stack; extern int systems_nstack; +// player.c +extern int planet_target; +extern int hyperspace_target; static void map_close(char* str); static void map_update(void); @@ -123,6 +127,7 @@ static void map_render(double bx, double by, double w, double h) { int i, j; double x, y, r; StarSystem* sys; + glColour* col; r = 5.; x = bx - map_xpos + w/2; @@ -150,17 +155,23 @@ static void map_render(double bx, double by, double w, double 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. :) + 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); - COLOUR(cTrans); + ACOLOUR(*col, 0.); glVertex2d(x+sys->pos.x, y+sys->pos.y); - COLOUR(cInert); + COLOUR(*col); 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); + ACOLOUR(*col, 0.); glVertex2d(x+systems_stack[sys->jumps[j]].pos.x, y+systems_stack[sys->jumps[j]].pos.y); glEnd(); @@ -175,7 +186,7 @@ static void map_render(double bx, double by, double w, double h) { // Map event handling. static void map_mouse(SDL_Event* event, double mx, double my) { - int i; + int i, j; double x, y, t; t = 13.*13.; // Threshold. @@ -193,6 +204,12 @@ static void map_mouse(SDL_Event* event, double mx, double my) { if((pow2(mx-x)+pow2(my-y)) < t) { map_selected = i; + for(j = 0; j < cur_system->njumps; j++) + if(i == cur_system->jumps[j]) { + planet_target = -1; // Override planet target. + hyperspace_target = j; + break; + } map_update(); break; } diff --git a/src/opengl.h b/src/opengl.h index fb2314c..4f5f19e 100644 --- a/src/opengl.h +++ b/src/opengl.h @@ -33,7 +33,8 @@ typedef struct glInfo_ { } glInfo; extern glInfo gl_screen; // Local structure set with gl_init etc. -#define COLOUR(x) glColor4d((x).r, (x).g, (x).b, (x).a) +#define COLOUR(x) glColor4d((x).r, (x).g, (x).b, (x).a) +#define ACOLOUR(x,a) glColor4d((x).r, (x).g, (x).b, a) // Spritesheet info. typedef struct glTexture_ { diff --git a/src/player.c b/src/player.c index e17e048..403ad40 100644 --- a/src/player.c +++ b/src/player.c @@ -35,9 +35,9 @@ unsigned int player_flags = 0; // Player flags. double player_turn = 0.; // Turn velocity from input. double player_acc = 0.; // Accel velocity from input. unsigned int player_target = PLAYER_ID; // Targetted pilot. -static int planet_target = -1; // Targetted planet. -// Internal. -static int hyperspace_target = -1; // Target hyperspace route. +// Internal +int planet_target = -1; // Targetted planet. +int hyperspace_target = -1; // Target hyperspace route. // Pilot stuff for GUI. extern Pilot** pilot_stack;