From: Mario Date: Sun, 16 Jul 2017 14:09:30 +0000 (+1000) Subject: Move racecar_angles into the bugrigs file X-Git-Tag: xonotic-v0.8.5~2598 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=926c661916abe4e27456dd977025fe4c56042626;p=xonotic%2Fxonotic-data.pk3dir.git Move racecar_angles into the bugrigs file --- diff --git a/qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc b/qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc index 0293f4d6a..40f19d6b1 100644 --- a/qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc +++ b/qcsrc/common/mutators/mutator/bugrigs/bugrigs.qc @@ -63,6 +63,24 @@ void bugrigs_SetVars() #endif +float racecar_angle(float forward, float down) +{ + if (forward < 0) + { + forward = -forward; + down = -down; + } + + float ret = vectoyaw('0 1 0' * down + '1 0 0' * forward); + + float angle_mult = forward / (800 + forward); + + if (ret > 180) + return ret * angle_mult + 360 * (1 - angle_mult); + else + return ret * angle_mult; +} + void RaceCarPhysics(entity this, float dt) { // using this move type for "big rigs" @@ -202,11 +220,11 @@ void RaceCarPhysics(entity this, float dt) { // now set angles_x so that the car points parallel to the surface this.angles = vectoangles( - '1 0 0' * v_forward_x * trace_plane_normal_z + '1 0 0' * v_forward.x * trace_plane_normal.z + - '0 1 0' * v_forward_y * trace_plane_normal_z + '0 1 0' * v_forward.y * trace_plane_normal.z + - '0 0 1' * -(v_forward_x * trace_plane_normal_x + v_forward_y * trace_plane_normal_y) + '0 0 1' * -(v_forward.x * trace_plane_normal.x + v_forward.y * trace_plane_normal.y) ); SET_ONGROUND(this); } @@ -231,11 +249,11 @@ void RaceCarPhysics(entity this, float dt) if (trace_fraction != 1) { this.angles = vectoangles2( - '1 0 0' * v_forward_x * trace_plane_normal_z + '1 0 0' * v_forward.x * trace_plane_normal.z + - '0 1 0' * v_forward_y * trace_plane_normal_z + '0 1 0' * v_forward.y * trace_plane_normal.z + - '0 0 1' * -(v_forward_x * trace_plane_normal_x + v_forward_y * trace_plane_normal_y), + '0 0 1' * -(v_forward.x * trace_plane_normal.x + v_forward.y * trace_plane_normal.y), trace_plane_normal ); } @@ -243,12 +261,12 @@ void RaceCarPhysics(entity this, float dt) { vector vel_local; - vel_local_x = v_forward * this.velocity; - vel_local_y = v_right * this.velocity; - vel_local_z = v_up * this.velocity; + vel_local.x = v_forward * this.velocity; + vel_local.y = v_right * this.velocity; + vel_local.z = v_up * this.velocity; - this.angles_x = racecar_angle(vel_local_x, vel_local_z); - this.angles_z = racecar_angle(-vel_local_y, vel_local_z); + this.angles_x = racecar_angle(vel_local.x, vel_local.z); + this.angles_z = racecar_angle(-vel_local.y, vel_local.z); } // smooth the angles @@ -263,8 +281,8 @@ void RaceCarPhysics(entity this, float dt) vf1 = vf1 + v_forward * (1 - f); vu1 = vu1 + v_up * (1 - f); smoothangles = vectoangles2(vf1, vu1); - this.angles_x = -smoothangles_x; - this.angles_z = smoothangles_z; + this.angles_x = -smoothangles.x; + this.angles_z = smoothangles.z; } #ifdef SVQC diff --git a/qcsrc/common/physics/player.qc b/qcsrc/common/physics/player.qc index 587156bd6..47249356b 100644 --- a/qcsrc/common/physics/player.qc +++ b/qcsrc/common/physics/player.qc @@ -477,24 +477,6 @@ void CheckPlayerJump(entity this) CheckWaterJump(this); } -float racecar_angle(float forward, float down) -{ - if (forward < 0) - { - forward = -forward; - down = -down; - } - - float ret = vectoyaw('0 1 0' * down + '1 0 0' * forward); - - float angle_mult = forward / (800 + forward); - - if (ret > 180) - return ret * angle_mult + 360 * (1 - angle_mult); - else - return ret * angle_mult; -} - #ifdef SVQC string specialcommand = "xwxwxsxsxaxdxaxdx1x "; .float specialcommand_pos; diff --git a/qcsrc/server/client.qc b/qcsrc/server/client.qc index 490b41157..ec6d292d9 100644 --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@ -2262,7 +2262,7 @@ bool PlayerThink(entity this) } this.items_added = 0; - if (this.items & ITEM_Jetpack.m_itemid && (this.items & ITEM_JetpackRegen.m_itemid || this.ammo_fuel >= 0.01)) + if ((this.items & ITEM_Jetpack.m_itemid) && ((this.items & ITEM_JetpackRegen.m_itemid) || this.ammo_fuel >= 0.01)) this.items_added |= IT_FUEL; this.items |= this.items_added; @@ -2721,7 +2721,6 @@ void PlayerPostThink (entity this) CheatFrame(this); - //CheckPlayerJump(); if (game_stopped) { this.solid = SOLID_NOT;