| 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 | #include <stdlib.h> |
| 16 | |
| 17 | #include "config.h" |
| 18 | #include "elite.h" |
| 19 | #include "vector.h" |
| 20 | #include "planet.h" |
| 21 | #include "shipdata.h" |
| 22 | |
| 23 | |
| 24 | struct galaxy_seed docked_planet; |
| 25 | |
| 26 | struct galaxy_seed hyperspace_planet; |
| 27 | |
| 28 | struct planet_data current_planet_data; |
| 29 | |
| 30 | int curr_galaxy_num = 1; |
| 31 | int curr_fuel = 70; |
| 32 | int carry_flag = 0; |
| 33 | int current_screen = 0; |
| 34 | int witchspace; |
| 35 | |
| 36 | int wireframe = 0; |
| 37 | int anti_alias_gfx = 0; |
| 38 | int hoopy_casinos = 0; |
| 39 | int speed_cap = 75; |
| 40 | int instant_dock = 0; |
| 41 | |
| 42 | |
| 43 | char scanner_filename[256]; |
| 44 | int scanner_cx; |
| 45 | int scanner_cy; |
| 46 | int compass_centre_x; |
| 47 | int compass_centre_y; |
| 48 | |
| 49 | int planet_render_style = 0; |
| 50 | |
| 51 | int game_over; |
| 52 | int docked; |
| 53 | int finish; |
| 54 | int flight_speed; |
| 55 | int flight_roll; |
| 56 | int flight_climb; |
| 57 | int front_shield; |
| 58 | int aft_shield; |
| 59 | int energy; |
| 60 | int laser_temp; |
| 61 | int detonate_bomb; |
| 62 | int auto_pilot; |
| 63 | int prefer_window; |
| 64 | int condition_x, condition_y, condition_r; |
| 65 | int zoom_x, zoom_y; |
| 66 | |
| 67 | int condition = COND_DOCKED; |
| 68 | |
| 69 | struct commander saved_cmdr = |
| 70 | { |
| 71 | "JAMESON", /* Name */ |
| 72 | 0, /* Mission Number */ |
| 73 | 0x14,0xAD, /* Ship X,Y */ |
| 74 | {0x4a, 0x5a, 0x48, 0x02, 0x53, 0xb7}, /* Galaxy Seed */ |
| 75 | 1000, /* Credits * 10 */ |
| 76 | 70, /* Fuel * 10 */ |
| 77 | 0, |
| 78 | 0, /* Galaxy - 1 */ |
| 79 | PULSE_LASER, /* Front Laser */ |
| 80 | 0, /* Rear Laser */ |
| 81 | 0, /* Left Laser */ |
| 82 | 0, /* Right Laser */ |
| 83 | 0, 0, |
| 84 | 20, /* Cargo Capacity */ |
| 85 | {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, /* Current Cargo */ |
| 86 | 0, /* ECM */ |
| 87 | 0, /* Fuel Scoop */ |
| 88 | 0, /* Energy Bomb */ |
| 89 | 0, /* Energy Unit */ |
| 90 | 0, /* Docking Computer */ |
| 91 | 0, /* Galactic H'Drive */ |
| 92 | 0, /* Escape Pod */ |
| 93 | 0,0,0,0, |
| 94 | 3, /* No. of Missiles */ |
| 95 | 0, /* Legal Status */ |
| 96 | {0x10, 0x0F, 0x11, 0x00, 0x03, 0x1C, /* Station Stock */ |
| 97 | 0x0E, 0x00, 0x00, 0x0A, 0x00, 0x11, |
| 98 | 0x3A, 0x07, 0x09, 0x08, 0x00}, |
| 99 | 0, /* Fluctuation */ |
| 100 | 0, /* Score */ |
| 101 | 0x80 /* Saved */ |
| 102 | }; |
| 103 | |
| 104 | struct commander cmdr; |
| 105 | |
| 106 | struct player_ship myship; |
| 107 | |
| 108 | |
| 109 | struct ship_data *ship_list[NO_OF_SHIPS + 1] = |
| 110 | { |
| 111 | NULL, |
| 112 | &missile_data, |
| 113 | &coriolis_data, |
| 114 | &esccaps_data, |
| 115 | &alloy_data, |
| 116 | &cargo_data, |
| 117 | &boulder_data, |
| 118 | &asteroid_data, |
| 119 | &rock_data, |
| 120 | &orbit_data, |
| 121 | &transp_data, |
| 122 | &cobra3a_data, |
| 123 | &pythona_data, |
| 124 | &boa_data, |
| 125 | &anacnda_data, |
| 126 | &hermit_data, |
| 127 | &viper_data, |
| 128 | &sidewnd_data, |
| 129 | &mamba_data, |
| 130 | &krait_data, |
| 131 | &adder_data, |
| 132 | &gecko_data, |
| 133 | &cobra1_data, |
| 134 | &worm_data, |
| 135 | &cobra3b_data, |
| 136 | &asp2_data, |
| 137 | &pythonb_data, |
| 138 | &ferdlce_data, |
| 139 | &moray_data, |
| 140 | &thargoid_data, |
| 141 | &thargon_data, |
| 142 | &constrct_data, |
| 143 | &cougar_data, |
| 144 | &dodec_data |
| 145 | }; |
| 146 | |
| 147 | |
| 148 | |
| 149 | void restore_saved_commander (void) |
| 150 | { |
| 151 | cmdr = saved_cmdr; |
| 152 | |
| 153 | docked_planet = find_planet (cmdr.ship_x, cmdr.ship_y); |
| 154 | hyperspace_planet = docked_planet; |
| 155 | |
| 156 | generate_planet_data (¤t_planet_data, docked_planet); |
| 157 | generate_stock_market (); |
| 158 | set_stock_quantities (cmdr.station_stock); |
| 159 | } |
| 160 | |