do not rewrite colormap on corpses (but do rewrite in CopyBody cheats)
authorRudolf Polzer <divverent@alientrap.org>
Wed, 15 Feb 2012 11:20:00 +0000 (12:20 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Wed, 15 Feb 2012 11:20:00 +0000 (12:20 +0100)
qcsrc/server/cheats.qc
qcsrc/server/cl_player.qc

index 5ba8609..b348765 100644 (file)
@@ -1,4 +1,4 @@
-void CopyBody(float keepvelocity);
+entity CopyBody(float keepvelocity);
 
 #ifdef NOCHEATS
 
@@ -158,15 +158,18 @@ float CheatImpulse(float i)
                case CHIMPULSE_CLONE_MOVING:
                        IS_CHEAT(i, 0, 0);
                        makevectors (self.v_angle);
-                       self.velocity = self.velocity + v_forward * 300;
-                       CopyBody(1);
+                       e = CopyBody(1);
+                       if(e.colormap <= maxclients && e.colormap > 0)
+                               e.colormap = 1024 + self.clientcolors;
+                       e.velocity = e.velocity + v_forward * 300;
                        self.lip += 1;
-                       self.velocity = self.velocity - v_forward * 300;
                        DID_CHEAT();
                        break;
                case CHIMPULSE_CLONE_STANDING:
                        IS_CHEAT(i, 0, 0);
-                       CopyBody(0);
+                       e = CopyBody(0);
+                       if(e.colormap <= maxclients && e.colormap > 0)
+                               e.colormap = 1024 + self.clientcolors;
                        self.lip += 1;
                        DID_CHEAT();
                        break;
index 49b5255..86763c7 100644 (file)
@@ -140,13 +140,14 @@ void CopyBody_Think(void)
        CSQCMODEL_AUTOUPDATE();
        self.nextthink = time;
 }
-void CopyBody(float keepvelocity)
+entity CopyBody(float keepvelocity)
 {
+       entity ret;
        entity oldself;
        if (self.effects & EF_NODRAW)
-               return;
+               return world;
        oldself = self;
-       self = spawn();
+       ret = self = spawn();
        self.enemy = oldself;
        self.lip = oldself.lip;
        self.colormap = oldself.colormap;
@@ -200,9 +201,6 @@ void CopyBody(float keepvelocity)
 
        self.owner = oldself;
 
-       if(self.colormap <= maxclients && self.colormap > 0)
-               self.colormap = 1024 + oldself.clientcolors;
-
        CSQCMODEL_AUTOINIT();
        self.CopyBody_nextthink = oldself.nextthink;
        self.CopyBody_think = oldself.think;
@@ -210,6 +208,8 @@ void CopyBody(float keepvelocity)
        self.think = CopyBody_Think;
 
        self = oldself;
+
+       return ret;
 }
 
 float player_getspecies()