Exemplo n.º 1
0
void radar_draw_range()
{
	char buf[32];

	// hud_set_bright_color();
	hud_set_gauge_color(HUD_RADAR, HUD_C_BRIGHT);

	switch ( HUD_config.rp_dist ) {

	case RR_SHORT:
		gr_printf(Radar_dist_coords[gr_screen.res][RR_SHORT][0], Radar_dist_coords[gr_screen.res][RR_SHORT][1], XSTR( "2k", 467));
		break;

	case RR_LONG:
		gr_printf(Radar_dist_coords[gr_screen.res][RR_LONG][0], Radar_dist_coords[gr_screen.res][RR_LONG][1], XSTR( "10k", 468));
		break;

	case RR_INFINITY:
		sprintf(buf, NOX("%c"), Lcl_special_chars);
		gr_printf(Radar_dist_coords[gr_screen.res][RR_INFINITY][0], Radar_dist_coords[gr_screen.res][RR_INFINITY][1], buf);
		break;

	default:
		Int3();	// can't happen (get Alan if it does)
		break;
	}

	hud_set_default_color();
}
Exemplo n.º 2
0
/**
 * HudGaugeMessages::render() will display the active HUD messages on the HUD.  It will scroll
 * the messages up when a new message arrives.
 */
void HudGaugeMessages::render(float frametime)
{
    hud_set_default_color();

    // dependant on max_width, max_lines, and line_height
    setClip(position[0], position[1], Window_width, Window_height+2);

    for ( SCP_vector<Hud_display_info>::iterator m = active_messages.begin(); m != active_messages.end(); ++m) {
        if ( !timestamp_elapsed(m->total_life) ) {
            if ( !(Player->flags & PLAYER_FLAGS_MSG_MODE) || !Hidden_by_comms_menu) {
                // set the appropriate color
                if ( m->msg.source ) {
                    setGaugeColor(HUD_C_BRIGHT);
                } else {
                    setGaugeColor();
                }

                // print the message out
                renderPrintf(m->msg.x, m->y, "%s", m->msg.text.c_str());
            }
        }
    }
}
Exemplo n.º 3
0
// ---------------------------------------------------------------------------------------
// hud_show_msg_window() will display the active HUD messages on the HUD.  It will scroll
// the messages up when a new message arrives.  
//
void hud_show_msg_window()
{
	int i, index;

	hud_set_default_color();
	gr_set_font(FONT1);

	HUD_set_clip(MSG_WINDOW_X_START,MSG_WINDOW_Y_START, MSG_WINDOW_WIDTH, MSG_WINDOW_HEIGHT+2);

	if ( OLD_ACTIVE_BUFFER_LINES != ACTIVE_BUFFER_LINES ) {
		// the size of the message window has changed, the best thing to do is to put all
		// the blank out the current hud messages.  There is no need to add them to the 
		// scrollback buffer, since they are already there!
	
		for ( i=0; i < ACTIVE_BUFFER_LINES; i++ ) {
			if ( !timestamp_elapsed(HUD_active_msgs_list[i].total_life) ) {
				HUD_active_msgs_list[i].total_life = 1;
				Active_index=0;
			}
		}
	}
	
	OLD_ACTIVE_BUFFER_LINES = ACTIVE_BUFFER_LINES;

	// check if there is a message to display on the HUD, and if there is room to display it
	if ( Hud_list_start != Hud_list_end && !Scroll_needed) {

		Hud_list_start++;

		// if the pointer exceeds the array size, wrap around to element 1.  element 0 is not used.		
		if (Hud_list_start >= SCROLL_BUFFER_LINES)
			Hud_list_start = 1;

		HUD_active_msgs_list[Active_index].msg = HUD_pending[Hud_list_start];
		HUD_active_msgs_list[Active_index].total_life = timestamp(HUD_MESSAGE_TOTAL_LIFE);

		for (i=Active_index+1; i < Active_index+ACTIVE_BUFFER_LINES; i++) {
			index = i % ACTIVE_BUFFER_LINES;

			// determine if there are any existing messages, if so need to scroll them up

			if ( !timestamp_elapsed(HUD_active_msgs_list[index].total_life) ) {
				HUD_active_msgs_list[index].target_y -=  MSG_WINDOW_FONT_HEIGHT;
				Scroll_needed=1;
			}

		}

		if (Scroll_needed) {
			HUD_active_msgs_list[Active_index].y = (ACTIVE_BUFFER_LINES-1)*MSG_WINDOW_FONT_HEIGHT;
			HUD_active_msgs_list[Active_index].target_y = HUD_active_msgs_list[Active_index].y - MSG_WINDOW_FONT_HEIGHT;
		}
		else {
			HUD_active_msgs_list[Active_index].y = (ACTIVE_BUFFER_LINES-2)*MSG_WINDOW_FONT_HEIGHT;
			HUD_active_msgs_list[Active_index].target_y = HUD_active_msgs_list[Active_index].y;
		}

		Active_index++;
		if (Active_index >= ACTIVE_BUFFER_LINES) Active_index = 0;

		if (Hud_list_end == Hud_list_start) {	// just printed the last msg
			Hud_list_start = Hud_list_end = 0;
		}
	}

	Scroll_in_progress=0;
	Scroll_needed = 0;

	for ( i=0; i < ACTIVE_BUFFER_LINES; i++ ) {

		if ( !timestamp_elapsed(HUD_active_msgs_list[i].total_life) ) {

			if (HUD_active_msgs_list[i].y > HUD_active_msgs_list[i].target_y) {
				Scroll_needed=1;
				if (timestamp_elapsed(Scroll_time_id) ){
					HUD_active_msgs_list[i].y -= SCROLL_STEP_SIZE;
					if (HUD_active_msgs_list[i].y < HUD_active_msgs_list[i].target_y)
						HUD_active_msgs_list[i].y = HUD_active_msgs_list[i].target_y;

					Scroll_in_progress=1;
				}

			}

			if ( hud_gauge_active(HUD_MESSAGE_LINES) ) {
				if ( !(Player->flags & PLAYER_FLAGS_MSG_MODE) ) {
					// set the appropriate color					
					if(HUD_active_msgs_list[i].msg.source){
						hud_set_gauge_color(HUD_MESSAGE_LINES, HUD_C_BRIGHT);
					} else {
						hud_set_gauge_color(HUD_MESSAGE_LINES);
					}

					// print the message out
					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);
				}
			}
		}

	} // end for

	if (Scroll_in_progress)
		Scroll_time_id = timestamp(SCROLL_TIME);

	HUD_reset_clip();
}