| 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 | |
| 35 | char *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 | |
| 43 | char *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 | |
| 51 | char *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 | |
| 59 | char *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 | |
| 63 | char *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 | |
| 79 | char *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 | |
| 85 | char *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 | |
| 91 | char *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 | |
| 98 | char *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 | |
| 106 | char *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 | |
| 181 | void 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; |
| 205 | |
| 206 | do |
| 207 | { |
| 208 | gfx_clear_area (310, 50, 510, 180); |
| 209 | update_universe (); |
| 210 | universe[0].location.z = 600; |
| 211 | gfx_update_screen(); |
| 212 | kbd_poll_keyboard(); |
| 213 | } while (!kbd_space_pressed); |
| 214 | } |
| 215 | |
| 216 | |
| 217 | void constrictor_mission_debrief (void) |
| 218 | { |
| 219 | int keyasc; |
| 220 | |
| 221 | cmdr.mission = 3; |
| 222 | cmdr.score += 256; |
| 223 | cmdr.credits += 50000; |
| 224 | |
| 225 | gfx_clear_display(); |
| 226 | gfx_display_centre_text (10, "INCOMING MESSAGE", 140, GFX_COL_GOLD); |
| 227 | gfx_draw_line (0, 36, 511, 36); |
| 228 | |
| 229 | gfx_display_centre_text (100, "Congratulations Commander!", 140, GFX_COL_GOLD); |
| 230 | |
| 231 | gfx_display_pretty_text (116, 132, 400, 384, mission1_debrief); |
| 232 | |
| 233 | gfx_display_centre_text (330, "Press space to continue.", 140, GFX_COL_GOLD); |
| 234 | |
| 235 | gfx_update_screen(); |
| 236 | |
| 237 | do |
| 238 | { |
| 239 | keyasc = kbd_read_key(); |
| 240 | } while (keyasc != ' '); |
| 241 | } |
| 242 | |
| 243 | |
| 244 | void thargoid_mission_first_brief (void) |
| 245 | { |
| 246 | int keyasc; |
| 247 | |
| 248 | cmdr.mission = 4; |
| 249 | |
| 250 | gfx_clear_display(); |
| 251 | gfx_display_centre_text (10, "INCOMING MESSAGE", 140, GFX_COL_GOLD); |
| 252 | gfx_draw_line (0, 36, 511, 36); |
| 253 | |
| 254 | gfx_display_pretty_text (116, 132, 400, 384, mission2_brief_a); |
| 255 | |
| 256 | gfx_display_centre_text (330, "Press space to continue.", 140, GFX_COL_GOLD); |
| 257 | |
| 258 | gfx_update_screen(); |
| 259 | |
| 260 | do |
| 261 | { |
| 262 | keyasc = kbd_read_key(); |
| 263 | } while (keyasc != ' '); |
| 264 | } |
| 265 | |
| 266 | |
| 267 | void thargoid_mission_second_brief (void) |
| 268 | { |
| 269 | int keyasc; |
| 270 | |
| 271 | cmdr.mission = 5; |
| 272 | |
| 273 | gfx_clear_display(); |
| 274 | gfx_display_centre_text (10, "INCOMING MESSAGE", 140, GFX_COL_GOLD); |
| 275 | gfx_draw_line (0, 36, 511, 36); |
| 276 | |
| 277 | gfx_display_pretty_text (16, 50, 300, 384, mission2_brief_b); |
| 278 | gfx_display_pretty_text (16, 200, 470, 384, mission2_brief_c); |
| 279 | |
| 280 | gfx_draw_sprite (IMG_BLAKE, 352, 46); |
| 281 | |
| 282 | gfx_display_centre_text (330, "Press space to continue.", 140, GFX_COL_GOLD); |
| 283 | |
| 284 | gfx_update_screen(); |
| 285 | |
| 286 | do |
| 287 | { |
| 288 | keyasc = kbd_read_key(); |
| 289 | } while (keyasc != ' '); |
| 290 | } |
| 291 | |
| 292 | |
| 293 | void thargoid_mission_debrief (void) |
| 294 | { |
| 295 | int keyasc; |
| 296 | |
| 297 | cmdr.mission = 6; |
| 298 | cmdr.score += 256; |
| 299 | cmdr.energy_unit = 2; |
| 300 | |
| 301 | gfx_clear_display (); |
| 302 | gfx_display_centre_text (10, "INCOMING MESSAGE", 140, GFX_COL_GOLD); |
| 303 | gfx_draw_line (0, 36, 511, 36); |
| 304 | |
| 305 | gfx_display_centre_text (100, "Well done Commander.", 140, GFX_COL_GOLD); |
| 306 | |
| 307 | gfx_display_pretty_text (116, 132, 400, 384, mission2_debrief); |
| 308 | |
| 309 | gfx_display_centre_text (330, "Press space to continue.", 140, GFX_COL_GOLD); |
| 310 | |
| 311 | gfx_update_screen(); |
| 312 | |
| 313 | do |
| 314 | { |
| 315 | keyasc = kbd_read_key(); |
| 316 | } while (keyasc != ' '); |
| 317 | } |
| 318 | |
| 319 | |
| 320 | |
| 321 | void check_mission_brief (void) |
| 322 | { |
| 323 | if ((cmdr.mission == 0) && (cmdr.score >= 256) && (cmdr.galaxy_number < 2)) |
| 324 | { |
| 325 | constrictor_mission_brief(); |
| 326 | return; |
| 327 | } |
| 328 | |
| 329 | if (cmdr.mission == 2) |
| 330 | { |
| 331 | constrictor_mission_debrief(); |
| 332 | return; |
| 333 | } |
| 334 | |
| 335 | if ((cmdr.mission == 3) && (cmdr.score >= 1280) && (cmdr.galaxy_number == 2)) |
| 336 | { |
| 337 | thargoid_mission_first_brief(); |
| 338 | return; |
| 339 | } |
| 340 | |
| 341 | if ((cmdr.mission == 4) && (docked_planet.d == 215) && (docked_planet.b == 84)) |
| 342 | { |
| 343 | thargoid_mission_second_brief(); |
| 344 | return; |
| 345 | } |
| 346 | |
| 347 | if ((cmdr.mission == 5) && (docked_planet.d == 63) && (docked_planet.b == 72)) |
| 348 | { |
| 349 | thargoid_mission_debrief(); |
| 350 | return; |
| 351 | } |
| 352 | } |
| 353 | |