modmdl[vwep|weap][N] aliases for switching model of guns (even on-the-fly)

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6691 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
flowtron
2011-11-06 13:29:44 +00:00
parent 544b992c72
commit b2ec034187
3 changed files with 8 additions and 4 deletions
+2 -1
View File
@@ -115,7 +115,8 @@ void preload_hudguns()
{
loopi(NUMGUNS)
{
defformatstring(path)("weapons/%s", guns[i].modelname);
defformatstring(widn)("modmdlweap%d", i);
defformatstring(path)("weapons/%s", identexists(widn)?getalias(widn):guns[i].modelname);
loadmodel(path);
}
}
+4 -2
View File
@@ -491,7 +491,8 @@ void preload_playermodels()
if(dynshadow && playermdl) playermdl->genshadows(8.0f, 4.0f);
loopi(NUMGUNS)
{
defformatstring(vwep)("weapons/%s/world", guns[i].modelname);
defformatstring(widn)("modmdlvwep%d", i);
defformatstring(vwep)("weapons/%s/world", identexists(widn)?getalias(widn):guns[i].modelname);
model *vwepmdl = loadmodel(vwep);
if(dynshadow && vwepmdl) vwepmdl->genshadows(8.0f, 4.0f);
}
@@ -709,7 +710,8 @@ void renderclient(playerent *d)
}
}
string vwep;
if(d->weaponsel) formatstring(vwep)("weapons/%s/world", d->weaponsel->info.modelname);
defformatstring(widn)("modmdlvwep%d", d->weaponsel->type);
if(d->weaponsel) formatstring(vwep)("weapons/%s/world", identexists(widn)?getalias(widn):d->weaponsel->info.modelname);
else vwep[0] = 0;
renderclient(d, "playermodels", vwep[0] ? vwep : NULL, -(int)textureload(skin)->id);
}
+2 -1
View File
@@ -852,7 +852,8 @@ void weapon::renderhudmodel(int lastaction, int index)
weaponmove wm;
if(!intermission) wm.calcmove(unitv, lastaction, p);
defformatstring(path)("weapons/%s", info.modelname);
defformatstring(widn)("modmdlweap%d", type);
defformatstring(path)("weapons/%s", identexists(widn)?getalias(widn):info.modelname);
bool emit = (wm.anim&ANIM_INDEX)==ANIM_GUN_SHOOT && (lastmillis - lastaction) < flashtime();
rendermodel(path, wm.anim|ANIM_DYNALLOC|(righthanded==index ? ANIM_MIRROR : 0)|(emit ? ANIM_PARTICLE : 0), 0, -1, wm.pos, p->yaw+90, p->pitch+wm.k_rot, 40.0f, wm.basetime, NULL, NULL, 1.28f);
}