Exemplo n.º 1
0
Arquivo: hud.c Projeto: 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.");
		}
	}
}
Exemplo n.º 2
0
void draw_special_segments(void)
{
	short seg;
	ubyte color;

	// Highlight matcens, fuelcens, etc.
	for (seg=0;seg<=Highest_segment_index;seg++)
		if (Segments[seg].segnum != -1)
			switch( Segments[seg].special )	{
			case SEGMENT_IS_FUELCEN:
				color = BM_XRGB( 29, 27, 13 );
				gr_setcolor(color);
				draw_segment(&Segments[seg]);
				break;
			case SEGMENT_IS_CONTROLCEN:
				color = BM_XRGB( 29, 0, 0 );
				gr_setcolor(color);
				draw_segment(&Segments[seg]);
				break;
			case SEGMENT_IS_ROBOTMAKER:
				color = BM_XRGB( 29, 0, 31 );
				gr_setcolor(color);
				draw_segment(&Segments[seg]);
				break;
			}
}
Exemplo n.º 3
0
// ----------------------------------------------------------------------------------------------------------------
// Draws special walls (for now these are just removable walls.)
void draw_special_wall( segment *seg, int side )
{
	gr_setcolor(PLAINSEG_COLOR);

	if (Walls[seg->sides[side].wall_num].type == WALL_BLASTABLE)
		gr_setcolor(WALL_BLASTABLE_COLOR);	
	if (Walls[seg->sides[side].wall_num].type == WALL_DOOR)
		gr_setcolor(WALL_DOOR_COLOR);
	if (Walls[seg->sides[side].wall_num].type == WALL_ILLUSION)
		gr_setcolor(GROUPSIDE_COLOR);	
	if (Walls[seg->sides[side].wall_num].flags & WALL_DOOR_LOCKED)
		gr_setcolor(WALL_DOOR_LOCKED_COLOR);
	if (Walls[seg->sides[side].wall_num].flags & WALL_DOOR_AUTO)
		gr_setcolor(WALL_AUTO_DOOR_COLOR);
	if (Walls[seg->sides[side].wall_num].flags & WALL_DOOR_LOCKED)
	if (Walls[seg->sides[side].wall_num].flags & WALL_DOOR_AUTO)
		gr_setcolor(WALL_AUTO_DOOR_LOCKED_COLOR);
	if (Walls[seg->sides[side].wall_num].type == WALL_OPEN)
		gr_setcolor(PLAINSEG_COLOR);
	
	draw_wall_side(seg,side);

	if (Walls[seg->sides[side].wall_num].trigger != -1) {
		int trigger_num;

		trigger_num = Walls[seg->sides[side].wall_num].trigger;

		gr_setcolor(TRIGGER_COLOR);
		draw_trigger_side(seg,side);
		}


	gr_setcolor(PLAINSEG_COLOR);
}
Exemplo n.º 4
0
Arquivo: menubar.c Projeto: btb/d2x
void menu_show( MENU * menu )
{
	int i;

	ui_mouse_hide();

	gr_set_current_canvas(NULL);
	// Don't save background it if it's already drawn
	if (!menu->Displayed) 
	{
		// Save the background
		gr_bm_ubitblt(menu->w, menu->h, 0, 0, menu->x, menu->y, &(grd_curscreen->sc_canvas.cv_bitmap), menu->Background);

		// Draw the menu background
		gr_setcolor( CGREY );
		gr_urect( menu->x, menu->y, menu->x + menu->w - 1, menu->y + menu->h - 1 );
		if ( menu != &Menu[0] )
		{
			gr_setcolor( CBLACK );
			gr_ubox( menu->x, menu->y, menu->x + menu->w - 1, menu->y + menu->h - 1 );
		}
	}
		
	// Draw the items
	
	for (i=0; i< menu->NumItems; i++ )
		item_show( menu, i );

	ui_mouse_show();
	
	// Mark as displayed.
	menu->Displayed = 1;
}
Exemplo n.º 5
0
void plot_parametric(vms_equation *coeffs, fix min_t, fix max_t, fix del_t) {
    vms_vector coord, dcoord;
    fix t, dt;

    gr_setcolor(15);
    gr_box(  75,  40, 325, 290 );
    gr_box(  75, 310, 325, 560 );
    gr_box( 475, 310, 725, 560 );
    //gr_pal_fade_in( grd_curscreen->pal );

    for (t=min_t;t<max_t-del_t;t+=del_t) {
        dt = t+del_t;

        coord = evaluate_curve(coeffs, 3, t);
        dcoord = evaluate_curve(coeffs, 3, dt);

        gr_setcolor(9);
        gr_line (  75*F1_0 + coord.x, 290*F1_0 - coord.z,  75*F1_0 + dcoord.x, 290*F1_0 - dcoord.z );
        gr_setcolor(10);
        gr_line (  75*F1_0 + coord.x, 560*F1_0 - coord.y,  75*F1_0 + dcoord.x, 560*F1_0 - dcoord.y );
        gr_setcolor(12);
        gr_line ( 475*F1_0 + coord.z, 560*F1_0 - coord.y, 475*F1_0 + dcoord.z, 560*F1_0 - dcoord.y );

    }

}
Exemplo n.º 6
0
void ui_draw_scrollbar( UI_GADGET_SCROLLBAR * scrollbar )
{
	int x, y;

	if (scrollbar->status==0)
		return;

	scrollbar->status = 0;
	x = y = 0;
	ui_mouse_hide();
	gr_set_current_canvas( scrollbar->canvas );

	if (CurWindow->keyboard_focus_gadget == (UI_GADGET *)scrollbar)
		gr_setcolor( CRED );
	else
		gr_setcolor( CGREY );

	gr_rect( 0, 0, scrollbar->width-1, scrollbar->fake_position-1 );
	gr_rect( 0, scrollbar->fake_position+scrollbar->fake_size, scrollbar->width-1, scrollbar->height-1);

	ui_draw_box_out(0, scrollbar->fake_position, scrollbar->width-1, scrollbar->fake_position+scrollbar->fake_size-1 );

	ui_mouse_show();

}
Exemplo n.º 7
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");
}
Exemplo n.º 8
0
void ui_draw_shad( short x1, short y1, short x2, short y2, short c1, short c2 )
{
	gr_setcolor( c1 );

	Hline( x1+0, x2-1, y1+0 );
	Vline( y1+1, y2+0, x1+0 );

	gr_setcolor( c2 );
	Hline( x1+1, x2, y2-0 );
	Vline( y1+0, y2-1, x2-0 );
}
Exemplo n.º 9
0
void gr_draw_sunken_border( short x1, short y1, short x2, short y2 )
{

	gr_setcolor( CGREY );
	Hline( x1-1, x2+1, y1-1);
	Vline( y1-1, y2+1, x1-1);

	gr_setcolor( CBRIGHT );
	Hline( x1-1, x2+1, y2+1);
	Vline( y1, y2+1, x2+1);

}
Exemplo n.º 10
0
void ui_draw_line_in( short x1, short y1, short x2, short y2 )
{
	gr_setcolor( CGREY );
	Hline( x1, x2, y1 );
	Hline( x1, x2-1, y2-1 );
	Vline( y1+1, y2-2, x1 );
	Vline( y1+1, y2-2, x2-1 );

	gr_setcolor( CBRIGHT );
	Hline( x1+1, x2-1, y1+1 );
	Hline( x1, x2, y2 );
	Vline( y1+2, y2-2, x1+1 );
	Vline( y1+1, y2-1, x2 );

}
Exemplo n.º 11
0
void ui_close_window( UI_WINDOW * wnd )
{

	ui_mouse_hide();

	ui_gadget_delete_all( wnd );

	if (W_BACKGROUND)
	{
		gr_bm_ubitblt(W_WIDTH, W_HEIGHT, W_X, W_Y, 0, 0, W_BACKGROUND, &(grd_curscreen->sc_canvas.cv_bitmap));
		gr_free_bitmap( W_BACKGROUND );
	} else
	{
		gr_set_current_canvas( NULL );
		gr_setcolor( CBLACK );
		gr_rect( W_X, W_Y, W_X+W_WIDTH-1, W_Y+W_HEIGHT-1 );
	}

	gr_free_sub_canvas( W_CANVAS );

	gr_set_current_canvas( W_OLDCANVAS );

	selected_gadget = NULL;

	remove_window( wnd );

	if (CurWindow==wnd)
		CurWindow = NULL;

	d_free( wnd );

	ui_mouse_show();
}
Exemplo n.º 12
0
UI_GADGET_INPUTBOX * ui_add_gadget_inputbox( UI_WINDOW * wnd, short x, short y, short length, short slength, char * text )
{
	int h, w, aw, f;
	UI_GADGET_INPUTBOX * inputbox;

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

	inputbox = (UI_GADGET_INPUTBOX *)ui_gadget_add( wnd, 6, x, y, x+aw*slength-1, y+h-1+4 );

	f = 0;

	inputbox->text = malloc( length + 1);
	strncpy( inputbox->text, text, length );
	inputbox->position = strlen(inputbox->text);
	inputbox->oldposition = inputbox->position;
	inputbox->width = aw*slength;
	inputbox->height = h+4;
	inputbox->length = length;
	inputbox->slength = slength;
	inputbox->pressed = 0;
	inputbox->first_time = 1;

	gr_set_current_canvas( inputbox->canvas );
	gr_setcolor( CBLACK );
	gr_rect( 0, 0, inputbox->width-1, inputbox->height-1 );

	return inputbox;

}
Exemplo n.º 13
0
Arquivo: tmapflat.c Projeto: btb/d1x
//this takes the same partms as draw_tmap, but draws a flat-shaded polygon
void draw_tmap_flat(grs_bitmap *bp,int nverts,g3s_point **vertbuf)
{
	pnt2d	points[MAX_TMAP_VERTS];
	int	i;
	fix	average_light;
	int	color;

	Assert(nverts < MAX_TMAP_VERTS);

	average_light = vertbuf[0]->p3_l;
	for (i=1; i<nverts; i++)
		average_light += vertbuf[i]->p3_l;

	if (nverts == 4)
		average_light = f2i(average_light * NUM_LIGHTING_LEVELS/4);
	else
		average_light = f2i(average_light * NUM_LIGHTING_LEVELS/nverts);

	if (average_light < 0)
		average_light = 0;
	else if (average_light > NUM_LIGHTING_LEVELS-1)
		average_light = NUM_LIGHTING_LEVELS-1;

	color = gr_fade_table[average_light*256 + bp->avg_color];
	gr_setcolor(color);

	for (i=0;i<nverts;i++) {
		points[i].x = vertbuf[i]->p3_sx;
		points[i].y = vertbuf[i]->p3_sy;
	}

	gr_upoly_tmap(nverts,(int *) points);

}
Exemplo n.º 14
0
void player_dead_message(void)
{
	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_string(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_string(0x8000, GHEIGHT-LINE_SPACING, TXT_PRESS_ANY_KEY);
	}
}
Exemplo n.º 15
0
void draw_selected_segments(void)
{
	int	s;

	gr_setcolor(SELECT_COLOR);
	for (s=0; s<N_selected_segs; s++)
		if (Segments[Selected_segs[s]].segnum != -1)
			draw_segment(&Segments[Selected_segs[s]]);
}
Exemplo n.º 16
0
void ui_draw_userbox( UI_DIALOG *dlg, UI_GADGET_USERBOX * userbox )
{
#if 0  //ndef OGL
	if ( userbox->status==1 )
#endif
	{
		userbox->status = 0;

		gr_set_current_canvas( userbox->canvas );

		if (dlg->keyboard_focus_gadget == (UI_GADGET *)userbox)
			gr_setcolor( CRED );
		else
			gr_setcolor( CBRIGHT );

		gr_ubox( -1, -1, userbox->width, userbox->height );
	}
}
Exemplo n.º 17
0
void draw_warning_segments(void)
{
	int	s;

	gr_setcolor(WARNING_COLOR);
	for (s=0; s<N_warning_segs; s++)
		if (Segments[Warning_segs[s]].segnum != -1)
			draw_segment(&Segments[Warning_segs[s]]);
}
Exemplo n.º 18
0
void ui_draw_box_in( short x1, short y1, short x2, short y2 )
{

	gr_setcolor( CWHITE );
	gr_urect( x1+2, y1+2, x2-2, y2-2 );

	ui_draw_shad( x1+0, y1+0, x2-0, y2-0, CGREY, CBRIGHT );
	ui_draw_shad( x1+1, y1+1, x2-1, y2-1, CGREY, CBRIGHT );
}
Exemplo n.º 19
0
void draw_found_segments(void)
{
	int	s;

	gr_setcolor(FOUND_COLOR);
	for (s=0; s<N_found_segs; s++)
		if (Segments[Found_segs[s]].segnum != -1)
			draw_segment(&Segments[Found_segs[s]]);
}
Exemplo n.º 20
0
void DrawMarkers (automap *am)
 {
	int i,maxdrop;
	static int cyc=10,cycdir=1;
	g3s_point sphere_point;

	if (Game_mode & GM_MULTI)
		maxdrop=2;
	else
		maxdrop=9;

	for (i=0;i<maxdrop;i++)
		if (MarkerObject[(Player_num*2)+i] != -1) {

			g3_rotate_point(&sphere_point,&Objects[MarkerObject[(Player_num*2)+i]].pos);

			gr_setcolor (gr_find_closest_color_current(cyc,0,0));
			g3_draw_sphere(&sphere_point,MARKER_SPHERE_SIZE);
			gr_setcolor (gr_find_closest_color_current(cyc+10,0,0));
			g3_draw_sphere(&sphere_point,MARKER_SPHERE_SIZE/2);
			gr_setcolor (gr_find_closest_color_current(cyc+20,0,0));
			g3_draw_sphere(&sphere_point,MARKER_SPHERE_SIZE/4);

			DrawMarkerNumber (am, i);
		}

	if (cycdir)
		cyc+=2;
	else
		cyc-=2;

	if (cyc>43)
	{
		cyc=43;
		cycdir=0;
	}
	else if (cyc<10)
	{
		cyc=10;
		cycdir=1;
	}

}
Exemplo n.º 21
0
Arquivo: menubar.c Projeto: btb/d2x
void item_show( MENU * menu, int n )
{
	ITEM * item = &menu->Item[n];
	
	gr_set_current_canvas(NULL);
	// If this is a seperator, then draw it.
	if ( item->Text[0] == '-'  )
	{
		gr_setcolor( CBLACK );
		gr_urect( item->x, item->y+item->h/2, item->x+item->w-1, item->y+item->h/2 );
		return;
	}	

	if ( menu->CurrentItem==n && menu->ShowBar )
	{
		if ( menu != &Menu[0] )
		{
			gr_setcolor( CBLACK );
			gr_urect( item->x+1, item->y+1, item->x+menu->w-2, item->y+item->h-2 );
		}
	 	gr_set_fontcolor( CWHITE, CBLACK );
	}else {
		if ( menu != &Menu[0] )
		{
			gr_setcolor( CGREY );
			gr_urect( item->x+1, item->y+1, item->x+menu->w-2, item->y+item->h-2 );
		}
		gr_set_fontcolor( CBLACK, CGREY );
	}

	if ( menu != &Menu[0] )
	{
		if ( menu->Active)
			gr_ustring( item->x+1, item->y+1, item->Text );
		else
			gr_ustring( item->x+1, item->y+1, item->InactiveText );
	} else {
		if ( menu->Active)
			gr_ustring( item->x, item->y, item->Text );
		else
			gr_ustring( item->x, item->y, item->InactiveText );
	}
}
Exemplo n.º 22
0
void ui_draw_inputbox( UI_DIALOG *dlg, UI_GADGET_INPUTBOX * inputbox )
{
	int w, h, aw;

#if 0  //ndef OGL
	if ((inputbox->status==1) || (inputbox->position != inputbox->oldposition))
#endif
	{
		gr_set_current_canvas( inputbox->canvas );

		gr_setcolor( CBLACK );
		gr_rect( 0, 0, inputbox->width-1, inputbox->height-1 );
		gr_get_string_size(inputbox->text, &w, &h, &aw  );
		
		if (dlg->keyboard_focus_gadget == (UI_GADGET *)inputbox)
		{
			if (inputbox->first_time)
			{
				gr_set_fontcolor( CBLACK, -1 );
				gr_setcolor( CRED );
				gr_rect(2, 2, 2 + w, 2 + h);
			}
			else
				gr_set_fontcolor( CRED, -1 );
		}
		else
			gr_set_fontcolor( CWHITE, -1 );

		inputbox->status = 0;

		gr_string( 2, 2, inputbox->text );

		//gr_setcolor( CBLACK );
		//gr_rect( 2+w, 0, inputbox->width-1, inputbox->height-1 );

		if (dlg->keyboard_focus_gadget == (UI_GADGET *)inputbox  && !inputbox->first_time )
		{
			gr_setcolor(CRED);
			Vline( 2,inputbox->height-3, 2+w+1 );
			Vline( 2,inputbox->height-3, 2+w+2 );
		}
	}
}
Exemplo n.º 23
0
void draw_seg_objects(segment *seg)
{
	int objnum;

	for (objnum=seg->objects;objnum!=-1;objnum=Objects[objnum].next) {
		object *obj = &Objects[objnum];
		g3s_point sphere_point;

		if ((obj->type==OBJ_PLAYER) && (objnum > 0 ))
			gr_setcolor(BM_XRGB( 0,  25, 0  ));
		else
			gr_setcolor(obj==ConsoleObject?PLAYER_COLOR:ROBOT_COLOR);

		g3_rotate_point(&sphere_point,&obj->pos);

		g3_draw_sphere(&sphere_point,obj->size);
	}

}
Exemplo n.º 24
0
void ui_draw_userbox( UI_GADGET_USERBOX * userbox )
{

	if ( userbox->status==1 )
	{
		userbox->status = 0;

		ui_mouse_hide();
		gr_set_current_canvas( userbox->canvas );

		if (CurWindow->keyboard_focus_gadget == (UI_GADGET *)userbox)
			gr_setcolor( CRED );
		else
			gr_setcolor( CBRIGHT );

		gr_box( -1, -1, userbox->width, userbox->height );

		ui_mouse_show();
	}
}
Exemplo n.º 25
0
void draw_group_segments(void)
{
	int	s;

	if (current_group > -1) {
		gr_setcolor(GROUP_COLOR);
		for (s=0; s<GroupList[current_group].num_segments; s++)
			if (Segments[GroupList[current_group].segments[s]].segnum != -1)
				draw_segment(&Segments[GroupList[current_group].segments[s]]);
		}
}
Exemplo n.º 26
0
void gr_ubitmapGENERIC(int x, int y, grs_bitmap * bm)
{
	register int x1, y1;

	for (y1=0; y1 < bm->bm_h; y1++ )    {
		for (x1=0; x1 < bm->bm_w; x1++ )    {
			gr_setcolor( gr_gpixel(bm,x1,y1) );
			gr_upixel( x+x1, y+y1 );
		}
	}
}
Exemplo n.º 27
0
void menu_draw(MENU *menu)
{
	int i;
	
	gr_set_current_canvas(NULL);

	// Draw the menu background
	gr_setcolor( CGREY );
	gr_urect( menu->x, menu->y, menu->x + menu->w - 1, menu->y + menu->h - 1 );
	if ( menu != &Menu[0] )
	{
		gr_setcolor( CBLACK );
		gr_ubox( menu->x, menu->y, menu->x + menu->w - 1, menu->y + menu->h - 1 );
	}
	
	// Draw the items
	
	for (i=0; i< menu->NumItems; i++ )
		item_show( menu, i );
}
Exemplo n.º 28
0
void print_status_bar( char message[DIAGNOSTIC_MESSAGE_MAX] ) {
	int w,h,aw;

	gr_set_current_canvas( NULL );
	gr_set_curfont(editor_font);
	gr_set_fontcolor( CBLACK, CGREY );
	gr_get_string_size( message, &w, &h, &aw );
	gr_string( 4, 583, message );
	gr_set_fontcolor( CBLACK, CWHITE );
	gr_setcolor( CGREY );
	gr_rect( 4+w, 583, 799, 599 );
}
Exemplo n.º 29
0
void draw_stars()
{
	int i;
	int intensity=31;
	g3s_point p;

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

		if ((i&63) == 0) {
			gr_setcolor(BM_XRGB(intensity,intensity,intensity));
			intensity-=3;
		}			

		//g3_rotate_point(&p,&stars[i]);
		g3_rotate_delta_vec(&p.p3_vec,&stars[i]);
		g3_code_point(&p);

		if (p.p3_codes == 0) {

			p.p3_flags &= ~PF_PROJECTED;

			g3_project_point(&p);
#ifndef OGL
			gr_pixel(f2i(p.p3_sx),f2i(p.p3_sy));
#else
			g3_draw_sphere(&p,F1_0*3);
#endif
		}
	}

