From 1ff7e4bcd688f3133a3f809d44f159b0d9846fdf Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 1 May 2016 11:52:44 +0100 Subject: [PATCH] If a message box speaker is "Wingmate" randomly choose from all available wingmates. --- src/battle/messageBox.c | 26 ++++++++++++++++++++++---- src/battle/messageBox.h | 1 + 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/battle/messageBox.c b/src/battle/messageBox.c index 46699b7..10f029f 100644 --- a/src/battle/messageBox.c +++ b/src/battle/messageBox.c @@ -147,18 +147,36 @@ void drawMessageBox(void) static void nextMessage(void) { - Entity *e; + Entity *e, *wingmate; + + wingmate = NULL; playSound(SND_RADIO); for (e = battle.entityHead.next ; e != NULL ; e = e->next) { - if (strcmp(e->name, head.next->title) == 0) + if (e->active && e != player) { - battle.messageSpeaker = e; - return; + if (strcmp(e->name, head.next->title) == 0) + { + battle.messageSpeaker = e; + return; + } + + if (strcmp(head.next->title, "Wingmate") == 0 && e->type == ET_FIGHTER && e->speed > 0) + { + wingmate = e; + + if (rand() % 2) + { + battle.messageSpeaker = e; + return; + } + } } } + + battle.messageSpeaker = wingmate; } void resetMessageBox(void) diff --git a/src/battle/messageBox.h b/src/battle/messageBox.h index ff88c5e..1a0c2ac 100644 --- a/src/battle/messageBox.h +++ b/src/battle/messageBox.h @@ -28,3 +28,4 @@ extern void playSound(int sound); extern App app; extern Battle battle; extern Colors colors; +extern Entity *player;