diff options
author | eray orçunus <erayorcunus@gmail.com> | 2020-06-16 22:55:28 +0300 |
---|---|---|
committer | eray orçunus <erayorcunus@gmail.com> | 2020-06-16 22:55:28 +0300 |
commit | a822692c2647964c8dba6c8ea12168c5f80e335e (patch) | |
tree | 0ce2167cf566e6b23c48b5ff791746b7796f4315 /src/control/Pickups.cpp | |
parent | 7ae0b8ef06fc6cc1410f29ebd130af736688ef6f (diff) |
fix crash-VC pickup scaling
Diffstat (limited to 'src/control/Pickups.cpp')
-rw-r--r-- | src/control/Pickups.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index 1db6dfa2..95abe2c5 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -71,11 +71,6 @@ uint8 aWeaponBlues[] = { 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 128, 255, 0, 0 }; -float aWeaponScale[] = { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -2.0f, 1.5f, 1.0f, 1.0f, 1.5f, 1.0f, 2.0f, 1.0f, 2.0f, 2.5f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f }; - void CPickup::RemoveKeepType() { @@ -770,7 +765,15 @@ CPickups::DoPickUpEffects(CEntity *entity) } } - entity->GetMatrix().SetRotateZOnlyScaled((float)(CTimer::GetTimeInMilliseconds() & 0x7FF) * DEGTORAD(360.0f / 0x800), aWeaponScale[colorId]); + uint32 model = entity->GetModelIndex(); + CColModel* colModel = entity->GetColModel(); + CVector colLength = colModel->boundingBox.max - colModel->boundingBox.min; + + float scale = (Max(1.f, 1.2f / Max(colLength.x, Max(colLength.y, colLength.z))) - 1.0f) * 0.6f + 1.0f; + if (model == MI_MINIGUN || model == MI_MINIGUN2) + scale = 1.2f; + + entity->GetMatrix().SetRotateZOnlyScaled((float)(CTimer::GetTimeInMilliseconds() & 0x7FF) * DEGTORAD(360.0f / 0x800), scale); if (doInnerGlow) CCoronas::RegisterCorona((uintptr)entity + 1, 126, 69, 121, 255, entity->GetPosition(), 1.2f, 50.0f, |