If a message box speaker is "Wingmate" randomly choose from all available wingmates.

This commit is contained in:
Steve 2016-05-01 11:52:44 +01:00
parent 0baaeac246
commit 1ff7e4bcd6
2 changed files with 23 additions and 4 deletions

View File

@ -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)

View File

@ -28,3 +28,4 @@ extern void playSound(int sound);
extern App app;
extern Battle battle;
extern Colors colors;
extern Entity *player;