From fe40f65703052e4fb4f54fd8a2eec08b26e4313a Mon Sep 17 00:00:00 2001 From: Sergeanur Date: Fri, 20 Nov 2020 01:18:37 +0200 Subject: Reorganize CPed functions into their original cpp files --- src/render/Renderer.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'src/render/Renderer.cpp') diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index c2982d6d..fa01c61a 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -1492,6 +1492,45 @@ CRenderer::RequestObjectsInFrustum(void) } } +// --MIAMI: Done +bool +CPed::SetupLighting(void) +{ + ActivateDirectional(); + SetAmbientColoursForPedsCarsAndObjects(); + +#ifndef MASTER + // Originally this was being called through iteration of Sectors, but putting it here is better. + if (GetDebugDisplay() != 0 && !IsPlayer()) + DebugRenderOnePedText(); +#endif + + if (bRenderScorched) { + WorldReplaceNormalLightsWithScorched(Scene.world, 0.1f); + } else { + // Note that this lightMult is only affected by LIGHT_DARKEN. If there's no LIGHT_DARKEN, it will be 1.0. + float lightMult = CPointLights::GenerateLightsAffectingObject(&GetPosition()); + if (lightMult != 1.0f) { + SetAmbientAndDirectionalColours(lightMult); + return true; + } + } + return false; +} + +// --MIAMI: Done +void +CPed::RemoveLighting(bool reset) +{ + if (!bRenderScorched) { + CRenderer::RemoveVehiclePedLights(this, reset); + if (reset) + ReSetAmbientAndDirectionalColours(); + } + SetAmbientColours(); + DeActivateDirectional(); +} + float CalcNewDelta(RwV2d *a, RwV2d *b) { -- cgit v1.2.3