2 Copyright (C) 2004-2011 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.
23 // This is for easy mode
24 void skipBossMission()
26 if (game.stagesCleared == 5)
28 gameData.addCompletedObjective("BioMech Supply Depot", "Easy Mode Skip", 1, 1);
29 game.stagesCleared = 6;
32 if (game.stagesCleared == 10)
34 gameData.addCompletedObjective("BioMech Communications", "Easy Mode Skip", 1, 1);
35 game.hasAquaLung = true;
36 game.stagesCleared = 11;
37 SDL_FillRect(graphics.screen, NULL, graphics.black);
39 graphics.drawString(_("You got the Aqua Lung!"), 320, 420, TXT_CENTERED, graphics.screen);
41 SDL_FillRect(graphics.screen, NULL, graphics.black);
44 if (game.stagesCleared == 15)
46 gameData.addCompletedObjective("BioMech Assimilator", "Easy Mode Skip", 1, 1);
47 game.hasJetPack = true;
48 game.stagesCleared = 16;
49 SDL_FillRect(graphics.screen, NULL, graphics.black);
51 graphics.drawString(_("You got the Jet Pack!"), 320, 420, TXT_CENTERED, graphics.screen);
53 SDL_FillRect(graphics.screen, NULL, graphics.black);
56 if (game.stagesCleared == 21)
58 gameData.addCompletedObjective("BioMech HQ", "Easy Mode Skip", 1, 1);
59 game.stagesCleared = 22;
63 void processPostMissionData()
67 if (!gameData.stagePreviouslyCleared(game.stageName))
69 presentPlayerMedal(game.stageName);
78 gameData.setMIARescueCount(map.name, map.foundMIAs, map.totalMIAs);
80 Objective *objective = (Objective*)map.objectiveList.getHead();
81 Entity *mia = (Entity*)map.miaList.getHead();
83 while (objective->next != NULL)
85 objective = (Objective*)objective->next;
87 gameData.addCompletedObjective(map.name, objective->description, objective->currentValue, objective->targetValue);
92 while (mia->next != NULL)
94 mia = (Entity*)mia->next;
101 snprintf(string, sizeof string, "MIA_%s", mia->name);
105 gameData.addCompletedObjective(map.name, string, 1, 1);
109 gameData.addCompletedObjective(map.name, string, 0, 1);
115 if (game.totalEnemiesDefeated >= 1000)
117 presentPlayerMedal("1000_Enemies");
120 if (game.totalEnemiesDefeated >= 2500)
122 presentPlayerMedal("2500_Enemies");
126 void clearAllMissionData()
128 char levelMIAKey[100];
130 snprintf(levelMIAKey, sizeof levelMIAKey, "%s MIAs", game.stageName);
132 Data *data = (Data*)gameData.dataList.getHead();
133 Data *previous = data;
135 while (data->next != NULL)
137 data = (Data*)data->next;
139 if ((strcmp(data->key, game.stageName) == 0) || (strstr(data->key, levelMIAKey)))
141 gameData.dataList.remove(previous, data);
150 map.destroyPersistant(map.name);
153 void showMissionClear()
156 bool perfect = perfectlyCompleted();
160 (perfect) ? clear = graphics.loadImage("gfx/main/areaPerfect.png") : clear = graphics.loadImage("gfx/main/areaClear.png");
162 graphics.loadBackground("gfx/main/areaClearBackGround.jpg");
164 SDL_Surface *panel = graphics.alphaRect(550, 420, 0x00, 0x00, 0x00);
165 SDL_SetAlpha(panel, SDL_SRCALPHA|SDL_RLEACCEL, 180);
166 graphics.drawRect(1, 1, panel->w - 2, panel->h - 2 , graphics.black, graphics.white, panel);
168 graphics.blit(panel, (640 - panel->w) / 2, (480 - panel->h) / 2, graphics.background, false);
170 audio.loadSound(0, "sound/pop1");
171 audio.loadSound(1, "sound/cheer");
173 SDL_FillRect(graphics.screen, NULL, graphics.black);
174 graphics.updateScreen();
179 Objective *objective = (Objective*)map.objectiveList.getHead();
180 Entity *mia = (Entity*)map.miaList.getHead();
181 Sprite *teleportStar = graphics.getSprite("TeleportStar", true);
187 int nextStarBurst = 10 * (Math::prand() % 6);
189 float px, py, dx, dy;
192 while (mia->next != NULL)
194 mia = (Entity*)mia->next;
205 if (count > colCount)
214 if (count > colCount)
217 if (place > (colCount * 25))
218 place = colCount * 25;
220 place = (640 - place) / 2;
222 graphics.setFontSize(1);
224 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
231 if (map.totalMIAs > 0)
233 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
234 snprintf(message, sizeof message, _("Rescue %d MIAs"), map.requiredMIAs);
235 graphics.drawString(message, col1, y, TXT_RIGHT, graphics.background);
237 if (map.foundMIAs < map.requiredMIAs)
239 graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
240 snprintf(message, sizeof message, "%d / %d", map.foundMIAs, map.requiredMIAs);
241 graphics.drawString(message, col2, y, TXT_LEFT, graphics.background);
245 graphics.setFontColor(0x00, 0xff, 0x00, 0x00, 0x00, 0x00);
246 graphics.drawString(_("Completed"), col2, y, TXT_LEFT, graphics.background);
250 objective = (Objective*)map.objectiveList.getHead();
252 engine.setPlayerPosition(0, 0, -1, -1, -1, -1);
254 while (objective->next != NULL)
256 objective = (Objective*)objective->next;
260 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
262 if ((game.skill < 3) && (strstr(objective->description, "L.R.T.S.")) && (!gameData.completedWorld))
264 graphics.drawString(_("???? ???????? ????"), col1, y, TXT_RIGHT, graphics.background);
268 graphics.drawString(_(objective->description), col1, y, TXT_RIGHT, graphics.background);
271 if (objective->currentValue < objective->targetValue)
273 if (objective->targetValue == 1)
275 graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
276 graphics.drawString(_("Incomplete"), col2, y, TXT_LEFT, graphics.background);
280 graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
281 snprintf(message, sizeof message, "%d / %d", objective->currentValue, objective->targetValue);
282 graphics.drawString(message, col2, y, TXT_LEFT, graphics.background);
287 graphics.setFontColor(0x00, 0xff, 0x00, 0x00, 0x00, 0x00);
288 graphics.drawString(_("Completed"), col2, y, TXT_LEFT, graphics.background);
292 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
294 unsigned int frameLimit = SDL_GetTicks() + 16;
297 audio.playSound(1, 1);
303 graphics.updateScreen();
304 graphics.animateSprites();
306 if (engine.userAccepts())
309 graphics.drawBackground();
311 graphics.blit(clear, 320, clearY, graphics.screen, true);
313 Math::limitInt(&(clearY -= 5), 70, 520);
317 mia = (Entity*)map.miaList.getHead();
321 while (mia->next != NULL)
323 mia = (Entity*)mia->next;
328 if (count > colCount)
331 graphics.blit(mia->getFaceImage(), (int)mia->x, (int)mia->y, graphics.screen, false);
334 audio.playSound(0, 0);
336 if (mia->x > (place + (count * 25)))
337 Math::limitFloat(&(mia->x -= 35), place + (count * 25), 640);
339 if (mia->x > place + (count * 25))
347 Math::limitInt(&(--nextStarBurst), 0, 999);
349 if (nextStarBurst == 0)
351 nextStarBurst = 10 * (Math::prand() % 6);
353 px = Math::rrand(50, 585);
354 py = Math::rrand(55, 85);
356 for (int i = 0 ; i < 50 ; i++)
358 dx = Math::rrand(-30, 30); dx /= 20;
359 dy = Math::rrand(-30, 30); dy /= 20;
360 map.addParticle(px, py, dx, dy, Math::rrand(30, 60), graphics.red, teleportStar, PAR_WEIGHTLESS);
368 static Graphics::SurfaceCache cache;
369 snprintf(message, sizeof message, "%s - %.2d:%.2d:%.2d", _("Mission Time"), game.currentMissionHours, game.currentMissionMinutes, game.currentMissionSeconds);
370 graphics.drawString(message, 320, 420, true, graphics.screen, cache);
372 engine.delay(frameLimit);
373 frameLimit = SDL_GetTicks() + 16;
378 processPostMissionData();
380 if (!engine.practice)