From: Mario Date: Mon, 2 Mar 2015 08:13:56 +0000 (+1100) Subject: Make it work X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=2551047e04af0aaa4474ad5d5a9a19d77ca55c11;p=xonotic%2Fxonotic-data.pk3dir.git Make it work --- diff --git a/qcsrc/client/csqcmodel_hooks.qc b/qcsrc/client/csqcmodel_hooks.qc index 5d169c9d7..cfadcd0eb 100644 --- a/qcsrc/client/csqcmodel_hooks.qc +++ b/qcsrc/client/csqcmodel_hooks.qc @@ -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) { diff --git a/qcsrc/client/hook.qc b/qcsrc/client/hook.qc index 8861067dd..5f6226fbe 100644 --- a/qcsrc/client/hook.qc +++ b/qcsrc/client/hook.qc @@ -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) { diff --git a/qcsrc/client/progs.src b/qcsrc/client/progs.src index ca206355c..019adbf23 100644 --- a/qcsrc/client/progs.src +++ b/qcsrc/client/progs.src @@ -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 diff --git a/qcsrc/common/viewloc.qc b/qcsrc/common/viewloc.qc index 960ad4c89..aedd9e81f 100644 --- a/qcsrc/common/viewloc.qc +++ b/qcsrc/common/viewloc.qc @@ -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) diff --git a/qcsrc/csqcmodellib/cl_player.qc b/qcsrc/csqcmodellib/cl_player.qc index 659a57c1c..331759218 100644 --- a/qcsrc/csqcmodellib/cl_player.qc +++ b/qcsrc/csqcmodellib/cl_player.qc @@ -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 diff --git a/qcsrc/server/cl_physics.qc b/qcsrc/server/cl_physics.qc index 697576972..c9de02d01 100644 --- a/qcsrc/server/cl_physics.qc +++ b/qcsrc/server/cl_physics.qc @@ -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) { diff --git a/qcsrc/server/progs.src b/qcsrc/server/progs.src index b94ef71a6..9698a6634 100644 --- a/qcsrc/server/progs.src +++ b/qcsrc/server/progs.src @@ -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 diff --git a/qcsrc/server/t_viewloc.qc b/qcsrc/server/t_viewloc.qc index ac53daf23..38c841c8e 100644 --- a/qcsrc/server/t_viewloc.qc +++ b/qcsrc/server/t_viewloc.qc @@ -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