From e86e5210df1721b6b956309bbae70b84ca57234b Mon Sep 17 00:00:00 2001 From: Julie Marchant Date: Sun, 26 May 2019 18:22:08 -0400 Subject: [PATCH] Re-implemented a targeting system similar to the original for Classic. It's not exactly the same technically, but in function it is. The only functional difference is that the original would sometimes show an unexpected health bar for a small(ish) enemy, whereas the new implementation never does that. Also different is that exact location is still shown. Will fix that next. --- README.txt | 12 +++++------- src/game.c | 29 +++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/README.txt b/README.txt index 2e35eee..bd37e06 100644 --- a/README.txt +++ b/README.txt @@ -53,13 +53,11 @@ of the game (the last version released by Parallel Realities) as closely as possible. However, there are a few minor differences in addition to the changes to graphics, sound, and dialog: -* Where targets are is shown via arrows at the edge of the screen, and - all targets are indicated in this way; the main target is indicated - with text that says "Target", unless the target is one of the cast of - named characters, and all named characters have their arrows indicated - with their respective arrows. In contrast, version 1.1 only had an - optional arrow that rested in the middle of the screen and pointed in - the general direction of the active (main) target. +* The current target is shown by an arrow at the edge of the screen which + precisely indicates the target's position. In contrast, version 1.1's + optional target arrow rested in the middle of the screen and only + pointed in the general direction (north, south, east, west, northwest, + northeast, southwest, southeast) of the target. * Selling your secondary weapon leaves you with standard Rockets. In version 1.1, it instead left you with no secondary weapon at all (with diff --git a/src/game.c b/src/game.c index 95342e8..bac8826 100644 --- a/src/game.c +++ b/src/game.c @@ -1774,10 +1774,12 @@ static void game_doArrow(int i) static void game_doHud() { + static int last_arrow = -1; int shieldColor = 0; SDL_Rect bar; int fontColor; char text[25]; + int i; screen_addBuffer(0, 20, screen->w, 25); screen_addBuffer(0, screen->h - 50, screen->w, 34); @@ -1809,8 +1811,31 @@ static void game_doHud() gfx_createTextObject(TS_CASH, text, 90, 21, FONT_WHITE); screen_blitText(TS_CASH); - for (int i = 0; i < ALIEN_MAX; i++) - game_doArrow(i); + if (game.difficulty == DIFFICULTY_ORIGINAL) + { + i = engine.targetIndex; + if ((i >= 0) && aliens[i].active && (aliens[i].shield > 0) && (!(aliens[i].flags & FL_ISCLOAKED))) + game_doArrow(i); + else + { + i = last_arrow; + if ((i >= 0) && aliens[i].active && (aliens[i].shield > 0) && (!(aliens[i].flags & FL_ISCLOAKED))) + game_doArrow(i); + else + { + last_arrow = rand() % ALIEN_MAX; + if (aliens[last_arrow].flags & FL_FRIEND) + last_arrow = 0; + + game_doArrow(last_arrow); + } + } + } + else + { + for (i = 0; i < ALIEN_MAX; i++) + game_doArrow(i); + } fontColor = FONT_WHITE; if (player.ammo[0] > 0)