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