chiark / gitweb /
Proper Subversion configuration.
[newkind] / missions.c
CommitLineData
84bbd123 1/*
2 * Elite - The New Kind.
3 *
4 * Reverse engineered from the BBC disk version of Elite.
5 * Additional material by C.J.Pinder.
6 *
7 * The original Elite code is (C) I.Bell & D.Braben 1984.
8 * This version re-engineered in C by C.J.Pinder 1999-2001.
9 *
10 * email: <christian@newkind.co.uk>
11 *
12 *
13 */
14
15/*
16 * missions.c
17 *
18 * Code to handle the special missions.
19 */
20
21#include <stdlib.h>
22#include <string.h>
23
24#include "config.h"
25#include "elite.h"
26#include "gfx.h"
27#include "vector.h"
28#include "space.h"
29#include "planet.h"
30#include "main.h"
31#include "missions.h"
32#include "keyboard.h"
33
34
35char *mission1_brief_a =
36 "Greetings Commander, I am Captain Curruthers of "
37 "Her Majesty's Space Navy and I beg a moment of your "
38 "valuable time. We would like you to do a little job "
39 "for us. The ship you see here is a new model, the "
40 "Constrictor, equiped with a top secret new shield "
41 "generator. Unfortunately it's been stolen.";
42
43char *mission1_brief_b =
44 "It went missing from our ship yard on Xeer five months ago "
45 "and was last seen at Reesdice. Your mission should you decide "
46 "to accept it, is to seek and destroy this ship. You are "
47 "cautioned that only Military Lasers will get through the new "
48 "shields and that the Constrictor is fitted with an E.C.M. "
49 "System. Good Luck, Commander. ---MESSAGE ENDS.";
50
51char *mission1_brief_c =
52 "It went missing from our ship yard on Xeer five months ago "
53 "and is believed to have jumped to this galaxy. "
54 "Your mission should you decide to accept it, is to seek and "
55 "destroy this ship. You are cautioned that only Military Lasers "
56 "will get through the new shields and that the Constrictor is "
57 "fitted with an E.C.M. System. Good Luck, Commander. ---MESSAGE ENDS.";
58
59char *mission1_debrief =
60 "There will always be a place for you in Her Majesty's Space Navy. "
61 "And maybe sooner than you think... ---MESSAGE ENDS.";
62
63char *mission1_pdesc[] =
64{
65 "THE CONSTRICTOR WAS LAST SEEN AT REESDICE, COMMANDER.",
66 "A STRANGE LOOKING SHIP LEFT HERE A WHILE BACK. LOOKED BOUND FOR AREXE.",
67 "YEP, AN UNUSUAL NEW SHIP HAD A GALACTIC HYPERDRIVE FITTED HERE, USED IT TOO.",
68 "I HEAR A WEIRD LOOKING SHIP WAS SEEN AT ERRIUS.",
69 "THIS STRANGE SHIP DEHYPED HERE FROM NOWHERE, SUN SKIMMED AND JUMPED. I HEAR IT WENT TO INBIBE.",
70 "ROGUE SHIP WENT FOR ME AT AUSAR. MY LASERS DIDN'T EVEN SCRATCH ITS HULL.",
71 "OH DEAR ME YES. A FRIGHTFUL ROGUE WITH WHAT I BELIEVE YOU PEOPLE CALL A LEAD "
72 "POSTERIOR SHOT UP LOTS OF THOSE BEASTLY PIRATES AND WENT TO USLERI.",
73 "YOU CAN TACKLE THE VICIOUS SCOUNDREL IF YOU LIKE. HE'S AT ORARRA.",
74 "THERE'S A REAL DEADLY PIRATE OUT THERE.",
75 "BOY ARE YOU IN THE WRONG GALAXY!",
76 "COMING SOON: ELITE - DARKNESS FALLS.",
77};
78
79char *mission2_brief_a =
80 "Attention Commander, I am Captain Fortesque of Her Majesty's Space Navy. "
81 "We have need of your services again. If you would be so good as to go to "
82 "Ceerdi you will be briefed.If succesful, you will be rewarded."
83 "---MESSAGE ENDS.";
84
85char *mission2_brief_b =
86 "Good Day Commander. I am Agent Blake of Naval Intelligence. As you know, "
87 "the Navy have been keeping the Thargoids off your ass out in deep space "
88 "for many years now. Well the situation has changed. Our boys are ready "
89 "for a push right to the home system of those murderers.";
90
91char *mission2_brief_c =
92 "I have obtained the defence plans for their Hive Worlds. The beetles "
93 "know we've got something but not what. If I transmit the plans to our "
94 "base on Birera they'll intercept the transmission. I need a ship to "
95 "make the run. You're elected. The plans are unipulse coded within "
96 "this transmission. You will be paid. Good luck Commander. ---MESSAGE ENDS.";
97
98char *mission2_debrief =
99 "You have served us well and we shall remember. "
100 "We did not expect the Thargoids to find out about you."
101 "For the moment please accept this Navy Extra Energy Unit as payment. "
102 "---MESSAGE ENDS.";
103
104
105
106char *mission_planet_desc (struct galaxy_seed planet)
107{
108 int pnum;
109
110 if (!docked)
111 return NULL;
112
113 if ((planet.a != docked_planet.a) ||
114 (planet.b != docked_planet.b) ||
115 (planet.c != docked_planet.c) ||
116 (planet.d != docked_planet.d) ||
117 (planet.e != docked_planet.e) ||
118 (planet.f != docked_planet.f))
119 return NULL;
120
121 pnum = find_planet_number (planet);
122
123 if (cmdr.galaxy_number == 0)
124 {
125 switch (pnum)
126 {
127 case 150:
128 return mission1_pdesc[0];
129
130 case 36:
131 return mission1_pdesc[1];
132
133 case 28:
134 return mission1_pdesc[2];
135 }
136 }
137
138 if (cmdr.galaxy_number == 1)
139 {
140 switch (pnum)
141 {
142 case 32:
143 case 68:
144 case 164:
145 case 220:
146 case 106:
147 case 16:
148 case 162:
149 case 3:
150 case 107:
151 case 26:
152 case 192:
153 case 184:
154 case 5:
155 return mission1_pdesc[3];
156
157 case 253:
158 return mission1_pdesc[4];
159
160 case 79:
161 return mission1_pdesc[5];
162
163 case 53:
164 return mission1_pdesc[6];
165
166 case 118:
167 return mission1_pdesc[7];
168
169 case 193:
170 return mission1_pdesc[8];
171 }
172 }
173
174 if ((cmdr.galaxy_number == 2) && (pnum == 101))
175 return mission1_pdesc[9];
176
177 return NULL;
178}
179
180
181void constrictor_mission_brief (void)
182{
183 Matrix rotmat;
184
185 cmdr.mission = 1;
186
187 current_screen = SCR_FRONT_VIEW;
188
189 gfx_clear_display();
190 gfx_display_centre_text (10, "INCOMING MESSAGE", 140, GFX_COL_GOLD);
191 gfx_draw_line (0, 36, 511, 36);
192
193 gfx_display_pretty_text (16, 50, 300, 384, mission1_brief_a);
194 gfx_display_pretty_text (16, 200, 470, 384,
195 (cmdr.galaxy_number == 0) ? mission1_brief_b : mission1_brief_c);
196
197 gfx_display_centre_text (330, "Press space to continue.", 140, GFX_COL_GOLD);
198
199 clear_universe();
200 set_init_matrix (rotmat);
201 add_new_ship (SHIP_CONSTRICTOR, 200, 90, 600, rotmat, -127, -127);
202 flight_roll = 0;
203 flight_climb = 0;
204 flight_speed = 0;
40471f00 205#ifdef HACKING
1a8abebd 206 identify = 0;
40471f00 207#endif
84bbd123 208
209 do
210 {
211 gfx_clear_area (310, 50, 510, 180);
212 update_universe ();
213 universe[0].location.z = 600;
214 gfx_update_screen();
215 kbd_poll_keyboard();
216 } while (!kbd_space_pressed);
217}
218
219
220void constrictor_mission_debrief (void)
221{
222 int keyasc;
223
224 cmdr.mission = 3;
225 cmdr.score += 256;
226 cmdr.credits += 50000;
227
228 gfx_clear_display();
229 gfx_display_centre_text (10, "INCOMING MESSAGE", 140, GFX_COL_GOLD);
230 gfx_draw_line (0, 36, 511, 36);
231
232 gfx_display_centre_text (100, "Congratulations Commander!", 140, GFX_COL_GOLD);
233
234 gfx_display_pretty_text (116, 132, 400, 384, mission1_debrief);
235
236 gfx_display_centre_text (330, "Press space to continue.", 140, GFX_COL_GOLD);
237
238 gfx_update_screen();
239
240 do
241 {
242 keyasc = kbd_read_key();
243 } while (keyasc != ' ');
244}
245
246
247void thargoid_mission_first_brief (void)
248{
249 int keyasc;
250
251 cmdr.mission = 4;
252
253 gfx_clear_display();
254 gfx_display_centre_text (10, "INCOMING MESSAGE", 140, GFX_COL_GOLD);
255 gfx_draw_line (0, 36, 511, 36);
256
257 gfx_display_pretty_text (116, 132, 400, 384, mission2_brief_a);
258
259 gfx_display_centre_text (330, "Press space to continue.", 140, GFX_COL_GOLD);
260
261 gfx_update_screen();
262
263 do
264 {
265 keyasc = kbd_read_key();
266 } while (keyasc != ' ');
267}
268
269
270void thargoid_mission_second_brief (void)
271{
272 int keyasc;
273
274 cmdr.mission = 5;
275
276 gfx_clear_display();
277 gfx_display_centre_text (10, "INCOMING MESSAGE", 140, GFX_COL_GOLD);
278 gfx_draw_line (0, 36, 511, 36);
279
280 gfx_display_pretty_text (16, 50, 300, 384, mission2_brief_b);
281 gfx_display_pretty_text (16, 200, 470, 384, mission2_brief_c);
282
283 gfx_draw_sprite (IMG_BLAKE, 352, 46);
284
285 gfx_display_centre_text (330, "Press space to continue.", 140, GFX_COL_GOLD);
286
287 gfx_update_screen();
288
289 do
290 {
291 keyasc = kbd_read_key();
292 } while (keyasc != ' ');
293}
294
295
296void thargoid_mission_debrief (void)
297{
298 int keyasc;
299
300 cmdr.mission = 6;
301 cmdr.score += 256;
302 cmdr.energy_unit = 2;
303
304 gfx_clear_display ();
305 gfx_display_centre_text (10, "INCOMING MESSAGE", 140, GFX_COL_GOLD);
306 gfx_draw_line (0, 36, 511, 36);
307
308 gfx_display_centre_text (100, "Well done Commander.", 140, GFX_COL_GOLD);
309
310 gfx_display_pretty_text (116, 132, 400, 384, mission2_debrief);
311
312 gfx_display_centre_text (330, "Press space to continue.", 140, GFX_COL_GOLD);
313
314 gfx_update_screen();
315
316 do
317 {
318 keyasc = kbd_read_key();
319 } while (keyasc != ' ');
320}
321
322
323
324void check_mission_brief (void)
325{
326 if ((cmdr.mission == 0) && (cmdr.score >= 256) && (cmdr.galaxy_number < 2))
327 {
328 constrictor_mission_brief();
329 return;
330 }
331
332 if (cmdr.mission == 2)
333 {
334 constrictor_mission_debrief();
335 return;
336 }
337
338 if ((cmdr.mission == 3) && (cmdr.score >= 1280) && (cmdr.galaxy_number == 2))
339 {
340 thargoid_mission_first_brief();
341 return;
342 }
343
344 if ((cmdr.mission == 4) && (docked_planet.d == 215) && (docked_planet.b == 84))
345 {
346 thargoid_mission_second_brief();
347 return;
348 }
349
350 if ((cmdr.mission == 5) && (docked_planet.d == 63) && (docked_planet.b == 72))
351 {
352 thargoid_mission_debrief();
353 return;
354 }
355}
356