// database for misc stuff
float tempdb;
float ClientProgsDB;
-vector hook_shotorigin;
-vector electro_shotorigin;
+vector hook_shotorigin[4];
+vector electro_shotorigin[4];
#ifdef BLURTEST
float blurtest_time0, blurtest_time1, blurtest_radius, blurtest_power;
nb_pb_period = ReadByte() / 32; //Accuracy of 1/32th
- hook_shotorigin_x = ReadCoord();
- hook_shotorigin_y = ReadCoord();
- hook_shotorigin_z = ReadCoord();
- electro_shotorigin_x = ReadCoord();
- electro_shotorigin_y = ReadCoord();
- electro_shotorigin_z = ReadCoord();
+ hook_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
+ hook_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
+ hook_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
+ hook_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
+ electro_shotorigin[0] = decompressShotOrigin(ReadInt24_t());
+ electro_shotorigin[1] = decompressShotOrigin(ReadInt24_t());
+ electro_shotorigin[2] = decompressShotOrigin(ReadInt24_t());
+ electro_shotorigin[3] = decompressShotOrigin(ReadInt24_t());
if(forcefog)
strunzone(forcefog);
string tex;
vector rgb;
float t;
+ float s;
+ vector vs;
if(time < self.HookKillTime)
{
+ s = cvar("cl_gunalign");
+ if(s != 1 && s != 2 && s != 4)
+ s = 3; // default value
+ --s;
+ vs = hook_shotorigin[s];
+
if(self.sv_entnum == player_localentnum - 1)
- a = view_origin + view_forward * hook_shotorigin_x + view_right * hook_shotorigin_y + view_up * hook_shotorigin_z;
+ a = view_origin + view_forward * vs_x + view_right * vs_y + view_up * vs_z;
else
a = self.HookStart;
b = self.HookEnd;
if(time < self.LGBeamKillTime)
{
+ s = cvar("cl_gunalign");
+ if(s != 1 && s != 2 && s != 4)
+ s = 3; // default value
+ --s;
+ vs = electro_shotorigin[s];
+
if(self.sv_entnum == player_localentnum - 1)
- a = view_origin + view_forward * electro_shotorigin_x + view_right * electro_shotorigin_y + view_up * electro_shotorigin_z;
+ a = view_origin + view_forward * vs_x + view_right * vs_y + view_up * vs_z;
else
a = self.LGBeamStart;
b = self.LGBeamEnd;
{
WriteByte(MSG_ENTITY, ENT_CLIENT_INIT);
WriteByte(MSG_ENTITY, g_nexball_meter_period * 32);
- WriteCoord(MSG_ENTITY, hook_shotorigin_x);
- WriteCoord(MSG_ENTITY, hook_shotorigin_y);
- WriteCoord(MSG_ENTITY, hook_shotorigin_z);
- WriteCoord(MSG_ENTITY, electro_shotorigin_x);
- WriteCoord(MSG_ENTITY, electro_shotorigin_y);
- WriteCoord(MSG_ENTITY, electro_shotorigin_z);
+ WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[0]));
+ WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[1]));
+ WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[2]));
+ WriteInt24_t(MSG_ENTITY, compressShotOrigin(hook_shotorigin[3]));
+ WriteInt24_t(MSG_ENTITY, compressShotOrigin(electro_shotorigin[0]));
+ WriteInt24_t(MSG_ENTITY, compressShotOrigin(electro_shotorigin[1]));
+ WriteInt24_t(MSG_ENTITY, compressShotOrigin(electro_shotorigin[2]));
+ WriteInt24_t(MSG_ENTITY, compressShotOrigin(electro_shotorigin[3]));
if(sv_foginterval && world.fog != "")
WriteString(MSG_ENTITY, world.fog);
else
void GrapplingHookThink()
{
- float spd, dist, minlength, pullspeed, ropestretch, ropeairfriction, rubberforce, newlength, rubberforce_overstretch;
- vector dir, org, end, v0, dv, v, myorg;
+ float spd, dist, minlength, pullspeed, ropestretch, ropeairfriction, rubberforce, newlength, rubberforce_overstretch, s;
+ vector dir, org, end, v0, dv, v, myorg, vs;
if(self.owner.health <= 0 || self.owner.hook != self) // how did that happen?
{ // well, better fix it anyway
remove(self);
self.nextthink = time;
+ s = self.owner.cvar_cl_gunalign;
+ if(s != 1 && s != 2 && s != 4)
+ s = 3; // default value
+ --s;
+ vs = hook_shotorigin[s];
+
makevectors(self.owner.v_angle);
- org = self.owner.origin + self.owner.view_ofs + v_forward * hook_shotorigin_x + v_right * hook_shotorigin_y + v_up * hook_shotorigin_z;
+ org = self.owner.origin + self.owner.view_ofs + v_forward * vs_x + v_right * vs_y + v_up * vs_z;
myorg = WarpZone_RefSys_TransformOrigin(self.owner, self, org);
if(self.hook_length < 0)
{
local entity missile;
local vector org;
+ float s;
+ vector vs;
if((arena_roundbased && time < warmup) || (time < game_starttime))
return;
makevectors(self.v_angle);
+ s = self.cvar_cl_gunalign;
+ if(s != 1 && s != 2 && s != 4)
+ s = 3; // default value
+ --s;
+ vs = hook_shotorigin[s];
+
// UGLY WORKAROUND: play this on CHAN_WEAPON2 so it can't cut off fire sounds
sound (self, CHAN_WEAPON2, "weapons/hook_fire.wav", VOL_BASE, ATTN_NORM);
- org = self.origin + self.view_ofs + v_forward * hook_shotorigin_x + v_right * hook_shotorigin_y + v_up * hook_shotorigin_z;
+ org = self.origin + self.view_ofs + v_forward * vs_x + v_right * vs_y + v_up * vs_z;
pointparticles(particleeffectnum("grapple_muzzleflash"), org, '0 0 0', 1);
missile = WarpZone_RefSys_SpawnSameRefSys(self);
void GrappleHookInit()
{
if(g_grappling_hook)
- hook_shotorigin = '8 -8 -12';
+ {
+ hook_shotorigin[0] = '8 -8 -12';
+ hook_shotorigin[1] = '8 -8 -12';
+ hook_shotorigin[2] = '8 -8 -12';
+ hook_shotorigin[3] = '8 -8 -12';
+ }
else
{
weapon_action(WEP_HOOK, WR_PRECACHE);
- hook_shotorigin = shotorg_adjust(CL_Weapon_GetShotOrg(WEP_HOOK), TRUE, FALSE);
+ hook_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK), TRUE, FALSE, 1);
+ hook_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK), TRUE, FALSE, 2);
+ hook_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK), TRUE, FALSE, 3);
+ hook_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_HOOK), TRUE, FALSE, 4);
}
}
.float hook_state;
void GrappleHookInit();
-vector hook_shotorigin;
+vector hook_shotorigin[4];
" ", ftos(tstart), " ", ftos(dt), "\n"));
}
-vector shotorg_adjustfromclient(vector vecs, float y_is_right, float allowcenter)
+vector shotorg_adjustfromclient(vector vecs, float y_is_right, float allowcenter, float algn)
{
- switch(self.owner.cvar_cl_gunalign)
+ switch(algn)
{
case 1: // right
break;
return vecs;
}
-vector shotorg_adjust(vector vecs, float y_is_right, float visual)
+vector shotorg_adjust_values(vector vecs, float y_is_right, float visual, float algn)
{
string s;
vector v;
{
if (visual)
{
- vecs = shotorg_adjustfromclient(vecs, y_is_right, TRUE);
+ vecs = shotorg_adjustfromclient(vecs, y_is_right, TRUE, algn);
}
else
{
{
if (visual)
{
- vecs = shotorg_adjustfromclient(vecs, y_is_right, TRUE);
+ vecs = shotorg_adjustfromclient(vecs, y_is_right, TRUE, algn);
}
else
{
}
else if (cvar("g_shootfromclient"))
{
- vecs = shotorg_adjustfromclient(vecs, y_is_right, (cvar("g_shootfromclient") >= 2));
+ vecs = shotorg_adjustfromclient(vecs, y_is_right, (cvar("g_shootfromclient") >= 2), algn);
}
return vecs;
}
+vector shotorg_adjust(vector vecs, float y_is_right, float visual)
+{
+ return shotorg_adjust_values(vecs, y_is_right, visual, self.owner.cvar_cl_gunalign);
+}
void attach_sameorigin(entity e, entity to, string tag)
void ElectroInit()
{
weapon_action(WEP_ELECTRO, WR_PRECACHE);
- electro_shotorigin = shotorg_adjust(CL_Weapon_GetShotOrg(WEP_ELECTRO), TRUE, FALSE);
+ electro_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), TRUE, FALSE, 1);
+ electro_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), TRUE, FALSE, 2);
+ electro_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), TRUE, FALSE, 3);
+ electro_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), TRUE, FALSE, 4);
}
void spawnfunc_weapon_electro (void)
void ElectroInit();
-vector electro_shotorigin;
+vector electro_shotorigin[4];