Deliverator
Graphical Hackificator
Cool. We could finally be in business for Worm Riders in Dune Wars...
if (pPlot->isWater() != pOldPlot->isWater())
if (m_pUnitInfo->getLateArtDefineTag(0, (UnitArtStyleTypes) 0))
if (isHasPromotion((PromotionTypes)GC.getInfoTypeForString("PROMOTION_SANDRIDER")))
reloadEntity();
I had unsubscribed this thread some time back, thank you for the additional PM to draw my attention back.
This feature is working in Dune Wars. However, it is not easy to separate out into a separate modcomp. There is an sdk part and an XML part; so unless you can take C++ code out of the Dune Wars sdk files, modify it appropriately, and compile it into your mod, you would not be able to use this. It also re-uses the LateArtStyleTag, so if you had early or late art variants already, you could not use it.
If you are already comfortable with modifying C++ code in the sdk, then please download the latest version of Dune Wars (see the download database; here is a current version but newer versions will replace it.) In the cvgamecoredll directory, search for comments matching "davidlallen.*reuse late art tag". You will find code segments in CvInfos.cpp and CvUnit.cpp. The code in CvInfos.cpp makes the art style tag local to a unit. The code in CvUnit.cpp has a few magic words copied from Kael's code in FFH around reloadEntity, which actually loads and unloads the art.
The one nasty bit is the four lines inside CvUnit::move, which is highly specific to Dune Wars:
Code:if (pPlot->isWater() != pOldPlot->isWater()) if (m_pUnitInfo->getLateArtDefineTag(0, (UnitArtStyleTypes) 0)) if (isHasPromotion((PromotionTypes)GC.getInfoTypeForString("PROMOTION_SANDRIDER"))) reloadEntity();
This specifically checks for a promotion, by name, and forces an art swap when a unit with that promotion moves in or out of water. For whatever your application may be, you would need to change these lines.
Once you have a cvgamecoredll.dll built with this, then you need to add the artstyles into the xml. This is not hard if you are familiar with writing xml for new units. Basically, you have two artdefines in assets/xml/art/civ4artdefines_unit.xml, one for the land version and one for the sea unit. Then use the EarlyArtDefineTag for the land unit and the LateArtDefineTag for the sea unit. You can search in the Dune Wars assets/xml/units/civ4unitinfos.xml file for "LateArtDefineTag". All the places where this is used are related to the feature. In the Fremen Scout unit, for example, you will see it uses ART_DEF_UNIT_FREMEN_SCOUT on land, but ART_DEF_UNIT_FREMEN_WORM on water.
If you have specific questions about this, I will be happy to answer, but please keep in mind this requires sdk mods and some assumptions, as I have mentioned above.
What exactly is sdk and C++code?
valkrionn said:Rather than hardcode a promotion, could you not add a 'bReloadArtOnWater' tag to units/promotions, and check if the unit has that?
That same mechanic is possible in FF, without requiring any hardcoding at all. Autoacquire promotions ftw.
Thank you for the suggestion. Of course adding a tag would be cleaner, just more code. Since only one person is using the code, it does not matter much.
Yes, that was pointed out earlier in the thread. But since FF is a huge customization of its own, unrelated to the huge customization in Dune Wars, merging the two together would be much harder than adding the seven lines of sdk code I actually added.