Selected Unit Panel / CvMainInterface.py

HumbleSage

Chieftain
Joined
Nov 20, 2009
Messages
20
Location
Michigan, USA
How can I go about widening the selected unit panel (you know.. the lower left window)?

I had a small discussion with Tholish (very helpful guy btw) about making this happen and he directed me here. I would like to do this because when a unit gets a large amount of promotions they seem to cover up the rest of the unit information.

A simple code snippet with line number directions for replacement in my CvMainInterface.py would be great or an updated one for FfH2 Patch J would be even better. I am sure that any of the FfH code gurus can whip this up pretty easily having modified the CvMainInterface.py extensively already.

Your help is greatly appreciated and thanks for the fun mod! :)

P.S. My 1680x1050 viewing screen for gameplay thanks you also. :lol:
 
Wild Mana can be found here http://forums.civfanatics.com/forumdisplay.php?f=366. I am not certain at the moment if you need FFH loaded in order to load wild mana. Download those, install them, and you can load that up really easily.

Another thing that you may want to consider if you haven't done it already is the stacking of promotions. An example of this is how in regular civ, getting the combat or drill promotions will add an icon for each promotion, whereas in FFH, if you get combat or drill, it will only show the highest level of that promotion that the unit has (so if you have combat 3, it won't show combat 1-2).

-Colin
 
Also useful is swapping the order of the display, so that the number is on the left and the title on the right:

25 Strength

instead of:

Strength 25


If I remember correctly, this is the actual panel:

Code:
		# Left Background Widget
		screen.addPanel( "InterfaceLeftBackgroundWidget", u"", u"", True, False, 0, yResolution - 168, 304, 168, PanelStyles.PANEL_STYLE_STANDARD)
		screen.setStyle( "InterfaceLeftBackgroundWidget", "Panel_Game_HudBL_Style" )
		screen.hide( "InterfaceLeftBackgroundWidget" )

This is where the promotions are placed:

Code:
					iPromotionCount = 0
					i = 0
					for i in range(gc.getNumPromotionInfos()):
						if (pHeadSelectedUnit.isHasPromotion(i)):
							szName = "PromotionButton" + str(i)
							self.setPromotionButtonPosition( szName, iPromotionCount )
							screen.moveToFront( szName )
							screen.show( szName )

							iPromotionCount = iPromotionCount + 1

So you would have to modify this to change where they are located when you stretch the panel:

Code:
	def setPromotionButtonPosition( self, szName, iPromotionCount ):
		
		screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
		
		# Find out our resolution
		yResolution = screen.getYResolution()

		if ( CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_SHOW ):
			screen.moveItem( szName, 266 - (24 * (iPromotionCount / 6)), yResolution - 144 + (24 * (iPromotionCount % 6)), -0.3 )
 
xienwolf,

Using your information I was able to narrow down a few things but in regards to your code for the "actual panel" that's from the original CvMainINterface.py BtS file. I did a few text searches in the FfH file using the code bits you gave me to attempt to figure out what to adjust but couldn't locate the panel itself.

What I did find was the line of code to adjust the location of the promotions display and what "magic number" to adjust to move them from the left:

Code:
#FfH: Modified By Kael 07/17/2007
#			screen.moveItem( szName, 266 - (24 * (iPromotionCount / 6)), yResolution - 144 + (24 * (iPromotionCount % 6)), -0.3 )
# HumbleSage Note: This adjusts promotion position on the X axis
			screen.moveItem( szName, 216 - (24 * (iPromotionCount / 6)), yResolution - 144 + (24 * (iPromotionCount % 6)), -0.3 )
# HumbleSage End Note			
#FfH: End Modify

The magic number here is the 216. Changing this moves the promotion icons. I also did some searching and it looks like Kael did some changes to the HUD but I can't figure out what to change for the left panel. The code for the actual panel has been modified like so:

Code:
#FfH: Added by Kael 07/18/2007
#		screen.setPanelSize( "InterfaceCenterBackgroundWidget", 296, yResolution - 133, xResolution - (296*2), 133)
#		screen.setPanelSize( "InterfaceLeftBackgroundWidget", 0, yResolution - 168, 304, 168)
#		screen.setPanelSize( "InterfaceRightBackgroundWidget", xResolution - 304, yResolution - 168, 304, 168)
#		screen.setPanelSize( "MiniMapPanel", xResolution - 214, yResolution - 151, 208, 151)
		iMultiListXR = 332
#FfH: End Add

As you can see the code that you gave me that closes matches this code is basically commented out and Kael uses a variable to do some display work. This is the only location in the file I could match for the code you gave me. I have attempted adjusting this number (bascially that's how I found the magic number for the promotion location) but have been unable to make any visible changes to track down how to change this panel. Getting closer though! :)

Any ideas?

readercolin: Thanks for that info. FfH already does the promotion stacking you speak of already (whew! :lol: I would not want to have to write that)
 
Ah, see now I went out of my way to reference base BtS thinking that was what you were working with :) Yes, our CvMain is VERY different from base BtS.

