RevDCM Specific Code Proposals

Two Comments with Existing RevDCM code:

First, in CvInfos, Takbel caught an issue with one of your Loops in the copy non defaults. It doesn't cause apparent harm, but will cause havoc when you use Modules:

for ( int iCivic = 0; i < GC.getNumCivicInfos(); iCivic++)

The i < GC.getNumCivicInfos() should be iCivic. I don't know why the compiler even compiles it, but there you have it.

The second issue is a RoM Specific bug, due to WoC's larger gamefont's. Since Zappara doesn't want to make SDK changes, I'm sure he would appreciate this fix. Specifically, WoC's larger gamefonts go bad after you add a certain number of resources. Going past this arbitrary limit destroys the in game symbols. Since the Gamefonts for Revolutions and LoR are different, their specific fixes will be different. Therefore, I would love it if you added a new global defines "IS_RISE_OF_MANKIND" and then you could turn off this fix for your mods (or fix it yourself, if need be.)

Okay, the specific code is in CvGameTextMgr, right in the bolded spot:

Code:
void CvGameTextMgr::assignFontIds(int iFirstSymbolCode, int iPadAmount)
{
	int iCurSymbolID = iFirstSymbolCode;

	// set yield symbols
	for (int i = 0; i < NUM_YIELD_TYPES; i++)
	{
		GC.getYieldInfo((YieldTypes) i).setChar(iCurSymbolID);  
		++iCurSymbolID;
	}

	do 
	{
		++iCurSymbolID;
	} while (iCurSymbolID % iPadAmount != 0);

	// set commerce symbols
	for (i=0;i<GC.getNUM_COMMERCE_TYPES();i++)
	{
		GC.getCommerceInfo((CommerceTypes) i).setChar(iCurSymbolID);  
		++iCurSymbolID;
	}

	do 
	{
		++iCurSymbolID;
	} while (iCurSymbolID % iPadAmount != 0);

	if (NUM_COMMERCE_TYPES < iPadAmount)
	{
		do 
		{
			++iCurSymbolID;
		} while (iCurSymbolID % iPadAmount != 0);
	}

	for (int i = 0; i < GC.getNumReligionInfos(); i++)
	{
		GC.getReligionInfo((ReligionTypes) i).setChar(iCurSymbolID);
		++iCurSymbolID;
		GC.getReligionInfo((ReligionTypes) i).setHolyCityChar(iCurSymbolID);
		++iCurSymbolID;
	}
	for (i = 0; i < GC.getNumCorporationInfos(); i++)
	{
		GC.getCorporationInfo((CorporationTypes) i).setChar(iCurSymbolID);
		++iCurSymbolID;
		GC.getCorporationInfo((CorporationTypes) i).setHeadquarterChar(iCurSymbolID);
		++iCurSymbolID;
	}

	do 
	{
		++iCurSymbolID;
	} while (iCurSymbolID % iPadAmount != 0);

	if (2 * (GC.getNumReligionInfos() + GC.getNumCorporationInfos()) < iPadAmount)
	{
		do 
		{
			++iCurSymbolID;
		} while (iCurSymbolID % iPadAmount != 0);
	}

	// set bonus symbols
	int bonusBaseID = iCurSymbolID;
	++iCurSymbolID;
	for (int i = 0; i < GC.getNumBonusInfos(); i++)
	{
		int bonusID = bonusBaseID + GC.getBonusInfo((BonusTypes) i).getArtInfo()->getFontButtonIndex();
		GC.getBonusInfo((BonusTypes) i).setChar(bonusID);
		++iCurSymbolID;
	}

	do 
	{
		++iCurSymbolID;
	} while (iCurSymbolID % iPadAmount != 0);

	if(GC.getNumBonusInfos() < iPadAmount)
	{
		do 
		{
			++iCurSymbolID;
		} while (iCurSymbolID % iPadAmount != 0);
	}

	if(GC.getNumBonusInfos() < 2 * iPadAmount)
	{
		do 
		{
			++iCurSymbolID;
		} while (iCurSymbolID % iPadAmount != 0);
	}
[COLOR="Navy"]//This hardcodes the last position of resources for RoM only. It will vary based on your gamefont.
// Thanks to Sephi for figuring it out.
	if GC.getDefineINT("IS_RISE_OF_MANKIND");
		iCurSymbolID=9200;
// TEMPFIX[/COLOR]

	// set extra symbols
	for (int i=0; i < MAX_NUM_SYMBOLS; i++)
	{
		gDLL->setSymbolID(i, iCurSymbolID);
		++iCurSymbolID;
	}
}
 
