2 * Copyright (C) Volition, Inc. 1999. All rights reserved.
4 * All source code herein is the property of Volition, Inc. You may not sell
5 * or otherwise commercially exploit the source or things you created based on
10 * $Logfile: /Freespace2/code/MenuUI/PlayerMenu.cpp $
15 * Code to drive the Player Select initial screen
18 * Revision 1.7 2003/08/09 03:18:03 taylor
19 * fix tips popup not having any tips
21 * Revision 1.6 2003/06/11 18:30:32 taylor
24 * Revision 1.5 2003/05/25 02:30:42 taylor
27 * Revision 1.4 2003/05/22 16:13:35 taylor
28 * fix missed German build option for auto-lang
30 * Revision 1.3 2002/06/09 04:41:22 relnev
31 * added copyright header
33 * Revision 1.2 2002/05/07 03:16:46 theoddone33
34 * The Great Newline Fix
36 * Revision 1.1.1.1 2002/05/03 03:28:09 root
40 * 43 11/02/99 11:42a Jefff
41 * fixed copyright symbol in german fonts
43 * 42 10/27/99 12:27a Jefff
44 * localized tips correctly
46 * 41 9/13/99 4:52p Dave
49 * 40 9/02/99 11:10a Jefff
50 * fixed 1024 list display bug - was only showing 8 pilots at a time
52 * 39 8/26/99 8:51p Dave
53 * Gave multiplayer TvT messaging a heavy dose of sanity. Cheat codes.
55 * 38 8/26/99 9:45a Dave
56 * First pass at easter eggs and cheats.
58 * 37 8/16/99 6:39p Jefff
60 * 36 8/16/99 6:37p Jefff
61 * minor string alterations
63 * 35 8/05/99 4:17p Dave
64 * Tweaks to client interpolation.
66 * 34 8/05/99 11:29a Mikek
67 * Jacked up number of comments from 20 to 40, thereby doubling the
68 * quality of our game.
70 * 33 8/04/99 10:53a Dave
71 * Added title to the user tips popup.
73 * 32 8/03/99 3:21p Jefff
75 * 31 8/03/99 10:32a Jefff
76 * raised location of bottom_text to not interfere w/ logo. changed
77 * "please enter callsign" to "type callsign and press enter"
79 * 30 8/02/99 9:13p Dave
82 * 29 7/30/99 10:29a Jefff
83 * fixed colors of bottom display texts
85 * 28 7/27/99 7:17p Jefff
86 * Replaced some art text with XSTR() text.
88 * 27 7/19/99 2:06p Jasons
89 * Remove all palette stuff from player select menu.
91 * 26 7/15/99 9:20a Andsager
92 * FS2_DEMO initial checkin
94 * 25 7/09/99 9:51a Dave
95 * Added thick polyline code.
97 * 24 6/11/99 11:13a Dave
98 * last minute changes before press tour build.
100 * 23 5/21/99 6:45p Dave
101 * Sped up ui loading a bit. Sped up localization disk access stuff. Multi
102 * start game screen, multi password, and multi pxo-help screen.
104 * 22 4/25/99 3:02p Dave
105 * Build defines for the E3 build.
107 * 21 3/25/99 2:31p Neilk
108 * Coordinate changes to handle new artwork
110 * 20 2/25/99 4:19p Dave
111 * Added multiplayer_beta defines. Added cd_check define. Fixed a few
112 * release build warnings. Added more data to the squad war request and
115 * 19 2/01/99 5:55p Dave
116 * Removed the idea of explicit bitmaps for buttons. Fixed text
117 * highlighting for disabled gadgets.
119 * 18 1/30/99 5:08p Dave
120 * More new hi-res stuff.Support for nice D3D textures.
122 * 17 1/30/99 1:53a Dave
123 * Fix some harcoded coords.
125 * 16 1/30/99 1:28a Dave
126 * 1024x768 full support.
128 * 15 1/29/99 1:25p Dave
129 * New code for choose pilot screen.
131 * 14 1/29/99 12:47a Dave
132 * Put in sounds for beam weapon. A bunch of interface screens (tech
135 * 13 1/12/99 12:53a Dave
136 * More work on beam weapons - made collision detection very efficient -
137 * collide against all object types properly - made 3 movement types
138 * smooth. Put in test code to check for possible non-darkening pixels on
141 * 12 12/18/98 1:13a Dave
142 * Rough 1024x768 support for Direct3D. Proper detection and usage through
145 * 11 12/06/98 2:36p Dave
146 * Drastically improved nebula fogging.
148 * 10 12/01/98 6:20p Dave
149 * Removed tga test bitmap code.
151 * 9 12/01/98 4:46p Dave
152 * Put in targa bitmap support (16 bit).
154 * 8 11/30/98 1:07p Dave
155 * 16 bit conversion, first run.
157 * 7 11/20/98 11:16a Dave
158 * Fixed up IPX support a bit. Making sure that switching modes and
159 * loading/saving pilot files maintains proper state.
161 * 6 11/19/98 4:19p Dave
162 * Put IPX sockets back in psnet. Consolidated all multiplayer config
165 * 5 11/05/98 4:18p Dave
166 * First run nebula support. Beefed up localization a bit. Removed all
167 * conditional compiles for foreign versions. Modified mission file
170 * 4 10/13/98 9:28a Dave
171 * Started neatening up freespace.h. Many variables renamed and
172 * reorganized. Added AlphaColors.[h,cpp]
174 * 3 10/09/98 2:57p Dave
175 * Starting splitting up OS stuff.
177 * 2 10/07/98 10:53a Dave
180 * 1 10/07/98 10:49a Dave
189 #include "playermenu.h"
196 #include "managepilot.h"
197 #include "missionscreencommon.h"
199 #include "freespace.h"
201 #include "gamesequence.h"
204 #include "osregistry.h"
206 #include "mainhallmenu.h"
210 #include "alphacolors.h"
211 #include "localize.h"
213 // --------------------------------------------------------------------------------------------------------
215 #if defined(FS2_DEMO) || defined(FS1_DEMO)
216 static int Demo_title_active = 0;
217 static int Demo_title_bitmap = -1;
218 static int Demo_title_expire_timestamp = 0;
219 static int Demo_title_need_fade_in = 1;
220 static char *Demo_title_bitmap_filename = NOX("DemoTitle1");
223 // --------------------------------------------------------------------------------------------------------
224 // PLAYER SELECT defines
227 //#define MAX_PLAYER_SELECT_LINES 8 // max # of pilots displayed at once
228 int Player_select_max_lines[GR_NUM_RESOLUTIONS] = { // max # of pilots displayed at once
233 // button control defines
234 #define NUM_PLAYER_SELECT_BUTTONS 8 // button control defines
236 #define CREATE_PILOT_BUTTON 0 //
237 #define CLONE_BUTTON 1 //
238 #define DELETE_BUTTON 2 //
239 #define SCROLL_LIST_UP_BUTTON 3 //
240 #define SCROLL_LIST_DOWN_BUTTON 4 //
241 #define ACCEPT_BUTTON 5 //
242 #define SINGLE_BUTTON 6 //
243 #define MULTI_BUTTON 7 //
245 // list text display area
246 int Choose_list_coords[GR_NUM_RESOLUTIONS][4] = {
259 char *Player_select_background_bitmap_name[GR_NUM_RESOLUTIONS] = {
263 char *Player_select_background_mask_bitmap[GR_NUM_RESOLUTIONS] = {
267 // #define PLAYER_SELECT_PALETTE NOX("ChoosePilotPalette") // palette for the screen
269 #define PLAYER_SELECT_MAIN_HALL_OVERLAY NOX("MainHall1") // main hall help overlay
271 // convenient struct for handling all button controls
272 struct barracks_buttons {
276 UI_BUTTON button; // because we have a class inside this struct, we need the constructor below..
278 barracks_buttons(char *name, int x1, int y1, int xt1, int yt1, int h) : filename(name), x(x1), y(y1), xt(xt1), yt(yt1), hotspot(h) {}
281 static barracks_buttons Player_select_buttons[GR_NUM_RESOLUTIONS][NUM_PLAYER_SELECT_BUTTONS] = {
284 barracks_buttons("CHP_00", 126, 211, -1, -1, 0), // create
285 barracks_buttons("CHP_13", 181, 211, -1, -1, 13), // clone
286 barracks_buttons("CHP_11", 228, 211, -1, -1, 11), // delete
287 barracks_buttons("CHP_01", 423, 232, -1, -1, 1), // scroll up
288 barracks_buttons("CHP_02", 452, 232, -1, -1, 2), // scroll down
289 barracks_buttons("CHP_12", 475, 213, -1, -1, 12), // accept
290 barracks_buttons("CHP_14", 438, 104, -1, -1, 14), // single
291 barracks_buttons("CHP_15", 485, 104, -1, -1, 15) // multi
293 // create, clone and delete (respectively)
294 barracks_buttons("CPB_00", 114, 205, 117, 240, 0),
295 barracks_buttons("CPB_01", 172, 205, 175, 240, 1),
296 barracks_buttons("CPB_02", 226, 205, 229, 240, 2),
298 // scroll up, scroll down, and accept (respectively)
299 barracks_buttons("CPB_03", 429, 213, -1, -1, 3),
300 barracks_buttons("CPB_04", 456, 213, -1, -1, 4),
301 barracks_buttons("CPB_05", 481, 207, 484, 246, 5),
303 // single player select and multiplayer select, respectively
304 barracks_buttons("CPB_06", 428, 82, 430, 108, 6),
305 barracks_buttons("CPB_07", 477, 82, 481, 108, 7)
309 // create, clone and delete (respectively)
310 barracks_buttons("2_CPB_00", 182, 328, 199, 384, 0),
311 barracks_buttons("2_CPB_01", 275, 328, 292, 384, 1),
312 barracks_buttons("2_CPB_02", 361, 328, 379, 384, 2),
314 // scroll up, scroll down, and accept (respectively)
315 barracks_buttons("2_CPB_03", 686, 341, -1, -1, 3),
316 barracks_buttons("2_CPB_04", 729, 341, -1, -1, 4),
317 barracks_buttons("2_CPB_05", 770, 332, 787, 394, 5),
319 // single player select and multiplayer select, respectively
320 barracks_buttons("2_CPB_06", 685, 132, 700, 173, 6),
321 barracks_buttons("2_CPB_07", 764, 132, 782, 173, 7)
325 // FIXME add to strings.tbl
327 #define PLAYER_SELECT_NUM_TEXT 0
329 #define PLAYER_SELECT_NUM_TEXT 1
331 UI_XSTR Player_select_text[GR_NUM_RESOLUTIONS][PLAYER_SELECT_NUM_TEXT] = {
333 // not needed for FS1
335 { "Choose Pilot", 1436, 122, 90, UI_XSTR_COLOR_GREEN, -1, NULL }
339 // not needed for FS1
341 { "Choose Pilot", 1436, 195, 143, UI_XSTR_COLOR_GREEN, -1, NULL }
346 UI_WINDOW Player_select_window; // ui window for this screen
347 UI_BUTTON Player_select_list_region; // button for detecting mouse clicks on this screen
348 UI_INPUTBOX Player_select_input_box; // input box for adding new pilot names
350 // #define PLAYER_SELECT_PALETTE_FNAME NOX("InterfacePalette")
351 int Player_select_background_bitmap; // bitmap for this screen
352 // int Player_select_palette; // palette bitmap for this screen
353 int Player_select_autoaccept = 0;
354 // int Player_select_palette_set = 0;
356 // flag indicating if this is the absolute first pilot created and selected. Used to determine
357 // if the main hall should display the help overlay screen
358 int Player_select_very_first_pilot = 0;
359 int Player_select_initial_count = 0;
360 char Player_select_very_first_pilot_callsign[CALLSIGN_LEN + 2];
362 extern int Main_hall_bitmap; // bitmap handle to the main hall bitmap
364 int Player_select_mode; // single or multiplayer - never set directly. use player_select_init_player_stuff()
365 int Player_select_num_pilots; // # of pilots on the list
366 int Player_select_list_start; // index of first list item to start displaying in the box
367 int Player_select_pilot; // index into the Pilot array of which is selected as the active pilot
368 int Player_select_input_mode; // 0 if the player _isn't_ typing a callsign, 1 if he is
369 char Pilots_arr[MAX_PILOTS][MAX_FILENAME_LEN];
370 char *Pilots[MAX_PILOTS];
371 int Player_select_clone_flag; // clone the currently selected pilot
372 char Player_select_last_pilot[CALLSIGN_LEN + 10]; // callsign of the last used pilot, or none if there wasn't one
373 int Player_select_last_is_multi;
375 int Player_select_force_bastion = 0;
377 // notification text areas
379 static int Player_select_bottom_text_y[GR_NUM_RESOLUTIONS] = {
388 static int Player_select_middle_text_y[GR_NUM_RESOLUTIONS] = {
397 char Player_select_bottom_text[150] = "";
398 char Player_select_middle_text[150] = "";
399 void player_select_set_bottom_text(char *txt);
400 void player_select_set_middle_text(char *txt);
403 // FORWARD DECLARATIONS
404 void player_select_init_player_stuff(int mode); // switch between single and multiplayer modes
405 void player_select_set_input_mode(int n);
406 void player_select_button_pressed(int n);
407 void player_select_scroll_list_up();
408 void player_select_scroll_list_down();
409 int player_select_create_new_pilot();
410 void player_select_delete_pilot();
411 void player_select_display_all_text();
412 void player_select_display_copyright();
413 void player_select_set_bottom_text(char *txt);
414 void player_select_set_controls(int gray);
415 void player_select_draw_list();
416 void player_select_process_noninput(int k);
417 void player_select_process_input(int k);
418 int player_select_pilot_file_filter(char *filename);
419 int player_select_get_last_pilot_info();
420 void player_select_eval_very_first_pilot();
421 void player_select_commit();
422 void player_select_cancel_create();
425 // basically, gray out all controls (gray == 1), or ungray the controls (gray == 0)
426 void player_select_set_controls(int gray)
430 for(idx=0;idx<NUM_PLAYER_SELECT_BUTTONS;idx++){
432 Player_select_buttons[gr_screen.res][idx].button.disable();
434 Player_select_buttons[gr_screen.res][idx].button.enable();
439 // functions for selecting single/multiplayer pilots at the very beginning of Freespace
440 void player_select_init()
448 // start a looping ambient sound
449 main_hall_start_ambient();
451 Player_select_force_bastion = 0;
455 Demo_title_bitmap = bm_load(Demo_title_bitmap_filename);
456 if ( Demo_title_bitmap >= 0 ) {
457 #ifndef HARDWARE_ONLY
458 palette_use_bm_palette(Demo_title_bitmap);
460 Demo_title_active = 1;
461 Demo_title_expire_timestamp = timestamp(5000);
463 Demo_title_active = 0;
466 Demo_title_active = 0;
469 // create the UI window
470 Player_select_window.create(0, 0, gr_screen.max_w, gr_screen.max_h, 0);
471 Player_select_window.set_mask_bmap(Player_select_background_mask_bitmap[gr_screen.res]);
474 common_set_interface_palette("ChoosePilotPalette");
477 // initialize the control buttons
478 for (i=0; i<NUM_PLAYER_SELECT_BUTTONS; i++) {
479 b = &Player_select_buttons[gr_screen.res][i];
482 if ( (i == SCROLL_LIST_UP_BUTTON) || (i == SCROLL_LIST_DOWN_BUTTON) )
483 b->button.create(&Player_select_window, NULL, b->x, b->y, 60, 30, 1, 1);
485 b->button.create(&Player_select_window, NULL, b->x, b->y, 60, 30, 1, 1);
487 // set its highlight action
488 b->button.set_highlight_action(common_play_highlight_sound);
490 // set its animation bitmaps
491 b->button.set_bmaps(b->filename);
493 // link the mask hotspot
494 b->button.link_hotspot(b->hotspot);
499 w = &Player_select_window;
500 w->add_XSTR("Create", 1034, Player_select_buttons[gr_screen.res][CREATE_PILOT_BUTTON].xt, Player_select_buttons[gr_screen.res][CREATE_PILOT_BUTTON].yt, &Player_select_buttons[gr_screen.res][CREATE_PILOT_BUTTON].button, UI_XSTR_COLOR_GREEN);
501 w->add_XSTR("Clone", 1040, Player_select_buttons[gr_screen.res][CLONE_BUTTON].xt, Player_select_buttons[gr_screen.res][CLONE_BUTTON].yt, &Player_select_buttons[gr_screen.res][CLONE_BUTTON].button, UI_XSTR_COLOR_GREEN);
502 w->add_XSTR("Remove", 1038, Player_select_buttons[gr_screen.res][DELETE_BUTTON].xt, Player_select_buttons[gr_screen.res][DELETE_BUTTON].yt, &Player_select_buttons[gr_screen.res][DELETE_BUTTON].button, UI_XSTR_COLOR_GREEN);
504 w->add_XSTR("Select", 1039, Player_select_buttons[gr_screen.res][ACCEPT_BUTTON].xt, Player_select_buttons[gr_screen.res][ACCEPT_BUTTON].yt, &Player_select_buttons[gr_screen.res][ACCEPT_BUTTON].button, UI_XSTR_COLOR_PINK);
505 w->add_XSTR("Single", 1041, Player_select_buttons[gr_screen.res][SINGLE_BUTTON].xt, Player_select_buttons[gr_screen.res][SINGLE_BUTTON].yt, &Player_select_buttons[gr_screen.res][SINGLE_BUTTON].button, UI_XSTR_COLOR_GREEN);
506 w->add_XSTR("Multi", 1042, Player_select_buttons[gr_screen.res][MULTI_BUTTON].xt, Player_select_buttons[gr_screen.res][MULTI_BUTTON].yt, &Player_select_buttons[gr_screen.res][MULTI_BUTTON].button, UI_XSTR_COLOR_GREEN);
507 for(i=0; i<PLAYER_SELECT_NUM_TEXT; i++) {
508 w->add_XSTR(&Player_select_text[gr_screen.res][i]);
512 // create the list button text select region
513 Player_select_list_region.create(&Player_select_window, "", Choose_list_coords[gr_screen.res][0], Choose_list_coords[gr_screen.res][1], Choose_list_coords[gr_screen.res][2], Choose_list_coords[gr_screen.res][3], 0, 1);
514 Player_select_list_region.hide();
516 // create the pilot callsign input box
517 Player_select_input_box.create(&Player_select_window, Choose_list_coords[gr_screen.res][0], Choose_list_coords[gr_screen.res][1], Choose_list_coords[gr_screen.res][2] , CALLSIGN_LEN - 1, "", UI_INPUTBOX_FLAG_INVIS | UI_INPUTBOX_FLAG_KEYTHRU | UI_INPUTBOX_FLAG_LETTER_FIRST);
518 Player_select_input_box.set_valid_chars(VALID_PILOT_CHARS);
519 Player_select_input_box.hide();
520 Player_select_input_box.disable();
522 // not currently entering any text
523 Player_select_input_mode = 0;
525 // set up hotkeys for buttons so we draw the correct animation frame when a key is pressed
526 Player_select_buttons[gr_screen.res][SCROLL_LIST_UP_BUTTON].button.set_hotkey(KEY_UP);
527 Player_select_buttons[gr_screen.res][SCROLL_LIST_DOWN_BUTTON].button.set_hotkey(KEY_DOWN);
528 Player_select_buttons[gr_screen.res][ACCEPT_BUTTON].button.set_hotkey(KEY_ENTER);
529 Player_select_buttons[gr_screen.res][CREATE_PILOT_BUTTON].button.set_hotkey(KEY_C);
531 // disable the single player button in the multiplayer beta
532 #ifdef MULTIPLAYER_BETA_BUILD
533 Player_select_buttons[gr_screen.res][SINGLE_BUTTON].button.hide();
534 Player_select_buttons[gr_screen.res][SINGLE_BUTTON].button.disable();
535 #elif defined(E3_BUILD) || defined(PRESS_TOUR_BUILD)
536 Player_select_buttons[gr_screen.res][MULTI_BUTTON].button.hide();
537 Player_select_buttons[gr_screen.res][MULTI_BUTTON].button.disable();
541 // attempt to load in the background bitmap
542 Player_select_background_bitmap = bm_load(Player_select_background_bitmap_name[gr_screen.res]);
543 Assert(Player_select_background_bitmap >= 0);
545 // load in the palette for the screen
546 // Player_select_palette = bm_load(PLAYER_SELECT_PALETTE);
547 // Player_select_palette_set = 0;
549 // unset the very first pilot data
550 Player_select_very_first_pilot = 0;
551 Player_select_initial_count = -1;
552 memset(Player_select_very_first_pilot_callsign, 0, CALLSIGN_LEN + 2);
554 // if(Player_select_num_pilots == 0){
555 // Player_select_autoaccept = 1;
558 // if we found a pilot
559 #if defined(DEMO) || defined(OEM_BUILD) || defined(E3_BUILD) || defined(PRESS_TOUR_BUILD) // not for FS2_DEMO
560 player_select_init_player_stuff(PLAYER_SELECT_MODE_SINGLE);
561 #elif defined(MULTIPLAYER_BETA_BUILD)
562 player_select_init_player_stuff(PLAYER_SELECT_MODE_MULTI);
564 if (player_select_get_last_pilot_info()) {
565 if (Player_select_last_is_multi) {
566 player_select_init_player_stuff(PLAYER_SELECT_MODE_MULTI);
568 player_select_init_player_stuff(PLAYER_SELECT_MODE_SINGLE);
571 // otherwise go to the single player mode by default
573 player_select_init_player_stuff(PLAYER_SELECT_MODE_SINGLE);
577 if((Player_select_num_pilots == 1) && Player_select_input_mode){
578 Player_select_autoaccept = 1;
582 #if defined(FS2_DEMO) || defined(FS1_DEMO)
583 // Display the demo title screen
584 void demo_title_blit()
590 if ( timestamp_elapsed(Demo_title_expire_timestamp) ) {
591 Demo_title_active = 0;
596 Demo_title_active = 0;
599 if ( Demo_title_need_fade_in ) {
603 gr_set_bitmap(Demo_title_bitmap);
608 if ( Demo_title_need_fade_in ) {
610 Demo_title_need_fade_in = 0;
613 if ( !Demo_title_active ) {
621 void player_select_do()
626 if ( Demo_title_active ) {
627 // demo_title_blit();
632 //if ( !Player_select_palette_set ) {
633 // Assert(Player_select_palette >= 0);
634 //#ifndef HARDWARE_ONLY
635 // palette_use_bm_palette(Player_select_palette);
637 // Player_select_palette_set = 1;
640 // set the input box at the "virtual" line 0 to be active so the player can enter a callsign
641 if (Player_select_input_mode){
642 Player_select_input_box.set_focus();
645 // process any ui window stuff
646 k = Player_select_window.process();
648 extern void game_process_cheats(int k);
649 game_process_cheats(k);
652 // switch between single and multiplayer modes
654 #if defined(DEMO) || defined(OEM_BUILD) // not for FS2_DEMO
658 if(Player_select_input_mode){
659 gamesnd_play_iface(SND_GENERAL_FAIL);
662 // play a little sound
663 gamesnd_play_iface(SND_USER_SELECT);
664 if(Player_select_mode == PLAYER_SELECT_MODE_MULTI){
666 player_select_set_bottom_text(XSTR( "Single Player Mode", 376));
668 player_select_set_bottom_text(XSTR( "Single-Player Mode", 376));
671 // reinitialize as single player mode
672 player_select_init_player_stuff(PLAYER_SELECT_MODE_SINGLE);
673 } else if(Player_select_mode == PLAYER_SELECT_MODE_SINGLE){
674 player_select_set_bottom_text(XSTR( "Multiplayer Mode", 377));
676 // reinitialize as multiplayer mode
677 player_select_init_player_stuff(PLAYER_SELECT_MODE_MULTI);
683 // draw the player select pseudo-dialog over it
684 gr_set_bitmap(Player_select_background_bitmap);
687 // press the accept button
688 if (Player_select_autoaccept) {
689 Player_select_buttons[gr_screen.res][ACCEPT_BUTTON].button.press_button();
692 // draw any ui window stuf
693 Player_select_window.draw();
695 // light up the correct mode button (single or multi)
696 if (Player_select_mode == PLAYER_SELECT_MODE_SINGLE){
697 Player_select_buttons[gr_screen.res][SINGLE_BUTTON].button.draw_forced(2);
699 Player_select_buttons[gr_screen.res][MULTI_BUTTON].button.draw_forced(2);
702 // draw the pilot list text
703 player_select_draw_list();
705 // draw copyright message on the bottom on the screen
706 player_select_display_copyright();
708 if (!Player_select_input_mode) {
709 player_select_process_noninput(k);
711 player_select_process_input(k);
714 // draw any pending messages on the bottom or middle of the screen
715 player_select_display_all_text();
718 // gr_set_color_fast(&Color_bright_green);
719 // gr_string(0x8000, 10, "Development version - DO NOT RELEASE");
723 gr_set_color(255, 0, 0);
725 vector *arr[5] = {&whee[0], &whee[1], &whee[2], &whee[3], &whee[4]};
726 whee[0].x = 10; whee[0].y = 10; whee[0].z = 0.0f;
727 whee[1].x = 50; whee[1].y = 50; whee[1].z = 0.0f;
728 whee[2].x = 50; whee[2].y = 90; whee[2].z = 0.0f;
729 whee[3].x = 90; whee[3].y = 130; whee[3].z = 0.0f;
730 whee[4].x = 180; whee[4].y = 130; whee[4].z = 0.0f;
731 gr_pline_special(arr, 5, 2);
738 void player_select_close()
740 // destroy the player select window
741 Player_select_window.destroy();
743 // if we're in input mode - we should undo the pilot create reqeust
744 if(Player_select_input_mode){
745 player_select_cancel_create();
748 // actually set up the Player struct here
749 if((Player_select_pilot == -1) || (Player_select_num_pilots == 0)){
750 nprintf(("General","WARNING! No pilot selected! We should be exiting the game now!\n"));
754 // unload all bitmaps
755 if(Player_select_background_bitmap >= 0){
756 bm_release(Player_select_background_bitmap);
757 Player_select_background_bitmap = -1;
759 // if(Player_select_palette >= 0){
760 // bm_release(Player_select_palette);
761 //Player_select_palette = -1;
765 common_free_interface_palette();
768 // setup the player struct
770 Player = &Players[0];
771 Player->flags |= PLAYER_FLAGS_STRUCTURE_IN_USE;
773 // now read in a the pilot data
774 if (read_pilot_file(Pilots[Player_select_pilot], !Player_select_mode, Player) != 0) {
775 Error(LOCATION,"Couldn't load pilot file, bailing");
779 if (Player_select_force_bastion) {
780 Player->on_bastion = 1;
784 void player_select_set_input_mode(int n)
788 // set the input mode
789 Player_select_input_mode = n;
791 // enable all the player select buttons
792 for (i=0; i<NUM_PLAYER_SELECT_BUTTONS; i++){
793 Player_select_buttons[gr_screen.res][i].button.enable(!n);
796 Player_select_buttons[gr_screen.res][ACCEPT_BUTTON].button.set_hotkey(n ? -1 : KEY_ENTER);
797 Player_select_buttons[gr_screen.res][CREATE_PILOT_BUTTON].button.set_hotkey(n ? -1 : KEY_C);
799 // enable the player select input box
800 if(Player_select_input_mode){
801 Player_select_input_box.enable();
802 Player_select_input_box.unhide();
804 Player_select_input_box.hide();
805 Player_select_input_box.disable();
809 void player_select_button_pressed(int n)
814 case SCROLL_LIST_UP_BUTTON:
815 player_select_set_bottom_text("");
817 player_select_scroll_list_up();
820 case SCROLL_LIST_DOWN_BUTTON:
821 player_select_set_bottom_text("");
823 player_select_scroll_list_down();
827 // make sure he has a valid pilot selected
828 if (Player_select_pilot < 0) {
829 popup(PF_USE_AFFIRMATIVE_ICON,1,POPUP_OK,XSTR( "You must select a valid pilot first", 378));
831 player_select_commit();
836 // if we're at max-pilots, don't allow another to be added
837 if (Player_select_num_pilots >= MAX_PILOTS) {
838 player_select_set_bottom_text(XSTR( "You already have the maximum # of pilots!", 379));
840 gamesnd_play_iface(SND_GENERAL_FAIL);
844 if (Player_select_pilot >= 0) {
845 // first we have to make sure this guy is actually loaded for when we create the clone
846 if (Player == NULL) {
847 Player = &Players[0];
848 Player->flags |= PLAYER_FLAGS_STRUCTURE_IN_USE;
851 // attempt to read in the pilot file of the guy to be cloned
852 if (read_pilot_file(Pilots[Player_select_pilot], !Player_select_mode, Player) != 0) {
853 Error(LOCATION,"Couldn't load pilot file, bailing");
858 // set the clone flag
859 Player_select_clone_flag = 1;
861 // create the new pilot (will be cloned with Player_select_clone_flag_set)
862 if (!player_select_create_new_pilot()) {
863 player_select_set_bottom_text(XSTR( "Error creating new pilot file!", 380));
864 Player_select_clone_flag = 0;
865 memset(Player,0,sizeof(player));
870 // clear the player out
871 // JH: What the hell? How do you clone a pilot if you clear out the source you are copying
872 // from? These next 2 lines are pure stupidity, so I commented them out!
873 // memset(Player,0,sizeof(player));
876 // display some text on the bottom of the dialog
877 player_select_set_bottom_text(XSTR( "Type Callsign and Press Enter", 381));
879 // gray out all controls in the dialog
880 player_select_set_controls(1);
884 case CREATE_PILOT_BUTTON:
885 // if we're at max-pilots, don't allow another to be added
886 if(Player_select_num_pilots >= MAX_PILOTS){
887 player_select_set_bottom_text(XSTR( "You already have the maximum # of pilots!", 379));
889 gamesnd_play_iface(SND_GENERAL_FAIL);
893 // create a new pilot
894 if (!player_select_create_new_pilot()) {
895 player_select_set_bottom_text(XSTR( "Type Callsign and Press Enter", 381));
898 // don't clone anyone
899 Player_select_clone_flag = 0;
901 // display some text on the bottom of the dialog
902 player_select_set_bottom_text(XSTR( "Type Callsign and Press Enter", 381));
904 // gray out all controls
905 player_select_set_controls(1);
909 player_select_set_bottom_text("");
911 if (Player_select_pilot >= 0) {
912 // display a popup requesting confirmation
913 ret = popup(PF_TITLE_BIG | PF_TITLE_RED, 2, POPUP_NO, POPUP_YES, XSTR( "Warning!\n\nAre you sure you wish to delete this pilot?", 382));
917 player_select_delete_pilot();
923 player_select_set_bottom_text("");
925 Player_select_autoaccept = 0;
926 // switch to single player mode
927 if (Player_select_mode != PLAYER_SELECT_MODE_SINGLE) {
928 // play a little sound
929 gamesnd_play_iface(SND_USER_SELECT);
931 player_select_set_bottom_text(XSTR( "Single Player Mode", 376));
933 // reinitialize as single player mode
934 player_select_init_player_stuff(PLAYER_SELECT_MODE_SINGLE);
936 gamesnd_play_iface(SND_GENERAL_FAIL);
941 player_select_set_bottom_text("");
943 Player_select_autoaccept = 0;
944 #if defined(DEMO) || defined(OEM_BUILD) // not for FS2_DEMO
945 game_feature_not_in_demo_popup();
947 // switch to multiplayer mode
948 if (Player_select_mode != PLAYER_SELECT_MODE_MULTI) {
949 // play a little sound
950 gamesnd_play_iface(SND_USER_SELECT);
952 player_select_set_bottom_text(XSTR( "Multiplayer Mode", 377));
954 // reinitialize as multiplayer mode
955 player_select_init_player_stuff(PLAYER_SELECT_MODE_MULTI);
957 gamesnd_play_iface(SND_GENERAL_FAIL);
964 int player_select_create_new_pilot()
968 // make sure we haven't reached the max
969 if (Player_select_num_pilots >= MAX_PILOTS) {
970 gamesnd_play_iface(SND_GENERAL_FAIL);
974 int play_scroll_sound = 1;
976 #if defined(FS2_DEMO) || defined(FS1_DEMO)
977 if ( Demo_title_active ) {
978 play_scroll_sound = 0;
982 if ( play_scroll_sound ) {
983 gamesnd_play_iface(SND_SCROLL);
986 idx = Player_select_num_pilots;
988 // move all the pilots in the list up
990 strcpy(Pilots[idx + 1], Pilots[idx]);
993 // by default, set the default netgame protocol to be VMT
994 Multi_options_g.protocol = NET_TCP;
996 // select the beginning of the list
997 Player_select_pilot = 0;
998 Player_select_num_pilots++;
999 Pilots[Player_select_pilot][0] = 0;
1000 Player_select_list_start= 0;
1002 // set us to be in input mode
1003 player_select_set_input_mode(1);
1005 // set the input box to have focus
1006 Player_select_input_box.set_focus();
1007 Player_select_input_box.set_text("");
1008 Player_select_input_box.update_dimensions(Choose_list_coords[gr_screen.res][0], Choose_list_coords[gr_screen.res][1], Choose_list_coords[gr_screen.res][2], gr_get_font_height());
1013 void player_select_delete_pilot()
1015 char filename[MAX_PATH_LEN + 1];
1016 int i, deleted_cur_pilot;
1018 deleted_cur_pilot = 0;
1020 // tack on the full path and the pilot file extension
1021 // build up the path name length
1022 // make sure we do this based upon whether we're in single or multiplayer mode
1023 strcpy( filename, Pilots[Player_select_pilot] );
1024 strcat( filename, NOX(".plr") );
1026 // attempt to delete the pilot
1027 if (Player_select_mode == PLAYER_SELECT_MODE_SINGLE) {
1028 cf_delete( filename, CF_TYPE_SINGLE_PLAYERS );
1030 cf_delete( filename, CF_TYPE_MULTI_PLAYERS );
1033 // delete all the campaign save files for this pilot.
1034 mission_campaign_delete_all_savefiles( Pilots[Player_select_pilot], (Player_select_mode != PLAYER_SELECT_MODE_SINGLE) );
1036 // move all the players down
1037 for (i=Player_select_pilot; i<Player_select_num_pilots-1; i++){
1038 strcpy(Pilots[i], Pilots[i + 1]);
1041 // correcly set the # of pilots and the currently selected pilot
1042 Player_select_num_pilots--;
1043 if (Player_select_pilot >= Player_select_num_pilots) {
1044 Player_select_pilot = Player_select_num_pilots - 1;
1049 // scroll the list of players up
1050 void player_select_scroll_list_up()
1052 if (Player_select_pilot == -1)
1055 // change the pilot selected index and play the appropriate sound
1056 if (Player_select_pilot) {
1057 Player_select_pilot--;
1058 gamesnd_play_iface(SND_SCROLL);
1060 gamesnd_play_iface(SND_GENERAL_FAIL);
1063 if (Player_select_pilot < Player_select_list_start){
1064 Player_select_list_start = Player_select_pilot;
1068 // scroll the list of players down
1069 void player_select_scroll_list_down()
1071 // change the pilot selected index and play the appropriate sound
1072 if (Player_select_pilot < Player_select_num_pilots - 1) {
1073 Player_select_pilot++;
1074 gamesnd_play_iface(SND_SCROLL);
1076 gamesnd_play_iface(SND_GENERAL_FAIL);
1079 if (Player_select_pilot >= (Player_select_list_start + Player_select_max_lines[gr_screen.res])){
1080 Player_select_list_start++;
1084 // fill in the data on the last played pilot (callsign and is_multi or not)
1085 int player_select_get_last_pilot_info()
1089 last_player = os_config_read_string( NULL, "LastPlayer", NULL);
1091 if(last_player == NULL){
1094 strcpy(Player_select_last_pilot,last_player);
1097 // determine if he was a single or multi-player based upon the last character in his callsign
1098 Player_select_last_is_multi = Player_select_last_pilot[strlen(Player_select_last_pilot)-1] == 'M' ? 1 : 0;
1099 Player_select_last_pilot[strlen(Player_select_last_pilot)-1]='\0';
1104 int player_select_get_last_pilot()
1106 // if the player has the Cmdline_use_last_pilot command line option set, try and drop out quickly
1107 if(Cmdline_use_last_pilot){
1110 if(!player_select_get_last_pilot_info()){
1114 if(Player_select_last_is_multi){
1115 Player_select_num_pilots = cf_get_file_list_preallocated(MAX_PILOTS, Pilots_arr, Pilots, CF_TYPE_MULTI_PLAYERS, NOX("*.plr"), CF_SORT_TIME);
1117 Player_select_num_pilots = cf_get_file_list_preallocated(MAX_PILOTS, Pilots_arr, Pilots, CF_TYPE_SINGLE_PLAYERS, NOX("*.plr"), CF_SORT_TIME);
1120 Player_select_pilot = -1;
1122 // pick the last player
1123 for(idx=0;idx<Player_select_num_pilots;idx++){
1124 if(strcmp(Player_select_last_pilot,Pilots_arr[idx])==0){
1125 Player_select_pilot = idx;
1130 // set this so that we don't incorrectly create a "blank" pilot - .plr
1131 // in the player_select_close() function
1132 Player_select_num_pilots = 0;
1134 // if we've actually found a valid pilot, load him up
1135 if(Player_select_pilot != -1){
1136 Player = &Players[0];
1137 read_pilot_file(Pilots_arr[idx],!Player_select_last_is_multi,Player);
1138 Player->flags |= PLAYER_FLAGS_STRUCTURE_IN_USE;
1146 void player_select_init_player_stuff(int mode)
1148 Player_select_list_start = 0;
1150 // set the select mode to single player for default
1151 Player_select_mode = mode;
1153 // load up the list of players based upon the Player_select_mode (single or multiplayer)
1154 Get_file_list_filter = player_select_pilot_file_filter;
1155 if (mode == PLAYER_SELECT_MODE_SINGLE){
1156 Player_select_num_pilots = cf_get_file_list_preallocated(MAX_PILOTS, Pilots_arr, Pilots, CF_TYPE_SINGLE_PLAYERS, NOX("*.plr"), CF_SORT_TIME);
1158 Player_select_num_pilots = cf_get_file_list_preallocated(MAX_PILOTS, Pilots_arr, Pilots, CF_TYPE_MULTI_PLAYERS, NOX("*.plr"), CF_SORT_TIME);
1163 // if this value is -1, it means we should set it to the num pilots count
1164 if(Player_select_initial_count == -1){
1165 Player_select_initial_count = Player_select_num_pilots;
1168 // select the first pilot if any exist, otherwise set to -1
1169 if (Player_select_num_pilots == 0) {
1170 Player_select_pilot = -1;
1171 player_select_set_middle_text(XSTR( "Type Callsign and Press Enter", 381));
1172 player_select_set_controls(1); // gray out the controls
1173 player_select_create_new_pilot();
1175 Player_select_pilot = 0;
1179 void player_select_draw_list()
1183 for (idx=0; idx<Player_select_max_lines[gr_screen.res]; idx++) {
1184 // only draw as many pilots as we have
1185 if ((idx + Player_select_list_start) == Player_select_num_pilots)
1188 // if the currently selected pilot is this line, draw it highlighted
1189 if ( (idx + Player_select_list_start) == Player_select_pilot) {
1190 // if he's the active pilot and is also the current selection, super-highlight him
1191 gr_set_color_fast(&Color_text_active);
1193 // otherwise draw him normally
1195 gr_set_color_fast(&Color_text_normal);
1198 // draw the actual callsign
1199 gr_printf(Choose_list_coords[gr_screen.res][0], Choose_list_coords[gr_screen.res][1] + (idx * gr_get_font_height()), Pilots[idx + Player_select_list_start]);
1203 void player_select_process_noninput(int k)
1207 // check for pressed buttons
1208 for (idx=0; idx<NUM_PLAYER_SELECT_BUTTONS; idx++) {
1209 if (Player_select_buttons[gr_screen.res][idx].button.pressed()) {
1210 player_select_button_pressed(idx);
1214 // check for keypresses
1216 // quit the game entirely
1218 gameseq_post_event(GS_EVENT_QUIT_GAME);
1221 case KEY_ENTER | KEY_CTRLED:
1222 player_select_button_pressed(ACCEPT_BUTTON);
1225 // delete the currently highlighted pilot
1227 if (Player_select_pilot >= 0) {
1230 // display a popup requesting confirmation
1231 ret = popup(PF_USE_AFFIRMATIVE_ICON | PF_USE_NEGATIVE_ICON,2,POPUP_NO,POPUP_YES,XSTR( "Are you sure you want to delete this pilot?", 383));
1235 player_select_delete_pilot();
1241 // check to see if the user has clicked on the "list region" button
1242 // and change the selected pilot appropriately
1243 if (Player_select_list_region.pressed()) {
1245 // get the mouse position
1246 Player_select_list_region.get_mouse_pos(NULL, &click_y);
1248 // determine what index to select
1249 //idx = (click_y+5) / 10;
1250 idx = click_y / gr_get_font_height();
1253 // if he selected a valid item
1254 if(((idx + Player_select_list_start) < Player_select_num_pilots) && (idx >= 0)){
1255 Player_select_pilot = idx + Player_select_list_start;
1259 // if the player has double clicked on a valid pilot, choose it and hit the accept button
1260 if (Player_select_list_region.double_clicked()) {
1261 if ((Player_select_pilot >= 0) && (Player_select_pilot < Player_select_num_pilots)) {
1262 player_select_button_pressed(ACCEPT_BUTTON);
1267 void player_select_process_input(int k)
1269 char buf[CALLSIGN_LEN + 1];
1272 // if the player is in the process of typing in a new pilot name...
1274 // cancel create pilot
1276 player_select_cancel_create();
1279 // accept a new pilot name
1281 Player_select_input_box.get_text(buf);
1282 drop_white_space(buf);
1284 if (!isalpha(*buf)) {
1287 for (idx=1; buf[idx]; idx++) {
1288 if (!isalpha(buf[idx]) && !isdigit(buf[idx]) && !strchr(VALID_PILOT_CHARS, buf[idx])) {
1295 for (idx=1; idx<Player_select_num_pilots; idx++) {
1296 if (!stricmp(buf, Pilots[idx])) {
1297 // verify if it is ok to overwrite the file
1298 if (pilot_verify_overwrite() == 1) {
1299 // delete the pilot and select the beginning of the list
1300 Player_select_pilot = idx;
1301 player_select_delete_pilot();
1302 Player_select_pilot = 0;
1303 idx = Player_select_num_pilots;
1313 if (!*buf || (idx < Player_select_num_pilots)) {
1318 gamesnd_play_iface(SND_GENERAL_FAIL);
1322 // Create the new pilot, and write out his file
1323 strcpy(Pilots[0], buf);
1325 // if this is the first guy, we should set the Player struct
1326 if (Player == NULL) {
1327 Player = &Players[0];
1328 memset(Player, 0, sizeof(player));
1329 Player->flags |= PLAYER_FLAGS_STRUCTURE_IN_USE;
1332 strcpy(Player->callsign, buf);
1333 init_new_pilot(Player, !Player_select_clone_flag);
1335 // set him as being a multiplayer pilot if we're in the correct mode
1336 if (Player_select_mode == PLAYER_SELECT_MODE_MULTI) {
1337 Player->flags |= PLAYER_FLAGS_IS_MULTI;
1338 Player->stats.flags |= STATS_FLAG_MULTIPLAYER;
1341 // create his pilot file
1342 write_pilot_file(Player);
1345 memset(Player, 0, sizeof(player));
1348 // make this guy the selected pilot and put him first on the list
1349 Player_select_pilot = 0;
1351 // unset the input mode
1352 player_select_set_input_mode(0);
1354 // clear any pending bottom text
1355 player_select_set_bottom_text("");
1357 // clear any pending middle text
1358 player_select_set_middle_text("");
1360 // ungray all the controls
1361 player_select_set_controls(0);
1363 // evaluate whether or not this is the very first pilot
1364 player_select_eval_very_first_pilot();
1370 // always kill middle text when a char is pressed in input mode
1372 player_select_set_middle_text("");
1377 // draw copyright message on the bottom on the screen
1378 void player_select_display_copyright()
1381 char Copyright_msg1[256], Copyright_msg2[256];
1384 gr_set_color_fast(&Color_bright);
1387 sprintf(Copyright_msg1, XSTR("Descent: FreeSpace - The Great War, Copyright %c 1998, Volition, Inc.", 384), '\xA8');
1389 sprintf(Copyright_msg1, XSTR("Descent: FreeSpace - The Great War, Copyright %c 1998, Volition, Inc.", 384), '\x83');
1391 sprintf(Copyright_msg2, XSTR("All Rights Reserved", 385));
1393 gr_set_color_fast(&Color_white);
1395 sprintf(Copyright_msg1, NOX("FreeSpace 2"));
1397 sprintf(Copyright_msg2, XSTR("Copyright %c 1999, Volition, Inc. All rights reserved.", 385), '\xA8');
1399 sprintf(Copyright_msg2, XSTR("Copyright %c 1999, Volition, Inc. All rights reserved.", 385), '\x83');
1403 gr_get_string_size(&w, NULL, Copyright_msg1);
1404 sx = fl2i((gr_screen.max_w / 2) - w/2.0f + 0.5f);
1405 sy = (gr_screen.max_h - 2) - 2*gr_get_font_height();
1406 gr_string(sx, sy, Copyright_msg1);
1408 gr_get_string_size(&w, NULL, Copyright_msg2);
1409 sx = fl2i((gr_screen.max_w / 2) - w/2.0f + 0.5f);
1410 sy = (gr_screen.max_h - 2) - gr_get_font_height();
1411 gr_string(sx, sy, Copyright_msg2);
1414 void player_select_display_all_text()
1418 // only draw if we actually have a valid string
1419 if (strlen(Player_select_bottom_text)) {
1420 gr_get_string_size(&w, &h, Player_select_bottom_text);
1422 w = (gr_screen.max_w - w) / 2;
1424 gr_set_color_fast(&Color_bright);
1426 gr_set_color_fast(&Color_bright_white);
1428 gr_printf(w, Player_select_bottom_text_y[gr_screen.res], Player_select_bottom_text);
1431 // only draw if we actually have a valid string
1432 if (strlen(Player_select_middle_text)) {
1433 gr_get_string_size(&w, &h, Player_select_middle_text);
1435 w = (gr_screen.max_w - w) / 2;
1436 gr_set_color_fast(&Color_bright_white);
1437 gr_printf(w, Player_select_middle_text_y[gr_screen.res], Player_select_middle_text);
1441 int player_select_pilot_file_filter(char *filename)
1443 return !verify_pilot_file(filename, Player_select_mode == PLAYER_SELECT_MODE_SINGLE);
1446 void player_select_set_bottom_text(char *txt)
1449 strncpy(Player_select_bottom_text, txt, 149);
1453 void player_select_set_middle_text(char *txt)
1456 strncpy(Player_select_middle_text, txt, 149);
1460 void player_select_eval_very_first_pilot()
1462 // never bring up the initial main hall help overlay
1463 // Player_select_very_first_pilot = 0;
1465 // if we already have this flag set, check to see if our callsigns match
1466 if(Player_select_very_first_pilot){
1467 // if the callsign has changed, unset the flag
1468 if(strcmp(Player_select_very_first_pilot_callsign,Pilots[Player_select_pilot])){
1469 Player_select_very_first_pilot = 0;
1472 // otherwise check to see if there is only 1 pilot
1474 if((Player_select_num_pilots == 1) && (Player_select_initial_count == 0)){
1476 Player_select_very_first_pilot = 1;
1477 strcpy(Player_select_very_first_pilot_callsign,Pilots[Player_select_pilot]);
1482 void player_select_commit()
1484 // if we've gotten to this point, we should have ensured this was the case
1485 Assert(Player_select_num_pilots > 0);
1487 gameseq_post_event(GS_EVENT_MAIN_MENU);
1488 gamesnd_play_iface(SND_COMMIT_PRESSED);
1490 // evaluate if this is the _very_ first pilot
1491 player_select_eval_very_first_pilot();
1494 void player_select_cancel_create()
1498 Player_select_num_pilots--;
1500 // make sure we correct the Selected_pilot index to account for the cancelled action
1501 if (Player_select_num_pilots == 0) {
1502 Player_select_pilot = -1;
1505 // move all pilots down
1506 for (idx=0; idx<Player_select_num_pilots; idx++) {
1507 strcpy(Pilots[idx], Pilots[idx + 1]);
1510 // unset the input mode
1511 player_select_set_input_mode(0);
1513 // clear any bottom text
1514 player_select_set_bottom_text("");
1516 // clear any middle text
1517 player_select_set_middle_text("");
1519 // ungray all controls
1520 player_select_set_controls(0);
1522 // disable the autoaccept
1523 Player_select_autoaccept = 0;
1526 DCF(bastion,"Sets the player to be on the bastion")
1528 if(gameseq_get_state() == GS_STATE_INITIAL_PLAYER_SELECT){
1529 Player_select_force_bastion = 1;
1530 dc_printf("Player is now in the Bastion\n");
1534 #define MAX_PLAYER_TIPS 40
1536 char *Player_tips[MAX_PLAYER_TIPS];
1537 int Num_player_tips;
1538 int Player_tips_shown = 0;
1541 void player_tips_init()
1544 Num_player_tips = 0;
1546 // begin external localization stuff
1549 read_file_text("tips.tbl");
1552 while(!optional_string("#end")){
1553 required_string("+Tip:");
1555 if(Num_player_tips >= MAX_PLAYER_TIPS){
1558 Player_tips[Num_player_tips++] = stuff_and_malloc_string(F_NAME, NULL, 1024);
1561 // stop externalizing, homey
1566 void player_tips_close()
1571 for (i=0; i<MAX_PLAYER_TIPS; i++) {
1572 if (Player_tips[i]) {
1573 free(Player_tips[i]);
1574 Player_tips[i] = NULL;
1580 void player_tips_popup()
1585 // player has disabled tips
1586 if((Player != NULL) && !Player->tips){
1589 // only show tips once per instance of Freespace
1590 if(Player_tips_shown == 1){
1593 Player_tips_shown = 1;
1595 // randomly pick one
1596 tip = (int)frand_range(0.0f, (float)Num_player_tips - 1.0f);
1601 sprintf(all_txt, XSTR("NEW USER TIP\n\n%s", 1565), Player_tips[tip]);
1602 ret = popup(PF_NO_SPECIAL_BUTTONS | PF_TITLE | PF_TITLE_WHITE, 3, XSTR("&Ok", 669), XSTR("&Next", 1444), XSTR("Don't show me this again", 1443), all_txt);
1608 if(tip >= Num_player_tips - 1){
1615 // don't show me this again
1619 write_pilot_file(Player);