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