Thanks for the fix.

The second issue, I'm not comfortable setting anything up like that for specific mods, I pretty much refuse to hardcode things in the SDK. If you look at the work I've done the vast majority of it was to softcode things. If you can set that up as a softcoded Global Defines value I'll add it. Since you're pulling from Global Defines, and GD can apply integer values, it shouldn't be hard to do. That way each and every mod that uses the RevDCM core can assign this GD value for their mod.
 
Thanks for the fix.

The second issue, I'm not comfortable setting anything up like that for specific mods, I pretty much refuse to hardcode things in the SDK. If you look at the work I've done the vast majority of it was to softcode things. If you can set that up as a softcoded Global Defines value I'll add it. Since you're pulling from Global Defines, and GD can apply integer values, it shouldn't be hard to do. That way each and every mod that uses the RevDCM core can assign this GD value for their mod.

Why Didn't I think of that. :facepalm:

Scratch my fix, use this instead then:

Code:
void CvGameTextMgr::assignFontIds(int iFirstSymbolCode, int iPadAmount)
{
	int iCurSymbolID = iFirstSymbolCode;

	// set yield symbols
	for (int i = 0; i < NUM_YIELD_TYPES; i++)
	{
		GC.getYieldInfo((YieldTypes) i).setChar(iCurSymbolID);  
		++iCurSymbolID;
	}

	do 
	{
		++iCurSymbolID;
	} while (iCurSymbolID % iPadAmount != 0);

	// set commerce symbols
	for (i=0;i<GC.getNUM_COMMERCE_TYPES();i++)
	{
		GC.getCommerceInfo((CommerceTypes) i).setChar(iCurSymbolID);  
		++iCurSymbolID;
	}

	do 
	{
		++iCurSymbolID;
	} while (iCurSymbolID % iPadAmount != 0);

	if (NUM_COMMERCE_TYPES < iPadAmount)
	{
		do 
		{
			++iCurSymbolID;
		} while (iCurSymbolID % iPadAmount != 0);
	}

	for (int i = 0; i < GC.getNumReligionInfos(); i++)
	{
		GC.getReligionInfo((ReligionTypes) i).setChar(iCurSymbolID);
		++iCurSymbolID;
		GC.getReligionInfo((ReligionTypes) i).setHolyCityChar(iCurSymbolID);
		++iCurSymbolID;
	}
	for (i = 0; i < GC.getNumCorporationInfos(); i++)
	{
		GC.getCorporationInfo((CorporationTypes) i).setChar(iCurSymbolID);
		++iCurSymbolID;
		GC.getCorporationInfo((CorporationTypes) i).setHeadquarterChar(iCurSymbolID);
		++iCurSymbolID;
	}

	do 
	{
		++iCurSymbolID;
	} while (iCurSymbolID % iPadAmount != 0);

	if (2 * (GC.getNumReligionInfos() + GC.getNumCorporationInfos()) < iPadAmount)
	{
		do 
		{
			++iCurSymbolID;
		} while (iCurSymbolID % iPadAmount != 0);
	}

	// set bonus symbols
	int bonusBaseID = iCurSymbolID;
	++iCurSymbolID;
	for (int i = 0; i < GC.getNumBonusInfos(); i++)
	{
		int bonusID = bonusBaseID + GC.getBonusInfo((BonusTypes) i).getArtInfo()->getFontButtonIndex();
		GC.getBonusInfo((BonusTypes) i).setChar(bonusID);
		++iCurSymbolID;
	}

	do 
	{
		++iCurSymbolID;
	} while (iCurSymbolID % iPadAmount != 0);

	if(GC.getNumBonusInfos() < iPadAmount)
	{
		do 
		{
			++iCurSymbolID;
		} while (iCurSymbolID % iPadAmount != 0);
	}

	if(GC.getNumBonusInfos() < 2 * iPadAmount)
	{
		do 
		{
			++iCurSymbolID;
		} while (iCurSymbolID % iPadAmount != 0);
	}
[COLOR=Navy]//This hardcodes the last position of resources. It will vary based on your gamefont.
// Thanks to Sephi for figuring it out.
	if (GC.getDefineINT("WOC_GAMEFONT_RESOURCE_FIX") > 0)
		iCurSymbolID=[/COLOR][COLOR=Navy]GC.getDefineINT("WOC_GAMEFONT_RESOURCE_FIX"[/COLOR]
[COLOR=Navy];
// TEMPFIX[/COLOR]

	// set extra symbols
	for (int i=0; i < MAX_NUM_SYMBOLS; i++)
	{
		gDLL->setSymbolID(i, iCurSymbolID);
		++iCurSymbolID;
	}
}
There, now setting a value of -1 in that Global Define will turn that off, and setting a positive value will change it.
 
Code:
[COLOR=Navy]//This hardcodes the last position of resources. It will vary based on your gamefont.
// Thanks to Sephi for figuring it out.
	if (GC.getDefineINT("WOC_GAMEFONT_RESOURCE_FIX") > 0)
		iCurSymbolID=[/COLOR][COLOR=Navy]GC.getDefineINT("WOC_GAMEFONT_RESOURCE_FIX"[/COLOR]
[COLOR=Navy];
// TEMPFIX[/COLOR]
Can't you get the exact number anyway with some custom function? Since you could find it with debug tools, you should be able to code similar function to find the value and then you wouldn't need the new global define, right? That way modders wouldn't need to worry about this value if they modify the gamefont files (since you can't find it without installing SDK?).

At the moment RoM, RevDCM (probably also LoR) are missing project icons that BUG mod added to their font files in v4.2 (or 4.0). Those go just above the smiley faces icons (ie. also above resource icons). Looks like RevDCM is currently using the gamefont file I updated for it and for RoM, though RoM has now newer fonts since some modmodders added lots of new corporations and religions and my main mod needed to support those.

Since modders will probably use our mods for years to come, there might be situations when they add more resources - even totally new resource lines to gamefonts so I think it would be best if we have solved this font issue in a such way that we don't have to worry about it ever again. :)
 
Can't you get the exact number anyway with some custom function? Since you could find it with debug tools, you should be able to code similar function to find the value and then you wouldn't need the new global define, right? That way modders wouldn't need to worry about this value if they modify the gamefont files (since you can't find it without installing SDK?).

