Non-source changes
1. Add the line "GenericWorld=x;" (where x is a number, currently 0, 1, or 2) to the map's SMD, under the [MAPS] section (not any sub sections). Not all maps require this, as it will default to 0 if not there.
2. Add the lines "Objectgrass=modelNameForGrassCamo;", "Objectsnow=modelname;" etc to the target unit's FBI (currently those are the only ones I put in).
Source changes
3. ReadMap.h
Add "int genericWorld;" to the CReadMap class.
4. BFReadMap.cpp
Add "mapDefParser.GetDef(genericWorld, "0", "MAP\\GenericWorld");" to CBFReadmap::ParseSMD.
5. UnitDefHandler.cpp
Here's the big one. Change this:
Code: Select all
std::string objectname;
sunparser.GetDef(objectname, "", "UNITINFO\\Objectname");
ud.model.modelpath = "objects3d\\" + objectname + ".3do";
ud.model.modelname = objectname;
Code: Select all
std::string objectname;
std::string objectgrass;
std::string objectsnow;
sunparser.GetDef(objectname, "", "UNITINFO\\Objectname");
sunparser.GetDef(objectgrass, objectname, "UNITINFO\\objectgrass");
sunparser.GetDef(objectsnow, objectname, "UNITINFO\\objectsnow");
if(readmap->genericWorld == 1) {
ud.model.modelpath = "objects3d\\" + objectgrass + ".3do";
ud.model.modelname = objectname;
}
else if(readmap->genericWorld == 2) {
ud.model.modelpath = "objects3d\\" + objectsnow + ".3do";
ud.model.modelname = objectname;
}
else {
ud.model.modelpath = "objects3d\\" + objectname + ".3do";
ud.model.modelname = objectname;
}
This should be fairly simple to follow. It'll load the camo model for the world defined in the SMD if there is a model for that world defined in the FBI for the particular unit. If there isn't one defined, it just uses the default model.
I know I and the real world mod people would appreciate it if this (or a streamlined version of this) made its way in officially, and well... There's the framework for the code. Just make sure there's support for plenty of various world types
