From a01b14f301afe9cea86f47b3ab27ce999097741a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?eray=20or=C3=A7unus?= Date: Fri, 9 Oct 2020 12:02:21 +0300 Subject: [PATCH] Fix sniper and water creatures bug, mark some files --- src/core/General.h | 2 ++ src/entities/Dummy.cpp | 2 ++ src/objects/DummyObject.cpp | 2 ++ src/objects/Object.cpp | 23 ++++++++++++++++++----- src/objects/Object.h | 2 +- src/objects/Projectile.cpp | 2 ++ src/objects/Stinger.cpp | 2 +- src/peds/PedRoutes.cpp | 2 ++ src/peds/PedStats.cpp | 2 ++ src/render/Fluff.cpp | 4 ++-- src/rw/Lights.h | 1 + src/vehicles/Heli.cpp | 16 +++++++++------- 12 files changed, 44 insertions(+), 16 deletions(-) diff --git a/src/core/General.h b/src/core/General.h index 7ab444a4..7e06b96e 100644 --- a/src/core/General.h +++ b/src/core/General.h @@ -2,6 +2,8 @@ #include +// --MIAMI: file done + class CGeneral { public: diff --git a/src/entities/Dummy.cpp b/src/entities/Dummy.cpp index 92b69761..544e24a6 100644 --- a/src/entities/Dummy.cpp +++ b/src/entities/Dummy.cpp @@ -4,6 +4,8 @@ #include "World.h" #include "Dummy.h" +// --MIAMI: file done + void *CDummy::operator new(size_t sz) { return CPools::GetDummyPool()->New(); } void CDummy::operator delete(void *p, size_t sz) { CPools::GetDummyPool()->Delete((CDummy*)p); } diff --git a/src/objects/DummyObject.cpp b/src/objects/DummyObject.cpp index 8dd1643d..8656abbb 100644 --- a/src/objects/DummyObject.cpp +++ b/src/objects/DummyObject.cpp @@ -3,6 +3,8 @@ #include "DummyObject.h" #include "Pools.h" +// --MIAMI: file done + CDummyObject::CDummyObject(CObject *obj) { SetModelIndexNoCreate(obj->GetModelIndex()); diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp index daa48d98..9a9eaa73 100644 --- a/src/objects/Object.cpp +++ b/src/objects/Object.cpp @@ -36,6 +36,7 @@ CObject::CObject(void) m_colour2 = 0; m_colour1 = m_colour2; m_nBonusValue = 0; + // m_nCostValue = 0; // TODO(Miami) bIsPickup = false; bPickupObjWithMessage = false; bOutOfStock = false; @@ -44,8 +45,12 @@ CObject::CObject(void) bHasBeenDamaged = false; m_nRefModelIndex = -1; bUseVehicleColours = false; +// bIsStreetLight = false; // duplicate m_pCurSurface = nil; m_pCollidingEntity = nil; + m_nBeachballBounces = 0; + bIsStreetLight = false; + m_area = AREA_EVERYWHERE; } CObject::CObject(int32 mi, bool createRW) @@ -138,12 +143,16 @@ CObject::Render(void) bool CObject::SetupLighting(void) { - DeActivateDirectional(); - SetAmbientColours(); - if(bRenderScorched){ WorldReplaceNormalLightsWithScorched(Scene.world, 0.1f); return true; + } else if (bIsPickup) { + SetFullAmbient(); + return true; + } else if (bIsWeapon) { + ActivateDirectional(); + SetAmbientColoursForPedsCarsAndObjects(); + return true; } return false; } @@ -151,8 +160,10 @@ CObject::SetupLighting(void) void CObject::RemoveLighting(bool reset) { - if(reset) - WorldReplaceScorchedLightsWithNormal(Scene.world); + if(reset) { + SetAmbientColours(); + DeActivateDirectional(); + } } void @@ -363,6 +374,8 @@ CObject::CanBeDeleted(void) return true; case CUTSCENE_OBJECT: return false; + case CONTROLLED_SUB_OBJECT: + return false; default: return true; } diff --git a/src/objects/Object.h b/src/objects/Object.h index 5f0ec0ab..b81e84b6 100644 --- a/src/objects/Object.h +++ b/src/objects/Object.h @@ -8,7 +8,7 @@ enum { MISSION_OBJECT = 2, TEMP_OBJECT = 3, CUTSCENE_OBJECT = 4, - ESCALATOR_OBJECT = 5, + CONTROLLED_SUB_OBJECT = 5, }; enum CollisionSpecialResponseCase diff --git a/src/objects/Projectile.cpp b/src/objects/Projectile.cpp index fe8b0c68..fc4b25cf 100644 --- a/src/objects/Projectile.cpp +++ b/src/objects/Projectile.cpp @@ -2,6 +2,8 @@ #include "Projectile.h" +// --MIAMI: file done + CProjectile::CProjectile(int32 model) : CObject() { m_fMass = 1.0f; diff --git a/src/objects/Stinger.cpp b/src/objects/Stinger.cpp index f33125ee..b3660881 100644 --- a/src/objects/Stinger.cpp +++ b/src/objects/Stinger.cpp @@ -23,7 +23,7 @@ CStingerSegment::CStingerSegment() m_fBuoyancy = GRAVITY * m_fMass * 0.1f; bExplosionProof = true; SetModelIndex(MI_PLC_STINGER); - ObjectCreatedBy = ESCALATOR_OBJECT; + ObjectCreatedBy = CONTROLLED_SUB_OBJECT; NumOfStingerSegments++; } diff --git a/src/peds/PedRoutes.cpp b/src/peds/PedRoutes.cpp index 3ff080e6..2de90eae 100644 --- a/src/peds/PedRoutes.cpp +++ b/src/peds/PedRoutes.cpp @@ -3,6 +3,8 @@ #include "main.h" #include "PedRoutes.h" +// --MIAMI: file done + CRouteNode gaRoutes[NUMPEDROUTES]; void diff --git a/src/peds/PedStats.cpp b/src/peds/PedStats.cpp index 1f7a95b4..fe594bdf 100644 --- a/src/peds/PedStats.cpp +++ b/src/peds/PedStats.cpp @@ -4,6 +4,8 @@ #include "FileMgr.h" #include "PedStats.h" +// --MIAMI: file done + CPedStats *CPedStats::ms_apPedStats[NUM_PEDSTATS]; void diff --git a/src/render/Fluff.cpp b/src/render/Fluff.cpp index 31bf92a8..773561f3 100644 --- a/src/render/Fluff.cpp +++ b/src/render/Fluff.cpp @@ -1358,7 +1358,7 @@ CEscalator::Update(void) { if (m_pSteps[i]) { m_pSteps[i]->SetPosition(m_pos1); CWorld::Add(m_pSteps[i]); - m_pSteps[i]->ObjectCreatedBy = ESCALATOR_OBJECT; + m_pSteps[i]->ObjectCreatedBy = CONTROLLED_SUB_OBJECT; } } } @@ -1713,4 +1713,4 @@ void CScriptPaths::Save_ForReplay(void) { g_pScriptPathObjects[6 * i + j] = aArray[i].m_pObjects[j]; } } -} \ No newline at end of file +} diff --git a/src/rw/Lights.h b/src/rw/Lights.h index b296816b..c3543d77 100644 --- a/src/rw/Lights.h +++ b/src/rw/Lights.h @@ -22,3 +22,4 @@ void SetAmbientColours(void); void SetAmbientColoursForPedsCarsAndObjects(void); void SetAmbientColoursToIndicateRoadGroup(int i); void SetAmbientColours(RwRGBAReal *color); +void SetFullAmbient(void); diff --git a/src/vehicles/Heli.cpp b/src/vehicles/Heli.cpp index a770f83d..2c2fb33c 100644 --- a/src/vehicles/Heli.cpp +++ b/src/vehicles/Heli.cpp @@ -1011,14 +1011,16 @@ CHeli::TestSniperCollision(CVector *line0, CVector *line1) bool hit = false; for(i = 0; i < NUM_HELIS; i++){ - CVector pilotPos = pHelis[i]->GetMatrix() * CVector(-0.43f, 1.49f, 1.5f); - if(pHelis[i] && !pHelis[i]->bBulletProof && CCollision::DistToLine(line0, line1, &pilotPos) < 0.8f){ - pHelis[i]->m_fAngularSpeed = CGeneral::GetRandomTrueFalse() ? 0.05f : -0.05f; - pHelis[i]->m_heliStatus = HELI_STATUS_SHOT_DOWN; - pHelis[i]->m_nExplosionTimer = CTimer::GetTimeInMilliseconds() + 9999999; - pHelis[i]->m_numSwat = 0; + if(pHelis[i] && !pHelis[i]->bBulletProof) { + CVector pilotPos = pHelis[i]->GetMatrix() * CVector(-0.43f, 1.49f, 1.5f); + if(CCollision::DistToLine(line0, line1, &pilotPos) < 0.8f){ + pHelis[i]->m_fAngularSpeed = CGeneral::GetRandomTrueFalse() ? 0.05f : -0.05f; + pHelis[i]->m_heliStatus = HELI_STATUS_SHOT_DOWN; + pHelis[i]->m_nExplosionTimer = CTimer::GetTimeInMilliseconds() + 9999999; + pHelis[i]->m_numSwat = 0; - hit = true; + hit = true; + } } } return hit;