diff options
Diffstat (limited to 'src/cgame/cg_attachment.c')
-rw-r--r-- | src/cgame/cg_attachment.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/src/cgame/cg_attachment.c b/src/cgame/cg_attachment.c index d8f20d90..a256318b 100644 --- a/src/cgame/cg_attachment.c +++ b/src/cgame/cg_attachment.c @@ -29,6 +29,9 @@ qboolean CG_AttachmentPoint( attachment_t *a, vec3_t v ) if( !a ) return qfalse; + // if it all breaks, then use the last point we know was correct + VectorCopy( a->lastValidAttachmentPoint, v ); + switch( a->type ) { case AT_STATIC: @@ -85,6 +88,8 @@ qboolean CG_AttachmentPoint( attachment_t *a, vec3_t v ) if( a->hasOffset ) VectorAdd( v, a->offset, v ); + VectorCopy( v, a->lastValidAttachmentPoint ); + return qtrue; } @@ -106,7 +111,6 @@ qboolean CG_AttachmentDir( attachment_t *a, vec3_t v ) switch( a->type ) { case AT_STATIC: - //FIXME: hmmmmmmm return qfalse; break; @@ -150,6 +154,53 @@ qboolean CG_AttachmentDir( attachment_t *a, vec3_t v ) /* =============== +CG_AttachmentAxis + +Return the attachment axis +=============== +*/ +qboolean CG_AttachmentAxis( attachment_t *a, vec3_t axis[ 3 ] ) +{ + centity_t *cent; + + if( !a ) + return qfalse; + + switch( a->type ) + { + case AT_STATIC: + return qfalse; + break; + + case AT_TAG: + if( !a->tagValid ) + return qfalse; + + AxisCopy( a->re.axis, axis ); + break; + + case AT_CENT: + if( !a->centValid ) + return qfalse; + + cent = &cg_entities[ a->centNum ]; + AnglesToAxis( cent->lerpAngles, axis ); + break; + + case AT_PARTICLE: + return qfalse; + break; + + default: + CG_Printf( S_COLOR_RED "ERROR: Invalid attachmentType_t in attachment\n" ); + break; + } + + return qtrue; +} + +/* +=============== CG_AttachmentVelocity If the attachment can have velocity, return it |