mirror of https://github.com/Nofated095/re-GTA.git
Merge pull request #875 from waliedyassen/master-cobject-fixes
re3 CObject fixes
This commit is contained in:
commit
0b47fdee1c
|
@ -209,15 +209,15 @@ CObject::ObjectDamage(float amount)
|
||||||
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
||||||
const RwRGBA color = { 96, 48, 0, 255 };
|
const RwRGBA color = { 96, 48, 0, 255 };
|
||||||
for (int32 i = 0; i < 25; i++) {
|
for (int32 i = 0; i < 25; i++) {
|
||||||
CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
|
CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.35f),
|
||||||
CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
|
CGeneral::GetRandomNumberInRange(-0.35f, 0.35f),
|
||||||
CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
|
CGeneral::GetRandomNumberInRange(0.1f, 0.25f) + fDirectionZ);
|
||||||
++nFrameGen;
|
++nFrameGen;
|
||||||
int32 currentFrame = nFrameGen & 3;
|
int32 currentFrame = nFrameGen & 3;
|
||||||
float fRandom = CGeneral::GetRandomNumberInRange(0.01f, 1.0f);
|
float fRandom = CGeneral::GetRandomNumberInRange(0.01f, 1.0f);
|
||||||
RwRGBA randomColor = { uint8(color.red * fRandom), uint8(color.green * fRandom) , color.blue, color.alpha };
|
RwRGBA randomColor = { uint8(color.red * fRandom), uint8(color.green * fRandom) , color.blue, color.alpha };
|
||||||
float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
|
float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.20f);
|
||||||
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
|
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 40);
|
||||||
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0);
|
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0);
|
||||||
}
|
}
|
||||||
PlayOneShotScriptObject(SCRIPT_SOUND_BOX_DESTROYED_2, vecPos);
|
PlayOneShotScriptObject(SCRIPT_SOUND_BOX_DESTROYED_2, vecPos);
|
||||||
|
@ -232,15 +232,15 @@ CObject::ObjectDamage(float amount)
|
||||||
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
SetTurnSpeed(0.0f, 0.0f, 0.0f);
|
||||||
const RwRGBA color = { 128, 128, 128, 255 };
|
const RwRGBA color = { 128, 128, 128, 255 };
|
||||||
for (int32 i = 0; i < 45; i++) {
|
for (int32 i = 0; i < 45; i++) {
|
||||||
CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
|
CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.35f),
|
||||||
CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
|
CGeneral::GetRandomNumberInRange(-0.35f, 0.35f),
|
||||||
CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
|
CGeneral::GetRandomNumberInRange(0.1f, 0.25f) + fDirectionZ);
|
||||||
++nFrameGen;
|
++nFrameGen;
|
||||||
int32 currentFrame = nFrameGen & 3;
|
int32 currentFrame = nFrameGen & 3;
|
||||||
float fRandom = CGeneral::GetRandomNumberInRange(0.5f, 0.5f);
|
float fRandom = CGeneral::GetRandomNumberInRange(0.5f, 1.0f);
|
||||||
RwRGBA randomColor = { uint8(color.red * fRandom), uint8(color.green * fRandom), uint8(color.blue * fRandom), color.alpha };
|
RwRGBA randomColor = { uint8(color.red * fRandom), uint8(color.green * fRandom), uint8(color.blue * fRandom), color.alpha };
|
||||||
float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
|
float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.20f);
|
||||||
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
|
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 40);
|
||||||
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0);
|
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0);
|
||||||
}
|
}
|
||||||
PlayOneShotScriptObject(SCRIPT_SOUND_BOX_DESTROYED_1, vecPos);
|
PlayOneShotScriptObject(SCRIPT_SOUND_BOX_DESTROYED_1, vecPos);
|
||||||
|
@ -256,16 +256,16 @@ CObject::ObjectDamage(float amount)
|
||||||
const RwRGBA color1 = { 200, 0, 0, 255 };
|
const RwRGBA color1 = { 200, 0, 0, 255 };
|
||||||
const RwRGBA color2 = { 200, 200, 200, 255 };
|
const RwRGBA color2 = { 200, 200, 200, 255 };
|
||||||
for (int32 i = 0; i < 10; i++) {
|
for (int32 i = 0; i < 10; i++) {
|
||||||
CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
|
CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.35f),
|
||||||
CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
|
CGeneral::GetRandomNumberInRange(-0.35f, 0.35f),
|
||||||
CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
|
CGeneral::GetRandomNumberInRange(0.1f, 0.25f) + fDirectionZ);
|
||||||
++nFrameGen;
|
++nFrameGen;
|
||||||
int32 currentFrame = nFrameGen & 3;
|
int32 currentFrame = nFrameGen & 3;
|
||||||
RwRGBA color = color2;
|
RwRGBA color = color2;
|
||||||
if (nFrameGen & 1)
|
if (nFrameGen & 1)
|
||||||
color = color1;
|
color = color1;
|
||||||
float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
|
float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.20f);
|
||||||
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
|
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 40);
|
||||||
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0);
|
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0);
|
||||||
}
|
}
|
||||||
PlayOneShotScriptObject(SCRIPT_SOUND_TIRE_COLLISION, vecPos);
|
PlayOneShotScriptObject(SCRIPT_SOUND_TIRE_COLLISION, vecPos);
|
||||||
|
@ -281,16 +281,16 @@ CObject::ObjectDamage(float amount)
|
||||||
const RwRGBA color1 = { 200, 0, 0, 255 };
|
const RwRGBA color1 = { 200, 0, 0, 255 };
|
||||||
const RwRGBA color2 = { 200, 200, 200, 255 };
|
const RwRGBA color2 = { 200, 200, 200, 255 };
|
||||||
for (int32 i = 0; i < 32; i++) {
|
for (int32 i = 0; i < 32; i++) {
|
||||||
CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
|
CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.35f),
|
||||||
CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
|
CGeneral::GetRandomNumberInRange(-0.35f, 0.35f),
|
||||||
CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
|
CGeneral::GetRandomNumberInRange(0.1f, 0.25f) + fDirectionZ);
|
||||||
++nFrameGen;
|
++nFrameGen;
|
||||||
int32 currentFrame = nFrameGen & 3;
|
int32 currentFrame = nFrameGen & 3;
|
||||||
RwRGBA color = color2;
|
RwRGBA color = color2;
|
||||||
if (nFrameGen & 1)
|
if (nFrameGen & 1)
|
||||||
color = color1;
|
color = color1;
|
||||||
float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
|
float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.20f);
|
||||||
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
|
int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 40);
|
||||||
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0);
|
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0);
|
||||||
}
|
}
|
||||||
PlayOneShotScriptObject(SCRIPT_SOUND_METAL_COLLISION, vecPos);
|
PlayOneShotScriptObject(SCRIPT_SOUND_METAL_COLLISION, vecPos);
|
||||||
|
@ -389,7 +389,8 @@ CObject::DeleteAllTempObjectsInArea(CVector point, float fRadius)
|
||||||
CObjectPool *objectPool = CPools::GetObjectPool();
|
CObjectPool *objectPool = CPools::GetObjectPool();
|
||||||
for (int32 i = 0; i < objectPool->GetSize(); i++) {
|
for (int32 i = 0; i < objectPool->GetSize(); i++) {
|
||||||
CObject *pObject = objectPool->GetSlot(i);
|
CObject *pObject = objectPool->GetSlot(i);
|
||||||
if (pObject && pObject->ObjectCreatedBy == TEMP_OBJECT && fRadius * fRadius > pObject->GetPosition().MagnitudeSqr()) {
|
CVector dist = point - pObject->GetPosition();
|
||||||
|
if (pObject && pObject->ObjectCreatedBy == TEMP_OBJECT && dist.MagnitudeSqr() < fRadius * fRadius) {
|
||||||
CWorld::Remove(pObject);
|
CWorld::Remove(pObject);
|
||||||
delete pObject;
|
delete pObject;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue