mirror of
https://github.com/hedge-dev/UnleashedRecomp.git
synced 2026-05-10 19:21:38 +00:00
Fix primitive 2D, and on screen 3D items.
This commit is contained in:
parent
d8b6befec0
commit
8fa2344f25
1 changed files with 69 additions and 60 deletions
|
|
@ -779,9 +779,9 @@ static void Draw(PPCContext& ctx, uint8_t* base, PPCFunc* original, uint32_t str
|
|||
scaleX *= g_aspectRatioGameplayScale;
|
||||
|
||||
if ((modifier.flags & ALIGN_RIGHT) != 0)
|
||||
offsetX += Video::s_viewportWidth * (1.0f - g_aspectRatioGameplayScale);
|
||||
offsetX += 1280.0f * (1.0f - g_aspectRatioGameplayScale) * g_aspectRatioScale;
|
||||
else if ((modifier.flags & ALIGN_LEFT) == 0)
|
||||
offsetX += Video::s_viewportWidth * (1.0f - g_aspectRatioGameplayScale) * 0.5f;
|
||||
offsetX += 640.0f * (1.0f - g_aspectRatioGameplayScale) * g_aspectRatioScale;
|
||||
}
|
||||
|
||||
if ((modifier.flags & WORLD_MAP) != 0)
|
||||
|
|
@ -809,9 +809,9 @@ static void Draw(PPCContext& ctx, uint8_t* base, PPCFunc* original, uint32_t str
|
|||
scaleY *= g_aspectRatioGameplayScale;
|
||||
|
||||
if ((modifier.flags & ALIGN_BOTTOM) != 0)
|
||||
offsetY += Video::s_viewportHeight * (1.0f - g_aspectRatioGameplayScale);
|
||||
offsetY += 720.0f * (1.0f - g_aspectRatioGameplayScale) * g_aspectRatioScale;
|
||||
else if ((modifier.flags & ALIGN_TOP) == 0)
|
||||
offsetY += Video::s_viewportHeight * (1.0f - g_aspectRatioGameplayScale) * 0.5f;
|
||||
offsetY += 360.0f * (1.0f - g_aspectRatioGameplayScale) * g_aspectRatioScale;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -896,10 +896,10 @@ PPC_FUNC(sub_82E16C70)
|
|||
{
|
||||
auto scissorRect = reinterpret_cast<GuestRect*>(base + ctx.r4.u32);
|
||||
|
||||
scissorRect->left = scissorRect->left + g_aspectRatioOffsetX;
|
||||
scissorRect->top = scissorRect->top + g_aspectRatioOffsetY;
|
||||
scissorRect->right = scissorRect->right + g_aspectRatioOffsetX;
|
||||
scissorRect->bottom = scissorRect->bottom + g_aspectRatioOffsetY;
|
||||
scissorRect->left = scissorRect->left * g_aspectRatioScale + g_aspectRatioOffsetX;
|
||||
scissorRect->top = scissorRect->top * g_aspectRatioScale + g_aspectRatioOffsetY;
|
||||
scissorRect->right = scissorRect->right * g_aspectRatioScale + g_aspectRatioOffsetX;
|
||||
scissorRect->bottom = scissorRect->bottom * g_aspectRatioScale + g_aspectRatioOffsetY;
|
||||
|
||||
__imp__sub_82E16C70(ctx, base);
|
||||
}
|
||||
|
|
@ -937,8 +937,6 @@ PPC_FUNC(sub_830D1EF0)
|
|||
|
||||
__imp__sub_830D1EF0(ctx, base);
|
||||
|
||||
if (!PPC_LOAD_U8(r3.u32 + PRIMITIVE_2D_PADDING_OFFSET))
|
||||
{
|
||||
struct Vertex
|
||||
{
|
||||
be<float> x;
|
||||
|
|
@ -957,8 +955,18 @@ PPC_FUNC(sub_830D1EF0)
|
|||
float x = vertex[i].x * 640.0f + 640.0f;
|
||||
float y = vertex[i].y * -360.0f + 360.0f;
|
||||
|
||||
if (PPC_LOAD_U8(r3.u32 + PRIMITIVE_2D_PADDING_OFFSET))
|
||||
{
|
||||
// Stretch
|
||||
x = ((x + 0.5f) / 1280.0f) * Video::s_viewportWidth;
|
||||
y = ((y + 0.5f) / 720.0f) * Video::s_viewportHeight;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Center
|
||||
x = g_aspectRatioOffsetX + (x + 0.5f) * g_aspectRatioScale;
|
||||
y = g_aspectRatioOffsetY + (y + 0.5f) * g_aspectRatioScale;
|
||||
}
|
||||
|
||||
vertex[i].x = ((x - 0.5f) / Video::s_viewportWidth) * 2.0f - 1.0f;
|
||||
vertex[i].y = ((y - 0.5f) / Video::s_viewportHeight) * -2.0f + 1.0f;
|
||||
|
|
@ -1002,7 +1010,6 @@ PPC_FUNC(sub_830D1EF0)
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Objects are pushed forward by 1m, so the coordinates need to compensate for it.
|
||||
static const double OBJ_GET_ITEM_TANGENT = tan(M_PI / 8.0);
|
||||
|
|
@ -1033,8 +1040,9 @@ static double ComputeObjGetItemX(uint32_t type)
|
|||
x = 1058.0;
|
||||
|
||||
x *= g_aspectRatioScale;
|
||||
x *= g_aspectRatioGameplayScale;
|
||||
|
||||
double scaleOffset = (1280.0 * (1.0 - g_aspectRatioScale));
|
||||
double scaleOffset = (1280.0 * (1.0 - g_aspectRatioGameplayScale)) * g_aspectRatioScale;
|
||||
|
||||
if (Config::UIScaleMode == EUIScaleMode::Edge)
|
||||
{
|
||||
|
|
@ -1080,7 +1088,8 @@ static double ComputeObjGetItemY(uint32_t type)
|
|||
y = 582.0;
|
||||
|
||||
y *= g_aspectRatioScale;
|
||||
y += g_aspectRatioOffsetY * 2.0 + 720.0 * (1.0 - g_aspectRatioScale);
|
||||
y *= g_aspectRatioGameplayScale;
|
||||
y += g_aspectRatioOffsetY * 2.0 + 720.0 * (1.0 - g_aspectRatioGameplayScale) * g_aspectRatioScale;
|
||||
|
||||
return ((0.5 * Video::s_viewportHeight) - y) / (0.5 * Video::s_viewportHeight) * OBJ_GET_ITEM_TANGENT;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue