]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Make it work
authorMario <zacjardine@y7mail.com>
Mon, 2 Mar 2015 08:13:56 +0000 (19:13 +1100)
committerMario <zacjardine@y7mail.com>
Mon, 2 Mar 2015 08:13:56 +0000 (19:13 +1100)
qcsrc/client/csqcmodel_hooks.qc
qcsrc/client/hook.qc
qcsrc/client/progs.src
qcsrc/common/viewloc.qc
qcsrc/csqcmodellib/cl_player.qc
qcsrc/server/cl_physics.qc
qcsrc/server/progs.src
qcsrc/server/t_viewloc.qc

index 5d169c9d7ceade86e64820ad02753459c2efe003..cfadcd0ebc1d57441c14091ac81ecb1eedb6bfa8 100644 (file)
@@ -404,7 +404,11 @@ void CSQCModel_AutoTagIndex_Apply(void)
        if(self.tag_entity && wasfreed(self.tag_entity))
                self.tag_entity = world;
 
-       viewloc_SetTags();
+       if(self.viewloc && wasfreed(self.viewloc))
+               self.viewloc = world;
+
+       if(self.viewloc.entnum != self.tag_networkviewloc)
+               self.viewloc = findfloat(world, entnum, self.tag_networkviewloc);
 
        if(self.tag_networkentity)
        {
index 8861067dd62f8911cab23852b02cc431d592a496..5f6226fbefca0216ea6a21c11e4882495c43b975 100644 (file)
@@ -84,7 +84,30 @@ void Draw_GrapplingHook()
                        break;
        }
 
-       if((self.owner.sv_entnum == player_localentnum - 1) && autocvar_chase_active <= 0)
+       entity view = CSQCModel_server2csqc(self.owner.sv_entnum + 1);
+       if(view.viewloc)
+       {
+               makevectors(view.angles);
+               vector org = view.origin + view.view_ofs;
+               switch(self.HookType)
+               {
+                       default:
+                       case ENT_CLIENT_HOOK:
+                               a = org + v_forward * vs.x + v_right * -vs.y + v_up * vs.z;
+                               b = self.origin;
+                               break;
+                       case ENT_CLIENT_ARC_BEAM:
+                               if(self.HookRange)
+                                       b = org + v_forward * self.HookRange;
+                               else
+                                       b = org + v_forward * vlen(self.velocity - self.origin); // honor original length of beam!
+                               WarpZone_TraceLine(org, b, MOVE_NORMAL, world);
+                               b = WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos);
+                               a = org + v_forward * vs.x + v_right * -vs.y + v_up * vs.z;
+                               break;
+               }
+       }
+       else if((self.owner.sv_entnum == player_localentnum - 1) && autocvar_chase_active <= 0)
        {
                switch(self.HookType)
                {
index ca206355c56c14246585516bb7eafc42238c86d3..019adbf2315405ba8ae28f861825576d1d352fb9 100644 (file)
@@ -71,6 +71,8 @@ weapons/projectile.qc // TODO
 ../common/vehicles/cl_vehicles.qc
 ../common/vehicles/vehicles.qc
 
+../common/viewloc.qc
+
 ../common/weapons/weapons.qc // TODO
 
 ../csqcmodellib/cl_model.qc
index 960ad4c897c0995fea3b2ca96e3f49a913e155c6..aedd9e81f546f90d0ba90ec0cab68ddd3cda14b8 100644 (file)
@@ -1,6 +1,3 @@
-//#define COMPAT_VEX
-
-#ifndef COMPAT_VEX
 #include "util.qh"
 
 #if defined(CSQC)
@@ -11,7 +8,6 @@
 #elif defined(SVQC)
        #include "../server/defs.qh"
 #endif
-#endif
 
 #ifdef SVQC
 
@@ -52,10 +48,6 @@ void viewloc_PlayerPhysics()
 
 void viewloc_SetTags()
 {
-#ifdef COMPAT_VEX
-       entity self = CSQCModel_server2csqc(player_localentnum);
-#endif
-
        if(self.viewloc && wasfreed(self.viewloc))
                self.viewloc = world;
 
@@ -66,19 +58,10 @@ void viewloc_SetTags()
                self.viewloc = findfloat(world, entnum, self.tag_networkviewloc);
 }
 
-#ifdef COMPAT_VEX
-entity view;
-#endif
+vector old_camera_angle = '0 0 0';
 void viewloc_SetViewLocation()
 {
-#ifdef COMPAT_VEX
-       if(!view) { view = spawn(); }
-
-       view.viewloc = findfloat(world, entnum, getstati(STAT_VIEWLOC));
-       view.origin = pmove_org;
-#else
        entity view = CSQCModel_server2csqc(player_localentnum);
-#endif
        if(!view) { return; }
        //NOTE: the "cam_" cvars sould probably be changed out with a spawnflag or an entity key. I have it like this for my testing -- Player_2
        if(view.viewloc && !wasfreed(view.viewloc) && view.viewloc.enemy && view.viewloc.goalentity)
index 659a57c1c1b3664896aa9b8c5b1afefb9748e791..3317592184b6f0d5444632dbf8d87b69429fd085 100644 (file)
@@ -33,6 +33,7 @@
        #include "cl_model.qh"
        #include "cl_player.qh"
        #include "../server/t_viewloc.qh"
+       #include "../common/viewloc.qh"
 #elif defined(MENUQC)
 #elif defined(SVQC)
 #endif
index 69757697275707992c027c43ea39f2b85c652108..c9de02d01cce42a8429127b8c0ab6989d92a74d7 100644 (file)
@@ -25,6 +25,7 @@
     #include "race.qh"
     #include "playerdemo.qh"
        #include "t_viewloc.qh"
+       #include "../common/viewloc.qh"
 #endif
 
 .float race_penalty;
@@ -863,7 +864,34 @@ void SV_PlayerPhysics()
        if(time < self.ladder_time)
                self.disableclientprediction = 1;
 
-       viewloc_PlayerPhysics();
+       if(self.viewloc)
+       {
+               self.disableclientprediction = 1;
+               vector oldmovement = self.movement;
+               self.movement_x = oldmovement_y;
+               self.movement_y = 0;
+
+               if(self.movement_x < 0)
+                       self.movement_x = -self.movement_x;
+
+               vector level_start, level_end;
+               level_start = self.viewloc.enemy.origin;
+               level_end = self.viewloc.goalentity.origin;
+               vector forward, backward;
+               forward = vectoangles(normalize(level_end - level_start));
+               backward = vectoangles(normalize(level_start - level_end));
+
+               if(self.movement_x < 0) // left
+                       self.angles = backward;
+               if(self.movement_x > 0) // right
+                       self.angles = forward;
+
+               if(oldmovement_x > 0)
+                       self.v_angle_x = self.angles_x = -50;
+               
+               if(!self.BUTTON_CROUCH)
+                       self.BUTTON_CROUCH = (oldmovement_x < 0);
+       }
 
        if(self.frozen)
        {
index b94ef71a619ac12791970c869758467beaf236c6..9698a663449a222f0e3538042728f2df555995e2 100644 (file)
@@ -113,6 +113,7 @@ weapons/weaponsystem.qc
 ../common/turrets/turrets.qc
 ../common/turrets/util.qc
 ../common/vehicles/vehicles_include.qc
+../common/viewloc.qc
 ../common/urllib.qc
 ../common/util.qc
 ../common/weapons/config.qc
index ac53daf23808466bb0b02d6faeeb90658159bb1a..38c841c8eda626c35e4ca8b1de185ffb315828f0 100644 (file)
@@ -1,4 +1,3 @@
-#ifndef COMPAT_VEX
 #if defined(CSQC)
 #elif defined(MENUQC)
 #elif defined(SVQC)
@@ -7,7 +6,6 @@
     #include "defs.qh"
        #include "t_viewloc.qh"
 #endif
-#endif
 
 #ifdef SVQC