void CEntitySA::SetCollidableWith( CEntity *entity, bool enabled ) { CEntitySA *intEnt = dynamic_cast <CEntitySA*> ( entity ); if ( intEnt == this ) return; // quit if no change if ( MapContains( m_disabledColl, intEnt->GetInterface() ) != enabled ) return; if ( enabled ) { MapRemove( m_disabledColl, intEnt->GetInterface() ); if ( m_disabledColl.empty() ) MapRemove( pGame->m_disabledColl, this ); } else { MapSet( m_disabledColl, intEnt->GetInterface(), true ); MapSet( pGame->m_disabledColl, this, true ); } // Set in the other entity as well intEnt->SetCollidableWith( this, enabled ); }
VOID CCameraSA::TakeControlAttachToEntity(CEntity * TargetEntity, CEntity * AttachEntity, CVector * vecOffset, CVector * vecLookAt, float fTilt, int CamSwitchStyle) { DEBUG_TRACE("VOID CCameraSA::TakeControlAttachToEntity(CEntity * TargetEntity, CEntity * AttachEntity, CVector * vecOffset, CVector * vecLookAt, float fTilt, int CamSwitchStyle)"); char szDebug[255] = {'\0'}; CEntitySAInterface * targetEntityInterface = 0; CEntitySAInterface * attachEntityInterface = 0; if(TargetEntity) { CEntitySA* pTargetEntitySA = dynamic_cast < CEntitySA* > ( TargetEntity ); if ( pTargetEntitySA ) targetEntityInterface = pTargetEntitySA->GetInterface (); } if(AttachEntity) { CEntitySA* pAttachEntitySA = dynamic_cast < CEntitySA* > ( AttachEntity ); if ( pAttachEntitySA ) attachEntityInterface = pAttachEntitySA->GetInterface (); } if(!attachEntityInterface) return; CCameraSAInterface * cameraInterface = this->GetInterface(); // __thiscall // void TakeControlAttachToEntity(CEntity* NewTarget, CEntity* AttachEntity, // CVector& vecOffset, CVector& vecLookAt, float fTilt, short CamSwitchStyle, // int WhoIsTakingControl=SCRIPT_CAM_CONTROL); DWORD CCamera__TakeControlAttachToEntity = FUNC_TakeControlAttachToEntity; _asm { mov ecx, cameraInterface push 1 push CamSwitchStyle push fTilt push vecLookAt push vecOffset push attachEntityInterface push targetEntityInterface call CCamera__TakeControlAttachToEntity } }
void CPedSA::AttachPedToBike(CEntity * entity, CVector * vector, unsigned short sUnk, FLOAT fUnk, FLOAT fUnk2, eWeaponType weaponType) { DEBUG_TRACE("void CPedSA::AttachPedToBike(CEntity * entity, CVector * vector, unsigned short sUnk, FLOAT fUnk, FLOAT fUnk2, eWeaponType weaponType)"); CEntitySA* pEntitySA = dynamic_cast < CEntitySA* > ( entity ); if ( !pEntitySA ) return; DWORD dwEntityInterface = (DWORD)pEntitySA->GetInterface(); DWORD dwFunc = FUNC_AttachPedToBike; FLOAT fX = vector->fX; FLOAT fY = vector->fY; FLOAT fZ = vector->fZ; DWORD dwThis = (DWORD)this->GetInterface(); _asm { push weaponType push fUnk2 push fUnk push sUnk push fZ push fY push fX mov ecx, dwThis push dwEntityInterface call dwFunc } }
void CPhysicalSA::SetDamageEntity( CEntity *entity ) { CEntitySA* pEntitySA = dynamic_cast <CEntitySA*> ( entity ); if ( !pEntitySA ) return; GetInterface()->m_damageEntity = pEntitySA->GetInterface(); }
void CWorldSA::IgnoreEntity(CEntity * pEntity) { DEBUG_TRACE("VOID CWorldSA::IgnoreEntity(CEntity * entity)"); CEntitySA* pEntitySA = dynamic_cast < CEntitySA* > ( pEntity ); if ( pEntitySA ) MemPutFast < DWORD > ( VAR_IgnoredEntity, (DWORD) pEntitySA->GetInterface () ); else MemPutFast < DWORD > ( VAR_IgnoredEntity, 0 ); }
void CWorldSA::Add ( CEntity * pEntity, eDebugCaller CallerId ) { DEBUG_TRACE("VOID CWorldSA::Add ( CEntity * pEntity )"); CEntitySA* pEntitySA = dynamic_cast < CEntitySA* > ( pEntity ); if ( pEntitySA ) { CEntitySAInterface * pInterface = pEntitySA->GetInterface(); if ( (DWORD)pInterface->vtbl == VTBL_CPlaceable ) { SString strMessage ( "Caller: %i ", CallerId ); LogEvent ( 506, "CWorld::Add ( CEntity * ) Crash", "", strMessage ); } DWORD dwEntity = (DWORD) pEntitySA->GetInterface(); DWORD dwFunction = FUNC_Add; _asm { push dwEntity call dwFunction add esp, 4 } } }
void CHeliSA::PickupEntityWithWinch( CEntity* pEntity ) { CEntitySA *pEntitySA = dynamic_cast <CEntitySA*> ( pEntity ); if ( !pEntitySA ) return; DWORD dwFunc = FUNC_CVehicle_PickUpEntityWithWinch; DWORD dwThis = (DWORD)GetInterface(); DWORD dwEntityInterface = (DWORD)pEntitySA->GetInterface(); _asm { push dwEntityInterface mov ecx, dwThis call dwFunc } }
/** * \todo Find out what the last two paramters are */ VOID CCameraSA::TakeControl(CEntity * entity, eCamMode CamMode, int CamSwitchStyle) { DEBUG_TRACE("VOID CCameraSA::TakeControl(CEntity * entity, eCamMode CamMode, int CamSwitchStyle)"); CEntitySA* pEntitySA = dynamic_cast < CEntitySA* > ( entity ); if ( !pEntitySA ) return; CEntitySAInterface * entityInterface = pEntitySA->GetInterface(); CCameraSAInterface * cameraInterface = this->GetInterface(); // __thiscall DWORD CCamera__TakeControl = FUNC_TakeControl; _asm { mov ecx, cameraInterface push 1 push CamSwitchStyle push CamMode push entityInterface call CCamera__TakeControl } }
bool CPedSA::CanSeeEntity(CEntity * entity, FLOAT fDistance) { DEBUG_TRACE("bool CPedSA::CanSeeEntity(CEntity * entity, FLOAT fDistance)"); DWORD dwFunc = FUNC_CanSeeEntity; bool bReturn = false; CEntitySA* pEntitySA = dynamic_cast < CEntitySA* > ( entity ); if ( pEntitySA ) { DWORD dwEntityInterface = (DWORD)pEntitySA->GetInterface(); _asm { push fDistance push dwEntityInterface call dwFunc mov bReturn, al } } return bReturn; }