mirror of
https://github.com/rehlds/reapi.git
synced 2025-04-23 06:43:42 +03:00
GetAttachment/GetBonePosition: Restore preserved animtime/frame after advancing studio entity
This commit is contained in:
parent
592ebca528
commit
8c220a7de5
@ -168,6 +168,9 @@ void GetBonePosition(CBaseEntity *pEntity, int iBone, Vector *pVecOrigin, Vector
|
|||||||
if (iBone < 0 || iBone >= pstudiohdr->numbones)
|
if (iBone < 0 || iBone >= pstudiohdr->numbones)
|
||||||
return; // invalid bone
|
return; // invalid bone
|
||||||
|
|
||||||
|
float flFrame = pEdict->v.frame;
|
||||||
|
float flAnimTime = pEdict->v.animtime;
|
||||||
|
|
||||||
// force to update frame
|
// force to update frame
|
||||||
StudioFrameAdvanceEnt(pstudiohdr, pEdict);
|
StudioFrameAdvanceEnt(pstudiohdr, pEdict);
|
||||||
|
|
||||||
@ -175,6 +178,10 @@ void GetBonePosition(CBaseEntity *pEntity, int iBone, Vector *pVecOrigin, Vector
|
|||||||
GET_BONE_POSITION(pEdict, iBone, vecOrigin, vecAngles);
|
GET_BONE_POSITION(pEdict, iBone, vecOrigin, vecAngles);
|
||||||
pEntity->pev->angles.x = -pEntity->pev->angles.x;
|
pEntity->pev->angles.x = -pEntity->pev->angles.x;
|
||||||
|
|
||||||
|
// restore the original state for the entity
|
||||||
|
pEdict->v.frame = flFrame;
|
||||||
|
pEdict->v.animtime = flAnimTime;
|
||||||
|
|
||||||
// ReGameDLL already have fixes angles for non-players entities
|
// ReGameDLL already have fixes angles for non-players entities
|
||||||
if (!g_ReGameApi && !pEntity->IsPlayer()) {
|
if (!g_ReGameApi && !pEntity->IsPlayer()) {
|
||||||
FixupAngles(pEdict, vecOrigin);
|
FixupAngles(pEdict, vecOrigin);
|
||||||
@ -204,11 +211,18 @@ void GetAttachment(CBaseEntity *pEntity, int iAttachment, Vector *pVecOrigin, Ve
|
|||||||
if (iAttachment < 0 || iAttachment >= pstudiohdr->numattachments)
|
if (iAttachment < 0 || iAttachment >= pstudiohdr->numattachments)
|
||||||
return; // invalid attachment
|
return; // invalid attachment
|
||||||
|
|
||||||
|
float flFrame = pEdict->v.frame;
|
||||||
|
float flAnimTime = pEdict->v.animtime;
|
||||||
|
|
||||||
// force to update frame
|
// force to update frame
|
||||||
StudioFrameAdvanceEnt(pstudiohdr, pEdict);
|
StudioFrameAdvanceEnt(pstudiohdr, pEdict);
|
||||||
|
|
||||||
GET_ATTACHMENT(pEdict, iAttachment, vecOrigin, vecAngles);
|
GET_ATTACHMENT(pEdict, iAttachment, vecOrigin, vecAngles);
|
||||||
|
|
||||||
|
// restore the original state for the entity
|
||||||
|
pEdict->v.frame = flFrame;
|
||||||
|
pEdict->v.animtime = flAnimTime;
|
||||||
|
|
||||||
// ReGameDLL already have fixes angles for non-players entities
|
// ReGameDLL already have fixes angles for non-players entities
|
||||||
if (!g_ReGameApi && !pEntity->IsPlayer()) {
|
if (!g_ReGameApi && !pEntity->IsPlayer()) {
|
||||||
FixupAngles(pEdict, vecOrigin);
|
FixupAngles(pEdict, vecOrigin);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user