PDA

View Full Version : Kotor font color?


SithRevan
09-28-2006, 12:45 PM
Hey I was just wondering in K1 and K2 what controls the font color? This has been puzzling me for quite some time, so if you guys could help me out with figuring it out I would really appreciate it. Thanks guys!:D

Agent Xim
09-28-2006, 01:06 PM
K1 - I remember seeing an image in Kotor Tool that included the Font...

Look in ERFs->TexturePacks->swpc_tex_gui.erf->D
dialogfont32x32.tpc

Never tried it, but interesting :)

stoffe
09-28-2006, 01:10 PM
Hey I was just wondering in K1 and K2 what controls the font color? This has been puzzling me for quite some time, so if you guys could help me out with figuring it out I would really appreciate it. Thanks guys!:D
I would assume it's set in the COLOR fields under each TEXT struct in the .GUI files. If that is the case it would depend on what text you want to change the color of where you'd have to change it. You'd have to find the GUI file handling the text you want to change.

You'll have to use k-gff to see or modify the COLOR field though since they are of the Vector field type introduced with KotOR that older NWN GFF-editors cannot handle. The color information seems to be kept in RGB format On a scale from 0.0 -> 1.0.


K1 - I remember seeing an image in Kotor Tool that included the Font...
Look in ERFs->TexturePacks->swpc_tex_gui.erf->D
dialogfont32x32.tpc

The Font images seem to mostly be made up of an alphachannel mask though and not any color information. The game engine fills in the color itself.

SithRevan
09-29-2006, 12:40 AM
I would assume it's set in the COLOR fields under each TEXT struct in the .GUI files. If that is the case it would depend on what text you want to change the color of where you'd have to change it. You'd have to find the GUI file handling the text you want to change.

You'll have to use k-gff to see or modify the COLOR field though since they are of the Vector field type introduced with KotOR that older NWN GFF-editors cannot handle. The color information seems to be kept in RGB format On a scale from 0.0 -> 1.0.


The Font images seem to mostly be made up of an alphachannel mask though and not any color information. The game engine fills in the color itself.

How exactly would I be able to define those colors? Most image editors put the RGB values in hex not decimal like these are. Here is an example of what I am asking:

This is what the image editor will give me:
#FFFFFF or #000000

This is what I need to change the color of the font in the game:
0.0509803928434849

So how do I get that value?

Kaspian
09-29-2006, 03:39 AM
If my memory isn't so leaky it should be like this:

#000000 - black - 0 (0 in decimal)
#FFFFFF - white - 1 (16777215 in decimal)

To get the number you want, convert hexadecimal value of selected color to decimal and divide it by 16777215. I think you can round the result but I'm not sure how much.

Example: #FF0000 -> 16711680/16777215 = 0,996093809371817670572857294849 -> 0,9961

I am using windows calulator in scientific mode. I would test pure blue (0000FF) in game. If font's color would be red, then you need BGR instead of RGB (just swap the values like #ABCDEF -> #EFCDAB before converting to decimal).

SithRevan
09-29-2006, 04:21 AM
Thanks Kaspian, it worked. I owe you one!:D

Darkkender
09-29-2006, 11:53 AM
Didn't you create a small utility that did this Kaspian?

Kaspian
09-29-2006, 12:44 PM
Yes Darkkender, but it just converts RGB or hex to BGR and backwards. I can add a feature to convert color to 0-1 range if you think it could come handy.

Darkkender
09-29-2006, 03:54 PM
Yes it would.

Kaspian
09-30-2006, 06:21 PM
Thanks Kaspian, it worked. I owe you one!:D I am finally at my home PC now. I looked into galaxymap.gui - the value you have to edit to change text's color is vector. 3 entries - Red, Green and Blue in range from 0 to 1 (using K-GFF). RGB channel is mostly defined in 0-255 range. Divide each channel's value by 255 to get your number.

LightSky Blue (#87CEFA)
R: 135 / 255 = 0,52941176470588235294117647058824
G: 206 / 255 = 0,8078431372549019607843137254902
B: 250 / 255 = 0,98039215686274509803921568627451

I thought you need all channels in one number :)

Agent Xim
09-30-2006, 07:19 PM
The Font images seem to mostly be made up of an alphachannel mask though and not any color information. The game engine fills in the color itself.

So, would that mean modifying dialogfont32x32.tpc could change the font look in the game? (I imagine it would be a rather tedious job!)

SithRevan
09-30-2006, 09:00 PM
Yes actaully I have already tried chaging some of the front in the game to custom fonts that I have on my computer and I have to say it is pretty hard to do. But when you complete it and the fonts actaully work in the game it becomes worth it!:D