//@@	{
//@@		vms_vector delta;
//@@		g3s_point top_pnt;
//@@
//@@		g3_rotate_point(&p,&satellite_pos);
//@@		g3_rotate_delta_vec(&delta,&satellite_upvec);
//@@
//@@		g3_add_delta_vec(&top_pnt,&p,&delta);
//@@
//@@		if (! (p.p3_codes & CC_BEHIND)) {
//@@			int save_im = Interpolation_method;
//@@			Interpolation_method = 0;
//@@			//p.p3_flags &= ~PF_PROJECTED;
//@@			g3_project_point(&p);
//@@			if (! (p.p3_flags & PF_OVERFLOW))
//@@				//gr_bitmapm(f2i(p.p3_sx)-32,f2i(p.p3_sy)-32,satellite_bitmap);
//@@				g3_draw_rod_tmap(satellite_bitmap,&p,SATELLITE_WIDTH,&top_pnt,SATELLITE_WIDTH,f1_0);
//@@			Interpolation_method = save_im;
//@@		}
//@@	}

}
Exemplo n.º 30
0
//for looking for segment under a mouse click
void check_segment(segment *seg)
{
	short	*svp;
	int	nv;
	g3s_codes cc;

	med_get_vertex_list(seg,&nv,&svp);				// set nv = number of vertices, svp = pointer to vertex indices
	cc=rotate_list(nv,svp);

	if (! cc.and) {		//all off screen?
		int fn;

		gr_setcolor(0);
		gr_pixel(Search_x,Search_y);	//set our search pixel to color zero
		gr_setcolor(1);					//and render in color one

		for (fn=0;fn<6;fn++) {
			g3s_point *vert_list[4];
			
			vert_list[0] = &Segment_points[seg->verts[Side_to_verts[fn][0]]];
			vert_list[1] = &Segment_points[seg->verts[Side_to_verts[fn][1]]];
			vert_list[2] = &Segment_points[seg->verts[Side_to_verts[fn][2]]];
			g3_check_and_draw_poly(3,vert_list,NULL,NULL);

			vert_list[1] = &Segment_points[seg->verts[Side_to_verts[fn][2]]];
			vert_list[2] = &Segment_points[seg->verts[Side_to_verts[fn][3]]];
			g3_check_and_draw_poly(3,vert_list,NULL,NULL);

		}

		if (gr_ugpixel(&grd_curcanv->cv_bitmap,Search_x,Search_y) == 1)
                 {
			if (N_found_segs < MAX_FOUND_SEGS)
				Found_segs[N_found_segs++] = SEG_PTR_2_NUM(seg);
			else
				Warning("Found too many segs! (limit=%d)",MAX_FOUND_SEGS);
                 }
	}
}