From: Mircea Kitsune Date: Wed, 4 Jan 2012 16:35:17 +0000 (+0200) Subject: Attach the damage effect entity to the bone and use its origin, instead of not attach... X-Git-Tag: xonotic-v0.6.0~110^2^2~67 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=22a9cf27830f1ced8fbf6c878b068b7d1a750a26;p=xonotic%2Fxonotic-data.pk3dir.git Attach the damage effect entity to the bone and use its origin, instead of not attaching it but getting bone origin each time. This might have some uses and should be more optimal --- diff --git a/qcsrc/client/Main.qc b/qcsrc/client/Main.qc index fd8afe117..9e94a88f6 100644 --- a/qcsrc/client/Main.qc +++ b/qcsrc/client/Main.qc @@ -212,6 +212,8 @@ void CSQC_Init(void) hud_configure_prev = -1; tab_panel = -1; + + precache_model("models/null.md3"); } // CSQC_Shutdown : Called every time the CSQC code is shutdown (changing maps, quitting, etc) diff --git a/qcsrc/client/damage.qc b/qcsrc/client/damage.qc index ebe7b2801..ae7440500 100644 --- a/qcsrc/client/damage.qc +++ b/qcsrc/client/damage.qc @@ -241,7 +241,6 @@ void DamageInfo_Precache() .entity dmgent; .float dmgpartnum, dmgtime; .float lifetime; -.float bone; void DamageEffect_Think() { @@ -262,7 +261,7 @@ void DamageEffect_Think() return; // if we aren't in third person mode, hide own damage effect // Now apply the effect to the player - org = gettaginfo(self.owner, self.bone); + org = gettaginfo(self, 0); pointparticles(self.dmgpartnum, org, '0 0 0', 1); self.dmgtime = time + autocvar_cl_damageeffect; } @@ -302,15 +301,17 @@ void DamageEffect(vector hitorg, float dmg, float type, float specnum, float ent } float closest; - for(i = 1; gettaginfo(self, i); i++) + for(i = 0; gettaginfo(self, i); i++) { // go through all tags on the player model, choose the one closest to the damage origin if(!closest || vlen(hitorg - gettaginfo(self, i)) <= vlen(hitorg - gettaginfo(self, closest))) closest = i; } + gettaginfo(self, closest); // set gettaginfo_name + e = spawn(); - e.owner = self; - e.bone = closest; + setmodel(e, "models/null.md3"); + setattachment(e, self, gettaginfo_name); e.classname = "damageeffect"; e.team = entnumber; e.dmgpartnum = particleeffectnum(effectnum); diff --git a/qcsrc/client/gibs.qc b/qcsrc/client/gibs.qc index 38ca07e7f..22825bc4f 100644 --- a/qcsrc/client/gibs.qc +++ b/qcsrc/client/gibs.qc @@ -152,7 +152,7 @@ void TossGib (string mdlname, vector safeorg, vector org, vector vconst, vector void Ent_GibSplash(float isNew) { - float amount, type, specnum, entnumber; + float amount, type, specnum; vector org, vel; string specstr; float issilent; diff --git a/qcsrc/dpdefs/csprogsdefs.qc b/qcsrc/dpdefs/csprogsdefs.qc index 0d3088f9c..f3003dbd6 100644 --- a/qcsrc/dpdefs/csprogsdefs.qc +++ b/qcsrc/dpdefs/csprogsdefs.qc @@ -1405,3 +1405,10 @@ float trace_networkentity; const float RF_FULLBRIGHT = 256; const float RF_NOSHADOW = 512; float RF_DYNAMICMODELLIGHT = 8192; + +float gettaginfo_parent; +string gettaginfo_name; +vector gettaginfo_offset; +vector gettaginfo_forward; +vector gettaginfo_right; +vector gettaginfo_up;