2 * Elite - The New Kind.
4 * Reverse engineered from the BBC disk version of Elite.
5 * Additional material by C.J.Pinder.
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.
10 * email: <christian@newkind.co.uk>
30 static int hilite_item
;
33 #define NUM_SETTINGS 7
35 #define OPTION_BAR_WIDTH (400)
36 #define OPTION_BAR_HEIGHT (15)
44 static struct option option_list
[NUM_OPTIONS
] =
46 {"Save Commander", 1},
47 {"Load Commander", 1},
59 static struct setting setting_list
[NUM_SETTINGS
] =
61 {"Graphics:", {"Solid", "Wireframe", "", "", ""}},
62 {"Anti Alias:", {"Off", "On", "", "", ""}},
63 {"Planet Style:", {"Wireframe", "Green", "SNES", "Fractal", ""}},
64 {"Planet Desc.:", {"BBC", "MSX", "", "", ""}},
65 {"Instant Dock:", {"Off", "On", "", "", ""}},
66 {"Remap Keys:", {"Off", "On", "", "", ""}},
67 {"Save Settings", {"", "", "", "", ""}}
71 void quit_screen (void)
73 current_screen
= SCR_QUIT
;
76 gfx_display_centre_text (10, "GAME OPTIONS", 140, GFX_COL_GOLD
);
77 gfx_draw_line (0, 36, 511, 36);
79 gfx_display_centre_text (175, "QUIT GAME (Y/N)?", 140, GFX_COL_GOLD
);
83 void restart_screen(void)
85 current_screen
= SCR_RESTART
;
88 gfx_display_centre_text (10, "GAME OPTIONS", 140, GFX_COL_GOLD
);
89 gfx_draw_line (0, 36, 511, 36);
91 gfx_display_centre_text (175, "RESTART GAME (Y/N)?", 140, GFX_COL_GOLD
);
95 void display_setting_item (int item
)
100 if (item
== (NUM_SETTINGS
- 1))
102 y
= ((NUM_SETTINGS
+ 1) / 2) * 30 + 96 + 32;
103 gfx_display_centre_text (y
, setting_list
[item
].name
, 120, GFX_COL_WHITE
);
118 v
= planet_render_style
;
138 x
= (item
& 1) * 250 + 32;
139 y
= (item
/ 2) * 30 + 96;
141 gfx_display_colour_text (x
, y
, setting_list
[item
].name
, GFX_COL_WHITE
);
142 gfx_display_colour_text (x
+ 120, y
, setting_list
[item
].value
[v
], GFX_COL_WHITE
);
146 void highlight_setting (int item
)
151 if ((hilite_item
!= -1) && (hilite_item
!= item
))
153 if (hilite_item
== (NUM_SETTINGS
- 1))
155 x
= GFX_X_CENTRE
- (OPTION_BAR_WIDTH
/ 2);
156 y
= ((NUM_SETTINGS
+ 1) / 2) * 30 + 96 + 32;
157 width
= OPTION_BAR_WIDTH
;
161 x
= (hilite_item
& 1) * 250 + 32 + 120;
162 y
= (hilite_item
/ 2) * 30 + 96;
166 gfx_clear_area (x
, y
, x
+ width
, y
+ OPTION_BAR_HEIGHT
);
167 display_setting_item (hilite_item
);
170 if (item
== (NUM_SETTINGS
- 1))
172 x
= GFX_X_CENTRE
- (OPTION_BAR_WIDTH
/ 2);
173 y
= ((NUM_SETTINGS
+ 1) / 2) * 30 + 96 + 32;
174 width
= OPTION_BAR_WIDTH
;
178 x
= (item
& 1) * 250 + 32 + 120;
179 y
= (item
/ 2) * 30 + 96;
183 gfx_draw_rectangle (x
, y
, x
+ width
, y
+ OPTION_BAR_HEIGHT
, GFX_COL_DARK_RED
);
184 display_setting_item (item
);
190 void select_left_setting (void)
192 if ((hilite_item
& 1) != 0)
193 highlight_setting (hilite_item
- 1);
196 void select_right_setting (void)
198 if (((hilite_item
& 1) == 0) && (hilite_item
< (NUM_SETTINGS
- 1)))
199 highlight_setting (hilite_item
+ 1);
203 void select_up_setting (void)
205 if (hilite_item
== (NUM_SETTINGS
- 1))
207 highlight_setting (NUM_SETTINGS
- 2);
212 highlight_setting (hilite_item
- 2);
216 void select_down_setting (void)
218 if (hilite_item
== (NUM_SETTINGS
- 2))
220 highlight_setting (NUM_SETTINGS
- 1);
224 if (hilite_item
< (NUM_SETTINGS
- 2))
225 highlight_setting (hilite_item
+ 2);
228 void toggle_setting (void)
230 if (hilite_item
== (NUM_SETTINGS
- 1))
248 planet_render_style
= (planet_render_style
+ 1) % 4;
264 highlight_setting (hilite_item
);
268 void game_settings_screen (void)
272 current_screen
= SCR_SETTINGS
;
275 gfx_display_centre_text (10, "GAME SETTINGS", 140, GFX_COL_GOLD
);
276 gfx_draw_line (0, 36, 511, 36);
278 for (i
= 0; i
< NUM_SETTINGS
; i
++)
280 display_setting_item (i
);
284 highlight_setting (0);
288 void display_option_item (int i
)
293 y
= (384 - (30 * NUM_OPTIONS
)) / 2;
295 col
= ((!docked
) && option_list
[i
].docked_only
) ? GFX_COL_GREY_1
: GFX_COL_WHITE
;
297 gfx_display_centre_text (y
, option_list
[i
].text
, 120, col
);
301 void highlight_option (int i
)
306 if ((hilite_item
!= -1) && (hilite_item
!= i
))
308 x
= GFX_X_CENTRE
- (OPTION_BAR_WIDTH
/ 2);
309 y
= (384 - (30 * NUM_OPTIONS
)) / 2;
310 y
+= hilite_item
* 30;
311 gfx_clear_area (x
, y
, x
+ OPTION_BAR_WIDTH
, y
+ OPTION_BAR_HEIGHT
);
312 display_option_item (hilite_item
);
315 x
= GFX_X_CENTRE
- (OPTION_BAR_WIDTH
/ 2);
316 y
= (384 - (30 * NUM_OPTIONS
)) / 2;
319 gfx_draw_rectangle (x
, y
, x
+ OPTION_BAR_WIDTH
, y
+ OPTION_BAR_HEIGHT
,
321 display_option_item (i
);
326 void select_previous_option (void)
329 highlight_option (hilite_item
- 1);
332 void select_next_option (void)
334 if (hilite_item
< (NUM_OPTIONS
- 1))
335 highlight_option (hilite_item
+ 1);
339 void do_option (void)
341 if ((!docked
) && option_list
[hilite_item
].docked_only
)
347 save_commander_screen();
351 load_commander_screen();
352 display_commander_status();
356 game_settings_screen();
370 void display_options (void)
374 current_screen
= SCR_OPTIONS
;
377 gfx_display_centre_text (10, "GAME OPTIONS", 140, GFX_COL_GOLD
);
378 gfx_draw_line (0, 36, 511, 36);
379 gfx_display_centre_text (300, "Version: Release 1.0", 120, GFX_COL_WHITE
);
380 gfx_display_centre_text (320, "www.newkind.co.uk", 120, GFX_COL_WHITE
);
381 gfx_display_centre_text (340, "Written by Christian Pinder 1999-2001", 120, GFX_COL_WHITE
);
382 gfx_display_centre_text (360, "Based on original code by Ian Bell & David Braben", 120, GFX_COL_WHITE
);
384 for (i
= 0; i
< NUM_OPTIONS
; i
++)
385 display_option_item (i
);
388 highlight_option (0);