diff --git a/sdl1090/defs.h b/sdl1090/defs.h index 79c77b6..2cc3768 100644 --- a/sdl1090/defs.h +++ b/sdl1090/defs.h @@ -17,7 +17,7 @@ #define UISCALE 1 #define LOGMAXDIST 1000.0 -#define MAXDIST 50.0 +#define MAXDIST 25.0 #define AA 0 diff --git a/sdl1090/mapdata.c.REMOVED.git-id b/sdl1090/mapdata.c.REMOVED.git-id index 904dee2..6388773 100644 --- a/sdl1090/mapdata.c.REMOVED.git-id +++ b/sdl1090/mapdata.c.REMOVED.git-id @@ -1 +1 @@ -b27351eb14efa48364b7125548c8aa825a31afc6 \ No newline at end of file +c1ba33fa01b0542b5be9bdef8df2078491847af5 \ No newline at end of file diff --git a/sdl1090/mapdata.h b/sdl1090/mapdata.h index 44f800e..bcdd7c1 100644 --- a/sdl1090/mapdata.h +++ b/sdl1090/mapdata.h @@ -1,2 +1,4 @@ double *mapPoints_relative; +double *mapPoints_x; +double *mapPoints_y; int mapPoints_count; diff --git a/sdl1090/maps.c b/sdl1090/maps.c index dffb74f..1885370 100644 --- a/sdl1090/maps.c +++ b/sdl1090/maps.c @@ -145,6 +145,9 @@ void drawPlaneHeading(int x, int y, double heading, SDL_Color planeColor) void drawPlane(int x, int y, SDL_Color planeColor) { if(outOfBounds(x,y)) { + // + // Draw oob arrow here + // return; } @@ -248,7 +251,12 @@ void drawGeography() { double d1 = sqrt(mapPoints_relative[(i - 1) * 2] * mapPoints_relative[(i - 1) * 2] + mapPoints_relative[(i - 1) * 2 + 1] * mapPoints_relative[(i - 1) * 2 + 1]); double d2 = sqrt(mapPoints_relative[i * 2]* mapPoints_relative[i * 2] + mapPoints_relative[i * 2 + 1] * mapPoints_relative[i * 2 + 1]); - double alpha = 255.0 - 255.0 * (d1+d2) / (2 * 250); + double alpha = 255.0 * (d1+d2) / 2; + if(Modes.mapLogDist) { + alpha = 255.0 - alpha / 125.0; + } else { + alpha = 255.0 - alpha / 25.0; + } if(AA) { aalineRGBA(game.screen, x1, y1, x2, y2,purple.r,purple.g,purple.b, (alpha < 0) ? 0 : (uint8_t) alpha); @@ -256,6 +264,13 @@ void drawGeography() { thickLineRGBA(game.screen, x1, y1, x2, y2, Modes.screen_uiscale, purple.r,purple.g,purple.b, (alpha < 0) ? 0 : (uint8_t) alpha); } } + + // int *screen_x = (int *) malloc(mapPoints_count * sizeof(int)); + // int *screen_y = (int *) malloc(mapPoints_count * sizeof(int)); + + // initializeMap(screen_x, screen_y); + + // filledPolygonRGBA(game.screen,screen_x, screen_y, mapPoints_count, 100, 100, 100, 255); } void drawMap(void) { @@ -294,7 +309,8 @@ void drawMap(void) { double age_ms = (double)(mstime() - a->created); if(age_ms < 500) { circleRGBA(game.screen, x, y, 500 - age_ms, 255,255, 255, (uint8_t)(255.0 * age_ms / 500.0)); - } + break; + } if(MODES_ACFLAGS_HEADING_VALID) { drawPlaneHeading(x, y,a->track, planeColor); @@ -321,3 +337,30 @@ void drawMap(void) { a = a->next; } } + +// void initializeMap(short *screen_x, short *screen_y) { +// int out_x, out_y; +// for(int i=0; i= Modes.screen_width) { +// // out_x = Modes.screen_width; +// // } + +// // if(out_y >= Modes.screen_height) { +// // out_y = Modes.screen_height; +// // } + +// screen_x[i] = out_x; +// screen_y[i] = out_y; +// } +// } \ No newline at end of file diff --git a/sdl1090/view1090.REMOVED.git-id b/sdl1090/view1090.REMOVED.git-id index 7e190be..98b1431 100644 --- a/sdl1090/view1090.REMOVED.git-id +++ b/sdl1090/view1090.REMOVED.git-id @@ -1 +1 @@ -28dc4d035492ea5f8627c495e51ea37b58ea01ec \ No newline at end of file +d29ca545170e5498144b5f10fa17976c4f51eab5 \ No newline at end of file diff --git a/sdl1090/view1090.c b/sdl1090/view1090.c index a4d7efe..6a958ab 100644 --- a/sdl1090/view1090.c +++ b/sdl1090/view1090.c @@ -379,8 +379,7 @@ int main(int argc, char **argv) { atexit(cleanup); go = 1; - - + while (go == 1) { getInput();