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