/*
-Copyright (C) 2004 Parallel Realities
+Copyright (C) 2004-2011 Parallel Realities
+Copyright (C) 2011-2015 Perpendicular Dimensions
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
void initMIAPhrases()
{
- strcpy(mia_scared[0], "help me...");
- strcpy(mia_scared[1], "i don't wanna die...");
- strcpy(mia_scared[2], "please... someone help...");
- strcpy(mia_scared[3], "i... i'm scared...");
- strcpy(mia_scared[4], "i wanna go home...");
- strcpy(mia_scared[5], "what was that?!");
- strcpy(mia_scared[6], "i don't like it here...");
+ strlcpy(mia_scared[0], "help me...", sizeof mia_scared[0]);
+ strlcpy(mia_scared[1], "i don't wanna die...", sizeof mia_scared[1]);
+ strlcpy(mia_scared[2], "please... someone help...", sizeof mia_scared[2]);
+ strlcpy(mia_scared[3], "i... i'm scared...", sizeof mia_scared[3]);
+ strlcpy(mia_scared[4], "i wanna go home...", sizeof mia_scared[4]);
+ strlcpy(mia_scared[5], "what was that?!", sizeof mia_scared[5]);
+ strlcpy(mia_scared[6], "i don't like it here...", sizeof mia_scared[6]);
}
void addMIA(const char *name, int x, int y, int type)
{
Entity *mia = new Entity();
- strcpy(mia->name, name);
+ strlcpy(mia->name, name, sizeof mia->name);
mia->id = type;
mia->baseThink = 60;
mia->health = 180;
int x, y;
- char message[100];
+ char message[256];
while (mia->next != NULL)
{
if ((mia->value != 100) && (!(mia->flags & ENT_DYING)))
{
+ static Graphics::SurfaceCache cache;
graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
- graphics.drawString(_((char*)mia_scared[mia->value]), x + 10, y - 10, true, graphics.screen);
+ graphics.drawString(_((char*)mia_scared[mia->value]), x + 10, y - 10, true, graphics.screen, cache);
}
graphics.blit(mia->getFaceImage(), x, y, graphics.screen, false);
{
Math::addBit(&mia->flags, ENT_WEIGHTLESS);
Math::addBit(&mia->flags, ENT_DYING);
- audio.playSound(SND_TELEPORT1, CH_ANY);
+ audio.playSound(SND_TELEPORT1, CH_ANY, mia->x);
}
}
if ((map.foundMIAs == (map.requiredMIAs / 2)) || (game.skill == 0))
{
- sprintf(message, _("Rescued %s - Checkpoint Reached!"), mia->name);
+ snprintf(message, sizeof message, _("Rescued %s - Checkpoint Reached!"), mia->name);
game.setObjectiveCheckPoint();
}
else
{
- sprintf(message, _("Rescued %s!"), mia->name);
+ snprintf(message, sizeof message, _("Rescued %s!"), mia->name);
}
if (map.foundMIAs == map.requiredMIAs)
{
- sprintf(message, _("Rescue %d MIAs - Objective Complete - Checkpoint Reached!"), map.requiredMIAs);
+ snprintf(message, sizeof message, _("Rescue %d MIAs - Objective Complete - Checkpoint Reached!"), map.requiredMIAs);
game.setObjectiveCheckPoint();
}
+
+ // MIA Medals
+ if (game.totalMIAsRescued == 50)
+ {
+ presentPlayerMedal("50_MIA");
+ }
+ else if (game.totalMIAsRescued == 100)
+ {
+ presentPlayerMedal("100_MIA");
+ }
+ else if (game.totalMIAsRescued == 200)
+ {
+ presentPlayerMedal("200_MIA");
+ }
+ else if (game.totalMIAsRescued == 227)
+ {
+ presentPlayerMedal("ALL_MIA");
+ }
engine.setInfoMessage(message, 1, INFO_OBJECTIVE);
}