]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/csqcmodellib/cl_model.qc
Declare more ints as ints
[xonotic/xonotic-data.pk3dir.git] / qcsrc / csqcmodellib / cl_model.qc
index 2c7bc2d925da89fc0c1d971ad86e2ca696cddb2c..2be2c728ba8c755d337e3ab2d4c40c32d6099b46 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011 Rudolf Polzer
+ * Copyright (c) 2011 Rudolf PolzerCSQCModel_InterpolateAnimation_2To4_PreNote
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to
@@ -28,7 +28,7 @@ var float autocvar_cl_nolerp = 0;
 .float csqcmodel_lerpfractime;
 .float csqcmodel_lerpfrac2time;
 
-void CSQCModel_InterpolateAnimation_2To4_PreNote(float sf)
+void CSQCModel_InterpolateAnimation_2To4_PreNote(int sf)
 {
        if(sf & CSQCMODEL_PROPERTY_FRAME)
        {
@@ -47,7 +47,7 @@ void CSQCModel_InterpolateAnimation_2To4_PreNote(float sf)
                self.lerpfrac = self.csqcmodel_lerpfrac;
        }
 }
-void CSQCModel_InterpolateAnimation_1To2_PreNote(float sf)
+void CSQCModel_InterpolateAnimation_1To2_PreNote(int sf)
 {
        if(sf & CSQCMODEL_PROPERTY_FRAME)
        {
@@ -64,7 +64,7 @@ void CSQCModel_InterpolateAnimation_PreNote(float sf)
 #endif
 }
 
-void CSQCModel_InterpolateAnimation_2To4_Note(float sf, float set_times)
+void CSQCModel_InterpolateAnimation_2To4_Note(int sf, float set_times)
 {
        if(sf & CSQCMODEL_PROPERTY_FRAME)
        {
@@ -83,7 +83,7 @@ void CSQCModel_InterpolateAnimation_2To4_Note(float sf, float set_times)
                        self.csqcmodel_lerpfractime = time;
        }
 }
-void CSQCModel_InterpolateAnimation_1To2_Note(float sf, float set_times)
+void CSQCModel_InterpolateAnimation_1To2_Note(int sf, float set_times)
 {
        if(sf & CSQCMODEL_PROPERTY_FRAME)
        {
@@ -173,9 +173,9 @@ void CSQCModel_InterpolateAnimation_Do()
 void CSQCModel_Draw()
 {
        // some nice flags for CSQCMODEL_IF and the hooks
-       local noref float isplayer = (self.entnum >= 1 && self.entnum <= maxclients);
-       local noref float islocalplayer = (self.entnum == player_localnum + 1);
-       local noref float isnolocalplayer = (isplayer && (self.entnum != player_localnum + 1));
+       local noref bool isplayer = (self.entnum >= 1 && self.entnum <= maxclients);
+       local noref bool islocalplayer = (self.entnum == player_localnum + 1);
+       local noref bool isnolocalplayer = (isplayer && (self.entnum != player_localnum + 1));
 
        // we don't do this for the local player as that one is already handled
        // by CSQCPlayer_SetCamera()
@@ -202,13 +202,12 @@ void CSQCModel_Draw()
 
 void CSQCModel_Read(float isnew)
 {
-       float sf;
-       sf = ReadShort();
+       int sf = ReadInt24_t();
 
        // some nice flags for CSQCMODEL_IF and the hooks
-       local noref float isplayer = (self.entnum >= 1 && self.entnum <= maxclients);
-       local noref float islocalplayer = (self.entnum == player_localnum + 1);
-       local noref float isnolocalplayer = (isplayer && (self.entnum != player_localnum + 1));
+       local noref bool isplayer = (self.entnum >= 1 && self.entnum <= maxclients);
+       local noref bool islocalplayer = (self.entnum == player_localnum + 1);
+       local noref bool isnolocalplayer = (isplayer && (self.entnum != player_localnum + 1));
 
        self.classname = "csqcmodel";
        self.iflags |= IFLAG_ORIGIN; // interpolate origin too
@@ -236,15 +235,18 @@ void CSQCModel_Read(float isnew)
 #undef CSQCMODEL_IF
 
        if(sf & CSQCMODEL_PROPERTY_MODELINDEX)
+       {
+               vector pmin = self.mins, pmax = self.maxs;
                setmodelindex(self, self.modelindex); // this retrieves the .model key and sets mins/maxs/absmin/absmax
-               // FIXME do we WANT this to override mins/maxs?
+               setsize(self, pmin, pmax);
+       }
 
        if(sf & CSQCMODEL_PROPERTY_TELEPORTED)
        {
                self.iflags |= IFLAG_TELEPORTED;
                self.csqcmodel_teleported = 1;
        }
-       
+
        CSQCModel_InterpolateAnimation_Note(sf);
        InterpolateOrigin_Note();
        CSQCPlayer_PostUpdate();
@@ -260,11 +262,7 @@ void CSQCModel_Read(float isnew)
        setorigin(self, self.origin);
 
        // set obvious render flags
-#ifdef COMPAT_XON050_ENGINE
-       if(self.entnum == player_localentnum || self.entnum == spectatee_status)
-#else
        if(self.entnum == player_localentnum)
-#endif
                self.renderflags |= RF_EXTERNALMODEL;
        else
                self.renderflags &= ~RF_EXTERNALMODEL;