How let Python point to an image in Gamefont_75.dds?

Liambane

Rome's Praetorian
Joined
Aug 14, 2007
Messages
289
Location
West Roman Empire, Italy.
I've the porge leaders attitude Gamefont_75.dds and the main screen mod installed.
In my Gamefont_75.dds there are others icons so the porge's attitude icons aren't showed.

I see that some images in gamefont have names like "unhappy_char", "unhealthy_char", "star_char" but i dunno how and where this name are given (wich file?) and how to give a name to my icons.

How let Python point to an image in Gamefont_75.dds?

if iAtt == 0:
att = unichr(CyGame().getSymbolID(FontSymbols.UNHAPPY_CHAR))
elif iAtt == 1:
att = unichr(CyGame().getSymbolID(FontSymbols.UNHEALTHY_CHAR))
elif iAtt == 2:
att = unichr(CyGame().getSymbolID(FontSymbols.BULLET_CHAR))#unichr(CyGame().getSymbolID(FontSymbols.ANGRY_POP_CHAR))
elif iAtt == 3:
att = unichr(CyGame().getSymbolID(FontSymbols.HAPPY_CHAR))
elif iAtt == 4:
att = unichr(CyGame().getSymbolID(FontSymbols.STAR_CHAR))
else:
att = unichr(CyGame().getSymbolID(FontSymbols.BULLET_CHAR))
szTempBuffer = u" %s" %(att)
szBuffer = szBuffer + szTempBuffer

How let the Python point to the last line of my gamefont75 instead of that "unhealty char" ecc...? :confused: :confused: :confused:

I attach my Gamefont_75 file for let you understand.
 

Attachments

  • GameFont_75.rar
    76.5 KB · Views: 62
Typically you use an existing glyph (symbol) and add an offset. For example, in BUG's font file the first attitude icon is 4 cells past the Power icon (lightning bolt). That entire block of code you posted is replaced with this:

Code:
szTempBuffer = u" %c" % (CyGame().getSymbolID(FontSymbols.POWER_CHAR) + 4 + iAtt)
szBuffer += szTempBuffer

getSymbolID() returns an integer representing the Unicode character needed to display that font glyph. To this you add 4 + <attitude> where <attitude> is iAtt which is 0 to 4.

"%c" is similar to unichr() without creating a temporary string first.

+= means to append one string onto the end of another. "x += y" is the same as "x = x + y" but easier to read.

All of the FontSymbols constants such as POWER_CHAR and HAPPY_CHAR are defined in the SDK. You cannot add new ones in Python and have them work with getSymbolID(). If you wanna see some semi-advanced Python tricks related to them, check out BUG's FontUtil.py module.
 
Thx for replies emperorfool.

Also Editing like you say, no chanche to say porge's file in the mod.
However, the NORMAL faces are shown if I choose them.

I'm so confused. Is like there aren't in Gamefont75_tga!
Pls help me :D

By the way I see that Main Screen Mod interface + Porge's gamefont doesn't work as standalone mod also setting g_iShowAttitude == 2
So Nevermind...
 

Attachments

  • Main Interface + Gamefont_75.rar
    98.4 KB · Views: 50
The Offset method is the only real way you can manage it if you just use python, but if you modify the DLL as well you can assign names to your new icons in the TGA as well.

I am not sure how to specifically access the _75 version (or the normal one, not sure which is used by default as I haven't tested by making them different than each other).
 
AFAIK the large font glyphs are only used on the city bar and in hover text when its shown in the brown background with white top/bottom trim view. Perhaps you can choose the large font glyphs using <font=X>...</font> where X is 1-4 (dunno which will work or if that's even right).

There's no documentation around the font glyphs so you need to experiment.
 
Top Bottom