2018-06-18 19:29 EDT


View Issue Details Jump to Notes ] Related Changesets ]
IDProjectCategoryView StatusLast Update
0003108FSSCPtablespublic2014-09-26 04:11
ReporterYarn 
Assigned ToYarn 
PrioritynormalSeveritymajorReproducibilityN/A
StatusresolvedResolutionfixed 
Platformx64OSWindows 7OS Version
Product Version3.7.1 
Target VersionFixed in Version 
Summary0003108: Parsing tweaks necessary for custom gauges and the DRADIS radar [patch included]
DescriptionI noticed two issues with custom gauges and the DRADIS radar in hudgauges.tbl:

1: The code that parses the position information for these gauges is outdated; it should be updated to match gauge_load_custom, where Origin and Offset must be used together.
2: The DRADIS radar requires Scale Gauge and Font to start with dollar signs. This differs from the wiki documentation and how all the other gauges are parsed.
Additional InformationI have attached a patch that fixes both issues.
TagsNo tags attached.
Attached Files
  • patch file icon mantis3108.patch (2,344 bytes) 2014-09-25 01:28 -
    Index: code/hud/hudparse.cpp
    ===================================================================
    --- code/hud/hudparse.cpp	(revision 11084)
    +++ code/hud/hudparse.cpp	(working copy)
    @@ -1270,17 +1270,26 @@
     			}
     
     			adjust_base_res(base_res, scale_gauge);
    +			
    +			// If no positioning information is specified, use the default position
    +			bool use_default_pos = true;
     
     			if(optional_string("Origin:")) {
     				stuff_float_list(origin, 2);
    +				use_default_pos = false;
    +
    +				required_string("Offset:");
    +				stuff_int_list(offset, 2);
     			}
     
     			if(optional_string("Offset:")) {
    -				stuff_int_list(offset, 2);
    +				Error(LOCATION, "HUD gauges table: Offset must also have Origin defined");
     			}
     
    -			coords[0] = (int)(base_res[0] * origin[0]) + offset[0];
    -			coords[1] = (int)(base_res[1] * origin[1]) + offset[1];
    +			if (!use_default_pos) {
    +				coords[0] = (int)(base_res[0] * origin[0]) + offset[0];
    +				coords[1] = (int)(base_res[1] * origin[1]) + offset[1];
    +			}
     		}
     
     		if ( optional_string("Cockpit Target:") && ship_idx->at(0) >= 0 ) {
    @@ -2904,22 +2913,31 @@
     		if(optional_string("Position:")) {
     			stuff_int_list(coords, 2);
     		} else {
    -			if (optional_string("$Scale Gauge:")) {
    +			if (optional_string("Scale Gauge:")) {
     				stuff_boolean(&scale_gauge);
     			}
     
     			adjust_base_res(base_res, scale_gauge);
    +			
    +			// If no positioning information is specified, use the default position
    +			bool use_default_pos = true;
     
     			if(optional_string("Origin:")) {
     				stuff_float_list(origin, 2);
    +				use_default_pos = false;
    +
    +				required_string("Offset:");
    +				stuff_int_list(offset, 2);
     			}
     
     			if(optional_string("Offset:")) {
    -				stuff_int_list(offset, 2);
    +				Error(LOCATION, "HUD gauges table: Offset must also have Origin defined");
     			}
     
    -			coords[0] = (int)(base_res[0] * origin[0]) + offset[0];
    -			coords[1] = (int)(base_res[1] * origin[1]) + offset[1];
    +			if (!use_default_pos) {
    +				coords[0] = (int)(base_res[0] * origin[0]) + offset[0];
    +				coords[1] = (int)(base_res[1] * origin[1]) + offset[1];
    +			}
     		}
     	} else {
     		adjust_base_res(base_res, scale_gauge);
    @@ -2928,7 +2946,7 @@
     		coords[1] = (int)(base_res[1] * origin[1]) + offset[1];
     	}
     
    -	if(optional_string("$Font:")) {
    +	if(optional_string("Font:")) {
     		stuff_int(&font_num);
     	} else {
     		if ( hud_font >=0 ) {
    
    patch file icon mantis3108.patch (2,344 bytes) 2014-09-25 01:28 +

-Relationships
+Relationships

-Notes

~0016303

niffiwan (developer)

Fix committed to trunk@11087.
+Notes

+Related Changesets

-Issue History
Date Modified Username Field Change
2014-09-25 01:28 Yarn New Issue
2014-09-25 01:28 Yarn Status new => assigned
2014-09-25 01:28 Yarn Assigned To => Yarn
2014-09-25 01:28 Yarn File Added: mantis3108.patch
2014-09-25 01:29 Yarn Status assigned => code review
2014-09-26 04:11 niffiwan Changeset attached => fs2open trunk r11087
2014-09-26 04:11 niffiwan Note Added: 0016303
2014-09-26 04:11 niffiwan Status code review => resolved
2014-09-26 04:11 niffiwan Resolution open => fixed
+Issue History