Skip to content

Commit 316b5d3

Browse files
Fix ScriptGetAttachmentMatrix/Angles
1 parent 286e822 commit 316b5d3

File tree

2 files changed

+13
-16
lines changed

2 files changed

+13
-16
lines changed

sp/src/game/client/c_baseanimating.cpp

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1531,35 +1531,32 @@ float C_BaseAnimating::ClampCycle( float flCycle, bool isLooping )
15311531
//-----------------------------------------------------------------------------
15321532
const Vector& C_BaseAnimating::ScriptGetAttachmentOrigin( int iAttachment )
15331533
{
1534-
15351534
static Vector absOrigin;
1536-
static QAngle qa;
1535+
QAngle qa;
15371536

15381537
C_BaseAnimating::GetAttachment( iAttachment, absOrigin, qa );
15391538

15401539
return absOrigin;
15411540
}
15421541

1543-
const Vector& C_BaseAnimating::ScriptGetAttachmentAngles( int iAttachment )
1542+
const QAngle& C_BaseAnimating::ScriptGetAttachmentAngles( int iAttachment )
15441543
{
1545-
1546-
static Vector absOrigin;
1547-
static Vector absAngles;
15481544
static QAngle qa;
1545+
Vector absOrigin;
15491546

15501547
C_BaseAnimating::GetAttachment( iAttachment, absOrigin, qa );
1551-
absAngles.x = qa.x;
1552-
absAngles.y = qa.y;
1553-
absAngles.z = qa.z;
1554-
return absAngles;
1548+
return qa;
15551549
}
15561550

1557-
HSCRIPT C_BaseAnimating::ScriptGetAttachmentMatrix( int iAttachment )
1551+
HSCRIPT_RC C_BaseAnimating::ScriptGetAttachmentMatrix( int iAttachment )
15581552
{
1559-
static matrix3x4_t matrix;
1553+
matrix3x4_t *matrix = new matrix3x4_t;
1554+
1555+
if ( C_BaseAnimating::GetAttachment( iAttachment, *matrix ) )
1556+
return g_pScriptVM->RegisterInstance( matrix, true );
15601557

1561-
C_BaseAnimating::GetAttachment( iAttachment, matrix );
1562-
return g_pScriptVM->RegisterInstance( &matrix );
1558+
delete matrix;
1559+
return NULL;
15631560
}
15641561

15651562
void C_BaseAnimating::ScriptGetBoneTransform( int iBone, HSCRIPT hTransform )

sp/src/game/client/c_baseanimating.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ class C_BaseAnimating : public C_BaseEntity, private IModelLoadCallback
464464
#ifdef MAPBASE_VSCRIPT
465465
int ScriptLookupAttachment( const char *pAttachmentName ) { return LookupAttachment( pAttachmentName ); }
466466
const Vector& ScriptGetAttachmentOrigin(int iAttachment);
467-
const Vector& ScriptGetAttachmentAngles(int iAttachment);
468-
HSCRIPT ScriptGetAttachmentMatrix(int iAttachment);
467+
const QAngle& ScriptGetAttachmentAngles(int iAttachment);
468+
HSCRIPT_RC ScriptGetAttachmentMatrix(int iAttachment);
469469

470470
void ScriptGetBoneTransform( int iBone, HSCRIPT hTransform );
471471
void ScriptSetBoneTransform( int iBone, HSCRIPT hTransform );

0 commit comments

Comments
 (0)