Example #1
0
// ----------------------------------------------------------------------
// hud_init_msg_window()
//
// Called from HUD_init(), which is called from game_level_init()
//
void hud_init_msg_window()
{
	int i, h;

	MSG_WINDOW_WIDTH = gr_screen.clip_width - 20;

	Hud_list_start = 0;
	Hud_list_end = 0;

	for (i=0; i<SCROLL_BUFFER_LINES; i++)
		HUD_pending[i].text[0] = HUD_pending[i].text[MAX_HUD_LINE_LEN - 1] = 0;
	
	for ( i=0; i < MAX_ACTIVE_BUFFER_LINES; i++ ) {
		HUD_active_msgs_list[i].total_life = 1;
	}

	Scroll_time_id = 1;

	// determine the height of the msg window, which depends on the font height	
	gr_set_font(FONT1);
	h = gr_get_font_height();

	//ACTIVE_BUFFER_LINES = Players[Player_num].HUD_config.num_msg_window_lines;
//	ACTIVE_BUFFER_LINES = HUD_config.num_msg_window_lines;
	ACTIVE_BUFFER_LINES = 4;

	MSG_WINDOW_FONT_HEIGHT = h;
	MSG_WINDOW_HEIGHT = MSG_WINDOW_FONT_HEIGHT * (ACTIVE_BUFFER_LINES-1);

	// starting a mission, free the scroll-back buffers, but only if we've been
	// through this function once already
	if ( HUD_msg_inited == TRUE ) {
		hud_free_scrollback_list();
	}

	list_init( &Msg_scrollback_free_list );
	list_init( &Msg_scrollback_used_list );

	// first slot is reserved for dummy node
	for (i=1; i < MAX_MSG_SCROLLBACK_LINES; i++)	{
		Msg_scrollback_lines[i].text = NULL;
		list_append(&Msg_scrollback_free_list, &Msg_scrollback_lines[i]);
	}

	Active_index=0;
	Scroll_needed=0;
	Scroll_in_progress=0;

	OLD_ACTIVE_BUFFER_LINES = ACTIVE_BUFFER_LINES;

	HUD_init_fixed_text();
	HUD_msg_inited = TRUE;
}
// ----------------------------------------------------------------------
// hud_init_msg_window()
//
// Called from HUD_init(), which is called from game_level_init()
//
void hud_init_msg_window()
{
    int i;

    // starting a mission, free the scroll-back buffers, but only if we've been
    // through this function once already
    if ( HUD_msg_inited == TRUE ) {
        hud_free_scrollback_list();
    }

    list_init( &Msg_scrollback_free_list );
    list_init( &Msg_scrollback_used_list );

    // first slot is reserved for dummy node
    for (i=1; i < MAX_MSG_SCROLLBACK_LINES; i++)	{
        Msg_scrollback_lines[i].text = NULL;
        list_append(&Msg_scrollback_free_list, &Msg_scrollback_lines[i]);
    }

    HUD_init_fixed_text();
    HUD_msg_inited = TRUE;
}