summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRoman Masanin <36927roma@gmail.com>2020-10-24 21:26:56 +0200
committerRoman Masanin <36927roma@gmail.com>2020-10-24 21:26:56 +0200
commita12789c632897c2f1339f806158e84c565bd8580 (patch)
treef7eb31c812c3c194eeee0c8defe440e675eae567 /src
parentmark reflections done (diff)
parentModel indices edits (diff)
downloadre3-a12789c632897c2f1339f806158e84c565bd8580.tar
re3-a12789c632897c2f1339f806158e84c565bd8580.tar.gz
re3-a12789c632897c2f1339f806158e84c565bd8580.tar.bz2
re3-a12789c632897c2f1339f806158e84c565bd8580.tar.lz
re3-a12789c632897c2f1339f806158e84c565bd8580.tar.xz
re3-a12789c632897c2f1339f806158e84c565bd8580.tar.zst
re3-a12789c632897c2f1339f806158e84c565bd8580.zip
Diffstat (limited to 'src')
-rw-r--r--src/audio/oal/stream.cpp2
-rw-r--r--src/control/Pickups.cpp293
-rw-r--r--src/control/Pickups.h16
-rw-r--r--src/core/CdStreamPosix.cpp2
-rw-r--r--src/core/Game.h4
-rw-r--r--src/core/config.h2
-rw-r--r--src/modelinfo/ModelIndices.h67
-rw-r--r--src/objects/Object.h2
-rw-r--r--src/objects/ObjectData.cpp73
-rw-r--r--src/peds/CivilianPed.cpp6
-rw-r--r--src/peds/Population.cpp8
-rw-r--r--src/render/Fluff.cpp693
-rw-r--r--src/render/Fluff.h50
-rw-r--r--src/render/WaterLevel.cpp119
-rw-r--r--src/render/WaterLevel.h16
-rw-r--r--src/weapons/Weapon.cpp9
16 files changed, 601 insertions, 761 deletions
diff --git a/src/audio/oal/stream.cpp b/src/audio/oal/stream.cpp
index 58b5dc02..06a38c29 100644
--- a/src/audio/oal/stream.cpp
+++ b/src/audio/oal/stream.cpp
@@ -202,7 +202,7 @@ public:
if (m_FileH) {
m_nChannels = op_head(m_FileH, 0)->channel_count;
- m_nRate = op_head(m_FileH, 0)->input_sample_rate;
+ m_nRate = 48000;
const OpusTags *tags = op_tags(m_FileH, 0);
for (int i = 0; i < tags->comments; i++) {
if (strncmp(tags->user_comments[i], "SAMPLERATE", sizeof("SAMPLERATE")-1) == 0)
diff --git a/src/control/Pickups.cpp b/src/control/Pickups.cpp
index ddf7cefb..8b8bc1a3 100644
--- a/src/control/Pickups.cpp
+++ b/src/control/Pickups.cpp
@@ -32,6 +32,9 @@
#include "World.h"
#include "Hud.h"
#include "Messages.h"
+#include "Streaming.h"
+
+// --MIAMI: file done
CPickup CPickups::aPickUps[NUMPICKUPS];
int16 CPickups::NumMessages;
@@ -39,7 +42,7 @@ int32 CPickups::aPickUpsCollected[NUMCOLLECTEDPICKUPS];
int16 CPickups::CollectedPickUpIndex;
int32 CPickups::PlayerOnWeaponPickup;
-int32 CPickups::CollectPickupBuffer;
+int32 CollectPickupBuffer;
// unused
bool CPickups::bPickUpcamActivated;
@@ -49,15 +52,12 @@ uint32 CPickups::StaticCamStartTime;
tPickupMessage CPickups::aMessages[NUMPICKUPMESSAGES];
-// --MIAMI: Done
uint16 AmmoForWeapon[WEAPONTYPE_TOTALWEAPONS + 1] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 8, 8, 8, 8, 68, 24,
32, 28, 20, 200, 120, 120, 120, 120, 120, 40, 28, 8, 300, 200, 1000, 1, 400, 36, 0 };
-// --MIAMI: Done
uint16 AmmoForWeapon_OnStreet[WEAPONTYPE_TOTALWEAPONS + 1] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 4, 34, 12,
16, 14, 10, 100, 60, 60, 60, 60, 60, 20, 14, 4, 150, 100, 500, 1, 400, 36, 0 };
-// --MIAMI: Done
uint16 CostOfWeapon[WEAPONTYPE_TOTALWEAPONS + 3] = { 0, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 1000, 1000,
1000, 500, 8000, 250, 400, 1200, 1250, 1250, 800, 800, 650, 1200, 5000, 400,
10000, 10000, 8000, 8000, 8000, 10000, 1000, 11000, 500, 20, 10, 0 };
@@ -140,24 +140,42 @@ ModifyStringLabelForControlSetting(char *str)
}
}
+inline bool
+IsWeaponSlotAmmoMergeable(uint32 slot)
+{
+ return slot == WEAPONSLOT_SHOTGUN || slot == WEAPONSLOT_SUBMACHINEGUN || slot == WEAPONSLOT_RIFLE;
+}
+
void
-CPickup::RemoveKeepType()
+CPickup::ExtractAmmoFromPickup(CPlayerPed *player)
{
- CWorld::Remove(m_pObject);
- delete m_pObject;
+ eWeaponType weaponType = CPickups::WeaponForModel(m_pObject->GetModelIndex());
+
+ if (m_eType == PICKUP_IN_SHOP || !IsWeaponSlotAmmoMergeable(CWeaponInfo::GetWeaponInfo(weaponType)->m_nWeaponSlot))
+ return;
- m_bRemoved = true;
- m_pObject = nil;
+ uint32 ammo = m_nQuantity;
+ if (ammo == 0) {
+ if (!m_bWasAmmoCollected)
+ ammo = AmmoForWeapon_OnStreet[weaponType];
+ else
+ goto removeAmmo;
+ }
+ player->GrantAmmo(weaponType, ammo);
+ DMAudio.PlayOneShot(player->m_audioEntityId, SOUND_WEAPON_RELOAD, weaponType); // BUG? weapon type as volume, wtf?
+removeAmmo:
+ m_nQuantity = 0;
+ m_bWasAmmoCollected = true;
}
void
CPickup::Remove()
{
- RemoveKeepType();
+ GetRidOfObjects();
+ m_bRemoved = true;
m_eType = PICKUP_NONE;
}
-// --MIAMI: Done
CObject *
CPickup::GiveUsAPickUpObject(CObject **ppObject, CObject **ppExtraObject, int32 handle, int32 extraHandle)
{
@@ -200,7 +218,7 @@ CPickup::GiveUsAPickUpObject(CObject **ppObject, CObject **ppExtraObject, int32
object->bExplosionProof = true;
object->bUsesCollision = false;
object->bIsPickup = true;
- object->obj_flag_02 = m_effects;
+ object->bAmmoCollected = m_bWasAmmoCollected;
object->bHasPreRenderEffects = true;
if (extraObject) {
@@ -214,7 +232,7 @@ CPickup::GiveUsAPickUpObject(CObject **ppObject, CObject **ppExtraObject, int32
extraObject->bExplosionProof = true;
extraObject->bUsesCollision = false;
extraObject->bIsPickup = true;
- extraObject->obj_flag_02 = true;
+ extraObject->bAmmoCollected = true;
extraObject->bHasPreRenderEffects = true;
extraObject->m_nBonusValue = 0;
extraObject->bPickupObjWithMessage = false;
@@ -274,6 +292,7 @@ CPickup::CanBePickedUp(CPlayerPed *player, int playerId)
bool
CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
{
+ bool result = false;
float waterLevel;
if (m_pObject) {
@@ -345,38 +364,94 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
}
}
- // MIAMI code here
-
- // ...
+ if (isPickupTouched) {
+ eWeaponType weaponType = CPickups::WeaponForModel(m_pObject->GetModelIndex());
+ if (weaponType < WEAPONTYPE_TOTALWEAPONS && CDarkel::FrenzyOnGoing()) {
+ isPickupTouched = false;
+ m_bWasControlMessageShown = false;
+ } else if (weaponType != WEAPONTYPE_UNARMED) {
+ uint32 slot = CWeaponInfo::GetWeaponInfo(weaponType)->m_nWeaponSlot;
+ eWeaponType plrWeaponSlot = FindPlayerPed()->GetWeapon(slot).m_eWeaponType;
+ if (plrWeaponSlot != weaponType) {
+ if (CStreaming::ms_aInfoForModel[m_pObject->GetModelIndex()].m_loadState == STREAMSTATE_LOADED) {
+ if (plrWeaponSlot == WEAPONTYPE_UNARMED || (FindPlayerPed()->GetWeapon(slot).m_nAmmoTotal == 0 && !IsWeaponSlotAmmoMergeable(slot))) {
+ if (CTimer::GetTimeInMilliseconds() - FindPlayerPed()->m_nPadDownPressedInMilliseconds < 1500) {
+ CPickups::PlayerOnWeaponPickup = 6;
+ isPickupTouched = false;
+ }
+ } else {
+ CPickups::PlayerOnWeaponPickup = 6;
+ if (IsWeaponSlotAmmoMergeable(slot)) {
+ if (m_eType == PICKUP_ONCE_TIMEOUT || m_eType == PICKUP_ONCE || m_eType == PICKUP_ON_STREET) {
+ ExtractAmmoFromPickup(player);
+ FindPlayerPed()->GetWeapon(slot).Reload();
+ }
+ }
+ if (!m_bWasControlMessageShown) {
+ switch (CPad::GetPad(0)->Mode)
+ {
+ case 0:
+ case 1:
+ CHud::SetHelpMessage(TheText.Get("PU_CF1"), false);
+ break;
+ case 2:
+ CHud::SetHelpMessage(TheText.Get("PU_CF3"), false);
+ break;
+ case 3:
+ CHud::SetHelpMessage(TheText.Get("PU_CF4"), false);
+ break;
+ default:
+ break;
+ }
+ m_bWasControlMessageShown = true;
+ }
+ if (CollectPickupBuffer == 0)
+ isPickupTouched = false;
+ if (CTimer::GetTimeInMilliseconds() - FindPlayerPed()->m_nPadDownPressedInMilliseconds < 1500)
+ isPickupTouched = false;
+ }
+ } else
+ isPickupTouched = false;
+ }
+ }
+ } else
+ m_bWasControlMessageShown = false;
// if we didn't then we've got nothing to do
if (isPickupTouched && CanBePickedUp(player, playerId)) {
- CPad::GetPad(0)->StartShake(120, 100);
+ if (m_pObject->GetModelIndex() != MI_PICKUP_PROPERTY && m_pObject->GetModelIndex() != MI_PICKUP_PROPERTY_FORSALE)
+ CPad::GetPad(0)->StartShake(120, 100);
+
+ eWeaponType weaponType = CPickups::WeaponForModel(m_pObject->GetModelIndex());
switch (m_eType)
{
case PICKUP_IN_SHOP:
- if (CWorld::Players[playerId].m_nMoney < CostOfWeapon[CPickups::WeaponForModel(m_pObject->GetModelIndex())]) {
+ if (CWorld::Players[playerId].m_nMoney < CostOfWeapon[weaponType])
CGarages::TriggerMessage("PU_MONY", -1, 6000, -1);
- } else {
- CWorld::Players[playerId].m_nMoney -= CostOfWeapon[CPickups::WeaponForModel(m_pObject->GetModelIndex())];
+ else {
+ CWorld::Players[playerId].m_nMoney -= CostOfWeapon[weaponType];
if (!CPickups::GivePlayerGoodiesWithPickUpMI(m_pObject->GetModelIndex(), playerId)) {
- player->GiveWeapon(CPickups::WeaponForModel(m_pObject->GetModelIndex()), AmmoForWeapon[CPickups::WeaponForModel(m_pObject->GetModelIndex())]);
- player->m_nSelectedWepSlot = player->GetWeaponSlot(CPickups::WeaponForModel(m_pObject->GetModelIndex()));
+ if (!player->DoesPlayerWantNewWeapon(weaponType, false))
+ break;
+ player->GiveWeapon(weaponType, AmmoForWeapon[weaponType]);
+ player->m_nSelectedWepSlot = player->GetWeaponSlot(weaponType);
DMAudio.PlayFrontEndSound(SOUND_PICKUP_WEAPON_BOUGHT, m_pObject->GetModelIndex() - MI_GRENADE);
}
- RemoveKeepType();
- m_nTimer = CTimer::GetTimeInMilliseconds() + 5000;
- return true;
+ result = true;
+ Remove();
}
break;
case PICKUP_ON_STREET:
case PICKUP_ON_STREET_SLOW:
if (!CPickups::GivePlayerGoodiesWithPickUpMI(m_pObject->GetModelIndex(), playerId)) {
- if (CPickups::WeaponForModel(m_pObject->GetModelIndex())) {
- player->GiveWeapon(CPickups::WeaponForModel(m_pObject->GetModelIndex()), m_nQuantity != 0 ? m_nQuantity : AmmoForWeapon_OnStreet[CPickups::WeaponForModel(m_pObject->GetModelIndex())]);
- if (player->m_nSelectedWepSlot == player->GetWeaponSlot(WEAPONTYPE_UNARMED)) {
- player->m_nSelectedWepSlot = player->GetWeaponSlot(CPickups::WeaponForModel(m_pObject->GetModelIndex()));
- }
+ if (!player->DoesPlayerWantNewWeapon(weaponType, false))
+ break;
+ if (weaponType != WEAPONTYPE_UNARMED) {
+ player->GiveWeapon(weaponType, m_nQuantity != 0 ? m_nQuantity : (m_bWasAmmoCollected ? 0 : AmmoForWeapon_OnStreet[weaponType]), true);
+
+ if (player->m_nSelectedWepSlot == player->GetWeaponSlot(WEAPONTYPE_UNARMED))
+ player->m_nSelectedWepSlot = player->GetWeaponSlot(weaponType);
+
DMAudio.PlayFrontEndSound(SOUND_PICKUP_WEAPON, m_pObject->GetModelIndex() - MI_GRENADE);
} else if (m_pObject->GetModelIndex() == MI_PICKUP_CAMERA && vehicle != nil) {
DMAudio.PlayFrontEndSound(SOUND_PICKUP_BONUS, 0);
@@ -386,29 +461,39 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
CPickups::StaticCamStartTime = CTimer::GetTimeInMilliseconds();
}
}
- if (m_eType == PICKUP_ON_STREET) {
+ if (m_eType == PICKUP_ON_STREET)
m_nTimer = CTimer::GetTimeInMilliseconds() + 30000;
- } else if (m_eType == PICKUP_ON_STREET_SLOW) {
+ else if (m_eType == PICKUP_ON_STREET_SLOW) {
if (MI_PICKUP_BRIBE == m_pObject->GetModelIndex())
m_nTimer = CTimer::GetTimeInMilliseconds() + 300000;
else
m_nTimer = CTimer::GetTimeInMilliseconds() + 720000;
}
- RemoveKeepType();
- return true;
+ result = true;
+ GetRidOfObjects();
+ m_bRemoved = true;
+ break;
case PICKUP_ONCE:
case PICKUP_ONCE_TIMEOUT:
+ case PICKUP_ONCE_TIMEOUT_SLOW:
if (!CPickups::GivePlayerGoodiesWithPickUpMI(m_pObject->GetModelIndex(), playerId)) {
- if (CPickups::WeaponForModel(m_pObject->GetModelIndex())) {
- player->GiveWeapon(CPickups::WeaponForModel(m_pObject->GetModelIndex()), m_nQuantity != 0 ? m_nQuantity : AmmoForWeapon[CPickups::WeaponForModel(m_pObject->GetModelIndex())]);
+ if (!player->DoesPlayerWantNewWeapon(weaponType, false)) {
+ ExtractAmmoFromPickup(player);
+ break;
+ }
+
+ if (weaponType != WEAPONTYPE_UNARMED) {
+ player->GiveWeapon(weaponType, m_nQuantity != 0 ? m_nQuantity : (m_bWasAmmoCollected ? 0 : AmmoForWeapon[weaponType]), true);
if (player->m_nSelectedWepSlot == player->GetWeaponSlot(WEAPONTYPE_UNARMED))
- player->m_nSelectedWepSlot = player->GetWeaponSlot(CPickups::WeaponForModel(m_pObject->GetModelIndex()));
+ player->m_nSelectedWepSlot = player->GetWeaponSlot(weaponType);
}
- DMAudio.PlayFrontEndSound(SOUND_PICKUP_WEAPON, m_pObject->GetModelIndex() - MI_GRENADE);
+ if (MI_PICKUP_SAVEGAME != m_pObject->GetModelIndex())
+ DMAudio.PlayFrontEndSound(SOUND_PICKUP_WEAPON, m_pObject->GetModelIndex() - MI_GRENADE);
}
+ result = true;
Remove();
- return true;
+ break;
case PICKUP_COLLECTABLE1:
CWorld::Players[playerId].m_nCollectedPackages++;
CWorld::Players[playerId].m_nMoney += 100;
@@ -420,6 +505,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
} else
CGarages::TriggerMessage("CO_ONE", CWorld::Players[CWorld::PlayerInFocus].m_nCollectedPackages, 5000, CWorld::Players[CWorld::PlayerInFocus].m_nTotalPackages);
+ result = true;
Remove();
DMAudio.PlayFrontEndSound(SOUND_PICKUP_HIDDEN_PACKAGE, 0);
return true;
@@ -429,6 +515,7 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
#ifdef MONEY_MESSAGES
CMoneyMessages::RegisterOne(m_vecPos + CVector(0.0f, 0.0f, 1.0f), gString, 0, 255, 0, 0.5f, 0.5f);
#endif
+ result = true;
Remove();
DMAudio.PlayFrontEndSound(SOUND_PICKUP_MONEY, 0);
return true;
@@ -437,27 +524,33 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
m_fRevenue = 0.0f;
DMAudio.PlayFrontEndSound(SOUND_PICKUP_MONEY, 0);
return false;
- // TODO(Miami): Control flow
+ case PICKUP_PROPERTY_LOCKED:
+ if (!m_bWasControlMessageShown) {
+ m_bWasControlMessageShown = true;
+ CHud::SetHelpMessage(TheText.Get(m_sTextKey), false);
+ }
+ break;
case PICKUP_PROPERTY_FORSALE:
ModifyStringLabelForControlSetting(m_sTextKey);
CMessages::InsertNumberInString(TheText.Get(m_sTextKey), m_nQuantity,
0, 0, 0, 0, 0, gUString);
if (!CHud::IsHelpMessageBeingDisplayed())
- CHud::SetHelpMessage(gUString, false); // 0, 0, 0);
- if (CPickups::CollectPickupBuffer == 0)
- return false;
- if (CTheScripts::IsPlayerOnAMission()) {
- CHud::SetHelpMessage(TheText.Get("PROP_2"), true); // , false);
- } else {
+ CHud::SetHelpMessage(gUString, false);
+ if (CollectPickupBuffer == 0)
+ break;
+ if (CTheScripts::IsPlayerOnAMission())
+ CHud::SetHelpMessage(TheText.Get("PROP_2"), true);
+ else {
if (CWorld::Players[CWorld::PlayerInFocus].m_nMoney >= m_nQuantity) {
CWorld::Players[CWorld::PlayerInFocus].m_nMoney -= m_nQuantity;
- CHud::SetHelpMessage(nil, true); //, false);
+ CHud::SetHelpMessage(nil, true);
+ result = true;
Remove();
- return true;
+ break;
}
- CHud::SetHelpMessage(TheText.Get("PROP_1"), true); //, false);
+ CHud::SetHelpMessage(TheText.Get("PROP_1"), true);
}
- return false;
+ break;
default:
break;
}
@@ -484,7 +577,9 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
CVehicle *vehicle = CPools::GetVehiclePool()->GetSlot(i);
if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 1.5f)) {
touched = true;
+#ifdef FIX_BUGS
break; // added break here
+#endif
}
}
@@ -511,7 +606,9 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
CVehicle *vehicle = CPools::GetVehiclePool()->GetSlot(i);
if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 1.5f)) {
explode = true;
+#ifdef FIX_BUGS
break; // added break here
+#endif
}
}
}
@@ -538,19 +635,39 @@ CPickup::Update(CPlayerPed *player, CVehicle *vehicle, int playerId)
m_pObject->UpdateRwFrame();
if (vehicle != nil && vehicle->IsSphereTouchingVehicle(m_pObject->GetPosition().x, m_pObject->GetPosition().y, m_pObject->GetPosition().z, 2.0f)) {
Remove();
+ result = true;
DMAudio.PlayFrontEndSound(SOUND_PICKUP_FLOAT_PACKAGE, 0);
- return true;
}
break;
default: break;
}
}
- if (!m_bRemoved && (m_eType == PICKUP_ONCE_TIMEOUT || m_eType == PICKUP_MONEY) && CTimer::GetTimeInMilliseconds() > m_nTimer)
+
+ if (!m_bRemoved && (m_eType == PICKUP_ONCE_TIMEOUT || m_eType == PICKUP_ONCE_TIMEOUT_SLOW || m_eType == PICKUP_MONEY) && CTimer::GetTimeInMilliseconds() > m_nTimer)
Remove();
- return false;
+
+ return result;
+}
+
+void
+CPickup::ProcessGunShot(CVector *vec1, CVector *vec2)
+{
+ CColLine line(*vec1, *vec2);
+ if (m_pObject) {
+ CColSphere sphere;
+ sphere.radius = 4.0f;
+ sphere.center = m_pObject->GetPosition();
+ if (CCollision::TestLineSphere(line, sphere)) {
+ CExplosion::AddExplosion(nil, nil, EXPLOSION_MINE, m_pObject->GetPosition(), 0);
+ CWorld::Remove(m_pObject);
+ delete m_pObject;
+ m_pObject = nil;
+ m_bRemoved = true;
+ m_eType = PICKUP_NONE;
+ }
+ }
}
-// --MIAMI: Done
void
CPickup::GetRidOfObjects()
{
@@ -566,7 +683,6 @@ CPickup::GetRidOfObjects()
}
}
-// --MIAMI: Done
void
CPickups::Init(void)
{
@@ -584,7 +700,6 @@ CPickups::Init(void)
CollectedPickUpIndex = 0;
}
-// --MIAMI: Done
bool
CPickups::TestForPickupsInBubble(CVector pos, float range)
{
@@ -595,7 +710,6 @@ CPickups::TestForPickupsInBubble(CVector pos, float range)
return false;
}
-// --MIAMI: Done
bool
CPickups::TryToMerge_WeaponType(CVector pos, eWeaponType weapon, uint8 type, uint32 quantity, bool unused) {
for (int i = 0; i < NUMPICKUPS; i++) {
@@ -608,7 +722,6 @@ CPickups::TryToMerge_WeaponType(CVector pos, eWeaponType weapon, uint8 type, uin
return false;
}
-// --MIAMI: Done
bool
CPickups::IsPickUpPickedUp(int32 pickupId)
{
@@ -621,7 +734,6 @@ CPickups::IsPickUpPickedUp(int32 pickupId)
return false;
}
-// --MIAMI: Done
void
CPickups::PassTime(uint32 time)
{
@@ -635,7 +747,6 @@ CPickups::PassTime(uint32 time)
}
}
-// --MIAMI: Done
int32
CPickups::GetActualPickupIndex(int32 index)
{
@@ -646,7 +757,6 @@ CPickups::GetActualPickupIndex(int32 index)
return (uint16)index;
}
-// --MIAMI: Done
bool
CPickups::GivePlayerGoodiesWithPickUpMI(int16 modelIndex, int playerIndex)
{
@@ -687,22 +797,6 @@ CPickups::GivePlayerGoodiesWithPickUpMI(int16 modelIndex, int playerIndex)
return false;
}
-// --MIAMI: Todo
-void
-CPickups::RemoveAllFloatingPickups()
-{
- for (int i = 0; i < NUMPICKUPS; i++) {
- if (aPickUps[i].m_eType == PICKUP_FLOATINGPACKAGE || aPickUps[i].m_eType == PICKUP_FLOATINGPACKAGE_FLOATING) {
- if (aPickUps[i].m_pObject) {
- CWorld::Remove(aPickUps[i].m_pObject);
- delete aPickUps[i].m_pObject;
- aPickUps[i].m_pObject = nil;
- }
- }
- }
-}
-
-// --MIAMI: Done
void
CPickups::RemovePickUp(int32 pickupIndex)
{
@@ -723,7 +817,6 @@ CPickups::RemovePickUp(int32 pickupIndex)
aPickUps[index].m_bRemoved = true;
}
-// --MIAMI: Done
int32
CPickups::GenerateNewOne(CVector pos, uint32 modelIndex, uint8 type, uint32 quantity, uint32 rate, bool highPriority, char* pText)
{
@@ -770,8 +863,8 @@ CPickups::GenerateNewOne(CVector pos, uint32 modelIndex, uint8 type, uint32 quan
aPickUps[slot].m_nMoneySpeed = rate;
aPickUps[slot].m_fRevenue = 0.0f;
aPickUps[slot].m_nTimer = CTimer::GetTimeInMilliseconds();
- aPickUps[slot].m_effects = highPriority;
- aPickUps[slot].m_effects2 = false;
+ aPickUps[slot].m_bWasAmmoCollected = highPriority;
+ aPickUps[slot].m_bWasControlMessageShown = false;
if (type == PICKUP_ONCE_TIMEOUT)
aPickUps[slot].m_nTimer = CTimer::GetTimeInMilliseconds() + 20000;
else if (type == PICKUP_ONCE_TIMEOUT_SLOW)
@@ -800,14 +893,12 @@ CPickups::GenerateNewOne(CVector pos, uint32 modelIndex, uint8 type, uint32 quan
return GetNewUniquePickupIndex(slot);
}
-// --MIAMI: Done
int32
CPickups::GenerateNewOne_WeaponType(CVector pos, eWeaponType weaponType, uint8 type, uint32 quantity)
{
return GenerateNewOne(pos, ModelForWeapon(weaponType), type, quantity);
}
-// --MIAMI: Done
int32
CPickups::GetNewUniquePickupIndex(int32 slot)
{
@@ -818,14 +909,12 @@ CPickups::GetNewUniquePickupIndex(int32 slot)
return slot | (aPickUps[slot].m_nIndex << 16);
}
-// --MIAMI: Done
int32
CPickups::ModelForWeapon(eWeaponType weaponType)
{
return CWeaponInfo::GetWeaponInfo(weaponType)->m_nModelId;
}
-// --MIAMI: Done
eWeaponType
CPickups::WeaponForModel(int32 model)
{
@@ -833,10 +922,9 @@ CPickups::WeaponForModel(int32 model)
if (model == MI_PICKUP_HEALTH) return WEAPONTYPE_HEALTH;
if (model == MI_PICKUP_ADRENALINE) return WEAPONTYPE_ARMOUR;
if (model == -1) return WEAPONTYPE_UNARMED;
- return (eWeaponType)((CWeaponModelInfo*)CModelInfo::GetModelInfo(model))->GetWeaponInfo();
+ return ((CWeaponModelInfo*)CModelInfo::GetModelInfo(model))->GetWeaponInfo();
}
-// --MIAMI: Done
void
CPickups::AddToCollectedPickupsArray(int32 index)
{
@@ -893,19 +981,16 @@ CPickups::Update()
#else // BUG: this code can only reach 318 out of 320 pickups
for (uint32 i = NUMGENERALPICKUPS / PICKUPS_FRAME_SPAN * (CTimer::GetFrameCounter() % PICKUPS_FRAME_SPAN); i < NUMGENERALPICKUPS / PICKUPS_FRAME_SPAN * (CTimer::GetFrameCounter() % PICKUPS_FRAME_SPAN + 1); i++) {
#endif
- if (aPickUps[i].m_eType != PICKUP_NONE && aPickUps[i].Update(FindPlayerPed(), FindPlayerVehicle(), CWorld::PlayerInFocus)) {
+ if (aPickUps[i].m_eType != PICKUP_NONE && aPickUps[i].Update(FindPlayerPed(), FindPlayerVehicle(), CWorld::PlayerInFocus))
AddToCollectedPickupsArray(i);
- }
}
#undef PICKUPS_FRAME_SPAN
for (uint32 i = NUMGENERALPICKUPS; i < NUMPICKUPS; i++) {
- if (aPickUps[i].m_eType != PICKUP_NONE && aPickUps[i].Update(FindPlayerPed(), FindPlayerVehicle(), CWorld::PlayerInFocus)) {
+ if (aPickUps[i].m_eType != PICKUP_NONE && aPickUps[i].Update(FindPlayerPed(), FindPlayerVehicle(), CWorld::PlayerInFocus))
AddToCollectedPickupsArray(i);
- }
}
}
-// --MIAMI: Done
CPickup*
CPickups::FindPickUpForThisObject(CEntity *object)
{
@@ -917,7 +1002,6 @@ CPickups::FindPickUpForThisObject(CEntity *object)
return &aPickUps[0];
}
-// --MIAMI: Done
void
CPickups::DoPickUpEffects(CEntity *entity)
{
@@ -992,7 +1076,7 @@ CPickups::DoPickUpEffects(CEntity *entity)
else
corona2 = true;
- if (((CObject*)entity)->obj_flag_02) {
+ if (((CObject*)entity)->bAmmoCollected) {
corona2 = false;
corona1 = false;
}
@@ -1073,8 +1157,8 @@ CPickups::DoPickUpEffects(CEntity *entity)
CMatrix matrix2; // unused
entity->SetPosition(pickup->m_vecPos);
matrix1.SetRotateX(0.0f);
- matrix1.Rotate(DEGTORAD(4.477f), DEGTORAD(-29.731), DEGTORAD(-1.064));
- matrix1.Translate(CVector(0.829, -0.001, 0.226));
+ matrix1.Rotate(DEGTORAD(4.477f), DEGTORAD(-29.731f), DEGTORAD(-1.064f));
+ matrix1.Translate(CVector(0.829f, -0.001f, 0.226f));
entity->GetMatrix() *= matrix1;
}
@@ -1118,7 +1202,6 @@ CPickups::DoPickUpEffects(CEntity *entity)
}
}
-// --MIAMI: Done
void
CPickups::DoMineEffects(CEntity *entity)
{
@@ -1138,7 +1221,6 @@ CPickups::DoMineEffects(CEntity *entity)
entity->GetMatrix().SetRotateZOnly((float)(CTimer::GetTimeInMilliseconds() & 0x3FF) * DEGTORAD(360.0f / 0x400));
}
-// --MIAMI: Done
void
CPickups::DoMoneyEffects(CEntity *entity)
{
@@ -1158,7 +1240,6 @@ CPickups::DoMoneyEffects(CEntity *entity)
entity->GetMatrix().SetRotateZOnly((float)(CTimer::GetTimeInMilliseconds() & 0x7FF) * DEGTORAD(360.0f / 0x800));
}
-// --MIAMI: Done
void
CPickups::DoCollectableEffects(CEntity *entity)
{
@@ -1178,7 +1259,6 @@ CPickups::DoCollectableEffects(CEntity *entity)
entity->GetMatrix().SetRotateZOnly((float)(CTimer::GetTimeInMilliseconds() & 0xFFF) * DEGTORAD(360.0f / 0x1000));
}
-// --MIAMI: Done
void
CPickups::RenderPickUpText()
{
@@ -1278,7 +1358,6 @@ CPickups::RenderPickUpText()
NumMessages = 0;
}
-// --MIAMI: Done
void
CPickups::CreateSomeMoney(CVector pos, int money)
{
@@ -1298,12 +1377,11 @@ CPickups::CreateSomeMoney(CVector pos, int money)
}
}
-// --MIAMI: Done
void
CPickups::RemoveAllPickupsOfACertainWeaponGroupWithNoAmmo(eWeaponType weaponType)
{
uint32 weaponSlot = CWeaponInfo::GetWeaponInfo(weaponType)->m_nWeaponSlot;
- if (weaponSlot >= WEAPONSLOT_SHOTGUN && weaponSlot <= WEAPONSLOT_RIFLE) {
+ if (IsWeaponSlotAmmoMergeable(weaponSlot)) {
for (int slot = 0; slot < NUMPICKUPS; slot++) {
if (aPickUps[slot].m_eType == PICKUP_ONCE || aPickUps[slot].m_eType == PICKUP_ONCE_TIMEOUT || aPickUps[slot].m_eType == PICKUP_ONCE_TIMEOUT_SLOW) {
if (aPickUps[slot].m_pObject) {
@@ -1321,7 +1399,15 @@ CPickups::RemoveAllPickupsOfACertainWeaponGroupWithNoAmmo(eWeaponType weaponType
}
}
-// --MIAMI: Done
+void
+CPickups::DetonateMinesHitByGunShot(CVector *vec1, CVector *vec2)
+{
+ for (int i = 0; i < NUMGENERALPICKUPS; i++) {
+ if (aPickUps[i].m_eType == PICKUP_NAUTICAL_MINE_ARMED)
+ aPickUps[i].ProcessGunShot(vec1, vec2);
+ }
+}
+
void
CPickups::Load(uint8 *buf, uint32 size)
{
@@ -1349,7 +1435,6 @@ INITSAVEBUF
VALIDATESAVEBUF(size)
}
-// --MIAMI: Done
void
CPickups::Save(uint8 *buf, uint32 *size)
{
diff --git a/src/control/Pickups.h b/src/control/Pickups.h
index 6c3045f7..e48ae3b7 100644
--- a/src/control/Pickups.h
+++ b/src/control/Pickups.h
@@ -45,17 +45,18 @@ public:
char m_sTextKey[8];
ePickupType m_eType;
bool m_bRemoved;
- uint8 m_effects:1;
- uint8 m_effects2:1;
+ uint8 m_bWasAmmoCollected:1;
+ uint8 m_bWasControlMessageShown:1;
CObject *GiveUsAPickUpObject(CObject **object, CObject **extraObject, int32 handle, int32 extraHandle);
bool Update(CPlayerPed *player, CVehicle *vehicle, int playerId);
void GetRidOfObjects();
+ void ExtractAmmoFromPickup(CPlayerPed *player);
+ void ProcessGunShot(CVector *vec1, CVector *vec2);
private:
- bool IsMine() { return m_eType >= PICKUP_MINE_INACTIVE && m_eType <= PICKUP_FLOATINGPACKAGE_FLOATING; }
+ inline bool IsMine() { return m_eType >= PICKUP_MINE_INACTIVE && m_eType <= PICKUP_FLOATINGPACKAGE_FLOATING; }
inline bool CanBePickedUp(CPlayerPed *player, int playerId);
- void RemoveKeepType();
- void Remove();
+ inline void Remove();
};
VALIDATE_SIZE(CPickup, 0x1C);
@@ -79,7 +80,6 @@ class CPickups
static tPickupMessage aMessages[NUMPICKUPMESSAGES];
public:
static int32 PlayerOnWeaponPickup;
- static int32 CollectPickupBuffer;
static void Init();
static void Update();
@@ -91,7 +91,6 @@ public:
static int32 GenerateNewOne(CVector pos, uint32 modelIndex, uint8 type, uint32 quantity, uint32 rate = 0, bool highPriority = false, char* pText = nil);
static int32 GenerateNewOne_WeaponType(CVector pos, eWeaponType weaponType, uint8 type, uint32 quantity);
static void RemovePickUp(int32 pickupIndex);
- static void RemoveAllFloatingPickups();
static void AddToCollectedPickupsArray(int32 index);
static bool IsPickUpPickedUp(int32 pickupId);
static int32 ModelForWeapon(eWeaponType weaponType);
@@ -103,6 +102,7 @@ public:
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 DetonateMinesHitByGunShot(CVector *vec1, CVector *vec2);
static void Load(uint8 *buf, uint32 size);
static void Save(uint8 *buf, uint32 *size);
@@ -122,6 +122,8 @@ extern uint16 AmmoForWeapon[WEAPONTYPE_TOTALWEAPONS + 1];
extern uint16 AmmoForWeapon_OnStreet[WEAPONTYPE_TOTALWEAPONS + 1];
extern uint16 CostOfWeapon[WEAPONTYPE_TOTALWEAPONS + 3];
+extern int32 CollectPickupBuffer;
+
enum ePacmanPickupType
{
PACMAN_NONE,
diff --git a/src/core/CdStreamPosix.cpp b/src/core/CdStreamPosix.cpp
index fdc63a05..5c8d1b16 100644
--- a/src/core/CdStreamPosix.cpp
+++ b/src/core/CdStreamPosix.cpp
@@ -216,10 +216,12 @@ CdStreamShutdown(void)
#ifndef ONE_THREAD_PER_CHANNEL
gCdStreamThreadStatus = 2;
sem_post(gCdStreamSema);
+ pthread_join(_gCdStreamThread, nil);
#else
for ( int32 i = 0; i < gNumChannels; i++ ) {
gpReadInfo[i].nThreadStatus = 2;
sem_post(gpReadInfo[i].pStartSemaphore);
+ pthread_join(gpReadInfo[i].pChannelThread, nil);
}
#endif
}
diff --git a/src/core/Game.h b/src/core/Game.h
index 67d83c00..ee9ca943 100644
--- a/src/core/Game.h
+++ b/src/core/Game.h
@@ -4,7 +4,9 @@ enum eLevelName {
LEVEL_IGNORE = -1, // beware, this is only used in CPhysical's m_nZoneLevel
LEVEL_GENERIC = 0,
LEVEL_BEACH,
- LEVEL_MAINLAND
+ LEVEL_MAINLAND,
+
+ NUM_LEVELS
};
enum eAreaName {
diff --git a/src/core/config.h b/src/core/config.h
index 770a7c2e..0ef921ca 100644
--- a/src/core/config.h
+++ b/src/core/config.h
@@ -23,7 +23,7 @@ enum Config {
MAXVEHICLESLOADED = 50, // 70 on mobile
- NUMOBJECTINFO = 400, // TODO(MIAMI): fantasy // object.dat
+ NUMOBJECTINFO = 210,
// Pool sizes
NUMPTRNODES = 50000,
diff --git a/src/modelinfo/ModelIndices.h b/src/modelinfo/ModelIndices.h
index 58aba733..182a0cea 100644
--- a/src/modelinfo/ModelIndices.h
+++ b/src/modelinfo/ModelIndices.h
@@ -233,7 +233,7 @@ enum
MI_JFOTO,
MI_JMOTO,
- MI_CBA = 83,
+ MI_CBA,// = 83,
MI_CBB,
MI_HNA,
MI_HNB,
@@ -255,12 +255,30 @@ enum
MI_VICE6,
MI_VICE7,
MI_VICE8,
- MI_WFYG2 = 106, // last regular ped
+ MI_WFYG1,
+ MI_WFYG2,// = 106, // last regular ped
+ // three more peds possible
MI_SPECIAL01 = 109,
- MI_SPECIAL02 = 110,
- MI_SPECIAL03 = 111,
- MI_SPECIAL04 = 112,
- MI_SPECIAL21 = 129,
+ MI_SPECIAL02,
+ MI_SPECIAL03,
+ MI_SPECIAL04,
+ MI_SPECIAL05,
+ MI_SPECIAL06,
+ MI_SPECIAL07,
+ MI_SPECIAL08,
+ MI_SPECIAL09,
+ MI_SPECIAL10,
+ MI_SPECIAL11,
+ MI_SPECIAL12,
+ MI_SPECIAL13,
+ MI_SPECIAL14,
+ MI_SPECIAL15,
+ MI_SPECIAL16,
+ MI_SPECIAL17,
+ MI_SPECIAL18,
+ MI_SPECIAL19,
+ MI_SPECIAL20,
+ MI_SPECIAL21,// = 129,
MI_LAST_PED = MI_SPECIAL21,
MI_FIRST_VEHICLE,
@@ -372,10 +390,18 @@ enum
MI_BLOODRA,
MI_BLOODRB,
MI_VICECHEE,
- // 3 available vehicle slots in here
- MI_LAST_VEHICLE = 239,
- MI_CAR_DOOR = 240,
+ // HACK
+ MI_TRAIN = -1,
+ MI_DODO = -2,
+
+ MI_LAST_VEHICLE = MI_VICECHEE,
+
+ MI_WHEEL_RIM,
+ MI_WHEEL_OFFROAD,
+ MI_WHEEL_TRUCK,
+
+ MI_CAR_DOOR,// = 240,
MI_CAR_BUMPER,
MI_CAR_PANEL,
MI_CAR_BONNET,
@@ -384,11 +410,18 @@ enum
MI_BODYPARTA,
MI_BODYPARTB,
- // HACK
- MI_TRAIN = -1,
- MI_DODO = -2,
+ MI_WHEEL_SPORT = 250,
+ MI_WHEEL_SALOON,
+ MI_WHEEL_LIGHTVAN,
+ MI_WHEEL_CLASSIC,
+ MI_WHEEL_ALLOY,
+ MI_WHEEL_LIGHTTRUCK,
+ MI_WHEEL_SMALLCAR,
+
+ MI_AIRTRAIN_VLO, // = 257,
+ MI_MOBILE,
- MI_BRASS_KNUCKLES = 259,
+ MI_BRASS_KNUCKLES, // 259
MI_SCREWDRIVER,
MI_GOLFCLUB,
MI_NIGHTSTICK,
@@ -425,20 +458,18 @@ enum
MI_FINGERS,
MI_MINIGUN2,
- MI_CUTOBJ01 = 295,
+ MI_CUTOBJ01,// = 295,
MI_CUTOBJ02,
MI_CUTOBJ03,
MI_CUTOBJ04,
MI_CUTOBJ05,
- MI_AIRTRAIN_VLO = 257,
- MI_MOBILE = 258,
- NUM_DEFAULT_MODELS = 300
+ NUM_DEFAULT_MODELS,// = 300
};
enum{
- NUM_OF_SPECIAL_CHARS = 4,
+ NUM_OF_SPECIAL_CHARS = 21,
NUM_OF_CUTSCENE_OBJECTS = 5
};
diff --git a/src/objects/Object.h b/src/objects/Object.h
index ce45509f..bc74b58b 100644
--- a/src/objects/Object.h
+++ b/src/objects/Object.h
@@ -61,7 +61,7 @@ public:
float m_fUprootLimit;
int8 ObjectCreatedBy;
uint8 bIsPickup : 1;
- uint8 obj_flag_02 : 1;
+ uint8 bAmmoCollected : 1;
uint8 bPickupObjWithMessage : 1;
uint8 bOutOfStock : 1;
uint8 bGlassCracked : 1;
diff --git a/src/objects/ObjectData.cpp b/src/objects/ObjectData.cpp
index 589cc3f7..04ac0b9c 100644
--- a/src/objects/ObjectData.cpp
+++ b/src/objects/ObjectData.cpp
@@ -6,6 +6,8 @@
#include "FileMgr.h"
#include "ObjectData.h"
+//--MIAMI: file done
+
CObjectInfo CObjectData::ms_aObjectInfo[NUMOBJECTINFO];
// Another ugly file reader
@@ -18,11 +20,55 @@ CObjectData::Initialise(const char *filename)
float percentSubmerged;
int damageEffect, responseCase, camAvoid;
CBaseModelInfo *mi;
+
+ ms_aObjectInfo[0].m_fMass = 99999.0f;
+ ms_aObjectInfo[0].m_fTurnMass = 99999.0f;
+ ms_aObjectInfo[0].m_fAirResistance = 0.99f;
+ ms_aObjectInfo[0].m_fElasticity = 0.1f;
+ ms_aObjectInfo[0].m_fBuoyancy = GRAVITY * ms_aObjectInfo[0].m_fMass * 2.0f;
+ ms_aObjectInfo[0].m_fUprootLimit = 0.0f;
+ ms_aObjectInfo[0].m_fCollisionDamageMultiplier = 1.0f;
+ ms_aObjectInfo[0].m_nCollisionDamageEffect = 0;
+ ms_aObjectInfo[0].m_nSpecialCollisionResponseCases = 0;
+ ms_aObjectInfo[0].m_bCameraToAvoidThisObject = false;
+
+ ms_aObjectInfo[1].m_fMass = 99999.0f;
+ ms_aObjectInfo[1].m_fTurnMass = 99999.0f;
+ ms_aObjectInfo[1].m_fAirResistance = 0.99f;
+ ms_aObjectInfo[1].m_fElasticity = 0.1f;
+ ms_aObjectInfo[1].m_fBuoyancy = ms_aObjectInfo[0].m_fBuoyancy;
+ ms_aObjectInfo[1].m_fUprootLimit = 0.0f;
+ ms_aObjectInfo[1].m_fCollisionDamageMultiplier = 1.0f;
+ ms_aObjectInfo[1].m_nCollisionDamageEffect = 0;
+ ms_aObjectInfo[1].m_nSpecialCollisionResponseCases = 0;
+ ms_aObjectInfo[1].m_bCameraToAvoidThisObject = true;
+
+ ms_aObjectInfo[2].m_fMass = 99999.0f;
+ ms_aObjectInfo[2].m_fTurnMass = 99999.0f;
+ ms_aObjectInfo[2].m_fAirResistance = 0.99f;
+ ms_aObjectInfo[2].m_fElasticity = 0.1f;
+ ms_aObjectInfo[2].m_fBuoyancy = ms_aObjectInfo[0].m_fBuoyancy;
+ ms_aObjectInfo[2].m_fUprootLimit = 0.0f;
+ ms_aObjectInfo[2].m_fCollisionDamageMultiplier = 1.0f;
+ ms_aObjectInfo[2].m_nCollisionDamageEffect = 0;
+ ms_aObjectInfo[2].m_bCameraToAvoidThisObject = false;
+ ms_aObjectInfo[2].m_nSpecialCollisionResponseCases = 4;
+
+ ms_aObjectInfo[3].m_fMass = 99999.0f;
+ ms_aObjectInfo[3].m_fTurnMass = 99999.0f;
+ ms_aObjectInfo[3].m_fAirResistance = 0.99f;
+ ms_aObjectInfo[3].m_fElasticity = 0.1f;
+ ms_aObjectInfo[3].m_fBuoyancy = ms_aObjectInfo[0].m_fBuoyancy;
+ ms_aObjectInfo[3].m_fUprootLimit = 0.0f;
+ ms_aObjectInfo[3].m_fCollisionDamageMultiplier = 1.0f;
+ ms_aObjectInfo[3].m_nCollisionDamageEffect = 0;
+ ms_aObjectInfo[3].m_nSpecialCollisionResponseCases = 4;
+ ms_aObjectInfo[3].m_bCameraToAvoidThisObject = true;
CFileMgr::SetDir("");
CFileMgr::LoadFile(filename, work_buff, sizeof(work_buff), "r");
- id = 0;
+ id = 4;
p = (char*)work_buff;
while(*p != '*'){
// skip over white space and comments
@@ -44,7 +90,11 @@ CObjectData::Initialise(const char *filename)
}
if(*p == '\n')
p++;
+#ifdef FIX_BUGS
*lp = '\0'; // FIX: game wrote '\n' here
+#else
+ *lp = '\n';
+#endif
assert(id < NUMOBJECTINFO);
sscanf(line, "%s %f %f %f %f %f %f %f %d %d %d", name,
@@ -63,9 +113,23 @@ CObjectData::Initialise(const char *filename)
ms_aObjectInfo[id].m_bCameraToAvoidThisObject = camAvoid;
mi = CModelInfo::GetModelInfo(name, nil);
- if(mi)
- mi->SetObjectID(id++);
- else
+ if (mi) {
+ if (ms_aObjectInfo[0].m_fMass != ms_aObjectInfo[id].m_fMass
+ || ms_aObjectInfo[0].m_fCollisionDamageMultiplier != ms_aObjectInfo[id].m_fCollisionDamageMultiplier
+ || ms_aObjectInfo[0].m_nCollisionDamageEffect != ms_aObjectInfo[id].m_nCollisionDamageEffect
+ || ((ms_aObjectInfo[0].m_nSpecialCollisionResponseCases != ms_aObjectInfo[id].m_nSpecialCollisionResponseCases)
+ && (ms_aObjectInfo[2].m_nSpecialCollisionResponseCases != ms_aObjectInfo[id].m_nSpecialCollisionResponseCases))) {
+ mi->SetObjectID(id++);
+ } else if (ms_aObjectInfo[0].m_nSpecialCollisionResponseCases == ms_aObjectInfo[id].m_nSpecialCollisionResponseCases) {
+ if (ms_aObjectInfo[0].m_bCameraToAvoidThisObject == ms_aObjectInfo[id].m_bCameraToAvoidThisObject)
+ mi->SetObjectID(0);
+ else
+ mi->SetObjectID(1);
+ } else if (ms_aObjectInfo[2].m_bCameraToAvoidThisObject == ms_aObjectInfo[id].m_bCameraToAvoidThisObject)
+ mi->SetObjectID(2);
+ else
+ mi->SetObjectID(3);
+ } else
debug("CObjectData: Cannot find object %s\n", name);
}
}
@@ -92,6 +156,7 @@ CObjectData::SetObjectData(int32 modelId, CObject &object)
object.m_bCameraToAvoidThisObject = objinfo->m_bCameraToAvoidThisObject;
if(object.m_fMass >= 99998.0f){
object.bInfiniteMass = true;
+ object.m_phy_flagA08 = true;
object.bAffectedByGravity = false;
object.bExplosionProof = true;
}
diff --git a/src/peds/CivilianPed.cpp b/src/peds/CivilianPed.cpp
index 74a7c9ba..18a0e2a3 100644
--- a/src/peds/CivilianPed.cpp
+++ b/src/peds/CivilianPed.cpp
@@ -34,7 +34,11 @@ CCivilianPed::CCivilianPed(ePedType pedtype, uint32 mi) : CPed(pedtype)
m_bJustStoleACar = false;
m_bStealCarEvenIfThereIsSomeoneInIt = false;
for (int i = 0; i < ARRAY_SIZE(m_nStealWishList); i++) {
- uint32 randomCarModel = CGeneral::GetRandomNumberInRange(MI_LANDSTAL, MI_LAST_VEHICLE + 1);
+#ifdef FIX_BUGS
+ uint32 randomCarModel = CGeneral::GetRandomNumberInRange(MI_LANDSTAL, MI_LAST_VEHICLE);
+#else
+ uint32 randomCarModel = CGeneral::GetRandomNumberInRange(MI_LANDSTAL, MI_LANDSTAL + VEHICLEMODELSIZE);
+#endif
if (CModelInfo::IsCarModel(randomCarModel) || CModelInfo::IsBikeModel(randomCarModel))
m_nStealWishList[i] = randomCarModel;
else
diff --git a/src/peds/Population.cpp b/src/peds/Population.cpp
index d52c8c7c..7314080b 100644
--- a/src/peds/Population.cpp
+++ b/src/peds/Population.cpp
@@ -767,13 +767,13 @@ CPopulation::AddToPopulation(float minDist, float maxDist, float minDistOffScree
CVector toyPos(newPed->GetPosition());
float waterLevel;
if (CWaterLevel::GetGroundLevel(toyPos, &waterLevel, nil, 30.0f)) {
- toyPos.z = 0.004f + waterLevel;
- CEntity *toy = CWaterLevel::CreateBeachToy(toyPos, BEACHTOY_11);
+ toyPos.z = 0.04f + waterLevel;
+ CEntity *toy = CWaterLevel::CreateBeachToy(toyPos, BEACHTOY_ANY_TOWEL);
if (toy)
toy->SetHeading(heading);
if (!(CGeneral::GetRandomNumber() & 3)) {
- CWaterLevel::CreateBeachToy(toyPos + CVector(CGeneral::GetRandomNumberInRange(-2.f, 2.f), CGeneral::GetRandomNumberInRange(-2.f, 2.f), 0.f), BEACHTOY_6);
+ CWaterLevel::CreateBeachToy(toyPos + CVector(CGeneral::GetRandomNumberInRange(-2.f, 2.f), CGeneral::GetRandomNumberInRange(-2.f, 2.f), 0.f), BEACHTOY_LOTION);
}
}
} else {
@@ -1793,4 +1793,4 @@ CPopulation::PlaceMallPedsAsStationaryGroup(CVector const& coors, int32 group)
}
}
}
-} \ No newline at end of file
+}
diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp
index 19a172fb..b765675f 100644
--- a/src/render/Fluff.cpp
+++ b/src/render/Fluff.cpp
@@ -22,6 +22,7 @@
#include "Bones.h"
#include "World.h"
#include "Replay.h"
+#include "Coronas.h"
CPlaneTrail CPlaneTrails::aArray[6];
RwImVertexIndex TrailIndices[32] = {
@@ -369,18 +370,10 @@ uint8 ScrollCharSet[59][5] = {
// ---------- CMovingThings ----------
enum eScrollBarTypes
{
- SCROLL_BUSINESS,
- SCROLL_TRAFFIC,
- SCROLL_ENTERTAINMENT,
- SCROLL_AIRPORT_DOORS,
- SCROLL_AIRPORT_FRONT,
- SCROLL_STORE,
- SCROLL_USED_CARS
+ SCROLL_ARENA_STRING
};
-CScrollBar aScrollBars[11];
-CTowerClock aTowerClocks[2];
-CDigitalClock aDigitalClocks[3];
+CScrollBar aScrollBars[1];
CMovingThing CMovingThings::StartCloseList;
CMovingThing CMovingThings::EndCloseList;
@@ -391,66 +384,47 @@ int32 CScrollBar::TonightsEvent;
void CMovingThings::Init()
{
+ StartCloseList.m_pNext = &CMovingThings::EndCloseList;
+ StartCloseList.m_pPrev = nil;
+ EndCloseList.m_pNext = nil;
+ EndCloseList.m_pPrev = &CMovingThings::StartCloseList;
+
CPlaneTrails::Init();
CSmokeTrails::Init();
CPlaneBanners::Init();
CPointLights::Init();
- StartCloseList.m_pNext = &CMovingThings::EndCloseList;
- StartCloseList.m_pPrev = nil;
- EndCloseList.m_pNext = nil;
- EndCloseList.m_pPrev = &CMovingThings::StartCloseList;
Num = 0;
- CEscalators::Init();
+ for (int32 i = 0; i < NUMMOVINGTHINGS; i++) {
+ aMovingThings[i].m_nType = 0;
+ aMovingThings[i].m_nHidden = 0;
+ }
-#ifndef MIAMI // something is still used here actually
- // Initialize scroll bars
- aScrollBars[0].Init(CVector( 228.3f, -669.0f, 39.0f ), SCROLL_BUSINESS, 0.0f, 0.5f, 0.5f, 255, 128, 0, 0.3f);
- aScrollBars[1].Init(CVector( 772.0f, 164.0f, -9.5f ), SCROLL_TRAFFIC, 0.0f, 0.5f, 0.25f, 128, 255, 0, 0.3f);
- aScrollBars[2].Init(CVector(-1089.61f, -584.224f, 13.246f), SCROLL_AIRPORT_DOORS, 0.0f, -0.1706f, 0.107f, 255, 0, 0, 0.11f);
- aScrollBars[3].Init(CVector(-1089.61f, -602.04602f, 13.246f), SCROLL_AIRPORT_DOORS, 0.0f, -0.1706f, 0.107f, 0, 255, 0, 0.11f);
- aScrollBars[4].Init(CVector(-1089.61f, -619.81702f, 13.246f), SCROLL_AIRPORT_DOORS, 0.0f, -0.1706f, 0.107f, 255, 128, 0, 0.11f);
- aScrollBars[5].Init(CVector(-754.578f, -633.50897f, 18.411f), SCROLL_AIRPORT_FRONT, 0.0f, 0.591f, 0.52f, 100, 100, 255, 0.3f);
- aScrollBars[6].Init(CVector( -754.578f, -586.672f, 18.411f), SCROLL_AIRPORT_FRONT, 0.0f, 0.591f, 0.52f, 100, 100, 255, 0.3f);
- aScrollBars[7].Init(CVector( 85.473f, -1069.512f, 30.5f ), SCROLL_STORE, 0.625f, -0.3125f, 0.727f, 100, 100, 255, 0.5f);
- aScrollBars[8].Init(CVector( 74.823f, -1086.879f, 31.495f), SCROLL_ENTERTAINMENT, -0.2083f, 0.1041f, 0.5f, 255, 255, 128, 0.3f);
- aScrollBars[9].Init(CVector( -36.459f, -1031.2371f, 32.534f), SCROLL_ENTERTAINMENT, -0.1442f, 0.0721f, 0.229f, 150, 255, 50, 0.3f);
- aScrollBars[10].Init(CVector( 1208.0f, -62.208f, 19.157f), SCROLL_USED_CARS, 0.0642f, -0.20365f, 0.229f, 255, 128, 0, 0.3f);
-
- // Initialize tower clocks
- aTowerClocks[0].Init(CVector(59.4f, -1081.3f, 54.15f), -1.0f, 0.0f, 0, 0, 0, 80.0f, 2.0f);
- aTowerClocks[1].Init(CVector(55.4f, -1083.6f, 54.15f), 0.0f, -1.0f, 0, 0, 0, 80.0f, 2.0f);
-
- // Initialize digital clocks
- CVector2D sz(3.7f, 2.144f);
- sz.Normalise();
- aDigitalClocks[0].Init(
- CVector(54.485f - sz.x * 0.05f + sz.y * 0.3f, -1081.679f - sz.y * 0.05f - sz.x * 0.3f, 32.803f),
- sz.y, -sz.x, 255, 0, 0, 100.0f, 0.8f
- );
- aDigitalClocks[1].Init(
- CVector(60.564f + sz.x * 0.05f - sz.y * 0.3f, -1083.089f + sz.y * 0.05f + sz.x * 0.3f, 32.803f),
- -sz.y, sz.x, 0, 0, 255, 100.0f, 0.8f
- );
- aDigitalClocks[2].Init(
- CVector(58.145f - sz.y * 0.05f - sz.x * 0.3f, -1079.268f + sz.x * 0.05f - sz.y * 0.3f, 32.803f),
- -sz.x, -sz.y, 0, 255, 0, 100.0f, 0.8f
- );
-#endif
+ for (int i = 0; i < NUMSECTORS_X; i++) {
+ for (int j = 0; j < NUMSECTORS_Y; j++) {
+ for (CPtrNode *pNode = CWorld::GetSector(i, j)->m_lists[ENTITYLIST_BUILDINGS].first; pNode; pNode = pNode->next) {
+ CEntity *pEntity = (CEntity *)pNode->item;
+ PossiblyAddThisEntity(pEntity);
+ }
+ }
+ }
+
+ for (int32 i = 0; i < NUM_LEVELS; i++) {
+ for (CPtrNode *pNode = CWorld::GetBigBuildingList((eLevelName)i).first; pNode; pNode = pNode->next) {
+ CEntity *pEntity = (CEntity *)pNode->item;
+ PossiblyAddThisEntity(pEntity);
+ }
+ }
+
+ CEscalators::Init();
+ aScrollBars[0].Init(CVector(-1069.209f, 1320.126f, 18.848f), CVector(-1069.209f, 1342.299f, 22.612), SCROLL_ARENA_STRING, 128, 255, 0, 0.3f);
}
void CMovingThings::Shutdown()
{
- int i;
- for (i = 0; i < ARRAY_SIZE(aScrollBars); ++i)
- aScrollBars[i].SetVisibility(false);
-/*
- for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i)
- aTowerClocks[i].SetVisibility(false);
- for (i = 0; i < ARRAY_SIZE(aDigitalClocks); ++i)
- aDigitalClocks[i].SetVisibility(false);
-*/
+
+ aScrollBars[0].SetVisibility(false);
CEscalators::Shutdown();
}
@@ -475,23 +449,12 @@ void CMovingThings::Update()
if (aMovingThings[i].m_nHidden == 0)
aMovingThings[i].Update();
}
- /* I don't think these are done yet?
+
for (i = 0; i < ARRAY_SIZE(aScrollBars); ++i)
{
if (aScrollBars[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0)
aScrollBars[i].Update();
}
- for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i)
- {
- if (aTowerClocks[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0)
- aTowerClocks[i].Update();
- }
- for (i = 0; i < ARRAY_SIZE(aDigitalClocks); ++i)
- {
- if (aDigitalClocks[i].IsVisible() || (CTimer::GetFrameCounter() + i) % 8 == 0)
- aDigitalClocks[i].Update();
- }
- */
}
void CMovingThings::Render()
@@ -504,18 +467,6 @@ void CMovingThings::Render()
if (aScrollBars[i].IsVisible())
aScrollBars[i].Render();
}
-/*
- for (i = 0; i < ARRAY_SIZE(aTowerClocks); ++i)
- {
- if (aTowerClocks[i].IsVisible())
- aTowerClocks[i].Render();
- }
- for (i = 0; i < ARRAY_SIZE(aDigitalClocks); ++i)
- {
- if (aDigitalClocks[i].IsVisible())
- aDigitalClocks[i].Render();
- }
-*/
CPlaneTrails::Render();
CSmokeTrails::Render();
@@ -523,22 +474,72 @@ void CMovingThings::Render()
}
// ---------- CMovingThing ----------
+float lengths[5] = { 100.0f, 1500.0f, 400.0f, 100.0f, 2000.0f };
+
void CMovingThing::Update()
{
+ switch (m_nType) {
+ case 1: {
+ float angle = (CTimer::GetTimeInMilliseconds() % 0x3FFF) * TWOPI / 0x3FFF;
+ m_pEntity->GetRight() = CVector(-Sin(angle), Cos(angle), 0.0f);
+ m_pEntity->GetForward() = CVector(0.0f, 0.0f, 1.0f);
+ m_pEntity->GetUp() = CVector(Cos(angle), Sin(angle), 0.0f);
+
+ if (CClock::GetHours() >= 20 || CClock::GetHours() < 5) {
+ if (Abs(TheCamera.GetPosition().x - m_pEntity->GetPosition().x) < 600.0f &&
+ Abs(TheCamera.GetPosition().y - m_pEntity->GetPosition().y) < 600.0f) {
+ CVector delta = m_pEntity->GetPosition() - TheCamera.GetPosition();
+ delta.Normalise();
+
+ if (delta.x * Cos(angle) + delta.y * Sin(angle) < -0.92f) {
+ CVector coors = m_pEntity->GetPosition() - 10.0f * delta;
+ CCoronas::RegisterCorona(43, 128, 128, 100, 255, coors, 70.0f, 600.0f, 0.0f, CCoronas::TYPE_STAR, CCoronas::REFLECTION_OFF, CCoronas::LOSCHECK_OFF, CCoronas::STREAK_OFF, 0.0f, false, 1.5f);
+ }
+ }
+ }
+ }
+ break;
+ case 2: {
+ float angle = (CTimer::GetTimeInMilliseconds() % 0x7FF) * TWOPI / 0x7FF;
+ m_pEntity->GetRight() = CVector(Cos(angle), Sin(angle), 0.0f);
+ m_pEntity->GetForward() = CVector(-Sin(angle), Cos(angle), 0.0f);
+ m_pEntity->GetUp() = CVector(0.0f, 0.0f, 1.0f);
+ }
+ break;
+ case 3: {
+ float angle = (CTimer::GetTimeInMilliseconds() % 0x3FF) * TWOPI / 0x3FF;
+ m_pEntity->GetRight() = CVector(Cos(angle), Sin(angle), 0.0f);
+ m_pEntity->GetForward() = CVector(-Sin(angle), Cos(angle), 0.0f);
+ m_pEntity->GetUp() = CVector(0.0f, 0.0f, 1.0f);
+ }
+ break;
+ case 4: {
+ float angle = (CTimer::GetTimeInMilliseconds() % 0x3FFFF) * TWOPI / 0x3FFFF;
+ m_pEntity->GetRight() = CVector(-Cos(angle), -Sin(angle), 0.0f);
+ m_pEntity->GetForward() = CVector(Sin(angle), -Cos(angle), 0.0f);
+ m_pEntity->GetUp() = CVector(0.0f, 0.0f, 1.0f);
+ m_pEntity->SetPosition(CVector(350.0f * Cos(angle) - 465.0f, 350.0f * Sin(angle) + 1163.0f, 260.0f));
+ }
+ break;
+ default:
+ break;
+ }
+
m_pEntity->GetMatrix().UpdateRW();
m_pEntity->UpdateRwFrame();
- if (SQR(m_pEntity->GetPosition().x - TheCamera.GetPosition().x) + SQR(m_pEntity->GetPosition().y - TheCamera.GetPosition().y) < 40000.0f) {
- if (m_nHidden == 1) {
- AddToList(&CMovingThings::StartCloseList);
- m_nHidden = 0;
- }
- } else {
+ if (SQR(m_pEntity->GetPosition().x - TheCamera.GetPosition().x) + SQR(m_pEntity->GetPosition().y - TheCamera.GetPosition().y) >= SQR(lengths[m_nType])) {
if (m_nHidden == 0) {
RemoveFromList();
m_nHidden = 1;
}
}
+ else {
+ if (m_nHidden == 1) {
+ AddToList(&CMovingThings::StartCloseList);
+ m_nHidden = 0;
+ }
+ }
}
void CMovingThing::AddToList(CMovingThing *pThing)
@@ -568,27 +569,32 @@ int16 CMovingThing::SizeList()
return count;
}
-// ---------- Find message functions ----------
-const char* FindTunnelMessage()
-{
- if (CStats::CommercialPassed)
- return "LIBERTY TUNNEL HAS BEEN OPENED TO ALL TRAFFIC . . . ";
-
- if (CStats::IndustrialPassed)
- return "FIRST PHASE LIBERTY TUNNEL HAS BEEN COMPLETED . . . ";
+void CMovingThings::RegisterOne(CEntity *pEnt, uint16 nType) {
+ if (Num >= NUMMOVINGTHINGS)
+ return;
- return "FIRST PHASE LIBERTY TUNNEL ABOUT TO BE COMPLETED . . . ";
+ aMovingThings[Num].m_pEntity = pEnt;
+ aMovingThings[Num].m_nType = nType;
+ aMovingThings[Num].m_nHidden = 0;
+ aMovingThings[Num].m_vecPosn = pEnt->GetPosition();
+ aMovingThings[Num].AddToList(&CMovingThings::StartCloseList);
+ Num++;
}
-const char* FindBridgeMessage()
-{
- if (CStats::CommercialPassed)
- return "STAUNTON LIFT BRIDGE IS OPERATIONAL AGAIN ";
-
- if (CStats::IndustrialPassed)
- return "LONG DELAYS BEHIND US AS CALLAHAN BRIDGE IS FIXED . . . STAUNTON LIFT BRIDGE STUCK OPEN ";
-
- return "CHAOS AS CALLAHAN BRIDGE IS UNDER REPAIR. . . ";
+void CMovingThings::PossiblyAddThisEntity(CEntity *pEnt) {
+ if (pEnt->GetModelIndex() == MI_LIGHTBEAM) {
+ RegisterOne(pEnt, 1);
+ }
+ else if (pEnt->GetModelIndex() == MI_AIRPORTRADAR) {
+ RegisterOne(pEnt, 2);
+ }
+ else if (pEnt->GetModelIndex() == MI_MALLFAN || pEnt->GetModelIndex() == MI_HOTELFAN_NIGHT
+ || pEnt->GetModelIndex() == MI_HOTELFAN_DAY || pEnt->GetModelIndex() == MI_HOTROOMFAN) {
+ RegisterOne(pEnt, 3);
+ }
+ else if (pEnt->GetModelIndex() == MI_BLIMP_NIGHT || pEnt->GetModelIndex() == MI_BLIMP_DAY) {
+ RegisterOne(pEnt, 4);
+ }
}
char String_Time[] = "THE TIME IS 12:34 ";
@@ -601,49 +607,23 @@ const char* FindTimeMessage()
return String_Time;
}
-char String_DigitalClock[] = "12:34";
-const char* FindDigitalClockMessage()
-{
- if (((CTimer::GetTimeInMilliseconds() >> 10) & 7) < 6)
- {
- String_DigitalClock[0] = '0' + CClock::GetHours() / 10;
- String_DigitalClock[1] = '0' + CClock::GetHours() % 10;
- String_DigitalClock[2] = CTimer::GetTimeInMilliseconds() & 0x200 ? ':' : ' ';
- String_DigitalClock[3] = '0' + CClock::GetMinutes() / 10;
- String_DigitalClock[4] = '0' + CClock::GetMinutes() % 10;
- }
- else
- {
- // they didn't use rad2deg here because of 3.14
- int temperature = 13.0f - 6.0f * Cos((CClock::GetMinutes() + 60.0f * CClock::GetHours()) / (4.0f * 180.0f / 3.14f) - 1.0f);
- String_DigitalClock[0] = '0' + temperature / 10;
- if (String_DigitalClock[0] == '0')
- String_DigitalClock[0] = ' ';
- String_DigitalClock[1] = '0' + temperature % 10;
- String_DigitalClock[2] = ' ';
- String_DigitalClock[3] = '@';
- String_DigitalClock[4] = 'C';
- }
- return String_DigitalClock;
-}
-
// ---------- CScrollBar ----------
-void CScrollBar::Init(CVector position, uint8 type, float sizeX, float sizeY, float sizeZ, uint8 red, uint8 green, uint8 blue, float scale)
+void CScrollBar::Init(CVector pos1, CVector pos2, uint8 type, uint8 red, uint8 green, uint8 blue, float scale)
{
for (int i = 0; i < ARRAY_SIZE(m_MessageBar); ++i)
m_MessageBar[i] = 0;
m_pMessage = ". ";
m_MessageCurrentChar = 0;
- m_MessageLength = 2;
+ m_MessageLength = strlen(m_pMessage);
m_Counter = 0;
m_bVisible = false;
- m_Position = position;
+ m_Position = pos1;
m_Type = type;
- m_Size.x = sizeX;
- m_Size.y = sizeY;
- m_Size.z = sizeZ;
+ m_Size.x = (pos2.x - pos1.x) * 0.025f;
+ m_Size.y = (pos2.y - pos1.y) * 0.025f;
+ m_Size.z = (pos2.z - pos1.z) * 0.2f;
m_uRed = red;
m_uGreen = green;
m_uBlue = blue;
@@ -672,263 +652,48 @@ void CScrollBar::Update()
if (m_Counter == 0 && ++m_MessageCurrentChar >= m_MessageLength)
{
const char* previousMessage = m_pMessage;
- switch (m_Type)
- {
- case SCROLL_BUSINESS:
- while (previousMessage == m_pMessage)
- {
- switch (CGeneral::GetRandomNumber() % 7)
- {
- case 0:
- m_pMessage = "SHARES UYE<10% DWD<20% NDWE>22% . . . ";
- break;
- case 1:
- m_pMessage = "CRIME WAVE HITS LIBERTY CITY . . . ";
- break;
- case 2:
- m_pMessage = "SHARES OBR>29% MADD<76% LEZ<11% ADAMSKI>53% AAG>110%. . . ";
- break;
- case 3:
- m_pMessage = FindTunnelMessage();
- break;
- case 4:
- m_pMessage = FindBridgeMessage();
- break;
- case 5:
- m_pMessage = FindTimeMessage();
- break;
- case 6:
- if (FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_FRENCH || FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_GERMAN)
- m_pMessage = FindTimeMessage();
- else
- m_pMessage = "WWW.GRANDTHEFTAUTO3.COM ";
- break;
- }
- }
- break;
- case SCROLL_TRAFFIC:
- while (previousMessage == m_pMessage)
- {
- switch (CGeneral::GetRandomNumber() % 8)
- {
- case 0:
- m_pMessage = "DRIVE CAREFULLY . . . ";
- break;
- case 1:
- m_pMessage = "RECENT WAVE OF CARJACKINGS. KEEP YOUR DOORS LOCKED !!! ";
- break;
- case 2:
- m_pMessage = "CHECK YOUR SPEED . . . ";
- break;
- case 3:
- m_pMessage = "KEEP YOUR EYES ON THE ROAD AND NOT ON THIS SIGN ";
- break;
- case 4:
- if (CWeather::Foggyness > 0.5f)
- m_pMessage = "POOR VISIBILITY ! ";
- else if (CWeather::WetRoads > 0.5f)
- m_pMessage = "ROADS ARE SLIPPERY ! ";
- else
- m_pMessage = "ENJOY YOUR TRIP ";
- break;
- case 5:
- m_pMessage = FindTunnelMessage();
- break;
- case 6:
- m_pMessage = FindBridgeMessage();
- break;
- case 7:
- m_pMessage = FindTimeMessage();
- break;
- }
- }
- break;
- case SCROLL_ENTERTAINMENT:
- while (previousMessage == m_pMessage)
- {
- switch (CGeneral::GetRandomNumber() % 12)
- {
- case 0:
- m_pMessage = " )69TH STREET) STILL HOLDS TOP POSITION THIS MONTH AT THE BOX-OFFICE WITH )MY FAIR LADYBOY) JUST CREEPING UP BEHIND. ";
- break;
- case 1:
- m_pMessage = " TALKING OF )FANNIE). THERE IS STILL TIME TO CATCH THIS LOVELY FAMILY MUSICAL, ABOUT THE ORPHAN WHO IS SO EASILY TAKEN IN BY ANY MAN WITH LOADS OF MONEY. ";
- break;
- case 2:
- m_pMessage = " DO NOT MISS )GTA3, THE MUSICAL) . . . ";
- break;
- case 3:
- m_pMessage =
- " STILL RUNNING ARE )RATS) AND )GUYS AND DOGS), BETWEEN THEN THEY SHOULD HAVE THE LEGS TO LAST TILL THE AND OF THE YEAR. . . "
- " ALSO FOR FOUR LEGGED FANS, THE STAGE VERSION OF THE GRITTY REALISTIC )SATERDAY NIGHT BEAVER) OPENED LAST WEEKEND,"
- " AND I FOR ONE CERTAINLY ENJOYED THAT. ";
- break;
- case 4:
- m_pMessage =
- " NOW SHOWING STATE-WIDE, ARNOLD STEELONE, HOLLYWOODS BEST LIVING SPECIAL EFFECT, APPEARS AGAIN AS A HALF_MAN,"
- " HALF ANDROID IN THE HALF-BAKED ROMP, )TOP DOWN CITY). AN HOMAGE TO HIS EARLIER TWO MULTI_MILLION MAKING MOVIES,"
- " IN WHICH HE PLAYED TWO-DEE, AN OUT OF CONTROL MONSTER, INTENT ON CORRUPTING CIVILISATION! ";
- break;
- case 5:
- m_pMessage =
- " ALSO APPEARING THIS WEEK )HALF-COCKED) SEES CHUCK SCHWARTZ UP TO HIS USUAL NONSENSE AS HE TAKES ON HALF OF LIBERTY CITY"
- " IN AN ATTEMPT TO SAVE HIS CROSS-DRESSING LADY-BOY SIDEKICK, )MISS PING-PONG), FROM A GANG OF RUTHLESS COSMETIC SURGEONS. ";
- break;
- case 6:
- m_pMessage =
- " STILL SHOWING: )SOLDIERS OF MISFORTUNE), ATTROCIOUS ACTING WHICH SEES BOYZ 2 GIRLZ) TRANSITION FROM THE CHARTS TO THE BIG SCREEN,"
- " AT LEAST THEY ALL DIE AT THE END. . . ";
- break;
- case 7:
- m_pMessage =
- " )BADFELLAS) IS STILL GOING STRONG WITH CROWDS ALMOST BEING PUSHED INTO CINEMAS TO SEE THIS ONE."
- " ANOTHER ONE WORTH LOOKING INTO IS )THE TUNNEL). ";
- break;
- case 8:
- m_pMessage = FindTunnelMessage();
- break;
- case 9:
- m_pMessage = FindBridgeMessage();
- break;
- case 10:
- m_pMessage = FindTimeMessage();
- break;
- case 11:
- m_pMessage = "WWW.ROCKSTARGAMES.COM ";
- break;
- }
- }
- break;
- case SCROLL_AIRPORT_DOORS:
- while (previousMessage == m_pMessage)
- {
- switch (CGeneral::GetRandomNumber() % 4)
- {
- case 0:
- m_pMessage = "WELCOME TO LIBERTY CITY . . . ";
- break;
- case 1:
- m_pMessage = "PLEASE HAVE YOUR PASSPORT READY . . . ";
- break;
- case 2:
- m_pMessage = "PLACE KEYS, FIREARMS, CHANGE AND OTHER METAL OBJECTS ON THE TRAY PLEASE . . . ";
- break;
- case 3:
- m_pMessage = FindTimeMessage();
- break;
- }
- }
- break;
- case SCROLL_AIRPORT_FRONT:
+ if (m_Type == SCROLL_ARENA_STRING) {
while (previousMessage == m_pMessage)
{
switch (CGeneral::GetRandomNumber() % 4)
{
case 0:
- m_pMessage = "WELCOME TO FRANCIS INTERNATIONAL AIRPORT . . . ";
+ switch (TonightsEvent) {
+ case 0:
+ m_pMessage = "MAIN EVENT TONIGHT: CAR RACING . . . ";
+ break;
+ case 1:
+ m_pMessage = "MAIN EVENT TONIGHT: DESTRUCTION DERBY . . . ";
+ break;
+ case 2:
+ m_pMessage = "MAIN EVENT TONIGHT: BIKE RACING . . . ";
+ break;
+ }
break;
case 1:
- m_pMessage = "PLEASE DO NOT LEAVE LUGGAGE UNATTENDED . . . ";
+ switch (TonightsEvent) {
+ case 0:
+ m_pMessage = "FOR TICKETS TO THE HOT RING EVENT CALL 555-3764 . . . ";
+ break;
+ case 1:
+ m_pMessage = "FOR TICKETS TO THE BLOOD RING EVENT CALL 555-3765 . . . ";
+ break;
+ case 2:
+ m_pMessage = "FOR TICKETS TO THE DIRT RING EVENT CALL 555-3766 . . . ";
+ break;
+ }
break;
case 2:
- m_pMessage = "FOLLOW 1 FOR LONG AND SHORT TERM PARKING ";
+ m_pMessage = "HYMAN MEMORIAL STADIUM. HOME TO SOME OF THE BIGGEST EVENTS OF"
+ " THE WESTERN HEMISPHERE. ALSO AVAILABLE FOR CHILDREN PARTIES. . . ";
break;
case 3:
m_pMessage = FindTimeMessage();
break;
- }
- }
- break;
- case SCROLL_STORE:
- while (previousMessage == m_pMessage)
- {
- switch (CGeneral::GetRandomNumber() % 10)
- {
- case 0:
- m_pMessage = "WWW.ROCKSTARGAMES.COM ";
- break;
- case 1:
- m_pMessage = "GTA3 OUT NOW . . . ";
- break;
- case 2:
- m_pMessage = "OUR STUFF IS CHEAP CHEAP CHEAP ";
- break;
- case 3:
- m_pMessage = "BUY 12 CDS GET ONE FREE . . . ";
- break;
- case 4:
- m_pMessage = "APPEARING IN SHOP SOON, )THE BLOODY CHOPPERS), WITH THEIR NEW ALBUM, )IS THAT MY DAUGHTER?) ";
- break;
- case 5:
- m_pMessage = "THIS MONTH IS OUR CRAZY CLEAROUT MONTH, EVERYTHING MUST GO, CDS, DVDS, STAFF, EVEN OUR CARPETS! ";
- break;
- case 6:
- m_pMessage =
- "OUT THIS WEEK: THE THEME TUNE TO )BOYS TO GIRLS) FIRST MOVIE )SOLDIERS OF MISFORTUNE), "
- "THE SINGLE )LET ME IN YOU)RE BODY-BAG) IS TAKEN FROM THE SOUNDTRACK ALBUM, )BOOT CAMP BOYS). "
- "ALSO INCLUDES THE SMASH SINGLE, )PRAY IT GOES OK). ";
- break;
- case 7:
- m_pMessage =
- "ALBUMS OUT THIS WEEK: MARYDANCING, )MUTHA O) CHRIST), FEATURING THE SINGLE )WASH HIM OFF), "
- "ALSO CRAIG GRAYS) DEBUT, )FADE AWAY), INCLUDES THE SINGLE OF THE SAME NAME. . . ";
- break;
- case 8:
- m_pMessage =
- "ON THE FILM FRONT, A NELY COMPILED COMPILATION OF ARNOLD STEELONES GREATEST MOVIES ON DVD. "
- "THE PACK INCLUDES THE EARLY )BY-CEP), THE CULT CLASSIC )FUTURE ANNHILATOR), AND THE HILARIOUS CROSS-DRESSING COMEDY )SISTERS). "
- "ONE FOR ALL THE FAMILY. . . ";
- break;
- case 9:
- m_pMessage = FindTimeMessage();
+ default:
break;
}
}
- break;
- case SCROLL_USED_CARS:
- while (previousMessage == m_pMessage)
- {
- switch (CGeneral::GetRandomNumber() % 11)
- {
- case 0:
- m_pMessage = "QUICK, TAKE A LOOK AT OUR CURRENT STOCK )CAUSE THESE AUTOS ARE MOVIN) FAST . . . ";
- break;
- case 1:
- m_pMessage = "THAT)S RIGHT, HERE AT )CAPITAL AUTO SALES) OUR VEHICLES ARE SO GOOD THAT THEY PRACTICALLY DRIVE THEMSELVES OFF OUR LOT . . . ";
- break;
- case 2:
- m_pMessage = "EASY CREDIT ON ALL CARS . . . ";
- break;
- case 3:
- m_pMessage = "FEEL LIKE A STUD IN ONE OF OUR STALLIONS OR TEST-DRIVE OUR BANSHEE, IT)S A REAL STEAL!!! ";
- break;
- case 4:
- m_pMessage = "TRY OUR HARDY PERENNIAL, IT)LL LAST YOU THE WHOLE YEAR. OUR BOBCATS AIN)T NO PUSSIES EITHER!!! ";
- break;
- case 5:
- m_pMessage = "IF IT)S A GUARANTEE YOU'RE AFTER, GO SOMEWHERE ELSE, )CAPITAL) CARS ARE THAT GOOD THEY DON)T NEED GUARANTEES!!! ";
- break;
- case 6:
- m_pMessage = "TOP DOLLAR OFFERED FOR YOUR OLD WHEELS, NOT YOUR CAR, JUST IT)S WHEELS. . . ";
- break;
- case 7:
- m_pMessage = "THAT)S RIGHT WE)RE CAR SILLY. TEST DRIVE ANY CAR, YOU WON)T WANT TO BRING IT BACK!!! ";
- break;
- case 8:
- m_pMessage = "FREE FLUFFY DICE WITH ALL PURCHASES. . .";
- break;
- case 9:
- if (FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_FRENCH || FrontEndMenuManager.m_PrefsLanguage == CMenuManager::LANGUAGE_GERMAN)
- m_pMessage = "QUICK, TAKE A LOOK AT OUR CURRENT STOCK )CAUSE THESE AUTOS ARE MOVIN) FAST . . . ";
- else
- m_pMessage = "HTTP:((ROCKSTARGAMES.COM(GRANDTHEFTAUTO3(CAPITALAUTOS ";
- break;
- case 10:
- m_pMessage = FindTimeMessage();
- break;
- }
- }
- break;
}
m_MessageLength = (uint32)strlen(m_pMessage);
@@ -1013,176 +778,6 @@ void CScrollBar::Render()
CSprite::FlushSpriteBuffer();
}
-// ---------- CTowerClock ----------
-void CTowerClock::Init(CVector position, float sizeX, float sizeY, uint8 red, uint8 green, uint8 blue, float drawDistance, float scale)
-{
- m_bVisible = false;
- m_Position = position;
- m_Size.x = sizeX;
- m_Size.y = sizeY;
- m_Size.z = 0.0f;
- m_uRed = red;
- m_uGreen = green;
- m_uBlue = blue;
- m_fDrawDistance = drawDistance;
- m_fScale = scale;
-}
-
-void CTowerClock::Update()
-{
- float distanceFromCamera = (TheCamera.GetPosition() - m_Position).Magnitude();
- if (distanceFromCamera < m_fDrawDistance)
- {
- m_bVisible = true;
- if (distanceFromCamera < 0.75f * m_fDrawDistance)
- m_fIntensity = 1.0f;
- else
- m_fIntensity = 1.0f - (distanceFromCamera - 0.75f * m_fDrawDistance) * 4.0f / m_fDrawDistance;
- }
- else
- m_bVisible = false;
-}
-
-RwIm3DVertex TempV[4];
-void CTowerClock::Render()
-{
- if (TheCamera.IsSphereVisible(m_Position, m_fScale))
- {
- // Calculate angle for each clock index
- float angleHour = 2.0f * (float)PI * (CClock::GetMinutes() + 60.0f * CClock::GetHours()) / 720.0f;
- float angleMinute = 2.0f * (float)PI * (CClock::GetSeconds() + 60.0f * CClock::GetMinutes()) / 3600.0f;
-
- // Prepare render states
- RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE);
- RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
- RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDSRCALPHA);
- RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDINVSRCALPHA);
- RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
- RwRenderStateSet(rwRENDERSTATETEXTURERASTER, nil);
-
- // Set vertices colors
- RwIm3DVertexSetRGBA(&TempV[0], m_uRed, m_uGreen, m_uBlue, (uint8)(m_fIntensity * 255.0f));
- RwIm3DVertexSetRGBA(&TempV[1], m_uRed, m_uGreen, m_uBlue, (uint8)(m_fIntensity * 255.0f));
- RwIm3DVertexSetRGBA(&TempV[2], m_uRed, m_uGreen, m_uBlue, (uint8)(m_fIntensity * 255.0f));
- RwIm3DVertexSetRGBA(&TempV[3], m_uRed, m_uGreen, m_uBlue, (uint8)(m_fIntensity * 255.0f));
-
- // Set vertices position
- RwIm3DVertexSetPos(&TempV[0], m_Position.x, m_Position.y, m_Position.z);
- RwIm3DVertexSetPos(
- &TempV[1],
- m_Position.x + Sin(angleMinute) * m_fScale * m_Size.x,
- m_Position.y + Sin(angleMinute) * m_fScale * m_Size.y,
- m_Position.z + Cos(angleMinute) * m_fScale
- );
- RwIm3DVertexSetPos(&TempV[2], m_Position.x, m_Position.y, m_Position.z);
- RwIm3DVertexSetPos(
- &TempV[3],
- m_Position.x + Sin(angleHour) * 0.75f * m_fScale * m_Size.x,
- m_Position.y + Sin(angleHour) * 0.75f * m_fScale * m_Size.y,
- m_Position.z + Cos(angleHour) * 0.75f * m_fScale
- );
-
- LittleTest();
-
- // Draw lines
- if (RwIm3DTransform(TempV, 4, nil, 0))
- {
- RwIm3DRenderLine(0, 1);
- RwIm3DRenderLine(2, 3);
- RwIm3DEnd();
- }
- }
-}
-
-// ---------- CDigitalClock ----------
-void CDigitalClock::Init(CVector position, float sizeX, float sizeY, uint8 red, uint8 green, uint8 blue, float drawDistance, float scale)
-{
- m_bVisible = false;
- m_Position = position;
- m_Size.x = sizeX;
- m_Size.y = sizeY;
- m_Size.z = 0.0f;
- m_uRed = red;
- m_uGreen = green;
- m_uBlue = blue;
- m_fDrawDistance = drawDistance;
- m_fScale = scale;
-}
-
-void CDigitalClock::Update()
-{
- float distanceFromCamera = (TheCamera.GetPosition() - m_Position).Magnitude();
- if (distanceFromCamera < m_fDrawDistance)
- {
- m_bVisible = true;
- if (distanceFromCamera < 0.75f * m_fDrawDistance)
- m_fIntensity = 1.0f;
- else
- m_fIntensity = 1.0f - (distanceFromCamera - 0.75f * m_fDrawDistance) * 4.0f / m_fDrawDistance;
- }
- else
- m_bVisible = false;
-}
-
-void CDigitalClock::Render()
-{
- if (TheCamera.IsSphereVisible(m_Position, 5.0f * m_fScale))
- {
- CSprite::InitSpriteBuffer();
-
- // Simulate flicker
- float currentIntensity = m_fIntensity * CGeneral::GetRandomNumberInRange(0x300, 0x400) / 1024.0f;
-
- uint8 r = currentIntensity * m_uRed;
- uint8 g = currentIntensity * m_uGreen;
- uint8 b = currentIntensity * m_uBlue;
-
- // Set render states
- RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE);
- RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)TRUE);
- RwRenderStateSet(rwRENDERSTATESRCBLEND, (void*)rwBLENDONE);
- RwRenderStateSet(rwRENDERSTATEDESTBLEND, (void*)rwBLENDONE);
- RwRenderStateSet(rwRENDERSTATETEXTUREFILTER, (void*)rwFILTERLINEAR);
- RwRenderStateSet(rwRENDERSTATETEXTURERASTER, RwTextureGetRaster(gpCoronaTexture[0]));
- RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE);
-
- const char* clockMessage = FindDigitalClockMessage();
-
- CVector coronaCoord, screenCoord;
- float screenW, screenH;
- for (int c = 0; c < 5; ++c) // for each char to be displayed
- {
- for (int i = 0; i < 5; ++i) // for each column of coronas
- {
- for (int j = 0; j < 5; ++j) // for each row of coronas
- {
- if (ScrollCharSet[clockMessage[c] - ' '][i] & (1 << j))
- {
- coronaCoord.x = m_Position.x + (8 * c + i) * m_Size.x * m_fScale / 8.0f;
- coronaCoord.y = m_Position.y + (8 * c + i) * m_Size.y * m_fScale / 8.0f;
- coronaCoord.z = m_Position.z + j * m_fScale / 8.0f;
-
- if (CSprite::CalcScreenCoors(coronaCoord, screenCoord, &screenW, &screenH, true))
- {
- CSprite::RenderBufferedOneXLUSprite(
- screenCoord.x, screenCoord.y, screenCoord.z,
- screenW * m_fScale * 0.12f,
- screenW * m_fScale * 0.12f,
- r, g, b,
- 255,
- 1.0f / screenCoord.z,
- 255);
- }
- }
- }
- }
- }
-
- CSprite::FlushSpriteBuffer();
- }
-}
-
void
CSmokeTrail::RegisterPoint(CVector regPosition, float opacity) {
bool bAddedNewPoint = false;
diff --git a/src/render/Fluff.h b/src/render/Fluff.h
index f61da350..98fb9f92 100644
--- a/src/render/Fluff.h
+++ b/src/render/Fluff.h
@@ -135,7 +135,7 @@ public:
int16 SizeList();
};
-#define NUMMOVINGTHINGS 128
+#define NUMMOVINGTHINGS 48
class CMovingThings
{
@@ -149,6 +149,8 @@ public:
static void Shutdown();
static void Update();
static void Render();
+ static void PossiblyAddThisEntity(CEntity *pEnt);
+ static void RegisterOne(CEntity *pEnt, uint16 nType);
};
class CScrollBar
@@ -176,51 +178,7 @@ public:
void SetVisibility(bool visible) { m_bVisible = visible; }
bool IsVisible() { return m_bVisible; }
- void Init(CVector, uint8, float, float, float, uint8, uint8, uint8, float);
- void Update();
- void Render();
-};
-
-class CTowerClock
-{
-private:
- CVector m_Position;
- CVector m_Size;
- float m_fDrawDistance;
- float m_fScale;
- uint8 m_uRed;
- uint8 m_uGreen;
- uint8 m_uBlue;
- bool m_bVisible;
- float m_fIntensity;
-
-public:
- void SetVisibility(bool visible) { m_bVisible = visible; }
- bool IsVisible() { return m_bVisible; }
-
- void Init(CVector, float, float, uint8, uint8, uint8, float, float);
- void Update();
- void Render();
-};
-
-class CDigitalClock
-{
-private:
- CVector m_Position;
- CVector m_Size;
- float m_fDrawDistance;
- float m_fScale;
- uint8 m_uRed;
- uint8 m_uGreen;
- uint8 m_uBlue;
- bool m_bVisible;
- float m_fIntensity;
-
-public:
- void SetVisibility(bool visible) { m_bVisible = visible; }
- bool IsVisible() { return m_bVisible; }
-
- void Init(CVector, float, float, uint8, uint8, uint8, float, float);
+ void Init(CVector pos1, CVector pos2, uint8 type, uint8 red, uint8 green, uint8 blue, float scale);
void Update();
void Render();
};
diff --git a/src/render/WaterLevel.cpp b/src/render/WaterLevel.cpp
index ec9485d2..530e0e85 100644
--- a/src/render/WaterLevel.cpp
+++ b/src/render/WaterLevel.cpp
@@ -125,15 +125,11 @@ WaterLevelInitialise(Const char *pWaterDat)
if ( hFile > 0 )
{
- if ( hFile >= 0 )
- {
- CFileMgr::Read(hFile, (char *)&CWaterLevel::ms_nNoOfWaterLevels, sizeof(CWaterLevel::ms_nNoOfWaterLevels));
- CFileMgr::Read(hFile, (char *)CWaterLevel::ms_aWaterZs, sizeof(CWaterLevel::ms_aWaterZs));
- CFileMgr::Read(hFile, (char *)CWaterLevel::ms_aWaterRects, sizeof(CWaterLevel::ms_aWaterRects));
- CFileMgr::Read(hFile, (char *)CWaterLevel::aWaterBlockList, sizeof(CWaterLevel::aWaterBlockList));
- CFileMgr::Read(hFile, (char *)CWaterLevel::aWaterFineBlockList, sizeof(CWaterLevel::aWaterFineBlockList));
- }
-
+ CFileMgr::Read(hFile, (char *)&CWaterLevel::ms_nNoOfWaterLevels, sizeof(CWaterLevel::ms_nNoOfWaterLevels));
+ CFileMgr::Read(hFile, (char *)CWaterLevel::ms_aWaterZs, sizeof(CWaterLevel::ms_aWaterZs));
+ CFileMgr::Read(hFile, (char *)CWaterLevel::ms_aWaterRects, sizeof(CWaterLevel::ms_aWaterRects));
+ CFileMgr::Read(hFile, (char *)CWaterLevel::aWaterBlockList, sizeof(CWaterLevel::aWaterBlockList));
+ CFileMgr::Read(hFile, (char *)CWaterLevel::aWaterFineBlockList, sizeof(CWaterLevel::aWaterFineBlockList));
CFileMgr::CloseFile(hFile);
}
@@ -488,7 +484,6 @@ CWaterLevel::GetWaterNormal(float fX, float fY)
float fAngle = (CTimer::GetTimeInMilliseconds() & 4095) * (TWOPI / 4096.0f);
float fWindFactor = CWeather::WindClipped * 0.4f + 0.2f;
- //TODO:
float _fWave = (WATER_UNSIGN_Y(fY) - y*SMALL_SECTOR_SIZE + WATER_UNSIGN_X(fX) - x*SMALL_SECTOR_SIZE)
* (TWOPI / SMALL_SECTOR_SIZE ) + fAngle;
@@ -2948,7 +2943,7 @@ CWaterLevel::HandleBeachToysStuff(void)
{
if ( coldata.SurfaceType == SURFACE_SAND )
{
- CEntity *toy = CreateBeachToy(vecPos, BEACHTOY_LOUNGE);
+ CEntity *toy = CreateBeachToy(vecPos, BEACHTOY_ANY_LOUNGE);
if ( toy )
{
toy->SetHeading(DEGTORAD(CGeneral::GetRandomNumberInRange(0.0f, 359.0f)));
@@ -2968,6 +2963,104 @@ CWaterLevel::HandleBeachToysStuff(void)
CEntity *
CWaterLevel::CreateBeachToy(CVector const &vec, eBeachToy beachtoy)
{
- //TODO(MIAMI)
- return nil;
+ if (CObject::nNoTempObjects >= 40)
+ return nil;
+
+ int finalToy = beachtoy;
+ bool isStatic = false;
+ int model = MI_BEACHBALL;
+ switch (beachtoy) {
+ case BEACHTOY_ANY_LOUNGE:
+ switch ( CGeneral::GetRandomNumber() & 7 ) {
+ case 1:
+ case 7:
+ finalToy = BEACHTOY_LOUNGE_WOOD_UP;
+ break;
+ case 3:
+ case 5:
+ finalToy = BEACHTOY_LOUNGE_TOWEL_UP;
+ break;
+ default:
+ finalToy = BEACHTOY_LOUNGE_WOOD_ON;
+ break;
+ }
+ break;
+ case BEACHTOY_ANY_TOWEL:
+ switch ( CGeneral::GetRandomNumber() & 7 ) {
+ case 1:
+ case 7:
+ finalToy = BEACHTOY_TOWEL2;
+ break;
+ case 2:
+ case 6:
+ finalToy = BEACHTOY_TOWEL3;
+ break;
+ case 3:
+ case 5:
+ finalToy = BEACHTOY_TOWEL4;
+ break;
+ default:
+ finalToy = BEACHTOY_TOWEL1;
+ break;
+ }
+ if (CObject::nNoTempObjects >= 35) {
+ return nil;
+ }
+ default:
+ break;
+ }
+ switch (finalToy) {
+ case BEACHTOY_BALL:
+ isStatic = false;
+ model = MI_BEACHBALL;
+ break;
+ case BEACHTOY_LOUNGE_WOOD_UP:
+ isStatic = false;
+ model = MI_LOUNGE_WOOD_UP;
+ break;
+ case BEACHTOY_LOUNGE_TOWEL_UP:
+ isStatic = false;
+ model = MI_LOUNGE_TOWEL_UP;
+ break;
+ case BEACHTOY_LOUNGE_WOOD_ON:
+ isStatic = false;
+ model = MI_LOUNGE_WOOD_DN;
+ break;
+ case BEACHTOY_LOTION:
+ model = MI_LOTION;
+ isStatic = true;
+ break;
+ case BEACHTOY_TOWEL1:
+ model = MI_BEACHTOWEL01;
+ isStatic = true;
+ break;
+ case BEACHTOY_TOWEL2:
+ model = MI_BEACHTOWEL02;
+ isStatic = true;
+ break;
+ case BEACHTOY_TOWEL3:
+ model = MI_BEACHTOWEL03;
+ isStatic = true;
+ break;
+ case BEACHTOY_TOWEL4:
+ model = MI_BEACHTOWEL04;
+ isStatic = true;
+ break;
+ default:
+ break;
+ }
+ CObject *toy = new CObject(model, true);
+ if (toy) {
+ toy->SetPosition(vec);
+ toy->GetMatrix().UpdateRW();
+ toy->m_vecMoveSpeed = CVector(0.f, 0.f, 0.f);
+ toy->m_vecTurnSpeed = CVector(0.f, 0.f, 0.f);
+ toy->ObjectCreatedBy = TEMP_OBJECT;
+ toy->bIsStatic = isStatic;
+ CObject::nNoTempObjects++;
+ toy->m_nEndOfLifeTime = CTimer::GetTimeInMilliseconds() + 43200000;
+ CWorld::Add(toy);
+ return toy;
+ } else
+ return nil;
} \ No newline at end of file
diff --git a/src/render/WaterLevel.h b/src/render/WaterLevel.h
index 58940c63..0e682305 100644
--- a/src/render/WaterLevel.h
+++ b/src/render/WaterLevel.h
@@ -81,12 +81,16 @@ enum eBeachToy
{
BEACHTOY_0 = 0,
BEACHTOY_BALL,
- BEACHTOY_2,
- BEACHTOY_3,
- BEACHTOY_4,
- BEACHTOY_LOUNGE = 5,
- BEACHTOY_6,
- BEACHTOY_11 = 11
+ BEACHTOY_LOUNGE_WOOD_UP,
+ BEACHTOY_LOUNGE_TOWEL_UP,
+ BEACHTOY_LOUNGE_WOOD_ON,
+ BEACHTOY_ANY_LOUNGE,
+ BEACHTOY_LOTION,
+ BEACHTOY_TOWEL1,
+ BEACHTOY_TOWEL2,
+ BEACHTOY_TOWEL3,
+ BEACHTOY_TOWEL4,
+ BEACHTOY_ANY_TOWEL,
};
extern RwRaster* gpWaterRaster;
diff --git a/src/weapons/Weapon.cpp b/src/weapons/Weapon.cpp
index 5d9686b5..1d32487b 100644
--- a/src/weapons/Weapon.cpp
+++ b/src/weapons/Weapon.cpp
@@ -933,26 +933,25 @@ CWeapon::FireInstantHit(CEntity *shooter, CVector *fireSource)
}
else if ( shooter == FindPlayerPed() && TheCamera.Cams[0].Using3rdPersonMouseCam() )
{
- CVector src, trgt;
- TheCamera.Find3rdPersonCamTargetVector(info->m_fRange, *fireSource, src, trgt);
+ TheCamera.Find3rdPersonCamTargetVector(info->m_fRange, *fireSource, source, target);
CWorld::bIncludeBikers = true;
CWorld::bIncludeDeadPeds = true;
CWorld::bIncludeCarTyres = true;
- CWorld::ProcessLineOfSight(src, trgt, point, victim, true, true, true, true, true, false, false, true);
+ CWorld::ProcessLineOfSight(source, target, point, victim, true, true, true, true, true, false, false, true);
CWorld::bIncludeBikers = false;
CWorld::bIncludeDeadPeds = false;
CWorld::bIncludeCarTyres = false;
if (victim)
- CheckForShootingVehicleOccupant(&victim, &point, m_eWeaponType, src, trgt);
+ CheckForShootingVehicleOccupant(&victim, &point, m_eWeaponType, source, target);
int32 rotSpeed = 1;
if ( m_eWeaponType == WEAPONTYPE_M4 )
rotSpeed = 4;
CVector bulletPos;
- if ( CHeli::TestBulletCollision(&src, &trgt, &bulletPos, 4) )
+ if ( CHeli::TestBulletCollision(&source, &target, &bulletPos, 4) )
{
for ( int32 i = 0; i < 16; i++ )
CParticle::AddParticle(PARTICLE_SPARK, bulletPos, CVector(0.0f, 0.0f, 0.0f), nil, 0.0f, rotSpeed);