2 * $Logfile: /Freespace2/code/Hud/HUDmessage.h $
7 * Header file for functions that control and manage the message window on the HUD
10 * Revision 1.1 2002/05/03 03:28:12 root
14 * 3 8/23/99 11:11a Jefff
15 * increased MAX_HUD_LINE_LENGTH
17 * 2 10/07/98 10:53a Dave
20 * 1 10/07/98 10:49a Dave
22 * 25 4/14/98 5:06p Dave
23 * Don't load or send invalid pilot pics. Fixed chatbox graphic errors.
24 * Made chatbox display team icons in a team vs. team game. Fixed up pause
25 * and endgame sequencing issues.
27 * 24 4/05/98 3:30p Dave
28 * Print netplayer messages in brighter green on the hud, with
29 * accompanying sound. Echo netplayer messages on sending machine. Fixed
30 * standalone sequencing bug where host never get the "enter mission"
33 * 23 3/17/98 4:01p Hoffoss
34 * Added HUD_SOURCE_TERRAN_CMD and changed code to utilize it when a
35 * message is being sent from Terran Command.
37 * 22 3/12/98 4:03p Hoffoss
38 * Changed formatting used in hug scrollbacl log.
40 * 21 1/18/98 5:09p Lawrance
41 * Added support for TEAM_TRAITOR
43 * 20 12/03/97 11:35a Hoffoss
44 * Made changes to HUD messages send throughout the game.
46 * 19 12/02/97 5:57p Hoffoss
47 * Changed Hud messaging code to align text to right after sending ship's
50 * 18 11/13/97 10:16p Hoffoss
51 * Added icons to mission log scrollback.
53 * 17 11/13/97 4:05p Hoffoss
54 * Added hiding code for mission log entries.
56 * 16 11/13/97 1:13p Hoffoss
57 * Added HUD_SOURCE_HIDDEN to be used to hide items from the message
60 * 15 11/12/97 6:00p Hoffoss
61 * Added training messages to hud scrollback log.
63 * 14 11/05/97 7:11p Hoffoss
64 * Made changed to the hud message system. Hud messages can now have
65 * sources so they can be color coded.
67 * 13 11/03/97 10:12p Hoffoss
68 * Finished up work on the hud message/mission log scrollback screen.
70 * 12 10/25/97 4:02p Lawrance
71 * took out unused hud_message struct members
73 * 11 9/05/97 4:59p Lawrance
74 * changed MAX_HUD_LINE_LEN
76 * 10 8/31/97 6:38p Lawrance
77 * pass in frametime to do_frame loop
79 * 9 6/23/97 12:03p Lawrance
80 * move split_str() to Parselo
82 * 8 6/17/97 12:25p Lawrance
83 * HUD message lines are split into multiple lines when they exceed
86 * 7 4/15/97 1:26p Lawrance
87 * using a static array of nodes to store hud scrollback messages, storage
90 * 6 4/14/97 9:55a Mike
91 * Fixed HUD message system.
92 * Better game sequencing.
94 * 5 1/24/97 9:47a Lawrance
95 * made number of message lines in HUD message area confiurable
97 * 4 1/07/97 5:36p Lawrance
98 * Enabled save/restore for old/present/pending hud messages
100 * 3 11/27/96 3:20p Lawrance
101 * added scroll-back message code
103 * 2 11/15/96 12:11a Lawrance
104 * HUD message bar working
110 #ifndef _HUDMESSAGE_H
111 #define _HUDMESSAGE_H
113 #define SCROLL_BUFFER_LINES 128 // maximum number of HUD messages that can be stored
114 #define SCROLL_TIME 30 // time in milliseconds between scrolling a message
115 #define SCROLL_STEP_SIZE 3
116 #define MAX_HUD_LINE_LEN 256 // maximum number of characters for a HUD message
117 #define MAX_ACTIVE_BUFFER_LINES 10
119 #define HUD_SOURCE_COMPUTER 0
120 #define HUD_SOURCE_FRIENDLY 1
121 #define HUD_SOURCE_HOSTILE 2
122 #define HUD_SOURCE_NEUTRAL 3
123 #define HUD_SOURCE_UNKNOWN 4
124 #define HUD_SOURCE_TRAITOR 5
125 #define HUD_SOURCE_TRAINING 6
126 #define HUD_SOURCE_HIDDEN 7
127 #define HUD_SOURCE_IMPORTANT 8
128 #define HUD_SOURCE_FAILED 9
129 #define HUD_SOURCE_SATISFIED 10
130 #define HUD_SOURCE_TERRAN_CMD 11
131 #define HUD_SOURCE_NETPLAYER 12
133 extern int ACTIVE_BUFFER_LINES; // user-preferred number of message buffer lines
136 char text[MAX_HUD_LINE_LEN];
137 int source; // where this message came from so we can color code it
138 int time; // timestamp message was originally sent
142 typedef struct line_node {
145 int time; // timestamp when message was added
146 int source; // who/what the source of the message was (for color coding)
153 extern line_node Msg_scrollback_used_list;
155 typedef struct Hud_display_info {
156 HUD_message_data msg;
157 int y; // y Coordinate to draw message at
159 int total_life; // timestamp id to control how long a HUD message stays alive
162 extern HUD_message_data HUD_pending[SCROLL_BUFFER_LINES];
163 extern Hud_display_info HUD_active_msgs_list[MAX_ACTIVE_BUFFER_LINES];
164 extern int Hud_list_start; // points to the next msg to be printed in the queue
165 extern int Hud_list_end; // points to the last msg in the queue
166 extern int Scroll_time_id;
167 extern int Active_index;
168 extern int Scroll_needed;
169 extern int Scroll_in_progress;
171 extern int MSG_WINDOW_HEIGHT; // extern'ed since needed in save/restore code
172 extern int MSG_WINDOW_FONT_HEIGHT; // extern'ed since needed in save/restore code
174 void hud_scrollback_init();
175 void hud_scrollback_close();
176 void hud_scrollback_do_frame(float frametime);
177 void hud_scrollback_exit();
179 void hud_init_msg_window();
180 void hud_show_msg_window();
181 void hud_show_fixed_text();
182 int HUD_get_team_source(int team);
183 void HUD_printf(char *format, ...);
184 void hud_sourced_print(int source, char *msg);
185 void HUD_sourced_printf(int source, char *format, ...); // send hud message from specified source
186 void HUD_ship_sent_printf(int sh, char *format, ...); // send hud message from a specific ship
187 void HUD_fixed_printf(float duration, char *format, ...); // Display a single message for duration seconds.
188 void HUD_init_fixed_text(); // Clear all pending fixed text.
190 void HUD_add_to_scrollback(char *text, int source);
191 void hud_add_line_to_scrollback(char *text, int source, int t, int x, int y, int w);
192 void hud_add_msg_to_scrollback(char *text, int source, int t);
193 void hud_free_scrollback_list();