Fix boss name arrows for ultrawide. (#351)

This commit is contained in:
Skyth (Asilkan) 2025-02-10 14:23:29 +03:00 committed by GitHub
parent fc99db7c97
commit 4502a9efee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -344,6 +344,8 @@ enum
LOADING_BLACK_BAR_MIN = 1 << 17, LOADING_BLACK_BAR_MIN = 1 << 17,
LOADING_BLACK_BAR_MAX = 1 << 18, LOADING_BLACK_BAR_MAX = 1 << 18,
UNSTRETCH_HORIZONTAL = 1 << 19,
}; };
struct CsdModifier struct CsdModifier
@ -365,6 +367,10 @@ static const xxHashMap<CsdModifier> g_modifiers =
{ HashStr("ui_boss_gauge/gauge_1"), { ALIGN_TOP_RIGHT | SCALE } }, { HashStr("ui_boss_gauge/gauge_1"), { ALIGN_TOP_RIGHT | SCALE } },
{ HashStr("ui_boss_gauge/gauge_breakpoint"), { ALIGN_TOP_RIGHT | SCALE } }, { HashStr("ui_boss_gauge/gauge_breakpoint"), { ALIGN_TOP_RIGHT | SCALE } },
// ui_boss_name
{ HashStr("ui_boss_name/name_so/bg"), { UNSTRETCH_HORIZONTAL } },
{ HashStr("ui_boss_name/name_so/pale"), { UNSTRETCH_HORIZONTAL } },
// ui_exstage // ui_exstage
{ HashStr("ui_exstage/shield/L_gauge"), { ALIGN_BOTTOM_LEFT | SCALE } }, { HashStr("ui_exstage/shield/L_gauge"), { ALIGN_BOTTOM_LEFT | SCALE } },
{ HashStr("ui_exstage/shield/L_gauge_effect"), { ALIGN_BOTTOM_LEFT | SCALE } }, { HashStr("ui_exstage/shield/L_gauge_effect"), { ALIGN_BOTTOM_LEFT | SCALE } },
@ -944,7 +950,9 @@ static void Draw(PPCContext& ctx, uint8_t* base, PPCFunc* original, uint32_t str
float scaleX = 1.0f; float scaleX = 1.0f;
float scaleY = 1.0f; float scaleY = 1.0f;
if (squash || ((modifier.flags & STRETCH_HORIZONTAL) != 0 && g_aspectRatio >= WIDE_ASPECT_RATIO)) bool needsStretch = g_aspectRatio >= WIDE_ASPECT_RATIO;
if (squash || (needsStretch && (modifier.flags & STRETCH_HORIZONTAL) != 0))
{ {
scaleX = Video::s_viewportWidth / 1280.0f; scaleX = Video::s_viewportWidth / 1280.0f;
} }
@ -952,28 +960,36 @@ static void Draw(PPCContext& ctx, uint8_t* base, PPCFunc* original, uint32_t str
{ {
scaleX = g_aspectRatioScale; scaleX = g_aspectRatioScale;
if ((modifier.flags & ALIGN_RIGHT) != 0) if (needsStretch && (modifier.flags & UNSTRETCH_HORIZONTAL) != 0)
offsetX = g_aspectRatioOffsetX * 2.0f;
else if ((modifier.flags & ALIGN_LEFT) == 0)
offsetX = g_aspectRatioOffsetX;
if ((modifier.flags & SCALE) != 0)
{ {
scaleX *= g_aspectRatioGameplayScale; pivotX = *getPosition(0);
pivotX = g_scenePositionX; offsetX = pivotX * Video::s_viewportWidth / 1280.0f;
if ((modifier.flags & ALIGN_RIGHT) != 0)
offsetX += 1280.0f * (1.0f - g_aspectRatioGameplayScale) * g_aspectRatioScale;
else if ((modifier.flags & ALIGN_LEFT) == 0)
offsetX += 640.0f * (1.0f - g_aspectRatioGameplayScale) * g_aspectRatioScale;
offsetX += pivotX * g_aspectRatioScale;
} }
else
if ((modifier.flags & WORLD_MAP) != 0)
{ {
if ((modifier.flags & ALIGN_LEFT) != 0) if ((modifier.flags & ALIGN_RIGHT) != 0)
offsetX += (1.0f - g_aspectRatioNarrowScale) * g_aspectRatioScale * -20.0f; offsetX = g_aspectRatioOffsetX * 2.0f;
else if ((modifier.flags & ALIGN_LEFT) == 0)
offsetX = g_aspectRatioOffsetX;
if ((modifier.flags & SCALE) != 0)
{
scaleX *= g_aspectRatioGameplayScale;
pivotX = g_scenePositionX;
if ((modifier.flags & ALIGN_RIGHT) != 0)
offsetX += 1280.0f * (1.0f - g_aspectRatioGameplayScale) * g_aspectRatioScale;
else if ((modifier.flags & ALIGN_LEFT) == 0)
offsetX += 640.0f * (1.0f - g_aspectRatioGameplayScale) * g_aspectRatioScale;
offsetX += pivotX * g_aspectRatioScale;
}
if ((modifier.flags & WORLD_MAP) != 0)
{
if ((modifier.flags & ALIGN_LEFT) != 0)
offsetX += (1.0f - g_aspectRatioNarrowScale) * g_aspectRatioScale * -20.0f;
}
} }
} }