]> icculus.org git repositories - taylor/freespace2.git/blob - include/hudmessage.h
Initial revision
[taylor/freespace2.git] / include / hudmessage.h
1 /*
2  * $Logfile: /Freespace2/code/Hud/HUDmessage.h $
3  * $Revision$
4  * $Date$
5  * $Author$
6  *
7  * Header file for functions that control and manage the message window on the HUD
8  *
9  * $Log$
10  * Revision 1.1  2002/05/03 03:28:12  root
11  * Initial revision
12  *
13  * 
14  * 3     8/23/99 11:11a Jefff
15  * increased  MAX_HUD_LINE_LENGTH
16  * 
17  * 2     10/07/98 10:53a Dave
18  * Initial checkin.
19  * 
20  * 1     10/07/98 10:49a Dave
21  * 
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.
26  * 
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"
31  * button.
32  * 
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.
36  * 
37  * 22    3/12/98 4:03p Hoffoss
38  * Changed formatting used in hug scrollbacl log.
39  * 
40  * 21    1/18/98 5:09p Lawrance
41  * Added support for TEAM_TRAITOR
42  * 
43  * 20    12/03/97 11:35a Hoffoss
44  * Made changes to HUD messages send throughout the game.
45  * 
46  * 19    12/02/97 5:57p Hoffoss
47  * Changed Hud messaging code to align text to right after sending ship's
48  * name.
49  * 
50  * 18    11/13/97 10:16p Hoffoss
51  * Added icons to mission log scrollback.
52  * 
53  * 17    11/13/97 4:05p Hoffoss
54  * Added hiding code for mission log entries.
55  * 
56  * 16    11/13/97 1:13p Hoffoss
57  * Added HUD_SOURCE_HIDDEN to be used to hide items from the message
58  * scrollback log.
59  * 
60  * 15    11/12/97 6:00p Hoffoss
61  * Added training messages to hud scrollback log.
62  * 
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.
66  * 
67  * 13    11/03/97 10:12p Hoffoss
68  * Finished up work on the hud message/mission log scrollback screen.
69  * 
70  * 12    10/25/97 4:02p Lawrance
71  * took out unused hud_message struct members
72  * 
73  * 11    9/05/97 4:59p Lawrance
74  * changed MAX_HUD_LINE_LEN
75  * 
76  * 10    8/31/97 6:38p Lawrance
77  * pass in frametime to do_frame loop
78  * 
79  * 9     6/23/97 12:03p Lawrance
80  * move split_str() to Parselo
81  * 
82  * 8     6/17/97 12:25p Lawrance
83  * HUD message lines are split into multiple lines when they exceed
84  * display width
85  * 
86  * 7     4/15/97 1:26p Lawrance
87  * using a static array of nodes to store hud scrollback messages, storage
88  * for text is dynamic
89  * 
90  * 6     4/14/97 9:55a Mike
91  * Fixed HUD message system.
92  * Better game sequencing.
93  * 
94  * 5     1/24/97 9:47a Lawrance
95  * made number of message lines in HUD message area confiurable
96  * 
97  * 4     1/07/97 5:36p Lawrance
98  * Enabled save/restore for  old/present/pending hud messages
99  * 
100  * 3     11/27/96 3:20p Lawrance
101  * added scroll-back message code
102  * 
103  * 2     11/15/96 12:11a Lawrance
104  * HUD message bar working
105  *
106  * $NoKeywords: $
107  *
108 */
109
110 #ifndef _HUDMESSAGE_H
111 #define _HUDMESSAGE_H
112
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
118
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
132
133 extern int ACTIVE_BUFFER_LINES;                                 // user-preferred number of message buffer lines
134
135 typedef struct {
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
139         int x;
140 } HUD_message_data;
141
142 typedef struct line_node {
143         line_node* next;
144         line_node* prev;
145         int time;  // timestamp when message was added
146         int source;  // who/what the source of the message was (for color coding)
147         int x;
148         int y;
149         int underline_width;
150         char *text;
151 } line_node;
152
153 extern line_node Msg_scrollback_used_list;
154
155 typedef struct Hud_display_info {
156         HUD_message_data msg;
157         int y;                                          // y Coordinate to draw message at
158         int target_y;
159         int total_life;                 // timestamp id to control how long a HUD message stays alive   
160 } Hud_display_info;
161
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;
170
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
173
174 void hud_scrollback_init();
175 void hud_scrollback_close();
176 void hud_scrollback_do_frame(float frametime);
177 void hud_scrollback_exit();
178
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.
189
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();
194
195 #endif
196