At the moment RoM, RevDCM (probably also LoR) are missing project icons that BUG mod added to their font files in v4.2 (or 4.0). Those go just above the smiley faces icons (ie. also above resource icons). Looks like RevDCM is currently using the gamefont file I updated for it and for RoM, though RoM has now newer fonts since some modmodders added lots of new corporations and religions and my main mod needed to support those.

Since modders will probably use our mods for years to come, there might be situations when they add more resources - even totally new resource lines to gamefonts so I think it would be best if we have solved this font issue in a such way that we don't have to worry about it ever again. :)

Id' love to, but I can't solve a mystery with only 1 plot point to go on. I need an entirely new line to the Resources in order to get a second point of reference for the issue. Perhaps just adding a resource down on the next line and using it as a resource would work. Hmm. One sec.

Edit:

I added a new dummy resource in, with a ButtonFont value of 250, to see what happened, but the resource worked fine, and none of the other symbols were affected. Sephi said that the number will need to be adjusted if you add a new row above the Resources. If someone could do that, I'd look at the number again and see if I could figure it out. But right now, it's hard to figure out a problem with only 1 point of data.
 
Phungus, I noticed a type in the SVN for CvInfos.h
Code:
	int getYieldModifier(int i) const;;
You just wasted some CPU by creating a second empty statement. Get rid of that second semicolon.
 
