2 * $Logfile: /Freespace2/code/Playerman/ManagePilot.h $
7 * ManagePilot.h is a header file for code to load and save pilot files, and
8 * to select and manage the pilot
11 * Revision 1.1 2002/05/03 03:28:12 root
15 * 5 1/12/99 3:15a Dave
16 * Barracks screen support for selecting squad logos. We need real artwork
19 * 4 12/14/98 12:13p Dave
20 * Spiffed up xfer system a bit. Put in support for squad logo file xfer.
23 * 3 10/09/98 5:17p Andsager
24 * move barracks screen into barracks.cpp
26 * 2 10/07/98 10:53a Dave
29 * 1 10/07/98 10:50a Dave
31 * 19 4/27/98 4:56p Hoffoss
32 * Added 'rank pips' to pilot names in barracks screen.
34 * 18 4/19/98 4:05p Dave
35 * Changed main hall region selection. Put an overwrite request in for new
36 * pilots with same callsign as existing pilots. Highlight local player by
37 * default in multi debriefing.
39 * 17 4/09/98 5:43p Dave
40 * Remove all command line processing from the demo. Began work fixing up
41 * the new multi host options screen.
43 * 16 3/25/98 2:16p Dave
44 * Select random default image for newly created pilots. Fixed several
45 * multi-pause messaging bugs. Begin work on online help for multiplayer
48 * 15 12/23/97 12:00p Allender
49 * change write_pilot_file to *not* take is_single as a default parameter.
50 * causing multiplayer pilots to get written to the single player folder
52 * 14 12/22/97 5:08p Hoffoss
53 * Changed inputbox class to be able to accept only certain keys, changed
54 * pilot screens to utilize this feature. Added to assert with pilot file
57 * 13 11/18/97 10:53a Hoffoss
59 * 12 11/12/97 4:40p Dave
60 * Put in multiplayer campaign support parsing, loading and saving. Made
61 * command-line variables better named. Changed some things on the initial
62 * pilot select screen.
64 * 11 11/11/97 4:57p Dave
65 * Put in support for single vs. multiplayer pilots. Began work on
66 * multiplayer campaign saving. Put in initial player select screen
68 * 10 10/24/97 10:59p Hoffoss
69 * Added in create pilot popup window and barracks screen.
71 * 9 10/21/97 7:18p Hoffoss
72 * Overhauled the key/joystick control structure and usage throughout the
73 * entire FreeSpace code. The whole system is very different now.
75 * 8 10/09/97 4:57p Lawrance
76 * store short_callsign in the player struct
78 * 7 12/18/96 10:18a Lawrance
79 * integrating joystick axis configuration
81 * 6 11/13/96 9:03a Lawrance
82 * Capitalized various global varibles
84 * 5 11/13/96 8:40a Lawrance
85 * fixed bug when a new campaign would not clear out the missions played
86 * from the previous campaign
88 * 4 11/05/96 8:30a Lawrance
89 * made backspace work while entering pilots names
91 * 3 11/04/96 2:56p Lawrance
92 * changed the way missions completed are read and written from .PLR file.
94 * 2 11/01/96 3:22p Lawrance
95 * implemented pilot selection, and pilot file save and restore
102 #include "controlsconfig.h"
105 #define VALID_PILOT_CHARS " _-"
107 #define MAX_PILOTS 20
108 #define MAX_PILOT_IMAGES 64
110 // pilot pic image list stuff ( call pilot_load_pic_list() to make these valid )
111 extern char Pilot_images_arr[MAX_PILOT_IMAGES][MAX_FILENAME_LEN];
112 extern char *Pilot_image_names[MAX_PILOT_IMAGES];
113 extern int Num_pilot_images;
115 // squad logo list stuff (call pilot_load_squad_pic_list() to make these valid )
116 extern char Pilot_squad_images_arr[MAX_PILOT_IMAGES][MAX_FILENAME_LEN];
117 extern char *Pilot_squad_image_names[MAX_PILOT_IMAGES];
118 extern int Num_pilot_squad_images;
120 // low-level read/writes to files
121 int read_int(CFILE *file);
122 short read_short(CFILE *file);
123 ubyte read_byte(CFILE *file);
124 void write_int(int i, CFILE *file);
125 void write_short(short s, CFILE *file);
126 void write_byte(ubyte i, CFILE *file);
128 void read_string(char *s, CFILE *f);
129 void write_string(char *s, CFILE *f);
131 // two ways of determining if a given pilot is multiplayer
132 // note, that the first version of this function can possibly return -1 if the file is invalid, etc.
133 int is_pilot_multi(CFILE *fp); // pass a newly opened (at the beginning) file pointer to the pilot file itself
134 int is_pilot_multi(player *p); // pass a pointer to a player struct
136 int verify_pilot_file(char *filename, int single = 1, int *rank = NULL);
137 int read_pilot_file(char* callsign, int single = 1, player *p = NULL);
138 int write_pilot_file(player *p = NULL);
140 // function to get default pilot callsign for game
143 void init_new_pilot(player *p, int reset = 1);
145 // load up the list of pilot image filenames (do this at game startup as well as barracks startup)
146 void pilot_load_pic_list();
148 // load up the list of pilot squad filenames
149 void pilot_load_squad_pic_list();
151 // set the truncated version of the callsign in the player struct
152 void pilot_set_short_callsign(player *p, int max_width);
154 // pick a random image for the passed player
155 void pilot_set_random_pic(player *p);
157 // pick a random squad logo for the passed player
158 void pilot_set_random_squad_pic(player *p);
160 // format a pilot's callsign into a "personal" form - ie, adding a 's or just an ' as appropriate
161 void pilot_format_callsign_personal(char *in_callsign,char *out_callsign);
163 // throw up a popup asking the user to verify the overwrite of an existing pilot name
164 // 1 == ok to overwrite, 0 == not ok
165 int pilot_verify_overwrite();
167 // functions that update player information that is stored in PLR file
168 void update_missions_played(int mission_number);
169 void clear_missions_played();