FS2_Open
Open source remastering of the Freespace 2 engine
playermenu.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) Volition, Inc. 1999. All rights reserved.
3  *
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 the
6  * source.
7  *
8 */
9 
10 
11 #include <limits.h>
12 #include <ctype.h>
13 
14 
15 #include "cfile/cfile.h"
16 #include "cmdline/cmdline.h"
17 #include "debugconsole/console.h"
18 #include "freespace2/freespace.h"
20 #include "gamesnd/gamesnd.h"
21 #include "globalincs/alphacolors.h"
22 #include "io/key.h"
23 #include "localization/localize.h"
24 #include "menuui/mainhallmenu.h"
25 #include "menuui/playermenu.h"
27 #include "network/multi.h"
28 #include "osapi/osregistry.h"
29 #include "parse/parselo.h"
30 #include "pilotfile/pilotfile.h"
31 #include "playerman/managepilot.h"
32 #include "playerman/player.h"
33 #include "popup/popup.h"
34 #include "ui/ui.h"
35 
36 
37 // --------------------------------------------------------------------------------------------------------
38 // PLAYER SELECT defines
39 //
40 
41 int Max_lines; //Max number of pilots displayed in Window. Gets set in player_select_draw_list()
42 
43 // button control defines
44 #define NUM_PLAYER_SELECT_BUTTONS 8 // button control defines
45 
46 #define CREATE_PILOT_BUTTON 0 //
47 #define CLONE_BUTTON 1 //
48 #define DELETE_BUTTON 2 //
49 #define SCROLL_LIST_UP_BUTTON 3 //
50 #define SCROLL_LIST_DOWN_BUTTON 4 //
51 #define ACCEPT_BUTTON 5 //
52 #define SINGLE_BUTTON 6 //
53 #define MULTI_BUTTON 7 //
54 
55 // list text display area
57  { // GR_640
58  114, 117, 400, 87
59  },
60  { // GR_1024
61  183, 186, 640, 139
62  }
63 };
64 
66  "ChoosePilot",
67  "2_ChoosePilot"
68 };
70  "ChoosePilot-m",
71  "2_ChoosePilot-m"
72 };
73 // #define PLAYER_SELECT_PALETTE NOX("ChoosePilotPalette") // palette for the screen
74 
75 #define PLAYER_SELECT_MAIN_HALL_OVERLAY NOX("MainHall1") // main hall help overlay
76 
77 // convenient struct for handling all button controls
78 struct barracks_buttons {
79  char *filename;
80  int x, y, xt, yt;
81  int hotspot;
82  UI_BUTTON button; // because we have a class inside this struct, we need the constructor below..
83 
84  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) {}
85 };
86 
87 static barracks_buttons Player_select_buttons[GR_NUM_RESOLUTIONS][NUM_PLAYER_SELECT_BUTTONS] = {
88  { // GR_640
89  // create, clone and delete (respectively)
90  barracks_buttons("CPB_00", 114, 205, 117, 240, 0),
91  barracks_buttons("CPB_01", 172, 205, 175, 240, 1),
92  barracks_buttons("CPB_02", 226, 205, 229, 240, 2),
93 
94  // scroll up, scroll down, and accept (respectively)
95  barracks_buttons("CPB_03", 429, 213, -1, -1, 3),
96  barracks_buttons("CPB_04", 456, 213, -1, -1, 4),
97  barracks_buttons("CPB_05", 481, 207, 484, 246, 5),
98 
99  // single player select and multiplayer select, respectively
100  barracks_buttons("CPB_06", 428, 82, 430, 108, 6),
101  barracks_buttons("CPB_07", 477, 82, 481, 108, 7)
102  },
103  { // GR_1024
104  // create, clone and delete (respectively)
105  barracks_buttons("2_CPB_00", 182, 328, 199, 384, 0),
106  barracks_buttons("2_CPB_01", 275, 328, 292, 384, 1),
107  barracks_buttons("2_CPB_02", 361, 328, 379, 384, 2),
108 
109  // scroll up, scroll down, and accept (respectively)
110  barracks_buttons("2_CPB_03", 686, 341, -1, -1, 3),
111  barracks_buttons("2_CPB_04", 729, 341, -1, -1, 4),
112  barracks_buttons("2_CPB_05", 770, 332, 787, 394, 5),
113 
114  // single player select and multiplayer select, respectively
115  barracks_buttons("2_CPB_06", 685, 132, 700, 173, 6),
116  barracks_buttons("2_CPB_07", 764, 132, 782, 173, 7)
117  }
118 };
119 
120 // FIXME add to strings.tbl
121 #define PLAYER_SELECT_NUM_TEXT 1
123  { // GR_640
124  { "Choose Pilot", 1436, 122, 90, UI_XSTR_COLOR_GREEN, -1, NULL }
125  },
126  { // GR_1024
127  { "Choose Pilot", 1436, 195, 143, UI_XSTR_COLOR_GREEN, -1, NULL }
128  }
129 };
130 
131 UI_WINDOW Player_select_window; // ui window for this screen
132 UI_BUTTON Player_select_list_region; // button for detecting mouse clicks on this screen
133 UI_INPUTBOX Player_select_input_box; // input box for adding new pilot names
134 
135 // #define PLAYER_SELECT_PALETTE_FNAME NOX("InterfacePalette")
136 int Player_select_background_bitmap; // bitmap for this screen
137 // int Player_select_palette; // palette bitmap for this screen
139 // int Player_select_palette_set = 0;
140 
141 // flag indicating if this is the absolute first pilot created and selected. Used to determine
142 // if the main hall should display the help overlay screen
146 
147 extern int Main_hall_bitmap; // bitmap handle to the main hall bitmap
148 
149 int Player_select_mode; // single or multiplayer - never set directly. use player_select_init_player_stuff()
150 int Player_select_num_pilots; // # of pilots on the list
151 int Player_select_list_start; // index of first list item to start displaying in the box
152 int Player_select_pilot; // index into the Pilot array of which is selected as the active pilot
153 int Player_select_input_mode; // 0 if the player _isn't_ typing a callsign, 1 if he is
156 int Player_select_clone_flag; // clone the currently selected pilot
157 char Player_select_last_pilot[CALLSIGN_LEN + 10]; // callsign of the last used pilot, or none if there wasn't one
159 
161 
162 static int Player_select_no_save_pilot = 0; // to skip save of pilot in pilot_select_close()
163 
164 int Player_select_screen_active = 0; // for pilot savefile loading - taylor
165 
166 // notification text areas
167 
168 static int Player_select_bottom_text_y[GR_NUM_RESOLUTIONS] = {
169  314, // GR_640
170  502 // GR_1024
171 };
172 
173 static int Player_select_middle_text_y[GR_NUM_RESOLUTIONS] = {
174  253, // GR_640
175  404 // GR_1024
176 };
177 
180 
181 
182 // FORWARD DECLARATIONS
183 void player_select_init_player_stuff(int mode); // switch between single and multiplayer modes
192 void player_select_set_bottom_text(const char *txt);
193 void player_select_set_middle_text(const char *txt);
194 void player_select_set_controls(int gray);
197 void player_select_process_input(int k);
201 void player_select_commit();
203 
204 extern int delete_pilot_file(char *pilot_name);
205 
206 /*
207  * validate that a pilot/player was created with the same language FSO is currently using
208  *
209  * @param pilots callsign
210  * @note not longer needed if intel entry "primary keys" change to a non-translated value
211  */
212 bool valid_pilot_lang(char *callsign)
213 {
214  char pilot_lang[LCL_LANG_NAME_LEN+1], current_lang[LCL_LANG_NAME_LEN+1];
215  SCP_string filename = callsign;
216 
217  filename += ".plr";
218  lcl_get_language_name(current_lang);
219 
220  if (Pilot.verify(filename.c_str(), NULL, pilot_lang)) {
221  if (!strcmp(current_lang, pilot_lang)) {
222  return true;
223  }
224  }
225  return false;
226 }
227 
228 // basically, gray out all controls (gray == 1), or ungray the controls (gray == 0)
230 {
231  int idx;
232 
233  for(idx=0;idx<NUM_PLAYER_SELECT_BUTTONS;idx++) {
234  if(gray) {
235  Player_select_buttons[gr_screen.res][idx].button.disable();
236  } else {
237  Player_select_buttons[gr_screen.res][idx].button.enable();
238  }
239  }
240 }
241 
242 // functions for selecting single/multiplayer pilots at the very beginning of FreeSpace
244 {
245  int i;
247  UI_WINDOW *w;
248 
249  // start a looping ambient sound
251 
253 
255 
256  // create the UI window
257  Player_select_window.create(0, 0, gr_screen.max_w_unscaled, gr_screen.max_h_unscaled, 0);
259 
260  // initialize the control buttons
261  for (i=0; i<NUM_PLAYER_SELECT_BUTTONS; i++) {
262  b = &Player_select_buttons[gr_screen.res][i];
263 
264  // create the button
265  b->button.create(&Player_select_window, NULL, b->x, b->y, 60, 30, 1, 1);
266 
267  // set its highlight action
269 
270  // set its animation bitmaps
271  b->button.set_bmaps(b->filename);
272 
273  // link the mask hotspot
274  b->button.link_hotspot(b->hotspot);
275  }
276 
277  // add some text
279  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);
280  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);
281  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);
282 
283  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);
284  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);
285  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);
286  for(i=0; i<PLAYER_SELECT_NUM_TEXT; i++) {
287  w->add_XSTR(&Player_select_text[gr_screen.res][i]);
288  }
289 
290 
291  // create the list button text select region
292  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);
293  Player_select_list_region.hide();
294 
295  // create the pilot callsign input box
297  Player_select_input_box.set_valid_chars(VALID_PILOT_CHARS);
298  Player_select_input_box.hide();
299  Player_select_input_box.disable();
300 
301  // not currently entering any text
303 
304  // set up hotkeys for buttons so we draw the correct animation frame when a key is pressed
305  Player_select_buttons[gr_screen.res][SCROLL_LIST_UP_BUTTON].button.set_hotkey(KEY_UP);
307  Player_select_buttons[gr_screen.res][ACCEPT_BUTTON].button.set_hotkey(KEY_ENTER);
308  Player_select_buttons[gr_screen.res][CREATE_PILOT_BUTTON].button.set_hotkey(KEY_C);
309 
310  // attempt to load in the background bitmap
313 
314  // load in the palette for the screen
315  // Player_select_palette = bm_load(PLAYER_SELECT_PALETTE);
316  // Player_select_palette_set = 0;
317 
318  // unset the very first pilot data
322 
323 // if(Player_select_num_pilots == 0){
324 // Player_select_autoaccept = 1;
325 // }
326 
327 // if we found a pilot
331  } else {
333  }
334  } else { // otherwise go to the single player mode by default
336  }
337 
339  // When benchmarking, just accept automatically
341  }
342 }
343 
344 // no need to reset this to false because we only ever see player_select once per game run
345 static bool Startup_warning_dialog_displayed = false;
346 
348 {
349  int k;
350 
351  // Goober5000 - display a popup warning about problems in the mod
352  if ((Global_warning_count > 10 || Global_error_count > 0) && !Startup_warning_dialog_displayed) {
353  char text[512];
354  sprintf(text, "Warning!\n\nThe currently active mod has generated %d warnings and/or errors during program startup. These could have been caused by anything from incorrectly formated table files to corrupt models. While FreeSpace Open will attempt to compensate for these issues, it cannot guarantee a trouble-free gameplay experience. Source Code Project staff cannot provide assistance or support for these problems, as they are caused by the mod's data files, not FreeSpace Open's source code.", Global_warning_count + Global_error_count);
356  Startup_warning_dialog_displayed = true;
357  }
358 
359  // set the input box at the "virtual" line 0 to be active so the player can enter a callsign
361  Player_select_input_box.set_focus();
362  }
363 
364  // process any ui window stuff
365  k = Player_select_window.process();
366 
367  if (k) {
368  extern void game_process_cheats(int k);
370  }
371 
372  switch (k) {
373  // switch between single and multiplayer modes
374  case KEY_TAB: {
377  break;
378  }
379 
380  // play a little sound
382 
384  player_select_set_bottom_text(XSTR( "Single-Player Mode", 376));
385 
386  // reinitialize as single player mode
389  player_select_set_bottom_text(XSTR( "Multiplayer Mode", 377));
390 
391  // reinitialize as multiplayer mode
393  }
394 
395  break;
396  }
397 
398  case KEY_ESC: {
399  // we can hit ESC to get out of text input mode, and we don't want
400  // to set this var in that case since it will crash on a NULL Player
401  // ptr when going to the mainhall
402  if ( !Player_select_input_mode ) {
403  Player_select_no_save_pilot = 1;
404  }
405 
406  break;
407  }
408  }
409 
410  // draw the player select pseudo-dialog over it
414 
415  // press the accept button
417  Player_select_buttons[gr_screen.res][ACCEPT_BUTTON].button.press_button();
418  }
419 
420  // draw any ui window stuf
421  Player_select_window.draw();
422 
423  // light up the correct mode button (single or multi)
425  Player_select_buttons[gr_screen.res][SINGLE_BUTTON].button.draw_forced(2);
426  } else {
427  Player_select_buttons[gr_screen.res][MULTI_BUTTON].button.draw_forced(2);
428  }
429 
430  // draw the pilot list text
432 
433  // draw copyright message on the bottom on the screen
435 
438  } else {
440  }
441 
442  // draw any pending messages on the bottom or middle of the screen
444 
445  gr_flip();
446 }
447 
449 {
450  // destroy the player select window
451  Player_select_window.destroy();
452 
453  // if we're in input mode - we should undo the pilot create reqeust
456  }
457 
458  // if we are just exiting then don't try to save any pilot files - taylor
459  if (Player_select_no_save_pilot) {
460  Player = NULL;
461  return;
462  }
463 
464  // actually set up the Player struct here
465  if ( (Player_select_pilot == -1) || (Player_select_num_pilots == 0) ) {
466  nprintf(("General","WARNING! No pilot selected! We should be exiting the game now!\n"));
467  return;
468  }
469 
470  // unload all bitmaps
474  }
475  // if(Player_select_palette >= 0){
476  // bm_release(Player_select_palette);
477  //Player_select_palette = -1;
478  // }
479 
480  // setup the player struct
481  Player_num = 0;
482  Player = &Players[0];
484 
485  // New pilot file makes no distinction between multi pilots and regular ones, so let's do this here.
488  }
489 
490  // WMC - Set appropriate game mode
493  } else {
495  }
496 
497  // now read in a the pilot data
499  Error(LOCATION,"Couldn't load pilot file, bailing");
500  Player = NULL;
501  } else {
502  // NOTE: this may fail if there is no current campaign, it's not fatal
504  }
505 
506  if (Player_select_force_main_hall != "") {
508  }
509 
510  // free memory from all parsing so far, all tbls found during game_init()
511  // and the current campaign which we loaded here
512  stop_parse();
513 
515 }
516 
518 {
519  int i;
520 
521  // set the input mode
523 
524  // enable all the player select buttons
525  for (i=0; i<NUM_PLAYER_SELECT_BUTTONS; i++) {
526  Player_select_buttons[gr_screen.res][i].button.enable(!n);
527  }
528 
529  Player_select_buttons[gr_screen.res][ACCEPT_BUTTON].button.set_hotkey(n ? -1 : KEY_ENTER);
530  Player_select_buttons[gr_screen.res][CREATE_PILOT_BUTTON].button.set_hotkey(n ? -1 : KEY_C);
531 
532  // enable the player select input box
534  Player_select_input_box.enable();
535  Player_select_input_box.unhide();
536  } else {
537  Player_select_input_box.hide();
538  Player_select_input_box.disable();
539  }
540 }
541 
543 {
544  int ret;
545 
546  switch (n) {
549 
551  break;
552 
555 
557  break;
558 
559  case ACCEPT_BUTTON:
560  // make sure he has a valid pilot selected
561  if (Player_select_pilot < 0) {
562  popup(PF_USE_AFFIRMATIVE_ICON,1,POPUP_OK,XSTR( "You must select a valid pilot first", 378));
563  } else {
566  } else {
568  "Selected pilot was created with a different language\n"
569  "to the currently active language.\n\n"
570  "Please select a different pilot or change the language", 1637));
571  }
572  }
573  break;
574 
575  case CLONE_BUTTON:
576  // if we're at max-pilots, don't allow another to be added
578  player_select_set_bottom_text(XSTR( "You already have the maximum # of pilots!", 379));
579 
581  break;
582  }
583 
584  if (Player_select_pilot >= 0) {
585  // first we have to make sure this guy is actually loaded for when we create the clone
586  if (Player == NULL) {
587  Player = &Players[0];
589  }
590 
591  // attempt to read in the pilot file of the guy to be cloned
593  Error(LOCATION,"Couldn't load pilot file, bailing");
594  Player = NULL;
595  Int3();
596  }
597 
598  // set the clone flag
600 
601  // create the new pilot (will be cloned with Player_select_clone_flag_set)
603  player_select_set_bottom_text(XSTR( "Error creating new pilot file!", 380));
605  Player->reset();
606  Player = NULL;
607  break;
608  }
609 
610  // display some text on the bottom of the dialog
611  player_select_set_bottom_text(XSTR( "Type Callsign and Press Enter", 381));
612 
613  // gray out all controls in the dialog
615  }
616  break;
617 
618  case CREATE_PILOT_BUTTON:
619  // if we're at max-pilots, don't allow another to be added
621  player_select_set_bottom_text(XSTR( "You already have the maximum # of pilots!", 379));
622 
624  break;
625  }
626 
627  // create a new pilot
629  player_select_set_bottom_text(XSTR( "Type Callsign and Press Enter", 381));
630  }
631 
632  // don't clone anyone
634 
635  // display some text on the bottom of the dialog
636  player_select_set_bottom_text(XSTR( "Type Callsign and Press Enter", 381));
637 
638  // gray out all controls
640  break;
641 
642  case DELETE_BUTTON:
644 
645  if (Player_select_pilot >= 0) {
647  popup(PF_TITLE_BIG | PF_TITLE_RED | PF_USE_AFFIRMATIVE_ICON, 1, POPUP_OK, XSTR("Disabled!\n\nMulti and single player pilots are now identical. "
648  "Deleting a multi-player pilot will also delete all single-player data for that pilot.\n\nAs a safety precaution, pilots can only be "
649  "deleted from the single-player menu.", 1610));
650  } else {
651  // display a popup requesting confirmation
652  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));
653 
654  // delete the pilot
655  if (ret == 1) {
657  }
658  }
659  }
660  break;
661 
662  case SINGLE_BUTTON:
664 
666  // switch to single player mode
668  // play a little sound
670 
671  player_select_set_bottom_text(XSTR( "Single Player Mode", 376));
672 
673  // reinitialize as single player mode
675  } else {
677  }
678  break;
679 
680  case MULTI_BUTTON:
682 
684  if ( Networking_disabled ) {
686  break;
687  }
688 
689  // switch to multiplayer mode
691  // play a little sound
693 
694  player_select_set_bottom_text(XSTR( "Multiplayer Mode", 377));
695 
696  // reinitialize as multiplayer mode
698  } else {
700  }
701  break;
702  }
703 }
704 
706 {
707  int idx;
708 
709  // make sure we haven't reached the max
712  return 0;
713  }
714 
715  int play_scroll_sound = 1;
716 
717  if ( play_scroll_sound ) {
719  }
720 
722 
723  // move all the pilots in the list up
724  while (idx--) {
725  strcpy(Pilots[idx + 1], Pilots[idx]);
726  }
727 
728  // by default, set the default netgame protocol to be VMT
730 
731  // select the beginning of the list
734  Pilots[Player_select_pilot][0] = 0;
736 
737  // set us to be in input mode
739 
740  // set the input box to have focus
741  Player_select_input_box.set_focus();
742  Player_select_input_box.set_text("");
744 
745  return 1;
746 }
747 
749 {
750  char filename[MAX_PATH_LEN + 1];
751  int i, del_rval;
752 
753  // tack on the full path and the pilot file extension
754  // build up the path name length
755  // make sure we do this based upon whether we're in single or multiplayer mode
756  strcpy_s( filename, Pilots[Player_select_pilot] );
757 
758  del_rval = delete_pilot_file(filename);
759 
760  if ( !del_rval ) {
761  popup(PF_USE_AFFIRMATIVE_ICON | PF_TITLE_BIG | PF_TITLE_RED, 1, POPUP_OK, XSTR("Error\nFailed to delete pilot file. File may be read-only.", 1599));
762  return;
763  }
764 
765  // move all the players down
766  for ( i=Player_select_pilot; i<Player_select_num_pilots-1; i++ ) {
767  strcpy(Pilots[i], Pilots[i + 1]);
768  }
769 
770  // correcly set the # of pilots and the currently selected pilot
771  Player_select_num_pilots--;
772  if (Player_select_pilot >= Player_select_num_pilots) {
773  Player_select_pilot = Player_select_num_pilots - 1;
774  }
775 
776 }
777 
778 // scroll the list of players up
780 {
781  if (Player_select_pilot == -1) {
782  return;
783  }
784 
785  // change the pilot selected index and play the appropriate sound
786  if (Player_select_pilot) {
789  } else {
791  }
792 
795  }
796 }
797 
798 // scroll the list of players down
800 {
801  // change the pilot selected index and play the appropriate sound
805  } else {
807  }
808 
811  }
812 }
813 
814 // fill in the data on the last played pilot (callsign and is_multi or not)
816 {
817  // TODO: Replace this with a function that does this properly for the new pilot code.
818 
819  const char *last_player = os_config_read_string( NULL, "LastPlayer", NULL);
820 
821  if (last_player == NULL) {
822  return 0;
823  } else {
824  strcpy_s(Player_select_last_pilot, last_player);
825  }
826 
827  // handle changing from pre-pilot code to post-pilot code
829  Player_select_last_pilot[strlen(Player_select_last_pilot)-1]='\0'; // chop off last char, M|P
830  }
831 
834  } else {
836  }
837 
838  return 1;
839 }
840 
842 {
843  // if the player has the Cmdline_use_last_pilot command line option set, try and drop out quickly
845  int idx;
846 
848  return 0;
849  }
850 
852 
854 
855  Player_select_pilot = -1;
856  idx = 0;
857  // pick the last player
858  for (idx=0;idx<Player_select_num_pilots;idx++) {
859  if (strcmp(Player_select_last_pilot,Pilots_arr[idx])==0) {
861  break;
862  }
863  }
864 
865  // set this so that we don't incorrectly create a "blank" pilot - .plr
866  // in the player_select_close() function
867  Player_select_num_pilots = 0;
868 
869  // if we've actually found a valid pilot, load him up
870  if (Player_select_pilot != -1) {
871  Player = &Players[0];
874  return 1;
875  }
876  }
877 
878  return 0;
879 }
880 
882 {
884 
885  // set the select mode to single player for default
887 
888  // load up the list of players based upon the Player_select_mode (single or multiplayer)
890 
892 
893  // if we have a "last_player", and they're in the list, bash them to the top of the list
894  if (Player_select_last_pilot[0] != '\0') {
895  int i,j;
896  for (i = 0; i < Player_select_num_pilots; ++i) {
898  break;
899  }
900  }
901  if (i != Player_select_num_pilots) {
902  for (j = i; j > 0; --j) {
903  strncpy(Pilots[j], Pilots[j-1], strlen(Pilots[j-1])+1);
904  }
906  }
907  }
908 
909  Player = NULL;
910 
911  // if this value is -1, it means we should set it to the num pilots count
912  if (Player_select_initial_count == -1) {
914  }
915 
916  // select the first pilot if any exist, otherwise set to -1
917  if (Player_select_num_pilots == 0) {
918  Player_select_pilot = -1;
919  player_select_set_middle_text(XSTR( "Type Callsign and Press Enter", 381));
920  player_select_set_controls(1); // gray out the controls
922  } else {
924  }
925 }
926 
928 {
929  int idx;
930 
931  if (gr_screen.res == 1) {
932  Max_lines = 145/gr_get_font_height(); //Make the max number of lines dependent on the font height. 145 and 85 are magic numbers, based on the window size in retail.
933  } else {
935  }
936 
937  for (idx=0; idx<Max_lines; idx++) {
938  // only draw as many pilots as we have
940  break;
941  }
942 
943  // if the currently selected pilot is this line, draw it highlighted
945  // if he's the active pilot and is also the current selection, super-highlight him
947  } else { // otherwise draw him normally
949  }
950  // draw the actual callsign
952  }
953 }
954 
956 {
957  int idx;
958 
959  // check for pressed buttons
960  for (idx=0; idx<NUM_PLAYER_SELECT_BUTTONS; idx++) {
961  if (Player_select_buttons[gr_screen.res][idx].button.pressed()) {
963  }
964  }
965 
966  // check for keypresses
967  switch (k) {
968  // quit the game entirely
969  case KEY_ESC:
971  break;
972 
973  case KEY_ENTER | KEY_CTRLED:
975  break;
976 
977  // delete the currently highlighted pilot
978  case KEY_DELETE:
980  break;
981  }
982 
983  // check to see if the user has clicked on the "list region" button
984  // and change the selected pilot appropriately
985  if (Player_select_list_region.pressed()) {
986  int click_y;
987  // get the mouse position
988  Player_select_list_region.get_mouse_pos(NULL, &click_y);
989 
990  // determine what index to select
991  //idx = (click_y+5) / 10;
992  idx = click_y / gr_get_font_height();
993 
994 
995  // if he selected a valid item
996  if ( ((idx + Player_select_list_start) < Player_select_num_pilots) && (idx >= 0) ) {
998  }
999  }
1000 
1001  // if the player has double clicked on a valid pilot, choose it and hit the accept button
1002  if (Player_select_list_region.double_clicked()) {
1005  }
1006  }
1007 }
1008 
1010 {
1011  char buf[CALLSIGN_LEN + 1];
1012  int idx,z;
1013 
1014  // if the player is in the process of typing in a new pilot name...
1015  switch (k) {
1016  // cancel create pilot
1017  case KEY_ESC:
1019  break;
1020 
1021  // accept a new pilot name
1022  case KEY_ENTER:
1023  Player_select_input_box.get_text(buf);
1024  drop_white_space(buf);
1025  z = 0;
1026  if (!isalpha(*buf)) {
1027  z = 1;
1028  } else {
1029  for (idx=1; buf[idx]; idx++) {
1030  if (!isalpha(buf[idx]) && !isdigit(buf[idx]) && !strchr(VALID_PILOT_CHARS, buf[idx])) {
1031  z = 1;
1032  break;
1033  }
1034  }
1035  }
1036 
1037  for (idx=1; idx<Player_select_num_pilots; idx++) {
1038  if (!stricmp(buf, Pilots[idx])) {
1039  // verify if it is ok to overwrite the file
1040  if (pilot_verify_overwrite() == 1) {
1041  // delete the pilot and select the beginning of the list
1044  Player_select_pilot = 0;
1046  z = 0;
1047 
1048  } else
1049  z = 1;
1050 
1051  break;
1052  }
1053  }
1054 
1055  if (!*buf || (idx < Player_select_num_pilots)) {
1056  z = 1;
1057  }
1058 
1059  if (z) {
1061  break;
1062  }
1063 
1064  // Create the new pilot, and write out his file
1065  strcpy(Pilots[0], buf);
1066 
1067  // if this is the first guy, we should set the Player struct
1068  if (Player == NULL) {
1069  Player = &Players[0];
1070  Player->reset();
1072  }
1073 
1074  strcpy_s(Player->callsign, buf);
1076 
1077  // set him as being a multiplayer pilot if we're in the correct mode
1081  }
1082 
1083  // create his pilot file
1085 
1086  // unset the player
1087  Player->reset();
1088  Player = NULL;
1089 
1090  // make this guy the selected pilot and put him first on the list
1091  Player_select_pilot = 0;
1092 
1093  // unset the input mode
1095 
1096  // clear any pending bottom text
1098 
1099  // clear any pending middle text
1101 
1102  // ungray all the controls
1104 
1105  // evaluate whether or not this is the very first pilot
1107  break;
1108 
1109  case 0:
1110  break;
1111 
1112  // always kill middle text when a char is pressed in input mode
1113  default:
1115  break;
1116  }
1117 }
1118 
1119 // draw copyright message on the bottom on the screen
1121 {
1122  int sx, sy, w;
1123  char Copyright_msg1[256], Copyright_msg2[256];
1124 
1125 // strcpy_s(Copyright_msg1, XSTR("Descent: FreeSpace - The Great War, Copyright c 1998, Volition, Inc.", -1));
1127 
1128 // sprintf(Copyright_msg1, NOX("FreeSpace 2"));
1129  get_version_string(Copyright_msg1, sizeof(Copyright_msg1));
1130  sprintf(Copyright_msg2, XSTR("Copyright %c 1999, Volition, Inc. All rights reserved.", 385), Lcl_special_chars + 4);
1131 
1132  gr_get_string_size(&w, NULL, Copyright_msg1);
1133  sx = fl2i((gr_screen.max_w_unscaled / 2) - w/2.0f + 0.5f);
1134  sy = (gr_screen.max_h_unscaled - 2) - 2*gr_get_font_height();
1135  gr_string(sx, sy, Copyright_msg1, GR_RESIZE_MENU);
1136 
1137  gr_get_string_size(&w, NULL, Copyright_msg2);
1138  sx = fl2i((gr_screen.max_w_unscaled / 2) - w/2.0f + 0.5f);
1140 
1141  gr_string(sx, sy, Copyright_msg2, GR_RESIZE_MENU);
1142 }
1143 
1145 {
1146  int w, h;
1147 
1148  // only draw if we actually have a valid string
1149  if (strlen(Player_select_bottom_text)) {
1151 
1152  w = (gr_screen.max_w_unscaled - w) / 2;
1154  gr_printf_menu(w, Player_select_bottom_text_y[gr_screen.res], Player_select_bottom_text);
1155  }
1156 
1157  // only draw if we actually have a valid string
1158  if (strlen(Player_select_middle_text)) {
1160 
1161  w = (gr_screen.max_w_unscaled - w) / 2;
1163  gr_printf_menu(w, Player_select_middle_text_y[gr_screen.res], Player_select_middle_text);
1164  }
1165 }
1166 
1168 {
1169  return (int)Pilot.verify(filename);
1170 }
1171 
1172 void player_select_set_bottom_text(const char *txt)
1173 {
1174  if (txt) {
1175  strncpy(Player_select_bottom_text, txt, 149);
1176  }
1177 }
1178 
1179 void player_select_set_middle_text(const char *txt)
1180 {
1181  if (txt) {
1182  strncpy(Player_select_middle_text, txt, 149);
1183  }
1184 }
1185 
1187 {
1188  // never bring up the initial main hall help overlay
1189  // Player_select_very_first_pilot = 0;
1190 
1191  // if we already have this flag set, check to see if our callsigns match
1193  // if the callsign has changed, unset the flag
1196  }
1197  } else { // otherwise check to see if there is only 1 pilot
1199  // set up the data
1202  }
1203  }
1204 }
1205 
1207 {
1208  // if we've gotten to this point, we should have ensured this was the case
1210 
1213 
1214  // evaluate if this is the _very_ first pilot
1216 }
1217 
1219 {
1220  int idx;
1221 
1223 
1224  // make sure we correct the Selected_pilot index to account for the cancelled action
1225  if (Player_select_num_pilots == 0) {
1226  Player_select_pilot = -1;
1227  }
1228 
1229  // move all pilots down
1230  for (idx=0; idx<Player_select_num_pilots; idx++) {
1231  strcpy(Pilots[idx], Pilots[idx + 1]);
1232  }
1233 
1234  // unset the input mode
1236 
1237  // clear any bottom text
1239 
1240  // clear any middle text
1242 
1243  // ungray all controls
1245 
1246  // disable the autoaccept
1248 }
1249 
1250 DCF(bastion,"Sets the player to be on the bastion (or any other main hall)")
1251 {
1252  int idx;
1253 
1255  dc_printf("This command can only be run while in the initial player select screen.\n");
1256  return;
1257  }
1258 
1259  if (dc_optional_string_either("help", "--help")) {
1260  dc_printf("Usage: bastion [index]\n");
1261  dc_printf(" [index] -- optional main hall index; if not supplied, defaults to 1\n");
1262  return;
1263  }
1264 
1265  if (dc_optional_string_either("status", "--status") || dc_optional_string_either("?", "--?")) {
1266  dc_printf("Player is on main hall '%s'\n", Player_select_force_main_hall.c_str());
1267  return;
1268  }
1269 
1270  if (dc_maybe_stuff_int(&idx)) {
1271  Assert(Main_hall_defines.size() < INT_MAX);
1272  if ((idx < 0) || (idx >= (int) Main_hall_defines.size())) {
1273  dc_printf("Main hall index out of range\n");
1274 
1275  } else {
1277  dc_printf("Player is now on main hall '%d'\n", Player_select_force_main_hall.c_str());
1278  }
1279 
1280  } else {
1281  // No argument passed
1283  dc_printf("Player is now on the Bastion... hopefully\n");
1284  }
1285 }
1286 
1287 #define MAX_PLAYER_TIPS 40
1288 
1292 
1293 // tooltips
1295 {
1296  Num_player_tips = 0;
1297 
1298  try
1299  {
1300  read_file_text("tips.tbl", CF_TYPE_TABLES);
1301  reset_parse();
1302 
1303  while (!optional_string("#end")) {
1304  required_string("+Tip:");
1305 
1306  if (Num_player_tips >= MAX_PLAYER_TIPS) {
1307  break;
1308  }
1309  Player_tips[Num_player_tips++] = stuff_and_malloc_string(F_NAME, NULL);
1310  }
1311  }
1312  catch (const parse::ParseException& e)
1313  {
1314  mprintf(("TABLES: Unable to parse '%s'! Error message = %s.\n", "tips.tbl", e.what()));
1315  return;
1316  }
1317 }
1318 
1319 // close out player tips - *only call from game_shutdown()*
1321 {
1322  int i;
1323 
1324  for (i=0; i<MAX_PLAYER_TIPS; i++) {
1325  if (Player_tips[i] != NULL) {
1326  vm_free(Player_tips[i]);
1327  Player_tips[i] = NULL;
1328  }
1329  }
1330 }
1331 
1333 {
1334  int tip, ret;
1335 
1336  // player has disabled tips
1337  if ( (Player != NULL) && !Player->tips ) {
1338  return;
1339  }
1340  // only show tips once per instance of FreeSpace
1341  if(Player_tips_shown == 1) {
1342  return;
1343  }
1344  Player_tips_shown = 1;
1345 
1346  // randomly pick one
1347  tip = (int)frand_range(0.0f, (float)Num_player_tips - 1.0f);
1348 
1349  char all_txt[2048];
1350 
1351  do {
1352  sprintf(all_txt, XSTR("NEW USER TIP\n\n%s", 1565), Player_tips[tip]);
1353  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);
1354 
1355  // now what?
1356  switch(ret){
1357  // next
1358  case 1:
1359  if(tip >= Num_player_tips - 1) {
1360  tip = 0;
1361  } else {
1362  tip++;
1363  }
1364  break;
1365 
1366  // don't show me this again
1367  case 2:
1368  ret = 0;
1369  Player->tips = 0;
1371  Pilot.save_savefile();
1372  break;
1373  }
1374  } while(ret > 0);
1375 }
void player_tips_close()
void set_text(const char *in)
Definition: inputbox.cpp:490
#define MAX_FILENAME_LEN
Definition: pstypes.h:324
#define MAX_PILOTS
Definition: managepilot.h:19
void set_highlight_action(void(*_user_function)(void))
Definition: button.cpp:375
pilotfile Pilot
Definition: pilotfile.cpp:7
#define NET_TCP
Definition: psnet2.h:29
int i
Definition: multi_pxo.cpp:466
#define vm_free(ptr)
Definition: pstypes.h:548
char * Player_select_background_mask_bitmap[GR_NUM_RESOLUTIONS]
Definition: playermenu.cpp:69
void add_XSTR(char *string, int _xstr_id, int _x, int _y, UI_GADGET *_assoc, int _color_type, int _font_id=-1)
Definition: window.cpp:476
int player_select_create_new_pilot()
Definition: playermenu.cpp:705
void player_select_cancel_create()
#define UI_INPUTBOX_FLAG_LETTER_FIRST
Definition: ui.h:41
#define VALID_PILOT_CHARS
Definition: managepilot.h:17
#define KEY_DOWN
Definition: key.h:180
int flags
Definition: player.h:104
int Game_mode
Definition: systemvars.cpp:24
GLfloat GLfloat GLfloat GLfloat h
Definition: Glext.h:7280
void gr_flip()
Definition: 2d.cpp:2113
commit pressed
Definition: gamesnd.h:294
float frand_range(float min, float max)
Return a floating point number in the range min..max.
Definition: floating.cpp:50
void player_select_button_pressed(int n)
Definition: playermenu.cpp:542
UI_BUTTON Player_select_list_region
Definition: playermenu.cpp:132
#define CF_TYPE_PLAYERS
Definition: cfile.h:67
UI_BUTTON button
Definition: barracks.cpp:196
#define GR_RESIZE_MENU
Definition: 2d.h:684
int Main_hall_bitmap
bool save_savefile()
Definition: csg.cpp:1524
void init_new_pilot(player *p, int reset)
Definition: managepilot.cpp:78
char * stuff_and_malloc_string(int type, char *terminators)
Definition: parselo.cpp:1406
int Player_select_very_first_pilot
Definition: playermenu.cpp:143
char Player_select_bottom_text[150]
Definition: playermenu.cpp:178
virtual void unhide()
Definition: gadget.cpp:217
#define NUM_PLAYER_SELECT_BUTTONS
Definition: playermenu.cpp:44
int gameseq_get_state(void)
Definition: fredstubs.cpp:60
int double_clicked()
Definition: button.cpp:333
Assert(pm!=NULL)
int Player_select_last_is_multi
Definition: playermenu.cpp:158
void player_select_set_controls(int gray)
Definition: playermenu.cpp:229
bool dc_maybe_stuff_int(int *i)
Tries to stuff an int from the Command_string.
#define GR_NUM_RESOLUTIONS
Definition: 2d.h:651
#define mprintf(args)
Definition: pstypes.h:238
#define MULTI_BUTTON
Definition: playermenu.cpp:53
__inline void gr_string(int x, int y, const char *string, int resize_mode=GR_RESIZE_FULL)
Definition: 2d.h:769
char Player_select_middle_text[150]
Definition: playermenu.cpp:179
general failure sound for any event
Definition: gamesnd.h:297
int Player_select_pilot
Definition: playermenu.cpp:152
int res
Definition: 2d.h:370
char * drop_white_space(char *str)
Definition: parselo.cpp:159
int max_h_unscaled
Definition: 2d.h:361
void main_hall_start_ambient()
void set_focus()
Definition: gadget.cpp:321
char Player_select_last_pilot[CALLSIGN_LEN+10]
Definition: playermenu.cpp:157
GLclampf f
Definition: Glext.h:7097
void player_tips_popup()
#define GR_MAYBE_CLEAR_RES(bmap)
Definition: 2d.h:639
GLenum mode
Definition: Glext.h:5794
#define KEY_C
Definition: key.h:84
#define ACCEPT_BUTTON
Definition: playermenu.cpp:51
const char * os_config_read_string(const char *section, const char *name, const char *default_value)
Definition: osregistry.cpp:322
virtual void hide(int n)
Definition: gadget.cpp:207
void gr_set_color_fast(color *dst)
Definition: 2d.cpp:1197
Definition: ui.h:195
std::basic_string< char, std::char_traits< char >, std::allocator< char > > SCP_string
Definition: vmallocator.h:21
void reset()
#define PLAYER_SELECT_MODE_SINGLE
Definition: playermenu.h:16
void gr_set_bitmap(int bitmap_num, int alphablend_mode, int bitblt_mode, float alpha)
Definition: 2d.cpp:2105
int max_w_unscaled
Definition: 2d.h:361
#define Int3()
Definition: pstypes.h:292
#define KEY_DELETE
Definition: key.h:176
void player_select_commit()
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: Glext.h:7308
bool verify(const char *fname, int *rank=NULL, char *valid_language=NULL)
Definition: plr.cpp:1006
int bm_release(int handle, int clear_render_targets)
Frees both a bitmap's data and it's associated slot.
Definition: bmpman.cpp:2603
char callsign[CALLSIGN_LEN+1]
Definition: player.h:91
SCP_vector< SCP_vector< main_hall_defines > > Main_hall_defines
void player_select_init()
Definition: playermenu.cpp:243
#define DCF(function_name, help_text)
The potent DCF macro, used to define new debug commands for the console.
Definition: console.h:60
int cf_get_file_list_preallocated(int max, char arr[][MAX_FILENAME_LEN], char **list, int type, const char *filter, int sort=CF_SORT_NONE, file_list_info *info=NULL)
int Choose_list_coords[GR_NUM_RESOLUTIONS][4]
Definition: playermenu.cpp:56
SCP_string Player_select_force_main_hall
Definition: playermenu.cpp:160
void player_select_process_input(int k)
#define CREATE_PILOT_BUTTON
Definition: playermenu.cpp:46
void draw_forced(int frame_num)
Definition: button.cpp:104
#define MAX_PLAYER_TIPS
player Players[MAX_PLAYERS]
void destroy()
Definition: window.cpp:189
typedef int(SCP_EXT_CALLCONV *SCPDLL_PFVERSION)(SCPDLL_Version *)
void press_button()
Definition: button.cpp:399
void set_mask_bmap(char *fname)
Definition: window.cpp:75
int set_bmaps(char *ani_filename, int nframes=3, int start_frame=1)
Definition: gadget.cpp:71
#define SINGLE_BUTTON
Definition: playermenu.cpp:52
#define nprintf(args)
Definition: pstypes.h:239
#define GM_MULTIPLAYER
Definition: systemvars.h:18
char current_campaign[MAX_FILENAME_LEN+1]
Definition: player.h:101
void player_select_scroll_list_up()
Definition: playermenu.cpp:779
#define CF_SORT_TIME
Definition: cfile.h:94
#define PLAYER_SELECT_MODE_MULTI
Definition: playermenu.h:17
char * filename
int pressed()
Definition: button.cpp:325
int Player_select_num_pilots
Definition: playermenu.cpp:150
void player_select_scroll_list_down()
Definition: playermenu.cpp:799
void player_select_draw_list()
Definition: playermenu.cpp:927
#define w(p)
Definition: modelsinc.h:68
#define CF_TYPE_TABLES
Definition: cfile.h:50
sprintf(buf,"(%f,%f,%f)", v3->xyz.x, v3->xyz.y, v3->xyz.z)
#define SCROLL_LIST_DOWN_BUTTON
Definition: playermenu.cpp:50
GLdouble GLdouble z
Definition: Glext.h:5451
#define KEY_ENTER
Definition: key.h:125
int tips
Definition: player.h:198
void get_version_string()
Definition: fredstubs.cpp:194
void player_select_close()
Definition: playermenu.cpp:448
int required_string(const char *pstr)
Definition: parselo.cpp:468
void player_select_process_noninput(int k)
Definition: playermenu.cpp:955
void player_select_init_player_stuff(int mode)
Definition: playermenu.cpp:881
int optional_string(const char *pstr)
Definition: parselo.cpp:539
int player_select_pilot_file_filter(const char *filename)
UI_XSTR Player_select_text[GR_NUM_RESOLUTIONS][PLAYER_SELECT_NUM_TEXT]
Definition: playermenu.cpp:122
bool dc_optional_string_either(const char *str1, const char *str2)
Searches for an optional string and it's alias.
void read_file_text(const char *filename, int mode, char *processed_text, char *raw_text)
Definition: parselo.cpp:1995
int player_select_get_last_pilot()
Definition: playermenu.cpp:841
bool save_player(player *_p=NULL)
Definition: plr.cpp:935
int idx
Definition: multiui.cpp:761
void main_hall_get_name(SCP_string &name, unsigned int index)
int Networking_disabled
Definition: fredstubs.cpp:32
barracks_buttons(char *name, int x1, int y1, int xt1, int yt1, int h)
Definition: playermenu.cpp:84
GLclampd n
Definition: Glext.h:7286
const char * XSTR(const char *str, int index)
Definition: localize.cpp:851
user_click (mouse selects a control)
Definition: gamesnd.h:305
int Global_error_count
Definition: windebug.cpp:47
#define NOX(s)
Definition: pstypes.h:473
void _cdecl void void _cdecl Error(const char *filename, int line, SCP_FORMAT_STRING const char *format,...) SCP_FORMAT_STRING_ARGS(3
int Player_tips_shown
int pilot_verify_overwrite()
void set_hotkey(int keycode)
Definition: gadget.cpp:280
dc_printf("Player is now on the Bastion... hopefully\n")
void reset_parse(char *text)
Definition: parselo.cpp:3305
color Color_text_active
Definition: alphacolors.cpp:27
GLuint const GLchar * name
Definition: Glext.h:5608
#define MAX_PATH_LEN
Definition: pstypes.h:325
int Player_select_input_mode
Definition: playermenu.cpp:153
int bm_load(const char *real_filename)
Loads a bitmap so we can draw with it later.
Definition: bmpman.cpp:1119
GLboolean GLboolean GLboolean b
Definition: Glext.h:5781
#define DELETE_BUTTON
Definition: playermenu.cpp:48
void update_dimensions(int _x, int _y, int _w, int _h)
Definition: gadget.cpp:187
color Color_bright_white
Definition: alphacolors.cpp:32
bool load_savefile(const char *campaign)
Definition: csg.cpp:1347
char Player_select_very_first_pilot_callsign[CALLSIGN_LEN+2]
Definition: playermenu.cpp:145
scroll pressed (and scroll)
Definition: gamesnd.h:296
color Color_white
Definition: alphacolors.cpp:32
#define CALLSIGN_LEN
Definition: globals.h:31
void link_hotspot(int num)
Definition: gadget.cpp:50
char * Player_tips[MAX_PLAYER_TIPS]
int Player_select_mode
Definition: playermenu.cpp:149
void player_select_delete_pilot()
Definition: playermenu.cpp:748
void create(UI_WINDOW *wnd, char *_text, int _x, int _y, int _w, int _h, int do_repeat=0, int ignore_focus=0)
Definition: button.cpp:26
#define KEY_ESC
Definition: key.h:124
int Player_select_list_start
Definition: playermenu.cpp:151
#define UI_XSTR_COLOR_PINK
Definition: ui.h:161
void stop_parse()
Definition: parselo.cpp:2071
UI_INPUTBOX Player_select_input_box
Definition: playermenu.cpp:133
void player_select_set_middle_text(const char *txt)
#define fl2i(fl)
Definition: floating.h:33
int Num_player_tips
bool load_player(const char *callsign, player *_p=NULL)
Definition: plr.cpp:779
int Player_select_autoaccept
Definition: playermenu.cpp:138
void create(int _x, int _y, int _w, int _h, int _flags, int _f_id=-1)
Definition: window.cpp:140
player * Player
bool valid_pilot_lang(char *callsign)
Definition: playermenu.cpp:212
Definition: ui.h:584
screen gr_screen
Definition: 2d.cpp:46
void gr_get_string_size(int *w, int *h, const char *text, int len=9999)
Definition: font.cpp:196
Definition: ui.h:162
UI_WINDOW Player_select_window
Definition: playermenu.cpp:131
void enable(int n=1)
Definition: gadget.cpp:440
char * Player_select_background_bitmap_name[GR_NUM_RESOLUTIONS]
Definition: playermenu.cpp:65
int gr_get_font_height()
Definition: font.cpp:187
#define PLAYER_FLAGS_STRUCTURE_IN_USE
Definition: player.h:40
#define F_NAME
Definition: parselo.h:34
An overhauled/updated debug console to allow monitoring, testing, and general debugging of new featur...
void player_select_do()
Definition: playermenu.cpp:347
#define LCL_LANG_NAME_LEN
Definition: localize.h:31
#define LOCATION
Definition: pstypes.h:245
void common_play_highlight_sound()
Definition: gamesnd.cpp:1151
char Pilots_arr[MAX_PILOTS][MAX_FILENAME_LEN]
Definition: playermenu.cpp:154
int player_was_multi
Definition: player.h:214
void create(UI_WINDOW *wnd, int _x, int _y, int _w, int _textlen, char *_text, int _flags=0, int pixel_lim=-1, color *clr=NULL)
Definition: inputbox.cpp:101
int player_select_get_last_pilot_info()
Definition: playermenu.cpp:815
int Player_select_clone_flag
Definition: playermenu.cpp:156
void get_mouse_pos(int *xx, int *yy)
Definition: gadget.cpp:341
#define UI_INPUTBOX_FLAG_INVIS
Definition: ui.h:35
int Max_lines
Definition: playermenu.cpp:41
void game_feature_disabled_popup()
Definition: fredstubs.cpp:219
#define KEY_CTRLED
Definition: key.h:64
#define KEY_TAB
Definition: key.h:127
void get_text(char *out)
Definition: inputbox.cpp:484
void gr_bitmap(int _x, int _y, int resize_mode)
Definition: 2d.cpp:1303
#define KEY_UP
Definition: key.h:179
#define UI_XSTR_COLOR_GREEN
Definition: ui.h:160
color Color_text_normal
Definition: alphacolors.cpp:26
void set_valid_chars(char *vchars)
Definition: inputbox.cpp:152
void player_select_set_bottom_text(const char *txt)
void player_select_display_copyright()
#define PLAYER_FLAGS_IS_MULTI
Definition: player.h:42
int Player_select_screen_active
Definition: playermenu.cpp:164
int Lcl_special_chars
Definition: localize.cpp:43
int Cmdline_use_last_pilot
Definition: cmdline.cpp:282
#define GM_NORMAL
Definition: systemvars.h:19
void gamesnd_play_iface(int n)
Definition: gamesnd.cpp:260
void disable()
Definition: gadget.cpp:432
void draw()
Definition: window.cpp:220
void player_select_display_all_text()
void _cdecl void void _cdecl void _cdecl void _cdecl void _cdecl int Global_warning_count
Definition: windebug.cpp:46
void player_select_eval_very_first_pilot()
void player_select_set_input_mode(int n)
Definition: playermenu.cpp:517
void player_tips_init()
char * Pilots[MAX_PILOTS]
Definition: playermenu.cpp:155
#define STATS_FLAG_MULTIPLAYER
Definition: scoring.h:75
int process(int key_in=-1, int process_mouse=1)
Definition: window.cpp:401
void _cdecl gr_printf_menu(int x, int y, const char *format,...)
Definition: font.cpp:314
void gameseq_post_event(int event)
#define CLONE_BUTTON
Definition: playermenu.cpp:47
void main_hall_init(const SCP_string &main_hall_name)
#define UI_INPUTBOX_FLAG_KEYTHRU
Definition: ui.h:36
#define stricmp(s1, s2)
Definition: config.h:271
multi_global_options Multi_options_g
void game_process_cheats(int k)
#define SCROLL_LIST_UP_BUTTON
Definition: playermenu.cpp:49
int Player_select_initial_count
Definition: playermenu.cpp:144
int delete_pilot_file(char *pilot_name)
Definition: managepilot.cpp:54
void lcl_get_language_name(char *lang_name)
Definition: localize.cpp:1121
bool Cmdline_benchmark_mode
Definition: cmdline.cpp:514
int Player_select_background_bitmap
Definition: playermenu.cpp:136
int(* Get_file_list_filter)(const char *filename)
scoring_struct stats
Definition: player.h:127
#define PLAYER_SELECT_NUM_TEXT
Definition: playermenu.cpp:121
int Player_num
#define strcpy_s(...)
Definition: safe_strings.h:67