Phungus, I noticed a type in the SVN for CvInfos.h
Code:
	int getYieldModifier(int i) const;;
You just wasted some CPU by creating a second empty statement.

Check the CvGameCoreDll in your BtS folder and reassess the direct object in your sentence.
 
No reassessment. Firaxis dev's made a typo (not there first error). Luckily, in C, a empty statement (just a semicolon) does nothing but waste memory.
 
I added a new dummy resource in, with a ButtonFont value of 250, to see what happened, but the resource worked fine, and none of the other symbols were affected. Sephi said that the number will need to be adjusted if you add a new row above the Resources. If someone could do that, I'd look at the number again and see if I could figure it out. But right now, it's hard to figure out a problem with only 1 point of data.
I guess I could add some more resource icons to the font files (like from FFH) but that project needs an entire weekend and lots of pills for headache :lol: Anyway, I'll try soon adding those BUG ss project icons as the new espionage screen needs them...
 
I would hope this would help save some work. I made png files of the mask(the pink with the blue dots minus the icons) so you can open in another program. You can merge this down over the layer afterwards to make sure there is nothing outside of the square boxes.

PSD files are in there as well. It is a lot easier to work with the photoshop files.
 
It's best to keep the GameFont of RevDCM a simple as possible. Is anyone who understands this file willing to create a new one for the RevDCM core that only includes what is needed for RevDCM? Base BtS stuff and BUG/BULL is all I can think of that's needed.

Edit:
Why does RevDCM have a special Gamefont TGA? Why can't it just use BUG/BULL's?
 
It's best to keep the GameFont of RevDCM a simple as possible. Is anyone who understands this file willing to create a new one for the RevDCM core that only includes what is needed for RevDCM? Base BtS stuff and BUG/BULL is all I can think of that's needed.

Edit:
Why does RevDCM have a special Gamefont TGA? Why can't it just use BUG/BULL's?
RevDCM has a special gamefont because that was part of WoC lite. It would be counterproductive to return to old BtS style gamefont file because WoC style font offers much more freedom when it comes to adding religions/corporations/resources.

In my opinion it would actually be the best to add gamefont that has the most icons included so that other modders can make modules for all RevDCM based mods which require new icons (f.ex. Rapture adds whole bunch of religion icons). I've tried to do this on my own modpack as there's now several different corporation/religion modmods for RoM and it was impossible to get them work altogether if I hadn't supported all the icons by default in the main mod.

Besides WoC gamefonts allow you to use TGAindex number xml modifier to locate the icons and all unused icons are ignored - compared to BtS format which requires you to define xml art defines for all icons that are included in the gamefont. All in all WoC style fonts are superior to BtS fonts.
 
I just want to say if the issue with the gamefonts persist as in how many can be added.....

It would be possible instead of placing all of the fonts strictly on one TGA file you could add multiple layers of fonts to one Photoshop file. I took a lot time to get a template so if in the future if the TGA is screwed(something that happens often) it can be quickly used to repair the file.

The pink template.
attachment.php


You can do this simply merging down the mask layer over the RGB layer.
attachment.php







As for the alpha channel if you click magic wand
attachment.php


Then the empty space
attachment.php


Next click similar.
attachment.php

attachment.php


Next select inverse
attachment.php


And you will have the area should be black in the alpha channel.
attachment.php


Then you can fill that area with black and fix it.
attachment.php


