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 6
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},
58 static struct setting setting_list
[NUM_SETTINGS
] =
60 {"Graphics:", {"Solid", "Wireframe", "", "", ""}},
61 {"Anti Alias:", {"Off", "On", "", "", ""}},
62 {"Planet Style:", {"Wireframe", "Green", "SNES", "Fractal", ""}},
63 {"Planet Desc.:", {"BBC", "MSX", "", "", ""}},
64 {"Instant Dock:", {"Off", "On", "", "", ""}},
65 {"Save Settings", {"", "", "", "", ""}}
69 void quit_screen (void)
71 current_screen
= SCR_QUIT
;
74 gfx_display_centre_text (10, "GAME OPTIONS", 140, GFX_COL_GOLD
);
75 gfx_draw_line (0, 36, 511, 36);
77 gfx_display_centre_text (175, "QUIT GAME (Y/N)?", 140, GFX_COL_GOLD
);
84 void display_setting_item (int item
)
89 if (item
== (NUM_SETTINGS
- 1))
91 y
= ((NUM_SETTINGS
+ 1) / 2) * 30 + 96 + 32;
92 gfx_display_centre_text (y
, setting_list
[item
].name
, 120, GFX_COL_WHITE
);
107 v
= planet_render_style
;
123 x
= (item
& 1) * 250 + 32;
124 y
= (item
/ 2) * 30 + 96;
126 gfx_display_colour_text (x
, y
, setting_list
[item
].name
, GFX_COL_WHITE
);
127 gfx_display_colour_text (x
+ 120, y
, setting_list
[item
].value
[v
], GFX_COL_WHITE
);
131 void highlight_setting (int item
)
136 if ((hilite_item
!= -1) && (hilite_item
!= item
))
138 if (hilite_item
== (NUM_SETTINGS
- 1))
140 x
= GFX_X_CENTRE
- (OPTION_BAR_WIDTH
/ 2);
141 y
= ((NUM_SETTINGS
+ 1) / 2) * 30 + 96 + 32;
142 width
= OPTION_BAR_WIDTH
;
146 x
= (hilite_item
& 1) * 250 + 32 + 120;
147 y
= (hilite_item
/ 2) * 30 + 96;
151 gfx_clear_area (x
, y
, x
+ width
, y
+ OPTION_BAR_HEIGHT
);
152 display_setting_item (hilite_item
);
155 if (item
== (NUM_SETTINGS
- 1))
157 x
= GFX_X_CENTRE
- (OPTION_BAR_WIDTH
/ 2);
158 y
= ((NUM_SETTINGS
+ 1) / 2) * 30 + 96 + 32;
159 width
= OPTION_BAR_WIDTH
;
163 x
= (item
& 1) * 250 + 32 + 120;
164 y
= (item
/ 2) * 30 + 96;
168 gfx_draw_rectangle (x
, y
, x
+ width
, y
+ OPTION_BAR_HEIGHT
, GFX_COL_DARK_RED
);
169 display_setting_item (item
);
175 void select_left_setting (void)
177 if ((hilite_item
& 1) != 0)
178 highlight_setting (hilite_item
- 1);
181 void select_right_setting (void)
183 if (((hilite_item
& 1) == 0) && (hilite_item
< (NUM_SETTINGS
- 1)))
184 highlight_setting (hilite_item
+ 1);
188 void select_up_setting (void)
190 if (hilite_item
== (NUM_SETTINGS
- 1))
192 highlight_setting (NUM_SETTINGS
- 2);
197 highlight_setting (hilite_item
- 2);
201 void select_down_setting (void)
203 if (hilite_item
== (NUM_SETTINGS
- 2))
205 highlight_setting (NUM_SETTINGS
- 1);
209 if (hilite_item
< (NUM_SETTINGS
- 2))
210 highlight_setting (hilite_item
+ 2);
213 void toggle_setting (void)
215 if (hilite_item
== (NUM_SETTINGS
- 1))
233 planet_render_style
= (planet_render_style
+ 1) % 4;
245 highlight_setting (hilite_item
);
249 void game_settings_screen (void)
253 current_screen
= SCR_SETTINGS
;
256 gfx_display_centre_text (10, "GAME SETTINGS", 140, GFX_COL_GOLD
);
257 gfx_draw_line (0, 36, 511, 36);
259 for (i
= 0; i
< NUM_SETTINGS
; i
++)
261 display_setting_item (i
);
265 highlight_setting (0);
269 void display_option_item (int i
)
274 y
= (384 - (30 * NUM_OPTIONS
)) / 2;
276 col
= ((!docked
) && option_list
[i
].docked_only
) ? GFX_COL_GREY_1
: GFX_COL_WHITE
;
278 gfx_display_centre_text (y
, option_list
[i
].text
, 120, col
);
282 void highlight_option (int i
)
287 if ((hilite_item
!= -1) && (hilite_item
!= i
))
289 x
= GFX_X_CENTRE
- (OPTION_BAR_WIDTH
/ 2);
290 y
= (384 - (30 * NUM_OPTIONS
)) / 2;
291 y
+= hilite_item
* 30;
292 gfx_clear_area (x
, y
, x
+ OPTION_BAR_WIDTH
, y
+ OPTION_BAR_HEIGHT
);
293 display_option_item (hilite_item
);
296 x
= GFX_X_CENTRE
- (OPTION_BAR_WIDTH
/ 2);
297 y
= (384 - (30 * NUM_OPTIONS
)) / 2;
300 gfx_draw_rectangle (x
, y
, x
+ OPTION_BAR_WIDTH
, y
+ OPTION_BAR_HEIGHT
,
302 display_option_item (i
);
307 void select_previous_option (void)
310 highlight_option (hilite_item
- 1);
313 void select_next_option (void)
315 if (hilite_item
< (NUM_OPTIONS
- 1))
316 highlight_option (hilite_item
+ 1);
320 void do_option (void)
322 if ((!docked
) && option_list
[hilite_item
].docked_only
)
328 save_commander_screen();
332 load_commander_screen();
333 display_commander_status();
337 game_settings_screen();
347 void display_options (void)
351 current_screen
= SCR_OPTIONS
;
354 gfx_display_centre_text (10, "GAME OPTIONS", 140, GFX_COL_GOLD
);
355 gfx_draw_line (0, 36, 511, 36);
356 gfx_display_centre_text (300, "Version: Release 1.0", 120, GFX_COL_WHITE
);
357 gfx_display_centre_text (320, "www.newkind.co.uk", 120, GFX_COL_WHITE
);
358 gfx_display_centre_text (340, "Written by Christian Pinder 1999-2001", 120, GFX_COL_WHITE
);
359 gfx_display_centre_text (360, "Based on original code by Ian Bell & David Braben", 120, GFX_COL_WHITE
);
361 for (i
= 0; i
< NUM_OPTIONS
; i
++)
362 display_option_item (i
);
365 highlight_option (0);