[ioquake3] 115/136: Fix Coverity warning that endVelocity is uninitialized
Simon McVittie
smcv at debian.org
Thu Jun 15 09:09:16 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian/master
in repository ioquake3.
commit b511b8f2f6690fa6e8268acfbb020aeff974413f
Author: Zack Middleton <zack at cloemail.com>
Date: Wed Jun 7 19:51:32 2017 -0500
Fix Coverity warning that endVelocity is uninitialized
---
code/game/bg_slidemove.c | 27 +++++++++++++++++++--------
1 file changed, 19 insertions(+), 8 deletions(-)
diff --git a/code/game/bg_slidemove.c b/code/game/bg_slidemove.c
index 0806b2f..9228ada 100644
--- a/code/game/bg_slidemove.c
+++ b/code/game/bg_slidemove.c
@@ -158,8 +158,10 @@ qboolean PM_SlideMove( qboolean gravity ) {
// slide along the plane
PM_ClipVelocity (pm->ps->velocity, planes[i], clipVelocity, OVERCLIP );
- // slide along the plane
- PM_ClipVelocity (endVelocity, planes[i], endClipVelocity, OVERCLIP );
+ if ( gravity ) {
+ // slide along the plane
+ PM_ClipVelocity (endVelocity, planes[i], endClipVelocity, OVERCLIP );
+ }
// see if there is a second plane that the new move enters
for ( j = 0 ; j < numplanes ; j++ ) {
@@ -172,7 +174,10 @@ qboolean PM_SlideMove( qboolean gravity ) {
// try clipping the move to the plane
PM_ClipVelocity( clipVelocity, planes[j], clipVelocity, OVERCLIP );
- PM_ClipVelocity( endClipVelocity, planes[j], endClipVelocity, OVERCLIP );
+
+ if ( gravity ) {
+ PM_ClipVelocity( endClipVelocity, planes[j], endClipVelocity, OVERCLIP );
+ }
// see if it goes back into the first clip plane
if ( DotProduct( clipVelocity, planes[i] ) >= 0 ) {
@@ -185,10 +190,12 @@ qboolean PM_SlideMove( qboolean gravity ) {
d = DotProduct( dir, pm->ps->velocity );
VectorScale( dir, d, clipVelocity );
- CrossProduct (planes[i], planes[j], dir);
- VectorNormalize( dir );
- d = DotProduct( dir, endVelocity );
- VectorScale( dir, d, endClipVelocity );
+ if ( gravity ) {
+ CrossProduct (planes[i], planes[j], dir);
+ VectorNormalize( dir );
+ d = DotProduct( dir, endVelocity );
+ VectorScale( dir, d, endClipVelocity );
+ }
// see if there is a third plane the the new move enters
for ( k = 0 ; k < numplanes ; k++ ) {
@@ -207,7 +214,11 @@ qboolean PM_SlideMove( qboolean gravity ) {
// if we have fixed all interactions, try another move
VectorCopy( clipVelocity, pm->ps->velocity );
- VectorCopy( endClipVelocity, endVelocity );
+
+ if ( gravity ) {
+ VectorCopy( endClipVelocity, endVelocity );
+ }
+
break;
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/ioquake3.git
More information about the Pkg-games-commits
mailing list