/********************************************************************* * 針を描く. subr() ********************************************************************* */ void draw_needle_sub(int value,int color) { int x1,y1,x2,y2,dx,dy,dy1,dy2; int cx = AIN_CENTER_X; int cy = AIN_CENTER_Y; int r1 = AIN_CENTER_R-9; int r2 = 60; float x,y; calc_sincos(value,&x,&y); x1 = cx - (x*r1); y1 = cy - (y*r1); x2 = cx - (x*r2); y2 = cy - (y*r2); // softclip if( y2>AIN_CENTER_H) { dy = y2-y1; dx = x2-x1; dy2 = y2 - AIN_CENTER_H; dy1 = AIN_CENTER_H - y1; y2 = AIN_CENTER_H; //中点を補間. x2 = (x1*dy2 + x2*dy1) / dy; } gr_line(x1,y1,x2-1,y2,color); gr_line(x1,y1,x2,y2,color); gr_line(x1,y1,x2+1,y2,color); }
// 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; // custom_size me gr_line(Goal_screen_icon_x, y1, Goal_screen_text_x - 2, y1, GR_RESIZE_MENU); gr_line(Goal_screen_text_x + w + 1, y1, Goal_screen_icon_x + Goal_screen_text_w, y1, GR_RESIZE_MENU); } 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_menu(Goal_screen_text_x, y, buf); }
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 ); } }
//------------------------------------------------------------------------------ // blob_vertices has 3 vertices in it, 4th must be computed void DrawBlobOutline (void) { fix v3x, v3y; v3x = blob_vertices[4] - blob_vertices[2] + blob_vertices[0]; v3y = blob_vertices[5] - blob_vertices[3] + blob_vertices[1]; GrSetColorRGB (255, 255, 255, 255); gr_line (blob_vertices[0], blob_vertices[1], blob_vertices[2], blob_vertices[3]); gr_line (blob_vertices[2], blob_vertices[3], blob_vertices[4], blob_vertices[5]); gr_line (blob_vertices[4], blob_vertices[5], v3x, v3y); gr_line (v3x, v3y, blob_vertices[0], blob_vertices[1]); }
/********************************************************************* * 目盛りを描く. ********************************************************************* * 引数: * n : 0(0.0V) 〜 5000(5.0V) * flag : 0:普通の目盛り / 1:0.5V毎の目盛り / 2:1.0V毎の目盛り */ void draw_scale_sub(int n,int flag,char *str) { int x1,y1,x2,y2; int cx = AIN_CENTER_X; int cy = AIN_CENTER_Y; int r1 = AIN_CENTER_R-8; int r2; float x,y; int color = 0x000040; int value = n; calc_sincos(value,&x,&y); switch(flag) { //目盛りの長さを選択. default: case 0: r2 = AIN_CENTER_R;break; case 1: r2 = AIN_CENTER_R+8;break; case 2: r2 = AIN_CENTER_R+16;break; } // 線分の両端の座標を計算. x1 = cx - (x*r1); y1 = cy - (y*r1); x2 = cx - (x*r2); y2 = cy - (y*r2); gr_line(x1,y1,x2,y2,color); //線分を描く. if(str) { //数字を書く. gr_puts(x2-8,y2-16,str,color,BKCOL,12); } }
// blob_vertices has 3 vertices in it, 4th must be computed void draw_blob_outline(void) { fix v3x, v3y; v3x = blob_vertices[4] - blob_vertices[2] + blob_vertices[0]; v3y = blob_vertices[5] - blob_vertices[3] + blob_vertices[1]; gr_setcolor(BM_XRGB(63, 63, 63)); mprintf((0, "[%7.3f %7.3f] [%7.3f %7.3f] [%7.3f %7.3f]\n", f2fl(blob_vertices[0]), f2fl(blob_vertices[1]), f2fl(blob_vertices[2]), f2fl(blob_vertices[3]), f2fl(blob_vertices[4]), f2fl(blob_vertices[5]) )); gr_line(blob_vertices[0], blob_vertices[1], blob_vertices[2], blob_vertices[3]); gr_line(blob_vertices[2], blob_vertices[3], blob_vertices[4], blob_vertices[5]); gr_line(blob_vertices[4], blob_vertices[5], v3x, v3y); gr_line(v3x, v3y, blob_vertices[0], blob_vertices[1]); }
void stats_underline_text(int sx, int sy, char *text) { int w,h,fh; gr_get_string_size(&w,&h,text); fh=gr_get_font_height(); gr_line(sx-1, sy+fh, sx+w+1, sy+fh); }
void plot_parametric(vms_equation *coeffs, fix min_t, fix max_t, fix del_t) { vms_vector coord, dcoord; fix t, dt; const uint8_t color = 15; gr_box(*grd_curcanv, 75, 40, 325, 290, color); gr_box(*grd_curcanv, 75, 310, 325, 560, color); gr_box(*grd_curcanv,475, 310, 725, 560, color); //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_line (*grd_curcanv, 75*F1_0 + coord.x, 290*F1_0 - coord.z, 75*F1_0 + dcoord.x, 290*F1_0 - dcoord.z, 9); gr_line (*grd_curcanv, 75*F1_0 + coord.x, 560*F1_0 - coord.y, 75*F1_0 + dcoord.x, 560*F1_0 - dcoord.y, 10); gr_line (*grd_curcanv, 475*F1_0 + coord.z, 560*F1_0 - coord.y, 475*F1_0 + dcoord.z, 560*F1_0 - dcoord.y, 12); } }
void barracks_display_pilot_stats() { int y = 0; int z = Stats_scroll_offset; int font_height = gr_get_font_height(); char *str; int i, w, h; while (y + font_height <= Barracks_stats_coords[gr_screen.res][BARRACKS_H_COORD]) { if (z >= Num_stat_lines) { break; } str = Stat_labels[z]; if (*str == '*') { gr_set_color_fast(&Color_text_heading); str++; gr_get_string_size(&w, &h, str); i = Barracks_stats_coords[gr_screen.res][BARRACKS_Y_COORD] + y + h / 2 - 1; gr_line(Barracks_stats_coords[gr_screen.res][BARRACKS_X_COORD], i, Barracks_stats_coords[gr_screen.res][BARRACKS_X_COORD] + Barracks_stats_coords[gr_screen.res][BARRACKS_W_COORD] - w - 2, i, GR_RESIZE_MENU); gr_line(Barracks_stats_coords[gr_screen.res][BARRACKS_X_COORD] + Barracks_stats_coords[gr_screen.res][BARRACKS_W_COORD] + 1, i, Barracks_stats2_coords[gr_screen.res][BARRACKS_X_COORD] + Barracks_stats2_coords[gr_screen.res][BARRACKS_W_COORD], i, GR_RESIZE_MENU); } else { gr_set_color_fast(&Color_text_normal); } gr_get_string_size(&w, NULL, str); gr_printf_menu(Barracks_stats_coords[gr_screen.res][BARRACKS_X_COORD] + Barracks_stats_coords[gr_screen.res][BARRACKS_W_COORD] - w, Barracks_stats_coords[gr_screen.res][BARRACKS_Y_COORD] + y, "%s", str); str = Stats[z]; if (*str) { gr_printf_menu(Barracks_stats2_coords[gr_screen.res][BARRACKS_X_COORD], Barracks_stats_coords[gr_screen.res][BARRACKS_Y_COORD] + y, "%s", str); } y += font_height; z++; } }
void hud_draw_diamond(int x, int y, int width, int height) { Assert(height>0); Assert(width>0); int x1,x2,x3,x4,y1,y2,y3,y4; x1=x; y1=y-height/2; x2=x+width/2; y2=y; x3=x; y3=y+height/2; x4=x-width/2; y4=y; gr_line(x1,y1,x2,y2); gr_line(x2,y2,x3,y3); gr_line(x3,y3,x4,y4); gr_line(x4,y4,x1,y1); }
/********************************************************************* * 1サンプルの1ビット分を描画 ********************************************************************* * v : 0 か 非0 信号レベル. * diff : 0 か 非0 信号反転が起きた. */ static void plot_signals(int x,int y,int val,int old) { int col0,col1,col2,i,d; col0 = 0; col1 = BACK_COLOR ; col2 = SIG_COLOR2 ; if((x % 40)==0) col0=blue; if(x==0) return; x += 8; gr_vline(x+1,y,x+1,y-AIN_GRAPH_H,col2); //縦の線(先行線). gr_vline(x,y,x,y-AIN_GRAPH_H,col0); //縦の線(現在線). for(i=1;i<5;i++) { d = AIN_GRAPH_H * i / 5; gr_pset(x,y-d , blue); // ベースライン赤. } gr_line(x-1,y-old,x,y-val,SIG_COLOR); }
// --------------------------------------------------------------------- // mission_hotkey_do_frame() // // Called once per frame to process user input for the Hotkey Assignment Screen // void mission_hotkey_do_frame(float frametime) { char buf[256]; int i, k, w, h, y, z, line, hotkeys; int font_height = gr_get_font_height(); int select_tease_line = -1; // line mouse is down on, but won't be selected until button released color circle_color; if ( help_overlay_active(Hotkey_overlay_id) ) { Buttons[gr_screen.res][HELP_BUTTON].button.reset_status(); Ui_window.set_ignore_gadgets(1); } k = Ui_window.process() & ~KEY_DEBUGGED; if ( (k > 0) || B1_JUST_RELEASED ) { if ( help_overlay_active(Hotkey_overlay_id) ) { help_overlay_set_state(Hotkey_overlay_id, gr_screen.res, 0); Ui_window.set_ignore_gadgets(0); k = 0; } } if ( !help_overlay_active(Hotkey_overlay_id) ) { Ui_window.set_ignore_gadgets(0); } switch (k) { case KEY_DOWN: // scroll list down hotkey_scroll_line_down(); break; case KEY_UP: // scroll list up hotkey_scroll_line_up(); break; case KEY_PAGEDOWN: // scroll list down hotkey_scroll_screen_down(); break; case KEY_PAGEUP: // scroll list up hotkey_scroll_screen_up(); break; case KEY_CTRLED | KEY_ENTER: save_hotkeys(); // fall through to next state -- allender changed this behavior since ESC should always cancel, no? case KEY_ESC: mission_hotkey_exit(); break; case KEY_TAB: case KEY_ENTER: case KEY_PADENTER: expand_wing(); break; case KEY_EQUAL: case KEY_PADPLUS: add_hotkey(Cur_hotkey); break; case KEY_MINUS: case KEY_PADMINUS: remove_hotkey(); break; case KEY_F2: gameseq_post_event(GS_EVENT_OPTIONS_MENU); break; case KEY_CTRLED | KEY_R: reset_hotkeys(); break; case KEY_CTRLED | KEY_C: clear_hotkeys(); break; } // end switch // ? for (i=0; i<MAX_KEYED_TARGETS; i++) { if (k == Key_sets[i]) Cur_hotkey = i; if (k == (Key_sets[i] | KEY_SHIFTED)) add_hotkey(i); } // handle pressed buttons for (i=0; i<NUM_BUTTONS; i++) { if (Buttons[gr_screen.res][i].button.pressed()) { hotkey_button_pressed(i); break; // only need to handle 1 button @ a time } } for (i=0; i<LIST_BUTTONS_MAX; i++) { // check for tease line if (List_buttons[i].button_down()) { select_tease_line = i + Scroll_offset; } // check for selected list item if (List_buttons[i].pressed()) { Selected_line = i + Scroll_offset; List_buttons[i].get_mouse_pos(&z, NULL); z += Hotkey_list_coords[gr_screen.res][0]; // adjust to full screen space if ((z >= Hotkey_wing_icon_x[gr_screen.res]) && (z < (Hotkey_wing_icon_x[gr_screen.res]) + Hotkey_function_field_width[gr_screen.res])) { expand_wing(); } } if (List_buttons[i].double_clicked()) { Selected_line = i + Scroll_offset; hotkeys = -1; switch (Hotkey_lines[Selected_line].type) { case HOTKEY_LINE_WING: hotkeys = get_wing_hotkeys(Hotkey_lines[Selected_line].index); break; case HOTKEY_LINE_SHIP: case HOTKEY_LINE_SUBSHIP: hotkeys = Hotkey_bits[Hotkey_lines[Selected_line].index]; break; } if (hotkeys != -1) { if (hotkeys & (1 << Cur_hotkey)) remove_hotkey(); else add_hotkey(Cur_hotkey); } } } GR_MAYBE_CLEAR_RES(Background_bitmap); if (Background_bitmap >= 0) { gr_set_bitmap(Background_bitmap); gr_bitmap(0, 0, GR_RESIZE_MENU); } else gr_clear(); Ui_window.draw(); gr_init_color(&circle_color, 160, 160, 0); // draw the big "F10" in the little box font::set_font(font::FONT2); gr_set_color_fast(&Color_text_normal); strcpy_s(buf, Scan_code_text[Key_sets[Cur_hotkey]]); gr_get_string_size(&w, &h, buf); gr_printf_menu(Hotkey_function_name_coords[gr_screen.res][0] + (Hotkey_function_name_coords[gr_screen.res][2] - w) / 2, Hotkey_function_name_coords[gr_screen.res][1], buf); font::set_font(font::FONT1); line = Scroll_offset; while (hotkey_line_query_visible(line)) { z = Hotkey_lines[line].index; y = Hotkey_list_coords[gr_screen.res][1] + Hotkey_lines[line].y - Hotkey_lines[Scroll_offset].y; hotkeys = 0; switch (Hotkey_lines[line].type) { case HOTKEY_LINE_HEADING: gr_set_color_fast(&Color_text_heading); gr_get_string_size(&w, &h, Hotkey_lines[line].label); i = y + h / 2 - 1; gr_line(Hotkey_list_coords[gr_screen.res][0], i, Hotkey_ship_x[gr_screen.res] - 2, i, GR_RESIZE_MENU); gr_line(Hotkey_ship_x[gr_screen.res] + w + 1, i, Hotkey_list_coords[gr_screen.res][0] + Hotkey_list_coords[gr_screen.res][2], i, GR_RESIZE_MENU); break; case HOTKEY_LINE_WING: gr_set_bitmap(Wing_bmp); bm_get_info(Wing_bmp, NULL, &h, NULL); i = y + font_height / 2 - h / 2 - 1; gr_bitmap(Hotkey_wing_icon_x[gr_screen.res], i, GR_RESIZE_MENU); // i = y + font_height / 2 - 1; // gr_set_color_fast(&circle_color); // gr_circle(ICON_LIST_X + 4, i, 5, GR_RESIZE_MENU); // gr_set_color_fast(&Color_bright); // gr_line(ICON_LIST_X, i, ICON_LIST_X + 2, i, GR_RESIZE_MENU); // gr_line(ICON_LIST_X + 4, i - 4, ICON_LIST_X + 4, i - 2, GR_RESIZE_MENU); // gr_line(ICON_LIST_X + 6, i, ICON_LIST_X + 8, i, GR_RESIZE_MENU); // gr_line(ICON_LIST_X + 4, i + 2, ICON_LIST_X + 4, i + 4, GR_RESIZE_MENU); hotkeys = get_wing_hotkeys(Hotkey_lines[line].index); break; case HOTKEY_LINE_SHIP: case HOTKEY_LINE_SUBSHIP: hotkeys = Hotkey_bits[Hotkey_lines[line].index]; break; default: Int3(); } if (Hotkey_lines[line].type != HOTKEY_LINE_HEADING) { Assert( (line - Scroll_offset) < LIST_BUTTONS_MAX ); List_buttons[line - Scroll_offset].update_dimensions(Hotkey_list_coords[gr_screen.res][0], y, Hotkey_list_coords[gr_screen.res][0] + Hotkey_list_coords[gr_screen.res][2] - Hotkey_list_coords[gr_screen.res][0], font_height); List_buttons[line - Scroll_offset].enable(); if (hotkeys & (1 << Cur_hotkey)) { gr_set_color_fast(&Color_text_active); } else { if (line == Selected_line) gr_set_color_fast(&Color_text_selected); else if (line == select_tease_line) gr_set_color_fast(&Color_text_subselected); else gr_set_color_fast(&Color_text_normal); } } else { Assert( (line - Scroll_offset) < LIST_BUTTONS_MAX ); List_buttons[line - Scroll_offset].disable(); } // print active hotkeys associated for this line if (hotkeys) { for (i=0; i<MAX_KEYED_TARGETS; i++) { if (hotkeys & (1 << i)) { gr_printf_menu(Hotkey_list_coords[gr_screen.res][0] + Hotkey_function_field_width[gr_screen.res]*i, y, Scan_code_text[Key_sets[i]]); } } /* *buf = 0; for (i=0; i<MAX_KEYED_TARGETS; i++) { if (hotkeys & (1 << i)) { strcat_s(buf, Scan_code_text[Key_sets[i]]); strcat_s(buf, ", "); } } Assert(strlen(buf) > 1); buf[strlen(buf) - 2] = 0; // lose the ", " on the end font::force_fit_string(buf, 255, GROUP_LIST_W); gr_printf_menu(GROUP_LIST_X, y, buf);*/ } // draw ship/wing name strcpy_s(buf, Hotkey_lines[line].label); end_string_at_first_hash_symbol(buf); if (Hotkey_lines[line].type == HOTKEY_LINE_SUBSHIP) { // indent font::force_fit_string(buf, 255, Hotkey_list_coords[gr_screen.res][0] + Hotkey_list_coords[gr_screen.res][2] - (Hotkey_ship_x[gr_screen.res]+20)); gr_printf_menu(Hotkey_ship_x[gr_screen.res]+20, y, buf); } else { font::force_fit_string(buf, 255, Hotkey_list_coords[gr_screen.res][0] + Hotkey_list_coords[gr_screen.res][2] - Hotkey_ship_x[gr_screen.res]); gr_printf_menu(Hotkey_ship_x[gr_screen.res], y, buf); } line++; } i = line - Scroll_offset; while (i < LIST_BUTTONS_MAX) List_buttons[i++].disable(); // blit help overlay if active help_overlay_maybe_blit(Hotkey_overlay_id, gr_screen.res); gr_flip(); }
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(); }
void ui_line(int x1, int y1, int x2, int y2, int width) { pthread_mutex_lock(&gUpdateMutex); gr_line(x1,y1,x2,y2,width); pthread_mutex_unlock(&gUpdateMutex); }
void ui_hline(int x1, int x2, int y) { gr_line(x1, y, x2, y); }
void ui_vline(int y1, int y2, int x) { gr_line(x, y1, x, y2); }
// ------------------------------------------------------------------------------------- // Interface from Matt's data structures to Mike's texture mapper. // ------------------------------------------------------------------------------------- void draw_tmap(grs_bitmap *bp,int nverts,g3s_point **vertbuf) { int i; // These variables are used in system which renders texture maps which lie on one scanline as a line. #if SC2000K int flat_flag; // Set to 1 and remains 1 so long as all y coords are the same (in integer portion). int last_y; // Y coordinate of previous vertex. fix min_x = 0xfff0000, max_x = 0; // Minimum and maximum bounds of line to render in place of flat texture map. #endif // fix div_numerator; int lighting_on_save = Lighting_on; Assert(nverts <= MAX_TMAP_VERTS); #ifdef USE_MULT_CODE if ( !divide_table_filled ) fill_divide_table(); #endif // -- now called from g3_start_frame -- init_interface_vars_to_assembler(); // If no transparency and seg depth is large, render as flat shaded. if ((Current_seg_depth > Max_linear_depth) && ((bp->bm_flags & 3) == 0)) { draw_tmap_flat(bp, nverts, vertbuf); return; } if ( bp->bm_flags & BM_FLAG_RLE ) bp = rle_expand_texture( bp ); // Expand if rle'd Transparency_on = bp->bm_flags & BM_FLAG_TRANSPARENT; if (bp->bm_flags & BM_FLAG_NO_LIGHTING) Lighting_on = 0; // Set selector for current texture map. if ( bp->bm_selector == 0 ) { if (gr_bitmap_assign_selector( bp ) ) Error( "Couldn't assign selector in ntmap.c!\n" ); } pixel_data_selector = bp->bm_selector; // Setup texture map in Tmap1 Tmap1.nv = nverts; // Initialize number of vertices #if SC2000K last_y = f2i(vertbuf[0]->p3_sy); flat_flag = 1; // Says so far, this texture map exists all on one scan line #endif // div_numerator = DivNum; //f1_0*3; for (i=0; i<nverts; i++) { g3ds_vertex *tvp = &Tmap1.verts[i]; g3s_point *vp = vertbuf[i]; tvp->x2d = vp->p3_sx; tvp->y2d = vp->p3_sy; #if SC2000K // If y coordinates are not the same (in integer portion), then this texture map is not all on one scan line if (f2i(tvp->y2d) != last_y) flat_flag = 0; // If everything is flat so far, set minimum x and y for rendering a scanline if (flat_flag) { if (tvp->x2d < min_x) min_x = tvp->x2d; if (tvp->x2d > max_x) max_x = tvp->x2d; } #endif // Check for overflow on fixdiv. Will overflow on vp->z <= something small. Allow only as low as 256. if (vp->z < 256) { vp->z = 256; // Int3(); // we would overflow if we divided! } tvp->z = fixdiv(F1_0*12, vp->z); tvp->u = vp->p3_u << 6; //* bp->bm_w; tvp->v = vp->p3_v << 6; //* bp->bm_h; Assert(Lighting_on < 3); if (Lighting_on) tvp->l = vp->p3_l * NUM_LIGHTING_LEVELS; } #if SC2000K // Render a horizontal line instead of a texture map if flat_flag still set (all vertices on one scanline). if (SC2000 && flat_flag) { fix y,cvw; Int3(); y = Tmap1.verts[0].y2d; cvw = i2f(grd_curcanv->cv_bitmap.bm_w-1); if (y<0 || y>i2f(grd_curcanv->cv_bitmap.bm_h-1)) { Lighting_on = lighting_on_save; return; } //if (min_x < 0) min_x = 0; //if (max_x > cvw) max_x = cvw; gr_setcolor(*(bp->bm_data+32*32+32)); // Read center pixel of 64x64 bitmap, use as line color. gr_line(min_x, Tmap1.verts[0].y2d, max_x, Tmap1.verts[0].y2d); Lighting_on = lighting_on_save; return; } #endif Lighting_enabled = Lighting_on; // Now, call my texture mapper. if (Lighting_on) { switch (Interpolation_method) { // 0 = choose, 1 = linear, 2 = /8 perspective, 3 = full perspective case 0: // choose best interpolation per2_flag = 1; if (Current_seg_depth > Max_perspective_depth) ntexture_map_lighted_linear(bp, &Tmap1); else ntexture_map_lighted(bp, &Tmap1); break; case 1: // linear interpolation per2_flag = 1; ntexture_map_lighted_linear(bp, &Tmap1); break; case 2: // perspective every 8th pixel interpolation per2_flag = 1; ntexture_map_lighted(bp, &Tmap1); break; case 3: // perspective every pixel interpolation per2_flag = 0; // this hack means do divide every pixel ntexture_map_lighted(bp, &Tmap1); break; default: Assert(0); // Illegal value for Interpolation_method, must be 0,1,2,3 } } else { switch (Interpolation_method) { // 0 = choose, 1 = linear, 2 = /8 perspective, 3 = full perspective case 0: // choose best interpolation per2_flag = 1; if (Current_seg_depth > Max_perspective_depth) ntexture_map_lighted_linear(bp, &Tmap1); else ntexture_map_lighted(bp, &Tmap1); break; case 1: // linear interpolation per2_flag = 1; ntexture_map_lighted_linear(bp, &Tmap1); break; case 2: // perspective every 8th pixel interpolation per2_flag = 1; ntexture_map_lighted(bp, &Tmap1); break; case 3: // perspective every pixel interpolation per2_flag = 0; // this hack means do divide every pixel ntexture_map_lighted(bp, &Tmap1); break; default: Assert(0); // Illegal value for Interpolation_method, must be 0,1,2,3 } } Lighting_on = lighting_on_save; }