diff --git a/saco/game/actorped.cpp b/saco/game/actorped.cpp index b7ec013..3c4a39d 100644 --- a/saco/game/actorped.cpp +++ b/saco/game/actorped.cpp @@ -66,6 +66,32 @@ void CActorPed::Destroy() //----------------------------------------------------------- +void CActorPed::ApplyAnimation( char *szAnimName, char *szAnimFile, float fT, + int opt1, int opt2, int opt3, int opt4, int iUnk ) +{ + int iWaitAnimLoad=0; + + if(!m_pPed) return; + if(!GamePool_Ped_GetAt(m_dwGTAId)) return; + + // Can't allow 'naughty' anims! + if( !stricmp(szAnimFile,"SEX") ) + return; + + if (!pGame->IsAnimationLoaded(szAnimFile)) { + pGame->RequestAnimation(szAnimFile); + while(!pGame->IsAnimationLoaded(szAnimFile)) { + Sleep(1); + iWaitAnimLoad++; + if(iWaitAnimLoad == 15) return; // we can't wait forever + } + } + + ScriptCommand(&apply_animation,m_dwGTAId,szAnimName,szAnimFile,fT,opt1,opt2,opt3,opt4,iUnk); +} + +//----------------------------------------------------------- + DWORD dwActorPed=0; BOOL __declspec(naked) FlushPedIntelligence() diff --git a/saco/game/actorped.h b/saco/game/actorped.h index 1534ceb..b498d5f 100644 --- a/saco/game/actorped.h +++ b/saco/game/actorped.h @@ -15,9 +15,12 @@ public: void SetTargetRotation(float fRotation); float GetHealth(); + void SetHealth(float fHealth); float GetArmour(); void SetArmour(float fArmour); + void ApplyAnimation(char *szAnimName, char *szAnimFile, float fT, + int opt1, int opt2, int opt3, int opt4, int iUnk); void ClearAnimations(); diff --git a/saco/game/scripting.h b/saco/game/scripting.h index dbb18c1..dce79e4 100644 --- a/saco/game/scripting.h +++ b/saco/game/scripting.h @@ -89,7 +89,7 @@ const SCRIPT_COMMAND set_actor_animation_set = { 0x0245, "is" }; const SCRIPT_COMMAND request_animation = { 0x04ED, "s" }; const SCRIPT_COMMAND is_animation_loaded = { 0x04EE, "s" }; const SCRIPT_COMMAND release_animation = { 0x04EF, "s" }; - +const SCRIPT_COMMAND apply_animation = { 0x0812, "issfiiiii" }; // actor,animation,library,floatunk,bool,bool,bool,bool,int const SCRIPT_COMMAND set_actor_weapon_droppable = { 0x087e, "ii" }; const SCRIPT_COMMAND set_actor_money = { 0x03fe, "ii" };