2019-12-15 21:32 EST


View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0001933FSSCPgraphicspublic2009-11-09 22:32
ReporterKeldorKatarn 
Assigned Toportej05 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformPCOSWindows VistaOS VersionSP 1
Product Version3.6.11 
Target VersionFixed 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.
Attached Files
  • diff file icon externalcustomgauges.diff (4,357 bytes) 2009-06-07 10:05 -
    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 )))
     	{
    
    diff file icon externalcustomgauges.diff (4,357 bytes) 2009-06-07 10:05 +
  • ? file icon central.ani (10,444 bytes) 2009-06-07 11:51

-Relationships
+Relationships

-Notes

~0010942

portej05 (reporter)

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?

~0010952

KeldorKatarn (reporter)

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.

~0010954

portej05 (reporter)

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.

~0010955

KeldorKatarn (reporter)

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.

~0010956

portej05 (reporter)

Last edited: 2009-06-07 11: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.

~0010962

KeldorKatarn (reporter)

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

~0010964

KeldorKatarn (reporter)

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.

~0010965

portej05 (reporter)

Patch attached.

~0010966

portej05 (reporter)

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

~0010983

portej05 (reporter)

Fix committed

~0011232

chief1983 (administrator)

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

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