View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002076 | FSSCP | HUD | public | 2009-12-21 12:31 | 2010-12-11 04:25 |
Reporter | KeldorKatarn | Assigned To | Swifty | ||
Priority | normal | Severity | feature | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | IBM PC | OS | MS Windows | OS Version | Vista SP2 |
Product Version | 3.6.11 | ||||
Summary | 0002076: Possibility to specify for custom and tbl-customizable gauges move in pan view or remain static | ||||
Description | Summary says it all. And this is a child of 0002071 and depends on completion of 0001936 Code will be posted here upon completion of the dependency ticket. | ||||
Tags | No tags attached. | ||||
|
The attached patch will add a possible flag to hud_gauges.tbl that will have an effect on the fuel and weapon energy gauge and any custom gauge. If set to "true" the gauge will move like the reticle in pan view, if "false" it will remain static. Default for custom gauges is false, as before. Default for afterburner and weapons fuel gauges is true as in retail. |
2010-01-21 10:06
|
custom_gauges_pan_view.patch (11,948 bytes)
Index: code/hud/hud.cpp =================================================================== --- code/hud/hud.cpp (revision 5831) +++ code/hud/hud.cpp (working copy) @@ -1314,7 +1314,14 @@ } if(image_ids[i].first_frame != -1) { - GR_AABITMAP(image_ids[i].first_frame + current_hud->custom_gauge_frames[i], current_hud->custom_gauge_coords[i][0], current_hud->custom_gauge_coords[i][1]); + if (current_hud->custom_gauge_moveflags[i]) + { + GR_AABITMAP(image_ids[i].first_frame + current_hud->custom_gauge_frames[i], current_hud->custom_gauge_coords[i][0] + HUD_nose_x, current_hud->custom_gauge_coords[i][1] + HUD_nose_y); + } + else + { + GR_AABITMAP(image_ids[i].first_frame + current_hud->custom_gauge_frames[i], current_hud->custom_gauge_coords[i][0], current_hud->custom_gauge_coords[i][1]); + } } //So we're back to normal Index: code/hud/hudparse.cpp =================================================================== --- code/hud/hudparse.cpp (revision 5831) +++ code/hud/hudparse.cpp (working copy) @@ -43,26 +43,26 @@ #define HUD_VAR(a) offsetof(hud_info, a) gauge_info gauges[MAX_HUD_GAUGE_TYPES] = { - { NULL, HUD_VAR(Player_shield_coords), "$Player Shield:", 396, 379, 634, 670, 0, 0, 0, 0, 0, -1, -1 }, - { NULL, HUD_VAR(Target_shield_coords), "$Target Shield:", 142, 379, 292, 670, 0, 0, 0, 0, 0, -1, -1 }, - { NULL, HUD_VAR(Shield_mini_coords), "$Shield Mini:", 305, 291, 497, 470, 0, HUD_VAR(Shield_mini_fname), 0, 0, 0, -1, -1 }, - { NULL, HUD_VAR(Aburn_coords), "$Afterburner Energy:", 171, 265, 274, 424, HUD_VAR(Aburn_size), HUD_VAR(Aburn_fname), 0, 0, 0, -1, -1 }, - { NULL, HUD_VAR(Wenergy_coords), "$Weapons Energy:", 416, 265, 666, 424, HUD_VAR(Wenergy_size), HUD_VAR(Wenergy_fname), 0, 0, 0, -1, -1 }, - { NULL, HUD_VAR(Wenergy_text_coords), "$Weapons Energy Text:", 439, 318, 708, 509, 0, 0, 0, 0, 0, -1, -1 }, - { NULL, HUD_VAR(Escort_coords), "$Escort List:", 486, 206, 865, 330, 0, HUD_VAR(Escort_filename[0]), 0, HUD_VAR(Escort_htext), 0, -1, -1 }, + { NULL, HUD_VAR(Player_shield_coords), "$Player Shield:", 396, 379, 634, 670, 0, 0, 0, 0, 0, 0, -1, -1 }, + { NULL, HUD_VAR(Target_shield_coords), "$Target Shield:", 142, 379, 292, 670, 0, 0, 0, 0, 0, 0, -1, -1 }, + { NULL, HUD_VAR(Shield_mini_coords), "$Shield Mini:", 305, 291, 497, 470, 0, HUD_VAR(Shield_mini_fname), 0, 0, 0, 0, -1, -1 }, + { NULL, HUD_VAR(Aburn_coords), "$Afterburner Energy:", 171, 265, 274, 424, HUD_VAR(Aburn_size), HUD_VAR(Aburn_fname), 0, 0, 0, HUD_VAR(Aburn_move_flag), -1, -1 }, + { NULL, HUD_VAR(Wenergy_coords), "$Weapons Energy:", 416, 265, 666, 424, HUD_VAR(Wenergy_size), HUD_VAR(Wenergy_fname), 0, 0, 0, HUD_VAR(Wenergy_move_flag), -1, -1 }, + { NULL, HUD_VAR(Wenergy_text_coords), "$Weapons Energy Text:", 439, 318, 708, 509, 0, 0, 0, 0, 0, 0, -1, -1 }, + { NULL, HUD_VAR(Escort_coords), "$Escort List:", 486, 206, 865, 330, 0, HUD_VAR(Escort_filename[0]), 0, HUD_VAR(Escort_htext), 0, 0, -1, -1 }, //Mini-gauges - { &gauges[2], HUD_VAR(Hud_mini_3digit), "$Text Base:", 310, 298, 502, 477, 0, 0, 0, 0, 0, -1, -1 }, - { &gauges[2], HUD_VAR(Hud_mini_1digit), "$Text 1 digit:", 316, 298, 511, 477, 0, 0, 0, 0, 0, -1, -1 }, -// { &gauges[2], HUD_VAR(Hud_mini_2digit), "$Text 2 digit:", 213, 298, 346, 477, 0, 0, 0, 0, 0, -1, -1 }, - { &gauges[2], HUD_VAR(Hud_mini_2digit), "$Text 2 digit:", 313, 298, 506, 477, 0, 0, 0, 0, 0, -1, -1 }, - { &gauges[5], HUD_VAR(Escort_htext_coords), "$Header Text:", 489, 208, 869, 331, 0, 0, 0, 0, 0, -1, -1 }, - { &gauges[5], HUD_VAR(Escort_list), "$List:", 0, 12, 0, 13, 0, 0, 0, 0, 0, HG_NOADD, -1 }, - { &gauges[5], HUD_VAR(Escort_entry), "$Ship:", 0, 11, 0, 11, 0, HUD_VAR(Escort_filename[1]), 0, 0, 0, HG_NOADD, -1 }, - { &gauges[5], HUD_VAR(Escort_entry_last), "$Last Ship:", 0, 11, 0, 11, 0, HUD_VAR(Escort_filename[2]), 0, 0, 0, HG_NOADD, -1 }, - { &gauges[5], HUD_VAR(Escort_name), "$Ship Name:", 3, 0, 4, 0, 0, 0, 0, 0, 0, HG_NOADD, -1 }, - { &gauges[5], HUD_VAR(Escort_integrity), "$Ship Hull:", 128, 0, 116, 0, 0, 0, 0, 0, 0, HG_NOADD, -1 }, - { &gauges[5], HUD_VAR(Escort_status), "$Ship Status:", -12, 0, -11, 0, 0, 0, 0, 0, 0, HG_NOADD, -1 } + { &gauges[2], HUD_VAR(Hud_mini_3digit), "$Text Base:", 310, 298, 502, 477, 0, 0, 0, 0, 0, 0, -1, -1 }, + { &gauges[2], HUD_VAR(Hud_mini_1digit), "$Text 1 digit:", 316, 298, 511, 477, 0, 0, 0, 0, 0, 0, -1, -1 }, +// { &gauges[2], HUD_VAR(Hud_mini_2digit), "$Text 2 digit:", 213, 298, 346, 477, 0, 0, 0, 0, 0, 0, -1, -1 }, + { &gauges[2], HUD_VAR(Hud_mini_2digit), "$Text 2 digit:", 313, 298, 506, 477, 0, 0, 0, 0, 0, 0, -1, -1 }, + { &gauges[5], HUD_VAR(Escort_htext_coords), "$Header Text:", 489, 208, 869, 331, 0, 0, 0, 0, 0, 0, -1, -1 }, + { &gauges[5], HUD_VAR(Escort_list), "$List:", 0, 12, 0, 13, 0, 0, 0, 0, 0, 0, HG_NOADD, -1 }, + { &gauges[5], HUD_VAR(Escort_entry), "$Ship:", 0, 11, 0, 11, 0, HUD_VAR(Escort_filename[1]), 0, 0, 0, 0, HG_NOADD, -1 }, + { &gauges[5], HUD_VAR(Escort_entry_last), "$Last Ship:", 0, 11, 0, 11, 0, HUD_VAR(Escort_filename[2]), 0, 0, 0, 0, HG_NOADD, -1 }, + { &gauges[5], HUD_VAR(Escort_name), "$Ship Name:", 3, 0, 4, 0, 0, 0, 0, 0, 0, 0, HG_NOADD, -1 }, + { &gauges[5], HUD_VAR(Escort_integrity), "$Ship Hull:", 128, 0, 116, 0, 0, 0, 0, 0, 0, 0, HG_NOADD, -1 }, + { &gauges[5], HUD_VAR(Escort_status), "$Ship Status:", -12, 0, -11, 0, 0, 0, 0, 0, 0, 0, HG_NOADD, -1 } }; //Number of gauges @@ -103,6 +103,10 @@ /**************************************************/ } + // Pan View Move Flag defaults + hud->Aburn_move_flag = true; + hud->Wenergy_move_flag = true; + //Neither strcpy_s(hud->Shield_mini_fname, "targhit1"); strcpy_s(hud->Escort_filename[0], "escort1"); @@ -281,6 +285,18 @@ stuff_ubyte(&junk_byte); } } + if(optional_string("+Move in Pan View:")) + { + if(cg->moveflag_dest) + { + stuff_boolean(HUD_BOOL(dest_hud, cg->moveflag_dest)); + } + else + { + bool junk_bool; + stuff_boolean(&junk_bool); + } + } return 1; } @@ -434,6 +450,7 @@ cg->frame_dest = HUD_VAR(custom_gauge_frames[0]) + (Num_custom_gauges * sizeof(int)); cg->text_dest = HUD_VAR(custom_gauge_text[0]) + (Num_custom_gauges * (NAME_LENGTH * sizeof(char))); cg->color_dest = HUD_VAR(custom_gauge_colors[0]) + (Num_custom_gauges * sizeof(color)); + cg->moveflag_dest = HUD_VAR(custom_gauge_moveflags[0]) + (Num_custom_gauges * sizeof(bool)); required_string("$Name:"); //Gotta make this a token Index: code/hud/hudparse.h =================================================================== --- code/hud/hudparse.h (revision 5831) +++ code/hud/hudparse.h (working copy) @@ -33,6 +33,8 @@ int Wenergy_size[2]; char Aburn_fname[MAX_FILENAME_LEN]; char Wenergy_fname[MAX_FILENAME_LEN]; + bool Aburn_move_flag; + bool Wenergy_move_flag; //Hudescort int Escort_coords[2]; @@ -58,6 +60,7 @@ int custom_gauge_frames[MAX_CUSTOM_HUD_GAUGES]; char custom_gauge_text[MAX_CUSTOM_HUD_GAUGES][NAME_LENGTH]; color custom_gauge_colors[MAX_CUSTOM_HUD_GAUGES]; + bool custom_gauge_moveflags[MAX_CUSTOM_HUD_GAUGES]; // int gauge_text_sexp_vars[MAX_HUD_GAUGE_TYPES]; // int gauge_frame_sexp_vars[MAX_HUD_GAUGE_TYPES]; @@ -98,6 +101,7 @@ memset( custom_gauge_frames, 0, sizeof( custom_gauge_frames ) ); memset( custom_gauge_text, 0, sizeof( custom_gauge_text ) ); memset( custom_gauge_colors, 0, sizeof( custom_gauge_colors ) ); + memset( custom_gauge_moveflags, 0, sizeof( custom_gauge_moveflags ) ); } } hud_info; @@ -115,6 +119,7 @@ size_t frame_dest; //Storage spot for frame info size_t text_dest; //Storage spot for text value size_t color_dest; //Storage spot for color value + size_t moveflag_dest; //Storage spot for pan view move boolean int placement_flags; int show_flags; //Show outside ship? //int (*update_gauge)(gauge_info* cg); //Function to update the gauge @@ -127,6 +132,7 @@ #define HUD_INT(a, b) ((int*)((char*)a + b)) #define HUD_CHAR(a, b) ((char *)((char*)a + b)) #define HUD_COLOR(a, b) ((color *)((char*)a + b)) +#define HUD_BOOL(a, b) ((bool *)((char*)a + b)) //Variables extern int Num_custom_gauges; Index: code/hud/hudtarget.cpp =================================================================== --- code/hud/hudtarget.cpp (revision 5831) +++ code/hud/hudtarget.cpp (working copy) @@ -4820,7 +4820,8 @@ void hud_show_afterburner_gauge() { float percent_left; - int clip_h,w,h; + int clip_h,w,h; + int nose_offset_x = 0, nose_offset_y = 0; if ( Aburn_bar_gauge.first_frame == -1 ){ return; @@ -4842,13 +4843,19 @@ clip_h = fl2i( (1.0f - percent_left) * current_hud->Aburn_size[0] + 0.5f ); bm_get_info(Aburn_bar_gauge.first_frame,&w,&h); + + if (current_hud->Aburn_move_flag) + { + nose_offset_x = HUD_nose_x; + nose_offset_y = HUD_nose_y; + } if ( clip_h > 0) { - GR_AABITMAP_EX(Aburn_bar_gauge.first_frame, current_hud->Aburn_coords[0] + HUD_nose_x, current_hud->Aburn_coords[1] + HUD_nose_y,w,clip_h,0,0); + GR_AABITMAP_EX(Aburn_bar_gauge.first_frame, current_hud->Aburn_coords[0] + nose_offset_x, current_hud->Aburn_coords[1] + nose_offset_y,w,clip_h,0,0); } if ( clip_h <= current_hud->Aburn_size[0] ) { - GR_AABITMAP_EX(Aburn_bar_gauge.first_frame+1, current_hud->Aburn_coords[0] + HUD_nose_x, current_hud->Aburn_coords[1]+clip_h + HUD_nose_y,w,h-clip_h,0,clip_h); + GR_AABITMAP_EX(Aburn_bar_gauge.first_frame+1, current_hud->Aburn_coords[0] + nose_offset_x, current_hud->Aburn_coords[1]+clip_h + nose_offset_y,w,h-clip_h,0,clip_h); } } @@ -4857,6 +4864,7 @@ { int x; bool use_new_gauge = false; + int nose_offset_x = 0, nose_offset_y = 0; // Goober5000 - only check for the new gauge in case of command line + a ballistic-capable ship if (Cmdline_ballistic_gauge && Ship_info[Player_ship->ship_info_index].flags & SIF_BALLISTIC_PRIMARIES) @@ -4871,14 +4879,20 @@ } } + if (current_hud->Aburn_move_flag) + { + nose_offset_x = HUD_nose_x; + nose_offset_y = HUD_nose_y; + } + if(use_new_gauge) { int currentx, currenty; int y; int max_w = 100; float remaining; - currentx = current_hud->Wenergy_coords[0] + 10; - currenty = current_hud->Wenergy_coords[1]; + currentx = current_hud->Wenergy_coords[0] + 10 + nose_offset_x; + currenty = current_hud->Wenergy_coords[1] + nose_offset_y; if(gr_screen.max_w_unscaled == 640) { max_w = 60; } @@ -4980,7 +4994,7 @@ sprintf(buf,XSTR( "%d%%", 326), fl2i(percent_left*100+0.5f)); hud_num_make_mono(buf); // gr_string(Weapon_energy_text_coords[gr_screen.res][0], Weapon_energy_text_coords[gr_screen.res][1], buf); - gr_string(current_hud->Wenergy_text_coords[0] + HUD_nose_x, current_hud->Wenergy_text_coords[1] + HUD_nose_y, buf); + gr_string(current_hud->Wenergy_text_coords[0] + nose_offset_x, current_hud->Wenergy_text_coords[1] + nose_offset_y, buf); } hud_set_gauge_color(HUD_WEAPONS_ENERGY); @@ -5002,11 +5016,11 @@ bm_get_info(Wenergy_bar_gauge.first_frame+2,&w,&h); if ( clip_h > 0 ) { - GR_AABITMAP_EX(Wenergy_bar_gauge.first_frame+2, current_hud->Wenergy_coords[0] + HUD_nose_x, current_hud->Wenergy_coords[1] + HUD_nose_y, w,clip_h,0,0); + GR_AABITMAP_EX(Wenergy_bar_gauge.first_frame+2, current_hud->Wenergy_coords[0] + nose_offset_x, current_hud->Wenergy_coords[1] + nose_offset_y, w,clip_h,0,0); } if ( clip_h <= current_hud->Wenergy_size[0] ) { - GR_AABITMAP_EX(Wenergy_bar_gauge.first_frame+3, current_hud->Wenergy_coords[0] + HUD_nose_x, current_hud->Wenergy_coords[1] + clip_h + HUD_nose_y, w,h-clip_h,0,clip_h); + GR_AABITMAP_EX(Wenergy_bar_gauge.first_frame+3, current_hud->Wenergy_coords[0] + nose_offset_x, current_hud->Wenergy_coords[1] + clip_h + nose_offset_y, w,h-clip_h,0,clip_h); } // hud_set_default_color(); |
|
Fixed/implemented in antipodes |
Date Modified | Username | Field | Change |
---|---|---|---|
2009-12-21 12:31 | KeldorKatarn | New Issue | |
2010-01-17 23:22 | chief1983 | Relationship added | child of 0002071 |
2010-01-21 10:06 | KeldorKatarn | Note Added: 0011548 | |
2010-01-21 10:06 | KeldorKatarn | File Added: custom_gauges_pan_view.patch | |
2010-01-22 08:09 | Swifty | Status | new => assigned |
2010-01-22 08:09 | Swifty | Assigned To | => Swifty |
2010-12-11 04:25 | The_E | Note Added: 0012538 | |
2010-12-11 04:25 | The_E | Status | assigned => resolved |
2010-12-11 04:25 | The_E | Resolution | open => fixed |