View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002419 | FSSCP | HUD | public | 2011-03-21 22:53 | 2012-06-25 01:09 |
Reporter | Kolgena | Assigned To | niffiwan | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | Antipodes 8 | ||||
Target Version | 3.6.14 | Fixed in Version | 3.6.14 | ||
Summary | 0002419: ETS gauges do not rearrange themselves as per retail behavior when fighters do not have shields. | ||||
Description | In subspace missions or early FSPort missions, fighters lack shields, and therefore their Shields ETS gauge. Before the HUD code was used, the two gauges would be moved closer together to fill the gap that the Shield gauge left behind. Now, the two gauges stay where the table has specified them to be. | ||||
Tags | No tags attached. | ||||
|
Given that each ETS gauge is treated separately, this is not easily fixable. |
|
So, no way to restore retail behavior? Maybe have a check for whether a shield gauge needs rendering, and assign alternate coordinates to the other two gauges to be used when the shield gauge is absent? Not sure how feasible that would be though. How did retail do it? |
|
Retail treated the ETS gauge as one unit. Doing the same thing in the new system would require a redesign of the ETS gauge as it is right now, which is something I am not exactly looking forward to. |
|
What's going to have to happen is that I'm going to have to create a HUD gauge type that represents the ETS gauges as a monolithic whole while still keeping the micro ETS gauges in case modders still want to move them around separately. |
|
Any progress on this? |
|
Bump for 3.6.14 |
|
Hud_Gauges.tbl.txt (2,391 bytes)
#Gauge Config $Base: (1440, 900) $Required Aspect: Wide Screen ; Can be "Wide Screen" or "Full Screen" ATM $Min: (1280, 720) ; These Min and Max fields are Inclusive $Max: (1920, 1080) $Gauges: +Messages: Position: (7, 6) +Training Messages: Position: (533, 146) +Multiplayer Messages: Position: (11, 281) +Support: Position: (645, 625) +Damage: Position: (619, 71) +Wingman Status: Position: (1311, 169) +Auto Speed: Position: (1350, 788) +Auto Target: Position: (1350, 759) +Countermeasures: Position: (1238, 705) +Talking Head: Position: (7, 66) +Directives: Position: (7, 326) +Weapons: Position: (1238, 615) +Objective Notify: Position: (613, 216) +Squad Message: Position: (1163, 6) +Escort View: Position: (1238, 326) ;+ETS Weapons: ; Position: (1238, 759) ;+ETS Shields: ; Position: (1257, 759) ;+ETS Engines: ; Position: (1276, 759) +ETS Retail: Position: (1238, 759) +Target Monitor: Position: (7, 691) +Extra Target Data: Position: (7, 647) +Target Shields: Position: (503, 785) +Radar: Position: (617, 691) +Player Shields: Position: (827, 785) ; If you want different types of radar running, be my guest ;+Radar Orb: ; Position: (615, 691) +Afterburner Energy: Position: (428, 439) +Weapon Energy: Position: (924, 439) +Text Warnings: Position: (720, 322) +Center Reticle: Position: (700, 438) +Mini Target Shields: Position: (705, 552) +Throttle: Position: (490, 317) +Threat Indicator: Position: (847, 317) +Voice Status: position: (7, 193) +Ping: Position: (1260, 6) +Lag: Position: (881, 620) +Supernova: Position: (239, 199) +Target Brackets: ; Target Brackets, Lock Indicator, Lead Indicator, and Offscreen Indicator don't need a "Position:" field. +Lead Indicator: +Lock Indicator: +Offscreen Indicator: +Hostile Triangle: Position: (720, 450) +Target Triangle: Position: (720, 450) +Missile Triangles: Position: (720, 450) +Orientation Tee: Position: (720, 450) +Mission Time: Position: (1363, 839) +Kills: Position: (1238, 731) ; FS1 specific gauge ;+Weapon Linking: ; Position: (841, 453) ; Komet's lead sight. Looks for "leadsight.ani" ;+Lead Sight: default $End Gauges #End |
|
mv_root-hdg.tbm.txt (2,103 bytes)
$Load Retail Configuration: NO $Max directives: 8 $Max escort ships: 8 $Reticle Style: FS1 #Gauge Config $Base: (1440,900) $Min: (1024,768) $Max: (1920,1200) $Gauges: +Messages: Position: (5,5) +Training Messages: Position: (587,191) +Multiplayer Messages: Position: (216,306) +Support: Position: (667,600) +Damage: Position: (648,127) +Wingman Status: Position: (1348,210) +Auto Speed: Position: (1376,804) +Auto Target: Position: (1376,780) +Countermeasures: Position: (1296,734) +Talking Head: Position: (5,59) +Directives: Position: (5,344) +Weapons: Position: (1296,657) +Objective Notify: Position: (644,316) +Squad Message: Position: (1243,5) +Escort View: Position: (1281,462) +ETS Retail: Position: (1296,780) ;+ETS Weapons: ; Position: (1296,780) ;+ETS Shields: ; Position: (1314,780) ;+ETS Engines: ; Position: (1332,780) +Target Monitor: Position: (5,722) +Extra Target Data: Position: (5,684) +Target Shields: Position: (458,802) +Radar: Position: (619,722) +Player Shields: Position: (884,802) +Afterburner Energy: Position: (482,490) +Weapon Energy: Position: (874,490) +Text Warnings: Position: (720,341) +Center Reticle: Position: (701,442) +Mini Target Shields: Position: (705,536) +Throttle: Position: (555,456) +Threat Indicator: Position: (594,285) +Voice Status: Position: (5,231) +Ping: Position: (1104,5) +Lag: Position: (835,595) +Supernova: Position: (170,179) +Hostile Triangle: Position: (720,450) +Target Triangle: Position: (720,450) +Missile Triangles: Position: (720,450) +Orientation Tee: Position: (720,450) +Target Brackets: +Lead Indicator: +Lock Indicator: +Offscreen Indicator: Position: (720,450) +Mission Time: Position: (1385,848) +Kills: Position: (1296,756) +Weapon Linking: Position: (806,453) $End Gauges #End |
|
The attached patch creates a new hud gauge which behaves like the retail gauge, i.e. it re-arranges itself when any system (weapons/shields/engines) is missing. Otherwise it's pretty much identical to the existing ETS gauges. Parsing is the same as for the existing ETS gauges, except for one additional parameter which can be specified, the offset (in pixels) between each gauge. e.g. +ETS Retail: Gauge Offset: 30 The other two files are hud gauge layouts for testing - both have had .txt appended to the end so that mantis accepts them as attachments, remove the .txt extension before using the files. Hud_Gauges.tbl is for FS2 mv_root-hdg.tbm is for FSPORT |
|
mantis2419.patch (13,562 bytes)
Index: fs2_open/code/hud/hudets.cpp =================================================================== --- fs2_open/code/hud/hudets.cpp (revision 8816) +++ fs2_open/code/hud/hudets.cpp (working copy) @@ -713,13 +713,13 @@ void HudGaugeEts::pageIn() bm_page_in_aabitmap( Ets_bar.first_frame, Ets_bar.num_frames ); } +/** + * Draw one ETS bar to screen + */ void HudGaugeEts::blitGauge(int index) { int y_start, y_end, clip_h, w, h, x, y; - // draw the letters for the gauges first, before any clipping occurs - renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter); - clip_h = fl2i( (1 - Energy_levels[index]) * ETS_bar_h ); bm_get_info(Ets_bar.first_frame,&w,&h); @@ -772,6 +772,97 @@ void HudGaugeEts::blitGauge(int index) } } +/** + * Default ctor for retail ETS gauge + * 2nd arg (0) is not used + */ +HudGaugeEtsRetail::HudGaugeEtsRetail(): +HudGaugeEts(HUD_OBJECT_ETS_RETAIL, 0) +{ +} + +/** + * Render the ETS retail gauge to the screen (weapon+shield+engine) + */ +void HudGaugeEtsRetail::render(float frametime) +{ + int i; + int initial_position; + + ship* ship_p = &Ships[Player_obj->instance]; + + if ( Ets_bar.first_frame < 0 ) { + return; + } + + // if at least two gauges are not shown, don't show any + i = 0; + if (!ship_has_energy_weapons(ship_p)) i++; + if (Player_obj->flags & OF_NO_SHIELDS) i++; + if (!ship_has_engine_power(ship_p)) i++; + if (i >= 2) return; + + setGaugeColor(); + + // draw the letters for the gauges first, before any clipping occurs + // skip letter for any missing gauges (max one, see check above) + initial_position = 0; + if (ship_has_energy_weapons(ship_p)) { + Letter = Letters[0]; + position[0] = Gauge_positions[initial_position++]; + renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter); + } + if (!(Player_obj->flags & OF_NO_SHIELDS)) { + Letter = Letters[1]; + position[0] = Gauge_positions[initial_position++]; + renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter); + } + if (ship_has_engine_power(ship_p)) { + Letter = Letters[2]; + position[0] = Gauge_positions[initial_position++]; + renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter); + } + + // draw gauges, skipping any gauge that is missing + initial_position = 0; + if (ship_has_energy_weapons(ship_p)) { + Letter = Letters[0]; + position[0] = Gauge_positions[initial_position++]; + blitGauge(ship_p->weapon_recharge_index); + } + if (!(Player_obj->flags & OF_NO_SHIELDS)) { + Letter = Letters[1]; + position[0] = Gauge_positions[initial_position++]; + blitGauge(ship_p->shield_recharge_index); + } + if (ship_has_engine_power(ship_p)) { + Letter = Letters[2]; + position[0] = Gauge_positions[initial_position++]; + blitGauge(ship_p->engine_recharge_index); + } +} + +/** + * Set ETS letters for retail ETS gauge + * Allows for different languages to be used in the hud + */ +void HudGaugeEtsRetail::initLetters(char *_letters) +{ + int i; + for ( i = 0; i < num_retail_ets_gauges; ++i) + Letters[i] = _letters[i]; +} + +/** + * Set the three possible positions for ETS bars + */ +void HudGaugeEtsRetail::initGaugePositions(int *_gauge_positions) +{ + int i; + for ( i = 0; i < num_retail_ets_gauges; ++i) + Gauge_positions[i] = _gauge_positions[i]; +} + HudGaugeEtsWeapons::HudGaugeEtsWeapons(): HudGaugeEts(HUD_OBJECT_ETS_WEAPONS, (int)WEAPONS) { @@ -794,7 +885,7 @@ void HudGaugeEtsWeapons::render(float frametime) if (!ship_has_engine_power(ship_p)) i++; if (i >= 2) return; - // now actually check if this + // no weapon energy, no weapon gauge if (!ship_has_energy_weapons(ship_p)) { return; @@ -802,6 +893,9 @@ void HudGaugeEtsWeapons::render(float frametime) setGaugeColor(); + // draw the letters for the gauge first, before any clipping occurs + renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter); + // draw the gauges for the weapon system blitGauge(ship_p->weapon_recharge_index); } @@ -828,14 +922,17 @@ void HudGaugeEtsShields::render(float frametime) if (!ship_has_engine_power(ship_p)) i++; if (i >= 2) return; - setGaugeColor(); - - // draw the letters for the gauges first, before any clipping occurs + // no shields, no shields gauge if (Player_obj->flags & OF_NO_SHIELDS) { return; } - // draw the gauges for the weapon system + setGaugeColor(); + + // draw the letters for the gauge first, before any clipping occurs + renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter); + + // draw the gauge for the shield system blitGauge(ship_p->shield_recharge_index); } @@ -861,13 +958,16 @@ void HudGaugeEtsEngines::render(float frametime) if (!ship_has_engine_power(ship_p)) i++; if (i >= 2) return; - setGaugeColor(); - - // draw the letters for the gauges first, before any clipping occurs + // no engines, no engine gauge if (!ship_has_engine_power(ship_p)) { return; } - // draw the gauges for the weapon system + setGaugeColor(); + + // draw the letters for the gauge first, before any clipping occurs + renderPrintf(position[0] + Letter_offsets[0], position[1] + Letter_offsets[1], NOX("%c"), Letter); + + // draw the gauge for the engine system blitGauge(ship_p->engine_recharge_index); } Index: fs2_open/code/hud/hudets.h =================================================================== --- fs2_open/code/hud/hudets.h (revision 8816) +++ fs2_open/code/hud/hudets.h (working copy) @@ -18,6 +18,8 @@ struct object; #define ETS_RECHARGE_RATE 4.0f // Recharge this percent of total shields/second +const int num_retail_ets_gauges = 3; + extern float Energy_levels[]; extern int Weapon_energy_cheat; @@ -81,4 +83,16 @@ public: void render(float frametime); }; +class HudGaugeEtsRetail: public HudGaugeEts +{ +protected: + char Letters[num_retail_ets_gauges]; + int Gauge_positions[num_retail_ets_gauges]; +public: + HudGaugeEtsRetail(); + void render(float frametime); + void initLetters(char *_letters); + void initGaugePositions(int *_gauge_positions); +}; + #endif Index: fs2_open/code/hud/hudparse.cpp =================================================================== --- fs2_open/code/hud/hudparse.cpp (revision 8816) +++ fs2_open/code/hud/hudparse.cpp (working copy) @@ -49,7 +49,7 @@ bool Hud_retail = true; int Hud_font = -1; //WARNING: If you add gauges to this array, make sure to bump num_default_gauges! -int num_default_gauges = 44; +int num_default_gauges = 42; static int retail_gauges[] = { HUD_OBJECT_MESSAGES, HUD_OBJECT_TRAINING_MESSAGES, @@ -70,9 +70,6 @@ static int retail_gauges[] = { HUD_OBJECT_TARGET_SHIELD, HUD_OBJECT_ESCORT, HUD_OBJECT_MISSION_TIME, - HUD_OBJECT_ETS_WEAPONS, - HUD_OBJECT_ETS_SHIELDS, - HUD_OBJECT_ETS_ENGINES, HUD_OBJECT_TARGET_MONITOR, HUD_OBJECT_EXTRA_TARGET_DATA, HUD_OBJECT_AFTERBURNER, @@ -94,7 +91,8 @@ static int retail_gauges[] = { HUD_OBJECT_TARGET_TRI, HUD_OBJECT_MISSILE_TRI, HUD_OBJECT_KILLS, - HUD_OBJECT_FIXED_MESSAGES + HUD_OBJECT_FIXED_MESSAGES, + HUD_OBJECT_ETS_RETAIL }; flag_def_list Hud_gauge_types[] = { @@ -146,7 +144,8 @@ flag_def_list Hud_gauge_types[] = { { "Target direction", HUD_OBJECT_TARGET_TRI, 0}, { "Missile indicator", HUD_OBJECT_MISSILE_TRI, 0}, { "Kills", HUD_OBJECT_KILLS, 0}, - { "Fixed messages", HUD_OBJECT_FIXED_MESSAGES, 0} + { "Fixed messages", HUD_OBJECT_FIXED_MESSAGES, 0}, + { "Ets retail", HUD_OBJECT_ETS_RETAIL, 0} }; int Num_hud_gauge_types = sizeof(Hud_gauge_types)/sizeof(flag_def_list); @@ -446,6 +445,7 @@ void load_missing_retail_gauges() for(int j = 0; j < num_loaded_gauges; j++) { if(retail_gauges[i] == default_hud_gauges[j]->getObjectType()) { retail_gauge_loaded = true; + break; } } @@ -707,6 +707,9 @@ int parse_gauge_type() if(optional_string("+ETS Engines:")) return HUD_OBJECT_ETS_ENGINES; + if(optional_string("+ETS Retail:")) + return HUD_OBJECT_ETS_RETAIL; + if(optional_string("+Target Monitor:")) return HUD_OBJECT_TARGET_MONITOR; @@ -868,6 +871,9 @@ void load_gauge(int gauge, int base_w, int base_h, int font, int ship_idx, color case HUD_OBJECT_ETS_ENGINES: load_gauge_ets_engines(base_w, base_h, font, ship_idx, use_clr); break; + case HUD_OBJECT_ETS_RETAIL: + load_gauge_ets_retail(base_w, base_h, font, ship_idx, use_clr); + break; case HUD_OBJECT_TARGET_MONITOR: load_gauge_target_monitor(base_w, base_h, font, ship_idx, use_clr); break; @@ -2312,6 +2318,139 @@ void load_gauge_throttle(int base_w, int base_h, int font, int ship_index, color } } +/** + * Load retail style ETS gauge + * i.e. treats weapons, shields & engines gauges as a single gauge + */ +void load_gauge_ets_retail(int base_w, int base_h, int hud_font, int ship_index, color *use_clr) +{ + int coords[2]; + int base_res[2]; + int bar_h; + int letter_offsets[2]; + int top_offsets[2]; + int bottom_offsets[2]; + char ets_letters[num_retail_ets_gauges]; + char fname[MAX_FILENAME_LEN] = "energy1"; + bool slew = false; + int font_num = FONT1; + int colors[3] = {255, 255, 255}; + bool lock_color = false; + int gauge_offset; // distance between micro gauges + int i; + int gauge_positions[num_retail_ets_gauges]; + + if (Lcl_gr) { + ets_letters[0] = 'G'; ets_letters[1] = 'S'; ets_letters[2] = 'A'; // German + } else if (Lcl_fr) { + ets_letters[0] = 'C'; ets_letters[1] = 'B'; ets_letters[2] = 'M'; // French + } else { + ets_letters[0] = 'G'; ets_letters[1] = 'S'; ets_letters[2] = 'E'; // English + } + + // default values which may be overwritten by .tbl + if(gr_screen.res == GR_640) { + coords[0] = 523; + coords[1] = 380; + + base_res[0] = 640; + base_res[1] = 480; + } else { + coords[0] = 880; + coords[1] = 648; + + base_res[0] = 1024; + base_res[1] = 768; + } + bar_h = 41; + letter_offsets[0] = 2; + letter_offsets[1] = 42; + top_offsets[0] = 0; + top_offsets[1] = 0; + bottom_offsets[0] = 0; + bottom_offsets[1] = 50; + gauge_offset = 20; + + // parse data from .tbl + if(check_base_res(base_w, base_h)) { + base_res[0] = base_w; + base_res[1] = base_h; + + if(optional_string("Position:")) { + stuff_int_list(coords, 2); + } + } + + if ( use_clr != NULL ) { + colors[0] = use_clr->red; + colors[1] = use_clr->green; + colors[2] = use_clr->blue; + + lock_color = true; + } else if ( optional_string("Color:") ) { + stuff_int_list(colors, 3); + + check_color(colors); + + lock_color = true; + } + + if ( optional_string("Font:") ) { + stuff_int(&font_num); + } else { + if ( hud_font >=0 ) { + font_num = hud_font; + } + } + if(optional_string("Slew:")) { + stuff_boolean(&slew); + } + if(optional_string("Filename:")) { + stuff_string(fname, F_NAME, MAX_FILENAME_LEN); + } + if(optional_string("Foreground Clip Height:")) { + stuff_int(&bar_h); + } + if(optional_string("Letter Offsets:")) { + stuff_int_list(letter_offsets, 2); + } + if(optional_string("Top Offsets:")) { + stuff_int_list(top_offsets, 2); + } + if(optional_string("Bottom Offsets:")) { + stuff_int_list(bottom_offsets, 2); + } + if(optional_string("Gauge Offset:")) { + stuff_int(&gauge_offset); + } + + // calculate offsets for the three gauges + for (i = 0; i < num_retail_ets_gauges; ++i) + gauge_positions[i] = coords[0] + gauge_offset * i; + + HudGaugeEtsRetail* hud_gauge = new HudGaugeEtsRetail(); + + hud_gauge->initPosition(coords[0], coords[1]); + hud_gauge->initLetters(ets_letters); + hud_gauge->initBaseResolution(base_res[0], base_res[1]); + hud_gauge->initLetterOffsets(letter_offsets[0], letter_offsets[1]); + hud_gauge->initTopOffsets(top_offsets[0], top_offsets[1]); + hud_gauge->initBottomOffsets(bottom_offsets[0], bottom_offsets[1]); + hud_gauge->initBarHeight(bar_h); + hud_gauge->initBitmaps(fname); + hud_gauge->initSlew(slew); + hud_gauge->initFont(font_num); + hud_gauge->updateColor(colors[0], colors[1], colors[2]); + hud_gauge->lockConfigColor(lock_color); + hud_gauge->initGaugePositions(gauge_positions); + + if(ship_index >= 0) { + Ship_info[ship_index].hud_gauges.push_back(hud_gauge); + } else { + default_hud_gauges.push_back(hud_gauge); + } +} + void load_gauge_ets_weapons(int base_w, int base_h, int font, int ship_index, color *use_clr) { int coords[2]; @@ -6249,4 +6388,4 @@ void load_gauge_kills(int base_w, int base_h, int font, int ship_index, color *u } else { default_hud_gauges.push_back(hud_gauge); } -} \ No newline at end of file +} Index: fs2_open/code/hud/hudparse.h =================================================================== --- fs2_open/code/hud/hudparse.h (revision 8816) +++ fs2_open/code/hud/hudparse.h (working copy) @@ -29,7 +29,7 @@ void init_hud(); void load_missing_retail_gauges(); void check_color(int *color); -#define NUM_HUD_OBJECT_ENTRIES 54 +#define NUM_HUD_OBJECT_ENTRIES 54 // not used anywhere? int parse_gauge_type(); void load_gauge(int gauge, int base_w = -1, int base_h = -1, int font = -1, int ship_idx = -1, color *use_clr = NULL); @@ -183,4 +183,7 @@ void load_gauge_kills(int base_w, int base_h, int font, int ship_idx = -1, color #define HUD_OBJECT_FIXED_MESSAGES 49 void load_gauge_fixed_messages(int base_w, int base_h, int font, int ship_idx = -1, color *use_clr = NULL); +#define HUD_OBJECT_ETS_RETAIL 50 +void load_gauge_ets_retail(int base_w, int base_h, int hud_font, int ship_idx = -1, color *use_clr = NULL); + #endif // _HUDPARSE_H |
|
Reviewed by The_E here: http://www.hard-light.net/forums/index.php?topic=78956.msg1611804#msg1611804 |
|
Fixed in r8830 |
Date Modified | Username | Field | Change |
---|---|---|---|
2011-03-21 22:53 | Kolgena | New Issue | |
2011-03-25 15:10 | The_E | Note Added: 0012641 | |
2011-03-25 15:34 | Kolgena | Note Added: 0012642 | |
2011-03-31 17:18 | chief1983 | Target Version | => 3.6.14 |
2011-04-06 09:22 | The_E | Note Added: 0012652 | |
2011-06-22 06:24 | Swifty | Status | new => assigned |
2011-06-22 06:24 | Swifty | Assigned To | => Swifty |
2011-06-22 06:26 | Swifty | Note Added: 0012722 | |
2012-02-09 06:51 | Goober5000 | Note Added: 0013264 | |
2012-05-20 19:41 | Goober5000 | Note Added: 0013578 | |
2012-05-21 09:19 | niffiwan | Assigned To | Swifty => niffiwan |
2012-05-27 10:18 | niffiwan | File Added: mantis2419.patch | |
2012-05-27 10:20 | niffiwan | File Added: Hud_Gauges.tbl.txt | |
2012-05-27 10:20 | niffiwan | File Added: mv_root-hdg.tbm.txt | |
2012-05-27 10:25 | niffiwan | Note Added: 0013612 | |
2012-05-27 10:25 | niffiwan | Status | assigned => code review |
2012-05-27 10:29 | niffiwan | File Deleted: mantis2419.patch | |
2012-05-27 10:35 | niffiwan | File Added: mantis2419.patch | |
2012-05-28 08:10 | niffiwan | Note Added: 0013616 | |
2012-05-28 09:29 | niffiwan | Note Added: 0013617 | |
2012-05-28 09:29 | niffiwan | Status | code review => resolved |
2012-05-28 09:29 | niffiwan | Fixed in Version | => 3.6.14 |
2012-05-28 09:29 | niffiwan | Resolution | open => fixed |
2012-06-25 01:09 | niffiwan | Relationship added | related to 0002672 |