diff --git a/dev/screenshots/v0.7-03.png b/dev/screenshots/v0.7-03.png new file mode 100644 index 0000000..0768b7a Binary files /dev/null and b/dev/screenshots/v0.7-03.png differ diff --git a/src/battle/entities.c b/src/battle/entities.c index 01dff42..6b6cfdb 100644 --- a/src/battle/entities.c +++ b/src/battle/entities.c @@ -485,6 +485,17 @@ static void drawTargetRects(Entity *e) SDL_SetRenderDrawColor(app.renderer, 0, 255, 0, 255); SDL_RenderDrawRect(app.renderer, &r); } + + if (e == battle.messageSpeaker && battle.stats[STAT_TIME] % 60 < 40) + { + r.x = e->x - (size / 2) - battle.camera.x; + r.y = e->y - (size / 2) - battle.camera.y; + r.w = size; + r.h = size; + + SDL_SetRenderDrawColor(app.renderer, 255, 255, 255, 255); + SDL_RenderDrawRect(app.renderer, &r); + } } void activateEntities(char *names) diff --git a/src/battle/hud.c b/src/battle/hud.c index 22bf94a..9ee2612 100644 --- a/src/battle/hud.c +++ b/src/battle/hud.c @@ -330,7 +330,7 @@ static void drawPlayerTargeter(void) float angle; int x, y; - if (player->target || battle.missionTarget || jumpgateEnabled()) + if (player->target || battle.missionTarget || jumpgateEnabled() || battle.messageSpeaker) { if (player->target) { @@ -340,6 +340,10 @@ static void drawPlayerTargeter(void) { SDL_SetTextureColorMod(targetCircle, 0, 255, 0); } + else if (battle.messageSpeaker) + { + SDL_SetTextureColorMod(targetCircle, 255, 255, 255); + } else { SDL_SetTextureColorMod(targetCircle, 255, 255, 0); @@ -389,6 +393,20 @@ static void drawPlayerTargeter(void) blitRotated(targetPointer, x - battle.camera.x, y - battle.camera.y, angle); } + + if (battle.messageSpeaker) + { + angle = getAngle(player->x, player->y, battle.messageSpeaker->x, battle.messageSpeaker->y); + x = player->x; + y = player->y; + + x += sin(TO_RAIDANS(angle)) * 45; + y += -cos(TO_RAIDANS(angle)) * 45; + + SDL_SetTextureColorMod(targetPointer, 255, 255, 255); + + blitRotated(targetPointer, x - battle.camera.x, y - battle.camera.y, angle); + } } static void drawNumFighters(void) diff --git a/src/battle/messageBox.c b/src/battle/messageBox.c index 29dc97d..46699b7 100644 --- a/src/battle/messageBox.c +++ b/src/battle/messageBox.c @@ -21,6 +21,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "messageBox.h" static void calculateMessageBoxHeight(MessageBox *msg); +static void nextMessage(void); static MessageBox head; static MessageBox *tail; @@ -34,12 +35,10 @@ void initMessageBox(void) void addMessageBox(char *title, char *body, int important) { MessageBox *msg; + int isFirst; float time; - if (tail == &head) - { - playSound(SND_RADIO); - } + isFirst = (tail == &head); msg = malloc(sizeof(MessageBox)); memset(msg, 0, sizeof(MessageBox)); @@ -53,6 +52,11 @@ void addMessageBox(char *title, char *body, int important) STRNCPY(msg->body, body, MAX_DESCRIPTION_LENGTH); msg->time = time * FPS; msg->important = important; + + if (isFirst) + { + nextMessage(); + } } void doMessageBox(void) @@ -74,9 +78,11 @@ void doMessageBox(void) free(msg); msg = &head; + battle.messageSpeaker = NULL; + if (head.next) { - playSound(SND_RADIO); + nextMessage(); } } } @@ -139,6 +145,22 @@ void drawMessageBox(void) } } +static void nextMessage(void) +{ + Entity *e; + + playSound(SND_RADIO); + + for (e = battle.entityHead.next ; e != NULL ; e = e->next) + { + if (strcmp(e->name, head.next->title) == 0) + { + battle.messageSpeaker = e; + return; + } + } +} + void resetMessageBox(void) { MessageBox *messageBox; diff --git a/src/battle/messageBox.h b/src/battle/messageBox.h index 9a8ac86..ff88c5e 100644 --- a/src/battle/messageBox.h +++ b/src/battle/messageBox.h @@ -26,4 +26,5 @@ extern void limitTextWidth(int width); extern void playSound(int sound); extern App app; +extern Battle battle; extern Colors colors; diff --git a/src/structs.h b/src/structs.h index 2d33e14..ccc76ad 100644 --- a/src/structs.h +++ b/src/structs.h @@ -344,6 +344,7 @@ typedef struct { int numObjectivesComplete, numObjectivesTotal, numConditions; Entity *missionTarget; Entity *jumpgate; + Entity *messageSpeaker; SDL_Texture *background, *planetTexture; PointF planet; int planetWidth, planetHeight;