Esempio 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();
}
Esempio n. 2
0
File: hud.c Progetto: jihnsius/d2r
void player_dead_message(void)
{
	if (!(Game_mode & GM_CAPTURE))
	{
		if (Player_exploded) {
			if ( Players[Player_num].lives < 2 )    {
				int x, y, w, h, aw;
				gr_set_curfont( HUGE_FONT );
				gr_get_string_size( TXT_GAME_OVER, &w, &h, &aw );
				w += 20;
				h += 8;
				x = (grd_curcanv->cv_bitmap.bm_w - w ) / 2;
				y = (grd_curcanv->cv_bitmap.bm_h - h ) / 2;
			
				gr_settransblend(14, GR_BLEND_NORMAL);
				gr_setcolor( BM_XRGB(0,0,0) );
				gr_rect( x, y, x+w, y+h );
				gr_settransblend(GR_FADE_OFF, GR_BLEND_NORMAL);
			
				gr_printf(0x8000, (GHEIGHT - h)/2 + h/8, TXT_GAME_OVER );
			}
		
			gr_set_curfont( GAME_FONT );
			if (HUD_color == -1)
				HUD_color = BM_XRGB(0,28,0);
			gr_set_fontcolor( HUD_color, -1);
			gr_printf(0x8000, GHEIGHT-LINE_SPACING, TXT_PRESS_ANY_KEY);
		}
	}
	extern int player_spawn_timer;
	if (Game_mode & GM_CAPTURE)
	{
		if (Player_exploded) {
			if ( Players[Player_num].lives < 2 )    {
				int x, y, w, h, aw;
				gr_set_curfont( HUGE_FONT );
				gr_get_string_size( TXT_GAME_OVER, &w, &h, &aw );
				w += 20;
				h += 8;
				x = (grd_curcanv->cv_bitmap.bm_w - w ) / 2;
				y = (grd_curcanv->cv_bitmap.bm_h - h ) / 2;
			
				gr_settransblend(14, GR_BLEND_NORMAL);
				gr_setcolor( BM_XRGB(0,0,0) );
				gr_rect( x, y, x+w, y+h );
				gr_settransblend(GR_FADE_OFF, GR_BLEND_NORMAL);
			
				gr_printf(0x8000, (GHEIGHT - h)/2 + h/8, TXT_GAME_OVER );
			}
		
			gr_set_curfont( GAME_FONT );
			if (HUD_color == -1)
				HUD_color = BM_XRGB(0,28,0);
			gr_set_fontcolor( HUD_color, -1);
			if (((player_spawn_timer + Netgame.RespawnTime*5) > f2i(Players[Player_num].time_level)) && force_respawn == 0) gr_printf(0x8000, GHEIGHT-LINE_SPACING, "You must wait %d seconds to respawn.", (player_spawn_timer + (Netgame.RespawnTime*5)) - f2i(Players[Player_num].time_level));
			if (((player_spawn_timer + Netgame.RespawnTime*5) > f2i(Players[Player_num].time_level)) && force_respawn == 1) gr_printf(0x8000, GHEIGHT-LINE_SPACING, "You will respawn in %d seconds.", (player_spawn_timer + (Netgame.RespawnTime*5)) - f2i(Players[Player_num].time_level));
			if ((player_spawn_timer + Netgame.RespawnTime*5) <= f2i(Players[Player_num].time_level)) gr_printf(0x8000, GHEIGHT-LINE_SPACING, "Press any key or button to respawn.");
		}
	}
}
Esempio n. 3
0
File: titles.c Progetto: btb/d1x
//	-----------------------------------------------------------------------------
//	Returns char width.
//	If show_robot_flag set, then show a frame of the spinning robot.
int show_char_delay(char the_char, int delay, int robot_num, int cursor_flag)
{
	int	w, h, aw;
	char	message[2];
	fix	start_time;
	int	i;

	start_time = timer_get_fixed_seconds();

	message[0] = the_char;
	message[1] = 0;

	gr_get_string_size(message, &w, &h, &aw );

	Assert((Current_color >= 0) && (Current_color < MAX_BRIEFING_COLORS));

	//	Draw cursor if there is some delay and caller says to draw cursor
//added/changed on 9/13/98 by adb to fix messy code and add gr_update
     if (delay)
      {
	if (cursor_flag && delay) {
		gr_set_fontcolor(Briefing_foreground_colors[Current_color], -1);
		gr_printf(Briefing_text_x+1, Briefing_text_y, "_" );
	}

	for (i=0; i<2; i++) {
                if (robot_num != -1)
			show_spinning_robot_frame(robot_num);
                show_bitmap_frame();

                gr_update();

		while (timer_get_fixed_seconds() < start_time + delay/2)
			;

		start_time = timer_get_fixed_seconds();
	}

	//	Erase cursor
        if (cursor_flag) {
		gr_set_fontcolor(Erase_color, -1);
		gr_printf(Briefing_text_x+1, Briefing_text_y, "_" );
	}
      }
//end additions/changed - adb

	//	Draw the character
	gr_set_fontcolor(Briefing_background_colors[Current_color], -1);
	gr_printf(Briefing_text_x, Briefing_text_y, message );

	gr_set_fontcolor(Briefing_foreground_colors[Current_color], -1);
	gr_printf(Briefing_text_x+1, Briefing_text_y, message );

//	if (the_char != ' ')
//		if (!digi_is_sound_playing(231))
//			digi_play_sample( 231, F1_0 );

	return w;
}
Esempio n. 4
0
void kmatrix_status_msg (fix time, int reactor)
{
	grd_curcanv->cv_font = GAME_FONT;
	gr_set_fontcolor(gr_find_closest_color(255,255,255),-1);

	if (reactor)
		gr_printf(0x8000, SHEIGHT-LINE_SPACING, "Waiting for players to finish level. Reactor time: T-%d", time);
	else
		gr_printf(0x8000, SHEIGHT-LINE_SPACING, "Level finished. Wait (%d) to proceed or ESC to Quit.", time);
}
Esempio n. 5
0
void kmatrix_draw_coop_item( int  i, int *sorted )
{
	int  x, y;

	y = FSPACY(50+i*9);
	gr_printf( FSPACX(CENTERING_OFFSET(N_players)), y, "%s", Players[sorted[i]].callsign );
	x = CENTERSCREEN;
	gr_set_fontcolor( BM_XRGB(60,40,10),-1 );
	gr_printf( x, y, "%d", Players[sorted[i]].score );
	x = CENTERSCREEN+FSPACX(50);
	gr_set_fontcolor( BM_XRGB(60,40,10),-1 );
	gr_printf( x, y, "%d", Players[sorted[i]].net_killed_total);
}
Esempio n. 6
0
void game_draw_multi_message()
{

	if ( (Game_mode&GM_MULTI) && (multi_sending_message[Player_num]))	{
		gr_set_curfont(GAME_FONT);
		gr_set_fontcolor(BM_XRGB(0,63,0),-1);
		gr_printf(0x8000, (LINE_SPACING*5)+FSPACY(1), "%s: %s_", TXT_MESSAGE, Network_message );
	}

	if ( (Game_mode&GM_MULTI) && (multi_defining_message))	{
		gr_set_curfont(GAME_FONT);
		gr_set_fontcolor(BM_XRGB(0,63,0),-1);
		gr_printf(0x8000, (LINE_SPACING*5)+FSPACY(1), "%s #%d: %s_", TXT_MACRO, multi_defining_message, Network_message );
	}
}
Esempio n. 7
0
void show_framerate()
{
	static int fps_count = 0, fps_rate = 0;
	int y = GHEIGHT;
	static fix64 fps_time = 0;

	gr_set_curfont(GAME_FONT);
	gr_set_fontcolor(BM_XRGB(0,31,0),-1);

	if (PlayerCfg.CockpitMode[1] == CM_FULL_SCREEN) {
		if ((Game_mode & GM_MULTI) || (Newdemo_state == ND_STATE_PLAYBACK && Newdemo_game_mode & GM_MULTI))
			y -= LINE_SPACING * 10;
		else
			y -= LINE_SPACING * 4;
	} else if (PlayerCfg.CockpitMode[1] == CM_STATUS_BAR) {
		if ((Game_mode & GM_MULTI) || (Newdemo_state == ND_STATE_PLAYBACK && Newdemo_game_mode & GM_MULTI))
			y -= LINE_SPACING * 6;
		else
			y -= LINE_SPACING * 1;
	} else {
		if ((Game_mode & GM_MULTI) || (Newdemo_state == ND_STATE_PLAYBACK && Newdemo_game_mode & GM_MULTI))
			y -= LINE_SPACING * 7;
		else
			y -= LINE_SPACING * 2;
	}

	fps_count++;
	if (timer_query() >= fps_time + F1_0)
	{
		fps_rate = fps_count;
		fps_count = 0;
		fps_time = timer_query();
	}
	gr_printf(SWIDTH-(GameArg.SysMaxFPS>999?FSPACX(43):FSPACX(37)),y,"FPS: %i",fps_rate);
}
Esempio n. 8
0
// Display a line of goal text
//   n = goal text line number
//   y = y offset to draw relative to goal text area top
void goal_text::display(int n, int y)
{
	int y1, w, h;
	char buf[MAX_GOAL_TEXT];

	if ((n < 0) || (n >= m_num_lines) || (m_line_sizes[n] < 1))
		return;  // out of range, don't draw anything

	Assert(m_line_sizes[n] < MAX_GOAL_TEXT);
	y += Goal_screen_text_y;
	if (*m_lines[n] == '*') {  // header line
		gr_set_color_fast(&Color_text_heading);
		strncpy(buf, m_lines[n] + 1, m_line_sizes[n] - 1);
		buf[m_line_sizes[n] - 1] = 0;

		gr_get_string_size(&w, &h, buf);
		y1 = y + h / 2 - 1;
		gr_line(Goal_screen_icon_x, y1, Goal_screen_text_x - 2, y1);
		gr_line(Goal_screen_text_x + w + 1, y1, Goal_screen_icon_x + Goal_screen_text_w, y1);

	} else {
		gr_set_color_fast(&Color_text_normal);
		strncpy(buf, m_lines[n], m_line_sizes[n]);
		buf[m_line_sizes[n]] = 0;
	}

	gr_printf(Goal_screen_text_x, y, buf);
}
// display
void multi_rate_display(int np_index, int x, int y)
{	
	int idx;
	mr_info *m;

	// sanity checks
	if((np_index < 0) || (np_index >= MAX_RATE_PLAYERS)){
		return;
	}

	// get info
	for(idx=0; idx<MAX_RATE_TYPES; idx++){
		m = &Multi_rate[np_index][idx];

		// if we have a 0 length string, we're done
		if(strlen(m->type) <= 0){
			break;
		}

		// display
		gr_set_color_fast(&Color_red);
		gr_printf(x, y, "%s %d (%d/s) (%f/f)", m->type, m->total_bytes, (int)m->avg_second, m->avg_frame);
		y += 10;
	}
}
Esempio n. 10
0
// Draw the button text nicely formatted in the popup
void popup_draw_button_text(popup_info *pi, int flags)
{
	int w, h, i, sx, sy;

	gr_set_color_fast(&Color_bright_blue);

	for ( i=0; i < pi->nchoices; i++ ) {
		gr_get_string_size(&w, &h, pi->button_text[i]);

		if ( (pi->nchoices == 1) && (flags&PF_USE_AFFIRMATIVE_ICON) ) {
			sx = Button_regions[gr_screen.res][i+1][0]-w;
			sy = Button_regions[gr_screen.res][i+1][1]+4;
		} else {
			sx = Button_regions[gr_screen.res][i][0]-w;
			sy = Button_regions[gr_screen.res][i][1]+4;
		}

		gr_string(sx, sy, pi->button_text[i]);

		// figure out where to draw underline char
		if ( pi->shortcut_index[i] > 0 ) {
			int	cut=pi->shortcut_index[i];
			char	save_char=pi->button_text[i][cut];
			pi->button_text[i][cut] = 0;
			gr_get_string_size(&w, &h, pi->button_text[i]);
			pi->button_text[i][cut] = save_char;
			sx += w;
		}
		
		if ( pi->shortcut_index[i] >= 0 ) {
			gr_printf(sx, sy, NOX("%c"), 95);
		}
	}
}
Esempio n. 11
0
void kmatrix_draw_names(int *sorted)
{
	int j, x, color;

	if(Netgame.FairColors)
		selected_player_rgb = player_rgb_all_blue; 
	else if(Netgame.BlackAndWhitePyros) 
		selected_player_rgb = player_rgb_alt; 
	else
		selected_player_rgb = player_rgb;	

	for (j=0; j<N_players; j++)
	{
		if (Game_mode & GM_TEAM)
			color = get_team(sorted[j]);
		else
			color = sorted[j];

		x = FSPACX (70 + CENTERING_OFFSET(N_players) + j*25);

		if (Players[sorted[j]].connected==CONNECT_DISCONNECTED)
			gr_set_fontcolor(gr_find_closest_color(31,31,31),-1);
		else
			gr_set_fontcolor(BM_XRGB(selected_player_rgb[color].r,selected_player_rgb[color].g,selected_player_rgb[color].b),-1 );

		gr_printf( x, FSPACY(40), "%c", Players[sorted[j]].callsign[0] );
	}

	x = FSPACX(72 + CENTERING_OFFSET(N_players) + N_players*25);
	gr_set_fontcolor( BM_XRGB(31,31,31),-1 );
	gr_string( x, FSPACY(40), "K/E");
}
Esempio n. 12
0
//print to canvas & double height
grs_canvas *print_to_canvas(char *s,grs_font *font, int fc, int bc)
{
	int y;
	ubyte *data;
	int rs;
	grs_canvas *temp_canv,*save_canv;

	save_canv = grd_curcanv;

	temp_canv = gr_create_canvas(font->ft_w*strlen(s),font->ft_h*2);

	gr_set_current_canvas(temp_canv);
	gr_set_curfont(font);
	gr_clear_canvas(255);						//trans color
	gr_set_fontcolor(fc,bc);
	gr_printf(0,0,s);

	//now double it, since we're drawing to 400-line modex screen

	data = temp_canv->cv_bitmap.bm_data;
	rs = temp_canv->cv_bitmap.bm_rowsize;

	for (y=temp_canv->cv_bitmap.bm_h/2;y--;) {
		memcpy(data+(rs*y*2),data+(rs*y),temp_canv->cv_bitmap.bm_w);
		memcpy(data+(rs*(y*2+1)),data+(rs*y),temp_canv->cv_bitmap.bm_w);
	}

	gr_set_current_canvas(save_canv);

	return temp_canv;
}
Esempio n. 13
0
void autodemo_menu_check(int nitems, newmenu_item * items, int *last_key, int citem )
{
	int curtime;

	nitems = nitems;
	items=items;
	citem = citem;

	//draw copyright message
	if ( Menu_draw_copyright )		{
		Menu_draw_copyright = 0;
		gr_set_current_canvas(NULL);
		gr_set_curfont(GAME_FONT);
		gr_set_fontcolor(BM_XRGB(6,6,6),-1);
		gr_printf(0x8000,grd_curcanv->cv_bitmap.bm_h-GAME_FONT->ft_h-2,TXT_COPYRIGHT);
	}
	
	// Don't allow them to hit ESC in the main menu.
	if (*last_key==KEY_ESC) *last_key = 0;

	if ( do_auto_demo )	{
		curtime = timer_get_approx_seconds();
		//if ( ((keyd_time_when_last_pressed+i2f(20)) < curtime) && ((last_joy_time+i2f(20)) < curtime) && (!speedtest_on)  ) {
		if ( ((keyd_time_when_last_pressed+i2f(45)) < curtime) && (!speedtest_on)  ) {
			keyd_time_when_last_pressed = curtime;			// Reset timer so that disk won't thrash if no demos.
			newdemo_start_playback(NULL);		// Randomly pick a file
			if (Newdemo_state == ND_STATE_PLAYBACK)	{
				Function_mode = FMODE_GAME;
				*last_key = -2;							  	
			}
		}
	}
}
Esempio n. 14
0
void render_countdown_gauge()
{
	if (!Endlevel_sequence && Control_center_destroyed  && (Countdown_seconds_left>-1) && (Countdown_seconds_left<127))	{
		gr_set_curfont(GAME_FONT);
		gr_set_fontcolor(BM_XRGB(0,63,0),-1);
		gr_printf(0x8000, (LINE_SPACING*6)+FSPACY(1), "T-%d s", Countdown_seconds_left );
	}
}
Esempio n. 15
0
void scores_draw_item( int i, stats_info * stats )
{
	char buffer[20];

	int y;

	y = 77+i*9;

	if (i==0)
		y -= 8;

	if ( i==MAX_HIGH_SCORES )
		y += 8;
	else
		scores_rprintf( 57, y-3, "%d.", i+1 );

	y -= 3;

	if (strlen(stats->name)==0) {
		gr_printf( FSPACX(66), FSPACY(y), TXT_EMPTY );
		return;
	}
	gr_printf( FSPACX(66), FSPACY(y), "%s", stats->name );
	int_to_string(stats->score, buffer);
	scores_rprintf( 149, y, "%s", buffer );

	gr_printf( FSPACX(166), FSPACY(y), "%s", MENU_DIFFICULTY_TEXT(stats->diff_level) );

	if ( (stats->starting_level > 0 ) && (stats->ending_level > 0 ))
		scores_rprintf( 232, y, "%d-%d", stats->starting_level, stats->ending_level );
	else if ( (stats->starting_level < 0 ) && (stats->ending_level > 0 ))
		scores_rprintf( 232, y, "S%d-%d", -stats->starting_level, stats->ending_level );
	else if ( (stats->starting_level < 0 ) && (stats->ending_level < 0 ))
		scores_rprintf( 232, y, "S%d-S%d", -stats->starting_level, -stats->ending_level );
	else if ( (stats->starting_level > 0 ) && (stats->ending_level < 0 ))
		scores_rprintf( 232, y, "%d-S%d", stats->starting_level, -stats->ending_level );

	{
		int h, m, s;
		h = stats->seconds/3600;
		s = stats->seconds%3600;
		m = s / 60;
		s = s % 60;
		scores_rprintf( 276, y, "%d:%02d:%02d", h, m, s );
	}
}
Esempio n. 16
0
void scores_draw_item( int  i, stats_info * stats )
{
	char buffer[20];

		int y;

		y = 7+70+i*9;

		if (i==0) y -= 8;

		if ( i==MAX_HIGH_SCORES ) 	{
			y += 8;
			//scores_rprintf( 17+33+XX, y+YY, "" );
		} else {
			scores_rprintf( 17+33+XX, y+YY, "%d.", i+1 );
		}

		if (strlen(stats->name)==0) {
			gr_printf( 26+33+XX, y+YY, TXT_EMPTY );
			return;
		}
		gr_printf( 26+33+XX, y+YY, "%s", stats->name );
		int_to_string(stats->score, buffer);
		scores_rprintf( 109+33+XX, y+YY, "%s", buffer );

		gr_printf( 125+33+XX, y+YY, "%s", MENU_DIFFICULTY_TEXT(stats->diff_level) );

		if ( (stats->starting_level > 0 ) && (stats->ending_level > 0 ))
			scores_rprintf( 192+33+XX, y+YY, "%d-%d", stats->starting_level, stats->ending_level );
		else if ( (stats->starting_level < 0 ) && (stats->ending_level > 0 ))
			scores_rprintf( 192+33+XX, y+YY, "S%d-%d", -stats->starting_level, stats->ending_level );
		else if ( (stats->starting_level < 0 ) && (stats->ending_level < 0 ))
			scores_rprintf( 192+33+XX, y+YY, "S%d-S%d", -stats->starting_level, -stats->ending_level );
		else if ( (stats->starting_level > 0 ) && (stats->ending_level < 0 ))
			scores_rprintf( 192+33+XX, y+YY, "%d-S%d", stats->starting_level, -stats->ending_level );

		{
			int h, m, s;
			h = stats->seconds/3600;
			s = stats->seconds%3600;
			m = s / 60;
			s = s % 60;
			scores_rprintf( 311-42+XX, y+YY, "%d:%02d:%02d", h, m, s );
		}
}
Esempio n. 17
0
static void con_draw(void)
{
	int i = 0, y = 0, done = 0;

	if (con_size <= 0)
		return;

	gr_set_current_canvas(NULL);
	gr_set_curfont(GAME_FONT);
	gr_setcolor(BM_XRGB(0,0,0));
	gr_settransblend(7, GR_BLEND_NORMAL);
	gr_rect(0,0,SWIDTH,(LINE_SPACING*(con_size))+FSPACY(1));
	gr_settransblend(GR_FADE_OFF, GR_BLEND_NORMAL);
	y=FSPACY(1)+(LINE_SPACING*con_size);
	i+=con_scroll_offset;
	{
		cxx_con_interactive_print(&y);
		if (y<=0)
			done=1;
	}
	while (!done)
	{
		int w,h,aw;

		switch (con_buffer[CON_LINES_MAX-1-i].priority)
		{
			case CON_CRITICAL:
				gr_set_fontcolor(BM_XRGB(28,0,0),-1);
				break;
			case CON_URGENT:
				gr_set_fontcolor(BM_XRGB(54,54,0),-1);
				break;
			case CON_DEBUG:
			case CON_VERBOSE:
				gr_set_fontcolor(BM_XRGB(14,14,14),-1);
				break;
			case CON_HUD:
				gr_set_fontcolor(BM_XRGB(0,28,0),-1);
				break;
			default:
				gr_set_fontcolor(BM_XRGB(255,255,255),-1);
				break;
		}
		gr_get_string_size(con_buffer[CON_LINES_MAX-1-i].line,&w,&h,&aw);
		y-=h+FSPACY(1);
		gr_string(FSPACX(1),y,con_buffer[CON_LINES_MAX-1-i].line);
		i++;

		if (y<=0 || CON_LINES_MAX-1-i <= 0 || i < 0)
			done=1;
	}
	gr_setcolor(BM_XRGB(0,0,0));
	gr_rect(0,0,SWIDTH,LINE_SPACING);
	gr_set_fontcolor(BM_XRGB(255,255,255),-1);
	gr_printf(FSPACX(1),FSPACY(1),"%s LOG", DESCENT_VERSION);
	gr_string(SWIDTH-FSPACX(110),FSPACY(1),"PAGE-UP/DOWN TO SCROLL");
}
Esempio n. 18
0
File: hud.c Progetto: jihnsius/d2r
// ----------------------------------------------------------------------------
//	Writes a message on the HUD and checks its timer.
void HUD_render_message_frame()
{
	int i,j,y;

	HUD_toolong = 0;

	if (( HUD_nmessages < 0 ) || (HUD_nmessages > HUD_MAX_NUM_STOR))
		Int3(); // Get Rob!

	if (HUD_nmessages < 1 )
		return;

	for (i = 0; i < HUD_nmessages; i++)
	{
		HUD_messages[i].time -= FrameTime;
		// message expired - remove
		if (HUD_messages[i].time <= 0)
		{
			for (j = i; j < HUD_nmessages; j++)
			{
				if (j+1 < HUD_nmessages)
					memcpy(&HUD_messages[j], &HUD_messages[j+1], sizeof(struct hudmsg));
				else
					memset(&HUD_messages[j], 0, sizeof(struct hudmsg));
			}
			HUD_nmessages--;
		}
	}

	// display last $HUD_MAX_NUM_DISP messages on the list
	if (HUD_nmessages > 0 )
	{
		int startmsg = ((HUD_nmessages-HUD_MAX_NUM_DISP<0)?0:HUD_nmessages-HUD_MAX_NUM_DISP);
		if (HUD_color == -1)
			HUD_color = BM_XRGB(0,28,0);

		gr_set_curfont( GAME_FONT );
		y = FSPACY(1);

		if (Guided_missile[Player_num] && Guided_missile[Player_num]->type==OBJ_WEAPON && Guided_missile[Player_num]->id==GUIDEDMISS_ID &&
		Guided_missile[Player_num]->signature==Guided_missile_sig[Player_num] && PlayerCfg.GuidedInBigWindow)
			y+=LINE_SPACING;

		for (i=startmsg; i<HUD_nmessages; i++ )	{
			gr_set_fontcolor( HUD_color, -1);

			if (i == startmsg && strlen(HUD_messages[i].message) > 38)
				HUD_toolong = 1;
			gr_printf(0x8000,y, &HUD_messages[i].message[0] );
			y += LINE_SPACING;
		}
	}

	gr_set_curfont( GAME_FONT );
}
Esempio n. 19
0
void hud_show_fixed_text()
{
	HUD_ft	*hp;

	hp = &HUD_fixed_text[0];

	if (!timestamp_elapsed(hp->end_time)) {
		//gr_set_color((hp->color >> 16) & 0xff, (hp->color >> 8) & 0xff, hp->color & 0xff);
		gr_printf(0x8000, MSG_WINDOW_Y_START + MSG_WINDOW_HEIGHT + 8, hp->text);
	}
}
Esempio n. 20
0
File: titles.c Progetto: btb/d1x
//	-----------------------------------------------------------------------------
void flash_cursor(int cursor_flag)
{
	if (cursor_flag == 0)
		return;

	if ((timer_get_fixed_seconds() % (F1_0/2) ) > (F1_0/4))
		gr_set_fontcolor(Briefing_foreground_colors[Current_color], -1);
	else
		gr_set_fontcolor(Erase_color, -1);

	gr_printf(Briefing_text_x+1, Briefing_text_y, "_" );

}
Esempio n. 21
0
// draw overlay on the screen
void help_overlay_blit(int overlay_id)
{
	int idx, width, height;
	int plinecount = help_overlaylist[overlay_id].plinecount;
	int textcount = help_overlaylist[overlay_id].textcount;
	int rbracketcount = help_overlaylist[overlay_id].rbracketcount;
	int lbracketcount = help_overlaylist[overlay_id].lbracketcount;

	Assert(overlay_id >= 0 && overlay_id < MAX_HELP_OVERLAYS);

	// this draws each line of help text with white on black text (use the GR_640 index for the string)
	for (idx = 0; idx < textcount; idx++)
	{
		gr_set_color_fast(&Color_black);
		gr_get_string_size(&width, &height, help_overlaylist[overlay_id].textlist[GR_640][idx].string,
			strlen(help_overlaylist[overlay_id].textlist[GR_640][idx].string));
		gr_rect(help_overlaylist[overlay_id].textlist[gr_screen.res][idx].x_coord - 2 * HELP_PADDING,
			help_overlaylist[overlay_id].textlist[gr_screen.res][idx].y_coord - 3 * HELP_PADDING,
			width + 4 * HELP_PADDING, height + 4 * HELP_PADDING);
		gr_set_color_fast(&Color_bright_white);
		gr_printf(help_overlaylist[overlay_id].textlist[gr_screen.res][idx].x_coord,
			help_overlaylist[overlay_id].textlist[gr_screen.res][idx].y_coord,
			help_overlaylist[overlay_id].textlist[GR_640][idx].string);
	}

	// this draws each right bracket
	for (idx = 0; idx < rbracketcount; idx++)
	{
		gr_set_bitmap(help_right_bracket_bitmap);
		gr_bitmap(help_overlaylist[overlay_id].rbracketlist[gr_screen.res][idx].x_coord,
			help_overlaylist[overlay_id].rbracketlist[gr_screen.res][idx].y_coord);
	}

	// this draws each left bracket
	for (idx = 0; idx < lbracketcount; idx++)
	{
		gr_set_bitmap(help_left_bracket_bitmap);
		gr_bitmap(help_overlaylist[overlay_id].lbracketlist[gr_screen.res][idx].x_coord,
			help_overlaylist[overlay_id].lbracketlist[gr_screen.res][idx].y_coord);
	}

	// this draws each 2d line for the help screen
	//gr_set_color_fast(&Color_yellow);
	gr_set_color(255, 255, 0);
	for (idx = 0; idx < plinecount; idx++)
	{
		gr_pline_special(help_overlaylist[overlay_id].plinelist[gr_screen.res][idx].pvtx,
			help_overlaylist[overlay_id].plinelist[GR_640][idx].vtxcount, HELP_PLINE_THICKNESS);
	}
}
Esempio n. 22
0
void name_frame(automap *am)
{
	char	name_level_left[128],name_level_right[128];
	int wr,h,aw;

	if (Current_level_num > 0)
		sprintf(name_level_left, "%s %i",TXT_LEVEL, Current_level_num);
	else
		sprintf(name_level_left, "Secret Level %i",-Current_level_num);

	if (PLAYING_BUILTIN_MISSION && Current_level_num > 0)
		sprintf(name_level_right,"%s %d: ",system_name[(Current_level_num-1)/4],((Current_level_num-1)%4)+1);
	else
		strcpy(name_level_right, " ");

	strcat(name_level_right, Current_level_name);

	gr_set_curfont(GAME_FONT);
	gr_set_fontcolor(am->green_31,-1);
	gr_printf((SWIDTH/64),(SHEIGHT/48),"%s", name_level_left);
	gr_get_string_size(name_level_right,&wr,&h,&aw);
	gr_printf(grd_curcanv->cv_bitmap.bm_w-wr-(SWIDTH/64),(SHEIGHT/48),"%s", name_level_right);
}
Esempio n. 23
0
void player_dead_message(void)
{
          if (Player_exploded) {
//		gr_set_curfont( Gamefonts[GFONT_SMALL] );
		gr_set_curfont( GAME_FONT );    
		if (HUD_color == -1)
			HUD_color = BM_XRGB(0,28,0);
		gr_set_fontcolor( HUD_color, -1);

		gr_printf(0x8000, grd_curcanv->cv_bitmap.bm_h-(GAME_FONT->ft_h+3), TXT_PRESS_ANY_KEY);//was -8
//		gr_set_curfont( GAME_FONT );    
	}

}
Esempio n. 24
0
void name_frame(automap *am)
{
	char		name_level[128];
	
	if (Current_level_num > 0)
		sprintf(name_level, "%s %i: ",TXT_LEVEL, Current_level_num);
	else
		name_level[0] = 0;

	strcat(name_level, Current_level_name);

	gr_set_curfont(GAME_FONT);
	gr_set_fontcolor(am->green_31,-1);
	gr_printf((SWIDTH/64),(SHEIGHT/48),"%s", name_level);
}
Esempio n. 25
0
static void con_draw(void)
{
	int i = 0, y = 0;

	if (con_size <= 0)
		return;

	gr_set_default_canvas();
	auto &canvas = *grd_curcanv;
	auto &game_font = *GAME_FONT;
	gr_set_curfont(canvas, GAME_FONT);
	const uint8_t color = BM_XRGB(0, 0, 0);
	gr_settransblend(canvas, 7, GR_BLEND_NORMAL);
	const auto &&fspacy1 = FSPACY(1);
	const auto &&line_spacing = LINE_SPACING(*canvas.cv_font, *GAME_FONT);
	y = fspacy1 + (line_spacing * con_size);
	gr_rect(canvas, 0, 0, SWIDTH, y, color);
	gr_settransblend(canvas, GR_FADE_OFF, GR_BLEND_NORMAL);
	i+=con_scroll_offset;

	gr_set_fontcolor(canvas, BM_XRGB(255, 255, 255), -1);
	y = cli_draw(y, line_spacing);

	const auto &&fspacx = FSPACX();
	const auto &&fspacx1 = fspacx(1);
	for (;;)
	{
		auto &b = con_buffer[CON_LINES_MAX - 1 - i];
		gr_set_fontcolor(canvas, get_console_color_by_priority(b.priority), -1);
		int w,h;
		gr_get_string_size(game_font, b.line, &w, &h, nullptr);
		y -= h + fspacy1;
		gr_string(canvas, game_font, fspacx1, y, b.line, w, h);
		i++;

		if (y<=0 || CON_LINES_MAX-1-i <= 0 || i < 0)
			break;
	}
	gr_rect(canvas, 0, 0, SWIDTH, line_spacing, color);
	gr_set_fontcolor(canvas, BM_XRGB(255, 255, 255),-1);
	gr_printf(canvas, game_font, fspacx1, fspacy1, "%s LOG", DESCENT_VERSION);
	gr_string(canvas, game_font, SWIDTH - fspacx(110), fspacy1, "PAGE-UP/DOWN TO SCROLL");
}
Esempio n. 26
0
void kmatrix_draw_item( int  i, int *sorted )
{
	int j, x, y;
	char temp[10];

	y = FSPACY(50+i*9);
	gr_printf( FSPACX(CENTERING_OFFSET(N_players)), y, "%s", Players[sorted[i]].callsign );

	for (j=0; j<N_players; j++)
	{
		x = FSPACX(70 + CENTERING_OFFSET(N_players) + j*25);

		if (sorted[i]==sorted[j])
		{
			if (kill_matrix[sorted[i]][sorted[j]] == 0)
			{
				gr_set_fontcolor( BM_XRGB(10,10,10),-1 );
				gr_printf( x, y, "%d", kill_matrix[sorted[i]][sorted[j]] );
			}
			else
			{
				gr_set_fontcolor( BM_XRGB(25,25,25),-1 );
				gr_printf( x, y, "-%d", kill_matrix[sorted[i]][sorted[j]] );
			}
		}
		else
		{
			if (kill_matrix[sorted[i]][sorted[j]] <= 0)
			{
				gr_set_fontcolor( BM_XRGB(10,10,10),-1 );
				gr_printf( x, y, "%d", kill_matrix[sorted[i]][sorted[j]] );
			}
			else
			{
				gr_set_fontcolor( BM_XRGB(25,25,25),-1 );
				gr_printf( x, y, "%d", kill_matrix[sorted[i]][sorted[j]] );
			}
		}
	}

	if (Players[sorted[i]].net_killed_total+Players[sorted[i]].net_kills_total==0)
		sprintf (temp,"NA");
	else
		sprintf (temp,"%d%%",(int)((float)((float)Players[sorted[i]].net_kills_total/((float)Players[sorted[i]].net_killed_total+(float)Players[sorted[i]].net_kills_total))*100.0));

	x = FSPACX(60 + CENTERING_OFFSET(N_players) + N_players*25);
	gr_set_fontcolor( BM_XRGB(25,25,25),-1 );
	gr_printf( x ,y,"%4d/%s",Players[sorted[i]].net_kills_total,temp);
}
Esempio n. 27
0
//show a message in a nice little box
void show_boxed_message(char *msg, int RenderFlag)
{
	int w,h,aw;
	int x,y;
	
	gr_set_current_canvas(NULL);
	gr_set_curfont( MEDIUM1_FONT );
	gr_set_fontcolor(BM_XRGB(31, 31, 31), -1);
	gr_get_string_size(msg,&w,&h,&aw);
	
	x = (SWIDTH-w)/2;
	y = (SHEIGHT-h)/2;
	
	nm_draw_background(x-BORDERX,y-BORDERY,x+w+BORDERX,y+h+BORDERY);
	
	gr_printf( 0x8000, y, msg );
	
	// If we haven't drawn behind it, need to flip
	if (!RenderFlag)
		gr_flip();
}
Esempio n. 28
0
void pilot_manage_display_pilot_callsigns(int prospective_pilot)
{
	int y = 0;
	int cur_pilot_idx = List_scroll_offset;

	int multi = 0;
	if (Player_sel_mode == PLAYER_SELECT_MODE_MULTI) {
		multi = 1;
	}
	
	int font_height = gr_get_font_height();
	//cur_pilot_idx = 1;
	while (y + font_height <= Pilot_manage_list_coords[gr_screen.res][PM_H_COORD]) {
	if (cur_pilot_idx >= Num_pilots)
			break;
		
		if (!stricmp(Cur_pilot->callsign, Pilots[cur_pilot_idx]) && (is_pilot_multi(Cur_pilot) == multi)) {
			if ((cur_pilot_idx == Selected_line) || (cur_pilot_idx == prospective_pilot)) {
				gr_set_color_fast(&Color_text_active_hi);
			} else {
				gr_set_color_fast(&Color_text_active);
			}
		} else {
			if (cur_pilot_idx == Selected_line) {
				gr_set_color_fast(&Color_text_selected);
			} else if (cur_pilot_idx == prospective_pilot) {
				gr_set_color_fast(&Color_text_subselected);
			} else {
				gr_set_color_fast(&Color_text_normal);
			}
		}
		
		gr_printf(Pilot_manage_list_coords[gr_screen.res][PM_X_COORD], Pilot_manage_list_coords[gr_screen.res][PM_Y_COORD] + y, Pilots[cur_pilot_idx]);
		gr_set_bitmap(Rank_pips_bitmaps + Pilot_ranks[cur_pilot_idx]);
		gr_bitmap(Pilot_manage_list_coords[gr_screen.res][PM_X_COORD] - 34, Pilot_manage_list_coords[gr_screen.res][PM_Y_COORD] + y);
 
		y += font_height;
		cur_pilot_idx++;
	}
}
Esempio n. 29
0
void draw_window_label()
{
	if ( Show_view_text_timer > 0 )
	{
		char *viewer_name,*control_name;
		
		Show_view_text_timer -= FrameTime;
		
		switch( Viewer->type )
		{
			case OBJ_FIREBALL:	viewer_name = "Fireball"; break;
			case OBJ_ROBOT:		viewer_name = "Robot"; break;
			case OBJ_HOSTAGE:	viewer_name = "Hostage"; break;
			case OBJ_PLAYER:	viewer_name = "Player"; break;
			case OBJ_WEAPON:	viewer_name = "Weapon"; break;
			case OBJ_CAMERA:	viewer_name = "Camera"; break;
			case OBJ_POWERUP:	viewer_name = "Powerup"; break;
			case OBJ_DEBRIS:	viewer_name = "Debris"; break;
			case OBJ_CNTRLCEN:	viewer_name = "Control Center"; break;
			default:		viewer_name = "Unknown"; break;
		}
		
		switch ( Viewer->control_type) {
			case CT_NONE:		control_name = "Stopped"; break;
			case CT_AI:		control_name = "AI"; break;
			case CT_FLYING:		control_name = "Flying"; break;
			case CT_SLEW:		control_name = "Slew"; break;
			case CT_FLYTHROUGH:	control_name = "Flythrough"; break;
			case CT_MORPH:		control_name = "Morphing"; break;
			default:		control_name = "Unknown"; break;
		}
		gr_set_curfont( GAME_FONT );
		gr_set_fontcolor( BM_XRGB(31, 0, 0), -1 );
		gr_printf( 0x8000, (SHEIGHT/10), "%s View - %s",viewer_name,control_name );
	}
}
Esempio n. 30
0
void game_draw_hud_stuff()
{
#ifdef CROSSHAIR
	if ( Viewer->type == OBJ_PLAYER )
		laser_do_crosshair(Viewer);
#endif
	
#ifndef NDEBUG
	draw_window_label();
#endif
	
#ifdef NETWORK
	game_draw_multi_message();
#endif
	
	if ((Newdemo_state == ND_STATE_PLAYBACK) || (Newdemo_state == ND_STATE_RECORDING)) {
		char message[128];
		int y;
		
		if (Newdemo_state == ND_STATE_PLAYBACK) {
			if (Newdemo_show_percentage) {
			  	sprintf(message, "%s (%d%%%% %s)", TXT_DEMO_PLAYBACK, newdemo_get_percent_done(), TXT_DONE);
			} else {
				sprintf (message, " ");
			}
		} else {
			extern int Newdemo_num_written;
			sprintf (message, "%s (%dK)", TXT_DEMO_RECORDING, (Newdemo_num_written / 1024));
		}
		
		gr_set_curfont( GAME_FONT );
		gr_set_fontcolor( BM_XRGB(27,0,0), -1 );
		
		y = GHEIGHT-(LINE_SPACING*2);
		
		if (PlayerCfg.CockpitMode[1] == CM_FULL_COCKPIT)
			y = grd_curcanv->cv_bitmap.bm_h / 1.2 ;
		if (PlayerCfg.CockpitMode[1] != CM_REAR_VIEW)
			gr_printf(0x8000, y, message );
	}
	
	render_countdown_gauge();
	render_spec_status();	// jinx 02-01-13 spec
	
	// this should be made part of hud code some day
	if (( Player_num > -1 && Viewer->type==OBJ_PLAYER && Viewer->id==Player_num && PlayerCfg.CockpitMode[1] != CM_REAR_VIEW) || ((Players[Player_num].spec_flags & PLAYER_FLAGS_SPECTATING) && in_free))
	{
		int	x = FSPACX(1);
		int	y = grd_curcanv->cv_bitmap.bm_h;
		
		gr_set_curfont( GAME_FONT );
		gr_set_fontcolor( BM_XRGB(0, 31, 0), -1 );
		if ((Cruise_speed > 0) || ((Players[Player_num].spec_flags & PLAYER_FLAGS_SPECTATING) && in_free)) {
			if (PlayerCfg.CockpitMode[1]==CM_FULL_SCREEN) {
				if (Game_mode & GM_MULTI)
					y -= LINE_SPACING * 10;
				else
					y -= LINE_SPACING * 6;
			} else if (PlayerCfg.CockpitMode[1] == CM_STATUS_BAR) {
				if (Game_mode & GM_MULTI)
					y -= LINE_SPACING * 6;
				else
					y -= LINE_SPACING * 1;
			} else {
				if (Game_mode & GM_MULTI)
					y -= LINE_SPACING * 7;
				else
					y -= LINE_SPACING * 2;
			}
			if (Players[Player_num].spec_flags & PLAYER_FLAGS_SPECTATING)
				gr_printf( x, y, "Free Fly Speed %2d%%", 100 + f2i((Cruise_speed)));		// f2i(100 + (Cruise_speed / SPEC_SPEED_MOD)));
			else
				gr_printf( x, y, "%s %2d%%", TXT_CRUISE, f2i(Cruise_speed) );	
		}
	}
	
	if (GameCfg.FPSIndicator && PlayerCfg.CockpitMode[1] != CM_REAR_VIEW)
		show_framerate();

	if (Newdemo_state == ND_STATE_PLAYBACK)
		Game_mode = Newdemo_game_mode;

	draw_hud();

	if (Newdemo_state == ND_STATE_PLAYBACK)
		Game_mode = GM_NORMAL;
	
	if ( Player_is_dead )
		player_dead_message();
}