View Issue Details

IDProjectCategoryView StatusLast Update
0001933FSSCPgraphicspublic2009-11-10 03:32
ReporterKeldorKatarn Assigned Toportej05  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformPCOSWindows VistaOS VersionSP 1
Product Version3.6.11 
Fixed in Version3.6.11 
Summary0001933: Custom gauges show up in external view
DescriptionThe title pretty much says it. Custom gauges are not hidden when switching to external view.
TagsNo tags attached.

Activities

portej05

2009-06-04 12:19

reporter   ~0010942

Location: hud.cpp, around line 1900.

The code that draws the standard gauges has
if (!(Viewer_mode & (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY ))){

around it.

What if a custom gauge is intended to be shown in external view?

KeldorKatarn

2009-06-06 13:06

reporter   ~0010952

Well by default they shouldn't.. I mean it's part of the HUD.. why should HUD show up when looking at a ship from the outside (except 3rd person view of course, in which the entire hud remains visible).

If at any point some mod would need such a gauge, then one might want to add an additional option to enable that to hud_gauges.tbl when defining the gauge.
But by default it should behave like the rest of the HUD.

portej05

2009-06-07 08:16

reporter   ~0010954

Can you provide testing data for this?

My gut reaction would be to stick the if statement from my first comment around the code that draws the custom gauges near line 1900 in hud.cpp.
It is the same if statement that protects the normal hud elements from being drawn.

KeldorKatarn

2009-06-07 13:14

reporter   ~0010955

Well... what testing data do you need? Just specify a custom gauge with any visible location and some arbitrary .ani and see if it shows up or not.

2009-06-07 14:05

 

externalcustomgauges.diff (4,357 bytes)   
Index: code/hud/hud.cpp
===================================================================
--- code/hud/hud.cpp	(revision 5327)
+++ code/hud/hud.cpp	(working copy)
@@ -1846,70 +1846,72 @@
 		return;
 	}
 
-	//Custom hud stuff
+	if (!(Viewer_mode & (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY ))) {
+		//Custom hud stuff
 #ifdef NEW_HUD
-	//Player_ship->ship_hud.show();
-	//	int i;
-	//	gauge_data* cg;
-/*	for(i = 0; i < current_hud->num_gauges; i++)
-	{
+		//Player_ship->ship_hud.show();
+		//	int i;
+		//	gauge_data* cg;
+		/*	for(i = 0; i < current_hud->num_gauges; i++)
+		{
 		if(current_hud->gauges[i].type == HG_MAINGAUGE)
 		{
-			current_hud->gauges[i].update(current_hud->owner);
+		current_hud->gauges[i].update(current_hud->owner);
 		}
-	}*/
+		}*/
 #else
-	int i;
-	static bool image_ids_set = false;
-	static hud_frames image_ids[MAX_CUSTOM_HUD_GAUGES];
-	if(!image_ids_set)
-	{
-		for(i = 0; i < Num_custom_gauges; i++)
+		int i;
+		static bool image_ids_set = false;
+		static hud_frames image_ids[MAX_CUSTOM_HUD_GAUGES];
+		if(!image_ids_set)
 		{
-			if(strlen(current_hud->custom_gauge_images[i]))
+			for(i = 0; i < Num_custom_gauges; i++)
 			{
-				image_ids[i].first_frame = bm_load_animation(current_hud->custom_gauge_images[i], &image_ids[i].num_frames);
-				if(image_ids[i].first_frame != -1)
+				if(strlen(current_hud->custom_gauge_images[i]))
 				{
-					bm_page_in_aabitmap( image_ids[i].first_frame, image_ids[i].num_frames );
+					image_ids[i].first_frame = bm_load_animation(current_hud->custom_gauge_images[i], &image_ids[i].num_frames);
+					if(image_ids[i].first_frame != -1)
+					{
+						bm_page_in_aabitmap( image_ids[i].first_frame, image_ids[i].num_frames );
+					}
+					else
+					{
+						image_ids[i].first_frame = bm_load(current_hud->custom_gauge_images[i]);
+					}
 				}
 				else
 				{
-					image_ids[i].first_frame = bm_load(current_hud->custom_gauge_images[i]);
+					image_ids[i].first_frame = -1;
 				}
 			}
-			else
-			{
-				image_ids[i].first_frame = -1;
-			}
+			image_ids_set = true;
 		}
-		image_ids_set = true;
-	}
 