So this time I am going with the other extreme and referencing my own files in Fall Further since those are what I have open now anyway, and I doubt Kael has changed it much from what I wrote (or that I have changed it from when I gave it to him). Especially since I set it up so that exactly the kind of thing you are asking to do is pretty easily done (though I should have gone further still and made it automatically adjust the elements included within each panel...)

Code:
#Main Panel Behind Unit Stats
HUD_Main_Bottom_Left_Width = 243
HUD_Main_Bottom_Left_Height = 186

Change those, and you change the panel size, the bonus is that it will automatically adjust the other panels to fit properly.
 
xienwolf,

Yes, this is exactly what I was looking for. I only had to adjust 2 variables and one constant (in a loop) to get the view almost perfect. I only have one more thing to slide and I think it's called the stack bar:

StackBar.jpg


(I have also attached the picture just in case the above image ever breaks)

I found a variable that I think adjusts the height of the bar but I just need to find the loop, constant, or var to slide this over. Ideas?

I agree about the automatic window adjustment you mentioned in your post. Something to think about for FfH Patch K :D It just makes more sense to do it that way with all the diverse unit classes and different promotions. You guys have already done an outstanding job on little touches like the mini picture. I couldn't stand how promotions would stack over it and I couldn't use it to center over the unit anymore, but you guys moved it above the selected unit panel and that was a simple and brilliant idea. It's little things like this that make a great mod/game. :)
 

Attachments

  • StackBar.jpg
    StackBar.jpg
    21.9 KB · Views: 35
xienwolf,

There are lost of plotlist items in that file but I think I narrowed it down to this code:

Code:
		# Find out our resolution
		xResolution = screen.getXResolution()
		yResolution = screen.getYResolution()

		self.m_iNumPlotListButtons = (xResolution - (iMultiListXL+iMultiListXR) - 68) / 34

Somehow this formula calculates the position. I have played with the numbers (spent about an hour) but still can't seem to get it to go right, it either goes way left or way right and doesn't pocket up above the center HUD window. This is what I have for the variables:

iMultiListXL = 414 (Original was: 250 but had to adjust to align the center HUD buttons)
iMultiListXR = 236 (Original number, aligns right as it should)

My screen resolution is 1680x1050

I am probably guessing it's because this isn't coming out to a round number but who knows.
 
Those variables are used for the center panel it appears. Since it also determines your number of icons, you'll want to adjust iMultiListXL to be larger by the same value you increased HUD_Main_Bottom_Left_Width.

Code:
		# *********************************************************************************
		# PLOT LIST BUTTONS
		# *********************************************************************************

		for j in range(gc.getMAX_PLOT_LIST_ROWS()):
			yRow = (j - gc.getMAX_PLOT_LIST_ROWS() + 1) * 34

#FfH: Modified by Kael 07/18/2008
#			yPixel = yResolution - 169 + yRow - 3
#			xPixel = 315 - 3
			yPixel = yResolution - 174 + yRow - 3
			xPixel = 249 - 3
#FfH: End Modify

			xWidth = self.numPlotListButtons() * 34 + 3
			yHeight = 32 + 3
		
			szStringPanel = "PlotListPanel" + str(j)
			screen.addPanel(szStringPanel, u"", u"", True, False, xPixel, yPixel, xWidth, yHeight, PanelStyles.PANEL_STYLE_EMPTY)

			for i in range(self.numPlotListButtons()):
				k = j*self.numPlotListButtons()+i
				
				xOffset = i * 34
				
				szString = "PlotListButton" + str(k)
				screen.addCheckBoxGFCAt(szStringPanel, szString, ArtFileMgr.getInterfaceArtInfo("INTERFACE_BUTTONS_GOVERNOR").getPath(), ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(), xOffset + 3, 3, 32, 32, WidgetTypes.WIDGET_PLOT_LIST, k, -1, ButtonStyles.BUTTON_STYLE_LABEL, True )
				screen.hide( szString )
				
				szStringHealth = szString + "Health"
				screen.addStackedBarGFCAt( szStringHealth, szStringPanel, xOffset + 3, 22, 32, 22, InfoBarTypes.NUM_INFOBAR_TYPES, WidgetTypes.WIDGET_GENERAL, k, -1 )
				screen.setHitTest( szStringHealth, HitTestTypes.HITTEST_NOHIT )
				screen.hide( szStringHealth )
				
				szStringIcon = szString + "Icon"
				szFileName = ArtFileMgr.getInterfaceArtInfo("OVERLAY_MOVE").getPath()
				screen.addDDSGFCAt( szStringIcon, szStringPanel, szFileName, xOffset, 0, 12, 12, WidgetTypes.WIDGET_PLOT_LIST, k, -1, False )
				screen.hide( szStringIcon )

This chunk is the important bit for you.
 
xienwolf,

I got it! What I had to do was change this line of code:

xPixel = 249 - 3

to

xPixel = 414 - 3

I had to change this constant to be the same as my iMultiListXL :D:D
 
Back
Top Bottom