print error message if md3skin tries to skin non-existing meshes

the error message includes a list of available mesh names
This commit is contained in:
ac-stef
2015-05-17 00:24:38 +02:00
parent 3e84f11630
commit 890e13076c
+8
View File
@@ -268,6 +268,7 @@ void md3skin(char *objname, char *skin)
if(!objname || !skin) return;
if(!loadingmd3 || loadingmd3->parts.empty()) { conoutf("not loading an md3"); return; };
md3::part &mdl = *loadingmd3->parts.last();
bool used = false;
loopv(mdl.meshes)
{
md3::mesh &m = *mdl.meshes[i];
@@ -275,8 +276,15 @@ void md3skin(char *objname, char *skin)
{
defformatstring(spath)("%s/%s", md3dir, skin);
m.skin = textureload(spath);
used = true;
}
}
if(!used)
{
defformatstring(s)(", possibilities are: *");
loopv(mdl.meshes) concatformatstring(s, "|%s", mdl.meshes[i]->name);
conoutf("mesh \"%s\" not found in model %s, skin %s not loaded%s", objname, loadingmd3->loadname, skin, mdl.meshes.length() ? s : "");
}
}
void md3anim(char *anim, int *startframe, int *range, float *speed)