summaryrefslogtreecommitdiffstats
path: root/src/control/Pickups.cpp
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-05-20 19:10:05 +0200
committereray orçunus <erayorcunus@gmail.com>2020-05-20 19:21:27 +0200
commit2ab3fb5dd02aad980718f1ac176f06f7b7e25f41 (patch)
tree974cd9b8b95fb9655621143932eca14154fe7df6 /src/control/Pickups.cpp
parentMerge pull request #569 from aap/miami (diff)
downloadre3-2ab3fb5dd02aad980718f1ac176f06f7b7e25f41.tar
re3-2ab3fb5dd02aad980718f1ac176f06f7b7e25f41.tar.gz
re3-2ab3fb5dd02aad980718f1ac176f06f7b7e25f41.tar.bz2
re3-2ab3fb5dd02aad980718f1ac176f06f7b7e25f41.tar.lz
re3-2ab3fb5dd02aad980718f1ac176f06f7b7e25f41.tar.xz
re3-2ab3fb5dd02aad980718f1ac176f06f7b7e25f41.tar.zst
re3-2ab3fb5dd02aad980718f1ac176f06f7b7e25f41.zip
Diffstat (limited to 'src/control/Pickups.cpp')
-rw-r--r--src/control/Pickups.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index b5e20e41..9492e0e1 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -1018,6 +1018,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