View Issue Details

IDProjectCategoryView StatusLast Update
0003108FSSCPtablespublic2014-09-26 08:11
ReporterYarn Assigned ToYarn  
PrioritynormalSeveritymajorReproducibilityN/A
Status resolvedResolutionfixed 
Platformx64OSWindows 7 
Product Version3.7.1 
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.

Activities

Yarn

2014-09-25 05:28

developer  

mantis3108.patch (2,344 bytes)   
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 ) {
mantis3108.patch (2,344 bytes)   

niffiwan

2014-09-26 08:11

developer   ~0016303

Fix committed to trunk@11087.

Related Changesets

fs2open: trunk r11087

2014-09-26 04:48

niffiwan


Ported: N/A

Details Diff
Fix mantis 3108 (from Yarn)

Make parsing of DRADIS and custom hud gauges consistent with the rest
of the hud gauges
Affected Issues
0003108
mod - /trunk/fs2_open/code/hud/hudparse.cpp Diff File

Issue History

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