Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Nikolay Korolev 2020-05-12 20:23:03 +03:00
commit 180a1dc42b
3 changed files with 10 additions and 8 deletions

View file

@ -5099,7 +5099,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
CColPoint foundCol; CColPoint foundCol;
CEntity* foundEnt; CEntity* foundEnt;
CWorld::pIgnoreEntity = CamTargetEntity; CWorld::pIgnoreEntity = CamTargetEntity;
if (CWorld::ProcessLineOfSight(TargetCoors, Source, foundCol, foundEnt, true, dontCollideWithCars < 0.1f, false, true, false, true, false)) { if (CWorld::ProcessLineOfSight(TargetCoors, Source, foundCol, foundEnt, true, dontCollideWithCars < 0.1f, false, false, false, true, false)) {
float obstacleTargetDist = (TargetCoors - foundCol.point).Magnitude(); float obstacleTargetDist = (TargetCoors - foundCol.point).Magnitude();
float obstacleCamDist = newDistance - obstacleTargetDist; float obstacleCamDist = newDistance - obstacleTargetDist;
if (!foundEnt->IsPed() || obstacleCamDist <= 1.0f) { if (!foundEnt->IsPed() || obstacleCamDist <= 1.0f) {
@ -5108,7 +5108,7 @@ CCam::Process_FollowCar_SA(const CVector& CameraTarget, float TargetOrientation,
RwCameraSetNearClipPlane(Scene.camera, Max(0.05f, obstacleTargetDist - 0.3f)); RwCameraSetNearClipPlane(Scene.camera, Max(0.05f, obstacleTargetDist - 0.3f));
} }
} else { } else {
if (!CWorld::ProcessLineOfSight(foundCol.point, Source, foundCol, foundEnt, true, dontCollideWithCars < 0.1f, false, true, false, true, false)) { if (!CWorld::ProcessLineOfSight(foundCol.point, Source, foundCol, foundEnt, true, dontCollideWithCars < 0.1f, false, false, false, true, false)) {
float lessClip = obstacleCamDist - 0.35f; float lessClip = obstacleCamDist - 0.35f;
if (lessClip <= DEFAULT_NEAR) if (lessClip <= DEFAULT_NEAR)
RwCameraSetNearClipPlane(Scene.camera, lessClip); RwCameraSetNearClipPlane(Scene.camera, lessClip);

View file

@ -263,6 +263,9 @@ DoFade(void)
void void
DoRWStuffEndOfFrame(void) DoRWStuffEndOfFrame(void)
{ {
char buf[100];
sprintf(buf, "timestep: %f %f", CTimer::GetTimeStep(), CTimer::GetTimeStepInMilliseconds());
CDebug::PrintAt(buf, 10, 10);
CDebug::DisplayScreenStrings(); // custom CDebug::DisplayScreenStrings(); // custom
CDebug::DebugDisplayTextBuffer(); CDebug::DebugDisplayTextBuffer();
FlushObrsPrintfs(); FlushObrsPrintfs();

View file

@ -93,7 +93,7 @@ CClouds::Render(void)
int minute = CClock::GetHours()*60 + CClock::GetMinutes(); int minute = CClock::GetHours()*60 + CClock::GetMinutes();
RwV3d campos = *(RwV3d*)&TheCamera.GetPosition(); RwV3d campos = *(RwV3d*)&TheCamera.GetPosition();
float coverage = CWeather::CloudCoverage <= CWeather::Foggyness ? CWeather::Foggyness : CWeather::CloudCoverage; float coverage = Max(CWeather::Foggyness, CWeather::Foggyness);
// Moon // Moon
int moonfadeout = Abs(minute - 180); // fully visible at 3AM int moonfadeout = Abs(minute - 180); // fully visible at 3AM
@ -308,20 +308,19 @@ CClouds::Render(void)
bool bool
UseDarkBackground(void) UseDarkBackground(void)
{ {
return RwFrameGetLTM(RwCameraGetFrame(TheCamera.m_pRwCamera))->up.z < -0.9f || return TheCamera.GetForward().z < -0.9f || gbShowCollisionPolys;
gbShowCollisionPolys;
} }
void void
CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue, CClouds::RenderBackground(int16 topred, int16 topgreen, int16 topblue,
int16 botred, int16 botgreen, int16 botblue, int16 alpha) int16 botred, int16 botgreen, int16 botblue, int16 alpha)
{ {
RwMatrix *mat = RwFrameGetLTM(RwCameraGetFrame(TheCamera.m_pRwCamera)); CVector left = TheCamera.GetRight();
float c = Sqrt(mat->right.x * mat->right.x + mat->right.y * mat->right.y); float c = left.Magnitude2D();
if(c > 1.0f) if(c > 1.0f)
c = 1.0f; c = 1.0f;
ms_cameraRoll = Acos(c); ms_cameraRoll = Acos(c);
if(mat->right.z < 0.0f) if(left.z < 0.0f)
ms_cameraRoll = -ms_cameraRoll; ms_cameraRoll = -ms_cameraRoll;
if(UseDarkBackground()){ if(UseDarkBackground()){