cheaper clientmodel draw code
authorRudolf Polzer <divverent@alientrap.org>
Thu, 14 Oct 2010 11:22:21 +0000 (13:22 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Thu, 14 Oct 2010 11:22:21 +0000 (13:22 +0200)
qcsrc/client/wall.qc

index d04ab8eb3649a095f7ea90b172430dcbd48f277e..1c30f4eec289b6b3cedd9aefc6b08390cbc52373 100644 (file)
@@ -2,6 +2,7 @@
 .float bgmscriptangular;
 .float lodmodelindex0, lodmodelindex1, lodmodelindex2;
 .float loddistance1, loddistance2;
+.vector saved;
 
 void Ent_Wall_Draw()
 {
@@ -10,6 +11,11 @@ void Ent_Wall_Draw()
        vector save;
        var .vector fld;
 
+       if(self.bgmscriptangular)
+               self.angles = self.saved;
+       else
+               self.origin = self.saved;
+
        if(self.lodmodelindex1)
        {
                d = cvar("loddebug");
@@ -37,11 +43,10 @@ void Ent_Wall_Draw()
        InterpolateOrigin_Do();
 
        if(self.bgmscriptangular)
-               fld = angles;
+               self.saved = self.angles;
        else
-               fld = origin;
-       
-       save = self.fld;
+               self.saved = self.origin;
+
        f = BGMScript(self);
        if(f >= 0)
        {
@@ -55,9 +60,9 @@ void Ent_Wall_Draw()
                self.alpha = 1;
 
        if(self.alpha >= ALPHA_MIN_VISIBLE)
-               R_AddEntity(self);
-
-       self.fld = save;
+               self.drawmask = MASK_NORMAL;
+       else
+               self.drawmask = 0;
 }
 
 void Ent_Wall_Remove()
@@ -73,6 +78,11 @@ void Ent_Wall()
        InterpolateOrigin_Undo();
        self.iflags = IFLAG_ANGLES;
 
+       if(self.bgmscriptangular)
+               self.angles = self.saved;
+       else
+               self.origin = self.saved;
+
        f = ReadByte();
 
        if(f & 1)
@@ -161,6 +171,11 @@ void Ent_Wall()
 
        InterpolateOrigin_Note();
 
+       if(self.bgmscriptangular)
+               self.saved = self.angles;
+       else
+               self.saved = self.origin;
+
        self.entremove = Ent_Wall_Remove;
        self.draw = Ent_Wall_Draw;
 }