From 6225e5072309e69e98246f59222ba82ddf6a418a Mon Sep 17 00:00:00 2001 From: aap Date: Thu, 9 Apr 2020 16:35:24 +0200 Subject: fixed questionable RW usage; changed radar mask to PS2 techinque --- src/render/Sprite2d.cpp | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'src/render/Sprite2d.cpp') diff --git a/src/render/Sprite2d.cpp b/src/render/Sprite2d.cpp index c4dbcdaa..3f21516a 100644 --- a/src/render/Sprite2d.cpp +++ b/src/render/Sprite2d.cpp @@ -267,6 +267,7 @@ CSprite2d::SetVertices(float x1, float y1, float x2, float y2, float x3, float y const CRGBA &c0, const CRGBA &c1, const CRGBA &c2, const CRGBA &c3) { float screenz, recipz; + float z = RwCameraGetNearClipPlane(Scene.camera); // not done by game screenz = RwIm2DGetNearScreenZ(); recipz = RecipNearClip; @@ -312,10 +313,11 @@ void CSprite2d::SetVertices(int n, float *positions, float *uvs, const CRGBA &col) { int i; - float screenz, recipz; + float screenz, recipz, z; screenz = RwIm2DGetNearScreenZ(); recipz = RecipNearClip; + z = RwCameraGetNearClipPlane(Scene.camera); // not done by game for(i = 0; i < n; i++){ @@ -334,10 +336,11 @@ void CSprite2d::SetMaskVertices(int n, float *positions) { int i; - float screenz, recipz; + float screenz, recipz, z; screenz = RwIm2DGetNearScreenZ(); recipz = RecipNearClip; + z = RwCameraGetNearClipPlane(Scene.camera); // not done by game for(i = 0; i < n; i++){ RwIm2DVertexSetScreenX(&maVertices[i], positions[i*2 + 0]); @@ -345,7 +348,7 @@ CSprite2d::SetMaskVertices(int n, float *positions) RwIm2DVertexSetScreenZ(&maVertices[i], screenz); RwIm2DVertexSetCameraZ(&maVertices[i], z); RwIm2DVertexSetRecipCameraZ(&maVertices[i], recipz); - RwIm2DVertexSetIntRGBA(&maVertices[i], 0, 0, 0, 0); + RwIm2DVertexSetIntRGBA(&maVertices[i], 255, 255, 255, 255); // 0, 0, 0, 0 on PC } } @@ -353,10 +356,11 @@ void CSprite2d::SetVertices(RwIm2DVertex *verts, const CRect &r, const CRGBA &c0, const CRGBA &c1, const CRGBA &c2, const CRGBA &c3, float u0, float v0, float u1, float v1, float u3, float v3, float u2, float v2) { - float screenz, recipz; + float screenz, recipz, z; screenz = RwIm2DGetNearScreenZ(); recipz = RecipNearClip; + z = RwCameraGetNearClipPlane(Scene.camera); // not done by game RwIm2DVertexSetScreenX(&verts[0], r.left); RwIm2DVertexSetScreenY(&verts[0], r.top); @@ -459,15 +463,15 @@ CSprite2d::DrawRectXLU(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C void CSprite2d::Draw2DPolygon(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4, const CRGBA &color) { - SetVertices(x1, y1, x2, y2, x3, y3, x4, y4, color, color, color, color); - RwRenderStateSet(rwRENDERSTATETEXTURERASTER, 0); - RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT); - RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); - RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); - RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)(color.a != 255)); - RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::maVertices, 4); - RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE); - RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); + SetVertices(x1, y1, x2, y2, x3, y3, x4, y4, color, color, color, color); + RwRenderStateSet(rwRENDERSTATETEXTURERASTER, 0); + RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEFLAT); + RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)FALSE); + RwRenderStateSet(rwRENDERSTATEVERTEXALPHAENABLE, (void*)(color.a != 255)); + RwIm2DRenderPrimitive(rwPRIMTYPETRIFAN, CSprite2d::maVertices, 4); + RwRenderStateSet(rwRENDERSTATEZTESTENABLE, (void*)TRUE); + RwRenderStateSet(rwRENDERSTATEZWRITEENABLE, (void*)TRUE); RwRenderStateSet(rwRENDERSTATESHADEMODE, (void*)rwSHADEMODEGOURAUD); } -- cgit v1.2.3