void CTaskSimpleChokingSA::UpdateChoke ( CPed* pPed, CPed* pAttacker, bool bIsTearGas ) { // Get game interfaces CPedSA* pPedSA = dynamic_cast < CPedSA* > ( pPed ); if ( !pPedSA ) return; CPedSAInterface* pPedInterface = pPedSA->GetPedInterface (); CPedSAInterface* pAttackerInterface = NULL; if ( pAttacker ) { CPedSA* pAttackerSA = dynamic_cast < CPedSA* > ( pAttacker ); if ( pAttackerSA ) pAttackerInterface = pAttackerSA->GetPedInterface (); } // Call the func DWORD dwThisInterface = (DWORD)this->GetInterface(); DWORD dwFunc = FUNC_CTaskSimpleChoking__UpdateChoke; _asm { mov ecx, dwThisInterface push bIsTearGas push pAttackerInterface push pPedInterface call dwFunc } }
DWORD CPoolsSA::GetPedRef ( CPed* pPed ) { DEBUG_TRACE("DWORD CPoolsSA::GetPedRef ( CPed* pPed )"); DWORD dwRef = 0; CPedSA* pPedSA = dynamic_cast < CPedSA * > ( pPed ); if ( pPedSA ) { CPedSAInterface* pInterface = pPedSA->GetPedInterface (); DWORD dwFunc = FUNC_GetPedRef; _asm { push pInterface call dwFunc add esp, 0x4 mov dwRef, eax } } return dwRef; }
bool CCarEnterExitSA::GetNearestCarDoor ( CPed * pPed, CVehicle * pVehicle, CVector * pVector, int * pDoor ) { DWORD dwFunc = FUNC_GetNearestCarDoor; bool bReturn = false; CPedSA* pPedSA = dynamic_cast < CPedSA* > ( pPed ); CVehicleSA* pVehicleSA = dynamic_cast < CVehicleSA* > ( pVehicle ); if ( pPedSA && pVehicleSA ) { CPedSAInterface * pPedInterface = pPedSA->GetPedInterface (); CVehicleSAInterface * pVehicleInterface = pVehicleSA->GetVehicleInterface (); _asm { push pDoor push pVector push pVehicleInterface push pPedInterface call dwFunc add esp, 0x10 mov bReturn, al } }
CTaskSimpleChokingSA::CTaskSimpleChokingSA ( CPed* pAttacker, bool bIsTearGas ) { CPedSA* pAttackerSA = dynamic_cast < CPedSA* > ( pAttacker ); DWORD dwFunc = FUNC_CTaskSimpleChoking__Constructor; DWORD dwIsTearGas = bIsTearGas; // Grab the GTA class for the attacker if any CPedSAInterface* pAttackerInterface = NULL; if ( pAttackerSA ) pAttackerInterface = pAttackerSA->GetPedInterface (); this->CreateTaskInterface ( sizeof ( CTaskSimpleChokingSAInterface ) ); DWORD dwThisInterface = (DWORD)this->GetInterface(); _asm { mov ecx, dwThisInterface push ebx push bIsTearGas push pAttackerInterface call dwFunc pop ebx } }
void CPoolsSA::RemovePed ( unsigned long ulID, bool bDelete ) { DEBUG_TRACE("void CPoolsSA::RemovePed ( unsigned long ulID, bool bDelete )"); static bool bIsDeletingPedAlready = false; // to prevent delete being called twice if ( !bIsDeletingPedAlready ) { bIsDeletingPedAlready = true; CPedSA* pPedSA = m_pedPool.array [ ulID ]; assert ( NULL != pPedSA ); // Pop the element to remove from the pool array if ( ulID != m_pedPool.ulCount - 1 ) { // We are removing an intermediate position of // the array. Move the last element to the just // deleted element position to not allow empty // spaces on it. m_pedPool.array [ ulID ] = m_pedPool.array [ m_pedPool.ulCount - 1 ]; m_pedPool.array [ ulID ]->SetArrayID ( ulID ); } m_pedPool.array [ m_pedPool.ulCount - 1 ] = NULL; // Unlink the element to remove from the pool map pedPool_t::mapType::iterator iter = m_pedPool.map.find ( pPedSA->GetPedInterface () ); if ( iter != m_pedPool.map.end () ) { m_pedPool.map.erase ( iter ); } // Delete the element from memory switch ( pPedSA->GetType () ) { case PLAYER_PED: { CPlayerPedSA* pPlayerPed = dynamic_cast < CPlayerPedSA* > ( pPedSA ); if ( pPlayerPed ) { if ( ! bDelete ) pPlayerPed->SetDoNotRemoveFromGameWhenDeleted ( true ); } delete pPlayerPed; break; } default: { CCivilianPedSA* pCivPed = dynamic_cast < CCivilianPedSA* > ( pPedSA ); if ( pCivPed ) { if ( ! bDelete ) pCivPed->SetDoNotRemoveFromGameWhenDeleted ( true ); } delete pCivPed; } } // Decrease the count of elements in the pool --m_pedPool.ulCount; bIsDeletingPedAlready = false; } }