Asaf
Sleep Deprived
- Joined
- Mar 22, 2010
- Messages
- 1,326
I'm trying to add a new yield type (specifically 'used food').
This is mainly for display, so the player can see how much of the food on the tile is used and how much is unused.
I think I added it to all the right places:
- CvEnums.h to YieldTypes: I added it last (after a little trial and error) since the yield order is important for the order in the XML's.
- Civ4YieldInfos.xml: I added a new YieldInfo, with updated type, text, and symbol paths.
- Game fonts (both 75 and regular) - added a new (ugly and temporary) icon for the new 'used food' yield.
I also copied the food symbols folder and changed the dds files there so I can see the difference in game, and of course updated the SymbolPath in the new YieldInfo in the xml accordingly.
I forcibly added the new yield to every tile in the code (CvPlot::calculateYield() returns 1 for YIELD_USED_FOOD).
Results:
In the tool tip (which is created in CvGameTextMgr::setPlotHelp) I saw the icons I added to game fonts, but on the tile itself I don't see the new symbols.
It also appeared that changing the original yields' symbol path and/or files had no effect.
So I found Vertical_Symbols.dds which has all 15 symbols (1-5 of each of the 3 yields). Modifying it for the original food yield affected the game graphics. So I was on the right track.
I wanted to add new symbols there. Only problem is, the file is 64x1024, and each symbol takes 64x64 pixels, which leaves room for 1 symbol instead of 5.
I resized the file to 64x2048 (to maintain the power-of-2 dimensions), and added the new (again, ugly and temporary) symbols after the existing ones.
This was the result in game (the food with the X is the new yield):
There are 2 problems here:
1. Apparently the game takes 1/16th of the image for every symbol, so instead a single symbol for 2 food (for example), you see the 2-breads and below it the 3-breads, and of course the size is all wrong.
2. When all 4 yield types should appear, only 3 are displayed. I assume there is a limit somewhere, I just don't know if it's hardcoded in the exe or if I can change it anywhere.
Can anyone think of ways to solve either of these problems?
Thanks.
This is mainly for display, so the player can see how much of the food on the tile is used and how much is unused.
I think I added it to all the right places:
- CvEnums.h to YieldTypes: I added it last (after a little trial and error) since the yield order is important for the order in the XML's.
- Civ4YieldInfos.xml: I added a new YieldInfo, with updated type, text, and symbol paths.
- Game fonts (both 75 and regular) - added a new (ugly and temporary) icon for the new 'used food' yield.
I also copied the food symbols folder and changed the dds files there so I can see the difference in game, and of course updated the SymbolPath in the new YieldInfo in the xml accordingly.
I forcibly added the new yield to every tile in the code (CvPlot::calculateYield() returns 1 for YIELD_USED_FOOD).
Results:
In the tool tip (which is created in CvGameTextMgr::setPlotHelp) I saw the icons I added to game fonts, but on the tile itself I don't see the new symbols.
It also appeared that changing the original yields' symbol path and/or files had no effect.
So I found Vertical_Symbols.dds which has all 15 symbols (1-5 of each of the 3 yields). Modifying it for the original food yield affected the game graphics. So I was on the right track.
I wanted to add new symbols there. Only problem is, the file is 64x1024, and each symbol takes 64x64 pixels, which leaves room for 1 symbol instead of 5.
I resized the file to 64x2048 (to maintain the power-of-2 dimensions), and added the new (again, ugly and temporary) symbols after the existing ones.
This was the result in game (the food with the X is the new yield):
Spoiler :

There are 2 problems here:
1. Apparently the game takes 1/16th of the image for every symbol, so instead a single symbol for 2 food (for example), you see the 2-breads and below it the 3-breads, and of course the size is all wrong.
2. When all 4 yield types should appear, only 3 are displayed. I assume there is a limit somewhere, I just don't know if it's hardcoded in the exe or if I can change it anywhere.
Can anyone think of ways to solve either of these problems?
Thanks.