]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Player colored hooks, also show hook coming from player in 3rd person mode
authorMario <mario.mario@y7mail.com>
Wed, 7 May 2014 18:53:16 +0000 (04:53 +1000)
committerMario <mario.mario@y7mail.com>
Wed, 7 May 2014 18:53:16 +0000 (04:53 +1000)
particles/hook_green.tga [deleted file]
particles/hook_white.tga [new file with mode: 0644]
qcsrc/client/hook.qc
qcsrc/client/miscfunctions.qc

diff --git a/particles/hook_green.tga b/particles/hook_green.tga
deleted file mode 100644 (file)
index e01eb47..0000000
Binary files a/particles/hook_green.tga and /dev/null differ
diff --git a/particles/hook_white.tga b/particles/hook_white.tga
new file mode 100644 (file)
index 0000000..c60f070
Binary files /dev/null and b/particles/hook_white.tga differ
index 196730a72dde016cbe3fd28308955ed2c2de6ee1..889e75d2679dc65cb7bfd18726479fd38fd8f97f 100644 (file)
@@ -83,7 +83,7 @@ void Draw_GrapplingHook()
                        break;
        }
 
-       if((self.owner.sv_entnum == player_localentnum - 1))
+       if((self.owner.sv_entnum == player_localentnum - 1) && autocvar_chase_active <= 0)
        {
                switch(self.HookType)
                {
@@ -129,30 +129,13 @@ void Draw_GrapplingHook()
                case ENT_CLIENT_HOOK:
                        intensity = 1;
                        offset = 0;
-                       if(t == NUM_TEAM_1)
+                       switch(t)
                        {
-                               tex = "particles/hook_red";
-                               rgb = '1 .3 .3';
-                       }
-                       else if(t == NUM_TEAM_2)
-                       {
-                               tex = "particles/hook_blue";
-                               rgb = '.3 .3 1';
-                       }
-                       else if(t == NUM_TEAM_3)
-                       {
-                               tex = "particles/hook_yellow";
-                               rgb = '1 1 .3';
-                       }
-                       else if(t == NUM_TEAM_4)
-                       {
-                               tex = "particles/hook_pink";
-                               rgb = '1 .3 1';
-                       }
-                       else
-                       {
-                               tex = "particles/hook_green";
-                               rgb = '.3 1 .3';
+                               case NUM_TEAM_1: tex = "particles/hook_red"; rgb = '1 0.3 0.3'; break;
+                               case NUM_TEAM_2: tex = "particles/hook_blue"; rgb = '0.3 0.3 1'; break;
+                               case NUM_TEAM_3: tex = "particles/hook_yellow"; rgb = '1 1 0.3'; break;
+                               case NUM_TEAM_4: tex = "particles/hook_pink"; rgb = '1 0.3 1'; break;
+                               default: tex = "particles/hook_white"; rgb = getcsqcplayercolor(self.sv_entnum); break;
                        }
                        break;
                case ENT_CLIENT_LGBEAM:
@@ -232,7 +215,9 @@ void Ent_ReadHook(float bIsNew, float type)
 
        if(sf & 1)
        {
-               self.owner = playerslots[ReadByte() - 1];
+               float myowner = ReadByte();
+               self.owner = playerslots[myowner - 1];
+               self.sv_entnum = myowner;
                switch(self.HookType)
                {
                        default:
index fbdbc45f3a3c25a0c5f4f650c7cba9cfe2349b53..8b674e7826c2ccd6529e46a703d55ee00a21a2ae 100644 (file)
@@ -589,6 +589,20 @@ float getplayeralpha(float pl)
        return 1;
 }
 
+vector getcsqcplayercolor(float pl)
+{
+       entity e;
+
+       e = CSQCModel_server2csqc(pl);
+       if(e)
+       {
+               if(e.colormap > 0)
+                       return colormapPaletteColor(((e.colormap >= 1024) ? e.colormap : stof(getplayerkeyvalue(e.colormap - 1, "colors"))) & 0x0F, TRUE);
+       }
+
+       return '1 1 1';
+}
+
 float getplayerisdead(float pl)
 {
        entity e;