-	//Display the gauges
-	for(i = 0; i < Num_custom_gauges; i++)
-	{
-		if(current_hud->custom_gauge_colors[i].red != 0 || current_hud->custom_gauge_colors[i].green != 0 || current_hud->custom_gauge_colors[i].blue != 0)
+		//Display the gauges
+		for(i = 0; i < Num_custom_gauges; i++)
 		{
-			//No custom alpha gauge color...
-			gr_init_alphacolor(&current_hud->custom_gauge_colors[i], current_hud->custom_gauge_colors[i].red, current_hud->custom_gauge_colors[i].green, current_hud->custom_gauge_colors[i].blue, (HUD_color_alpha+1)*16);
+			if(current_hud->custom_gauge_colors[i].red != 0 || current_hud->custom_gauge_colors[i].green != 0 || current_hud->custom_gauge_colors[i].blue != 0)
+			{
+				//No custom alpha gauge color...
+				gr_init_alphacolor(&current_hud->custom_gauge_colors[i], current_hud->custom_gauge_colors[i].red, current_hud->custom_gauge_colors[i].green, current_hud->custom_gauge_colors[i].blue, (HUD_color_alpha+1)*16);
 
-			gr_set_color_fast(&current_hud->custom_gauge_colors[i]);
+				gr_set_color_fast(&current_hud->custom_gauge_colors[i]);
+			}
+			if(strlen(current_hud->custom_gauge_text[i]))
+			{
+				hud_num_make_mono(current_hud->custom_gauge_text[i]);
+				gr_string(current_hud->custom_gauge_coords[i][0], current_hud->custom_gauge_coords[i][1], current_hud->custom_gauge_text[i]);
+			}
+			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]);
+			}
+
+			//So we're back to normal
+			hud_set_default_color();
 		}
-		if(strlen(current_hud->custom_gauge_text[i]))
-		{
-			hud_num_make_mono(current_hud->custom_gauge_text[i]);
-			gr_string(current_hud->custom_gauge_coords[i][0], current_hud->custom_gauge_coords[i][1], current_hud->custom_gauge_text[i]);
-		}
-		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]);
-		}
-
-		//So we're back to normal
-		hud_set_default_color();
+#endif
 	}
-#endif
 
 	if (!(Viewer_mode & (VM_EXTERNAL | VM_DEAD_VIEW | VM_WARP_CHASE | VM_PADLOCK_ANY )))
 	{
externalcustomgauges.diff (4,357 bytes)   

portej05

2009-06-07 14:06

reporter   ~0010956

Last edited: 2009-06-07 15:56

Patch attached.
Debug build will be posted in Recent Builds forum (http://www.hard-light.net/forums/index.php/topic,63662.0.html).
Please test - I cannot figure out how to reproduce this issue.

KeldorKatarn

2009-06-07 15:50

reporter   ~0010962

Add this to hud_gauges.tbl right before the #Main gauges entry

#Custom Gauges
    $Name: Central
#End

#Main Gauges

$Default: (1024 768)
    $Central: (346 219)
        +Image: central
        +Color: 175 230 175

#End

then add the attached ani to the data/hud folder

that should make this testable

2009-06-07 15:51

 

central.ani (10,444 bytes)

KeldorKatarn

2009-06-07 19:46

reporter   ~0010964

I tested the build and it seems to work, but please thoroughly test this further. The diff is very large and I can't judge from here if there are any unwanted side effects.

portej05

2009-06-08 06:56

reporter   ~0010965

Patch attached.

portej05

2009-06-08 07:11

reporter   ~0010966

Jumped the gun a bit there - patch not accepted yet.

portej05

2009-06-20 07:41

reporter   ~0010983

Fix committed

chief1983

2009-11-10 03:32

administrator   ~0011232

According to the forums, pan view still does not function correctly. Should that be a separate issue or should this be reopened?

Issue History

Date Modified Username Field Change
2009-06-02 07:58 KeldorKatarn New Issue
2009-06-04 12:19 portej05 Note Added: 0010942
2009-06-06 13:06 KeldorKatarn Note Added: 0010952
2009-06-07 08:16 portej05 Note Added: 0010954
2009-06-07 13:14 KeldorKatarn Note Added: 0010955
2009-06-07 14:05 portej05 File Added: externalcustomgauges.diff
2009-06-07 14:06 portej05 Note Added: 0010956
2009-06-07 14:16 portej05 Status new => assigned
2009-06-07 14:16 portej05 Assigned To => portej05
2009-06-07 14:16 portej05 Status assigned => feedback
2009-06-07 15:50 KeldorKatarn Note Added: 0010962
2009-06-07 15:51 KeldorKatarn File Added: central.ani
2009-06-07 15:56 portej05 Note Edited: 0010956
2009-06-07 19:46 KeldorKatarn Note Added: 0010964
2009-06-08 06:56 portej05 Status feedback => resolved
2009-06-08 06:56 portej05 Resolution open => fixed
2009-06-08 06:56 portej05 Note Added: 0010965
2009-06-08 07:11 portej05 Note Added: 0010966
2009-06-08 07:11 portej05 Status resolved => acknowledged
2009-06-20 07:41 portej05 Status acknowledged => resolved
2009-06-20 07:41 portej05 Fixed in Version => 3.6.11
2009-06-20 07:41 portej05 Note Added: 0010983
2009-11-10 03:32 chief1983 Note Added: 0011232