From daf69096b462bb16d35573d9ddacee6abeb31959 Mon Sep 17 00:00:00 2001 From: Steve Date: Tue, 20 Oct 2015 17:20:55 +0100 Subject: [PATCH] Show indicator arrow for star systems with available missions. --- README.md | 3 +++ gfx/galaxy/arrow.png | Bin 0 -> 325 bytes src/galaxy/galacticMap.c | 57 +++++++++++++++++++++++++++++++++++++-- src/galaxy/galacticMap.h | 1 + 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 gfx/galaxy/arrow.png diff --git a/README.md b/README.md index f31642d..a08dc32 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,9 @@ # tbftss 2D mission-based space shooter, based on the Battle for the Solar System space opera trilogy. +Website: www.battleforthesolarsystem.com +Email: stephenjsweeney@battleforthesolarsystem.com + CREDITS GRAPHICS diff --git a/gfx/galaxy/arrow.png b/gfx/galaxy/arrow.png new file mode 100644 index 0000000000000000000000000000000000000000..44df5114a2fd60a27335f2801dbe3580b914b105 GIT binary patch literal 325 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzwj^(N7l!{JxM1({$v_d#0*}aI z1_o|n5N2eUHAey{$X?><>&kwgON3ukDfpkwKcJ9giEBiObAE1aYF-J0b5UwyNotBh zd1gt5g1e`0KzJjcI8f1APZ!6Kh{H!O927ikz~K^j%r($>Z2;?1jpZp%Hm>ntnzlCK zzjBd}%d8HQRT9SA-_MY&cM7d%57|2P>U51SUkh3TZ9@`6_=9I$brwnc`jSig>q;Qb z$o*?41nyr7#A_x*?q4z? z@_#sEpna&rmHk=@uiLp!{Azb{{p-7M(Z28next) { - blit(starSystemTexture, starSystem->x - camera.x, starSystem->y - camera.y, 1); + r.x = starSystem->x - camera.x; + r.y = starSystem->y - camera.y; + + blit(starSystemTexture, r.x, r.y, 1); switch (starSystem->side) { @@ -317,7 +331,45 @@ static void drawGalaxy(void) break; } - drawText(starSystem->x - camera.x, starSystem->y - camera.y + 12, 14, TA_CENTER, color, starSystem->name); + drawText(r.x, r.y + 12, 14, TA_CENTER, color, starSystem->name); + + if (starSystem->completedMissions < starSystem->totalMissions) + { + ax = r.x; + ay = r.y; + aa = -1; + + ax = MAX(MIN(SCREEN_WIDTH - 64, ax), 64); + ay = MAX(MIN(SCREEN_HEIGHT - 64, ay), 64); + + if (r.x < 0) + { + ax = 64 + (sin(arrowPulse) * 10); + aa = 270; + } + else if (r.x > SCREEN_WIDTH) + { + ax = SCREEN_WIDTH - 64 + (sin(arrowPulse) * 10); + aa = 90; + } + else if (r.y < 0) + { + ay = 64 + (sin(arrowPulse) * 10); + aa = 0; + } + else if (r.y > SCREEN_HEIGHT) + { + ay = SCREEN_HEIGHT - 64 + (sin(arrowPulse) * 10); + aa = 180; + } + + if (aa != -1) + { + SDL_SetTextureColorMod(arrowTexture, 255, 0, 0); + + blitRotated(arrowTexture, ax, ay, aa); + } + } } if (!viewingSystem && selectedStarSystem != NULL) @@ -562,6 +614,7 @@ static void handleGalaxyKB(void) if (app.keyboard[SDL_SCANCODE_RETURN] && selectedStarSystem) { + playSound(SND_GUI_SELECT); selectStarSystem(); memset(app.keyboard, 0, sizeof(int) * MAX_KEYBOARD_KEYS); } diff --git a/src/galaxy/galacticMap.h b/src/galaxy/galacticMap.h index 90c9965..074377b 100644 --- a/src/galaxy/galacticMap.h +++ b/src/galaxy/galacticMap.h @@ -61,6 +61,7 @@ extern void drawOptions(void); extern void initOptions(void (*returnFromOptions)(void)); extern void drawStats(void); extern void playSound(int id); +extern void blitRotated(SDL_Texture *texture, int x, int y, int angle); extern App app; extern Colors colors;