summaryrefslogtreecommitdiffstats
path: root/src/control
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-05-20 22:54:22 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-05-20 22:54:22 +0200
commit510261cb058d00bc0388ad58a33b173e5b1536ac (patch)
tree2aa795fe25f5d3bc4fa22d93f7a966838e50b3b5 /src/control
parentscript revision (diff)
parentPickup and audio fix (diff)
downloadre3-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')
-rw-r--r--src/control/Pickups.cpp20
-rw-r--r--src/control/Pickups.h1
-rw-r--r--src/control/Script.h2
-rw-r--r--src/control/TrafficLights.cpp5
4 files changed, 23 insertions, 5 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
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 4f9f6b74..f335c148 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