modmdlpickupN - load custom pickup models via cubescript (plz review/test)
git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@7201 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
@@ -836,6 +836,11 @@ docexample [echo (modenum ctf)] [Output: 5];
|
||||
docexample [echo (modenum btosok)] [Output: 21];
|
||||
docident [modlanconnect] [Connect to a modified LAN server.];
|
||||
docremark [The modified server needs to use the original client-server protocol. The protocol version number will be the negated value of an unmodded server.];
|
||||
docident [modmdlpickupN] [change name of directory used for pickup model number N];
|
||||
docremark [These setting should be loaded from config/autoexec.cfg, but they work on-the-fly too.];
|
||||
docremark [If the model fails to load you will end up with nothing being displayed; use delalias to get back to default];
|
||||
docexample [modmdlpickup3 = health2] [This will make the health pickup model use the data inside packages/models/pickups/health2];
|
||||
docexample [modmdlpickup1 = my_ammobox] [This will make the ammobox pickup model use the data inside packages/models/pickups/my_ammobox];
|
||||
docident [modmdlvwepN] [change name of directory used for weapon model (viewable/world) number N];
|
||||
docident [modmdlweapN] [change name of directory used for weapon model (hudgun) number N];
|
||||
docremark [These setting should be loaded from config/autoexec.cfg, but they work on-the-fly too.];
|
||||
|
||||
+13
-9
@@ -5,18 +5,22 @@
|
||||
vector<entity> ents;
|
||||
vector<int> eh_ents; // edithide entities
|
||||
const char *entmdlnames[] =
|
||||
{
|
||||
"pickups/pistolclips", "pickups/ammobox", "pickups/nade", "pickups/health", "pickups/helmet", "pickups/kevlar", "pickups/akimbo", "pickups/nades", //FIXME
|
||||
};
|
||||
{
|
||||
"pistolclips", "ammobox", "nade", "health", "helmet", "kevlar", "akimbo", "nades", //FIXME
|
||||
};
|
||||
|
||||
void renderent(entity &e)
|
||||
{
|
||||
void renderent(entity &e)
|
||||
{
|
||||
/* FIXME: if the item list change, this hack will be messed */
|
||||
const char *mdlname = entmdlnames[e.type-I_CLIPS+(m_lss && e.type==I_GRENADE ? 5:0)];
|
||||
float z = (float)(1+sinf(lastmillis/100.0f+e.x+e.y)/20),
|
||||
yaw = lastmillis/10.0f;
|
||||
|
||||
defformatstring(widn)("modmdlpickup%d", e.type-3);
|
||||
defformatstring(mdlname)("pickups/%s", identexists(widn)?getalias(widn):
|
||||
|
||||
entmdlnames[e.type-I_CLIPS+(m_lss && e.type==I_GRENADE ? 5:0)]);
|
||||
|
||||
float z = (float)(1+sinf(lastmillis/100.0f+e.x+e.y)/20), yaw = lastmillis/10.0f;
|
||||
rendermodel(mdlname, ANIM_MAPMODEL|ANIM_LOOP|ANIM_DYNALLOC, 0, 0, vec(e.x, e.y, z+S(e.x, e.y)->floor+e.attr1), yaw, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void renderclip(entity &e)
|
||||
{
|
||||
|
||||
@@ -519,11 +519,23 @@ void preload_playermodels()
|
||||
}
|
||||
|
||||
void preload_entmodels()
|
||||
{
|
||||
{
|
||||
string buf;
|
||||
|
||||
extern const char *entmdlnames[];
|
||||
loopi(I_AKIMBO-I_CLIPS+1)
|
||||
{
|
||||
model *mdl = loadmodel(entmdlnames[i]);
|
||||
strcpy(buf, "pickups/");
|
||||
|
||||
defformatstring(widn)("modmdlvwep%d", i-3);
|
||||
|
||||
if (identexists(widn))
|
||||
strcat(buf, getalias(widn));
|
||||
else
|
||||
strcat(buf, entmdlnames[i]);
|
||||
|
||||
model *mdl = loadmodel(buf);
|
||||
|
||||
if(dynshadow && mdl) mdl->genshadows(8.0f, 2.0f);
|
||||
}
|
||||
static const char *bouncemdlnames[] = { "misc/gib01", "misc/gib02", "misc/gib03", "weapons/grenade/static" };
|
||||
@@ -532,7 +544,7 @@ void preload_entmodels()
|
||||
model *mdl = loadmodel(bouncemdlnames[i]);
|
||||
if(dynshadow && mdl) mdl->genshadows(8.0f, 2.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void preload_mapmodels()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user