]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/client/csqcmodel_hooks.qc
Merge branch 'master' into Mario/qc_physics_prehax
[xonotic/xonotic-data.pk3dir.git] / qcsrc / client / csqcmodel_hooks.qc
index 1231a3de941780541f2f67d0634a7660938c6b0f..92cef15efff3316b3f936aa2dca50a95f359e575 100644 (file)
@@ -1,3 +1,25 @@
+#include "csqcmodel_hooks.qh"
+#include "_all.qh"
+
+#include "gibs.qh"
+#include "player_skeleton.qh"
+#include "sortlist.qh"
+
+#include "weapons/projectile.qh"
+
+#include "../common/animdecide.qh"
+#include "../common/csqcmodel_settings.qh"
+#include "../common/teams.qh"
+
+#include "../csqcmodellib/cl_model.qh"
+#include "../csqcmodellib/cl_player.qh"
+#include "../csqcmodellib/interpolate.qh"
+
+#include "../warpzonelib/mathlib.qh"
+
+.float death_time;
+.int modelflags;
+
 void CSQCModel_Hook_PreDraw(bool isplayer);
 
 .bool isplayermodel;
@@ -267,7 +289,7 @@ void CSQCPlayer_ModelAppearance_Apply(bool islocalplayer)
 
        // GLOWMOD AND DEATH FADING
        if(self.colormap > 0)
-               self.glowmod = colormapPaletteColor(((self.colormap >= 1024) ? self.colormap : stof(getplayerkeyvalue(self.colormap - 1, "colors"))) & 0x0F, TRUE) * 2;
+               self.glowmod = colormapPaletteColor(((self.colormap >= 1024) ? self.colormap : stof(getplayerkeyvalue(self.colormap - 1, "colors"))) & 0x0F, true) * 2;
        else
                self.glowmod = '1 1 1';
 
@@ -280,9 +302,9 @@ void CSQCPlayer_ModelAppearance_Apply(bool islocalplayer)
                        self.colormap = 0;
 
                        self.glowmod = self.old_glowmod * bound(0, 1 - (time - self.death_time) / autocvar_cl_deathglow, 1);
-                       self.glowmod_x = max(self.glowmod_x, 0.0001);
-                       self.glowmod_y = max(self.glowmod_y, 0.0001);
-                       self.glowmod_z = max(self.glowmod_z, 0.0001);
+                       self.glowmod_x = max(self.glowmod.x, 0.0001);
+                       self.glowmod_y = max(self.glowmod.y, 0.0001);
+                       self.glowmod_z = max(self.glowmod.z, 0.0001);
                }
                else if(self.old_glowmod != '0 0 0') { self.old_glowmod = '0 0 0'; }
        }
@@ -322,16 +344,15 @@ void CSQCPlayer_FallbackFrame_PostUpdate(bool isnew)
        // player "pops in"
        if(isnew)
        {
-#define FIX_FRAMETIME(f,ft) \
-               if(IS_DEAD_FRAME(self.f) && self.ft != 0 && self.death_time != 0) \
-               { \
-                       self.ft = self.death_time; \
-               }
-               FIX_FRAMETIME(frame, frame1time)
-               FIX_FRAMETIME(frame2, frame2time)
+#define FIX_FRAMETIME(f,ft) do {                                                                                                                                                                       \
+               if(IS_DEAD_FRAME(self.f) && self.ft != 0 && self.death_time != 0)                                                                                       \
+                       self.ft = self.death_time;                                                                                                                                                              \
+} while(0)
+               FIX_FRAMETIME(frame, frame1time);
+               FIX_FRAMETIME(frame2, frame2time);
 #ifdef CSQCMODEL_HAVE_TWO_FRAMES
-               FIX_FRAMETIME(frame3, frame3time)
-               FIX_FRAMETIME(frame4, frame4time)
+               FIX_FRAMETIME(frame3, frame3time);
+               FIX_FRAMETIME(frame4, frame4time);
 #endif
        }
        self.csqcmodel_isdead = IS_DEAD_FRAME(self.frame);
@@ -485,11 +506,10 @@ void CSQCModel_Effects_PostUpdate(void)
        if(self.csqcmodel_teleported)
                Projectile_ResetTrail(self.origin);
 }
-.bool snd_looping;
+.int snd_looping;
 void CSQCModel_Effects_Apply(void)
 {
-       int eff = self.csqcmodel_effects;
-       eff &= ~CSQCMODEL_EF_RESPAWNGHOST;
+       int eff = self.csqcmodel_effects & ~CSQCMODEL_EF_RESPAWNGHOST;
 
        self.renderflags &= ~(RF_DEPTHHACK | RF_ADDITIVE | RF_FULLBRIGHT | EF_NOSHADOW | RF_USEAXIS);
        self.effects = 0;
@@ -635,13 +655,13 @@ void CSQCModel_Hook_PreDraw(bool isplayer)
                        bool onground = 0;
                        if(self == csqcplayer)
                        {
-                               if(self.pmove_flags & PMF_ONGROUND)
+                               if(self.flags & FL_ONGROUND)
                                        onground = 1;
-                               self.anim_prev_pmove_flags = self.pmove_flags;
-                               if(self.pmove_flags & PMF_DUCKED)
-                                       animdecide_setstate(self, self.anim_state | ANIMSTATE_DUCK, FALSE);
+                               self.anim_prev_pmove_flags = self.flags;
+                               if(self.flags & FL_DUCKED)
+                                       animdecide_setstate(self, self.anim_state | ANIMSTATE_DUCK, false);
                                else if(self.anim_state & ANIMSTATE_DUCK)
-                                       animdecide_setstate(self, self.anim_state - ANIMSTATE_DUCK, FALSE);
+                                       animdecide_setstate(self, self.anim_state - ANIMSTATE_DUCK, false);
                        }
                        else
                        {
@@ -669,7 +689,7 @@ void CSQCModel_Hook_PreDraw(bool isplayer)
                        self.frame1time = self.anim_frame1time;
                        self.frame2 = self.anim_frame2;
                        self.frame2time = self.anim_frame2time;
-                       CSQCModel_InterpolateAnimation_2To4_Note(sf | CSQCMODEL_PROPERTY_LERPFRAC, FALSE);
+                       CSQCModel_InterpolateAnimation_2To4_Note(sf | CSQCMODEL_PROPERTY_LERPFRAC, false);
                        CSQCModel_InterpolateAnimation_2To4_Do();
                        if(doblend)
                        {