Fix sprite depths for text that got broken from the recip changes

This commit is contained in:
Stefanos Kornilios Mitsis Poiitidis
2025-03-15 01:32:00 +02:00
parent c456198906
commit aa34cd3bd7
2 changed files with 11 additions and 10 deletions

View File

@@ -177,8 +177,8 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
z = RwCameraGetFarClipPlane(Scene.camera);
}else{
screenz = RwIm2DGetNearScreenZ();
z = 1.0f/RecipNearClip;
RecipNearClip *= 1.1f;
z = 1.0f/RecipNearClip;
}
recipz = 1.0f/z;
float offset = 1.0f/1024.0f;
@@ -231,9 +231,9 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
float screenz, z, recipz;
screenz = RwIm2DGetNearScreenZ();
RecipNearClip *= 1.1f;
z = 1.0f/RecipNearClip;
recipz = 1.0f/z;
RecipNearClip *= 1.1f;
// This is what we draw:
// 0---1
@@ -286,6 +286,7 @@ CSprite2d::SetVertices(float x1, float y1, float x2, float y2, float x3, float y
screenz = RwIm2DGetNearScreenZ();
recipz = RecipNearClip;
RecipNearClip *= 1.1f;
z = 1/RecipNearClip;
RwIm2DVertexSetScreenX(&maVertices[0], x3);
RwIm2DVertexSetScreenY(&maVertices[0], y3);
@@ -333,7 +334,7 @@ CSprite2d::SetVertices(int n, float *positions, float *uvs, const CRGBA &col)
screenz = RwIm2DGetNearScreenZ();
recipz = RecipNearClip;
RecipNearClip *= 1.1f;
z = RwCameraGetNearClipPlane(Scene.camera); // not done by game
z = 1/RecipNearClip;
for(i = 0; i < n; i++){
@@ -357,7 +358,7 @@ CSprite2d::SetMaskVertices(int n, float *positions)
screenz = RwIm2DGetNearScreenZ();
recipz = RecipNearClip;
RecipNearClip *= 1.1f;
z = RwCameraGetNearClipPlane(Scene.camera); // not done by game
z = 1/RecipNearClip;
for(i = 0; i < n; i++){
RwIm2DVertexSetScreenX(&maVertices[i], positions[i*2 + 0]);
@@ -382,7 +383,7 @@ CSprite2d::SetVertices(RwIm2DVertex *verts, const CRect &r, const CRGBA &c0, con
screenz = RwIm2DGetNearScreenZ();
recipz = RecipNearClip;
RecipNearClip *= 1.1f;
z = RwCameraGetNearClipPlane(Scene.camera); // not done by game
z = 1/RecipNearClip;
RwIm2DVertexSetScreenX(&verts[0], r.left);
RwIm2DVertexSetScreenY(&verts[0], r.top);

View File

@@ -130,7 +130,7 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
float offset = 1.0f/1024.0f;
// Workaround for PVR Z-Equality not being exact
RecipNearClip *= 1.1f;
NearCamZ /= 1.1f;
// This is what we draw:
// 0---1
@@ -178,7 +178,7 @@ CSprite2d::SetVertices(const CRect &r, const CRGBA &c0, const CRGBA &c1, const C
float u0, float v0, float u1, float v1, float u3, float v3, float u2, float v2)
{
// Workaround for PVR Z-Equality not being exact
RecipNearClip *= 1.1f;
NearCamZ /= 1.1f;
// This is what we draw:
// 0---1
@@ -227,7 +227,7 @@ CSprite2d::SetVertices(float x1, float y1, float x2, float y2, float x3, float y
{
// Workaround for PVR Z-Equality not being exact
if (dt == DRAW_NEAR) {
RecipNearClip *= 1.1f;
NearCamZ /= 1.1f;
}
float screenZ = dt == DRAW_FAR ? FarScreenZ : NearScreenZ;
@@ -275,7 +275,7 @@ void
CSprite2d::SetVertices(int n, float *positions, float *uvs, const CRGBA &col)
{
// Workaround for PVR Z-Equality not being exact
RecipNearClip *= 1.1f;
NearCamZ /= 1.1f;
int i;
@@ -315,7 +315,7 @@ CSprite2d::SetVertices(RwIm2DVertex *verts, const CRect &r, const CRGBA &c0, con
float u0, float v0, float u1, float v1, float u3, float v3, float u2, float v2)
{
// Workaround for PVR Z-Equality not being exact
RecipNearClip *= 1.1f;
NearCamZ /= 1.1f;
RwIm2DVertexSetScreenX(&verts[0], r.left);
RwIm2DVertexSetScreenY(&verts[0], r.top);