2 Copyright (C) 2004 Parallel Realities
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 See the GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 strcpy(mia_scared[0], "help me...");
26 strcpy(mia_scared[1], "i don't wanna die...");
27 strcpy(mia_scared[2], "please... someone help...");
28 strcpy(mia_scared[3], "i... i'm scared...");
29 strcpy(mia_scared[4], "i wanna go home...");
30 strcpy(mia_scared[5], "what was that?!");
31 strcpy(mia_scared[6], "i don't like it here...");
34 void addMIA(const char *name, int x, int y, int type)
36 Entity *mia = new Entity();
38 strcpy(mia->name, name);
43 mia->value = Math::rrand(0, 5);
44 mia->flags = ENT_INANIMATE; // MIAs don't drown
49 mia->setSprites(graphics.getSprite("ScaredMIA", true), graphics.getSprite("ScaredMIA", true), graphics.getSprite("ScaredMIA", true));
52 mia->setSprites(graphics.getSprite("AquaMIA", true), graphics.getSprite("AquaMIA", true), graphics.getSprite("AquaMIA", true));
61 Entity *mia = (Entity*)map.miaList.getHead();
67 while (mia->next != NULL)
69 mia = (Entity*)mia->next;
76 if (mia->flags & ENT_TELEPORTING)
82 x = (int)(mia->x - engine.playerPosX);
83 y = (int)(mia->y - engine.playerPosY);
85 if ((abs(x) <= 2048) && (abs(y) <= 768))
91 if ((Math::prand() % 250) == 0)
96 if ((Math::prand() % 250) == 0)
97 mia->value = Math::rrand(0, 6);
100 if ((mia->value != 100) && (!(mia->flags & ENT_DYING)))
102 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
103 graphics.drawString(_((char*)mia_scared[mia->value]), x + 10, y - 10, true, graphics.screen);
106 graphics.blit(mia->getFaceImage(), x, y, graphics.screen, false);
111 if ((Collision::collision(&player, mia)) && (player.health > 0) && (!(player.flags & ENT_TELEPORTING)))
113 if (!(mia->flags & ENT_DYING))
115 Math::addBit(&mia->flags, ENT_WEIGHTLESS);
116 Math::addBit(&mia->flags, ENT_DYING);
117 audio.playSound(SND_TELEPORT1, CH_ANY);
121 if ((mia->id == MIA_NORMAL) && (mia->environment == ENV_WATER))
124 mia->setSprites(graphics.getSprite("AquaMIA", true), graphics.getSprite("AquaMIA", true), graphics.getSprite("AquaMIA", true));
125 debug(("MIA '%s' fell into water. Became Aqua Mia\n", mia->name));
128 if (mia->flags & ENT_DYING)
130 for (int i = 0 ; i < 2 ; i++)
131 map.addParticle(mia->x + Math::rrand(-2, 15), mia->y + Math::prand() % mia->height, 0, Math::rrand(-5, -1), Math::rrand(30, 60), graphics.red, graphics.getSprite("TeleportStar", true), PAR_WEIGHTLESS);
133 if (mia->health <= 100)
136 if (mia->health <= 0)
139 game.totalMIAsRescued++;
141 if ((map.foundMIAs == (map.requiredMIAs / 2)) || (game.skill == 0))
143 sprintf(message, _("Rescued %s - Checkpoint Reached!"), mia->name);
144 game.setObjectiveCheckPoint();
148 sprintf(message, _("Rescued %s!"), mia->name);
151 if (map.foundMIAs == map.requiredMIAs)
153 sprintf(message, _("Rescue %d MIAs - Objective Complete - Checkpoint Reached!"), map.requiredMIAs);
154 game.setObjectiveCheckPoint();
158 if (game.totalMIAsRescued == 50)
160 presentPlayerMedal("50_MIA");
162 else if (game.totalMIAsRescued == 100)
164 presentPlayerMedal("100_MIA");
166 else if (game.totalMIAsRescued == 200)
168 presentPlayerMedal("200_MIA");
170 else if (game.totalMIAsRescued == 227)
172 presentPlayerMedal("ALL_MIA");
175 engine.setInfoMessage(message, 1, INFO_OBJECTIVE);