summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/control/Pickups.cpp19
-rw-r--r--src/control/Pickups.h1
-rw-r--r--src/control/Script.h2
-rw-r--r--src/control/TrafficLights.cpp5
4 files changed, 22 insertions, 5 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
diff --git a/src/control/Pickups.h b/src/control/Pickups.h
index 810f3dff..0a73696a 100644
--- a/src/control/Pickups.h
+++ b/src/control/Pickups.h
@@ -91,6 +91,7 @@ public:
static bool GivePlayerGoodiesWithPickUpMI(int16 modelIndex, int playerIndex);
static bool TestForPickupsInBubble(CVector pos, float range);
static bool TryToMerge_WeaponType(CVector pos, eWeaponType weapon, uint8 type, uint32 quantity, bool unused);
+ static void CreateSomeMoney(CVector, int);
static void Load(uint8 *buf, uint32 size);
static void Save(uint8 *buf, uint32 *size);
diff --git a/src/control/Script.h b/src/control/Script.h
index 3393467e..f7aaa46c 100644
--- a/src/control/Script.h
+++ b/src/control/Script.h
@@ -232,7 +232,7 @@ enum {
MAX_NUM_INTRO_RECTANGLES = 16,
MAX_NUM_SCRIPT_SRPITES = 16,
MAX_NUM_SCRIPT_SPHERES = 16,
- MAX_NUM_USED_OBJECTS = 200,
+ MAX_NUM_USED_OBJECTS = 220,
MAX_NUM_MISSION_SCRIPTS = 120,
MAX_NUM_BUILDING_SWAPS = 25,
MAX_NUM_INVISIBILITY_SETTINGS = 20,
diff --git a/src/control/TrafficLights.cpp b/src/control/TrafficLights.cpp
index b1816936..8487847f 100644
--- a/src/control/TrafficLights.cpp
+++ b/src/control/TrafficLights.cpp
@@ -145,10 +145,7 @@ CTrafficLights::ScanForLightsOnMap(void)
CPtrList &list = CWorld::GetSector(x, y)->m_lists[ENTITYLIST_DUMMIES];
for(node = list.first; node; node = node->next){
CEntity *light = (CEntity*)node->item;
- if(light->GetModelIndex() != MI_TRAFFICLIGHTS &&
- light->GetModelIndex() != MI_TRAFFICLIGHTS_VERTICAL &&
- light->GetModelIndex() != MI_TRAFFICLIGHTS_MIAMI &&
- light->GetModelIndex() != MI_TRAFFICLIGHTS_TWOVERTICAL)
+ if (!IsTrafficLight(light->GetModelIndex()))
continue;
// Check cars