summaryrefslogtreecommitdiffstats
path: root/src/objects
diff options
context:
space:
mode:
authorWalied K. Yassen <walied.developer@hotmail.com>2020-12-08 20:19:34 +0100
committerWalied K. Yassen <walied.developer@hotmail.com>2020-12-08 20:22:05 +0100
commita35c96c5ec3f785bac87d34f3cfeaf60caa0f620 (patch)
treefad2c7dc80c20625ed80e00feecafebf69521a85 /src/objects
parentUpdate Readme (diff)
downloadre3-a35c96c5ec3f785bac87d34f3cfeaf60caa0f620.tar
re3-a35c96c5ec3f785bac87d34f3cfeaf60caa0f620.tar.gz
re3-a35c96c5ec3f785bac87d34f3cfeaf60caa0f620.tar.bz2
re3-a35c96c5ec3f785bac87d34f3cfeaf60caa0f620.tar.lz
re3-a35c96c5ec3f785bac87d34f3cfeaf60caa0f620.tar.xz
re3-a35c96c5ec3f785bac87d34f3cfeaf60caa0f620.tar.zst
re3-a35c96c5ec3f785bac87d34f3cfeaf60caa0f620.zip
Diffstat (limited to 'src/objects')
-rw-r--r--src/objects/Object.cpp45
1 files changed, 23 insertions, 22 deletions
diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp
index d91a0f13..466cecac 100644
--- a/src/objects/Object.cpp
+++ b/src/objects/Object.cpp
@@ -209,15 +209,15 @@ CObject::ObjectDamage(float amount)
SetTurnSpeed(0.0f, 0.0f, 0.0f);
const RwRGBA color = { 96, 48, 0, 255 };
for (int32 i = 0; i < 25; i++) {
- CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
- CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
- CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
+ CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.35f),
+ CGeneral::GetRandomNumberInRange(-0.35f, 0.35f),
+ CGeneral::GetRandomNumberInRange(0.1f, 0.25f) + fDirectionZ);
++nFrameGen;
int32 currentFrame = nFrameGen & 3;
float fRandom = CGeneral::GetRandomNumberInRange(0.01f, 1.0f);
RwRGBA randomColor = { uint8(color.red * fRandom), uint8(color.green * fRandom) , color.blue, color.alpha };
- float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
- int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
+ float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.20f);
+ int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 40);
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0);
}
PlayOneShotScriptObject(SCRIPT_SOUND_BOX_DESTROYED_2, vecPos);
@@ -232,15 +232,15 @@ CObject::ObjectDamage(float amount)
SetTurnSpeed(0.0f, 0.0f, 0.0f);
const RwRGBA color = { 128, 128, 128, 255 };
for (int32 i = 0; i < 45; i++) {
- CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
- CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
- CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
+ CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.35f),
+ CGeneral::GetRandomNumberInRange(-0.35f, 0.35f),
+ CGeneral::GetRandomNumberInRange(0.1f, 0.25f) + fDirectionZ);
++nFrameGen;
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 };
- float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
- int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
+ float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.20f);
+ int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 40);
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, randomColor, nRotationSpeed, 0, currentFrame, 0);
}
PlayOneShotScriptObject(SCRIPT_SOUND_BOX_DESTROYED_1, vecPos);
@@ -256,16 +256,16 @@ CObject::ObjectDamage(float amount)
const RwRGBA color1 = { 200, 0, 0, 255 };
const RwRGBA color2 = { 200, 200, 200, 255 };
for (int32 i = 0; i < 10; i++) {
- CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
- CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
- CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
+ CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.35f),
+ CGeneral::GetRandomNumberInRange(-0.35f, 0.35f),
+ CGeneral::GetRandomNumberInRange(0.1f, 0.25f) + fDirectionZ);
++nFrameGen;
int32 currentFrame = nFrameGen & 3;
RwRGBA color = color2;
if (nFrameGen & 1)
color = color1;
- float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
- int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
+ float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.20f);
+ int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 40);
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0);
}
PlayOneShotScriptObject(SCRIPT_SOUND_TIRE_COLLISION, vecPos);
@@ -281,16 +281,16 @@ CObject::ObjectDamage(float amount)
const RwRGBA color1 = { 200, 0, 0, 255 };
const RwRGBA color2 = { 200, 200, 200, 255 };
for (int32 i = 0; i < 32; i++) {
- CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
- CGeneral::GetRandomNumberInRange(-0.35f, 0.7f),
- CGeneral::GetRandomNumberInRange(0.1f, 0.15f) + fDirectionZ);
+ CVector vecDir(CGeneral::GetRandomNumberInRange(-0.35f, 0.35f),
+ CGeneral::GetRandomNumberInRange(-0.35f, 0.35f),
+ CGeneral::GetRandomNumberInRange(0.1f, 0.25f) + fDirectionZ);
++nFrameGen;
int32 currentFrame = nFrameGen & 3;
RwRGBA color = color2;
if (nFrameGen & 1)
color = color1;
- float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.18f);
- int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 80);
+ float fSize = CGeneral::GetRandomNumberInRange(0.02f, 0.20f);
+ int32 nRotationSpeed = CGeneral::GetRandomNumberInRange(-40, 40);
CParticle::AddParticle(PARTICLE_CAR_DEBRIS, vecPos, vecDir, nil, fSize, color, nRotationSpeed, 0, currentFrame, 0);
}
PlayOneShotScriptObject(SCRIPT_SOUND_METAL_COLLISION, vecPos);
@@ -389,7 +389,8 @@ CObject::DeleteAllTempObjectsInArea(CVector point, float fRadius)
CObjectPool *objectPool = CPools::GetObjectPool();
for (int32 i = 0; i < objectPool->GetSize(); 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);
delete pObject;
}