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.
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))
77 gameData.setMIARescueCount(map.name, map.foundMIAs, map.totalMIAs);
79 Objective *objective = (Objective*)map.objectiveList.getHead();
80 Entity *mia = (Entity*)map.miaList.getHead();
82 while (objective->next != NULL)
84 objective = (Objective*)objective->next;
86 gameData.addCompletedObjective(map.name, objective->description, objective->currentValue, objective->targetValue);
91 while (mia->next != NULL)
93 mia = (Entity*)mia->next;
100 sprintf(string, "MIA_%s", mia->name);
104 gameData.addCompletedObjective(map.name, string, 1, 1);
108 gameData.addCompletedObjective(map.name, string, 0, 1);
115 void clearAllMissionData()
117 char levelMIAKey[100];
119 sprintf(levelMIAKey, "%s MIAs", game.stageName);
121 Data *data = (Data*)gameData.dataList.getHead();
122 Data *previous = data;
124 while (data->next != NULL)
126 data = (Data*)data->next;
128 if ((strcmp(data->key, game.stageName) == 0) || (strstr(data->key, levelMIAKey)))
130 gameData.dataList.remove(previous, data);
139 map.destroyPersistant(map.name);
142 void showMissionClear()
145 bool perfect = perfectlyCompleted();
149 (perfect) ? clear = graphics.loadImage("gfx/main/areaPerfect.png") : clear = graphics.loadImage("gfx/main/areaClear.png");
151 graphics.loadBackground("gfx/main/areaClearBackGround.jpg");
153 SDL_Surface *panel = graphics.alphaRect(550, 420, 0x00, 0x00, 0x00);
154 SDL_SetAlpha(panel, SDL_SRCALPHA|SDL_RLEACCEL, 180);
155 graphics.drawRect(1, 1, panel->w - 2, panel->h - 2 , graphics.black, graphics.white, panel);
157 graphics.blit(panel, (640 - panel->w) / 2, (480 - panel->h) / 2, graphics.background, false);
159 audio.loadSound(0, "sound/pop1.wav");
160 audio.loadSound(1, "sound/cheer.wav");
162 SDL_FillRect(graphics.screen, NULL, graphics.black);
163 graphics.updateScreen();
168 Objective *objective = (Objective*)map.objectiveList.getHead();
169 Entity *mia = (Entity*)map.miaList.getHead();
170 Sprite *teleportStar = graphics.getSprite("TeleportStar", true);
176 int nextStarBurst = 10 * (Math::prand() % 6);
178 float px, py, dx, dy;
181 while (mia->next != NULL)
183 mia = (Entity*)mia->next;
194 if (count > colCount)
203 if (count > colCount)
206 if (place > (colCount * 25))
207 place = colCount * 25;
209 place = (640 - place) / 2;
211 graphics.setFontSize(1);
213 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
220 if (map.totalMIAs > 0)
222 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
223 sprintf(message, _("Rescue %d MIAs"), map.requiredMIAs);
224 graphics.drawString(message, col1, y, TXT_RIGHT, graphics.background);
226 if (map.foundMIAs < map.requiredMIAs)
228 graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
229 sprintf(message, "%d / %d", map.foundMIAs, map.requiredMIAs);
230 graphics.drawString(message, col2, y, TXT_LEFT, graphics.background);
234 graphics.setFontColor(0x00, 0xff, 0x00, 0x00, 0x00, 0x00);
235 graphics.drawString(_("Completed"), col2, y, TXT_LEFT, graphics.background);
239 objective = (Objective*)map.objectiveList.getHead();
241 engine.setPlayerPosition(0, 0, -1, -1, -1, -1);
243 while (objective->next != NULL)
245 objective = (Objective*)objective->next;
249 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
251 if ((game.skill < 3) && (strstr(objective->description, "L.R.T.S.")) && (!gameData.completedWorld))
253 graphics.drawString(_("???? ???????? ????"), col1, y, TXT_RIGHT, graphics.background);
257 graphics.drawString(_(objective->description), col1, y, TXT_RIGHT, graphics.background);
260 if (objective->currentValue < objective->targetValue)
262 if (objective->targetValue == 1)
264 graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
265 graphics.drawString(_("Incomplete"), col2, y, TXT_LEFT, graphics.background);
269 graphics.setFontColor(0xff, 0x00, 0x00, 0x00, 0x00, 0x00);
270 sprintf(message, "%d / %d", objective->currentValue, objective->targetValue);
271 graphics.drawString(message, col2, y, TXT_LEFT, graphics.background);
276 graphics.setFontColor(0x00, 0xff, 0x00, 0x00, 0x00, 0x00);
277 graphics.drawString(_("Completed"), col2, y, TXT_LEFT, graphics.background);
281 graphics.setFontColor(0xff, 0xff, 0xff, 0x00, 0x00, 0x00);
283 unsigned int frameLimit = SDL_GetTicks() + 16;
286 audio.playSound(1, 1);
292 graphics.updateScreen();
293 graphics.animateSprites();
295 if (engine.userAccepts())
298 graphics.drawBackground();
300 graphics.blit(clear, 320, clearY, graphics.screen, true);
302 Math::limitInt(&(clearY -= 5), 70, 520);
306 mia = (Entity*)map.miaList.getHead();
310 while (mia->next != NULL)
312 mia = (Entity*)mia->next;
317 if (count > colCount)
320 graphics.blit(mia->getFaceImage(), (int)mia->x, (int)mia->y, graphics.screen, false);
323 audio.playSound(0, 0);
325 if (mia->x > (place + (count * 25)))
326 Math::limitFloat(&(mia->x -= 35), place + (count * 25), 640);
328 if (mia->x > place + (count * 25))
336 Math::limitInt(&(--nextStarBurst), 0, 999);
338 if (nextStarBurst == 0)
340 nextStarBurst = 10 * (Math::prand() % 6);
342 px = Math::rrand(50, 585);
343 py = Math::rrand(55, 85);
345 for (int i = 0 ; i < 50 ; i++)
347 dx = Math::rrand(-30, 30); dx /= 20;
348 dy = Math::rrand(-30, 30); dy /= 20;
349 map.addParticle(px, py, dx, dy, Math::rrand(30, 60), graphics.red, teleportStar, PAR_WEIGHTLESS);
357 sprintf(message, "%s - %.2d:%.2d:%.2d", _("Mission Time"), game.currentMissionHours, game.currentMissionMinutes, game.currentMissionSeconds);
358 graphics.drawString(message, 320, 420, true, graphics.screen);
360 engine.delay(frameLimit);
361 frameLimit = SDL_GetTicks() + 16;
366 processPostMissionData();
368 if (!engine.practice)