Exemple #1
0
void CObject::Explode()
{
    CVector pos = GetPos();
    pos.z += 0.5;
    CExplosion::AddExplosion(this, GetPlayerPed(-1), 9, pos, 100, 1, -1.0, 0);
    if (m_colDamageEffect == 202 || m_colDamageEffect == 200)
    {
        pos.z -= 1.0;
        ObjectDamage(10000.0f, pos, 0, GetPlayerPed(-1), 51);
    }
    else if (!m_disableFriction)
    {
        m_linearVelocity.z += 0.5;
        m_linearVelocity.x += (rand() - 128) * 0.000199999994947575;
        m_linearVelocity.y += (rand() - 128) * 0.000199999994947575;
        if (bIsStatic || bIsStaticWaitingForCollision)
        {
            SetIsStatic(false);
            AddToMovingList();
        }
    }
    if (m_objectInfo->fxType == 2)
    {
        CMatrix pos = GetMatrix();
        // to object space
        CVector fxObjPos = Multiply3x3(pos, m_objectInfo->fxOffset);
        fxObjPos += GetPos(); // to world space
        FxSystem_c *sys = FxManager.InitialiseFxSystem(m_objectInfo->fxSystem, fxObjPos, 0, 0);
        if (sys)
        {
            sys->Start();
        }
    }
}
Exemple #2
0
void CObject::Explode()
{
    CVector pos = Placeable.GetPos();
    pos.z += 0.5;
    CExplosion::AddExplosion(this, getPlayerPed(-1), 9, pos, 100, 1, -1.0, 0);
    if(m_colDamageEffect == 0xCA || m_colDamageEffect == 0xc8)
    {
        pos.z -= 1.0;
        Break(10000.0, pos, 0, getPlayerPed(-1), 51);
    }
    else if(!bDisableFriction)
    {
        m_vecLinearVelocity.z += 0.5;
        m_vecLinearVelocity.x += (rand() - 128) * 0.000199999994947575;
        m_vecLinearVelocity.y += (rand() - 128) * 0.000199999994947575;
        if(bIsStatic || bIsStaticWaitingForCollision)
        {
            SetIsStatic(false);
            AddToMovingList();
        }
    }
    if(m_pObjectInfo->fxType == 2)
    {
        CMatrix pos = CMatrix::FromXYZ(m_xyz);
        // to object space
        CVector fx_obj_pos = pos * m_pObjectInfo->fxOffset;
        fx_obj_pos += GetPos(); // to world space
        FxSystem_c *sys = FxManager.InitialiseFxSystem(m_pObjectInfo->pFxSystemBP, fx_obj_pos, 0, 0);
        if(sys)
        {
            sys->Start();
        }
    }
}