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.cpp $
15 * C module that controls and manages the message window on the HUD
18 * Revision 1.6 2002/07/28 05:05:08 relnev
19 * removed some old stuff
21 * Revision 1.5 2002/07/13 06:46:48 theoddone33
24 * Revision 1.4 2002/06/09 04:41:21 relnev
25 * added copyright header
27 * Revision 1.3 2002/06/02 04:26:34 relnev
30 * Revision 1.2 2002/05/03 13:34:33 theoddone33
33 * Revision 1.1.1.1 2002/05/03 03:28:09 root
37 * 23 9/08/99 5:38p Jefff
39 * 22 9/08/99 2:38p Jefff
40 * sound pausing going to menu from game
42 * 21 9/07/99 9:42p Jefff
44 * 20 9/02/99 11:47a Jefff
45 * yet another hud message length adjustment. yeesh.
47 * 19 8/25/99 10:08a Jefff
48 * fixed another messge cut-off bug
50 * 18 8/23/99 11:12a Jefff
51 * fixed 1024 message cut-off bug
53 * 17 8/20/99 2:26p Jefff
54 * hud message text wrapping problem in hires fixed
56 * 16 8/03/99 7:27p Jefff
57 * hud messages go completely across screnn in high res now
59 * 15 8/03/99 6:21p Jefff
60 * fixed stupid bug with objectives screen key
62 * 14 8/01/99 12:39p Dave
63 * Added HUD contrast control key (for nebula).
65 * 13 7/29/99 2:58p Jefff
66 * Ingame objective screen icon key now uses normal objective icons and
67 * text is drawn in code.
69 * 12 6/16/99 5:26p Dave
70 * Fixed some bitmap and coordinate problems on the mission scrollback
73 * 11 6/10/99 3:43p Dave
74 * Do a better job of syncing text colors to HUD gauges.
76 * 10 2/02/99 10:13a Neilk
79 * 9 2/01/99 5:55p Dave
80 * Removed the idea of explicit bitmaps for buttons. Fixed text
81 * highlighting for disabled gadgets.
83 * 8 1/30/99 5:08p Dave
84 * More new hi-res stuff.Support for nice D3D textures.
86 * 7 1/30/99 3:09p Neilk
87 * More mission log coord fixes
89 * 6 1/30/99 2:59p Neilk
90 * Fixed more mission log coords
92 * 5 1/29/99 7:57p Neilk
93 * Added support for multiresolutions
95 * 4 1/06/99 2:24p Dave
96 * Stubs and release build fixes.
98 * 3 10/13/98 9:28a Dave
99 * Started neatening up freespace.h. Many variables renamed and
100 * reorganized. Added AlphaColors.[h,cpp]
102 * 2 10/07/98 10:53a Dave
105 * 1 10/07/98 10:49a Dave
107 * 89 6/09/98 5:17p Lawrance
108 * French/German localization
110 * 88 6/09/98 10:31a Hoffoss
111 * Created index numbers for all xstr() references. Any new xstr() stuff
112 * added from here on out should be added to the end if the list. The
113 * current list count can be found in FreeSpace.cpp (search for
116 * 87 5/19/98 8:36p Andsager
117 * Fix bug where last line of message log would not show if more than one
120 * 86 4/27/98 8:49p Allender
121 * make terran command display in white (with correct code anyway).
123 * 85 4/25/98 11:49p Lawrance
126 * 84 4/25/98 9:10p Hoffoss
127 * Fixed bug with scrollback origin.
129 * 83 4/25/98 5:22p Hoffoss
130 * Fixed some problems with scrolling and positioning, and added code to
131 * support pageup/pagedown.
133 * 82 4/14/98 5:06p Dave
134 * Don't load or send invalid pilot pics. Fixed chatbox graphic errors.
135 * Made chatbox display team icons in a team vs. team game. Fixed up pause
136 * and endgame sequencing issues.
138 * 81 4/14/98 2:44p Hoffoss
139 * Made arrow keys do what tab does.
141 * 80 4/08/98 4:10p John
142 * Removed all remaining traces of the evil gr_init_font_ex.
144 * 79 4/07/98 11:33a Hoffoss
145 * Fixed bug where scroll offset was wrong when first entering the F4
148 * 78 4/05/98 3:30p Dave
149 * Print netplayer messages in brighter green on the hud, with
150 * accompanying sound. Echo netplayer messages on sending machine. Fixed
151 * standalone sequencing bug where host never get the "enter mission"
154 * 77 3/27/98 11:57a Dave
155 * Put in expression checking for text messages.
157 * 76 3/17/98 4:01p Hoffoss
158 * Added HUD_SOURCE_TERRAN_CMD and changed code to utilize it when a
159 * message is being sent from Terran Command.
161 * 75 3/16/98 5:55p Lawrance
162 * Increase width of HUD message line, don't draw lines while comm menu is
165 * 74 3/12/98 4:03p Hoffoss
166 * Changed formatting used in hug scrollbacl log.
168 * 73 3/09/98 4:47p Hoffoss
169 * Changed F4 screen to start in objectives mode rather than HUD messages
172 * 72 3/09/98 2:50p Hoffoss
173 * Changed to use different palette file, and fixed bug with text
174 * overrunning the right edge of screen.
176 * 71 3/02/98 5:42p John
177 * Removed WinAVI stuff from Freespace. Made all HUD gauges wriggle from
178 * afterburner. Made gr_set_clip work good with negative x &y. Made
179 * model_caching be on by default. Made each cached model have it's own
180 * bitmap id. Made asteroids not rotate when model_caching is on.
182 * 70 2/27/98 4:55p Hoffoss
183 * Fixed some alignment problems.
185 * 69 2/27/98 4:37p Hoffoss
186 * Combined Objectives screen into Mission Log screen.
188 * 68 2/22/98 4:17p John
189 * More string externalization classification... 190 left to go!
191 * 67 2/22/98 12:19p John
192 * Externalized some strings
194 * 66 2/06/98 2:58p Hoffoss
195 * Fixed bug where mission log scrolls twice when using the arrow keys.
197 * 65 1/29/98 10:26a Hoffoss
198 * Made changes so arrow buttons repeat scrolling when held down.
200 * 64 1/20/98 4:39p Hoffoss
201 * Added mission time display to scrollback log screen.
203 * 63 1/18/98 5:09p Lawrance
204 * Added support for TEAM_TRAITOR
206 * 62 1/12/98 11:16p Lawrance
207 * Wonderful HUD config.
209 * 61 1/08/98 1:33p Hoffoss
210 * Made scroll offset reset to bottom of list instead of top.
212 * 60 1/05/98 2:59p Hoffoss
213 * Fixed bug with messages drawing outside of limits.
215 * 59 1/02/98 9:10p Lawrance
216 * Big changes to how colors get set on the HUD.
218 * 58 1/02/98 10:23a Hoffoss
219 * Fixed incorrect scrolling directions in message scrollback log.
221 * 57 12/11/97 10:17p Dave
222 * Put in some checks to make sure HUD_printfs aren't
223 * done in certain multiplayer situations.
225 * 56 12/05/97 2:16p Hoffoss
226 * Made hidden hud messages actually not show up in scrollback.
228 * 55 12/03/97 6:07p Dave
229 * Added assert that hud scrollback initialized before adding messages to
232 * 54 12/03/97 4:16p Hoffoss
233 * Changed sound stuff used in interface screens for interface purposes.
235 * 53 12/03/97 11:35a Hoffoss
236 * Made changes to HUD messages send throughout the game.
238 * 52 12/02/97 5:57p Hoffoss
239 * Changed Hud messaging code to align text to right after sending ship's
242 * 51 12/01/97 4:30p Hoffoss
243 * Changed code to list hud messages in scrollback from top down.
245 * 50 11/25/97 10:01a Jasen
246 * Remoced excess buttons from MessageLog screen.
248 * 49 11/24/97 10:03p Jasen
249 * Dang... had to make an entirely new revision of the last button. :)
251 * 48 11/24/97 9:44p Jasen
252 * Changed button name and coords to new exit button.
254 * 47 11/20/97 12:02p Lawrance
255 * change Error to nprintf at warning level
257 * 46 11/17/97 6:37p Lawrance
258 * new gauges: extended target view, new lock triangles, support ship view
260 * 45 11/14/97 2:46p Lawrance
261 * decrease width of HUD message line to 435, so it doesn overlap with
264 * 44 11/13/97 10:16p Hoffoss
265 * Added icons to mission log scrollback.
267 * 43 11/13/97 4:05p Hoffoss
268 * Added hiding code for mission log entries.
270 * 42 11/12/97 6:00p Hoffoss
271 * Added training messages to hud scrollback log.
273 * 41 11/11/97 11:16a Hoffoss
274 * Changed hud scrollback to color entire lines.
276 * 40 11/06/97 5:42p Hoffoss
277 * Added support for fixed size timstamp rendering.
279 * 39 11/05/97 7:11p Hoffoss
280 * Made changed to the hud message system. Hud messages can now have
281 * sources so they can be color coded.
283 * 38 11/04/97 4:56p Jasen
284 * Updated coordinates for buttons
286 * 37 11/03/97 10:12p Hoffoss
287 * Finished up work on the hud message/mission log scrollback screen.
289 * 36 11/03/97 5:38p Dave
290 * Cleaned up more multiplayer sequencing. Added OBJ_OBSERVER module/type.
291 * Restructured HUD_config structs/flags.
293 * 35 10/25/97 4:02p Lawrance
294 * took out unused hud_message struct members
296 * 34 10/02/97 9:53p Hoffoss
297 * Added event evaluation analysis debug screen so we can determine the
298 * state of events and their sexp trees to track down logic problems and
301 * 33 9/17/97 5:12p John
302 * Restructured collision routines. Probably broke a lot of stuff.
304 * 32 9/08/97 12:01p Lawrance
305 * when re-using HUD scrollback entries, ensure memory gets free'ed
308 * 31 8/31/97 6:38p Lawrance
309 * pass in frametime to do_frame loop
311 * 30 8/22/97 10:03a Lawrance
312 * fix exception that occurred when hud scrollback was selected from the
315 * 29 6/23/97 12:03p Lawrance
316 * move split_str() to Parselo
318 * 28 6/17/97 12:25p Lawrance
319 * HUD message lines are split into multiple lines when they exceed
322 * 27 6/12/97 10:23a John
323 * added new colors to freespace. made most menus display the background
324 * bitmap rather than dull black screen.
326 * 26 6/11/97 1:12p John
327 * Started fixing all the text colors in the game.
329 * 25 4/22/97 3:14p Lawrance
330 * only free HUD scrollback messages if they exist
332 * 24 4/15/97 1:26p Lawrance
333 * using a static array of nodes to store hud scrollback messages, storage
334 * for text is dynamic
336 * 23 4/14/97 9:55a Mike
337 * Fixed HUD message system.
338 * Better game sequencing.
340 * 22 1/28/97 5:33p Lawrance
341 * saving number of msg window lines in save game and player file
343 * 21 1/28/97 4:59p Lawrance
344 * allowing number of lines on hud message bar to be configured
346 * 20 1/24/97 9:47a Lawrance
347 * made number of message lines in HUD message area confiurable
349 * 19 1/22/97 10:56a Lawrance
350 * added check for NULL after malloc()
352 * 18 1/07/97 5:36p Lawrance
353 * Enabled save/restore for old/present/pending hud messages
355 * 17 12/10/96 12:28p Lawrance
356 * adding new offscreen target indicator
358 * 16 12/08/96 1:54a Lawrance
359 * integrating hud configuration
361 * 15 11/29/96 6:12p Lawrance
362 * took out duplicate include of timer.h
364 * 14 11/29/96 11:17a Lawrance
365 * added comments, put check in for zero-length HUD messages in the
368 * 13 11/28/96 6:27p Lawrance
369 * added some additional comments
371 * 12 11/27/96 3:20p Lawrance
372 * added scroll-back message code
374 * 11 11/22/96 1:00p Lawrance
375 * fixed bug when a key held down and created tons of messages
377 * 10 11/22/96 12:35p Lawrance
379 * 9 11/20/96 11:51a Lawrance
380 * trying out losing the HUD message shaded area
382 * 8 11/19/96 4:46p Lawrance
383 * fixed problem when too many messages were to be displayed at once
385 * 7 11/19/96 3:55p Lawrance
386 * modifed HUD message details (scroll speed, fade time etc)
388 * 6 11/19/96 10:16a Lawrance
389 * changing to new use of color scheme
391 * 5 11/17/96 5:28p Lawrance
392 * using HUD color globals instead of hard-coded numbers
394 * 4 11/15/96 11:46a Lawrance
395 * tweaked size of HUD message bar to prevent clipping of g's etc on the
398 * 3 11/15/96 11:39a Lawrance
399 * got HUD messages scrolling
401 * 2 11/15/96 12:11a Lawrance
402 * HUD message bar working
412 #include "hudmessage.h"
413 #include "hudtarget.h"
414 #include "freespace.h"
415 #include "gamesequence.h"
422 #include "linklist.h"
423 #include "missionlog.h"
425 #include "missionscreencommon.h"
430 #include "missiongoals.h"
431 #include "alphacolors.h"
433 #include "audiostr.h"
435 /* replaced with those static ints that follow
437 #define LIST_X2 108 // second column x start position
439 #define LIST_W 558 // total width including both columns
440 #define LIST_W2 (LIST_W + LIST_X - LIST_X2) // width of second column
442 #define LIST_H_O 275 // applies only to objectives mode
445 // 1st column, width includes both columns
446 static int Hud_mission_log_list_coords[GR_NUM_RESOLUTIONS][4] = {
448 46,60,558,269 // GR_640
451 74,96,558,297 // GR_1024
455 // 2nd column, width is just of second column
456 static int Hud_mission_log_list2_coords[GR_NUM_RESOLUTIONS][4] = {
458 108, 60, 496, 297 // GR_640
461 136, 96, 496, 436 // GR_1024
465 static int Hud_mission_log_list_objective_x_coord[GR_NUM_RESOLUTIONS] = {
470 static int Hud_mission_log_time_coords[GR_NUM_RESOLUTIONS][2] = {
479 static int Hud_mission_log_time2_coords[GR_NUM_RESOLUTIONS][2] = {
489 #define SCROLLBACK_MODE_MSGS_LOG 0
490 #define SCROLLBACK_MODE_EVENT_LOG 1
491 #define SCROLLBACK_MODE_OBJECTIVES 2
493 #define NUM_BUTTONS 6
495 #define SCROLL_UP_BUTTON 0
496 #define SCROLL_DOWN_BUTTON 1
497 #define SHOW_MSGS_BUTTON 2
498 #define SHOW_EVENTS_BUTTON 3
499 #define SHOW_OBJS_BUTTON 4
500 #define ACCEPT_BUTTON 5
502 #define HUD_MESSAGE_TOTAL_LIFE 14000 // total time a HUD message is alive (in milliseconds)
504 #define HUD_MSG_LENGTH_MAX 2048
505 //#define HUD_MSG_MAX_PIXEL_W 439 // maximum number of pixels wide message display area is
506 //#define HUD_MSG_MAX_PIXEL_W 619 // maximum number of pixels wide message display area is
508 /* // No Longer Used - DDOI
509 static int Hud_mission_log_status_coords[GR_NUM_RESOLUTIONS][2] = {
519 struct scrollback_buttons {
524 UI_BUTTON button; // because we have a class inside this struct, we need the constructor below..
526 scrollback_buttons(char *name, int x1, int y1, int x2, int y2, int h) : filename(name), x(x1), y(y1), xt(x2), yt(y2), hotspot(h) {}
531 int MSG_WINDOW_X_START = 5;
532 int MSG_WINDOW_Y_START = 5;
533 int MSG_WINDOW_WIDTH; // initialed in hud_init_msg_window()
534 int MSG_WINDOW_HEIGHT;
535 int MSG_WINDOW_FONT_HEIGHT;
536 int ACTIVE_BUFFER_LINES = 4; // number of HUD messages that can be shown at one time + 1
537 int OLD_ACTIVE_BUFFER_LINES;
539 int Hud_list_start; // points to the next msg to be printed in the queue
540 int Hud_list_end; // points to the last msg in the queue
544 int Scroll_in_progress=0;
546 HUD_message_data HUD_pending[SCROLL_BUFFER_LINES];
547 Hud_display_info HUD_active_msgs_list[MAX_ACTIVE_BUFFER_LINES];
549 int HUD_msg_inited = FALSE;
551 // There is a maximum number of lines that will be stored in the message scrollback. Oldest
552 // messages are deleted to make way for newest messages.
553 #define MAX_MSG_SCROLLBACK_LINES 100
554 line_node Msg_scrollback_lines[MAX_MSG_SCROLLBACK_LINES];
556 line_node Msg_scrollback_free_list;
557 line_node Msg_scrollback_used_list;
561 typedef struct HUD_ft {
562 int end_time; // Timestamp at which this message will go away.
563 char text[MAX_HUD_LINE_LEN]; // Text to display.
564 int color; // 0rgb color, 8 bit fields.
567 HUD_ft HUD_fixed_text[MAX_HUD_FT];
569 static int Num_obj_lines;
570 static int Scroll_offset;
571 static int Scroll_max;
572 static int Scrollback_mode = SCROLLBACK_MODE_OBJECTIVES;
573 // static int Status_bitmap;
574 static int Background_bitmap;
575 static UI_WINDOW Ui_window;
577 static char* Hud_mission_log_fname[GR_NUM_RESOLUTIONS] = {
578 "MissionLog", // GR_640
579 "2_MissionLog" // GR_1024
582 /* // No longer used - DDOI
583 static char* Hud_mission_log_status_fname[GR_NUM_RESOLUTIONS] = {
584 "MLStatus", // GR_640
585 "MLStatus" // GR_1024
589 static char* Hud_mission_log_mask_fname[GR_NUM_RESOLUTIONS] = {
590 "MissionLog-m", // GR_640
591 "2_MissionLog-m" // GR_1024
594 static scrollback_buttons Buttons[GR_NUM_RESOLUTIONS][NUM_BUTTONS] = {
597 scrollback_buttons("LB_00", 1, 67, -1, -1, 0),
598 scrollback_buttons("LB_01", 1, 307, -1, -1, 1),
599 scrollback_buttons("LB_02", 111, 376, 108, 413, 2),
600 scrollback_buttons("LB_03", 209, 376, 205, 413, 3),
601 scrollback_buttons("LB_04", 12, 376, 7, 413, 4),
602 scrollback_buttons("CB_05a", 571, 425, 564, 413, 5)
607 scrollback_buttons("2_LB_00", 1, 108, -1, -1, 0),
608 scrollback_buttons("2_LB_01", 1, 492, -1, -1, 1),
609 scrollback_buttons("2_LB_02", 177, 602, 173, 661, 2),
610 scrollback_buttons("2_LB_03", 335, 602, 335, 661, 3),
611 scrollback_buttons("2_LB_04", 20, 602, 11, 661, 4),
612 scrollback_buttons("2_CB_05a",914, 681, 946, 661, 5)
618 // ----------------------------------------------------------------------
619 // HUD_init_fixed_text()
621 void HUD_init_fixed_text()
625 for (i=0; i<MAX_HUD_FT; i++)
626 HUD_fixed_text[i].end_time = timestamp(0);
629 // ----------------------------------------------------------------------
630 // hud_init_msg_window()
632 // Called from HUD_init(), which is called from game_level_init()
634 void hud_init_msg_window()
638 MSG_WINDOW_WIDTH = gr_screen.clip_width - 20;
643 for (i=0; i<SCROLL_BUFFER_LINES; i++)
644 HUD_pending[i].text[0] = HUD_pending[i].text[MAX_HUD_LINE_LEN - 1] = 0;
646 for ( i=0; i < MAX_ACTIVE_BUFFER_LINES; i++ ) {
647 HUD_active_msgs_list[i].total_life = 1;
652 // determine the height of the msg window, which depends on the font height
654 h = gr_get_font_height();
656 //ACTIVE_BUFFER_LINES = Players[Player_num].HUD_config.num_msg_window_lines;
657 // ACTIVE_BUFFER_LINES = HUD_config.num_msg_window_lines;
658 ACTIVE_BUFFER_LINES = 4;
660 MSG_WINDOW_FONT_HEIGHT = h;
661 MSG_WINDOW_HEIGHT = MSG_WINDOW_FONT_HEIGHT * (ACTIVE_BUFFER_LINES-1);
663 // starting a mission, free the scroll-back buffers, but only if we've been
664 // through this function once already
665 if ( HUD_msg_inited == TRUE ) {
666 hud_free_scrollback_list();
669 list_init( &Msg_scrollback_free_list );
670 list_init( &Msg_scrollback_used_list );
672 // first slot is reserved for dummy node
673 for (i=1; i < MAX_MSG_SCROLLBACK_LINES; i++) {
674 Msg_scrollback_lines[i].text = NULL;
675 list_append(&Msg_scrollback_free_list, &Msg_scrollback_lines[i]);
680 Scroll_in_progress=0;
682 OLD_ACTIVE_BUFFER_LINES = ACTIVE_BUFFER_LINES;
684 HUD_init_fixed_text();
685 HUD_msg_inited = TRUE;
688 // ---------------------------------------------------------------------------------------
689 // hud_show_msg_window() will display the active HUD messages on the HUD. It will scroll
690 // the messages up when a new message arrives.
692 void hud_show_msg_window()
696 hud_set_default_color();
699 HUD_set_clip(MSG_WINDOW_X_START,MSG_WINDOW_Y_START, MSG_WINDOW_WIDTH, MSG_WINDOW_HEIGHT+2);
701 if ( OLD_ACTIVE_BUFFER_LINES != ACTIVE_BUFFER_LINES ) {
702 // the size of the message window has changed, the best thing to do is to put all
703 // the blank out the current hud messages. There is no need to add them to the
704 // scrollback buffer, since they are already there!
706 for ( i=0; i < ACTIVE_BUFFER_LINES; i++ ) {
707 if ( !timestamp_elapsed(HUD_active_msgs_list[i].total_life) ) {
708 HUD_active_msgs_list[i].total_life = 1;
714 OLD_ACTIVE_BUFFER_LINES = ACTIVE_BUFFER_LINES;
716 // check if there is a message to display on the HUD, and if there is room to display it
717 if ( Hud_list_start != Hud_list_end && !Scroll_needed) {
721 // if the pointer exceeds the array size, wrap around to element 1. element 0 is not used.
722 if (Hud_list_start >= SCROLL_BUFFER_LINES)
725 HUD_active_msgs_list[Active_index].msg = HUD_pending[Hud_list_start];
726 HUD_active_msgs_list[Active_index].total_life = timestamp(HUD_MESSAGE_TOTAL_LIFE);
728 for (i=Active_index+1; i < Active_index+ACTIVE_BUFFER_LINES; i++) {
729 index = i % ACTIVE_BUFFER_LINES;
731 // determine if there are any existing messages, if so need to scroll them up
733 if ( !timestamp_elapsed(HUD_active_msgs_list[index].total_life) ) {
734 HUD_active_msgs_list[index].target_y -= MSG_WINDOW_FONT_HEIGHT;
741 HUD_active_msgs_list[Active_index].y = (ACTIVE_BUFFER_LINES-1)*MSG_WINDOW_FONT_HEIGHT;
742 HUD_active_msgs_list[Active_index].target_y = HUD_active_msgs_list[Active_index].y - MSG_WINDOW_FONT_HEIGHT;
745 HUD_active_msgs_list[Active_index].y = (ACTIVE_BUFFER_LINES-2)*MSG_WINDOW_FONT_HEIGHT;
746 HUD_active_msgs_list[Active_index].target_y = HUD_active_msgs_list[Active_index].y;
750 if (Active_index >= ACTIVE_BUFFER_LINES) Active_index = 0;
752 if (Hud_list_end == Hud_list_start) { // just printed the last msg
753 Hud_list_start = Hud_list_end = 0;
757 Scroll_in_progress=0;
760 for ( i=0; i < ACTIVE_BUFFER_LINES; i++ ) {
762 if ( !timestamp_elapsed(HUD_active_msgs_list[i].total_life) ) {
764 if (HUD_active_msgs_list[i].y > HUD_active_msgs_list[i].target_y) {
766 if (timestamp_elapsed(Scroll_time_id) ){
767 HUD_active_msgs_list[i].y -= SCROLL_STEP_SIZE;
768 if (HUD_active_msgs_list[i].y < HUD_active_msgs_list[i].target_y)
769 HUD_active_msgs_list[i].y = HUD_active_msgs_list[i].target_y;
771 Scroll_in_progress=1;
776 if ( hud_gauge_active(HUD_MESSAGE_LINES) ) {
777 if ( !(Player->flags & PLAYER_FLAGS_MSG_MODE) ) {
778 // set the appropriate color
779 if(HUD_active_msgs_list[i].msg.source){
780 hud_set_gauge_color(HUD_MESSAGE_LINES, HUD_C_BRIGHT);
782 hud_set_gauge_color(HUD_MESSAGE_LINES);
785 // print the message out
786 gr_printf(MSG_WINDOW_X_START + HUD_active_msgs_list[i].msg.x - 2, HUD_active_msgs_list[i].y, "%s", HUD_active_msgs_list[i].msg.text);
793 if (Scroll_in_progress)
794 Scroll_time_id = timestamp(SCROLL_TIME);
799 void hud_show_fixed_text()
803 hp = &HUD_fixed_text[0];
805 if (!timestamp_elapsed(hp->end_time)) {
806 //gr_set_color((hp->color >> 16) & 0xff, (hp->color >> 8) & 0xff, hp->color & 0xff);
807 gr_printf(0x8000, MSG_WINDOW_Y_START + MSG_WINDOW_HEIGHT + 8, hp->text);
811 // Similar to HUD printf, but shows only one message at a time, at a fixed location.
812 void HUD_fixed_printf(float duration, char * format, ...)
815 char tmp[HUD_MSG_LENGTH_MAX];
818 // make sure we only print these messages if we're in the correct state
819 if((Game_mode & GM_MULTIPLAYER) && (Netgame.game_state != NETGAME_STATE_IN_MISSION)){
820 nprintf(("Network","HUD_fixed_printf bailing because not in multiplayer game play state\n"));
824 va_start(args, format);
825 vsprintf(tmp, format, args);
828 msg_length = strlen(tmp);
829 Assert(msg_length < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway.
832 nprintf(("Warning", "HUD_fixed_printf ==> attempt to print a 0 length string in msg window\n"));
835 } else if (msg_length > MAX_HUD_LINE_LEN - 1){
836 nprintf(("Warning", "HUD_fixed_printf ==> Following string truncated to %d chars: %s\n",MAX_HUD_LINE_LEN,tmp));
839 if (duration == 0.0f){
840 HUD_fixed_text[0].end_time = timestamp(-1);
842 HUD_fixed_text[0].end_time = timestamp((int) (1000.0f * duration));
845 strncpy(HUD_fixed_text[0].text, tmp, MAX_HUD_LINE_LEN - 1);
846 HUD_fixed_text[0].color = 0xff0000;
849 // Clear all pending text.
850 void HUD_fixed_printf_reset()
852 HUD_init_fixed_text();
856 // --------------------------------------------------------------------------------------
859 // Print a single line of text to the HUD. We know that the text will fit on the screen,
860 // since that was taken care of in HUD_printf();
862 void HUD_printf_line(char *text, int source, int time = 0, int x = 0)
864 Assert(text != NULL);
866 // if the pointer exceeds the array size, wrap around to element 1. element 0 is not used.
868 if (Hud_list_end >= SCROLL_BUFFER_LINES)
871 if (Hud_list_end == Hud_list_start) {
872 nprintf(("Warning", "HUD ==> Exceeded msg scroll buffer, discarding message %s\n", text));
874 if (Hud_list_end == 0)
875 Hud_list_end = SCROLL_BUFFER_LINES - 1;
879 if ( strlen(text) > MAX_HUD_LINE_LEN - 1 ){
880 nprintf(("Warning", "HUD_printf_line() ==> Following string truncated to %d chars: %s\n", MAX_HUD_LINE_LEN, text));
883 strncpy(HUD_pending[Hud_list_end].text, text, MAX_HUD_LINE_LEN - 1);
884 HUD_pending[Hud_list_end].text[MAX_HUD_LINE_LEN - 1] = 0;
885 HUD_pending[Hud_list_end].source = source;
886 HUD_pending[Hud_list_end].time = time;
887 HUD_pending[Hud_list_end].x = x;
890 // converts a TEAM_* define to a HUD_SOURCE_* define
891 int HUD_get_team_source(int team)
895 return HUD_SOURCE_FRIENDLY;
898 return HUD_SOURCE_HOSTILE;
901 return HUD_SOURCE_NEUTRAL;
904 return HUD_SOURCE_UNKNOWN;
907 return HUD_SOURCE_TRAITOR;
910 nprintf(("warning", "Unknown TEAM_* define used! (%d)", team));
914 void HUD_printf(char *format, ...)
917 char tmp[HUD_MSG_LENGTH_MAX];
920 // make sure we only print these messages if we're in the correct state
921 if((Game_mode & GM_MULTIPLAYER) && (Net_player->state != NETPLAYER_STATE_IN_MISSION)){
922 nprintf(("Network","HUD_printf bailing because not in multiplayer game play state\n"));
926 va_start(args, format);
927 vsprintf(tmp, format, args);
931 Assert(len < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway.
932 hud_sourced_print(HUD_SOURCE_COMPUTER, tmp);
935 void HUD_ship_sent_printf(int sh, char *format, ...)
938 char tmp[HUD_MSG_LENGTH_MAX];
941 sprintf(tmp, NOX("%s: "), Ships[sh].ship_name);
943 Assert(len < HUD_MSG_LENGTH_MAX);
945 va_start(args, format);
946 vsprintf(tmp + len, format, args);
950 Assert(len < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway.
951 hud_sourced_print(HUD_get_team_source(Ships[sh].team), tmp);
954 // --------------------------------------------------------------------------------------
955 // HUD_sourced_printf()
957 // HUD_sourced_printf() has the same parameters as printf(), but displays the text as a scrolling
958 // message on the HUD. Text is split into multiple lines if width exceeds msg display area
959 // width. 'source' is used to indicate who send the message, and is used to color code text.
961 void HUD_sourced_printf(int source, char *format, ...)
964 char tmp[HUD_MSG_LENGTH_MAX];
966 // make sure we only print these messages if we're in the correct state
967 if((Game_mode & GM_MULTIPLAYER) && (Net_player->state != NETPLAYER_STATE_IN_MISSION)){
968 nprintf(("Network","HUD_sourced_printf bailing because not in multiplayer game play state\n"));
972 va_start(args, format);
973 vsprintf(tmp, format, args);
975 Assert(strlen(tmp) < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway.
976 hud_sourced_print(source, tmp);
979 void hud_sourced_print(int source, char *msg)
982 //char *src_str, *msg_str;
983 int sw, t, x, offset = 0;
984 //int fudge = (gr_screen.res == GR_640) ? 15 : 50; // prevents string from running off screen
986 if ( !strlen(msg) ) {
987 nprintf(("Warning", "HUD ==> attempt to print a 0 length string in msg window\n"));
991 // add message to the scrollback log first
992 hud_add_msg_to_scrollback(msg, source, timestamp());
994 ptr = strstr(msg, NOX(": ")) + 2;
996 gr_get_string_size(&sw, NULL, msg, ptr - msg); // get width of the speaker field
997 //if (sw < MSG_WINDOW_WIDTH - 20)
1004 while ((ptr = split_str_once(str, MSG_WINDOW_WIDTH - x - 7)) != NULL) { // the 7 is a fudge hack
1005 HUD_printf_line(str, source, t, x);
1011 HUD_printf_line(str, source, t, x);
1014 int hud_query_scrollback_size()
1016 int count = 0, y_add = 0;
1017 int font_height = gr_get_font_height();
1020 if (EMPTY(&Msg_scrollback_used_list) || !HUD_msg_inited)
1023 ptr = GET_FIRST(&Msg_scrollback_used_list);
1024 while (ptr != END_OF_LIST(&Msg_scrollback_used_list)) {
1025 if (ptr->source != HUD_SOURCE_HIDDEN) {
1027 count += font_height + ptr->y;
1030 ptr = GET_NEXT(ptr);
1037 // add text directly to the hud scrollback log, without displaying on the hud
1038 void HUD_add_to_scrollback(char *text, int source)
1040 if (!strlen(text)) {
1041 nprintf(("Warning", "HUD ==> attempt to print a 0 length string in msg window\n"));
1045 hud_add_msg_to_scrollback(text, source, timestamp());
1048 // hud_add_msg_to_scrollback() adds the new_msg to the scroll-back message list. If there
1049 // are no more free slots, the first slot is released to make room for the new message.
1051 void hud_add_line_to_scrollback(char *text, int source, int t, int x, int y, int underline_width)
1053 line_node *new_line;
1055 Assert(HUD_msg_inited);
1056 if (!text || !strlen(text))
1059 if ( EMPTY(&Msg_scrollback_free_list) ) {
1060 new_line = GET_FIRST(&Msg_scrollback_used_list);
1061 list_remove(&Msg_scrollback_used_list, new_line);
1062 free(new_line->text);
1065 new_line = GET_FIRST(&Msg_scrollback_free_list);
1066 list_remove(&Msg_scrollback_free_list, new_line);
1071 new_line->underline_width = underline_width;
1073 new_line->source = source;
1074 new_line->text = (char *) malloc( strlen(text) + 1 );
1075 strcpy(new_line->text, text);
1076 list_append(&Msg_scrollback_used_list, new_line);
1079 void hud_add_msg_to_scrollback(char *text, int source, int t)
1081 char buf[HUD_MSG_LENGTH_MAX], *ptr, *str;
1082 int msg_len, w, max_width, x, offset = 0;
1084 max_width = Hud_mission_log_list2_coords[gr_screen.res][2];
1085 msg_len = strlen(text);
1090 Assert(msg_len < HUD_MSG_LENGTH_MAX);
1092 ptr = strstr(buf, NOX(": "));
1094 gr_get_string_size(&w, NULL, buf, ptr - buf);
1098 // gr_get_string_size(&w, NULL, buf, ptr - buf + 2);
1099 // if (w < max_width - 20)
1105 while ((ptr = split_str_once(str, max_width - x)) != NULL) {
1106 hud_add_line_to_scrollback(str, source, t, x, 1, w);
1112 hud_add_line_to_scrollback(str, source, t, x, 3, w);
1115 // hud_free_scrollback_list() will free the memory that was allocated to store the messages
1116 // for the scroll-back list
1118 void hud_free_scrollback_list()
1122 // check if the list has been inited yet. If not, return with doing nothing.
1123 if ( Msg_scrollback_used_list.next == NULL || Msg_scrollback_used_list.prev == NULL )
1126 A = GET_FIRST(&Msg_scrollback_used_list);
1127 while( A !=END_OF_LIST(&Msg_scrollback_used_list) ) {
1128 if ( A->text != NULL ) {
1137 // how many lines to skip
1138 int hud_get_scroll_max_pos()
1140 int max = 0, font_height = gr_get_font_height();
1142 if (Scrollback_mode == SCROLLBACK_MODE_MSGS_LOG) {
1145 // number of pixels in excess of what can be displayed
1146 int excess = Scroll_max - Hud_mission_log_list_coords[gr_screen.res][3];
1148 if (EMPTY(&Msg_scrollback_used_list) || !HUD_msg_inited) {
1152 ptr = GET_FIRST(&Msg_scrollback_used_list);
1153 while (ptr != END_OF_LIST(&Msg_scrollback_used_list)) {
1154 if (ptr->source != HUD_SOURCE_HIDDEN) {
1157 excess -= font_height;
1166 // spacing between lines
1171 ptr = GET_NEXT(ptr);
1176 max = (Scroll_max - Hud_mission_log_list_coords[gr_screen.res][3]) / font_height;
1185 void hud_scroll_reset()
1187 if (Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES) {
1191 Scroll_offset = hud_get_scroll_max_pos();
1195 void hud_scroll_list(int dir)
1198 if (Scroll_offset) {
1200 gamesnd_play_iface(SND_SCROLL);
1203 gamesnd_play_iface(SND_GENERAL_FAIL);
1206 if (Scroll_offset < hud_get_scroll_max_pos()) {
1208 gamesnd_play_iface(SND_SCROLL);
1211 gamesnd_play_iface(SND_GENERAL_FAIL);
1215 void hud_goto_pos(int delta)
1217 int pos=0, font_height = gr_get_font_height();
1219 if (Scrollback_mode == SCROLLBACK_MODE_MSGS_LOG) {
1220 int count = 0, y = 0;
1223 if (EMPTY(&Msg_scrollback_used_list) || !HUD_msg_inited)
1226 ptr = GET_FIRST(&Msg_scrollback_used_list);
1227 while (ptr != END_OF_LIST(&Msg_scrollback_used_list)) {
1228 if (ptr->source != HUD_SOURCE_HIDDEN) {
1229 if (count == Scroll_offset) {
1234 y += font_height + ptr->y;
1238 ptr = GET_NEXT(ptr);
1241 Scroll_offset = count = y = 0;
1242 ptr = GET_FIRST(&Msg_scrollback_used_list);
1243 while (ptr != END_OF_LIST(&Msg_scrollback_used_list)) {
1244 if (ptr->source != HUD_SOURCE_HIDDEN) {
1245 if (y <= pos + delta)
1246 Scroll_offset = count;
1248 y += font_height + ptr->y;
1252 ptr = GET_NEXT(ptr);
1256 pos = Scroll_offset * font_height;
1258 Scroll_offset = pos / font_height;
1262 void hud_page_scroll_list(int dir)
1264 int max = hud_get_scroll_max_pos();
1267 if (Scroll_offset) {
1268 hud_goto_pos(-Hud_mission_log_list_coords[gr_screen.res][3]);
1269 if (Scroll_offset < 0)
1272 gamesnd_play_iface(SND_SCROLL);
1275 gamesnd_play_iface(SND_GENERAL_FAIL);
1278 if (Scroll_offset < max) {
1279 hud_goto_pos(Hud_mission_log_list_coords[gr_screen.res][3]);
1280 if (Scroll_offset > max)
1281 Scroll_offset = max;
1283 gamesnd_play_iface(SND_SCROLL);
1286 gamesnd_play_iface(SND_GENERAL_FAIL);
1290 void hud_scrollback_button_pressed(int n)
1293 case SCROLL_UP_BUTTON:
1297 case SCROLL_DOWN_BUTTON:
1301 case SHOW_MSGS_BUTTON:
1302 Scrollback_mode = SCROLLBACK_MODE_MSGS_LOG;
1303 Scroll_max = hud_query_scrollback_size();
1307 case SHOW_EVENTS_BUTTON:
1308 Scrollback_mode = SCROLLBACK_MODE_EVENT_LOG;
1309 Scroll_max = Num_log_lines * gr_get_font_height();
1313 case SHOW_OBJS_BUTTON:
1314 Scrollback_mode = SCROLLBACK_MODE_OBJECTIVES;
1315 Scroll_max = Num_obj_lines * gr_get_font_height();
1320 hud_scrollback_exit();
1325 void hud_scrollback_init()
1328 scrollback_buttons *b;
1330 // pause all game sounds
1331 beam_pause_sounds();
1332 audiostream_pause_all();
1334 common_set_interface_palette("BriefingPalette"); // set the interface palette
1335 Ui_window.create(0, 0, gr_screen.max_w, gr_screen.max_h, 0);
1336 Ui_window.set_mask_bmap(Hud_mission_log_mask_fname[gr_screen.res]);
1338 for (i=0; i<NUM_BUTTONS; i++) {
1339 b = &Buttons[gr_screen.res][i];
1341 b->button.create(&Ui_window, "", b->x, b->y, 60, 30, (i < 2), 1);
1342 // set up callback for when a mouse first goes over a button
1343 b->button.set_highlight_action(common_play_highlight_sound);
1344 b->button.set_bmaps(b->filename);
1345 b->button.link_hotspot(b->hotspot);
1349 Ui_window.add_XSTR("Continue", 1069, Buttons[gr_screen.res][ACCEPT_BUTTON].xt, Buttons[gr_screen.res][ACCEPT_BUTTON].yt, &Buttons[gr_screen.res][ACCEPT_BUTTON].button, UI_XSTR_COLOR_PINK);
1350 Ui_window.add_XSTR("Events", 1070, Buttons[gr_screen.res][SHOW_EVENTS_BUTTON].xt, Buttons[gr_screen.res][SHOW_EVENTS_BUTTON].yt, &Buttons[gr_screen.res][SHOW_EVENTS_BUTTON].button, UI_XSTR_COLOR_GREEN);
1351 Ui_window.add_XSTR("Objectives", 1071, Buttons[gr_screen.res][SHOW_OBJS_BUTTON].xt, Buttons[gr_screen.res][SHOW_OBJS_BUTTON].yt, &Buttons[gr_screen.res][SHOW_OBJS_BUTTON].button, UI_XSTR_COLOR_GREEN);
1352 Ui_window.add_XSTR("Messages", 1072, Buttons[gr_screen.res][SHOW_MSGS_BUTTON].xt, Buttons[gr_screen.res][SHOW_MSGS_BUTTON].yt, &Buttons[gr_screen.res][SHOW_MSGS_BUTTON].button, UI_XSTR_COLOR_GREEN);
1354 // set up hotkeys for buttons so we draw the correct animation frame when a key is pressed
1355 Buttons[gr_screen.res][SCROLL_UP_BUTTON].button.set_hotkey(KEY_UP);
1356 Buttons[gr_screen.res][SCROLL_DOWN_BUTTON].button.set_hotkey(KEY_DOWN);
1358 Background_bitmap = bm_load(Hud_mission_log_fname[gr_screen.res]);
1359 // Status_bitmap = bm_load(Hud_mission_log_status_fname[gr_screen.res]);
1361 message_log_init_scrollback(Hud_mission_log_list_coords[gr_screen.res][2]);
1362 if (Scrollback_mode == SCROLLBACK_MODE_EVENT_LOG)
1363 Scroll_max = Num_log_lines * gr_get_font_height();
1364 else if (Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES)
1365 Scroll_max = Num_obj_lines * gr_get_font_height();
1367 Scroll_max = hud_query_scrollback_size();
1369 Num_obj_lines = ML_objectives_init(Hud_mission_log_list_coords[gr_screen.res][0], Hud_mission_log_list_coords[gr_screen.res][1], Hud_mission_log_list_coords[gr_screen.res][2], Hud_mission_log_list_objective_x_coord[gr_screen.res]);
1373 void hud_scrollback_close()
1375 ML_objectives_close();
1376 message_log_shutdown_scrollback();
1377 if (Background_bitmap >= 0)
1378 bm_unload(Background_bitmap);
1379 //if (Status_bitmap >= 0)
1380 // bm_unload(Status_bitmap);
1382 Ui_window.destroy();
1383 common_free_interface_palette(); // restore game palette
1386 // unpause all game sounds
1387 beam_unpause_sounds();
1388 audiostream_unpause_all();
1392 void hud_scrollback_do_frame(float frametime)
1395 int font_height = gr_get_font_height();
1397 k = Ui_window.process();
1401 if (Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES) {
1402 Scrollback_mode = SCROLLBACK_MODE_MSGS_LOG;
1403 Scroll_max = hud_query_scrollback_size();
1406 } else if (Scrollback_mode == SCROLLBACK_MODE_MSGS_LOG) {
1407 Scrollback_mode = SCROLLBACK_MODE_EVENT_LOG;
1408 Scroll_max = Num_log_lines * gr_get_font_height();
1412 Scrollback_mode = SCROLLBACK_MODE_OBJECTIVES;
1413 Scroll_max = Num_obj_lines * gr_get_font_height();
1420 case KEY_SHIFTED | KEY_TAB:
1421 if (Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES) {
1422 Scrollback_mode = SCROLLBACK_MODE_EVENT_LOG;
1423 Scroll_max = Num_log_lines * gr_get_font_height();
1426 } else if (Scrollback_mode == SCROLLBACK_MODE_MSGS_LOG) {
1427 Scrollback_mode = SCROLLBACK_MODE_OBJECTIVES;
1428 Scroll_max = Num_obj_lines * gr_get_font_height();
1432 Scrollback_mode = SCROLLBACK_MODE_MSGS_LOG;
1433 Scroll_max = hud_query_scrollback_size();
1440 hud_page_scroll_list(1);
1444 hud_page_scroll_list(0);
1448 case KEY_CTRLED | KEY_ENTER:
1450 hud_scrollback_exit();
1453 case KEY_F1: // show help overlay
1456 case KEY_F2: // goto options screen
1457 gameseq_post_event(GS_EVENT_OPTIONS_MENU);
1461 for (i=0; i<NUM_BUTTONS; i++){
1462 if (Buttons[gr_screen.res][i].button.pressed()){
1463 hud_scrollback_button_pressed(i);
1467 GR_MAYBE_CLEAR_RES(Background_bitmap);
1468 if (Background_bitmap >= 0) {
1469 gr_set_bitmap(Background_bitmap);
1474 if ((Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES) && (Status_bitmap >= 0)) {
1475 gr_set_bitmap(Status_bitmap);
1476 gr_bitmap(Hud_mission_log_status_coords[gr_screen.res][0], Hud_mission_log_status_coords[gr_screen.res][1]);
1480 // draw the objectives key at the bottom of the ingame objectives screen
1481 if (Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES) {
1482 ML_render_objectives_key();
1487 if (Scrollback_mode == SCROLLBACK_MODE_EVENT_LOG) {
1488 Buttons[gr_screen.res][SHOW_EVENTS_BUTTON].button.draw_forced(2);
1489 mission_log_scrollback(Scroll_offset, Hud_mission_log_list_coords[gr_screen.res][0], Hud_mission_log_list_coords[gr_screen.res][1], Hud_mission_log_list_coords[gr_screen.res][2], Hud_mission_log_list_coords[gr_screen.res][3]);
1491 } else if (Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES) {
1492 Buttons[gr_screen.res][SHOW_OBJS_BUTTON].button.draw_forced(2);
1493 ML_objectives_do_frame(Scroll_offset);
1496 line_node *node_ptr;
1498 Buttons[gr_screen.res][SHOW_MSGS_BUTTON].button.draw_forced(2);
1499 // y = ((LIST_H / font_height) - 1) * font_height;
1501 if ( !EMPTY(&Msg_scrollback_used_list) && HUD_msg_inited ) {
1502 node_ptr = GET_FIRST(&Msg_scrollback_used_list);
1504 while ( node_ptr != END_OF_LIST(&Msg_scrollback_used_list) ) {
1505 if ((node_ptr->source == HUD_SOURCE_HIDDEN) || (i++ < Scroll_offset)) {
1506 node_ptr = GET_NEXT(node_ptr);
1509 switch (node_ptr->source) {
1510 case HUD_SOURCE_FRIENDLY:
1514 case HUD_SOURCE_HOSTILE:
1518 case HUD_SOURCE_NEUTRAL:
1522 case HUD_SOURCE_UNKNOWN:
1526 case HUD_SOURCE_TRAINING:
1527 gr_set_color_fast(&Color_bright_blue);
1530 case HUD_SOURCE_TERRAN_CMD:
1531 gr_set_color_fast(&Color_bright_white);
1534 case HUD_SOURCE_IMPORTANT:
1535 case HUD_SOURCE_FAILED:
1536 case HUD_SOURCE_SATISFIED:
1537 gr_set_color_fast(&Color_bright_white);
1541 gr_set_color_fast(&Color_text_normal);
1546 gr_print_timestamp(Hud_mission_log_list_coords[gr_screen.res][0], Hud_mission_log_list_coords[gr_screen.res][1] + y, node_ptr->time);
1548 x = Hud_mission_log_list2_coords[gr_screen.res][0] + node_ptr->x;
1549 gr_printf(x, Hud_mission_log_list_coords[gr_screen.res][1] + y, "%s", node_ptr->text);
1550 if (node_ptr->underline_width)
1551 gr_line(x, Hud_mission_log_list_coords[gr_screen.res][1] + y + font_height - 1, x + node_ptr->underline_width, Hud_mission_log_list_coords[gr_screen.res][1] + y + font_height - 1);
1553 if ((node_ptr->source == HUD_SOURCE_FAILED) || (node_ptr->source == HUD_SOURCE_SATISFIED)) {
1555 if (node_ptr->source == HUD_SOURCE_FAILED)
1556 gr_set_color_fast(&Color_bright_red);
1558 gr_set_color_fast(&Color_bright_green);
1560 i = Hud_mission_log_list_coords[gr_screen.res][1] + y + font_height / 2 - 1;
1561 gr_circle(Hud_mission_log_list2_coords[gr_screen.res][0] - 6, i, 5);
1563 gr_set_color_fast(&Color_bright);
1564 gr_line(Hud_mission_log_list2_coords[gr_screen.res][0] - 10, i, Hud_mission_log_list2_coords[gr_screen.res][0] - 8, i);
1565 gr_line(Hud_mission_log_list2_coords[gr_screen.res][0] - 6, i - 4, Hud_mission_log_list2_coords[gr_screen.res][0] - 6, i - 2);
1566 gr_line(Hud_mission_log_list2_coords[gr_screen.res][0] - 4, i, Hud_mission_log_list2_coords[gr_screen.res][0] - 2, i);
1567 gr_line(Hud_mission_log_list2_coords[gr_screen.res][0] - 6, i + 2, Hud_mission_log_list2_coords[gr_screen.res][0] - 6, i + 4);
1570 y += font_height + node_ptr->y;
1571 node_ptr = GET_NEXT(node_ptr);
1572 if (y + font_height > Hud_mission_log_list_coords[gr_screen.res][3])
1579 gr_set_color_fast(&Color_text_heading);
1580 gr_print_timestamp(Hud_mission_log_time_coords[gr_screen.res][0], Hud_mission_log_time_coords[gr_screen.res][1] - font_height, (int) (f2fl(Missiontime) * 1000));
1581 gr_string(Hud_mission_log_time2_coords[gr_screen.res][0], Hud_mission_log_time_coords[gr_screen.res][1] - font_height, XSTR( "Current time", 289));
1585 void hud_scrollback_exit()
1587 gameseq_post_event(GS_EVENT_PREVIOUS_STATE);