Index: code/hud/hudparse.cpp
===================================================================
--- code/hud/hudparse.cpp	(revision 5836)
+++ code/hud/hudparse.cpp	(working copy)
@@ -170,15 +170,13 @@
 /****************************************************************************************************/
 /* You shouldn't have to modify anything past here to add gauges */
 /****************************************************************************************************/
-//This doesn't belong in parse_lo, it's not really that low.
-static int size_temp[2];
-static float percentage_temp[2];
 int stuff_coords(hud_info* dest_hud, gauge_info* cg, bool required = false)
 {
-	//Speed up calculations
-	static hud_info* factor_for_hud;
-	static float resize_factor[2];
-	float fl_buffer[2];
+	// Speed up calculations
+	float resize_factor[2];
+	float coords_temp[2];
+	float percentage_temp[2];
+	int size_temp[2];
 	bool size_defined = false;
 
 	if(required)
@@ -190,34 +188,26 @@
 		return 0;
 	}
 
-	//stuff_int_list(HUD_INT(dest_hud, i), 2, RAW_INTEGER_TYPE);
-	stuff_float_list(fl_buffer, 2);
-	if(!cg->parent)
-	{
-		factor_for_hud = NULL;
-		resize_factor[0] = 1;
-		resize_factor[1] = 1;
-	}
-	else if(dest_hud != factor_for_hud)
-	{
-		resize_factor[0] = (float)gr_screen.max_w / (float)dest_hud->resolution[0];
-		resize_factor[1] = (float)gr_screen.max_h / (float)dest_hud->resolution[1];
-	}
-	//Resize to current res
-	HUD_INT(dest_hud, cg->coord_dest)[0] = fl2i(fl_buffer[0] * resize_factor[0]);
-	HUD_INT(dest_hud, cg->coord_dest)[1] = fl2i(fl_buffer[1] * resize_factor[1]);
+	stuff_float_list(coords_temp, 2);
+	
+	resize_factor[0] = (float)gr_screen.max_w / (float)dest_hud->resolution[0];
+	resize_factor[1] = (float)gr_screen.max_h / (float)dest_hud->resolution[1];
 
+	// Resize to current screen resolution
+	HUD_INT(dest_hud, cg->coord_dest)[0] = fl2i(coords_temp[0] * resize_factor[0]);
+	HUD_INT(dest_hud, cg->coord_dest)[1] = fl2i(coords_temp[1] * resize_factor[1]);
+
 	if(optional_string("+Size:"))
 	{
 		stuff_int_list(size_temp, 2, RAW_INTEGER_TYPE);
+		
 		if(cg->size_dest)
 		{
-			HUD_INT(dest_hud, cg->size_dest)[0] = size_temp[0];
-			HUD_INT(dest_hud, cg->size_dest)[1] = size_temp[1];
+			HUD_INT(dest_hud, cg->size_dest)[0] = fl2i(size_temp[0] * resize_factor[0]);
+			HUD_INT(dest_hud, cg->size_dest)[1] = fl2i(size_temp[1] * resize_factor[1]);
+			
+			size_defined = true;
 		}
-		
-		//For %
-		size_defined = false;
 	}
 
 	if(optional_string("+Percentage:"))
@@ -226,8 +216,7 @@
 		percentage_temp[0] *= (gr_screen.max_w / 100.0f);
 		percentage_temp[1] *= (gr_screen.max_h / 100.0f);
 
-		//Bool true, size defined
-		if(!size_defined)
+		if(size_defined)
 		{
 			if(percentage_temp[0])
 			{
@@ -238,6 +227,7 @@
 				percentage_temp[1] -= size_temp[1] / 2;
 			}
 		}
+
 		HUD_INT(dest_hud, cg->coord_dest)[0] += fl2i(percentage_temp[0]);
 		HUD_INT(dest_hud, cg->coord_dest)[1] += fl2i(percentage_temp[1]);
 	}
@@ -287,11 +277,12 @@
 
 static void parse_resolution(hud_info* dest_hud)
 {
-	//Parse it
 	gauge_info* cg;
+	
 	for(int i = 0; i < Num_gauge_types; i++)
 	{
 		cg = &gauges[i];
+		
 		if(cg->parent == NULL && strlen(cg->fieldname))
 		{
 			stuff_coords(dest_hud, cg);
@@ -305,6 +296,7 @@
 {
 	char gaugename[NAME_LENGTH];
 	gauge_info *cg, *parent;
+	
 	while(!required_string_4("$Gauge:", "$Default:", "$Resolution:", "#End"))
 	{
 		required_string("$Gauge:");
@@ -392,16 +384,8 @@
 			buffer[1] = gr_screen.max_h;
 		}
 		
-		// In case of a second $Default: declaration (in a tbm or a ship gauge perhaps),
-		// check if it declares the same resolution as before. If not, reload defaults.
-		if(dest_hud->loaded && (buffer[0] != dest_hud->resolution[0]) || (buffer[1] != dest_hud->resolution[1]))
-		{
-			load_hud_defaults(dest_hud);
-		}
-		
 		//Set the resolution
 		memcpy(dest_hud->resolution, buffer, sizeof(buffer));
-		dest_hud->loaded = false;
 		
 		return dest_hud;
 	}
@@ -410,16 +394,10 @@
 		required_string("$Resolution:");
 		stuff_int_list(buffer, 2, RAW_INTEGER_TYPE);
 
-		if ( (buffer[0] == gr_screen.max_w_unscaled) && (buffer[1] == gr_screen.max_h_unscaled) )
+		if ( (buffer[0] == gr_screen.max_w) && (buffer[1] == gr_screen.max_h) )
 		{
-			if(dest_hud->loaded)
-			{
-				load_hud_defaults(dest_hud);
-			}
-			
 			//Set the resolution
 			memcpy(dest_hud->resolution, buffer, sizeof(buffer));
-			dest_hud->loaded = false;
 
 			return dest_hud;
 		}