If you guys don't like doing it the easy way then fine do it your way. It is not that hard of a process. There are photoshop like freeware programs though to download like. Like for example "Active Pixels" here is a link. http://idea-systems.net/

As for the amount of resources loading well I don't really know what the limit is. The file in its present state will load more resources with less religions and corporations set in the GameFont_GlobalDefines file for the fonts. You can have at the max 184 religions and 184 corporations each. Each row of religions or corporations is 46. So you could lower the amount to 92 each if needed. Default for the rows in BtS I think is 25 right?

The Rapture icons are there really just taking space perhaps from other religions in this situation. I mean I know it is better to have more instead of changing the TGA often, but if no solution can be found it might be better is all I am saying to remove them. And that means remove of some the white spaces to match the count in. Then adjust GameFont_GlobalDefines in Assets/Res/Fonts like so...

Code:
<Civ4Defines xmlns="x-schema:CIV4GlobalDefinesSchema.xml">	
	<Define>
		<DefineName>GAMEFONT_TGA_RELIGIONS</DefineName>
		<iDefineIntVal>138</iDefineIntVal>
	</Define>
	<Define>
		<DefineName>GAMEFONT_TGA_CORPORATIONS</DefineName>
		<iDefineIntVal>138</iDefineIntVal>
	</Define>
</Civ4Defines>

Anyway I hope this was not a waste, but it seems since no one looked at the previous files I sent that they do not know what the files were for apparently. If this has helped I need to post it as an tutorial.
 
Actually a few kinks in what I wrote though sorry...

You may need to make a duplicate of the alpha channel and the pink layer first. When you select inverse it will copy over the actual text lines in the alpha channel. So it would be better to copy the section minus the text after filling back to the one alpha channel. If there is any problems I can explain more, but I think it will be easy to figure out once someone knows what to do in general.

Sorry if I have confused you even more. If more help is needed I can explain more. I probably should write a full tutorial but I do not have the time at the moment. Just was expecting more people who work with it to understand the files, but I was wrong it seems. Sorry if I have confused you even more.
 
@ Zappara

Adding in a whole lot of stuff only asks for problems. This is the RevDCM core, a modding core attempting to be a standard for many mods to work off of. There is absolutely no reason for such a core to have a bloated gamefont.tga file. If people that use the RevDCM core want an expanded gamefont, that should be on them to build it.

Now if there is a formatting issue, yes RevDCM should side with the format that makes it easier for large mergers to work with. I'm all for using a gamefont.tga file that has a more accessible format; what I don't want is a gamefont.tga that's filled with 100s of new icons that exist for no reason in the RevDCM mod as a standalone.

Of course what comes standard with RevDCM, doesn't need to be all that's all that should be available. I'm not very familiar with this TGA stuff, but I'd greatly appreciate it if someone could make 2 gamefont.TGA files. One that is "clean", ie only icons that RevDCM needs itself (base BtS and BUG icons only I believe) in a WoC standardized format. Then an "expanded" version that has all the icons anyone that could ever want or need which will be available as a separate download, but easy to use as a modmaker could just grab it and replace the original. That's the optimal setup I can see. But again the base RevDCM download does not, and should not have a bunch of extra stuff in it like extra icons, in fact the goal of things in my mind is to make the simplest core for modmakers to build off of.
 
RevDCM has a special gamefont because that was part of WoC lite. It would be counterproductive to return to old BtS style gamefont file because WoC style font offers much more freedom when it comes to adding religions/corporations/resources.

In my opinion it would actually be the best to add gamefont that has the most icons included so that other modders can make modules for all RevDCM based mods which require new icons (f.ex. Rapture adds whole bunch of religion icons). I've tried to do this on my own modpack as there's now several different corporation/religion modmods for RoM and it was impossible to get them work altogether if I hadn't supported all the icons by default in the main mod.

Besides WoC gamefonts allow you to use TGAindex number xml modifier to locate the icons and all unused icons are ignored - compared to BtS format which requires you to define xml art defines for all icons that are included in the gamefont. All in all WoC style fonts are superior to BtS fonts.

