diff options
author | Nikolay Korolev <nickvnuk@gmail.com> | 2020-05-20 22:54:22 +0200 |
---|---|---|
committer | Nikolay Korolev <nickvnuk@gmail.com> | 2020-05-20 22:54:22 +0200 |
commit | 510261cb058d00bc0388ad58a33b173e5b1536ac (patch) | |
tree | 2aa795fe25f5d3bc4fa22d93f7a966838e50b3b5 /src/control/Pickups.cpp | |
parent | script revision (diff) | |
parent | Pickup and audio fix (diff) | |
download | re3-510261cb058d00bc0388ad58a33b173e5b1536ac.tar re3-510261cb058d00bc0388ad58a33b173e5b1536ac.tar.gz re3-510261cb058d00bc0388ad58a33b173e5b1536ac.tar.bz2 re3-510261cb058d00bc0388ad58a33b173e5b1536ac.tar.lz re3-510261cb058d00bc0388ad58a33b173e5b1536ac.tar.xz re3-510261cb058d00bc0388ad58a33b173e5b1536ac.tar.zst re3-510261cb058d00bc0388ad58a33b173e5b1536ac.zip |
Diffstat (limited to 'src/control/Pickups.cpp')
-rw-r--r-- | src/control/Pickups.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp index b5e20e41..4e4c02ab 100644 --- a/src/control/Pickups.cpp +++ b/src/control/Pickups.cpp @@ -136,6 +136,7 @@ CPickup::GiveUsAPickUpObject(int32 handle) object->bExplosionProof = true; object->bUsesCollision = false; object->bIsPickup = true; + object->bHasPreRenderEffects = true; object->m_nBonusValue = m_eModelIndex == MI_PICKUP_BONUS ? m_nQuantity : 0; @@ -1018,6 +1019,25 @@ CPickups::RenderPickUpText() } void +CPickups::CreateSomeMoney(CVector pos, int money) +{ + bool found; + + int pickupCount = Min(money / 20 + 1, 7); + int moneyPerPickup = money / pickupCount; + + for (int i = 0; i < pickupCount; i++) { + // (CGeneral::GetRandomNumber() % 256) * PI / 128 gives a float up to something TWOPI-ish. + pos.x += 1.5f * Sin((CGeneral::GetRandomNumber() % 256) * PI / 128); + pos.y += 1.5f * Cos((CGeneral::GetRandomNumber() % 256) * PI / 128); + pos.z = CWorld::FindGroundZFor3DCoord(pos.x, pos.y, pos.z, &found) + 0.5f; + if (found) { + CPickups::GenerateNewOne(CVector(pos.x, pos.y, pos.z), MI_MONEY, PICKUP_MONEY, moneyPerPickup + (CGeneral::GetRandomNumber() & 3)); + } + } +} + +void CPickups::Load(uint8 *buf, uint32 size) { INITSAVEBUF |