From 6bca9438a84baa3584ccafba020a33ae06aeda27 Mon Sep 17 00:00:00 2001 From: Bukz Date: Sat, 16 Feb 2013 05:54:05 +0000 Subject: [PATCH] modmdlbounceN - load custom gib/static grenade models via cubescript git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@7216 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- config/defaults.cfg | 2 +- config/docs.cfg | 7 +++++++ config/on_quit.cfg | 10 +++++++++- config/resetbinds.cfg | 2 +- source/src/rendermodel.cpp | 13 ++++++++++--- source/src/weapon.cpp | 10 ++++++++++ 6 files changed, 38 insertions(+), 6 deletions(-) diff --git a/config/defaults.cfg b/config/defaults.cfg index cd3457e9..17595c7e 100644 --- a/config/defaults.cfg +++ b/config/defaults.cfg @@ -33,4 +33,4 @@ nonSurvDefaults = 0 survDamageEffects = 1 autosavemap = 0 timeBetAutoSaves = 300000 -numAutoSaveBackups = 12 \ No newline at end of file +numAutoSaveBackups = 3 \ No newline at end of file diff --git a/config/docs.cfg b/config/docs.cfg index dcd01f44..5dad0a08 100644 --- a/config/docs.cfg +++ b/config/docs.cfg @@ -841,6 +841,13 @@ 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 [modmdlbounceN] [change name of directory used for bounce 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 [modmdlbounce0 = misc/my_gib1] [This will make the gib 1 model use the data inside packages/models/misc/my_gib1]; +docexample [modmdlbounce1 = misc/my_gib2] [This will make the gib 2 model use the data inside packages/models/misc/my_gib2]; +docexample [modmdlbounce2 = misc/my_gib3] [This will make the gib 3 model use the data inside packages/models/misc/my_gib3]; +docexample [modmdlbounce3 = weapons/grenade2/static] [This will make the grenade static model use the data inside packages/models/weapons/grenade2/static]; 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]; diff --git a/config/on_quit.cfg b/config/on_quit.cfg index 28880bcf..4cdc5449 100644 --- a/config/on_quit.cfg +++ b/config/on_quit.cfg @@ -7,16 +7,24 @@ const addListOnQuit [ alias_list = $arg1; loop al (listlen $alias_list) [ addOnQ const on_quit_aliases [ _demofile + __fontsetting + __screenshottype + acc1 + acc2 + acc3 badargs + cc1 + cc2 + cc3 cmapp cs_sets cs_newsets + gametimestart i len modifier numcla numrvsf - omit_idents preload_music r s diff --git a/config/resetbinds.cfg b/config/resetbinds.cfg index cfd9014d..d3cd3f05 100644 --- a/config/resetbinds.cfg +++ b/config/resetbinds.cfg @@ -6,7 +6,7 @@ bind MOUSE1 attack bind MOUSE2 altaction editbind MOUSE2 [ showmenu editing ] -bind MOUSE3 [ weapon ] +bind MOUSE3 weapon bind MOUSE4 [ universaldelta 1 ] bind MOUSE5 [ universaldelta -1 ] bind BACKSPACE dropflag diff --git a/source/src/rendermodel.cpp b/source/src/rendermodel.cpp index 0f36c2ee..90416e93 100644 --- a/source/src/rendermodel.cpp +++ b/source/src/rendermodel.cpp @@ -516,7 +516,7 @@ void preload_playermodels() } void preload_entmodels() - { +{ string buf; extern const char *entmdlnames[]; @@ -538,10 +538,17 @@ void preload_entmodels() static const char *bouncemdlnames[] = { "misc/gib01", "misc/gib02", "misc/gib03", "weapons/grenade/static" }; loopi(sizeof(bouncemdlnames)/sizeof(bouncemdlnames[0])) { - model *mdl = loadmodel(bouncemdlnames[i]); + model *mdl = NULL; + defformatstring(widn)("modmdlbounce%d", i); + + if (identexists(widn)) + mdl = loadmodel(getalias(widn)); + else + mdl = loadmodel(bouncemdlnames[i]); + if(dynshadow && mdl) mdl->genshadows(8.0f, 2.0f); } - } +} void preload_mapmodels() { diff --git a/source/src/weapon.cpp b/source/src/weapon.cpp index a84ff1bb..61599485 100644 --- a/source/src/weapon.cpp +++ b/source/src/weapon.cpp @@ -509,13 +509,23 @@ void renderbounceents() switch(p->bouncetype) { case BT_NADE: + if (identexists("modmdlbounce3")) + copystring(model, getalias("modmdlbounce3")); + else copystring(model, "weapons/grenade/static"); break; case BT_GIB: default: { uint n = (((4*(uint)(size_t)p)+(uint)p->timetolive)%3)+1; + + defformatstring(widn)("modmdlbounce%d", n-1); + + if (identexists(widn)) + copystring(model, getalias(widn)); + else formatstring(model)("misc/gib0%u", n); + int t = lastmillis-p->millis; if(t>p->timetolive-2000) {