From 9703ef9b591430b86c272e0f042b1f50b6cb437c Mon Sep 17 00:00:00 2001 From: aap Date: Wed, 12 Jun 2019 21:17:02 +0200 Subject: implemented CutsceneObject; little fixes --- src/render/Renderer.cpp | 13 +++++++++++++ src/render/Renderer.h | 2 ++ src/render/Shadows.cpp | 3 ++- src/render/Shadows.h | 2 ++ src/render/Sprite2d.cpp | 2 +- 5 files changed, 20 insertions(+), 2 deletions(-) (limited to 'src/render') diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index c2b341dc..5a27ab32 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -16,6 +16,7 @@ #include "ModelIndices.h" #include "Streaming.h" #include "Shadows.h" +#include "PointLights.h" #include "Renderer.h" bool gbShowPedRoadGroups; @@ -1153,6 +1154,16 @@ CRenderer::IsVehicleCullZoneVisible(CEntity *ent) return true; } +void +CRenderer::RemoveVehiclePedLights(CEntity *ent, bool reset) +{ + if(ent->bRenderScorched) + WorldReplaceScorchedLightsWithNormal(Scene.world); + CPointLights::RemoveLightsAffectingObject(); + if(reset) + ReSetAmbientAndDirectionalColours(); +} + STARTPATCHES InjectHook(0x4A7680, CRenderer::Init, PATCH_JUMP); @@ -1185,4 +1196,6 @@ STARTPATCHES InjectHook(0x4A9840, CRenderer::ShouldModelBeStreamed, PATCH_JUMP); InjectHook(0x4AAA00, CRenderer::IsEntityCullZoneVisible, PATCH_JUMP); InjectHook(0x4AAAA0, CRenderer::IsVehicleCullZoneVisible, PATCH_JUMP); + + InjectHook(0x4A7CF0, CRenderer::RemoveVehiclePedLights, PATCH_JUMP); ENDPATCHES diff --git a/src/render/Renderer.h b/src/render/Renderer.h index 38f2b6f7..e9e056c6 100644 --- a/src/render/Renderer.h +++ b/src/render/Renderer.h @@ -56,4 +56,6 @@ public: static bool ShouldModelBeStreamed(CEntity *ent); static bool IsEntityCullZoneVisible(CEntity *ent); static bool IsVehicleCullZoneVisible(CEntity *ent); + + static void RemoveVehiclePedLights(CEntity *ent, bool reset); }; diff --git a/src/render/Shadows.cpp b/src/render/Shadows.cpp index 498df6e9..d89338c1 100644 --- a/src/render/Shadows.cpp +++ b/src/render/Shadows.cpp @@ -6,4 +6,5 @@ WRAPPER void CShadows::AddPermanentShadow(unsigned char ShadowType, RwTexture* p WRAPPER void CShadows::RenderStaticShadows(void) { EAXJMP(0x5145F0); } WRAPPER void CShadows::RenderStoredShadows(void) { EAXJMP(0x514010); } WRAPPER void CShadows::RenderExtraPlayerShadows(void) { EAXJMP(0x516F90); } -WRAPPER void CShadows::CalcPedShadowValues(CVector light, float *frontX, float *frontY, float *sideX, float *sideY, float *dispX, float *dispY) { EAXJMP(0x516EB0); } \ No newline at end of file +WRAPPER void CShadows::CalcPedShadowValues(CVector light, float *frontX, float *frontY, float *sideX, float *sideY, float *dispX, float *dispY) { EAXJMP(0x516EB0); } +WRAPPER void CShadows::StoreShadowForPedObject(CEntity *ent, float dispX, float dispY, float frontX, float frontY, float sideX, float sideY) { EAXJMP(0x513CB0); } diff --git a/src/render/Shadows.h b/src/render/Shadows.h index 1efe6507..be3ec0c4 100644 --- a/src/render/Shadows.h +++ b/src/render/Shadows.h @@ -1,6 +1,7 @@ #pragma once struct RwTexture; +class CEntity; class CShadows { @@ -10,4 +11,5 @@ public: static void RenderStoredShadows(void); static void RenderExtraPlayerShadows(void); static void CalcPedShadowValues(CVector light, float *frontX, float *frontY, float *sideX, float *sideY, float *dispX, float *dispY); + static void StoreShadowForPedObject(CEntity *ent, float dispX, float dispY, float frontX, float frontY, float sideX, float sideY); }; diff --git a/src/render/Sprite2d.cpp b/src/render/Sprite2d.cpp index fd5900b8..3dc1d989 100644 --- a/src/render/Sprite2d.cpp +++ b/src/render/Sprite2d.cpp @@ -145,7 +145,7 @@ CSprite2d::Draw(const CRect &rect, const CRGBA &c0, const CRGBA &c1, const CRGBA void CSprite2d::Draw(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, const CRGBA &col) { - SetVertices(x1, y2, x2, y2, x3, y3, x4, y4, col, col, col, col); + SetVertices(x1, y1, x2, y2, x3, y3, x4, y4, col, col, col, col); SetRenderState(); RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::maVertices, 4); } -- cgit v1.2.3