Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: MTA10/game_sa/CAnimBlendAssociationSA.cpp
- ===================================================================
- --- MTA10/game_sa/CAnimBlendAssociationSA.cpp (revision 2973)
- +++ MTA10/game_sa/CAnimBlendAssociationSA.cpp (working copy)
- @@ -18,3 +18,15 @@
- {
- return pGame->GetAnimManager ()->GetAnimBlendHierarchy ( m_pInterface->pAnimHierarchy );
- }
- +
- +void CAnimBlendAssociationSA::SetCurrentTime ( float fTime )
- +{
- + DWORD DwFunc = 0x4CEA80;
- + DWORD DwThisInterface = reinterpret_cast<DWORD> (m_pInterface);
- + _asm
- + {
- + mov ecx, DwThisInterface
- + push fTime
- + call DwFunc
- + };
- +}
- \ No newline at end of file
- Index: MTA10/game_sa/CAnimBlendAssociationSA.h
- ===================================================================
- --- MTA10/game_sa/CAnimBlendAssociationSA.h (revision 2973)
- +++ MTA10/game_sa/CAnimBlendAssociationSA.h (working copy)
- @@ -51,6 +51,8 @@
- inline float GetBlendAmount ( void ) { return m_pInterface->fBlendAmount; }
- inline void SetBlendAmount ( float fAmount ) { m_pInterface->fBlendAmount = fAmount; }
- + void SetCurrentTime ( float fTime );
- +
- protected:
- CAnimBlendAssociationSAInterface * m_pInterface;
- };
- Index: MTA10/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
- ===================================================================
- --- MTA10/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp (revision 2973)
- +++ MTA10/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp (working copy)
- @@ -1898,6 +1898,31 @@
- }
- +bool CStaticFunctionDefinitions::SetPedAnimationProgress ( CClientEntity& Entity, const char * szAnimName, float fProgress )
- +{
- + RUN_CHILDREN SetPedAnimationProgress ( **iter, szAnimName, fProgress );
- +
- + if ( IS_PED ( &Entity ) )
- + {
- + CClientPed& Ped = static_cast < CClientPed& > ( Entity );
- + CAnimBlendAssociation* pA = g_pGame->GetAnimManager ()->RpAnimBlendClumpGetAssociation ( Ped.GetClump (), szAnimName );
- +
- + if ( pA )
- + {
- + /*
- + Here must be something like
- + float fNewTime = pA->GetInterface()->pAnimHierarchy->fTotalTime * fProgress;
- + But only abstract classes avaliable here
- + */
- + float fNewTime = *(float *)(*(DWORD *)( ((DWORD)(pA->GetInterface())) + 20) + 16) * fProgress;
- + pA->SetCurrentTime ( fNewTime );
- + }
- + }
- +
- + return false;
- +}
- +
- +
- bool CStaticFunctionDefinitions::SetPedMoveAnim ( CClientEntity& Entity, unsigned int iMoveAnim )
- {
- RUN_CHILDREN SetPedMoveAnim ( **iter, iMoveAnim );
- Index: MTA10/mods/deathmatch/logic/CStaticFunctionDefinitions.h
- ===================================================================
- --- MTA10/mods/deathmatch/logic/CStaticFunctionDefinitions.h (revision 2973)
- +++ MTA10/mods/deathmatch/logic/CStaticFunctionDefinitions.h (working copy)
- @@ -147,6 +147,7 @@
- static bool SetPedRotation ( CClientEntity& Entity, float fRotation );
- static bool SetPedCanBeKnockedOffBike ( CClientEntity& Entity, bool bCanBeKnockedOffBike );
- static bool SetPedAnimation ( CClientEntity& Entity, const char * szBlockName, const char * szAnimName, int iTime, bool bLoop, bool bUpdatePosition, bool bInterruptable, bool bFreezeLastFrame );
- + static bool SetPedAnimationProgress ( CClientEntity& Entity, const char * szAnimName, float fProgress );
- static bool SetPedMoveAnim ( CClientEntity& Entity, unsigned int iMoveAnim );
- static bool AddPedClothes ( CClientEntity& Entity, char* szTexture, char* szModel, unsigned char ucType );
- static bool RemovePedClothes ( CClientEntity& Entity, unsigned char ucType );
- Index: MTA10/mods/shared_logic/lua/CLuaFunctionDefs.h
- ===================================================================
- --- MTA10/mods/shared_logic/lua/CLuaFunctionDefs.h (revision 2973)
- +++ MTA10/mods/shared_logic/lua/CLuaFunctionDefs.h (working copy)
- @@ -234,6 +234,7 @@
- LUA_DECLARE ( SetPedRotation );
- LUA_DECLARE ( SetPedCanBeKnockedOffBike );
- LUA_DECLARE ( SetPedAnimation );
- + LUA_DECLARE ( SetPedAnimationProgress );
- LUA_DECLARE ( SetPedMoveAnim );
- LUA_DECLARE ( SetPedWeaponSlot );
- LUA_DECLARE ( AddPedClothes );
- Index: MTA10/mods/shared_logic/lua/CLuaFunctionDefs.Ped.cpp
- ===================================================================
- --- MTA10/mods/shared_logic/lua/CLuaFunctionDefs.Ped.cpp (revision 2973)
- +++ MTA10/mods/shared_logic/lua/CLuaFunctionDefs.Ped.cpp (working copy)
- @@ -1603,7 +1603,39 @@
- return 1;
- }
- +int CLuaFunctionDefs::SetPedAnimationProgress( lua_State* luaVM )
- +{
- + // Check types
- + if ( lua_istype ( luaVM, 1, LUA_TLIGHTUSERDATA ) )
- + {
- + // Grab the element
- + CClientEntity* pEntity = lua_toelement ( luaVM, 1 );
- + if ( pEntity )
- + {
- + const char * szAnimName = NULL;
- + float fProgress = 0.0f;
- + if ( lua_type ( luaVM, 2 ) == LUA_TSTRING ) szAnimName = lua_tostring ( luaVM, 2 );
- + if ( lua_type ( luaVM, 3 ) == LUA_TNUMBER ) fProgress = static_cast < float > ( lua_tonumber ( luaVM, 3 ) );
- +
- + if ( CStaticFunctionDefinitions::SetPedAnimationProgress ( *pEntity, szAnimName, fProgress ) );
- + {
- + lua_pushboolean ( luaVM, true );
- + return 1;
- + }
- + }
- + else
- + m_pScriptDebugging->LogBadPointer ( luaVM, "setPedAnimation", "element", 1 );
- + }
- + else
- + m_pScriptDebugging->LogBadType ( luaVM, "setPedAnimation" );
- +
- + // Failed
- + lua_pushboolean ( luaVM, false );
- + return 1;
- +}
- +
- +
- int CLuaFunctionDefs::SetPedMoveAnim ( lua_State* luaVM )
- {
- // Check types
- Index: MTA10/mods/shared_logic/lua/CLuaManager.cpp
- ===================================================================
- --- MTA10/mods/shared_logic/lua/CLuaManager.cpp (revision 2973)
- +++ MTA10/mods/shared_logic/lua/CLuaManager.cpp (working copy)
- @@ -440,6 +440,7 @@
- CLuaCFunctions::AddFunction ( "setPedRotation", CLuaFunctionDefs::SetPedRotation );
- CLuaCFunctions::AddFunction ( "setPedCanBeKnockedOffBike", CLuaFunctionDefs::SetPedCanBeKnockedOffBike );
- CLuaCFunctions::AddFunction ( "setPedAnimation", CLuaFunctionDefs::SetPedAnimation );
- + CLuaCFunctions::AddFunction ( "setPedAnimationProgress", CLuaFunctionDefs::SetPedAnimationProgress );
- //CLuaCFunctions::AddFunction ( "setPedWalkingStyle", CLuaFunctionDefs::SetPedMoveAnim );
- CLuaCFunctions::AddFunction ( "addPedClothes", CLuaFunctionDefs::AddPedClothes );
- CLuaCFunctions::AddFunction ( "removePedClothes", CLuaFunctionDefs::RemovePedClothes );
- Index: MTA10/sdk/game/CAnimBlendAssociation.h
- ===================================================================
- --- MTA10/sdk/game/CAnimBlendAssociation.h (revision 2973)
- +++ MTA10/sdk/game/CAnimBlendAssociation.h (working copy)
- @@ -27,6 +27,8 @@
- virtual float GetBlendAmount ( void ) = 0;
- virtual void SetBlendAmount ( float fAmount ) = 0;
- +
- + virtual void SetCurrentTime ( float fTime ) = 0;
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement