naev 0.11.5
menu.c
1/*
2 * See Licensing and Copyright notice in naev.h
3 */
10#include "physfs.h"
11#include "SDL.h"
12
13#include "naev.h"
16#include "menu.h"
17
18#include "array.h"
19#include "board.h"
20#include "camera.h"
21#include "comm.h"
22#include "conf.h"
23#include "dev_mapedit.h"
24#include "dev_uniedit.h"
25#include "dialogue.h"
26#include "gui.h"
27#include "hook.h"
28#include "info.h"
29#include "intro.h"
30#include "land.h"
31#include "load.h"
32#include "log.h"
33#include "map.h"
34#include "mission.h"
35#include "music.h"
36#include "ndata.h"
37#include "nstring.h"
38#include "ntime.h"
39#include "options.h"
40#include "pause.h"
41#include "pilot.h"
42#include "player.h"
43#include "render.h"
44#include "rng.h"
45#include "save.h"
46#include "space.h"
47#include "start.h"
48#include "safelanes.h"
49#include "tk/toolkit_priv.h" /* Needed for menu_main_resize */
50#include "toolkit.h"
51
52#define MAIN_WIDTH 200
54#define MENU_WIDTH 200
55#define MENU_HEIGHT 250
57#define DEATH_WIDTH 200
58#define DEATH_HEIGHT 200
60#define BUTTON_WIDTH 160
61#define BUTTON_HEIGHT 30
63#define EDITORS_EXTRA_WIDTH 60
65#define menu_Open(f) (menu_open |= (f))
66#define menu_Close(f) (menu_open &= ~(f))
67int menu_open = 0;
68int bg_needs_reset = 1;
70static glTexture *main_naevLogo = NULL;
71static int menu_small_allowsave = 1;
73/*
74 * prototypes
75 */
76/* Generic. */
77static void menu_exit( unsigned int wid, const char *str );
78/* main menu */
79static int menu_main_bkg_system (void);
80static void main_menu_promptClose( unsigned int wid, const char *unused );
81static void menu_main_load( unsigned int wid, const char *str );
82static void menu_main_new( unsigned int wid, const char *str );
83static void menu_main_credits( unsigned int wid, const char *str );
84static void menu_main_cleanBG( unsigned int wid, const char *str );
85/* small menu */
86static void menu_small_load( unsigned int wid, const char *str );
87static void menu_small_resume( unsigned int wid, const char *str );
88static void menu_small_info( unsigned int wid, const char *str );
89static void menu_small_exit( unsigned int wid, const char *str );
90static void exit_game (void);
91/* death menu */
92static void menu_death_continue( unsigned int wid, const char *str );
93static void menu_death_restart( unsigned int wid, const char *str );
94static void menu_death_main( unsigned int wid, const char *str );
95static void menu_death_close( unsigned int wid, const char *str );
96/* editors menu */
97/* - Universe Editor */
98/* - Back to Main Menu */
99static void menu_editors_open( unsigned int wid_unused, const char *unused );
100static void menu_editors_close( unsigned int wid, const char *str );
101/* options button. */
102static void menu_options_button( unsigned int wid, const char *str );
103
104/*
105 * Background system for the menu.
106 */
107static int menu_main_bkg_system (void)
108{
109 if (!bg_needs_reset) {
110 pause_setSpeed( 1. );
111 sound_setSpeed( 1. );
112 return 0;
113 }
114
115 const nsave_t *saves;
116 const char *sys;
117 double cx, cy;
118
119 /* Clean pilots. */
121 sys = NULL;
122
123 load_refresh();
124 saves = load_getList(NULL);
125
126 if (array_size( saves ) > 0) {
127 const nsave_t *ns = &saves[0];
128
129 /* Try to apply unidiff. */
130 load_gameDiff( ns[0].path );
131
132 /* Get start position. */
133 if (spob_exists( ns[0].spob )) {
134 Spob *pnt = spob_get( ns[0].spob );
135 if (pnt != NULL) {
136 sys = spob_getSystem( ns[0].spob );
137 if (sys != NULL) {
138 cx = pnt->pos.x;
139 cy = pnt->pos.y;
140 }
141 }
142 }
143 }
144
145 /* In case save game has no diff. */
148
149 /* Fallback if necessary. */
150 if (sys == NULL) {
151 sys = start_system();
152 start_position( &cx, &cy );
153 }
154
155 /* Have to normalize values by zoom. */
156 cx += SCREEN_W/4. / conf.zoom_far;
157 cy += SCREEN_H/8. / conf.zoom_far;
158
159 /* Initialize. */
160 space_init( sys, 1 ); /* More lively with simulation. */
161 cam_setTargetPos( cx, cy, 0 );
162 cam_setZoom( conf.zoom_far );
163 pause_setSpeed( 1. );
164 sound_setSpeed( 1. );
165
166 return 0;
167}
168
172void menu_main (void)
173{
174 int offset_logo, offset_wdw, freespace;
175 unsigned int bwid, wid;
176 glTexture *tex;
177 int h, y;
178
179 if (menu_isOpen(MENU_MAIN)) {
180 WARN( _("Menu main is already open.") );
181 return;
182 }
183
184 /* Clean up land if triggered with player.gameover() while landed. */
185 if (landed)
186 land_cleanup();
187
188 /* Close all open windows. */
190
191 /* Clean up GUI - must be done before using SCREEN_W or SCREEN_H. */
192 gui_cleanup();
193 player_soundStop(); /* Stop sound. */
195 render_postprocessCleanup();
196
197 /* Play load music. */
198 music_choose("load");
199
200 /* Load background and friends. */
201 gl_freeTexture( main_naevLogo );
202 tex = gl_newImage( GFX_PATH"Naev.webp", 0 );
203 main_naevLogo = tex;
204 menu_main_bkg_system();
205
206 /* Set dimensions */
207 y = 20 + (BUTTON_HEIGHT+20)*4;
208 h = y + 80;
209 if (conf.devmode) {
210 h += BUTTON_HEIGHT + 20;
211 y += BUTTON_HEIGHT + 20;
212 }
213
214 /* Calculate Logo and window offset. */
215 freespace = SCREEN_H - tex->sh - h;
216 if (freespace < 0) { /* Not enough freespace, this can get ugly. */
217 offset_logo = SCREEN_W - tex->sh;
218 offset_wdw = 0;
219 }
220 /* Otherwise space evenly. */
221 else {
222 offset_logo = -freespace/4;
223 offset_wdw = freespace/2;
224 }
225
226 /* create background image window */
227 bwid = window_create( "wdwBG", "", -1, -1, -1, -1 );
228 window_onClose( bwid, menu_main_cleanBG );
229 window_setBorder( bwid, 0 );
230 window_addImage( bwid, (SCREEN_W-tex->sw)/2., offset_logo, 0, 0, "imgLogo", tex, 0 );
231 window_addText( bwid, 0, 10, SCREEN_W, 30., 1, "txtBG", NULL,
232 &cWhite, naev_version(1) );
233
234 /* create menu window */
235 wid = window_create( "wdwMainMenu", _("Main Menu"), -1, offset_wdw, MAIN_WIDTH, h );
236 window_setCancel( wid, main_menu_promptClose );
237
238 /* Buttons. */
239 window_addButtonKey( wid, 20, y, BUTTON_WIDTH, BUTTON_HEIGHT,
240 "btnLoad", _("Load Game"), menu_main_load, SDLK_l );
241 y -= BUTTON_HEIGHT+20;
242 window_addButtonKey( wid, 20, y, BUTTON_WIDTH, BUTTON_HEIGHT,
243 "btnNew", _("New Game"), menu_main_new, SDLK_n );
244 y -= BUTTON_HEIGHT+20;
245 if (conf.devmode) {
246 window_addButtonKey( wid, 20, y, BUTTON_WIDTH, BUTTON_HEIGHT,
247 "btnEditor", _("Editors"), menu_editors_open, SDLK_e );
248 y -= BUTTON_HEIGHT+20;
249 }
250 window_addButtonKey( wid, 20, y, BUTTON_WIDTH, BUTTON_HEIGHT,
251 "btnOptions", _("Options"), menu_options_button, SDLK_o );
252 y -= BUTTON_HEIGHT+20;
253 window_addButtonKey( wid, 20, y, BUTTON_WIDTH, BUTTON_HEIGHT,
254 "btnCredits", p_("Menu|", "Credits"), menu_main_credits, SDLK_c );
255 y -= BUTTON_HEIGHT+20;
256 window_addButtonKey( wid, 20, y, BUTTON_WIDTH, BUTTON_HEIGHT,
257 "btnExit", _("Exit Game"), menu_exit, SDLK_x );
258
259 /* Disable load button if there are no saves. */
260 if (array_size( load_getList(NULL) ) == 0) {
261 window_disableButton( wid, "btnLoad" );
262 window_setFocus( wid, "btnNew" );
263 }
264 else
265 window_setFocus( wid, "btnLoad" );
266
267 /* Make the background window a child of the menu. */
268 window_setParent( bwid, wid );
269
270 unpause_game();
271 menu_Open(MENU_MAIN);
272}
273
280void menu_main_resize (void)
281{
282 int w, h, bgw, bgh, tw, th;
283 int offset_logo, offset_wdw, freespace;
284 int menu_id, bg_id;
285
287 return;
288
289 menu_id = window_get("wdwMainMenu");
290 bg_id = window_get("wdwBG");
291
292 window_dimWindow( menu_id, &w, &h );
293 window_dimWindow( bg_id, &bgw, &bgh );
294
295 freespace = SCREEN_H - main_naevLogo->sh - h;
296 if (freespace < 0) {
297 offset_logo = SCREEN_H - main_naevLogo->sh;
298 offset_wdw = 0;
299 }
300 else {
301 offset_logo = -freespace/4;
302 offset_wdw = freespace/2;
303 }
304
305 window_moveWidget( bg_id, "imgLogo",
306 (bgw - main_naevLogo->sw)/2., offset_logo );
307
308 window_dimWidget( bg_id, "txtBG", &tw, &th );
309
310 if (tw > SCREEN_W) {
311 /* RIP abstractions. X must be set manually because window_moveWidget
312 * transforms negative coordinates. */
313 Widget *wgt = window_getwgt( bg_id, "txtBG" );
314 if (wgt)
315 wgt->x = (SCREEN_W - tw) / 2;
316 }
317 else
318 window_moveWidget( bg_id, "txtBG", (SCREEN_W - tw)/2, 10. );
319
320 window_move( menu_id, -1, offset_wdw );
321}
322
326static void main_menu_promptClose( unsigned int wid, const char *unused )
327{
328 (void) wid;
329 (void) unused;
330 exit_game();
331}
332
336void menu_main_close (void)
337{
338 if (window_exists( "wdwMainMenu" )) {
339 unsigned int wid = window_get("wdwMainMenu");
340 window_destroy( wid );
341 }
342 else
343 WARN( _("Main menu does not exist.") );
344
345 menu_Close(MENU_MAIN);
346 pause_game();
347}
352static void menu_main_load( unsigned int wid, const char *str )
353{
354 (void) str;
355 (void) wid;
357}
362static void menu_main_new( unsigned int wid, const char *str )
363{
364 (void) str;
365 (void) wid;
366
367 /* Closes the main menu window. */
368 window_destroy( wid );
369 menu_Close(MENU_MAIN);
370 pause_game();
371
372 /* Start the new player. */
373 player_new();
374}
379static void menu_main_credits( unsigned int wid, const char *str )
380{
381 (void) str;
382 window_destroy( wid );
383 menu_Close(MENU_MAIN);
384 intro_display( "AUTHORS", "credits" );
385 bg_needs_reset = 0;
386 menu_main();
387 bg_needs_reset = 1;
388 /* We'll need to start music again. */
389 music_choose("load");
390}
395static void menu_exit( unsigned int wid, const char *str )
396{
397 (void) str;
398 (void) wid;
399
400 naev_quit();
401}
407static void menu_main_cleanBG( unsigned int wid, const char *str )
408{
409 (void) wid;
410 (void) str;
411
412 gl_freeTexture(main_naevLogo);
413 main_naevLogo = NULL;
414}
415
416/*
417 *
418 * in-game menu
419 *
420 */
424void menu_small( int docheck, int info, int options, int allowsave )
425{
426 int can_save;
427 unsigned int wid;
428 int y, h;
429
430 /* Check if menu should be openable. */
431 if (docheck && (player_isFlag(PLAYER_DESTROYED) ||
432 dialogue_isOpen() || /* Shouldn't open over dialogues. */
434 return;
435
436 if (menu_isOpen( MENU_SMALL ))
437 return;
438
439 can_save = allowsave && landed && !player_isFlag(PLAYER_NOSAVE);
440 menu_small_allowsave = allowsave;
441
442 h = MENU_HEIGHT - (BUTTON_HEIGHT+20)*(!info+!options);
443 y = 20 + (BUTTON_HEIGHT+20)*(2+!!info+!!options);
444 wid = window_create( "wdwMenuSmall", _("Menu"), -1, -1, MENU_WIDTH, h + BUTTON_HEIGHT + 20 );
445
446 window_setCancel( wid, menu_small_resume );
447
448 window_addButtonKey( wid, 20, y,
450 "btnResume", _("Resume"), menu_small_resume, SDLK_r );
451 y -= BUTTON_HEIGHT+20;
452 if (info) {
453 window_addButtonKey( wid, 20, y,
455 "btnInfo", _("Info"), menu_small_info, SDLK_i );
456 y -= BUTTON_HEIGHT+20;
457 }
458 window_addButtonKey( wid, 20, y,
460 "btnSave", can_save ? _("Load / Save") : _("Load"), menu_small_load, SDLK_l );
461 y -= BUTTON_HEIGHT+20;
462 if (options) {
463 window_addButtonKey( wid, 20, y,
465 "btnOptions", _("Options"), menu_options_button, SDLK_o );
466 y -= BUTTON_HEIGHT+20;
467 }
468 window_addButtonKey( wid, 20, y, BUTTON_WIDTH, BUTTON_HEIGHT,
469 "btnExit", _("Exit to Title"), menu_small_exit, SDLK_x );
470
471 menu_Open(MENU_SMALL);
472}
473
479static void menu_small_load( unsigned int wid, const char *str )
480{
481 (void) wid;
482 (void) str;
483
484 load_refresh(); /* FIXME: Substitute proper cache invalidation in case of save_all() etc. */
485 load_loadSnapshotMenu( player.name, !menu_small_allowsave );
486}
487
492static void menu_small_resume( unsigned int wid, const char *str )
493{
494 (void)str;
495 window_destroy( wid );
496 menu_Close(MENU_SMALL);
497}
498
502void menu_small_close (void)
503{
504 if (window_exists( "wdwMenuSmall" ))
505 window_destroy( window_get( "wdwMenuSmall" ) );
506 else
507 WARN( _("Small menu does not exist.") );
508
509 menu_Close(MENU_SMALL);
510}
511
517static void menu_small_info( unsigned int wid, const char *str )
518{
519 (void) str;
520 (void) wid;
521
522 menu_info( INFO_MAIN );
523}
524
525static int menu_small_exit_hook( void* unused )
526{
527 (void) unused;
528 unsigned int wid;
529
530 /* Still stuck in a dialogue, so we have to do another hook pass. */
531 if (dialogue_isOpen()) {
532 hook_addFunc( menu_small_exit_hook, NULL, "safe" );
533 return 0;
534 }
535
536 /* if landed we must save anyways */
537 if (landed && land_canSave()) {
538 save_all();
539 land_cleanup();
540 }
541
542 /* Close info menu if open. */
543 if (menu_isOpen(MENU_INFO)) {
544 unsigned int info_wid = window_get("wdwInfo");
545 window_destroy( info_wid );
546 menu_Close(MENU_INFO);
547 }
548
549 /* Stop player sounds because sometimes they hang. */
550 player_restoreControl( 0, _("Exited game.") );
552
553 /* Clean up. */
554 wid = window_get("wdwMenuSmall");
555 window_destroy( wid );
556 menu_Close(MENU_SMALL);
557 menu_main();
558 return 0;
559}
560
565static void menu_small_exit( unsigned int wid, const char *str )
566{
567 (void) wid;
568 (void) str;
569
570 if (!menu_small_allowsave && landed && land_canSave()) {
571 if (!dialogue_YesNoRaw(_("Exit to Menu?"),_("Are you sure you wish to exit to menu right now? The game #rwill not be saved#0 since last time you landed!") ))
572 return;
573 }
574
575 /* Break out of potential inner loops. */
576 SDL_Event event;
577 SDL_memset( &event, 0, sizeof(event) );
578 event.type = SDL_LOOPDONE;
579 SDL_PushEvent( &event );
580
581 hook_addFunc( menu_small_exit_hook, NULL, "safe" );
582}
583
587static void exit_game (void)
588{
589 /* if landed we must save anyways */
590 if (landed && land_canSave()) {
591 save_all();
592 land_cleanup();
593 }
594 SDL_Event quit;
595 quit.type = SDL_QUIT;
596 SDL_PushEvent(&quit);
597}
598
602static void menu_death_continue( unsigned int wid, const char *str )
603{
604 (void) str;
605
606 window_destroy( wid );
607 menu_Close(MENU_DEATH);
608
609 save_reload();
610 player.death_counter++; /* Add death here. */
612}
613
617static void menu_death_restart( unsigned int wid, const char *str )
618{
619 (void) str;
620
621 window_destroy( wid );
622 menu_Close(MENU_DEATH);
623
624 player_new();
625}
626
630void menu_death (void)
631{
632 unsigned int wid;
633
634 wid = window_create( "wdwRIP", _("Death"), -1, -1, DEATH_WIDTH, DEATH_HEIGHT );
635 window_onClose( wid, menu_death_close );
636
637 /* Allow the player to continue if the saved game exists, if not, propose to restart */
638 load_refresh();
639 if (array_size( load_getList( player.name ) ) > 0)
640 window_addButtonKey( wid, 20, 20 + BUTTON_HEIGHT*2 + 20*2, BUTTON_WIDTH, BUTTON_HEIGHT,
641 "btnContinue", _("Continue"), menu_death_continue, SDLK_c );
642 else
643 window_addButtonKey( wid, 20, 20 + BUTTON_HEIGHT*2 + 20*2, BUTTON_WIDTH, BUTTON_HEIGHT,
644 "btnRestart", _("Restart"), menu_death_restart, SDLK_r );
645
646 window_addButtonKey( wid, 20, 20 + (BUTTON_HEIGHT+20),
648 "btnMain", _("Main Menu"), menu_death_main, SDLK_m );
649 window_addButtonKey( wid, 20, 20, BUTTON_WIDTH, BUTTON_HEIGHT,
650 "btnExit", _("Exit Game"), menu_exit, SDLK_x );
651 menu_Open(MENU_DEATH);
652
653 /* Makes it all look cooler since everything still goes on. */
654 if (!landed)
655 unpause_game();
656}
661static void menu_death_main( unsigned int wid, const char *str )
662{
663 (void) str;
664
665 window_destroy( wid );
666 menu_Close(MENU_DEATH);
667
668 /* Game will repause now since toolkit closes and reopens. */
669 menu_main();
670}
674static void menu_death_close( unsigned int wid, const char *str )
675{
676 (void) wid;
677 (void) str;
678 pause_game(); /* Repause the game. */
679}
680
684static void menu_options_button( unsigned int wid, const char *str )
685{
686 (void) wid;
687 (void) str;
688 opt_menu();
689}
690
694int menu_askQuit (void)
695{
696 /* Asked twice, quit. */
697 if (menu_isOpen( MENU_ASKQUIT )) {
698 exit_game();
699 return 1;
700 }
701
702 /* Ask if should quit. */
703 menu_Open( MENU_ASKQUIT );
704 if (dialogue_YesNoRaw( _("Quit Naev"), _("Are you sure you want to quit Naev?") )) {
705 exit_game();
706 return 1;
707 }
708 menu_Close( MENU_ASKQUIT );
709
710 return 0;
711}
712
716static void menu_editors_open( unsigned int wid, const char *unused )
717{
718 (void) unused;
719 int h, y;
720
721 /* Menu already open, quit. */
722 if (menu_isOpen( MENU_EDITORS )) {
723 return;
724 }
725
726 /* Close the Main Menu */
727 menu_main_close();
728 unpause_game();
729
730 /* Clear known flags - specifically for the SYSTEM_HIDDEN flag. */
732
733 /* Set dimensions */
734 y = 20 + (BUTTON_HEIGHT+20)*2;
735 h = y + 80;
736
737 wid = window_create( "wdwEditors", _("Editors"), -1, -1, MENU_WIDTH + EDITORS_EXTRA_WIDTH, h );
738 window_setCancel( wid, menu_editors_close );
739
740 /* Set buttons for the editors */
741 window_addButtonKey( wid, 20, y, BUTTON_WIDTH + EDITORS_EXTRA_WIDTH, BUTTON_HEIGHT,
742 "btnUniverse", _("Universe Map"), uniedit_open, SDLK_u );
743 y -= BUTTON_HEIGHT+20;
744 window_addButtonKey( wid, 20, y, BUTTON_WIDTH + EDITORS_EXTRA_WIDTH, BUTTON_HEIGHT,
745 "btnMapEdit", _("Map Outfits"), mapedit_open, SDLK_m );
746 y -= BUTTON_HEIGHT+20;
747 window_addButtonKey( wid, 20, y, BUTTON_WIDTH + EDITORS_EXTRA_WIDTH, BUTTON_HEIGHT,
748 "btnMain", _("Exit to Main Menu"), menu_editors_close, SDLK_x );
749
750 /* Editors menu is open. */
751 menu_Open( MENU_EDITORS );
752
753 return;
754}
755
760static void menu_editors_close( unsigned int wid, const char *str )
761{
762 (void) str;
763
764 /* Close the Editors Menu and mark it as closed */
765 window_destroy( wid );
766 menu_Close( MENU_EDITORS );
767
768 /* Restores Main Menu */
769 bg_needs_reset = 0;
770 menu_main();
771 bg_needs_reset = 1;
772
773 return;
774}
Provides macros to work with dynamic arrays.
static ALWAYS_INLINE int array_size(const void *array)
Returns number of elements in the array.
Definition array.h:168
#define BUTTON_HEIGHT
Definition board.c:33
#define BUTTON_WIDTH
Definition board.c:32
void cam_setZoom(double zoom)
Sets the camera zoom.
Definition camera.c:73
void cam_setTargetPos(double x, double y, int soft_over)
Sets the camera target to a position.
Definition camera.c:182
void mapedit_open(unsigned int wid_unused, const char *unused)
Opens the system editor interface.
void uniedit_open(unsigned int wid_unused, const char *unused)
Opens the system editor interface.
int dialogue_YesNoRaw(const char *caption, const char *msg)
Runs a dialogue with both yes and no options.
Definition dialogue.c:373
int dialogue_isOpen(void)
Checks to see if a dialogue is open.
Definition dialogue.c:98
void gui_cleanup(void)
Cleans up the GUI.
Definition gui.c:1954
unsigned int hook_addFunc(int(*func)(void *), void *data, const char *stack)
Adds a function hook to be run.
Definition hook.c:594
Handles the info menu.
#define INFO_MAIN
Definition info.h:8
int intro_display(const char *text, const char *mus)
Displays the introduction sequence.
Definition intro.c:306
void land_cleanup(void)
Cleans up some land-related variables.
Definition land.c:1596
int landed
Definition land.c:75
int land_canSave(void)
Whether or not the player can save.
Definition land.c:166
void load_loadSnapshotMenu(const char *name, int disablesave)
Opens the load snapshot menu.
Definition load.c:567
int load_refresh(void)
Loads or refreshes saved games for the player.
Definition load.c:227
void load_loadGameMenu(void)
Opens the load game menu.
Definition load.c:492
const nsave_t * load_getList(const char *name)
Gets the array (array.h) of loaded saves.
Definition load.c:477
int load_gameDiff(const char *file)
Loads the diffs from game file.
Definition load.c:1063
Handles the important game menus.
#define MENU_SMALL
Definition menu.h:10
#define MENU_MAIN
Definition menu.h:9
#define MENU_EDITORS
Definition menu.h:15
#define menu_isOpen(f)
Definition menu.h:16
#define MENU_ASKQUIT
Definition menu.h:14
#define MENU_INFO
Definition menu.h:11
#define MENU_DEATH
Definition menu.h:12
int music_choose(const char *situation)
Actually runs the music stuff, based on situation.
Definition music.c:412
static int quit
Definition naev.c:100
void naev_quit(void)
Flags naev to quit.
Definition naev.c:150
Uint32 SDL_LOOPDONE
Definition naev.c:101
Header file with generic functions and naev-specifics.
const char * naev_version(int long_version)
Returns the version in a human readable string.
glTexture * gl_newImage(const char *path, const unsigned int flags)
Loads an image as a texture.
Definition opengl_tex.c:675
void gl_freeTexture(glTexture *texture)
Frees a texture.
Definition opengl_tex.c:862
void opt_menu(void)
Creates the options menu thingy.
Definition options.c:126
void pause_game(void)
Pauses the game.
Definition pause.c:28
void pause_setSpeed(double mod)
Adjusts the game's dt modifier.
Definition pause.c:64
void unpause_game(void)
Unpauses the game.
Definition pause.c:46
void pilots_cleanAll(void)
Even cleans up the player.
Definition pilot.c:3783
void player_new(void)
Creates a new player.
Definition player.c:242
void player_resetSpeed(void)
Resets the player speed stuff.
Definition player.c:1448
void player_soundStop(void)
Stops playing player sounds.
Definition player.c:894
void player_restoreControl(int reason, const char *str)
Aborts autonav and other states that take control of the ship.
Definition player.c:1461
Player_t player
Definition player.c:74
int safelanes_calculated(void)
Whether or not the safe lanes have been calculated at least once.
Definition safelanes.c:276
void safelanes_recalculate(void)
Update the safe lane locations in response to the universe changing (e.g., diff applied).
Definition safelanes.c:252
void save_reload(void)
Reload the current saved game.
Definition save.c:206
int save_all(void)
Saves the current game.
Definition save.c:94
void sound_setSpeed(double s)
Sets the speed to play the sound at.
Definition sound.c:1152
void space_init(const char *sysname, int do_simulate)
Initializes the system.
Definition space.c:1549
int spob_exists(const char *spobname)
Check to see if a spob exists.
Definition space.c:1126
Spob * spob_get(const char *spobname)
Gets a spob based on its name.
Definition space.c:1051
const char * spob_getSystem(const char *spobname)
Get the name of a system from a spobname.
Definition space.c:1025
void space_clearKnown(void)
Clears all system knowledge.
Definition space.c:3677
void start_position(double *x, double *y)
Gets the starting position of the player.
Definition start.c:250
const char * start_system(void)
Gets the starting system name.
Definition start.c:240
int devmode
Definition conf.h:157
double zoom_far
Definition conf.h:134
unsigned int death_counter
Definition player.h:93
PlayerShip_t ps
Definition player.h:102
char * name
Definition player.h:103
unsigned int death_counter
Definition player.h:139
Represents a Space Object (SPOB), including and not limited to planets, stations, wormholes,...
Definition space.h:89
vec2 pos
Definition space.h:94
Abstraction for rendering sprite sheets.
Definition opengl_tex.h:36
double sw
Definition opengl_tex.h:46
double sh
Definition opengl_tex.h:47
A naev save.
Definition load.h:23
double y
Definition vec2.h:34
double x
Definition vec2.h:33
unsigned int window_create(const char *name, const char *displayname, const int x, const int y, const int w, const int h)
Creates a window.
Definition toolkit.c:691
void window_dimWidget(unsigned int wid, const char *name, int *w, int *h)
Gets the dimensions of a widget.
Definition toolkit.c:416
void window_setFocus(unsigned int wid, const char *wgtname)
Sets the focused widget in a window.
Definition toolkit.c:2471
void window_dimWindow(unsigned int wid, int *w, int *h)
Gets the dimensions of a window.
Definition toolkit.c:371
void window_move(unsigned int wid, int x, int y)
Moves a window to the specified coordinates.
Definition toolkit.c:179
void window_setCancel(unsigned int wid, void(*cancel)(unsigned int, const char *))
Sets the default cancel function of the window.
Definition toolkit.c:868
void toolkit_closeAll(void)
Closes all open toolkit windows.
Definition toolkit.c:1014
void window_onClose(unsigned int wid, void(*fptr)(unsigned int, const char *))
Sets the default close function of the window.
Definition toolkit.c:826
void window_moveWidget(unsigned int wid, const char *name, int x, int y)
Moves a widget.
Definition toolkit.c:465
Widget * window_getwgt(unsigned int wid, const char *name)
Gets a widget from window id and widgetname.
Definition toolkit.c:346
unsigned int window_get(const char *wdwname)
Gets the ID of a window.
Definition toolkit.c:666
void window_setBorder(unsigned int wid, int enable)
Sets or removes the border of a window.
Definition toolkit.c:941
void window_setParent(unsigned int wid, unsigned int parent)
Sets a window as a window's parent.
Definition toolkit.c:789
int window_exists(const char *wdwname)
Checks to see if a window exists.
Definition toolkit.c:596
void window_destroy(unsigned int wid)
Kills the window.
Definition toolkit.c:1037