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.7 2003/05/25 02:30:42 taylor
21 * Revision 1.6 2002/07/28 05:05:08 relnev
22 * removed some old stuff
24 * Revision 1.5 2002/07/13 06:46:48 theoddone33
27 * Revision 1.4 2002/06/09 04:41:21 relnev
28 * added copyright header
30 * Revision 1.3 2002/06/02 04:26:34 relnev
33 * Revision 1.2 2002/05/03 13:34:33 theoddone33
36 * Revision 1.1.1.1 2002/05/03 03:28:09 root
40 * 23 9/08/99 5:38p Jefff
42 * 22 9/08/99 2:38p Jefff
43 * sound pausing going to menu from game
45 * 21 9/07/99 9:42p Jefff
47 * 20 9/02/99 11:47a Jefff
48 * yet another hud message length adjustment. yeesh.
50 * 19 8/25/99 10:08a Jefff
51 * fixed another messge cut-off bug
53 * 18 8/23/99 11:12a Jefff
54 * fixed 1024 message cut-off bug
56 * 17 8/20/99 2:26p Jefff
57 * hud message text wrapping problem in hires fixed
59 * 16 8/03/99 7:27p Jefff
60 * hud messages go completely across screnn in high res now
62 * 15 8/03/99 6:21p Jefff
63 * fixed stupid bug with objectives screen key
65 * 14 8/01/99 12:39p Dave
66 * Added HUD contrast control key (for nebula).
68 * 13 7/29/99 2:58p Jefff
69 * Ingame objective screen icon key now uses normal objective icons and
70 * text is drawn in code.
72 * 12 6/16/99 5:26p Dave
73 * Fixed some bitmap and coordinate problems on the mission scrollback
76 * 11 6/10/99 3:43p Dave
77 * Do a better job of syncing text colors to HUD gauges.
79 * 10 2/02/99 10:13a Neilk
82 * 9 2/01/99 5:55p Dave
83 * Removed the idea of explicit bitmaps for buttons. Fixed text
84 * highlighting for disabled gadgets.
86 * 8 1/30/99 5:08p Dave
87 * More new hi-res stuff.Support for nice D3D textures.
89 * 7 1/30/99 3:09p Neilk
90 * More mission log coord fixes
92 * 6 1/30/99 2:59p Neilk
93 * Fixed more mission log coords
95 * 5 1/29/99 7:57p Neilk
96 * Added support for multiresolutions
98 * 4 1/06/99 2:24p Dave
99 * Stubs and release build fixes.
101 * 3 10/13/98 9:28a Dave
102 * Started neatening up freespace.h. Many variables renamed and
103 * reorganized. Added AlphaColors.[h,cpp]
105 * 2 10/07/98 10:53a Dave
108 * 1 10/07/98 10:49a Dave
110 * 89 6/09/98 5:17p Lawrance
111 * French/German localization
113 * 88 6/09/98 10:31a Hoffoss
114 * Created index numbers for all xstr() references. Any new xstr() stuff
115 * added from here on out should be added to the end if the list. The
116 * current list count can be found in FreeSpace.cpp (search for
119 * 87 5/19/98 8:36p Andsager
120 * Fix bug where last line of message log would not show if more than one
123 * 86 4/27/98 8:49p Allender
124 * make terran command display in white (with correct code anyway).
126 * 85 4/25/98 11:49p Lawrance
129 * 84 4/25/98 9:10p Hoffoss
130 * Fixed bug with scrollback origin.
132 * 83 4/25/98 5:22p Hoffoss
133 * Fixed some problems with scrolling and positioning, and added code to
134 * support pageup/pagedown.
136 * 82 4/14/98 5:06p Dave
137 * Don't load or send invalid pilot pics. Fixed chatbox graphic errors.
138 * Made chatbox display team icons in a team vs. team game. Fixed up pause
139 * and endgame sequencing issues.
141 * 81 4/14/98 2:44p Hoffoss
142 * Made arrow keys do what tab does.
144 * 80 4/08/98 4:10p John
145 * Removed all remaining traces of the evil gr_init_font_ex.
147 * 79 4/07/98 11:33a Hoffoss
148 * Fixed bug where scroll offset was wrong when first entering the F4
151 * 78 4/05/98 3:30p Dave
152 * Print netplayer messages in brighter green on the hud, with
153 * accompanying sound. Echo netplayer messages on sending machine. Fixed
154 * standalone sequencing bug where host never get the "enter mission"
157 * 77 3/27/98 11:57a Dave
158 * Put in expression checking for text messages.
160 * 76 3/17/98 4:01p Hoffoss
161 * Added HUD_SOURCE_TERRAN_CMD and changed code to utilize it when a
162 * message is being sent from Terran Command.
164 * 75 3/16/98 5:55p Lawrance
165 * Increase width of HUD message line, don't draw lines while comm menu is
168 * 74 3/12/98 4:03p Hoffoss
169 * Changed formatting used in hug scrollbacl log.
171 * 73 3/09/98 4:47p Hoffoss
172 * Changed F4 screen to start in objectives mode rather than HUD messages
175 * 72 3/09/98 2:50p Hoffoss
176 * Changed to use different palette file, and fixed bug with text
177 * overrunning the right edge of screen.
179 * 71 3/02/98 5:42p John
180 * Removed WinAVI stuff from Freespace. Made all HUD gauges wriggle from
181 * afterburner. Made gr_set_clip work good with negative x &y. Made
182 * model_caching be on by default. Made each cached model have it's own
183 * bitmap id. Made asteroids not rotate when model_caching is on.
185 * 70 2/27/98 4:55p Hoffoss
186 * Fixed some alignment problems.
188 * 69 2/27/98 4:37p Hoffoss
189 * Combined Objectives screen into Mission Log screen.
191 * 68 2/22/98 4:17p John
192 * More string externalization classification... 190 left to go!
194 * 67 2/22/98 12:19p John
195 * Externalized some strings
197 * 66 2/06/98 2:58p Hoffoss
198 * Fixed bug where mission log scrolls twice when using the arrow keys.
200 * 65 1/29/98 10:26a Hoffoss
201 * Made changes so arrow buttons repeat scrolling when held down.
203 * 64 1/20/98 4:39p Hoffoss
204 * Added mission time display to scrollback log screen.
206 * 63 1/18/98 5:09p Lawrance
207 * Added support for TEAM_TRAITOR
209 * 62 1/12/98 11:16p Lawrance
210 * Wonderful HUD config.
212 * 61 1/08/98 1:33p Hoffoss
213 * Made scroll offset reset to bottom of list instead of top.
215 * 60 1/05/98 2:59p Hoffoss
216 * Fixed bug with messages drawing outside of limits.
218 * 59 1/02/98 9:10p Lawrance
219 * Big changes to how colors get set on the HUD.
221 * 58 1/02/98 10:23a Hoffoss
222 * Fixed incorrect scrolling directions in message scrollback log.
224 * 57 12/11/97 10:17p Dave
225 * Put in some checks to make sure HUD_printfs aren't
226 * done in certain multiplayer situations.
228 * 56 12/05/97 2:16p Hoffoss
229 * Made hidden hud messages actually not show up in scrollback.
231 * 55 12/03/97 6:07p Dave
232 * Added assert that hud scrollback initialized before adding messages to
235 * 54 12/03/97 4:16p Hoffoss
236 * Changed sound stuff used in interface screens for interface purposes.
238 * 53 12/03/97 11:35a Hoffoss
239 * Made changes to HUD messages send throughout the game.
241 * 52 12/02/97 5:57p Hoffoss
242 * Changed Hud messaging code to align text to right after sending ship's
245 * 51 12/01/97 4:30p Hoffoss
246 * Changed code to list hud messages in scrollback from top down.
248 * 50 11/25/97 10:01a Jasen
249 * Remoced excess buttons from MessageLog screen.
251 * 49 11/24/97 10:03p Jasen
252 * Dang... had to make an entirely new revision of the last button. :)
254 * 48 11/24/97 9:44p Jasen
255 * Changed button name and coords to new exit button.
257 * 47 11/20/97 12:02p Lawrance
258 * change Error to nprintf at warning level
260 * 46 11/17/97 6:37p Lawrance
261 * new gauges: extended target view, new lock triangles, support ship view
263 * 45 11/14/97 2:46p Lawrance
264 * decrease width of HUD message line to 435, so it doesn overlap with
267 * 44 11/13/97 10:16p Hoffoss
268 * Added icons to mission log scrollback.
270 * 43 11/13/97 4:05p Hoffoss
271 * Added hiding code for mission log entries.
273 * 42 11/12/97 6:00p Hoffoss
274 * Added training messages to hud scrollback log.
276 * 41 11/11/97 11:16a Hoffoss
277 * Changed hud scrollback to color entire lines.
279 * 40 11/06/97 5:42p Hoffoss
280 * Added support for fixed size timstamp rendering.
282 * 39 11/05/97 7:11p Hoffoss
283 * Made changed to the hud message system. Hud messages can now have
284 * sources so they can be color coded.
286 * 38 11/04/97 4:56p Jasen
287 * Updated coordinates for buttons
289 * 37 11/03/97 10:12p Hoffoss
290 * Finished up work on the hud message/mission log scrollback screen.
292 * 36 11/03/97 5:38p Dave
293 * Cleaned up more multiplayer sequencing. Added OBJ_OBSERVER module/type.
294 * Restructured HUD_config structs/flags.
296 * 35 10/25/97 4:02p Lawrance
297 * took out unused hud_message struct members
299 * 34 10/02/97 9:53p Hoffoss
300 * Added event evaluation analysis debug screen so we can determine the
301 * state of events and their sexp trees to track down logic problems and
304 * 33 9/17/97 5:12p John
305 * Restructured collision routines. Probably broke a lot of stuff.
307 * 32 9/08/97 12:01p Lawrance
308 * when re-using HUD scrollback entries, ensure memory gets free'ed
311 * 31 8/31/97 6:38p Lawrance
312 * pass in frametime to do_frame loop
314 * 30 8/22/97 10:03a Lawrance
315 * fix exception that occurred when hud scrollback was selected from the
318 * 29 6/23/97 12:03p Lawrance
319 * move split_str() to Parselo
321 * 28 6/17/97 12:25p Lawrance
322 * HUD message lines are split into multiple lines when they exceed
325 * 27 6/12/97 10:23a John
326 * added new colors to freespace. made most menus display the background
327 * bitmap rather than dull black screen.
329 * 26 6/11/97 1:12p John
330 * Started fixing all the text colors in the game.
332 * 25 4/22/97 3:14p Lawrance
333 * only free HUD scrollback messages if they exist
335 * 24 4/15/97 1:26p Lawrance
336 * using a static array of nodes to store hud scrollback messages, storage
337 * for text is dynamic
339 * 23 4/14/97 9:55a Mike
340 * Fixed HUD message system.
341 * Better game sequencing.
343 * 22 1/28/97 5:33p Lawrance
344 * saving number of msg window lines in save game and player file
346 * 21 1/28/97 4:59p Lawrance
347 * allowing number of lines on hud message bar to be configured
349 * 20 1/24/97 9:47a Lawrance
350 * made number of message lines in HUD message area confiurable
352 * 19 1/22/97 10:56a Lawrance
353 * added check for NULL after malloc()
355 * 18 1/07/97 5:36p Lawrance
356 * Enabled save/restore for old/present/pending hud messages
358 * 17 12/10/96 12:28p Lawrance
359 * adding new offscreen target indicator
361 * 16 12/08/96 1:54a Lawrance
362 * integrating hud configuration
364 * 15 11/29/96 6:12p Lawrance
365 * took out duplicate include of timer.h
367 * 14 11/29/96 11:17a Lawrance
368 * added comments, put check in for zero-length HUD messages in the
371 * 13 11/28/96 6:27p Lawrance
372 * added some additional comments
374 * 12 11/27/96 3:20p Lawrance
375 * added scroll-back message code
377 * 11 11/22/96 1:00p Lawrance
378 * fixed bug when a key held down and created tons of messages
380 * 10 11/22/96 12:35p Lawrance
382 * 9 11/20/96 11:51a Lawrance
383 * trying out losing the HUD message shaded area
385 * 8 11/19/96 4:46p Lawrance
386 * fixed problem when too many messages were to be displayed at once
388 * 7 11/19/96 3:55p Lawrance
389 * modifed HUD message details (scroll speed, fade time etc)
391 * 6 11/19/96 10:16a Lawrance
392 * changing to new use of color scheme
394 * 5 11/17/96 5:28p Lawrance
395 * using HUD color globals instead of hard-coded numbers
397 * 4 11/15/96 11:46a Lawrance
398 * tweaked size of HUD message bar to prevent clipping of g's etc on the
401 * 3 11/15/96 11:39a Lawrance
402 * got HUD messages scrolling
404 * 2 11/15/96 12:11a Lawrance
405 * HUD message bar working
415 #include "hudmessage.h"
416 #include "hudtarget.h"
417 #include "freespace.h"
418 #include "gamesequence.h"
425 #include "linklist.h"
426 #include "missionlog.h"
428 #include "missionscreencommon.h"
433 #include "missiongoals.h"
434 #include "alphacolors.h"
436 #include "audiostr.h"
438 /* replaced with those static ints that follow
440 #define LIST_X2 108 // second column x start position
442 #define LIST_W 558 // total width including both columns
443 #define LIST_W2 (LIST_W + LIST_X - LIST_X2) // width of second column
445 #define LIST_H_O 275 // applies only to objectives mode
448 // 1st column, width includes both columns
449 static int Hud_mission_log_list_coords[GR_NUM_RESOLUTIONS][4] = {
451 46,60,558,269 // GR_640
454 74,96,558,297 // GR_1024
458 // 2nd column, width is just of second column
459 static int Hud_mission_log_list2_coords[GR_NUM_RESOLUTIONS][4] = {
461 108, 60, 496, 297 // GR_640
464 136, 96, 496, 436 // GR_1024
468 static int Hud_mission_log_list_objective_x_coord[GR_NUM_RESOLUTIONS] = {
473 static int Hud_mission_log_time_coords[GR_NUM_RESOLUTIONS][2] = {
482 static int Hud_mission_log_time2_coords[GR_NUM_RESOLUTIONS][2] = {
492 #define SCROLLBACK_MODE_MSGS_LOG 0
493 #define SCROLLBACK_MODE_EVENT_LOG 1
494 #define SCROLLBACK_MODE_OBJECTIVES 2
496 #define NUM_BUTTONS 6
498 #define SCROLL_UP_BUTTON 0
499 #define SCROLL_DOWN_BUTTON 1
500 #define SHOW_MSGS_BUTTON 2
501 #define SHOW_EVENTS_BUTTON 3
502 #define SHOW_OBJS_BUTTON 4
503 #define ACCEPT_BUTTON 5
505 #define HUD_MESSAGE_TOTAL_LIFE 14000 // total time a HUD message is alive (in milliseconds)
507 #define HUD_MSG_LENGTH_MAX 2048
508 //#define HUD_MSG_MAX_PIXEL_W 439 // maximum number of pixels wide message display area is
509 //#define HUD_MSG_MAX_PIXEL_W 619 // maximum number of pixels wide message display area is
512 // No Longer Used - DDOI
513 static int Hud_mission_log_status_coords[GR_NUM_RESOLUTIONS][2] = {
523 struct scrollback_buttons {
528 UI_BUTTON button; // because we have a class inside this struct, we need the constructor below..
530 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) {}
535 int MSG_WINDOW_X_START = 5;
536 int MSG_WINDOW_Y_START = 5;
537 int MSG_WINDOW_WIDTH; // initialed in hud_init_msg_window()
538 int MSG_WINDOW_HEIGHT;
539 int MSG_WINDOW_FONT_HEIGHT;
540 int ACTIVE_BUFFER_LINES = 4; // number of HUD messages that can be shown at one time + 1
541 int OLD_ACTIVE_BUFFER_LINES;
543 int Hud_list_start; // points to the next msg to be printed in the queue
544 int Hud_list_end; // points to the last msg in the queue
548 int Scroll_in_progress=0;
550 HUD_message_data HUD_pending[SCROLL_BUFFER_LINES];
551 Hud_display_info HUD_active_msgs_list[MAX_ACTIVE_BUFFER_LINES];
553 int HUD_msg_inited = FALSE;
555 // There is a maximum number of lines that will be stored in the message scrollback. Oldest
556 // messages are deleted to make way for newest messages.
557 #define MAX_MSG_SCROLLBACK_LINES 100
558 line_node Msg_scrollback_lines[MAX_MSG_SCROLLBACK_LINES];
560 line_node Msg_scrollback_free_list;
561 line_node Msg_scrollback_used_list;
565 typedef struct HUD_ft {
566 int end_time; // Timestamp at which this message will go away.
567 char text[MAX_HUD_LINE_LEN]; // Text to display.
568 int color; // 0rgb color, 8 bit fields.
571 HUD_ft HUD_fixed_text[MAX_HUD_FT];
573 static int Num_obj_lines;
574 static int Scroll_offset;
575 static int Scroll_max;
576 static int Scrollback_mode = SCROLLBACK_MODE_OBJECTIVES;
578 static int Status_bitmap;
580 static int Background_bitmap;
581 static UI_WINDOW Ui_window;
583 static char* Hud_mission_log_fname[GR_NUM_RESOLUTIONS] = {
584 "MissionLog", // GR_640
585 "2_MissionLog" // GR_1024
589 // No longer used - DDOI
590 static char* Hud_mission_log_status_fname[GR_NUM_RESOLUTIONS] = {
591 "MLStatus", // GR_640
592 "MLStatus" // GR_1024
596 static char* Hud_mission_log_mask_fname[GR_NUM_RESOLUTIONS] = {
597 "MissionLog-m", // GR_640
598 "2_MissionLog-m" // GR_1024
601 static scrollback_buttons Buttons[GR_NUM_RESOLUTIONS][NUM_BUTTONS] = {
605 scrollback_buttons("LB_00", 7, 89, -1, -1, 0), // scroll up
606 scrollback_buttons("LB_01", 7, 133, -1, -1, 1), // scroll down
607 scrollback_buttons("LB_02", 294, 362, -1, -1, 2), // messages
608 scrollback_buttons("LB_03", 402, 362, -1, -1, 3), // events
609 scrollback_buttons("LB_04", 193, 362, -1, -1, 4), // objectives
610 scrollback_buttons("LB_05", 554, 411, -1, -1, 5) // continue
612 scrollback_buttons("LB_00", 1, 67, -1, -1, 0),
613 scrollback_buttons("LB_01", 1, 307, -1, -1, 1),
614 scrollback_buttons("LB_02", 111, 376, 108, 413, 2),
615 scrollback_buttons("LB_03", 209, 376, 205, 413, 3),
616 scrollback_buttons("LB_04", 12, 376, 7, 413, 4),
617 scrollback_buttons("CB_05a", 571, 425, 564, 413, 5)
623 scrollback_buttons("2_LB_00", 1, 108, -1, -1, 0),
624 scrollback_buttons("2_LB_01", 1, 492, -1, -1, 1),
625 scrollback_buttons("2_LB_02", 177, 602, 173, 661, 2),
626 scrollback_buttons("2_LB_03", 335, 602, 335, 661, 3),
627 scrollback_buttons("2_LB_04", 20, 602, 11, 661, 4),
628 scrollback_buttons("2_CB_05a",914, 681, 946, 661, 5)
634 // ----------------------------------------------------------------------
635 // HUD_init_fixed_text()
637 void HUD_init_fixed_text()
641 for (i=0; i<MAX_HUD_FT; i++)
642 HUD_fixed_text[i].end_time = timestamp(0);
645 // ----------------------------------------------------------------------
646 // hud_init_msg_window()
648 // Called from HUD_init(), which is called from game_level_init()
650 void hud_init_msg_window()
654 MSG_WINDOW_WIDTH = gr_screen.clip_width - 20;
659 for (i=0; i<SCROLL_BUFFER_LINES; i++)
660 HUD_pending[i].text[0] = HUD_pending[i].text[MAX_HUD_LINE_LEN - 1] = 0;
662 for ( i=0; i < MAX_ACTIVE_BUFFER_LINES; i++ ) {
663 HUD_active_msgs_list[i].total_life = 1;
668 // determine the height of the msg window, which depends on the font height
670 h = gr_get_font_height();
672 //ACTIVE_BUFFER_LINES = Players[Player_num].HUD_config.num_msg_window_lines;
673 // ACTIVE_BUFFER_LINES = HUD_config.num_msg_window_lines;
674 ACTIVE_BUFFER_LINES = 4;
676 MSG_WINDOW_FONT_HEIGHT = h;
677 MSG_WINDOW_HEIGHT = MSG_WINDOW_FONT_HEIGHT * (ACTIVE_BUFFER_LINES-1);
679 // starting a mission, free the scroll-back buffers, but only if we've been
680 // through this function once already
681 if ( HUD_msg_inited == TRUE ) {
682 hud_free_scrollback_list();
685 list_init( &Msg_scrollback_free_list );
686 list_init( &Msg_scrollback_used_list );
688 // first slot is reserved for dummy node
689 for (i=1; i < MAX_MSG_SCROLLBACK_LINES; i++) {
690 Msg_scrollback_lines[i].text = NULL;
691 list_append(&Msg_scrollback_free_list, &Msg_scrollback_lines[i]);
696 Scroll_in_progress=0;
698 OLD_ACTIVE_BUFFER_LINES = ACTIVE_BUFFER_LINES;
700 HUD_init_fixed_text();
701 HUD_msg_inited = TRUE;
704 // ---------------------------------------------------------------------------------------
705 // hud_show_msg_window() will display the active HUD messages on the HUD. It will scroll
706 // the messages up when a new message arrives.
708 void hud_show_msg_window()
712 hud_set_default_color();
715 HUD_set_clip(MSG_WINDOW_X_START,MSG_WINDOW_Y_START, MSG_WINDOW_WIDTH, MSG_WINDOW_HEIGHT+2);
717 if ( OLD_ACTIVE_BUFFER_LINES != ACTIVE_BUFFER_LINES ) {
718 // the size of the message window has changed, the best thing to do is to put all
719 // the blank out the current hud messages. There is no need to add them to the
720 // scrollback buffer, since they are already there!
722 for ( i=0; i < ACTIVE_BUFFER_LINES; i++ ) {
723 if ( !timestamp_elapsed(HUD_active_msgs_list[i].total_life) ) {
724 HUD_active_msgs_list[i].total_life = 1;
730 OLD_ACTIVE_BUFFER_LINES = ACTIVE_BUFFER_LINES;
732 // check if there is a message to display on the HUD, and if there is room to display it
733 if ( Hud_list_start != Hud_list_end && !Scroll_needed) {
737 // if the pointer exceeds the array size, wrap around to element 1. element 0 is not used.
738 if (Hud_list_start >= SCROLL_BUFFER_LINES)
741 HUD_active_msgs_list[Active_index].msg = HUD_pending[Hud_list_start];
742 HUD_active_msgs_list[Active_index].total_life = timestamp(HUD_MESSAGE_TOTAL_LIFE);
744 for (i=Active_index+1; i < Active_index+ACTIVE_BUFFER_LINES; i++) {
745 index = i % ACTIVE_BUFFER_LINES;
747 // determine if there are any existing messages, if so need to scroll them up
749 if ( !timestamp_elapsed(HUD_active_msgs_list[index].total_life) ) {
750 HUD_active_msgs_list[index].target_y -= MSG_WINDOW_FONT_HEIGHT;
757 HUD_active_msgs_list[Active_index].y = (ACTIVE_BUFFER_LINES-1)*MSG_WINDOW_FONT_HEIGHT;
758 HUD_active_msgs_list[Active_index].target_y = HUD_active_msgs_list[Active_index].y - MSG_WINDOW_FONT_HEIGHT;
761 HUD_active_msgs_list[Active_index].y = (ACTIVE_BUFFER_LINES-2)*MSG_WINDOW_FONT_HEIGHT;
762 HUD_active_msgs_list[Active_index].target_y = HUD_active_msgs_list[Active_index].y;
766 if (Active_index >= ACTIVE_BUFFER_LINES) Active_index = 0;
768 if (Hud_list_end == Hud_list_start) { // just printed the last msg
769 Hud_list_start = Hud_list_end = 0;
773 Scroll_in_progress=0;
776 for ( i=0; i < ACTIVE_BUFFER_LINES; i++ ) {
778 if ( !timestamp_elapsed(HUD_active_msgs_list[i].total_life) ) {
780 if (HUD_active_msgs_list[i].y > HUD_active_msgs_list[i].target_y) {
782 if (timestamp_elapsed(Scroll_time_id) ){
783 HUD_active_msgs_list[i].y -= SCROLL_STEP_SIZE;
784 if (HUD_active_msgs_list[i].y < HUD_active_msgs_list[i].target_y)
785 HUD_active_msgs_list[i].y = HUD_active_msgs_list[i].target_y;
787 Scroll_in_progress=1;
792 if ( hud_gauge_active(HUD_MESSAGE_LINES) ) {
793 if ( !(Player->flags & PLAYER_FLAGS_MSG_MODE) ) {
794 // set the appropriate color
795 if(HUD_active_msgs_list[i].msg.source){
796 hud_set_gauge_color(HUD_MESSAGE_LINES, HUD_C_BRIGHT);
798 hud_set_gauge_color(HUD_MESSAGE_LINES);
801 // print the message out
802 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);
809 if (Scroll_in_progress)
810 Scroll_time_id = timestamp(SCROLL_TIME);
815 void hud_show_fixed_text()
819 hp = &HUD_fixed_text[0];
821 if (!timestamp_elapsed(hp->end_time)) {
822 //gr_set_color((hp->color >> 16) & 0xff, (hp->color >> 8) & 0xff, hp->color & 0xff);
823 gr_printf(0x8000, MSG_WINDOW_Y_START + MSG_WINDOW_HEIGHT + 8, hp->text);
827 // Similar to HUD printf, but shows only one message at a time, at a fixed location.
828 void HUD_fixed_printf(float duration, char * format, ...)
831 char tmp[HUD_MSG_LENGTH_MAX];
834 // make sure we only print these messages if we're in the correct state
835 if((Game_mode & GM_MULTIPLAYER) && (Netgame.game_state != NETGAME_STATE_IN_MISSION)){
836 nprintf(("Network","HUD_fixed_printf bailing because not in multiplayer game play state\n"));
840 va_start(args, format);
841 vsprintf(tmp, format, args);
844 msg_length = strlen(tmp);
845 Assert(msg_length < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway.
848 nprintf(("Warning", "HUD_fixed_printf ==> attempt to print a 0 length string in msg window\n"));
851 } else if (msg_length > MAX_HUD_LINE_LEN - 1){
852 nprintf(("Warning", "HUD_fixed_printf ==> Following string truncated to %d chars: %s\n",MAX_HUD_LINE_LEN,tmp));
855 if (duration == 0.0f){
856 HUD_fixed_text[0].end_time = timestamp(-1);
858 HUD_fixed_text[0].end_time = timestamp((int) (1000.0f * duration));
861 strncpy(HUD_fixed_text[0].text, tmp, MAX_HUD_LINE_LEN - 1);
862 HUD_fixed_text[0].color = 0xff0000;
865 // Clear all pending text.
866 void HUD_fixed_printf_reset()
868 HUD_init_fixed_text();
872 // --------------------------------------------------------------------------------------
875 // Print a single line of text to the HUD. We know that the text will fit on the screen,
876 // since that was taken care of in HUD_printf();
878 void HUD_printf_line(char *text, int source, int time = 0, int x = 0)
880 Assert(text != NULL);
882 // if the pointer exceeds the array size, wrap around to element 1. element 0 is not used.
884 if (Hud_list_end >= SCROLL_BUFFER_LINES)
887 if (Hud_list_end == Hud_list_start) {
888 nprintf(("Warning", "HUD ==> Exceeded msg scroll buffer, discarding message %s\n", text));
890 if (Hud_list_end == 0)
891 Hud_list_end = SCROLL_BUFFER_LINES - 1;
895 if ( strlen(text) > MAX_HUD_LINE_LEN - 1 ){
896 nprintf(("Warning", "HUD_printf_line() ==> Following string truncated to %d chars: %s\n", MAX_HUD_LINE_LEN, text));
899 strncpy(HUD_pending[Hud_list_end].text, text, MAX_HUD_LINE_LEN - 1);
900 HUD_pending[Hud_list_end].text[MAX_HUD_LINE_LEN - 1] = 0;
901 HUD_pending[Hud_list_end].source = source;
902 HUD_pending[Hud_list_end].time = time;
903 HUD_pending[Hud_list_end].x = x;
906 // converts a TEAM_* define to a HUD_SOURCE_* define
907 int HUD_get_team_source(int team)
911 return HUD_SOURCE_FRIENDLY;
914 return HUD_SOURCE_HOSTILE;
917 return HUD_SOURCE_NEUTRAL;
920 return HUD_SOURCE_UNKNOWN;
923 return HUD_SOURCE_TRAITOR;
926 nprintf(("warning", "Unknown TEAM_* define used! (%d)", team));
930 void HUD_printf(char *format, ...)
933 char tmp[HUD_MSG_LENGTH_MAX];
936 // make sure we only print these messages if we're in the correct state
937 if((Game_mode & GM_MULTIPLAYER) && (Net_player->state != NETPLAYER_STATE_IN_MISSION)){
938 nprintf(("Network","HUD_printf bailing because not in multiplayer game play state\n"));
942 va_start(args, format);
943 vsprintf(tmp, format, args);
947 Assert(len < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway.
948 hud_sourced_print(HUD_SOURCE_COMPUTER, tmp);
951 void HUD_ship_sent_printf(int sh, char *format, ...)
954 char tmp[HUD_MSG_LENGTH_MAX];
957 sprintf(tmp, NOX("%s: "), Ships[sh].ship_name);
959 Assert(len < HUD_MSG_LENGTH_MAX);
961 va_start(args, format);
962 vsprintf(tmp + len, format, args);
966 Assert(len < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway.
967 hud_sourced_print(HUD_get_team_source(Ships[sh].team), tmp);
970 // --------------------------------------------------------------------------------------
971 // HUD_sourced_printf()
973 // HUD_sourced_printf() has the same parameters as printf(), but displays the text as a scrolling
974 // message on the HUD. Text is split into multiple lines if width exceeds msg display area
975 // width. 'source' is used to indicate who send the message, and is used to color code text.
977 void HUD_sourced_printf(int source, char *format, ...)
980 char tmp[HUD_MSG_LENGTH_MAX];
982 // make sure we only print these messages if we're in the correct state
983 if((Game_mode & GM_MULTIPLAYER) && (Net_player->state != NETPLAYER_STATE_IN_MISSION)){
984 nprintf(("Network","HUD_sourced_printf bailing because not in multiplayer game play state\n"));
988 va_start(args, format);
989 vsprintf(tmp, format, args);
991 Assert(strlen(tmp) < HUD_MSG_LENGTH_MAX); // If greater than this, probably crashed anyway.
992 hud_sourced_print(source, tmp);
995 void hud_sourced_print(int source, char *msg)
998 //char *src_str, *msg_str;
999 int sw, t, x, offset = 0;
1000 //int fudge = (gr_screen.res == GR_640) ? 15 : 50; // prevents string from running off screen
1002 if ( !strlen(msg) ) {
1003 nprintf(("Warning", "HUD ==> attempt to print a 0 length string in msg window\n"));
1007 // add message to the scrollback log first
1008 hud_add_msg_to_scrollback(msg, source, timestamp());
1010 ptr = strstr(msg, NOX(": ")) + 2;
1012 gr_get_string_size(&sw, NULL, msg, ptr - msg); // get width of the speaker field
1013 //if (sw < MSG_WINDOW_WIDTH - 20)
1020 while ((ptr = split_str_once(str, MSG_WINDOW_WIDTH - x - 7)) != NULL) { // the 7 is a fudge hack
1021 HUD_printf_line(str, source, t, x);
1027 HUD_printf_line(str, source, t, x);
1030 int hud_query_scrollback_size()
1032 int count = 0, y_add = 0;
1033 int font_height = gr_get_font_height();
1036 if (EMPTY(&Msg_scrollback_used_list) || !HUD_msg_inited)
1039 ptr = GET_FIRST(&Msg_scrollback_used_list);
1040 while (ptr != END_OF_LIST(&Msg_scrollback_used_list)) {
1041 if (ptr->source != HUD_SOURCE_HIDDEN) {
1043 count += font_height + ptr->y;
1046 ptr = GET_NEXT(ptr);
1053 // add text directly to the hud scrollback log, without displaying on the hud
1054 void HUD_add_to_scrollback(char *text, int source)
1056 if (!strlen(text)) {
1057 nprintf(("Warning", "HUD ==> attempt to print a 0 length string in msg window\n"));
1061 hud_add_msg_to_scrollback(text, source, timestamp());
1064 // hud_add_msg_to_scrollback() adds the new_msg to the scroll-back message list. If there
1065 // are no more free slots, the first slot is released to make room for the new message.
1067 void hud_add_line_to_scrollback(char *text, int source, int t, int x, int y, int underline_width)
1069 line_node *new_line;
1071 Assert(HUD_msg_inited);
1072 if (!text || !strlen(text))
1075 if ( EMPTY(&Msg_scrollback_free_list) ) {
1076 new_line = GET_FIRST(&Msg_scrollback_used_list);
1077 list_remove(&Msg_scrollback_used_list, new_line);
1078 free(new_line->text);
1081 new_line = GET_FIRST(&Msg_scrollback_free_list);
1082 list_remove(&Msg_scrollback_free_list, new_line);
1087 new_line->underline_width = underline_width;
1089 new_line->source = source;
1090 new_line->text = (char *) malloc( strlen(text) + 1 );
1091 strcpy(new_line->text, text);
1092 list_append(&Msg_scrollback_used_list, new_line);
1095 void hud_add_msg_to_scrollback(char *text, int source, int t)
1097 char buf[HUD_MSG_LENGTH_MAX], *ptr, *str;
1098 int msg_len, w, max_width, x, offset = 0;
1100 max_width = Hud_mission_log_list2_coords[gr_screen.res][2];
1101 msg_len = strlen(text);
1106 Assert(msg_len < HUD_MSG_LENGTH_MAX);
1108 ptr = strstr(buf, NOX(": "));
1110 gr_get_string_size(&w, NULL, buf, ptr - buf);
1114 // gr_get_string_size(&w, NULL, buf, ptr - buf + 2);
1115 // if (w < max_width - 20)
1121 while ((ptr = split_str_once(str, max_width - x)) != NULL) {
1122 hud_add_line_to_scrollback(str, source, t, x, 1, w);
1128 hud_add_line_to_scrollback(str, source, t, x, 3, w);
1131 // hud_free_scrollback_list() will free the memory that was allocated to store the messages
1132 // for the scroll-back list
1134 void hud_free_scrollback_list()
1138 // check if the list has been inited yet. If not, return with doing nothing.
1139 if ( Msg_scrollback_used_list.next == NULL || Msg_scrollback_used_list.prev == NULL )
1142 A = GET_FIRST(&Msg_scrollback_used_list);
1143 while( A !=END_OF_LIST(&Msg_scrollback_used_list) ) {
1144 if ( A->text != NULL ) {
1153 // how many lines to skip
1154 int hud_get_scroll_max_pos()
1156 int max = 0, font_height = gr_get_font_height();
1158 if (Scrollback_mode == SCROLLBACK_MODE_MSGS_LOG) {
1161 // number of pixels in excess of what can be displayed
1162 int excess = Scroll_max - Hud_mission_log_list_coords[gr_screen.res][3];
1164 if (EMPTY(&Msg_scrollback_used_list) || !HUD_msg_inited) {
1168 ptr = GET_FIRST(&Msg_scrollback_used_list);
1169 while (ptr != END_OF_LIST(&Msg_scrollback_used_list)) {
1170 if (ptr->source != HUD_SOURCE_HIDDEN) {
1173 excess -= font_height;
1182 // spacing between lines
1187 ptr = GET_NEXT(ptr);
1192 max = (Scroll_max - Hud_mission_log_list_coords[gr_screen.res][3]) / font_height;
1201 void hud_scroll_reset()
1203 if (Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES) {
1207 Scroll_offset = hud_get_scroll_max_pos();
1211 void hud_scroll_list(int dir)
1214 if (Scroll_offset) {
1216 gamesnd_play_iface(SND_SCROLL);
1219 gamesnd_play_iface(SND_GENERAL_FAIL);
1222 if (Scroll_offset < hud_get_scroll_max_pos()) {
1224 gamesnd_play_iface(SND_SCROLL);
1227 gamesnd_play_iface(SND_GENERAL_FAIL);
1231 void hud_goto_pos(int delta)
1233 int pos=0, font_height = gr_get_font_height();
1235 if (Scrollback_mode == SCROLLBACK_MODE_MSGS_LOG) {
1236 int count = 0, y = 0;
1239 if (EMPTY(&Msg_scrollback_used_list) || !HUD_msg_inited)
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 (count == Scroll_offset) {
1250 y += font_height + ptr->y;
1254 ptr = GET_NEXT(ptr);
1257 Scroll_offset = count = y = 0;
1258 ptr = GET_FIRST(&Msg_scrollback_used_list);
1259 while (ptr != END_OF_LIST(&Msg_scrollback_used_list)) {
1260 if (ptr->source != HUD_SOURCE_HIDDEN) {
1261 if (y <= pos + delta)
1262 Scroll_offset = count;
1264 y += font_height + ptr->y;
1268 ptr = GET_NEXT(ptr);
1272 pos = Scroll_offset * font_height;
1274 Scroll_offset = pos / font_height;
1278 void hud_page_scroll_list(int dir)
1280 int max = hud_get_scroll_max_pos();
1283 if (Scroll_offset) {
1284 hud_goto_pos(-Hud_mission_log_list_coords[gr_screen.res][3]);
1285 if (Scroll_offset < 0)
1288 gamesnd_play_iface(SND_SCROLL);
1291 gamesnd_play_iface(SND_GENERAL_FAIL);
1294 if (Scroll_offset < max) {
1295 hud_goto_pos(Hud_mission_log_list_coords[gr_screen.res][3]);
1296 if (Scroll_offset > max)
1297 Scroll_offset = max;
1299 gamesnd_play_iface(SND_SCROLL);
1302 gamesnd_play_iface(SND_GENERAL_FAIL);
1306 void hud_scrollback_button_pressed(int n)
1309 case SCROLL_UP_BUTTON:
1313 case SCROLL_DOWN_BUTTON:
1317 case SHOW_MSGS_BUTTON:
1318 Scrollback_mode = SCROLLBACK_MODE_MSGS_LOG;
1319 Scroll_max = hud_query_scrollback_size();
1323 case SHOW_EVENTS_BUTTON:
1324 Scrollback_mode = SCROLLBACK_MODE_EVENT_LOG;
1325 Scroll_max = Num_log_lines * gr_get_font_height();
1329 case SHOW_OBJS_BUTTON:
1330 Scrollback_mode = SCROLLBACK_MODE_OBJECTIVES;
1331 Scroll_max = Num_obj_lines * gr_get_font_height();
1336 hud_scrollback_exit();
1341 void hud_scrollback_init()
1344 scrollback_buttons *b;
1346 // pause all game sounds
1347 beam_pause_sounds();
1348 audiostream_pause_all();
1350 common_set_interface_palette("BriefingPalette"); // set the interface palette
1351 Ui_window.create(0, 0, gr_screen.max_w, gr_screen.max_h, 0);
1352 Ui_window.set_mask_bmap(Hud_mission_log_mask_fname[gr_screen.res]);
1354 for (i=0; i<NUM_BUTTONS; i++) {
1355 b = &Buttons[gr_screen.res][i];
1357 b->button.create(&Ui_window, "", b->x, b->y, 60, 30, (i < 2), 1);
1358 // set up callback for when a mouse first goes over a button
1359 b->button.set_highlight_action(common_play_highlight_sound);
1360 b->button.set_bmaps(b->filename);
1361 b->button.link_hotspot(b->hotspot);
1366 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);
1367 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);
1368 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);
1369 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);
1372 // set up hotkeys for buttons so we draw the correct animation frame when a key is pressed
1373 Buttons[gr_screen.res][SCROLL_UP_BUTTON].button.set_hotkey(KEY_UP);
1374 Buttons[gr_screen.res][SCROLL_DOWN_BUTTON].button.set_hotkey(KEY_DOWN);
1376 Background_bitmap = bm_load(Hud_mission_log_fname[gr_screen.res]);
1378 Status_bitmap = bm_load(Hud_mission_log_status_fname[gr_screen.res]);
1381 message_log_init_scrollback(Hud_mission_log_list_coords[gr_screen.res][2]);
1382 if (Scrollback_mode == SCROLLBACK_MODE_EVENT_LOG)
1383 Scroll_max = Num_log_lines * gr_get_font_height();
1384 else if (Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES)
1385 Scroll_max = Num_obj_lines * gr_get_font_height();
1387 Scroll_max = hud_query_scrollback_size();
1389 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]);
1393 void hud_scrollback_close()
1395 ML_objectives_close();
1396 message_log_shutdown_scrollback();
1397 if (Background_bitmap >= 0)
1398 bm_unload(Background_bitmap);
1400 if (Status_bitmap >= 0)
1401 bm_unload(Status_bitmap);
1404 Ui_window.destroy();
1405 common_free_interface_palette(); // restore game palette
1408 // unpause all game sounds
1409 beam_unpause_sounds();
1410 audiostream_unpause_all();
1414 void hud_scrollback_do_frame(float frametime)
1417 int font_height = gr_get_font_height();
1419 k = Ui_window.process();
1423 if (Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES) {
1424 Scrollback_mode = SCROLLBACK_MODE_MSGS_LOG;
1425 Scroll_max = hud_query_scrollback_size();
1428 } else if (Scrollback_mode == SCROLLBACK_MODE_MSGS_LOG) {
1429 Scrollback_mode = SCROLLBACK_MODE_EVENT_LOG;
1430 Scroll_max = Num_log_lines * gr_get_font_height();
1434 Scrollback_mode = SCROLLBACK_MODE_OBJECTIVES;
1435 Scroll_max = Num_obj_lines * gr_get_font_height();
1442 case KEY_SHIFTED | KEY_TAB:
1443 if (Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES) {
1444 Scrollback_mode = SCROLLBACK_MODE_EVENT_LOG;
1445 Scroll_max = Num_log_lines * gr_get_font_height();
1448 } else if (Scrollback_mode == SCROLLBACK_MODE_MSGS_LOG) {
1449 Scrollback_mode = SCROLLBACK_MODE_OBJECTIVES;
1450 Scroll_max = Num_obj_lines * gr_get_font_height();
1454 Scrollback_mode = SCROLLBACK_MODE_MSGS_LOG;
1455 Scroll_max = hud_query_scrollback_size();
1462 hud_page_scroll_list(1);
1466 hud_page_scroll_list(0);
1470 case KEY_CTRLED | KEY_ENTER:
1472 hud_scrollback_exit();
1475 case KEY_F1: // show help overlay
1478 case KEY_F2: // goto options screen
1479 gameseq_post_event(GS_EVENT_OPTIONS_MENU);
1483 for (i=0; i<NUM_BUTTONS; i++){
1484 if (Buttons[gr_screen.res][i].button.pressed()){
1485 hud_scrollback_button_pressed(i);
1489 GR_MAYBE_CLEAR_RES(Background_bitmap);
1490 if (Background_bitmap >= 0) {
1491 gr_set_bitmap(Background_bitmap);
1496 if ((Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES) && (Status_bitmap >= 0)) {
1497 gr_set_bitmap(Status_bitmap);
1498 gr_bitmap(Hud_mission_log_status_coords[gr_screen.res][0], Hud_mission_log_status_coords[gr_screen.res][1]);
1502 // draw the objectives key at the bottom of the ingame objectives screen
1503 if (Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES) {
1504 ML_render_objectives_key();
1509 if (Scrollback_mode == SCROLLBACK_MODE_EVENT_LOG) {
1510 Buttons[gr_screen.res][SHOW_EVENTS_BUTTON].button.draw_forced(2);
1511 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]);
1513 } else if (Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES) {
1514 Buttons[gr_screen.res][SHOW_OBJS_BUTTON].button.draw_forced(2);
1515 ML_objectives_do_frame(Scroll_offset);
1518 line_node *node_ptr;
1520 Buttons[gr_screen.res][SHOW_MSGS_BUTTON].button.draw_forced(2);
1521 // y = ((LIST_H / font_height) - 1) * font_height;
1523 if ( !EMPTY(&Msg_scrollback_used_list) && HUD_msg_inited ) {
1524 node_ptr = GET_FIRST(&Msg_scrollback_used_list);
1526 while ( node_ptr != END_OF_LIST(&Msg_scrollback_used_list) ) {
1527 if ((node_ptr->source == HUD_SOURCE_HIDDEN) || (i++ < Scroll_offset)) {
1528 node_ptr = GET_NEXT(node_ptr);
1531 switch (node_ptr->source) {
1532 case HUD_SOURCE_FRIENDLY:
1536 case HUD_SOURCE_HOSTILE:
1540 case HUD_SOURCE_NEUTRAL:
1544 case HUD_SOURCE_UNKNOWN:
1548 case HUD_SOURCE_TRAINING:
1549 gr_set_color_fast(&Color_bright_blue);
1552 case HUD_SOURCE_TERRAN_CMD:
1553 gr_set_color_fast(&Color_bright_white);
1556 case HUD_SOURCE_IMPORTANT:
1557 case HUD_SOURCE_FAILED:
1558 case HUD_SOURCE_SATISFIED:
1559 gr_set_color_fast(&Color_bright_white);
1563 gr_set_color_fast(&Color_text_normal);
1568 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);
1570 x = Hud_mission_log_list2_coords[gr_screen.res][0] + node_ptr->x;
1571 gr_printf(x, Hud_mission_log_list_coords[gr_screen.res][1] + y, "%s", node_ptr->text);
1572 if (node_ptr->underline_width)
1573 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);
1575 if ((node_ptr->source == HUD_SOURCE_FAILED) || (node_ptr->source == HUD_SOURCE_SATISFIED)) {
1577 if (node_ptr->source == HUD_SOURCE_FAILED)
1578 gr_set_color_fast(&Color_bright_red);
1580 gr_set_color_fast(&Color_bright_green);
1582 i = Hud_mission_log_list_coords[gr_screen.res][1] + y + font_height / 2 - 1;
1583 gr_circle(Hud_mission_log_list2_coords[gr_screen.res][0] - 6, i, 5);
1585 gr_set_color_fast(&Color_bright);
1586 gr_line(Hud_mission_log_list2_coords[gr_screen.res][0] - 10, i, Hud_mission_log_list2_coords[gr_screen.res][0] - 8, i);
1587 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);
1588 gr_line(Hud_mission_log_list2_coords[gr_screen.res][0] - 4, i, Hud_mission_log_list2_coords[gr_screen.res][0] - 2, i);
1589 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);
1592 y += font_height + node_ptr->y;
1593 node_ptr = GET_NEXT(node_ptr);
1594 if (y + font_height > Hud_mission_log_list_coords[gr_screen.res][3])
1601 gr_set_color_fast(&Color_text_heading);
1602 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));
1603 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));
1607 void hud_scrollback_exit()
1609 gameseq_post_event(GS_EVENT_PREVIOUS_STATE);