Okay, I figured out the issue with the GameFonts. Basically, it's the fault of WoC. They laid out the table incorrectly. If you look at the BTS gamefonts, it loads the symbols (like defense, GA, etc..) last. In the WoC gamefonts, it loads the symbols before the resources. This works fine, until you reach a combination of symbols and resources that is over 100 (RoM has 73 resources and 26 symbols. That's why adding 2 more resources broke it.)

A sidenote, the reason why the corporations and religions work is because WoC over-rode the XML value for the size of the arrays. In the game, usually, it loads up the number of buildings, or units, etc, and that's the value in GC.getNumWhatever()..., but for religions and corporations, there is a global define in the fonts folder with the value of 138. That value over rides the normal values, so that GC.getNumCorporationInfos() returns 138 now. Check for yourself...

Now, for the bad news. Basically, fixing it is an impossible task. You'd need to create a new gamefonts with the symbols last and the resources above it. But then you have the issue that the number of resources fluctuates, so you would need to hardcode the last position anyway. Basically, without the exe code, which controls the symbols in their entirety, we can do nothing but make short-term fixes. It certainly isn't ideal, but better than nothing... :sad:

Phungus, all this means that it will be impossible to have two working gamefonts for RevDCM. You must use the WoC one, or else you will break things that were hardcoded in the SDK for it. A bunch of the TGA index numbers are hardcoded.
 
What would happen if we simply revered the SDK code that loads the gamefont.tga to BtS standard? I'm all for rewriting this function if need be, since WoC hardcoded stuff (what's the point in WoC's supposed modularity if they keep hardcoding stuff, it's counterprodcutive and goes against the whole stated purpose of the project?).

Anyway based on what you say it sounds to me like the WoC SDK code dealing with the gamefonts needs to be ripped out, and reverted to BtS, then re written for modularity. Is this a correct assessment? How can we go about doing this?
 
What would happen if we simply revered the SDK code that loads the gamefont.tga to BtS standard? I'm all for rewriting this function if need be, since WoC hardcoded stuff (what's the point in WoC's supposed modularity if they keep hardcoding stuff, it's counterprodcutive and goes against the whole stated purpose of the project?).

Anyway based on what you say it sounds to me like the WoC SDK code dealing with the gamefonts needs to be ripped out, and reverted to BtS, then re written for modularity. Is this a correct assessment? How can we go about doing this?


Well, the SDK code for WoC gamefont has some advantages. For instance, you can add icons in the game font and don't need to use them all.

I'm not sure how to proceed... I don't understand how alot of the WoC gamefont code works, it's more advanced C then I've learned.
 
What would happen if we simply revered the SDK code that loads the gamefont.tga to BtS standard? I'm all for rewriting this function if need be, since WoC hardcoded stuff (what's the point in WoC's supposed modularity if they keep hardcoding stuff, it's counterprodcutive and goes against the whole stated purpose of the project?).

Anyway based on what you say it sounds to me like the WoC SDK code dealing with the gamefonts needs to be ripped out, and reverted to BtS, then re written for modularity. Is this a correct assessment? How can we go about doing this?

You not going to really figure it out easily. Basically I don't want to tell you do nothing wrong but you probably are going to need to know what is in the exe. Sorry all I can say take or leave it not that I am happy with that situation. Modularity and individual fonts in modules can not happen. I wish it could. I wanted that but it is locked away in the exe. Can the BUG icons not be loaded from somewhere else on the fonts?
 
Can you explain more Johnny?

Edit: Like what's locked away in the exe? If things are locked away in the exe then why can we load new icons by hardcoding values in the SDK regarding the gamefont. I'm not understanding, can I see an example of where such hardcodes are set? Where in the SDK is the code dealing with the gamefonts, and what parts are known to be loaded by the exe?
 
Back
Top Bottom