From: Rudolf Polzer Date: Mon, 9 Jan 2012 15:16:11 +0000 (+0100) Subject: add utility fields to detect player death X-Git-Tag: xonotic-v0.6.0~188^2~12 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=72e1cbd02172ea7ced1488fb948dcdb5e2d441f2;p=xonotic%2Fxonotic-data.pk3dir.git add utility fields to detect player death --- diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 320ae656b..5e4d27ac5 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -206,6 +206,11 @@ void CSQCPlayer_ForceModel_Apply(float islocalplayer) .float csqcmodel_saveframe3; .float csqcmodel_saveframe4; .float csqcmodel_framecount; + +.float csqcmodel_isdead; // for utility code +.float csqcmodel_deathtime; // for utility code + +#define IS_DEAD_FRAME(f) ((f) == 0 || (f) == 1) void CSQCPlayer_FallbackFrame_PreUpdate(void) { self.frame = self.csqcmodel_saveframe; @@ -225,18 +230,18 @@ void CSQCPlayer_FallbackFrame_PostUpdate(float isnew) if(isnew) { #define FIX_FRAMETIME(f,ft) \ - switch(self.f) \ + if(IS_DEAD_FRAME(self.f)) \ { \ - case 0: \ - case 1: \ - self.ft = 0; \ - break; \ + self.ft = 0; \ } FIX_FRAMETIME(frame, frame1time) FIX_FRAMETIME(frame2, frame2time) FIX_FRAMETIME(frame3, frame3time) FIX_FRAMETIME(frame4, frame4time) } + self.csqcmodel_isdead = IS_DEAD_FRAME(self.frame); + if(self.csqcmodel_isdead) + self.csqcmodel_deathtime = self.frame1time; } float CSQCPlayer_FallbackFrame(float f) {