From b2ec03418703e549bf4abadebb9a1990fe47b9b3 Mon Sep 17 00:00:00 2001 From: flowtron Date: Sun, 6 Nov 2011 13:29:44 +0000 Subject: [PATCH] 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 --- source/src/hudgun.h | 3 ++- source/src/rendermodel.cpp | 6 ++++-- source/src/weapon.cpp | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source/src/hudgun.h b/source/src/hudgun.h index 54c8eaf5..47b5f286 100644 --- a/source/src/hudgun.h +++ b/source/src/hudgun.h @@ -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); } } diff --git a/source/src/rendermodel.cpp b/source/src/rendermodel.cpp index 5e4f45fe..707d3c0a 100644 --- a/source/src/rendermodel.cpp +++ b/source/src/rendermodel.cpp @@ -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); } diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index 03fc84fe..77a17431 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -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); }