1 /*
2 Copyright (C) 2003 Parallel Realities
3 Copyright (C) 2011, 2012, 2013 Guus Sliepen
4 Copyright (C) 2012, 2015-2020 The Diligent Circle <diligentcircle@riseup.net>
5
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 3
9 of the License, or (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include <libintl.h>
21 #include <math.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24
25 #include "SDL.h"
26
27 #include "colors.h"
28 #include "defs.h"
29 #include "structs.h"
30
31 #include "audio.h"
32 #include "engine.h"
33 #include "game.h"
34 #include "gfx.h"
35 #include "intermission.h"
36 #include "player.h"
37 #include "renderer.h"
38 #include "save.h"
39 #include "screen.h"
40 #include "shop.h"
41 #include "weapons.h"
42 #include "window.h"
43
44 Planet intermission_planets[MAX_PLANETS];
45
intermission_initPlanets(int system)46 void intermission_initPlanets(int system)
47 {
48 for (int i = 0 ; i < MAX_PLANETS ; i++)
49 {
50 intermission_planets[i].missionNumber = -1; // no mission for this planet
51 intermission_planets[i].missionCompleted = 1;
52 }
53
54 switch(system)
55 {
56 // Spirit
57 case SYSTEM_SPIRIT:
58 intermission_planets[PLANET_HAIL].missionNumber = MISN_HAIL;
59 intermission_planets[PLANET_HAIL].missionCompleted = 0;
60
61 intermission_planets[PLANET_CERADSE].missionNumber = MISN_CERADSE;
62 intermission_planets[PLANET_CERADSE].missionCompleted = 0;
63
64 intermission_planets[PLANET_HINSTAG].missionNumber = MISN_HINSTAG;
65 intermission_planets[PLANET_HINSTAG].missionCompleted = 0;
66
67 intermission_planets[PLANET_JOLDAR].missionNumber = MISN_JOLDAR;
68 intermission_planets[PLANET_JOLDAR].missionCompleted = 0;
69
70 intermission_planets[PLANET_MOEBO].missionNumber = MISN_MOEBO;
71 intermission_planets[PLANET_MOEBO].missionCompleted = -1;
72
73 break;
74
75 // Eyananth
76 case SYSTEM_EYANANTH:
77 intermission_planets[PLANET_NEROD].missionNumber = MISN_NEROD;
78 intermission_planets[PLANET_NEROD].missionCompleted = 0;
79
80 intermission_planets[PLANET_ALLEZ].missionNumber = MISN_ALLEZ;
81 intermission_planets[PLANET_ALLEZ].missionCompleted = 0;
82
83 intermission_planets[PLANET_URUSOR].missionNumber = MISN_URUSOR;
84 intermission_planets[PLANET_URUSOR].missionCompleted = -1;
85
86 intermission_planets[PLANET_DORIM].missionNumber = MISN_DORIM;
87 intermission_planets[PLANET_DORIM].missionCompleted = -1;
88
89 intermission_planets[PLANET_ELAMALE].missionNumber = MISN_ELAMALE;
90 intermission_planets[PLANET_ELAMALE].missionCompleted = -2;
91
92 // This one is for the slaves
93 intermission_planets[PLANET_RESCUESLAVES].missionNumber = MISN_RESCUESLAVES;
94 intermission_planets[PLANET_RESCUESLAVES].missionCompleted = 0;
95
96 break;
97
98 // Mordor
99 case SYSTEM_MORDOR:
100 intermission_planets[PLANET_ODEON].missionNumber = MISN_ODEON;
101 intermission_planets[PLANET_ODEON].missionCompleted = 0;
102
103 intermission_planets[PLANET_FELLON].missionNumber = MISN_FELLON;
104 intermission_planets[PLANET_FELLON].missionCompleted = 0;
105
106 intermission_planets[PLANET_SIVEDI].missionNumber = MISN_SIVEDI;
107 intermission_planets[PLANET_SIVEDI].missionCompleted = -1;
108
109 intermission_planets[PLANET_ALMARTHA].missionNumber = MISN_ALMARTHA;
110 intermission_planets[PLANET_ALMARTHA].missionCompleted = -1;
111
112 intermission_planets[PLANET_POSWIC].missionNumber = MISN_POSWIC;
113 intermission_planets[PLANET_POSWIC].missionCompleted = -2;
114
115 intermission_planets[PLANET_ELLESH].missionNumber = MISN_ELLESH;
116 intermission_planets[PLANET_ELLESH].missionCompleted = -3;
117
118 // This one is for the experimental fighter
119 intermission_planets[PLANET_CLOAKFIGHTER].missionNumber = MISN_CLOAKFIGHTER;
120 intermission_planets[PLANET_CLOAKFIGHTER].missionCompleted = 0;
121
122 break;
123
124 // Sol
125 case SYSTEM_SOL:
126 intermission_planets[PLANET_PLUTO].missionNumber = MISN_PLUTO;
127 intermission_planets[PLANET_PLUTO].missionCompleted = 0;
128
129 intermission_planets[PLANET_NEPTUNE].missionNumber = MISN_NEPTUNE;
130 intermission_planets[PLANET_NEPTUNE].missionCompleted = 0;
131
132 intermission_planets[PLANET_URANUS].missionNumber = MISN_URANUS;
133 intermission_planets[PLANET_URANUS].missionCompleted = 0;
134
135 intermission_planets[PLANET_SATURN].missionNumber = MISN_SATURN;
136 intermission_planets[PLANET_SATURN].missionCompleted = -1;
137
138 intermission_planets[PLANET_JUPITER].missionNumber = MISN_JUPITER;
139 intermission_planets[PLANET_JUPITER].missionCompleted = -2;
140
141 intermission_planets[PLANET_MARS].missionNumber = MISN_MARS;
142 intermission_planets[PLANET_MARS].missionCompleted = -3;
143
144 intermission_planets[PLANET_EARTH].missionNumber = MISN_EARTH;
145 intermission_planets[PLANET_EARTH].missionCompleted = -4;
146
147 intermission_planets[PLANET_VENUS].missionNumber = MISN_VENUS;
148 intermission_planets[PLANET_VENUS].missionCompleted = -5;
149
150 break;
151 }
152 }
153
intermission_unlockPlanets()154 void intermission_unlockPlanets()
155 {
156 for (int i = 0 ; i < MAX_PLANETS ; i++)
157 {
158 if ((intermission_planets[i].missionCompleted == 0) && (intermission_planets[i].missionNumber != -1))
159 return;
160 }
161
162 for (int i = 0 ; i < MAX_PLANETS ; i++)
163 {
164 if (intermission_planets[i].missionCompleted < 0)
165 intermission_planets[i].missionCompleted++;
166 }
167 }
168
intermission_updateSystemStatus()169 void intermission_updateSystemStatus()
170 {
171 if (game.area == MISN_START)
172 {
173 game.stationedPlanet = 0;
174 game.area = 1;
175 intermission_initPlanets(game.system);
176 }
177 else if (game.area == MISN_MOEBO)
178 {
179 game.stationedPlanet = 0;
180 game.system = 1;
181 game.area = MISN_RESCUESLAVES;
182 intermission_initPlanets(game.system);
183
184 if (game.difficulty == DIFFICULTY_ORIGINAL)
185 player.maxShield = 50;
186 }
187 else if (game.area == MISN_ELAMALE)
188 {
189 game.stationedPlanet = 0;
190 game.system = 2;
191 game.area = MISN_CLOAKFIGHTER;
192 intermission_initPlanets(game.system);
193
194 if (game.difficulty == DIFFICULTY_ORIGINAL)
195 player.maxShield = 75;
196 }
197 else if (game.area == MISN_ELLESH)
198 {
199 game.stationedPlanet = 8;
200 game.system = 3;
201 game.area = MISN_PLUTO;
202 intermission_initPlanets(game.system);
203
204 if (game.difficulty == DIFFICULTY_ORIGINAL)
205 player.maxShield = 100;
206 }
207 else // Update the mission for the planet
208 {
209 intermission_planets[game.stationedPlanet].missionCompleted = 1;
210 }
211
212 strcpy(game.destinationName, _("No Destination"));
213 game.destinationPlanet = game.stationedPlanet;
214 }
215
216 /*
217 Drives the cursor. Is used by some other screens too
218 */
intermission_doCursor()219 static void intermission_doCursor()
220 {
221 player_getInput();
222
223 LIMIT(engine.cursor_x, 10, screen->w - 10 - gfx_sprites[SP_CURSOR]->w);
224 LIMIT(engine.cursor_y, 10, screen->h - 10 - gfx_sprites[SP_CURSOR]->h);
225 screen_blit(gfx_sprites[SP_CURSOR], engine.cursor_x, engine.cursor_y);
226 }
227
228 /*
229 Sets the player's current status information lines. These are the lines
230 that are scrolled up the screen when the player clicks on Current Status
231 These are set only once.
232 */
intermission_setStatusLines()233 static void intermission_setStatusLines()
234 {
235 char string[STRMAX_SHORT];
236 char difficulty[STRMAX_SHORT];
237 long timeTaken = game.timeTaken;
238
239 game_getDifficultyText(difficulty, game.difficulty);
240
241 /// Status Screen text
242 /// Retain "%s" as-is. It is replaced with the current difficulty.
243 snprintf(string, STRMAX_SHORT, _("Difficulty : %s"), difficulty);
244 gfx_createTextObject(TS_STATUS_DIFFICULTY, string, 0, 0, FONT_WHITE);
245
246 /// Status Screen text
247 /// Retain "%d" as-is. It is replaced with the number of shots fired.
248 snprintf(string, STRMAX_SHORT, _("Shots Fired : %d"), game.shots);
249 gfx_createTextObject(TS_SHOTS_FIRED, string, 0, 0, FONT_WHITE);
250
251 /// Status Screen text
252 /// Retain "%d" as-is. It is replaced with the number of hits scored.
253 snprintf(string, STRMAX_SHORT, _("Hits Scored : %d"), game.hits);
254 gfx_createTextObject(TS_HITS_SCORED, string, 0, 0, FONT_WHITE);
255
256 /// Status Screen text
257 /// Retain "%d" as-is. It is replaced with the firing accuracy as a percentage.
258 /// Note: To use the "%" symbol, you must enter "%%", as you can see in
259 /// the English version.
260 snprintf(string, STRMAX_SHORT, _("Accuracy : %d%%"), game.accuracy);
261 gfx_createTextObject(TS_ACCURACY, string, 0, 0, FONT_WHITE);
262
263 /// Status Screen text
264 /// Retain "%d" as-is. It is replaced with the number of kills.
265 snprintf(string, STRMAX_SHORT, _("Enemies Killed by Others : %d"), game.totalOtherKills);
266 gfx_createTextObject(TS_OTHER_KILLS, string, 0, 0, FONT_WHITE);
267
268 /// Retain "%d" as-is. It is replaced with the amount of cash earned.
269 snprintf(string, STRMAX_SHORT, _("Total Cash Earned : %d"), game.cashEarned);
270 gfx_createTextObject(TS_CASH_EARNED, string, 0, 0, FONT_WHITE);
271
272 gfx_createTextObject(TS_CHRIS_HEADER, _("*** Chris ***"), 0, 0, FONT_WHITE);
273
274 /// Status Screen text
275 /// Retain "%d" as-is. It is replaced with the number of kills.
276 snprintf(string, STRMAX_SHORT, _("Enemies Killed : %d"), game.totalKills);
277 gfx_createTextObject(TS_CHRIS_KILLS, string, 0, 0, FONT_WHITE);
278
279 /// Status Screen text
280 /// Retain "%d" as-is. It is replaced with the number of shield restores picked up.
281 snprintf(string, STRMAX_SHORT, _("Shield Restores Picked Up : %d"), game.shieldPickups);
282 gfx_createTextObject(TS_CHRIS_SHIELD_PICKUPS, string, 0, 0, FONT_WHITE);
283
284 /// Status Screen text
285 /// Retain "%d" as-is. It is replaced with the number of plasma cells picked up.
286 snprintf(string, STRMAX_SHORT, _("Plasma Cells Picked Up : %d"), game.cellPickups);
287 gfx_createTextObject(TS_CHRIS_PLASMA_PICKUPS, string, 0, 0, FONT_WHITE);
288
289 /// Status Screen text
290 /// Retain "%d" as-is. It is replaced with the number of rockets picked up.
291 snprintf(string, STRMAX_SHORT, _("Rockets Picked Up : %d"), game.rocketPickups);
292 gfx_createTextObject(TS_CHRIS_ROCKET_PICKUPS, string, 0, 0, FONT_WHITE);
293
294 /// Status Screen text
295 /// Retain "%d" as-is. It is replaced with the number of powerups picked up.
296 snprintf(string, STRMAX_SHORT, _("Powerups Picked Up : %d"), game.powerups);
297 gfx_createTextObject(TS_CHRIS_POWERUP_PICKUPS, string, 0, 0, FONT_WHITE);
298
299 /// Status Screen text
300 /// Retain "%d" as-is. It is replaced with the number of mines destroyed.
301 snprintf(string, STRMAX_SHORT, _("Mines Destroyed : %d"), game.minesKilled);
302 gfx_createTextObject(TS_CHRIS_MINES_KILLED, string, 0, 0, FONT_WHITE);
303
304 /// Status Screen text
305 /// Retain "%d" as-is. It is replaced with the number of slaves rescued.
306 snprintf(string, STRMAX_SHORT, _("Slaves Rescued : %d"), game.slavesRescued);
307 gfx_createTextObject(TS_CHRIS_SLAVES_RESCUED, string, 0, 0, FONT_WHITE);
308
309 if (game.hasWingMate1)
310 {
311 gfx_createTextObject(TS_PHOEBE_HEADER, _("*** Phoebe ***"), 0, 0, FONT_WHITE);
312
313 /// Status Screen text
314 /// Retain "%d" as-is. It is replaced with the number of kills.
315 snprintf(string, STRMAX_SHORT, _("Enemies Killed : %d"), game.wingMate1Kills);
316 gfx_createTextObject(TS_PHOEBE_KILLS, string, 0, 0, FONT_WHITE);
317
318 /// Retain
319 /// Status Screen text "%d" as-is. It is replaced with the number of ejections.
320 snprintf(string, STRMAX_SHORT, _("Ejections : %d"), game.wingMate1Ejects);
321 gfx_createTextObject(TS_PHOEBE_DEATHS, string, 0, 0, FONT_WHITE);
322 }
323 else
324 {
325 gfx_createTextObject(TS_PHOEBE_HEADER, "", 0, 0, FONT_WHITE);
326 gfx_createTextObject(TS_PHOEBE_KILLS, "", 0, 0, FONT_WHITE);
327 gfx_createTextObject(TS_PHOEBE_DEATHS, "", 0, 0, FONT_WHITE);
328 }
329
330 if (game.hasWingMate2)
331 {
332 /// Status Screen text
333 gfx_createTextObject(TS_URSULA_HEADER, _("*** Ursula ***"), 0, 0, FONT_WHITE);
334
335 /// Status Screen text
336 /// Retain "%d" as-is. It is replaced with the number of kills.
337 snprintf(string, STRMAX_SHORT, _("Enemies Killed : %d"), game.wingMate2Kills);
338 gfx_createTextObject(TS_URSULA_KILLS, string, 0, 0, FONT_WHITE);
339
340 /// Status Screen text
341 /// Retain "%d" as-is. It is replaced with the number of ejections.
342 snprintf(string, STRMAX_SHORT, _("Ejections : %d"), game.wingMate2Ejects);
343 gfx_createTextObject(TS_URSULA_DEATHS, string, 0, 0, FONT_WHITE);
344 }
345 else
346 {
347 gfx_createTextObject(TS_URSULA_HEADER, "", 0, 0, FONT_WHITE);
348 gfx_createTextObject(TS_URSULA_KILLS, "", 0, 0, FONT_WHITE);
349 gfx_createTextObject(TS_URSULA_DEATHS, "", 0, 0, FONT_WHITE);
350 }
351
352 gfx_createTextObject(TS_STATUS_HEADER, _("Current Status"), 0, 0, FONT_WHITE);
353
354 /// Status Screen footer (indicates the total time the game has been played)
355 /// "%ld" (which represents hours) and "%02ld" sequences (which
356 /// represent minutes and seconds, respectively) must remain and
357 /// stay in the same order relative to each other. The ":"s
358 /// between them can be changed to other characters if desired,
359 /// e.g. this would be acceptable:
360 ///
361 /// "Total Time : %ld hours, %02ld minutes, %02ld seconds"
362 ///
363 /// If you are familiar with printf formatting, you may also change
364 /// the formatting of any of these as long as the "ld" type remains.
365 /// For example, the "%02ld" sequences may be changed to "%ld" if
366 /// you wish to not force two digits to be filled in (e.g. to render
367 /// the number 3 as "3" instead of "03").
368 snprintf(string, STRMAX_SHORT, _("Total Time : %ld:%02ld:%02ld"), timeTaken / 3600, (timeTaken / 60) % 60, timeTaken % 60);
369 gfx_createTextObject(TS_STATUS_FOOTER, string, 0, 0, FONT_WHITE);
370 }
371
372 /*
373 Sets the names and stats of the planets within the current system.
374 */
intermission_setPlanets()375 static void intermission_setPlanets()
376 {
377 for (int i = 0 ; i < MAX_PLANETS ; i++)
378 {
379 intermission_planets[i].dist = -1;
380 strcpy(intermission_planets[i].name, "");
381 intermission_planets[i].image = NULL;
382 intermission_planets[i].messageMission = -1;
383 intermission_planets[i].messageSlot = -1;
384 intermission_planets[i].faceImage = -1;
385 strcpy(intermission_planets[i].subject, "ERROR");
386 }
387
388 switch (game.system)
389 {
390 case SYSTEM_SPIRIT:
391 intermission_planets[PLANET_HAIL].dist = 3;
392 strcpy(intermission_planets[PLANET_HAIL].name, _("Hail"));
393 intermission_planets[PLANET_HAIL].image = gfx_sprites[SP_PLANET_GREEN];
394
395 intermission_planets[PLANET_CERADSE].dist = 6;
396 strcpy(intermission_planets[PLANET_CERADSE].name, _("Ceradse"));
397 intermission_planets[PLANET_CERADSE].image = gfx_sprites[SP_PLANET_BLUE];
398
399 intermission_planets[PLANET_HINSTAG].dist = 6;
400 strcpy(intermission_planets[PLANET_HINSTAG].name, _("Hinstag"));
401 intermission_planets[PLANET_HINSTAG].image = gfx_sprites[SP_PLANET_RED];
402
403 intermission_planets[PLANET_JOLDAR].dist = 4;
404 strcpy(intermission_planets[PLANET_JOLDAR].name, _("Joldar"));
405 intermission_planets[PLANET_JOLDAR].image = gfx_sprites[SP_PLANET_GREEN];
406
407 intermission_planets[PLANET_MOEBO].dist = 8;
408 strcpy(intermission_planets[PLANET_MOEBO].name, _("Moebo"));
409 intermission_planets[PLANET_MOEBO].image = gfx_sprites[SP_PLANET_ORANGE];
410
411 intermission_planets[PLANET_HAIL].messageMission = MISN_HAIL;
412 intermission_planets[PLANET_HAIL].messageSlot = 0;
413 intermission_planets[PLANET_HAIL].faceImage = FS_KRASS;
414 /// Spirit, Hail mission summary
415 strcpy(intermission_planets[PLANET_HAIL].subject, _("Destroy WEAPCO training ground"));
416
417 intermission_planets[PLANET_CERADSE].messageMission = MISN_CERADSE;
418 intermission_planets[PLANET_CERADSE].messageSlot = 1;
419 intermission_planets[PLANET_CERADSE].faceImage = FS_SID;
420 /// Spirit, Ceradse mission summary
421 strcpy(intermission_planets[PLANET_CERADSE].subject, _("Collect 6 cargo pods"));
422
423 intermission_planets[PLANET_HINSTAG].messageMission = MISN_HINSTAG;
424 intermission_planets[PLANET_HINSTAG].messageSlot = 2;
425 intermission_planets[PLANET_HINSTAG].faceImage = FS_SID;
426 /// Spirit, Hinstag mission summary
427 strcpy(intermission_planets[PLANET_HINSTAG].subject, _("Destroy 5 WEAPCO missile boats"));
428
429 intermission_planets[PLANET_JOLDAR].messageMission = MISN_JOLDAR;
430 intermission_planets[PLANET_JOLDAR].messageSlot = 3;
431 intermission_planets[PLANET_JOLDAR].faceImage = FS_SID;
432 /// Spirit, Joldar mission summary
433 strcpy(intermission_planets[PLANET_JOLDAR].subject, _("Clear the mine field around Joldar"));
434
435 intermission_planets[PLANET_MOEBO].messageMission = MISN_MOEBO;
436 intermission_planets[PLANET_MOEBO].messageSlot = 0;
437 intermission_planets[PLANET_MOEBO].faceImage = FS_SID;
438 /// Spirit, Moebo mission summary
439 strcpy(intermission_planets[PLANET_MOEBO].subject, _("Destroy WEAPCO frigate"));
440
441 break;
442
443 case SYSTEM_EYANANTH:
444 strcpy(intermission_planets[PLANET_RESCUESLAVES].name, _("WEAPCO interceptions"));
445
446 intermission_planets[PLANET_NEROD].dist = 3;
447 strcpy(intermission_planets[PLANET_NEROD].name, _("Nerod"));
448 intermission_planets[PLANET_NEROD].image = gfx_sprites[SP_PLANET_GREEN];
449
450 intermission_planets[PLANET_ALLEZ].dist = 6;
451 strcpy(intermission_planets[PLANET_ALLEZ].name, _("Allez"));
452 intermission_planets[PLANET_ALLEZ].image = gfx_sprites[SP_PLANET_BLUE];
453
454 intermission_planets[PLANET_URUSOR].dist = 6;
455 strcpy(intermission_planets[PLANET_URUSOR].name, _("Urusor"));
456 intermission_planets[PLANET_URUSOR].image = gfx_sprites[SP_PLANET_RED];
457
458 intermission_planets[PLANET_DORIM].dist = 4;
459 strcpy(intermission_planets[PLANET_DORIM].name, _("Dorim"));
460 intermission_planets[PLANET_DORIM].image = gfx_sprites[SP_PLANET_GREEN];
461
462 intermission_planets[PLANET_ELAMALE].dist = 8;
463 strcpy(intermission_planets[PLANET_ELAMALE].name, _("Elamale"));
464 intermission_planets[PLANET_ELAMALE].image = gfx_sprites[SP_PLANET_ORANGE];
465
466 intermission_planets[PLANET_RESCUESLAVES].messageMission = MISN_RESCUESLAVES;
467 intermission_planets[PLANET_RESCUESLAVES].messageSlot = 0;
468 intermission_planets[PLANET_RESCUESLAVES].faceImage = FS_SID;
469 /// Eyananth, interception mission summary
470 strcpy(intermission_planets[PLANET_RESCUESLAVES].subject, _("Rescue slaves"));
471
472 intermission_planets[PLANET_NEROD].messageMission = MISN_NEROD;
473 intermission_planets[PLANET_NEROD].messageSlot = 1;
474 intermission_planets[PLANET_NEROD].faceImage = FS_PHOEBE;
475 /// Eyananth, Nerod mission summary
476 strcpy(intermission_planets[PLANET_NEROD].subject, _("SOS"));
477
478 intermission_planets[PLANET_ALLEZ].messageMission = MISN_ALLEZ;
479 intermission_planets[PLANET_ALLEZ].messageSlot = 2;
480 intermission_planets[PLANET_ALLEZ].faceImage = FS_SID;
481 /// Eyananth, Allez mission summary
482 strcpy(intermission_planets[PLANET_ALLEZ].subject, _("Assist medical supply craft"));
483
484 intermission_planets[PLANET_URUSOR].messageMission = MISN_URUSOR;
485 intermission_planets[PLANET_URUSOR].messageSlot = 0;
486 intermission_planets[PLANET_URUSOR].faceImage = FS_SID;
487 /// Eyananth, Urusor mission summary
488 strcpy(intermission_planets[PLANET_URUSOR].subject, _("Capture five WEAPCO supply craft"));
489
490 intermission_planets[PLANET_DORIM].messageMission = MISN_DORIM;
491 intermission_planets[PLANET_DORIM].messageSlot = 1;
492 intermission_planets[PLANET_DORIM].faceImage = FS_SID;
493 /// Eyananth, Dorim mission summary
494 strcpy(intermission_planets[PLANET_DORIM].subject, _("Find WEAPCO scientist"));
495
496 intermission_planets[PLANET_ELAMALE].messageMission = MISN_ELAMALE;
497 intermission_planets[PLANET_ELAMALE].messageSlot = 0;
498 intermission_planets[PLANET_ELAMALE].faceImage = FS_PHOEBE;
499 /// Eyananth, Elamale mission summary
500 strcpy(intermission_planets[PLANET_ELAMALE].subject, _("Destroy WEAPCO Ore Mining craft"));
501
502 break;
503
504 case SYSTEM_MORDOR:
505 strcpy(intermission_planets[PLANET_CLOAKFIGHTER].name, _("WEAPCO interceptions"));
506
507 intermission_planets[PLANET_ODEON].dist = 3;
508 strcpy(intermission_planets[PLANET_ODEON].name, _("Odeon"));
509 intermission_planets[PLANET_ODEON].image = gfx_sprites[SP_PLANET_GREEN];
510
511 intermission_planets[PLANET_FELLON].dist = 6;
512 strcpy(intermission_planets[PLANET_FELLON].name, _("Fellon"));
513 intermission_planets[PLANET_FELLON].image = gfx_sprites[SP_PLANET_BLUE];
514
515 intermission_planets[PLANET_SIVEDI].dist = 6;
516 strcpy(intermission_planets[PLANET_SIVEDI].name, _("Sivedi"));
517 intermission_planets[PLANET_SIVEDI].image = gfx_sprites[SP_PLANET_RED];
518
519 intermission_planets[PLANET_ALMARTHA].dist = 4;
520 strcpy(intermission_planets[PLANET_ALMARTHA].name, _("Almartha"));
521 intermission_planets[PLANET_ALMARTHA].image = gfx_sprites[SP_PLANET_GREEN];
522
523 intermission_planets[PLANET_POSWIC].dist = 4;
524 strcpy(intermission_planets[PLANET_POSWIC].name, _("Poswic"));
525 intermission_planets[PLANET_POSWIC].image = gfx_sprites[SP_PLANET_ORANGE];
526
527 intermission_planets[PLANET_ELLESH].dist = 8;
528 strcpy(intermission_planets[PLANET_ELLESH].name, _("Ellesh"));
529 intermission_planets[PLANET_ELLESH].image = gfx_sprites[SP_PLANET_GREEN];
530
531 intermission_planets[PLANET_CLOAKFIGHTER].messageMission = MISN_CLOAKFIGHTER;
532 intermission_planets[PLANET_CLOAKFIGHTER].messageSlot = 0;
533 intermission_planets[PLANET_CLOAKFIGHTER].faceImage = FS_SID;
534 /// Mordor, incerception mission summary
535 strcpy(intermission_planets[PLANET_CLOAKFIGHTER].subject, _("Destroy experimental fighter"));
536
537 intermission_planets[PLANET_ODEON].messageMission = MISN_ODEON;
538 intermission_planets[PLANET_ODEON].messageSlot = 1;
539 intermission_planets[PLANET_ODEON].faceImage = FS_PHOEBE;
540 /// Mordor, Odeon mission summary
541 strcpy(intermission_planets[PLANET_ODEON].subject, _("Rescue Ursula"));
542
543 intermission_planets[PLANET_FELLON].messageMission = MISN_FELLON;
544 intermission_planets[PLANET_FELLON].messageSlot = 2;
545 intermission_planets[PLANET_FELLON].faceImage = FS_SID;
546 /// Mordor, Fellon mission summary
547 strcpy(intermission_planets[PLANET_FELLON].subject, _("Assist rebel forces"));
548
549 intermission_planets[PLANET_SIVEDI].messageMission = MISN_SIVEDI;
550 intermission_planets[PLANET_SIVEDI].messageSlot = 0;
551 intermission_planets[PLANET_SIVEDI].faceImage = FS_SID;
552 /// Mordor, Sivedi mission summary
553 strcpy(intermission_planets[PLANET_SIVEDI].subject, _("Mine ore from asteroid belt"));
554
555 intermission_planets[PLANET_ALMARTHA].messageMission = MISN_ALMARTHA;
556 intermission_planets[PLANET_ALMARTHA].messageSlot = 1;
557 intermission_planets[PLANET_ALMARTHA].faceImage = FS_KRASS;
558 /// Mordor, Almartha mission summary
559 strcpy(intermission_planets[PLANET_ALMARTHA].subject, _("Create a diversion"));
560
561 intermission_planets[PLANET_POSWIC].messageMission = MISN_POSWIC;
562 intermission_planets[PLANET_POSWIC].messageSlot = 0;
563 intermission_planets[PLANET_POSWIC].faceImage = FS_URSULA;
564 /// Mordor, Poswic mission summary
565 strcpy(intermission_planets[PLANET_POSWIC].subject, _("Capture WEAPCO executive transport"));
566
567 intermission_planets[PLANET_ELLESH].messageMission = MISN_ELLESH;
568 intermission_planets[PLANET_ELLESH].messageSlot = 0;
569 intermission_planets[PLANET_ELLESH].faceImage = FS_PHOEBE;
570 /// Mordor, Ellesh mission summary
571 strcpy(intermission_planets[PLANET_ELLESH].subject, _("Destroy WEAPCO executive transport"));
572
573 break;
574
575 case SYSTEM_SOL:
576 intermission_planets[PLANET_MERCURY].dist = 3;
577 strcpy(intermission_planets[PLANET_MERCURY].name, _("Mercury"));
578 intermission_planets[PLANET_MERCURY].image = gfx_sprites[SP_PLANET_RED];
579
580 intermission_planets[PLANET_VENUS].dist = 4;
581 strcpy(intermission_planets[PLANET_VENUS].name, _("Venus"));
582 intermission_planets[PLANET_VENUS].image = gfx_sprites[SP_PLANET_ORANGE];
583
584 intermission_planets[PLANET_EARTH].dist = 4;
585 strcpy(intermission_planets[PLANET_EARTH].name, _("Earth"));
586 intermission_planets[PLANET_EARTH].image = gfx_sprites[SP_PLANET_BLUE];
587
588 intermission_planets[PLANET_MARS].dist = 4;
589 strcpy(intermission_planets[PLANET_MARS].name, _("Mars"));
590 intermission_planets[PLANET_MARS].image = gfx_sprites[SP_PLANET_RED];
591
592 intermission_planets[PLANET_JUPITER].dist = 6;
593 strcpy(intermission_planets[PLANET_JUPITER].name, _("Jupiter"));
594 intermission_planets[PLANET_JUPITER].image = gfx_sprites[SP_PLANET_ORANGE];
595
596 intermission_planets[PLANET_SATURN].dist = 4;
597 strcpy(intermission_planets[PLANET_SATURN].name, _("Saturn"));
598 intermission_planets[PLANET_SATURN].image = gfx_sprites[SP_PLANET_GREEN];
599
600 intermission_planets[PLANET_URANUS].dist = 4;
601 strcpy(intermission_planets[PLANET_URANUS].name, _("Uranus"));
602 intermission_planets[PLANET_URANUS].image = gfx_sprites[SP_PLANET_BLUE];
603
604 intermission_planets[PLANET_NEPTUNE].dist = 4;
605 strcpy(intermission_planets[PLANET_NEPTUNE].name, _("Neptune"));
606 intermission_planets[PLANET_NEPTUNE].image = gfx_sprites[SP_PLANET_BLUE];
607
608 intermission_planets[PLANET_PLUTO].dist = 4;
609 strcpy(intermission_planets[PLANET_PLUTO].name, _("Pluto"));
610 intermission_planets[PLANET_PLUTO].image = gfx_sprites[SP_PLANET_BLUE];
611
612 intermission_planets[PLANET_PLUTO].messageMission = MISN_PLUTO;
613 intermission_planets[PLANET_PLUTO].messageSlot = 0;
614 intermission_planets[PLANET_PLUTO].faceImage = FS_SID;
615 /// Sol, Pluto mission summary
616 strcpy(intermission_planets[PLANET_PLUTO].subject, _("Secure Pluto"));
617
618 intermission_planets[PLANET_NEPTUNE].messageMission = MISN_NEPTUNE;
619 intermission_planets[PLANET_NEPTUNE].messageSlot = 1;
620 intermission_planets[PLANET_NEPTUNE].faceImage = FS_SID;
621 /// Sol, Neptune mission summary
622 strcpy(intermission_planets[PLANET_NEPTUNE].subject, _("Secure Neptune"));
623
624 intermission_planets[PLANET_URANUS].messageMission = MISN_URANUS;
625 intermission_planets[PLANET_URANUS].messageSlot = 2;
626 intermission_planets[PLANET_URANUS].faceImage = FS_SID;
627 /// Sol, Uranus mission summary
628 strcpy(intermission_planets[PLANET_URANUS].subject, _("Secure Uranus"));
629
630 intermission_planets[PLANET_SATURN].messageMission = MISN_SATURN;
631 intermission_planets[PLANET_SATURN].messageSlot = 0;
632 intermission_planets[PLANET_SATURN].faceImage = FS_SID;
633 /// Sol, Saturn mission summary
634 strcpy(intermission_planets[PLANET_SATURN].subject, _("Destroy outer defense system"));
635
636 intermission_planets[PLANET_JUPITER].messageMission = MISN_JUPITER;
637 intermission_planets[PLANET_JUPITER].messageSlot = 0;
638 intermission_planets[PLANET_JUPITER].faceImage = FS_SID;
639 /// Sol, Jupiter mission summary
640 strcpy(intermission_planets[PLANET_JUPITER].subject, _("Investigate distress call"));
641
642 intermission_planets[PLANET_MARS].messageMission = MISN_MARS;
643 intermission_planets[PLANET_MARS].messageSlot = 0;
644 intermission_planets[PLANET_MARS].faceImage = FS_SID;
645 /// Sol, Mars mission summary
646 strcpy(intermission_planets[PLANET_MARS].subject, _("Navigate asteroid belt"));
647
648 intermission_planets[PLANET_EARTH].messageMission = MISN_EARTH;
649 intermission_planets[PLANET_EARTH].messageSlot = 0;
650 intermission_planets[PLANET_EARTH].faceImage = FS_CHRIS;
651 /// Sol, Earth mission summary
652 strcpy(intermission_planets[PLANET_EARTH].subject, _("Take back Earth"));
653
654 intermission_planets[PLANET_VENUS].messageMission = MISN_VENUS;
655 intermission_planets[PLANET_VENUS].messageSlot = 0;
656 intermission_planets[PLANET_VENUS].faceImage = FS_SID;
657 /// Sol, Venus mission summary
658 strcpy(intermission_planets[PLANET_VENUS].subject, _("Defeat Kline"));
659
660 break;
661 }
662 }
663
664 /*
665 Spins the planets around the sun, spaced according to their dist value
666 as defined in intermission_setPlanets(). Moving the cursor over the planet
667 will show their name and their current status
668 */
intermission_showSystem(float pos,int selectable)669 static int intermission_showSystem(float pos, int selectable)
670 {
671 int h = MIN(screen->h * 5 / 6, screen->w);
672 SDL_Rect r;
673 int printedName = 0;
674 int planet = 0;
675 int planetSpace = intermission_planets[planet].dist;
676 int rtn = 0;
677
678 // Blit the sun
679 screen_blit(gfx_sprites[SP_SUN], screen->w / 2 - 30, h / 2 - 30);
680
681 for (int i = h / 10 ; i < h * 3 / 5 ; i+= planetSpace * h / 100)
682 {
683 pos *= 0.75;
684
685 gfx_drawCircle(screen->w / 2, h / 2, i, screen, darkGrey);
686
687 r.x = (int)(screen->w / 2 + (sinf(pos) * i));
688 r.y = (int)(h / 2 + (cosf(pos) * i));
689 r.w = h / 50;
690 r.h = h / 50;
691
692 r.x -= (intermission_planets[planet].image->w / 2);
693 r.y -= (intermission_planets[planet].image->h / 2);
694 screen_blit(intermission_planets[planet].image, r.x, r.y);
695
696 if (selectable
697 && game_collision(engine.cursor_x + 13, engine.cursor_y + 13,
698 6, 6, r.x, r.y, intermission_planets[planet].image->w,
699 intermission_planets[planet].image->h))
700 {
701 if (!printedName)
702 {
703 screen_renderUnicode(intermission_planets[planet].name, -1, screen->h - 25, FONT_WHITE);
704 printedName = 1;
705 }
706 if ((engine.keyState[KEY_FIRE]))
707 {
708 game.destinationPlanet = planet;
709 strcpy(game.destinationName, intermission_planets[game.destinationPlanet].name);
710 rtn = 1;
711 engine.keyState[KEY_FIRE] = 0;
712 }
713 }
714
715 planet++;
716 if (intermission_planets[planet].dist == -1)
717 break;
718 planetSpace = intermission_planets[planet].dist;
719 }
720
721 return rtn;
722 }
723
724 /*
725 Scrolls the player's current information up the screen. When
726 the specified status line reaches a certain Y value, the entire
727 list is reset and the information lines begin again from the bottom
728 (in other words, they loop around).
729 */
intermission_showStatus(SDL_Surface * infoSurface)730 static void intermission_showStatus(SDL_Surface *infoSurface)
731 {
732 int status_x = (screen->w - infoSurface->w) / 2;
733 int status_y = (screen->h - infoSurface->h) / 2 - 40;
734 int y;
735 float speed = 0.25;
736
737 if(engine.keyState[KEY_DOWN])
738 speed = 1;
739 else if(engine.keyState[KEY_UP])
740 speed = -1;
741
742 screen_blit(infoSurface, status_x, status_y);
743
744 for (int i = TS_STATUS_HEADER + 1 ; i < TS_STATUS_FOOTER ; i++)
745 {
746 gfx_textSprites[i].y -= speed;
747 if ((gfx_textSprites[i].y > 10) && (gfx_textSprites[i].y < infoSurface->h))
748 screen_blitText(i, status_x + 25, status_y - 10);
749 }
750
751 if (gfx_textSprites[TS_STATUS_FOOTER - 1].y < -5)
752 {
753 y = infoSurface->h;
754 for (int i = TS_STATUS_HEADER + 1 ; i < TS_STATUS_FOOTER ; i++)
755 {
756 y += 20;
757 if ((i == TS_CHRIS_HEADER) || (i == TS_PHOEBE_HEADER)
758 || (i == TS_URSULA_HEADER))
759 y += 25;
760
761 gfx_textSprites[i].y = y;
762 }
763 }
764
765 screen_drawRect(status_x, status_y, infoSurface->w, 20, 0x00, 0x00, 0x99);
766
767 screen_drawRect(status_x, status_y + infoSurface->h - 10, infoSurface->w, 20, 0x00, 0x00, 0x99);
768
769 screen_blitText(TS_STATUS_HEADER, -1, status_y + 3);
770 screen_blitText(TS_STATUS_FOOTER, -1, status_y + infoSurface->h - 6);
771 }
772
intermission_createCommsSurface(SDL_Surface * comms)773 static void intermission_createCommsSurface(SDL_Surface *comms)
774 {
775 int yStart;
776 int yOffset;
777
778 engine.commsSection = 0;
779
780 gfx_drawRect(comms, 0, 0, comms->w - 1, comms->h - 1, 0x00, 0x00, 0x25);
781
782 gfx_renderUnicode(_("+++ CURRENT MISSIONS +++"), -1, 15, FONT_GREEN, 0, comms);
783 /// Brief instructions for how to review a mission conversation, shown below the
784 /// CURRENT MISSIONS header.
785 gfx_renderUnicode(_("click for info"), -1, 35, FONT_WHITE, 0, comms);
786
787 yStart = 60;
788
789 for (int i = 0 ; i < MAX_PLANETS ; i++)
790 {
791 if ((intermission_planets[i].messageSlot != -1) && (intermission_planets[i].missionCompleted == 0))
792 {
793 yOffset = intermission_planets[i].messageSlot * 60;
794 gfx_drawRect(comms, 0, yStart + yOffset, comms->w - 1, 55, 0x00, 0x00, 0x77);
795 gfx_blit(gfx_faceSprites[intermission_planets[i].faceImage], 20, yStart + 5 + yOffset, comms);
796 gfx_renderUnicode(intermission_planets[i].name, 80, yStart + 5 + yOffset, FONT_WHITE, 0, comms);
797 gfx_renderUnicode(intermission_planets[i].subject, 80, yStart + 25 + yOffset, FONT_CYAN, 0, comms);
798 }
799 }
800 }
801
intermission_renderDialog(SDL_Surface * comms,int y,int face,const char * string)802 static int intermission_renderDialog(SDL_Surface *comms, int y, int face, const char *string)
803 {
804 int newY;
805 gfx_blit(gfx_faceSprites[face], 10, y, comms);
806 newY = gfx_renderUnicode(string, 80, y, FONT_WHITE, 1, comms) + MENU_SPACING;
807 if (newY < y + 60)
808 newY += (60 - (newY - y));
809 return newY;
810 }
811
intermission_createMissionDetailSurface(SDL_Surface * comms,int missionSlot)812 static void intermission_createMissionDetailSurface(SDL_Surface *comms, int missionSlot)
813 {
814 char string[STRMAX];
815 int y = 10;
816 int misn = -1;
817
818 for (int i = 0 ; i < MAX_PLANETS ; i++)
819 {
820 if ((intermission_planets[i].messageSlot == missionSlot) && (intermission_planets[i].missionCompleted == 0))
821 {
822 misn = intermission_planets[i].messageMission;
823 }
824 }
825
826 if (misn == -1)
827 return;
828
829 gfx_drawRect(comms, 0, 0, comms->w - 1, comms->h - 1, 0x00, 0x00, 0x25);
830
831 switch (misn)
832 {
833 case MISN_HAIL:
834 /// Mission dialog: Spirit, Hail (Krass Tyler)
835 strcpy(string, _("Hey, boy! You still owe me money for the Firefly I stole for you! But instead, I want you to go to the WEAPCO training ground and destroy all the craft there."));
836 y = intermission_renderDialog(comms, y, FS_KRASS, string);
837
838 /// Mission dialog: Spirit, Hail (Chris Bainfield)
839 strcpy(string, _("Oh? That's the job I contracted you to do, was it not?"));
840 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
841
842 /// Mission dialog: Spirit, Hail (Krass Tyler)
843 strcpy(string, _("I know, but this way we can resolve your debt right now. Do this job, and also collect $500, and we will call it quits. And if you die... well, I guess the ship was not worth stealing! HA HA HA!"));
844 y = intermission_renderDialog(comms, y, FS_KRASS, string);
845
846 /// Mission dialog: Spirit, Hail (Chris Bainfield)
847 strcpy(string, _("As usual, you take me too lightly, Krass."));
848 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
849
850 break;
851
852 case MISN_CERADSE:
853 /// Mission dialog: Spirit, Ceradse (Chris Bainfield)
854 strcpy(string, _("Hey, Sid, what's up?"));
855 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
856
857 /// Mission dialog: Spirit, Ceradse (Sid Wilson)
858 strcpy(string, _("Chris, I've intercepted a communication from WEAPCO. Seems they're transporting some medical supplies around Ceradse. We need to get hold of those pods to save some lives!"));
859 y = intermission_renderDialog(comms, y, FS_SID, string);
860
861 /// Mission dialog: Spirit, Ceradse (Chris Bainfield)
862 strcpy(string, _("How many do we need?"));
863 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
864
865 /// Mission dialog: Spirit, Ceradse (Sid Wilson)
866 strcpy(string, _("All six, Chris! If you lose even a single one, thousands of people could perish in Spirit within the next few months."));
867 y = intermission_renderDialog(comms, y, FS_SID, string);
868
869 break;
870
871 case MISN_HINSTAG:
872 /// Mission dialog: Spirit, Hinstag (Chris Bainfield)
873 strcpy(string, _("Wow! Missile boats?"));
874 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
875
876 /// Mission dialog: Spirit, Hinstag (Sid Wilson)
877 strcpy(string, _("Yup. Looks like WEAPCO is starting to take notice of your actions."));
878 y = intermission_renderDialog(comms, y, FS_SID, string);
879
880 /// Mission dialog: Spirit, Hinstag (Chris Bainfield)
881 strcpy(string, _("Awesome! This will really put the Firefly's fighting ability to the test!"));
882 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
883
884 /// Mission dialog: Spirit, Hinstag (Sid Wilson)
885 strcpy(string, _("Please be careful, Chris. A single missile boat carries enough rockets to level most major cities. Try not to face them head-on, and keep your distance."));
886 y = intermission_renderDialog(comms, y, FS_SID, string);
887
888 break;
889
890 case MISN_JOLDAR:
891 /// Mission dialog: Spirit, Joldar (Sid Wilson)
892 strcpy(string, _("We're going to have to get rid of the mine deployment unit around Joldar. The minefield is stopping interplanetary traffic."));
893 y = intermission_renderDialog(comms, y, FS_SID, string);
894
895 /// Mission dialog: Spirit, Joldar (Chris Bainfield)
896 strcpy(string, _("Are any fighters around to keep me entertained?"));
897 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
898
899 /// Mission dialog: Spirit, Joldar (Sid Wilson)
900 strcpy(string, _("Not at the moment, but that doesn't mean they won't turn up. Be very careful of those mines! They'll only explode when they encounter a ship that's not transmitting a WEAPCO signal. Shoot them down if they get in your way."));
901 y = intermission_renderDialog(comms, y, FS_SID, string);
902
903 break;
904
905 case MISN_MOEBO:
906 /// Mission dialog: Spirit, Moebo (Sid Wilson)
907 strcpy(string, _("We've got a major problem here! WEAPCO has decided to stop our resistance by destroying Spirit! The explosion will incinerate everything in the system! You've got to destroy that frigate before it gets in range!"));
908 y = intermission_renderDialog(comms, y, FS_SID, string);
909
910 /// Mission dialog: Spirit, Moebo (Chris Bainfield)
911 strcpy(string, _("Damn! I'll get right on it, then!"));
912 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
913
914 /// Mission dialog: Spirit, Moebo (Sid Wilson)
915 strcpy(string, _("We're all counting on you, Chris! But remember, they didn't call that thing \"Star Killer\" just because it sounded nice!"));
916 y = intermission_renderDialog(comms, y, FS_SID, string);
917
918 break;
919
920 case MISN_RESCUESLAVES:
921 /// Mission dialog: Eyananth, interceptions (Sid Wilson)
922 /// "%d" must be retained as-is. It is replaced with the number of slaves that
923 /// need to be rescued.
924 snprintf(string, STRMAX, _("As you know, WEAPCO has many slaves in this system. If we free a large number of them, it might help to spark a rebellion. I estimate that we will need to rescue around %d to make a difference."), SLAVE_RESCUE_TARGET);
925 y = intermission_renderDialog(comms, y, FS_SID, string);
926
927 /// Mission dialog: Eyananth, interceptions (Chris Bainfield)
928 strcpy(string, _("Most of the slaves are working in ore mines, aren't they?"));
929 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
930
931 /// Mission dialog: Eyananth, interceptions (Sid Wilson)
932 strcpy(string, _("Yes, but attacking the mines directly would be dangerous. You'd be better off intercepting slave transports. What you'll have to do is fly around and see if you can intercept a WEAPCO patrol. Of course, they might not be escorting any slave units, so be careful!"));
933 y = intermission_renderDialog(comms, y, FS_SID, string);
934
935 break;
936
937 case MISN_NEROD:
938 /// Mission dialog: Eyananth, Nerod (Phoebe Lexx)
939 strcpy(string, _("Help! This is an SOS! Can anyone hear me?!"));
940 y = intermission_renderDialog(comms, y, FS_PHOEBE, string);
941
942 /// Mission dialog: Eyananth, Nerod (Chris Bainfield)
943 strcpy(string, _("I'm hearing you loud and clear! What's up?"));
944 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
945
946 /// Mission dialog: Eyananth, Nerod (Phoebe Lexx)
947 strcpy(string, _("Oh, thank God! I was intercepted by a large WEAPCO force near Nerod! I'm in need of assistance!"));
948 y = intermission_renderDialog(comms, y, FS_PHOEBE, string);
949
950 /// Mission dialog: Eyananth, Nerod (Chris Bainfield)
951 strcpy(string, _("I'm on my way!"));
952 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
953
954 break;
955
956 case MISN_ALLEZ:
957 /// Mission dialog: Eyananth, Allez (Sid Wilson)
958 strcpy(string, _("I've just received another SOS. This one is coming from a supply craft carrying essential medical supplies."));
959 y = intermission_renderDialog(comms, y, FS_SID, string);
960
961 /// Mission dialog: Eyananth, Allez (Chris Bainfield)
962 strcpy(string, _("Alright, tell 'em I'm on my way."));
963 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
964
965 break;
966
967 case MISN_URUSOR:
968 /// Mission dialog: Eyananth, Urusor (Sid Wilson)
969 strcpy(string, _("I need some resources before we leave. It'll make life a lot easier in Mordor. Problem is that WEAPCO hoards these parts."));
970 y = intermission_renderDialog(comms, y, FS_SID, string);
971
972 /// Mission dialog: Eyananth, Urusor (Chris Bainfield)
973 strcpy(string, _("Where can we get them, then?"));
974 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
975
976 /// Mission dialog: Eyananth, Urusor (Sid Wilson)
977 strcpy(string, _("There's a big shipment of them nearby. I can disable the supply craft carrying them; I just need you to give me some cover while I do it."));
978 y = intermission_renderDialog(comms, y, FS_SID, string);
979
980 /// Mission dialog: Eyananth, Urusor (Chris Bainfield)
981 strcpy(string, _("You got it!"));
982 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
983
984 break;
985
986 case MISN_DORIM:
987 /// Mission dialog: Eyananth, Dorim (Sid Wilson)
988 strcpy(string, _("A WEAPCO scientist just ran off in an escape pod and hid in the asteroid belt. If we capture him, we may be able to get some information about Mordor."));
989 y = intermission_renderDialog(comms, y, FS_SID, string);
990
991 /// Mission dialog: Eyananth, Dorim (Chris Bainfield)
992 strcpy(string, _("Alright, I'll go look for him. I guess I'll grab some ore along the way."));
993 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
994
995 break;
996
997 case MISN_ELAMALE:
998 /// Mission dialog: Eyananth, Elamale (Sid Wilson)
999 strcpy(string, _("I've received word that the slaves we rescued have started a rebellion. Looks like the plan worked."));
1000 y = intermission_renderDialog(comms, y, FS_SID, string);
1001
1002 /// Mission dialog: Eyananth, Elamale (Phoebe Lexx)
1003 strcpy(string, _("WEAPCO has an automated mining ship in orbit around Elamale. How about we take it out and cause some confusion?"));
1004 y = intermission_renderDialog(comms, y, FS_PHOEBE, string);
1005
1006 /// Mission dialog: Eyananth, Elamale (Chris Bainfield)
1007 strcpy(string, _("I like that idea!"));
1008 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
1009
1010 /// Mission dialog: Eyananth, Elamale (Sid Wilson)
1011 strcpy(string, _("It'll work, but be careful."));
1012 y = intermission_renderDialog(comms, y, FS_SID, string);
1013
1014 break;
1015
1016 case MISN_CLOAKFIGHTER:
1017 /// Mission dialog: Mordor, interceptions (Chris Bainfield)
1018 strcpy(string, _("What have you found out about that experimental fighter?"));
1019 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
1020
1021 /// Mission dialog: Mordor, interceptions (Sid Wilson)
1022 strcpy(string, _("It's got some kind of cloaking device that makes it invisible to radar. Could prove hard to track down."));
1023 y = intermission_renderDialog(comms, y, FS_SID, string);
1024
1025 /// Mission dialog: Mordor, interceptions (Chris Bainfield)
1026 strcpy(string, _("I'll just have to run around the system until I find it."));
1027 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
1028
1029 /// Mission dialog: Mordor, interceptions (Sid Wilson)
1030 strcpy(string, _("It's likely to run away if you engage it in battle, so try and do as much damage to it as possible."));
1031 y = intermission_renderDialog(comms, y, FS_SID, string);
1032
1033 break;
1034
1035 case MISN_ODEON:
1036 /// Mission dialog: Mordor, Odeon (Phoebe Lexx)
1037 strcpy(string, _("I've located my sister's ship currently in orbit around Odeon. She's ignoring my hails though."));
1038 y = intermission_renderDialog(comms, y, FS_PHOEBE, string);
1039
1040 /// Mission dialog: Mordor, Odeon (Sid Wilson)
1041 strcpy(string, _("Something's off here. She seems to be travelling freely with a WEAPCO group."));
1042 y = intermission_renderDialog(comms, y, FS_SID, string);
1043
1044 /// Mission dialog: Mordor, Odeon (Chris Bainfield)
1045 strcpy(string, _("Do you think she's turned traitor?"));
1046 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
1047
1048 /// Mission dialog: Mordor, Odeon (Phoebe Lexx)
1049 strcpy(string, _("No way. She hates WEAPCO with a passion."));
1050 y = intermission_renderDialog(comms, y, FS_PHOEBE, string);
1051
1052 /// Mission dialog: Mordor, Odeon (Sid Wilson)
1053 strcpy(string, _("She must be under some kind of mind control. I've heard of WEAPCO developing a new \"AI training program\" recently. We'd better rescue her!"));
1054 y = intermission_renderDialog(comms, y, FS_SID, string);
1055
1056 break;
1057
1058 case MISN_FELLON:
1059 /// Mission dialog: Mordor, Fellon (Sid Wilson)
1060 strcpy(string, _("A rebel group has organized a counter strike. If we can help them secure a victory it will be a real boost to morale."));
1061 y = intermission_renderDialog(comms, y, FS_SID, string);
1062
1063 /// Mission dialog: Mordor, Fellon (Chris Bainfield)
1064 strcpy(string, _("Awesome! Let's do it!"));
1065 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
1066
1067 /// Mission dialog: Mordor, Fellon (Sid Wilson)
1068 strcpy(string, _("Just make sure the rebel ships don't all get destroyed."));
1069 y = intermission_renderDialog(comms, y, FS_SID, string);
1070
1071 break;
1072
1073 case MISN_SIVEDI:
1074 /// Mission dialog: Mordor, Sivedi (Sid Wilson)
1075 strcpy(string, _("Seems like taking out that WEAPCO mining ship wasn't such a good idea. The ore it collected is needed in weapons production."));
1076 y = intermission_renderDialog(comms, y, FS_SID, string);
1077
1078 /// Mission dialog: Mordor, Sivedi (Chris Bainfield)
1079 strcpy(string, _("Damn! I guess that means I'll have to mine some myself, then, huh?"));
1080 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
1081
1082 /// Mission dialog: Mordor, Sivedi (Sid Wilson)
1083 strcpy(string, _("Yes. Be careful, Chris. Your weapons weren't designed for that sort of work, after all."));
1084 y = intermission_renderDialog(comms, y, FS_SID, string);
1085
1086 break;
1087
1088 case MISN_ALMARTHA:
1089 /// Mission dialog: Mordor, Almartha (Chris Bainfield)
1090 strcpy(string, _("Hey, Krass! I need you to help us out with something. Phoebe and Ursula are taking out key WEAPCO plants. Can you help me create a diversion by wreaking havoc a little bit away from that?"));
1091 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
1092
1093 /// Mission dialog: Mordor, Almartha (Krass Tyler)
1094 strcpy(string, _("Sure, I can help you out, boy. But I'll be needing my fee..."));
1095 y = intermission_renderDialog(comms, y, FS_KRASS, string);
1096
1097 break;
1098
1099 case MISN_POSWIC:
1100 /// Mission dialog: Mordor, Poswic (Ursula Lexx)
1101 strcpy(string, _("My memory is finally back. Here's something interesting: just before I was captured, I found out that WEAPCO is transporting several important executives to Poswic."));
1102 y = intermission_renderDialog(comms, y, FS_URSULA, string);
1103
1104 /// Mission dialog: Mordor, Poswic (Sid Wilson)
1105 strcpy(string, _("We can't let a rare opportunity like this slip through our fingers! I'll need some cover so I can disable that ship."));
1106 y = intermission_renderDialog(comms, y, FS_SID, string);
1107
1108 /// Mission dialog: Mordor, Poswic (Chris Bainfield)
1109 strcpy(string, _("I've got you covered, Sid!"));
1110 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
1111
1112 break;
1113
1114 case MISN_ELLESH:
1115 /// Mission dialog: Mordor, Ellesh (Chris Bainfield)
1116 strcpy(string, _("Phoebe, I need you to keep an eye on things here. I'm going after that ship!"));
1117 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
1118
1119 /// Mission dialog: Mordor, Ellesh (Phoebe Lexx)
1120 strcpy(string, _("Are you sure you can catch up to it?"));
1121 y = intermission_renderDialog(comms, y, FS_PHOEBE, string);
1122
1123 /// Mission dialog: Mordor, Ellesh (Chris Bainfield)
1124 strcpy(string, _("Absolutely. One thing that's really nice about the Firefly is its speed. I'll see you in a bit!"));
1125 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
1126
1127 break;
1128
1129 case MISN_PLUTO:
1130 case MISN_NEPTUNE:
1131 case MISN_URANUS:
1132 /// Mission dialog: Sol, Pluto/Neptune/Uranus (Sid Wilson)
1133 strcpy(string, _("We've got to start from the outside and work our way in. That will give us less chance of being flanked during the final operation."));
1134 y = intermission_renderDialog(comms, y, FS_SID, string);
1135
1136 /// Mission dialog: Sol, Pluto/Neptune/Uranus (Phoebe Lexx)
1137 strcpy(string, _("Sounds like a plan, Sid!"));
1138 y = intermission_renderDialog(comms, y, FS_PHOEBE, string);
1139
1140 /// Mission dialog: Sol, Pluto/Neptune/Uranus (Ursula Lexx)
1141 strcpy(string, _("Better safe than sorry, I guess."));
1142 y = intermission_renderDialog(comms, y, FS_URSULA, string);
1143
1144 /// Mission dialog: Sol, Pluto/Neptune/Uranus (Chris Bainfield)
1145 strcpy(string, _("Boring, but I guess you're right, Sid, as usual."));
1146 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
1147
1148 break;
1149
1150 case MISN_SATURN:
1151 /// Mission dialog: Sol, Saturn (Chris Bainfield)
1152 strcpy(string, _("WEAPCO has set up a highly dangerous defense line between Saturn and Uranus. We'll need to take it out."));
1153 y = intermission_renderDialog(comms, y, FS_SID, string);
1154
1155 /// Mission dialog: Sol, Saturn (Ursula Lexx)
1156 strcpy(string, _("What kind of defense system?"));
1157 y = intermission_renderDialog(comms, y, FS_URSULA, string);
1158
1159 /// Mission dialog: Sol, Saturn (Chris Bainfield)
1160 strcpy(string, _("Several mobile Energy Ray cannons, not unlike the weapon used by the Star Killer back in Spirit."));
1161 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
1162
1163 /// Mission dialog: Sol, Saturn (Phoebe Lexx)
1164 strcpy(string, _("Best check my ejection system, then!"));
1165 y = intermission_renderDialog(comms, y, FS_PHOEBE, string);
1166
1167 break;
1168
1169 case MISN_JUPITER:
1170 /// Mission dialog: Sol, Jupiter (Sid Wilson)
1171 strcpy(string, _("While you were gone I picked up a distress call coming from around Jupiter."));
1172 y = intermission_renderDialog(comms, y, FS_SID, string);
1173
1174 /// Mission dialog: Sol, Jupiter (Ursula Lexx)
1175 strcpy(string, _("Who would be sending out a distress call within Sol?"));
1176 y = intermission_renderDialog(comms, y, FS_URSULA, string);
1177
1178 /// Mission dialog: Sol, Jupiter (Chris Bainfield)
1179 strcpy(string, _("Let's check it out. Even if it's a trap, I think we can handle it."));
1180 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
1181
1182 break;
1183
1184 case MISN_MARS:
1185 /// Mission dialog: Sol, Mars (Sid Wilson)
1186 strcpy(string, _("Chris, we've got a small problem. WEAPCO has deployed a minefield in the asteroid belt. We'll need you to clear a way through."));
1187 y = intermission_renderDialog(comms, y, FS_SID, string);
1188
1189 /// Mission dialog: Sol, Mars (Chris Bainfield)
1190 strcpy(string, _("Alright. I'll radio in once I've cleared a safe path."));
1191 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
1192
1193 break;
1194
1195 case MISN_EARTH:
1196 /// Mission dialog: Sol, Earth (Chris Bainfield)
1197 strcpy(string, _("Okay people, this is the big one. We go in fast and we go in hard. Don't hold back and hit them with everything we've got!"));
1198 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
1199
1200 /// Mission dialog: Sol, Earth (Sid Wilson)
1201 strcpy(string, _("We've come too far to turn back now. None of us better die out there!"));
1202 y = intermission_renderDialog(comms, y, FS_SID, string);
1203
1204 /// Mission dialog: Sol, Earth (Phoebe Lexx)
1205 strcpy(string, _("Right with you, Chris!"));
1206 y = intermission_renderDialog(comms, y, FS_PHOEBE, string);
1207
1208 /// Mission dialog: Sol, Earth (Ursula Lexx)
1209 strcpy(string, _("WEAPCO'll regret sticking probes into my head!"));
1210 y = intermission_renderDialog(comms, y, FS_URSULA, string);
1211
1212 break;
1213
1214 case MISN_VENUS:
1215 /// Mission dialog: Sol, Venus (Chris Bainfield)
1216 strcpy(string, _("Kethlan has run off to Venus. I'm going after him."));
1217 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
1218
1219 /// Mission dialog: Sol, Venus (Sid Wilson)
1220 strcpy(string, _("Be careful, Chris. We've won the war, but it would be a real shame if you died now!"));
1221 y = intermission_renderDialog(comms, y, FS_SID, string);
1222
1223 break;
1224
1225 default:
1226 strcpy(string, "Hey, why am I talking to myself? This shouldn't happen! Clearly, this must be a bug.");
1227 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
1228
1229 snprintf(string, STRMAX, "I should go to pr-starfighter.github.io and report this bug there. In that report, I should mention that the mission number is %d.", misn);
1230 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
1231
1232 strcpy(string, "Wait, what am I still talking into empty space for? It's not like anyone can hear me...");
1233 y = intermission_renderDialog(comms, y, FS_CHRIS, string);
1234 }
1235
1236 engine.commsSection = 1;
1237 }
1238
intermission_doComms(SDL_Surface * comms,int x,int y)1239 static void intermission_doComms(SDL_Surface *comms, int x, int y)
1240 {
1241 if ((engine.keyState[KEY_FIRE]))
1242 {
1243 if (engine.commsSection == 0)
1244 {
1245 for (int i = 0 ; i < 4 ; i++)
1246 {
1247 if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x, y + 45 + (i * 60), 430, 50))
1248 {
1249 intermission_createMissionDetailSurface(comms, i);
1250 engine.keyState[KEY_FIRE] = 0;
1251 }
1252 }
1253 }
1254 else
1255 {
1256 if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x, y, comms->w, comms->h))
1257 {
1258 intermission_createCommsSurface(comms);
1259 engine.keyState[KEY_FIRE] = 0;
1260 }
1261 }
1262 }
1263 }
1264
intermission_createOptions(SDL_Surface * optionsSurface)1265 static void intermission_createOptions(SDL_Surface *optionsSurface)
1266 {
1267 SDL_FillRect(optionsSurface, NULL, black);
1268
1269 gfx_drawRect(optionsSurface, 0, 0, optionsSurface->w - 2, optionsSurface->h - 2, 0x00, 0x00, 0x44);
1270
1271 gfx_renderUnicode(_("++ OPTIONS ++"), 105, 8, FONT_WHITE, 0, optionsSurface);
1272
1273 gfx_drawRect(optionsSurface, 190, 45, 50, 22, 0x00, 0x00, 0x00);
1274 gfx_drawRect(optionsSurface, 250, 45, 50, 22, 0x00, 0x00, 0x00);
1275 gfx_drawRect(optionsSurface, 20, 45, 150, 22, 0x00, 0x00, 0x00);
1276 if (engine.useSound)
1277 gfx_drawRect(optionsSurface, 190, 45, 50, 22, 0xff, 0x00, 0x00);
1278 else
1279 gfx_drawRect(optionsSurface, 250, 45, 50, 22, 0xff, 0x00, 0x00);
1280 gfx_renderUnicode(_("ON"), 207, 50, FONT_WHITE, 0, optionsSurface);
1281 gfx_renderUnicode(_("OFF"), 263, 50, FONT_WHITE, 0, optionsSurface);
1282 gfx_renderUnicode(_("SOUND"), 30, 50, FONT_WHITE, 0, optionsSurface);
1283
1284 gfx_drawRect(optionsSurface, 190, 95, 50, 22, 0x00, 0x00, 0x00);
1285 gfx_drawRect(optionsSurface, 250, 95, 50, 22, 0x00, 0x00, 0x00);
1286 gfx_drawRect(optionsSurface, 20, 95, 150, 22, 0x00, 0x00, 0x00);
1287 if (engine.useMusic)
1288 gfx_drawRect(optionsSurface, 190, 95, 50, 22, 0xff, 0x00, 0x00);
1289 else
1290 gfx_drawRect(optionsSurface, 250, 95, 50, 22, 0xff, 0x00, 0x00);
1291 gfx_renderUnicode(_("ON"), 207, 100, FONT_WHITE, 0, optionsSurface);
1292 gfx_renderUnicode(_("OFF"), 263, 100, FONT_WHITE, 0, optionsSurface);
1293 gfx_renderUnicode(_("MUSIC"), 30, 100, FONT_WHITE, 0, optionsSurface);
1294
1295 gfx_drawRect(optionsSurface, 190, 145, 50, 22, 0x00, 0x00, 0x00);
1296 gfx_drawRect(optionsSurface, 250, 145, 50, 22, 0x00, 0x00, 0x00);
1297 gfx_drawRect(optionsSurface, 20, 145, 150, 22, 0x00, 0x00, 0x00);
1298 if (engine.fullScreen)
1299 gfx_drawRect(optionsSurface, 190, 145, 50, 22, 0xff, 0x00, 0x00);
1300 else
1301 gfx_drawRect(optionsSurface, 250, 145, 50, 22, 0xff, 0x00, 0x00);
1302 gfx_renderUnicode(_("ON"), 207, 150, FONT_WHITE, 0, optionsSurface);
1303 gfx_renderUnicode(_("OFF"), 263, 150, FONT_WHITE, 0, optionsSurface);
1304 gfx_renderUnicode(_("FULLSCREEN"), 30, 150, FONT_WHITE, 0, optionsSurface);
1305 }
1306
intermission_doOptions(SDL_Surface * optionsSurface,int x,int y)1307 static void intermission_doOptions(SDL_Surface *optionsSurface, int x, int y)
1308 {
1309 if ((engine.keyState[KEY_FIRE]))
1310 {
1311 if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + 187, y + 42, 45, 22))
1312 engine.useSound = 1;
1313
1314 if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + 248, y + 42, 45, 22))
1315 engine.useSound = 0;
1316
1317
1318 if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + 187, y + 92, 45, 22))
1319 {
1320 engine.useMusic = 1;
1321 #ifdef OLD_MUSIC
1322 audio_playMusic("music/3DParadise.mod", -1);
1323 #else
1324 audio_playMusic("music/through_space.ogg", -1);
1325 #endif
1326 }
1327
1328 if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + 248, y + 92, 45, 22))
1329 {
1330 engine.useMusic = 0;
1331 audio_haltMusic();
1332 }
1333
1334 if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + 187, y + 142, 45, 22))
1335 {
1336 if (!engine.fullScreen)
1337 {
1338 engine_setFullscreen(1);
1339 }
1340 }
1341
1342 if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + 248, y + 142, 45, 22))
1343 {
1344 if (engine.fullScreen)
1345 {
1346 engine_setFullscreen(0);
1347 }
1348 }
1349 }
1350 intermission_createOptions(optionsSurface);
1351 }
1352
1353 /*
1354 Controls the entire intermission screen. This simply draws a background,
1355 stars, gridlines and the icons at the bottom of the screen. Will call
1356 (and continue to call) the specified functions when the player has
1357 selected an icon.
1358 */
intermission()1359 int intermission()
1360 {
1361 char string[STRMAX_SHORT];
1362
1363 SDL_Rect r;
1364 SDL_Rect destRect;
1365 int distance = 0;
1366 double interceptionChance;
1367
1368 int section = 1;
1369
1370 int x;
1371 int y;
1372 int w;
1373
1374 float orbit_pos = 300;
1375 int movePlanets = 1;
1376 int saveSlot = -1;
1377
1378 int rtn = 0;
1379
1380 int redrawBackground = 1;
1381
1382 gfx_free();
1383
1384 intermission_unlockPlanets(); // double check just to make sure!
1385
1386 // Tell the game we are not in a mission so
1387 // do not perform certain keyboard actions
1388 engine.gameSection = SECTION_INTERMISSION;
1389
1390 screen_clear(black);
1391 renderer_update();
1392 screen_clear(black);
1393
1394 save_initSlots();
1395
1396 gfx_loadBackground(systemBackground[game.system]);
1397
1398 engine.cursor_x = screen->w / 2;
1399 engine.cursor_y = screen->h / 2;
1400 gfx_sprites[SP_CURSOR] = gfx_loadImage("gfx/cursor.png");
1401
1402 // Icons
1403 gfx_sprites[SP_START_MISSION] = gfx_loadImage("gfx/icon1.png");
1404 gfx_sprites[SP_MAP] = gfx_loadImage("gfx/icon2.png");
1405 gfx_sprites[SP_STATUS] = gfx_loadImage("gfx/icon3.png");
1406 gfx_sprites[SP_SAVE] = gfx_loadImage("gfx/icon4.png");
1407 gfx_sprites[SP_SHOP] = gfx_loadImage("gfx/icon5.png");
1408 gfx_sprites[SP_COMM] = gfx_loadImage("gfx/icon6.png");
1409 gfx_sprites[SP_OPTIONS] = gfx_loadImage("gfx/icon7.png");
1410 gfx_sprites[SP_EXIT] = gfx_loadImage("gfx/icon8.png");
1411 gfx_sprites[SP_PLASMA_MAX_OUTPUT] = gfx_loadImage("gfx/icon9.png");
1412 gfx_sprites[SP_PLASMA_MAX_POWER] = gfx_loadImage("gfx/icon10.png");
1413 gfx_sprites[SP_PLASMA_MAX_RATE] = gfx_loadImage("gfx/icon11.png");
1414 gfx_sprites[SP_PLASMA_AMMO] = gfx_loadImage("gfx/icon12.png");
1415 gfx_sprites[SP_ROCKET_AMMO] = gfx_loadImage("gfx/icon13.png");
1416 gfx_sprites[SP_PLASMA_MIN_OUTPUT] = gfx_loadImage("gfx/icon14.png");
1417 gfx_sprites[SP_PLASMA_MIN_POWER] = gfx_loadImage("gfx/icon15.png");
1418 gfx_sprites[SP_PLASMA_MIN_RATE] = gfx_loadImage("gfx/icon16.png");
1419 gfx_sprites[SP_PLASMA_MAX_AMMO] = gfx_loadImage("gfx/icon17.png");
1420 gfx_sprites[SP_ROCKET_MAX_AMMO] = gfx_loadImage("gfx/icon18.png");
1421 gfx_sprites[SP_DOUBLE_ROCKETS] = gfx_loadImage("gfx/icon19.png");
1422 gfx_sprites[SP_MICRO_ROCKETS] = gfx_loadImage("gfx/icon20.png");
1423 gfx_sprites[SP_LASER] = gfx_loadImage("gfx/icon21.png");
1424 gfx_sprites[SP_HOMING_MISSILE] = gfx_loadImage("gfx/icon22.png");
1425 gfx_sprites[SP_CHARGER] = gfx_loadImage("gfx/icon23.png");
1426 gfx_sprites[SP_DOUBLE_HOMING_MISSILES] = gfx_loadImage("gfx/icon24.png");
1427 gfx_sprites[SP_MICRO_HOMING_MISSILES] = gfx_loadImage("gfx/icon25.png");
1428 gfx_sprites[SP_GOTO] = gfx_loadImage("gfx/icon26.png");
1429 gfx_sprites[SP_BUY] = gfx_loadImage("gfx/buyIcon.png");
1430 gfx_sprites[SP_SELL] = gfx_loadImage("gfx/sellIcon.png");
1431 gfx_sprites[SP_FIREFLY] = gfx_loadImage("gfx/firefly1.png");
1432
1433 // Planets 30 - 39
1434 gfx_sprites[SP_SUN] = gfx_loadImage("gfx/planet_sun.png");
1435 gfx_sprites[SP_PLANET_GREEN] = gfx_loadImage("gfx/planet_green.png");
1436 gfx_sprites[SP_PLANET_BLUE] = gfx_loadImage("gfx/planet_blue.png");
1437 gfx_sprites[SP_PLANET_RED] = gfx_loadImage("gfx/planet_red.png");
1438 gfx_sprites[SP_PLANET_ORANGE] = gfx_loadImage("gfx/planet_orange.png");
1439
1440 // Faces
1441 gfx_faceSprites[FS_CHRIS] = gfx_loadImage("gfx/face_chris.png");
1442 gfx_faceSprites[FS_SID] = gfx_loadImage("gfx/face_sid.png");
1443 gfx_faceSprites[FS_KRASS] = gfx_loadImage("gfx/face_krass.png");
1444 gfx_faceSprites[FS_PHOEBE] = gfx_loadImage("gfx/face_phoebe.png");
1445 gfx_faceSprites[FS_URSULA] = gfx_loadImage("gfx/face_ursula.png");
1446 gfx_faceSprites[FS_KLINE] = gfx_loadImage("gfx/face_kline.png");
1447 gfx_faceSprites[FS_CREW] = gfx_loadImage("gfx/face_crew.png");
1448
1449 engine.done = ENGINE_RUNNING;
1450 engine.keyState[KEY_FIRE] = 0;
1451 engine.ssx = 0;
1452 engine.ssy = 0;
1453
1454 intermission_setStatusLines();
1455 shop_init();
1456 intermission_setPlanets();
1457
1458 SDL_Surface *statsSurface = gfx_createAlphaRect(DEFAULT_SCREEN_WIDTH * 7 / 8, DEFAULT_SCREEN_HEIGHT - 200, 0x00, 0x00, 0x99);
1459 SDL_Surface *savesSurface = gfx_createSurface(350, 300);
1460 SDL_Surface *optionsSurface = gfx_createSurface(320, 240);
1461 SDL_Surface *commsSurface = gfx_createSurface(450, 336);
1462
1463 save_createSurface(savesSurface, -1);
1464 intermission_createOptions(optionsSurface);
1465 intermission_createCommsSurface(commsSurface);
1466
1467 // Remove the Supercharge, if it is there
1468 if ((game.difficulty != DIFFICULTY_SUPEREASY)
1469 && (game.difficulty != DIFFICULTY_EASY)
1470 && (game.difficulty != DIFFICULTY_ORIGINAL))
1471 {
1472 weapons[W_PLAYER_WEAPON].reload[0] = MAX(
1473 weapons[W_PLAYER_WEAPON].reload[0],
1474 rate2reload[game.maxPlasmaRate]);
1475 weapons[W_PLAYER_WEAPON].ammo[0] = MIN(weapons[W_PLAYER_WEAPON].ammo[0],
1476 game.maxPlasmaOutput);
1477 weapons[W_PLAYER_WEAPON].damage = MIN(weapons[W_PLAYER_WEAPON].damage,
1478 game.maxPlasmaDamage);
1479 }
1480
1481 switch (game.system)
1482 {
1483 case SYSTEM_SPIRIT:
1484 if (game.difficulty == DIFFICULTY_ORIGINAL)
1485 interceptionChance = 0;
1486 else
1487 interceptionChance = 1. / 600.;
1488 break;
1489 case SYSTEM_EYANANTH:
1490 interceptionChance = 1. / 300.;
1491 break;
1492 case SYSTEM_MORDOR:
1493 interceptionChance = 1. / 150.;
1494 break;
1495 case SYSTEM_SOL:
1496 // There is no chance of being interceptted after the final attack on Earth
1497 if ((game.system == SYSTEM_SOL) && (intermission_planets[2].missionCompleted))
1498 interceptionChance = 0;
1499 else
1500 interceptionChance = 1. / 100.;
1501 break;
1502 default:
1503 interceptionChance = 0;
1504 }
1505
1506 if ((engine.useAudio) && (engine.useMusic))
1507 #ifdef OLD_MUSIC
1508 audio_playMusic("music/3DParadise.mod", -1);
1509 #else
1510 audio_playMusic("music/through_space.ogg", -1);
1511 #endif
1512
1513 /// Retain "%s" as-is. It is replaced with the current system name.
1514 snprintf(string, STRMAX_SHORT, _("System : %s"), game_systemNames[game.system]);
1515 gfx_createTextObject(TS_CURRENT_SYSTEM, string, 0, 0, FONT_WHITE);
1516
1517 gfx_createTextObject(TS_INFO_START_MISSION, _("Start Next Mission"), 0, 0, FONT_WHITE);
1518 gfx_createTextObject(TS_INFO_GOTO, _("Go to Destination Planet"), 0, 0, FONT_WHITE);
1519 gfx_createTextObject(TS_INFO_MAP, _("View System Map"), 0, 0, FONT_WHITE);
1520 gfx_createTextObject(TS_INFO_STATUS, _("Current Status"), 0, 0, FONT_WHITE);
1521 gfx_createTextObject(TS_INFO_SAVE_GAME, _("Save Game"), 0, 0, FONT_WHITE);
1522 gfx_createTextObject(TS_INFO_SHOP, _("Upgrade FIREFLY"), 0, 0, FONT_WHITE);
1523 gfx_createTextObject(TS_INFO_COMMS, _("Missions"), 0, 0, FONT_WHITE);
1524 gfx_createTextObject(TS_INFO_OPTIONS, _("Options"), 0, 0, FONT_WHITE);
1525 gfx_createTextObject(TS_INFO_EXIT, _("Exit to Title Screen"), 0, 0, FONT_WHITE);
1526
1527 /// Retain "%s" as-is. It is replaced with the name of the planet
1528 /// the player is currently stationed on.
1529 snprintf(string, STRMAX_SHORT, _("Stationed At: %s"), intermission_planets[game.stationedPlanet].name);
1530 gfx_createTextObject(TS_CURRENT_PLANET, string, 90, 0, FONT_WHITE);
1531
1532 if (game.destinationPlanet > -1)
1533 {
1534 /// Retain "%s" as-is. It is replaced with the name of the planet
1535 /// the player's destination is currently set to.
1536 snprintf(string, STRMAX_SHORT, _("Destination: %s"), intermission_planets[game.destinationPlanet].name);
1537 }
1538 else
1539 {
1540 strcpy(string, _("Destination: None"));
1541 }
1542 gfx_createTextObject(TS_DEST_PLANET, string, 0, 0, FONT_WHITE);
1543
1544 if (game.distanceCovered > 0)
1545 section = 0;
1546 else
1547 player.shield = player.maxShield;
1548
1549 player_flushInput();
1550 engine.keyState[KEY_FIRE] = engine.keyState[KEY_ALTFIRE] = 0;
1551 engine.done = ENGINE_RUNNING;
1552
1553 while (engine.done == ENGINE_RUNNING)
1554 {
1555 renderer_update();
1556
1557 if (redrawBackground)
1558 {
1559 screen_drawBackground();
1560 redrawBackground = 0;
1561 }
1562 else
1563 {
1564 screen_unBuffer();
1565 }
1566
1567 game_doStars();
1568
1569 r.x = 0;
1570 r.y = 0;
1571 r.h = screen->h;
1572 r.w = 1;
1573 for (int i = 40 ; i < screen->w ; i+= 40)
1574 {
1575 r.x = i;
1576 SDL_FillRect(screen, &r, darkerBlue);
1577 }
1578
1579 r.x = 0;
1580 r.y = 0;
1581 r.h = 1;
1582 r.w = screen->w;
1583 for (int i = 40 ; i < screen->h ; i+= 40)
1584 {
1585 r.y = i;
1586 SDL_FillRect(screen, &r, darkerBlue);
1587 }
1588
1589
1590 if (CHANCE(1. / 500))
1591 {
1592 engine.ssx = RANDRANGE(-100, 100);
1593 engine.ssy = RANDRANGE(-100, 100);
1594 engine.ssx /= 100;
1595 engine.ssy /= 100;
1596 }
1597
1598 screen_blitText(TS_CURRENT_SYSTEM, -1, 15);
1599
1600 switch(section)
1601 {
1602 case 0:
1603 if (game.stationedPlanet == game.destinationPlanet)
1604 {
1605 game.area = intermission_planets[game.stationedPlanet].missionNumber;
1606 rtn = 2;
1607 engine.done = ENGINE_CLOSING;
1608 }
1609 else
1610 {
1611 distance = abs(game.stationedPlanet - game.destinationPlanet);
1612 if (interceptionChance <= 0)
1613 distance = 1;
1614
1615 distance = (5 / distance);
1616 if (distance < 1)
1617 distance = 1;
1618
1619 gfx_createTextObject(TS_CURRENT_PLANET, intermission_planets[game.stationedPlanet].name,
1620 135, 0, FONT_WHITE);
1621 gfx_createTextObject(TS_DEST_PLANET, intermission_planets[game.destinationPlanet].name,
1622 85, 0, FONT_WHITE);
1623
1624 section = 8;
1625
1626 destRect.x = 180;
1627 destRect.y = screen->h - 90;
1628 destRect.w = 1;
1629 if (game.distanceCovered > 0)
1630 destRect.w = (int)game.distanceCovered;
1631 destRect.h = 20;
1632 }
1633 break;
1634
1635 case 1:
1636 if (engine.keyState[KEY_ALTFIRE])
1637 {
1638 movePlanets = !movePlanets;
1639 engine.keyState[KEY_ALTFIRE] = 0;
1640 }
1641
1642 if (movePlanets)
1643 {
1644 orbit_pos += 0.01;
1645 }
1646
1647 if (intermission_showSystem(orbit_pos, 1))
1648 {
1649 /// Retain "%s" as-is. It is replaced with the name of the planet
1650 /// the player's destination is currently set to.
1651 snprintf(string, STRMAX_SHORT, _("Destination: %s"), intermission_planets[game.destinationPlanet].name);
1652 gfx_createTextObject(TS_DEST_PLANET, string, 0, 0, FONT_WHITE);
1653 }
1654
1655 screen_blitText(TS_CURRENT_PLANET, 0, screen->h - 120);
1656 if (game.stationedPlanet != game.destinationPlanet)
1657 screen_blitText(TS_DEST_PLANET, screen->w - 250, screen->h - 120);
1658 break;
1659
1660 case 2:
1661 intermission_showStatus(statsSurface);
1662 break;
1663
1664 case 3:
1665 x = screen->w / 2 - savesSurface->w / 2;
1666 y = INTERMISSION_YCENTER - savesSurface->h / 2;
1667 screen_blit(savesSurface, x, y);
1668 saveSlot = save_showSlots(savesSurface, saveSlot, x, y);
1669 break;
1670
1671 case 4:
1672 shop_show();
1673 break;
1674
1675 case 5:
1676 x = screen->w / 2 - commsSurface->w / 2;
1677 y = INTERMISSION_YCENTER - commsSurface->h / 2;
1678 screen_blit(commsSurface, x, y);
1679 intermission_doComms(commsSurface, x, y);
1680 break;
1681
1682 case 6:
1683 x = screen->w / 2 - optionsSurface->w / 2;
1684 y = INTERMISSION_YCENTER - optionsSurface->h / 2;
1685 screen_blit(optionsSurface, x, y);
1686 intermission_doOptions(optionsSurface, x, y);
1687 break;
1688
1689 case 7:
1690 rtn = 0;
1691 engine.done = ENGINE_CLOSING;
1692 break;
1693
1694 case 8:
1695 intermission_showSystem(orbit_pos, 0);
1696
1697 screen_blit(intermission_planets[game.stationedPlanet].image, 150, screen->h - 90);
1698 screen_blitText(TS_CURRENT_PLANET, 0, screen->h - 120);
1699 screen_blit(intermission_planets[game.destinationPlanet].image, screen->w - 150, screen->h - 90);
1700 screen_blitText(TS_DEST_PLANET, screen->w - 250, screen->h - 120);
1701
1702 game.distanceCovered += distance * (screen->w - 350) / 450.;
1703 destRect.w = (int)game.distanceCovered;
1704 SDL_FillRect(screen, &destRect, red);
1705
1706 if (game.distanceCovered >= screen->w - 350)
1707 {
1708 game.stationedPlanet = game.destinationPlanet;
1709 game.distanceCovered = 0;
1710 player.shield = player.maxShield;
1711 /// Retain "%s" as-is. It is replaced with the name of the planet
1712 /// the player's destination is currently set to.
1713 snprintf(string, STRMAX_SHORT, _("Stationed At: %s"),
1714 intermission_planets[game.stationedPlanet].name);
1715 gfx_createTextObject(TS_CURRENT_PLANET, string, 90, 0, FONT_WHITE);
1716 section = 1;
1717 redrawBackground = 1;
1718 save(0);
1719 }
1720 else if (interceptionChance > 0)
1721 {
1722 if (CHANCE(interceptionChance))
1723 {
1724 game.area = MISN_INTERCEPTION;
1725 rtn = 2;
1726 engine.done = ENGINE_CLOSING;
1727 }
1728 }
1729
1730 break;
1731 }
1732
1733 screen_addBuffer(screen->w / 2 - 100, screen->h - 25, 200, 15);
1734
1735 if (section != 8)
1736 {
1737 x = screen->w / 16;
1738 y = screen->h - 80;
1739 w = screen->w - 2 * x - 32;
1740 if ((game.stationedPlanet == game.destinationPlanet)
1741 && (!intermission_planets[game.stationedPlanet].missionCompleted))
1742 screen_blit(gfx_sprites[SP_START_MISSION], x, y);
1743 else if (game.stationedPlanet != game.destinationPlanet)
1744 screen_blit(gfx_sprites[SP_GOTO], x, y);
1745
1746 screen_blit(gfx_sprites[SP_MAP], x + w / 7, y);
1747 screen_blit(gfx_sprites[SP_STATUS], x + 2 * w / 7, y);
1748 screen_blit(gfx_sprites[SP_SAVE], x + 3 * w / 7, y);
1749 screen_blit(gfx_sprites[SP_SHOP], x + 4 * w / 7, y);
1750 screen_blit(gfx_sprites[SP_COMM], x + 5 * w / 7, y);
1751 screen_blit(gfx_sprites[SP_OPTIONS], x + 6 * w / 7, y);
1752 screen_blit(gfx_sprites[SP_EXIT], x + w, y);
1753
1754 if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x, y, 32, 32)
1755 && ((game.stationedPlanet != game.destinationPlanet)
1756 || (!intermission_planets[game.stationedPlanet].missionCompleted)))
1757 {
1758 if (game.stationedPlanet == game.destinationPlanet)
1759 screen_blitText(TS_INFO_START_MISSION, -1, screen->h - 25);
1760 else
1761 screen_blitText(TS_INFO_GOTO, -1, screen->h - 25);
1762
1763 if ((engine.keyState[KEY_FIRE]))
1764 {
1765 redrawBackground = 1;
1766 section = 0;
1767 engine.keyState[KEY_FIRE] = 0;
1768 }
1769 }
1770 else if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + w / 7, y, 32, 32))
1771 {
1772 screen_blitText(TS_INFO_MAP, -1, screen->h - 25);
1773
1774 if ((engine.keyState[KEY_FIRE]))
1775 {
1776 redrawBackground = 1;
1777 section = 1;
1778 engine.keyState[KEY_FIRE] = 0;
1779 }
1780 }
1781 else if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + 2 * w / 7, y, 32, 32))
1782 {
1783 screen_blitText(TS_INFO_STATUS, -1, screen->h - 25);
1784
1785 if ((engine.keyState[KEY_FIRE]))
1786 {
1787 redrawBackground = 1;
1788 section = 2;
1789 engine.keyState[KEY_FIRE] = 0;
1790 }
1791 }
1792 else if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + 3 * w / 7, y, 32, 32))
1793 {
1794 screen_blitText(TS_INFO_SAVE_GAME, -1, screen->h - 25);
1795
1796 if ((engine.keyState[KEY_FIRE]))
1797 {
1798 redrawBackground = 1;
1799 section = 3;
1800 engine.keyState[KEY_FIRE] = 0;
1801 }
1802 }
1803 else if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + 4 * w / 7, y, 32, 32))
1804 {
1805 screen_blitText(TS_INFO_SHOP, -1, screen->h - 25);
1806
1807 if ((engine.keyState[KEY_FIRE]))
1808 {
1809 redrawBackground = 1;
1810 section = 4;
1811 engine.keyState[KEY_FIRE] = 0;
1812 }
1813 }
1814 else if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + 5 * w / 7, y, 32, 32))
1815 {
1816 screen_blitText(TS_INFO_COMMS, -1, screen->h - 25);
1817
1818 if ((engine.keyState[KEY_FIRE]))
1819 {
1820 redrawBackground = 1;
1821 section = 5;
1822 intermission_createCommsSurface(commsSurface);
1823 engine.keyState[KEY_FIRE] = 0;
1824 }
1825 }
1826 else if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + 6 * w / 7, y, 32, 32))
1827 {
1828 screen_blitText(TS_INFO_OPTIONS, -1, screen->h - 25);
1829
1830 if ((engine.keyState[KEY_FIRE]))
1831 {
1832 redrawBackground = 1;
1833 section = 6;
1834 engine.keyState[KEY_FIRE] = 0;
1835 }
1836 }
1837 else if (game_collision(engine.cursor_x + 13, engine.cursor_y + 13, 6, 6, x + w, y, 32, 32))
1838 {
1839 screen_blitText(TS_INFO_EXIT, -1, screen->h - 25);
1840
1841 if ((engine.keyState[KEY_FIRE]))
1842 {
1843 redrawBackground = 1;
1844 section = 7;
1845 engine.keyState[KEY_FIRE] = 0;
1846 }
1847 }
1848 }
1849
1850 engine.keyState[KEY_FIRE] = 0;
1851 engine.keyState[KEY_ALTFIRE] = 0;
1852 intermission_doCursor();
1853
1854 game_delayFrame();
1855 }
1856
1857 audio_haltMusic();
1858 SDL_FreeSurface(statsSurface);
1859 SDL_FreeSurface(savesSurface);
1860 SDL_FreeSurface(optionsSurface);
1861 SDL_FreeSurface(commsSurface);
1862
1863 if (game.distanceCovered == 0)
1864 player.shield = player.maxShield;
1865
1866 return rtn;
1867 }
1868
1869