예제 #1
0
void hud_scrollback_do_frame(float frametime)
{
    int i, k, x, y;
    int font_height = gr_get_font_height();

    k = Ui_window.process();
    switch (k) {
    case KEY_RIGHT:
    case KEY_TAB:
        if (Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES) {
            Scrollback_mode = SCROLLBACK_MODE_MSGS_LOG;
            Scroll_max = hud_query_scrollback_size();
            hud_scroll_reset();

        } else if (Scrollback_mode == SCROLLBACK_MODE_MSGS_LOG) {
            Scrollback_mode = SCROLLBACK_MODE_EVENT_LOG;
            Scroll_max = Num_log_lines * gr_get_font_height();
            hud_scroll_reset();

        } else {
            Scrollback_mode = SCROLLBACK_MODE_OBJECTIVES;
            Scroll_max = Num_obj_lines * gr_get_font_height();
            Scroll_offset = 0;
        }

        break;

    case KEY_LEFT:
    case KEY_SHIFTED | KEY_TAB:
        if (Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES) {
            Scrollback_mode = SCROLLBACK_MODE_EVENT_LOG;
            Scroll_max = Num_log_lines * gr_get_font_height();
            hud_scroll_reset();

        } else if (Scrollback_mode == SCROLLBACK_MODE_MSGS_LOG) {
            Scrollback_mode = SCROLLBACK_MODE_OBJECTIVES;
            Scroll_max = Num_obj_lines * gr_get_font_height();
            Scroll_offset = 0;

        } else {
            Scrollback_mode = SCROLLBACK_MODE_MSGS_LOG;
            Scroll_max = hud_query_scrollback_size();
            hud_scroll_reset();
        }

        break;

    case KEY_PAGEUP:
        hud_page_scroll_list(1);
        break;

    case KEY_PAGEDOWN:
        hud_page_scroll_list(0);
        break;

    case KEY_ENTER:
    case KEY_CTRLED | KEY_ENTER:
    case KEY_ESC:
        hud_scrollback_exit();
        break;

    case KEY_F1:  // show help overlay
        break;

    case KEY_F2:  // goto options screen
        gameseq_post_event(GS_EVENT_OPTIONS_MENU);
        break;
    }	// end switch

    for (i=0; i<NUM_BUTTONS; i++) {
        if (Buttons[gr_screen.res][i].button.pressed()) {
            hud_scrollback_button_pressed(i);
        }
    }

    GR_MAYBE_CLEAR_RES(Background_bitmap);
    if (Background_bitmap >= 0) {
        gr_set_bitmap(Background_bitmap);
        gr_bitmap(0, 0, GR_RESIZE_MENU);
    }

    /*
    if ((Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES) && (Status_bitmap >= 0)) {
    	gr_set_bitmap(Status_bitmap);
    	gr_bitmap(Hud_mission_log_status_coords[gr_screen.res][0], Hud_mission_log_status_coords[gr_screen.res][1], GR_RESIZE_MENU);
    }
    */

    // draw the objectives key at the bottom of the ingame objectives screen
    if (Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES) {
        ML_render_objectives_key();
    }

    Ui_window.draw();

    if (Scrollback_mode == SCROLLBACK_MODE_EVENT_LOG) {
        Buttons[gr_screen.res][SHOW_EVENTS_BUTTON].button.draw_forced(2);
        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]);

    } else if (Scrollback_mode == SCROLLBACK_MODE_OBJECTIVES) {
        Buttons[gr_screen.res][SHOW_OBJS_BUTTON].button.draw_forced(2);
        ML_objectives_do_frame(Scroll_offset);

    } else {
        line_node *node_ptr;

        Buttons[gr_screen.res][SHOW_MSGS_BUTTON].button.draw_forced(2);
//		y = ((LIST_H / font_height) - 1) * font_height;
        y = 0;
        if ( !EMPTY(&Msg_scrollback_used_list) && HUD_msg_inited ) {
            node_ptr = GET_FIRST(&Msg_scrollback_used_list);
            i = 0;
            while ( node_ptr != END_OF_LIST(&Msg_scrollback_used_list) ) {
                if ((node_ptr->source == HUD_SOURCE_HIDDEN) || (i++ < Scroll_offset)) {
                    node_ptr = GET_NEXT(node_ptr);

                } else {
                    int team = HUD_source_get_team(node_ptr->source);

                    if (team >= 0)
                    {
                        gr_set_color_fast(iff_get_color_by_team(team, Player_ship->team, 0));
                    }
                    else
                    {
                        switch (node_ptr->source)
                        {
                        case HUD_SOURCE_TRAINING:
                            gr_set_color_fast(&Color_bright_blue);
                            break;

                        case HUD_SOURCE_TERRAN_CMD:
                            gr_set_color_fast(&Color_bright_white);
                            break;

                        case HUD_SOURCE_IMPORTANT:
                        case HUD_SOURCE_FAILED:
                        case HUD_SOURCE_SATISFIED:
                            gr_set_color_fast(&Color_bright_white);
                            break;

                        default:
                            gr_set_color_fast(&Color_text_normal);
                            break;
                        }
                    }

                    if (node_ptr->time)
                        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, GR_RESIZE_MENU);

                    x = Hud_mission_log_list2_coords[gr_screen.res][0] + node_ptr->x;
                    gr_printf_menu(x, Hud_mission_log_list_coords[gr_screen.res][1] + y, "%s", node_ptr->text);
                    if (node_ptr->underline_width)
                        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, GR_RESIZE_MENU);

                    if ((node_ptr->source == HUD_SOURCE_FAILED) || (node_ptr->source == HUD_SOURCE_SATISFIED)) {
                        // draw goal icon
                        if (node_ptr->source == HUD_SOURCE_FAILED)
                            gr_set_color_fast(&Color_bright_red);
                        else
                            gr_set_color_fast(&Color_bright_green);

                        i = Hud_mission_log_list_coords[gr_screen.res][1] + y + font_height / 2 - 1;
                        gr_circle(Hud_mission_log_list2_coords[gr_screen.res][0] - 6, i, 5, GR_RESIZE_MENU);

                        gr_set_color_fast(&Color_bright);
                        gr_line(Hud_mission_log_list2_coords[gr_screen.res][0] - 10, i, Hud_mission_log_list2_coords[gr_screen.res][0] - 8, i, GR_RESIZE_MENU);
                        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, GR_RESIZE_MENU);
                        gr_line(Hud_mission_log_list2_coords[gr_screen.res][0] - 4, i, Hud_mission_log_list2_coords[gr_screen.res][0] - 2, i, GR_RESIZE_MENU);
                        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, GR_RESIZE_MENU);
                    }

                    y += font_height + node_ptr->y;
                    node_ptr = GET_NEXT(node_ptr);
                    if (y + font_height > Hud_mission_log_list_coords[gr_screen.res][3])
                        break;
                }
            }
        }
    }

    gr_set_color_fast(&Color_text_heading);
    gr_print_timestamp(Hud_mission_log_time_coords[gr_screen.res][0], Hud_mission_log_time_coords[gr_screen.res][1] - font_height, Missiontime, GR_RESIZE_MENU);
    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), GR_RESIZE_MENU);
    gr_flip();
}
예제 #2
0
파일: miniui.c 프로젝트: LuckJC/pro-mk
void ui_circle(int x, int y, int r) {
    pthread_mutex_lock(&gUpdateMutex);
    gr_circle(x,y,r);
    pthread_mutex_unlock(&gUpdateMutex);
}
예제 #3
0
파일: radar.c 프로젝트: btb/d1x
void radar_render_frame()	
{
	int i,color;
	object * objp;

// added 7/5/99 - Owen Evans - radar resizes with screen size
        switch (Cockpit_mode)
        {
                case CM_FULL_SCREEN:
                        Hostage_monitor_size = Game_window_w / 6;
                        Hostage_monitor_x = (grd_curscreen->sc_w - Game_window_w) / 2;
                        Hostage_monitor_y = (grd_curscreen->sc_h - Game_window_h) / 2;
                        break;
                case CM_FULL_COCKPIT:
                        Hostage_monitor_size = 40;
                        Hostage_monitor_x = 0;
                        Hostage_monitor_y = 80;
                        break;
                case CM_STATUS_BAR:
                        Hostage_monitor_size = Game_window_w / 6;
                        Hostage_monitor_x = (grd_curscreen->sc_w - Game_window_w) / 2;
                        Hostage_monitor_y = (max_window_h - Game_window_h) / 2;
                        break;
                case CM_REAR_VIEW: //no radar in rear view or letterbox!
                case CM_LETTERBOX:
                        return;
        }
//end added - OE

	if (hostage_is_vclip_playing())
		return;

	gr_set_current_canvas(NULL);

	gr_setcolor( BM_XRGB( 0, 31, 0 ) );
	
        gr_ucircle( i2f(Hostage_monitor_x+Hostage_monitor_size/2), i2f(Hostage_monitor_y+Hostage_monitor_size/2),     i2f(Hostage_monitor_size)/2);

     //other stuff added 9/14/98 by Victor Rachels for fun.
        gr_circle( i2f(Hostage_monitor_x+Hostage_monitor_size/2), i2f(Hostage_monitor_y+Hostage_monitor_size/2),     i2f(Hostage_monitor_size) / 8 );
        gr_upixel((Hostage_monitor_x+Hostage_monitor_size/2), (Hostage_monitor_y+Hostage_monitor_size/2) );
        gr_uline(i2f(Hostage_monitor_x+Hostage_monitor_size/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2),i2f(Hostage_monitor_x+Hostage_monitor_size*2/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2));
        gr_uline(i2f(Hostage_monitor_x+Hostage_monitor_size-Hostage_monitor_size/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2),i2f(Hostage_monitor_x+Hostage_monitor_size-Hostage_monitor_size*2/10),i2f(Hostage_monitor_y+Hostage_monitor_size/2));


//killed 7/5/99 - Owen Evans - make radar much more useable
//        // Erase old blips
//        for (i=0; i<N_blips; i++ )      {
//                gr_setcolor(gr_gpixel( &GameBitmaps[cockpit_bitmap[0].index], Blips[i].x, Blips[i].y ));
//                gr_upixel( Blips[i].x, Blips[i].y );
//        }
//end killed - OE

        N_blips = 0;

//	if ( !(Players[Player_num].flags & (PLAYER_FLAGS_RADAR_ENEMIES | PLAYER_FLAGS_RADAR_POWERUPS  )) ) return;

        radx = i2f(Hostage_monitor_size*4)/2;
        rady = i2f(Hostage_monitor_size*4)/2;
        cenx = i2f(Hostage_monitor_x)+i2f(Hostage_monitor_size)/2;
        ceny = i2f(Hostage_monitor_y)+i2f(Hostage_monitor_size)/2;

	rox = fixdiv( cenx, radx );
	roy = fixdiv( ceny, rady );

	objp = Objects;
	for (i=0;i<=Highest_object_index;i++) {
		switch( objp->type )	{
		case OBJ_PLAYER:
			if ( i != Players[Player_num].objnum )	{
#ifdef NETWORK
				if (Game_mode & GM_TEAM)
					color = get_team(i);
				else
#endif
                                        color = i;
				radar_plot_object( objp, gr_getcolor(player_rgb[color].r,player_rgb[color].g,player_rgb[color].b) );
			}
			break;
              case OBJ_HOSTAGE:
                      radar_plot_object( objp, BM_XRGB(0,31,0) );
                      break;
              case OBJ_POWERUP:
                      //if ( Players[Player_num].flags & PLAYER_FLAGS_RADAR_POWERUPS )
                       if(!(Game_mode & GM_MULTI))
                        radar_plot_object( objp, BM_XRGB(0,0,31) );
                      break;
	      case OBJ_ROBOT:
//			//if ( Players[Player_num].flags & PLAYER_FLAGS_RADAR_ENEMIES )
		      radar_plot_object( objp, BM_XRGB(31,0,0) );
		      break;
// added 7/5/99 - Owen Evans - reactor is now shown on radar
              case OBJ_CNTRLCEN:
                      radar_plot_object( objp, BM_XRGB(31,31,31) );
                      break;
// end added - OE
		default:
			break;
		}
		objp++;
	}

	// Draw new blips...
	for (i=0; i<N_blips; i++ )	{
		gr_setcolor( Blips[i].c );
		gr_upixel( Blips[i].x, Blips[i].y );
	}
}
예제 #4
0
void UI_RADIO::draw()
{
	int offset;


	if ( uses_bmaps ) {

		if ( disabled_flag ) {
			if ( flag ) {
				if ( bmap_ids[RADIO_DISABLED_MARKED] != -1 ) {
					gr_set_bitmap(bmap_ids[RADIO_DISABLED_MARKED], GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1);
					gr_bitmap(x,y);
				}
			}
			else {
				if ( bmap_ids[RADIO_DISABLED_CLEAR] != -1 ) {
					gr_set_bitmap(bmap_ids[RADIO_DISABLED_CLEAR], GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1);
					gr_bitmap(x,y);
				}
			}
		}
		else {		// not disabled
			if ( position == 0 )	{	// up
				if ( flag ) {			// marked
					if ( bmap_ids[RADIO_UP_MARKED] != -1 ) {
						gr_set_bitmap(bmap_ids[RADIO_UP_MARKED], GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1);
						gr_bitmap(x,y);
					}
				}
				else {					// not marked
					if ( bmap_ids[RADIO_UP_CLEAR] != -1 ) {
						gr_set_bitmap(bmap_ids[RADIO_UP_CLEAR], GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1);
						gr_bitmap(x,y);
					}
				}
			}
			else {						// down 
				if ( flag ) {			// marked
					if ( bmap_ids[RADIO_DOWN_MARKED] != -1 ) {
						gr_set_bitmap(bmap_ids[RADIO_DOWN_MARKED], GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1);
						gr_bitmap(x,y);
					}
				}
				else {					// not marked
					if ( bmap_ids[RADIO_DOWN_CLEAR] != -1 ) {
						gr_set_bitmap(bmap_ids[RADIO_DOWN_CLEAR], GR_ALPHABLEND_NONE, GR_BITBLT_MODE_NORMAL, 1.0f, -1, -1);
						gr_bitmap(x,y);
					}
				}
			}
		}
	}
	else {
		gr_set_font(my_wnd->f_id);
		gr_set_clip( x, y, w, h );

		if (position == 0 )	{
			ui_draw_box_out( 0, 0, w-1, h-1 );
			offset = 0;
		} else {
			ui_draw_box_in( 0, 0, w-1, h-1 );
			offset = 1;
		}

		if (disabled_flag)
			gr_set_color_fast(&CDARK_GRAY);
		else if (my_wnd->selected_gadget == this)
			gr_set_color_fast(&CBRIGHT_GREEN);
		else 
			gr_set_color_fast(&CGREEN);

	//	if (flag)
	//		ui_string_centered(  Middle(w)+offset, Middle(h)+offset, "*" );
	//	else
	//		ui_string_centered(  Middle(w)+offset, Middle(h)+offset, "o" );
		if (flag)	{
			gr_circle( Middle(w)+offset, Middle(h)+offset, 8 );
		} else {
			gr_circle( Middle(w)+offset, Middle(h)+offset, 8 );
			gr_set_color_fast( &CWHITE );
			gr_circle( Middle(w)+offset, Middle(h)+offset, 4 );
		}

		if (disabled_flag)
			gr_set_color_fast(&CDARK_GRAY);
		else if (my_wnd->selected_gadget == this)
			gr_set_color_fast(&CBRIGHT_GREEN);
		else 
			gr_set_color_fast(&CGREEN);

		if ( text )	{
			gr_reset_clip();
			gr_string( x+w+4, y+2, text );
		}
	}
}