Permalink
Browse files

game/cgame: fix scope weapon reticle not cleared on prone moving and …

…fix animation break when prone moving refs #1065
  • Loading branch information...
Aranud committed Dec 6, 2017
1 parent 8374f6a commit cf74f7d5c3ff9958e79b04546162ad0bab6e79fb
Showing with 12 additions and 18 deletions.
  1. +2 −2 src/cgame/cg_draw.c
  2. +10 −16 src/game/bg_pmove.c
View
@@ -1137,8 +1137,8 @@ static void CG_DrawCrosshair(void)
{
if (!BG_PlayerMounted(cg.snap->ps.eFlags))
{
// don't let players run with rifles -- speed 80 == crouch, 128 == walk, 256 == run
if (VectorLengthSquared(cg.snap->ps.velocity) > Square(160))
// don't let players prone moving and run with rifles -- speed 80 == crouch, 128 == walk, 256 == run
if (VectorLengthSquared(cg.snap->ps.velocity) > Square(160) || cg.predictedPlayerState.eFlags & EF_PRONE_MOVING)
{
CG_FinishWeaponChange(cg.snap->ps.weapon, GetWeaponTableData(cg.snap->ps.weapon)->weapAlts);
}
View
@@ -251,7 +251,7 @@ void PM_ClipVelocity(vec3_t in, vec3_t normal, vec3_t out, float overbounce)
* @param[in] ignoreent
* @param[in] tracemask
*/
void PM_TraceLegs(trace_t *trace, float *legsOffset, vec3_t start, vec3_t end, trace_t *bodytrace, vec3_t viewangles, void(tracefunc) (trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask), int ignoreent, int tracemask)
void PM_TraceLegs(trace_t *trace, float *legsOffset, vec3_t start, vec3_t end, trace_t *bodytrace, vec3_t viewangles, void(tracefunc) (trace_t * results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask), int ignoreent, int tracemask)
{
vec3_t ofs, org, point;
vec3_t flatforward;
@@ -332,7 +332,7 @@ void PM_TraceLegs(trace_t *trace, float *legsOffset, vec3_t start, vec3_t end, t
* @param[in] tracemask
*/
void PM_TraceHead(trace_t *trace, vec3_t start, vec3_t end, trace_t *bodytrace, vec3_t viewangles,
void(tracefunc) (trace_t *results,
void(tracefunc) (trace_t * results,
const vec3_t start,
const vec3_t mins,
const vec3_t maxs,
@@ -944,12 +944,6 @@ static qboolean PM_CheckProne(void)
if (userinput && spd > 40.f && !(pm->ps->eFlags & EF_PRONE_MOVING))
{
pm->ps->eFlags |= EF_PRONE_MOVING;
// Lose the scope view if moving too fast while prone
if (GetWeaponTableData(pm->ps->weapon)->isScoped)
{
PM_BeginWeaponChange((weapon_t)pm->ps->weapon, GetWeaponTableData(pm->ps->weapon)->weapAlts, qfalse);
}
}
else if (!userinput && spd < 20.0f && (pm->ps->eFlags & EF_PRONE_MOVING))
{
@@ -3439,13 +3433,6 @@ static void PM_Weapon(void)
}
}
// can't shoot while prone and moving
if ((pm->ps->eFlags & EF_PRONE_MOVING) && !delayedFire)
{
PM_ContinueWeaponAnim(GetWeaponTableData(pm->ps->weapon)->idleAnim);
return;
}
// check for weapon change
// can't change if weapon is firing, but can change
// again if lowering or raising
@@ -3499,6 +3486,13 @@ static void PM_Weapon(void)
break;
}
// can't shoot while prone and moving
if ((pm->ps->eFlags & EF_PRONE_MOVING) && !delayedFire)
{
PM_ContinueWeaponAnim(GetWeaponTableData(pm->ps->weapon)->idleAnim);
return;
}
// this is possible since the player starts with nothing
if (pm->ps->weapon == WP_NONE)
{
@@ -4300,7 +4294,7 @@ void PM_UpdateLean(playerState_t *ps, usercmd_t *cmd, pmove_t *tpm)
*
* @note Tnused trace parameter
*/
void PM_UpdateViewAngles(playerState_t *ps, pmoveExt_t *pmext, usercmd_t *cmd, void(trace) (trace_t *results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask), int tracemask) // modified
void PM_UpdateViewAngles(playerState_t *ps, pmoveExt_t *pmext, usercmd_t *cmd, void(trace) (trace_t * results, const vec3_t start, const vec3_t mins, const vec3_t maxs, const vec3_t end, int passEntityNum, int contentMask), int tracemask) // modified
{
short temp;
int i;

0 comments on commit cf74f7d

Please sign in to comment.