Need Help with Incorrect Icons showing on City Bar

SeveronSylvana

Chieftain
Joined
Jan 17, 2014
Messages
10
Hello.
I'm having a problem with the correct icons being displayed on the city bar. What it seems to be doing is loading up the icon that is the 6th block to the left of what its supposed to be in the gamefont.tga.
For example. the Power symbol is displaying a Golden Age icon. The Defence icon is being displayed as the Strength icon. Silver Star icon is displying as a bullet icon. etc.

I've added new religions, corporations and resources. All of them load up perfectly fine. Im using Better Bat AI so all the little attitude icons next to a leaders name is loading up fine. All the icons are loading in the right place except on the city bar.

I'm at a loss, if anyone is able to help I'd really appreciate it.
CivScreen1_zps8cb10ed9.png

CivScreen2_zps18df1793.png
 
Did you change the two tga files?

Post them so we can have a look at them. Without seeing them it's difficult to say anything.
 
It looks like 3 or 4 icons are missing their identifier, the cyan dot (lower right part of the partition). I'm talking about the last 3 images on row 12 (banana, ?, diskette). In addition, in the GameFont.tga, the same problem is found with the last image on row 13 (plane).

I used TgaTool2 to open and magnify the image. I attach a bmp image of the GameFont.tga.
 
It looks like 3 or 4 icons are missing their identifier, the cyan dot
Are the identifiers really that important? I have ignored them completely and are missing around half of them and the display still works :confused:

I have had the problem with off-by-one, which affects only the city billboards. The problem was that two slots merged into one big one. Through trial and error I figured out precisely where it happened and copy-pasted working slots into the location in question. The broken slots appeared to have identifiers like they should have.

If you feel like experimenting to figure out precisely where it goes wrong, the billboard strings are added in CvGameTextMgr::buildCityBillboardIconString().
There are lines like
Code:
szBuffer.append(CvWString::format(L" %c", gDLL->getSymbolID(GOLDEN_AGE_CHAR)));
However you can set it to display any slot you want by writing the ID of the slot in question.
Code:
szBuffer.append(CvWString::format(L" %c", 8724));
This will give the same result, at least with my GameFont file. It would appear that the first slot has ID 8483 and 8484 is the one to the right and so on. It should be possible to count to predict the ID of a specific slot, though I prefer to let the game tell me.

Write a loop which adds "X%c" instead of just %c and locate the place where two icons appear without an X between them and you know where you file is broken.

Granted, this might not be trivial to do, but it is the way I came up with to solve problems like this.
 
It looks clear to me from the experience of users that the identifiers (or markers) are needed for Civ4. It was the main source of problem for modding these two files before Asaf released his wonderful tool.
 
I just thought of another possible solution to this problem. Rather than pinpointing the error in GameFont, you can compensate in the DLL. Inside CvGameTextMgr.cpp, there is CvGameTextMgr::buildCityBillboardIconString(). Find all lines appending to szBuffer, like this one:
Code:
szBuffer.append(CvWString::format(L" %c",[COLOR="Red"] gDLL->getSymbolID(GOLDEN_AGE_CHAR)[/COLOR]));
The red part is the interesting one. It will be converted to the ID at runtime, in other words it is just a number. Your problem is that all numbers are one too low compared to how the game reads GameFont.tga. You can add that 1 everywhere and the display goes back to normal.
Code:
szBuffer.append(CvWString::format(L" %c", [COLOR="Blue"]1 +[/COLOR][COLOR="Red"] gDLL->getSymbolID(GOLDEN_AGE_CHAR)[/COLOR]));
This will introduce a bug, which gives you +1 to the slot selection. You will then end up with two bugs, one gives +1 and the other -1 and you will end up with an offset issue of 0.

It goes without saying that it would be best to fix GameFont.tga. If you are unlucky, only some of the icons have the -1 bug meaning adding one to everything will break some other icons. Also the right part of the merged slots can't be added to billboards. Depending on what it is, it may or may not be a problem. Still this solution is worth considering if you can't find the cause of the GameFont.tga bug.
 
Back
Top Bottom