diff options
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/Cam.cpp | 14 | ||||
-rw-r--r-- | src/core/PlayerInfo.h | 4 | ||||
-rw-r--r-- | src/core/World.cpp | 2 | ||||
-rw-r--r-- | src/core/common.h | 8 |
4 files changed, 21 insertions, 7 deletions
diff --git a/src/core/Cam.cpp b/src/core/Cam.cpp index bc01b58e..d1ff6ddb 100644 --- a/src/core/Cam.cpp +++ b/src/core/Cam.cpp @@ -5250,11 +5250,14 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, float timestepFactor = Pow(0.99f, CTimer::GetTimeStep()); dontCollideWithCars = (timestepFactor * dontCollideWithCars) + ((1.0f - timestepFactor) * car->m_vecMoveSpeed.Magnitude()); + // Our addition +#define IS_TRAFFIC_LIGHT(ent) (ent->IsObject() && IsLightObject(ent->GetModelIndex())) + // Move cam if on collision CColPoint foundCol; CEntity* foundEnt; CWorld::pIgnoreEntity = CamTargetEntity; - if (CWorld::ProcessLineOfSight(TargetCoors, Source, foundCol, foundEnt, true, dontCollideWithCars < 0.1f, false, false, false, true, false)) { + if (CWorld::ProcessLineOfSight(TargetCoors, Source, foundCol, foundEnt, true, dontCollideWithCars < 0.1f, false, true, false, true, false) && !IS_TRAFFIC_LIGHT(foundEnt)) { float obstacleTargetDist = (TargetCoors - foundCol.point).Magnitude(); float obstacleCamDist = newDistance - obstacleTargetDist; if (!foundEnt->IsPed() || obstacleCamDist <= 1.0f) { @@ -5263,7 +5266,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, RwCameraSetNearClipPlane(Scene.camera, Max(0.05f, obstacleTargetDist - 0.3f)); } } else { - if (!CWorld::ProcessLineOfSight(foundCol.point, Source, foundCol, foundEnt, true, dontCollideWithCars < 0.1f, false, false, false, true, false)) { + if (!CWorld::ProcessLineOfSight(foundCol.point, Source, foundCol, foundEnt, true, dontCollideWithCars < 0.1f, false, true, false, true, false) || IS_TRAFFIC_LIGHT(foundEnt)) { float lessClip = obstacleCamDist - 0.35f; if (lessClip <= DEFAULT_NEAR) RwCameraSetNearClipPlane(Scene.camera, lessClip); @@ -5282,6 +5285,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, } } } + CWorld::pIgnoreEntity = nil; float nearClip = RwCameraGetNearClipPlane(Scene.camera); float radius = Tan(DEGTORAD(FOV * 0.5f)) * CDraw::GetAspectRatio() * 1.1f; @@ -5289,9 +5293,12 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, // If we're seeing blue hell due to camera intersects some surface, fix it. // SA and LCS have this unrolled. for (int i = 0; - i <= 5 && CWorld::TestSphereAgainstWorld((nearClip * Front) + Source, radius * nearClip, nil, true, true, false, true, false, false); + i <= 5 && (foundEnt = CWorld::TestSphereAgainstWorld((nearClip * Front) + Source, radius * nearClip, nil, true, true, false, true, false, false)); i++) { + if (IS_TRAFFIC_LIGHT(foundEnt)) + break; + CVector surfaceCamDist = gaTempSphereColPoints->point - Source; CVector frontButInvertedIfTouchesSurface = DotProduct(surfaceCamDist, Front) * Front; float newNearClip = (surfaceCamDist - frontButInvertedIfTouchesSurface).Magnitude() / radius; @@ -5309,6 +5316,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation, nearClip = RwCameraGetNearClipPlane(Scene.camera); radius = Tan(DEGTORAD(FOV * 0.5f)) * CDraw::GetAspectRatio() * 1.1f; } +#undef IS_TRAFFIC_LIGHT } TheCamera.m_bCamDirectlyBehind = false; TheCamera.m_bCamDirectlyInFront = false; diff --git a/src/core/PlayerInfo.h b/src/core/PlayerInfo.h index 7d99a4e0..68a50c82 100644 --- a/src/core/PlayerInfo.h +++ b/src/core/PlayerInfo.h @@ -10,7 +10,7 @@ enum eWastedBustedState WBSTATE_FAILED_CRITICAL_MISSION, }; -enum eBustedAudioState : uint8 +enum eBustedAudioState { BUSTEDAUDIO_NONE, BUSTEDAUDIO_LOADING, @@ -82,7 +82,7 @@ public: bool m_bGetOutOfJailFree; bool m_bGetOutOfHospitalFree; bool m_bDriveByAllowed; - eBustedAudioState m_nBustedAudioStatus; + uint8 m_nBustedAudioStatus; int16 m_nCurrentBustedAudio; char m_aSkinName[32]; RwTexture *m_pSkinTexture; diff --git a/src/core/World.cpp b/src/core/World.cpp index dc04738a..84722fc5 100644 --- a/src/core/World.cpp +++ b/src/core/World.cpp @@ -1580,7 +1580,7 @@ CWorld::CallOffChaseForAreaSectorListVehicles(CPtrList &list, float x1, float y1 if(pVehicle->m_scanCode != GetCurrentScanCode()) { pVehicle->m_scanCode = GetCurrentScanCode(); const CVector &vehiclePos = pVehicle->GetPosition(); - eCarMission carMission = pVehicle->AutoPilot.m_nCarMission; + uint8 carMission = pVehicle->AutoPilot.m_nCarMission; if(pVehicle != FindPlayerVehicle() && vehiclePos.x > fStartX && vehiclePos.x < fEndX && vehiclePos.y > fStartY && vehiclePos.y < fEndY && pVehicle->bIsLawEnforcer && (carMission == MISSION_RAMPLAYER_FARAWAY || carMission == MISSION_RAMPLAYER_CLOSE || diff --git a/src/core/common.h b/src/core/common.h index 9c81cf3b..181389da 100644 --- a/src/core/common.h +++ b/src/core/common.h @@ -251,8 +251,14 @@ void re3_usererror(const char *format, ...); #define DEBUGBREAK() __debugbreak(); -#define debug(f, ...) re3_debug("[DBG]: " f, ## __VA_ARGS__) +// Switch to enable development messages. +#if 1 +#define DEV(f, ...) +#else #define DEV(f, ...) re3_debug("[DEV]: " f, ## __VA_ARGS__) +#endif + +#define debug(f, ...) re3_debug("[DBG]: " f, ## __VA_ARGS__) #define TRACE(f, ...) re3_trace(__FILE__, __LINE__, __FUNCTION__, f, ## __VA_ARGS__) #define Error(f, ...) re3_debug("[ERROR]: " f, ## __VA_ARGS__) #define USERERROR(f, ...) re3_usererror(f, ## __VA_ARGS__) |