Fix cross-platform rendering and optimize frame performance

Correct selection orientation, game-entry lifecycle, mounted NPCs, labels and skill panels. Add the native GPU scene path, resident geometry, bounded texture and Python caches, and collision broad phase.

Pin the independently maintained Metin2 SDK through a submodule and document reproducible setup. Include rendering regressions and macOS packaging improvements.

Validation: client Debug build and 12 targeted client tests passed; SDK build and all 14 SDK tests passed.
This commit is contained in:
shen
2026-10-11 17:55:53 -07:00
parent 08cc8865be
commit 281418f351
101 changed files with 6244 additions and 1877 deletions
+19 -14
View File
@@ -455,9 +455,9 @@ void TextTailManager::ArrangeTextTail() {
for (auto& tail : m_characterList) {
if (!tail) continue;
float nameWidth = static_cast<float>(tail->name.size()) * 8.0f;
float titleWidth = tail->title.empty() ? 0.0f : (static_cast<float>(tail->title.size()) * 8.0f);
float levelWidth = tail->level.empty() ? 0.0f : (static_cast<float>(tail->level.size()) * 8.0f);
float nameWidth = TextWidth(tail->name);
float titleWidth = tail->title.empty() ? 0.0f : (TextWidth(tail->title));
float levelWidth = tail->level.empty() ? 0.0f : (TextWidth(tail->level));
float totalW = nameWidth;
if (!tail->title.empty()) totalW += titleWidth + 6.0f;
@@ -493,6 +493,7 @@ void TextTailManager::RenderTextTailBox(SDL_Renderer* renderer, const TextTailIt
void TextTailManager::RenderText(SDL_Renderer* renderer, float x, float y, const std::string& text, uint32_t color, float scale, bool shadow) {
if (text.empty()) return;
if (m_textPainter) { m_textPainter(x,y,text,color,scale,shadow); return; }
uint8_t a = (color >> 24) & 0xFF;
if (a == 0) a = 0xFF;
@@ -520,7 +521,7 @@ void TextTailManager::RenderText(SDL_Renderer* renderer, float x, float y, const
void TextTailManager::RenderChatBubble(SDL_Renderer* renderer, const TextTailItem& tail) {
if (!tail.hasChat || tail.chatText.empty()) return;
float textW = static_cast<float>(tail.chatText.size()) * 8.0f;
float textW = TextWidth(tail.chatText);
float bubbleW = textW + 16.0f;
float bubbleH = 22.0f;
float bx = tail.x - bubbleW * 0.5f;
@@ -562,7 +563,7 @@ void TextTailManager::Render(SDL_Renderer* renderer, const Gr2SceneRenderer* sce
RenderTextTailBox(renderer, *tail);
float textW = static_cast<float>(tail->name.size()) * 8.0f;
float textW = TextWidth(tail->name);
float tx = tail->x - textW * 0.5f;
float ty = tail->y - 10.0f;
@@ -580,7 +581,7 @@ void TextTailManager::Render(SDL_Renderer* renderer, const Gr2SceneRenderer* sce
std::snprintf(buf, sizeof(buf), "(%dm %ds) ", m, s);
ownerTag = std::string(buf) + ownerTag;
}
float owW = static_cast<float>(ownerTag.size()) * 8.0f * 0.9f;
float owW = TextWidth(ownerTag, 0.9f);
uint32_t owColor = tail->isMineItem ? 0xFFFFD700 : 0xFFFF6060;
RenderText(renderer, tail->x - owW * 0.5f, ty - 14.0f, ownerTag, owColor, 0.9f, true);
}
@@ -590,27 +591,31 @@ void TextTailManager::Render(SDL_Renderer* renderer, const Gr2SceneRenderer* sce
for (const auto& tail : m_characterList) {
if (!tail) continue;
float nameW = static_cast<float>(tail->name.size()) * 8.0f;
float titleW = tail->title.empty() ? 0.0f : (static_cast<float>(tail->title.size()) * 8.0f);
float levelW = tail->level.empty() ? 0.0f : (static_cast<float>(tail->level.size()) * 8.0f);
float nameW = TextWidth(tail->name);
float titleW = tail->title.empty() ? 0.0f : (TextWidth(tail->title));
float levelW = tail->level.empty() ? 0.0f : (TextWidth(tail->level));
float totalW = nameW;
if (!tail->title.empty()) totalW += titleW + 6.0f;
if (!tail->level.empty()) totalW += levelW + 6.0f;
float curX = tail->x - totalW * 0.5f;
float curY = tail->y - 10.0f;
// Original AVA2 keeps the name centered on the actor; level and title
// extend to its left rather than moving the whole nameplate to the right.
float curX = tail->x + 4.0f - nameW * 0.5f;
if (!tail->title.empty()) curX -= titleW + 4.0f;
if (!tail->level.empty()) curX -= levelW + 4.0f;
float curY = tail->y - 14.0f;
// Level tag e.g. "[Lv. 99]" in lime green
if (!tail->level.empty()) {
RenderText(renderer, curX, curY, tail->level, tail->levelColor, 1.0f, true);
curX += levelW + 6.0f;
curX += levelW + 4.0f;
}
// Title e.g. "Noble" in gold
if (!tail->title.empty()) {
RenderText(renderer, curX, curY, tail->title, tail->titleColor, 1.0f, true);
curX += titleW + 6.0f;
curX += titleW + 4.0f;
}
// Character Name in tail->color (white / red / yellow / etc.)
@@ -619,7 +624,7 @@ void TextTailManager::Render(SDL_Renderer* renderer, const Gr2SceneRenderer* sce
// Guild Name e.g. "[GuildName]" in light cyan above character name, with Guild Mark
if (!tail->guildName.empty()) {
std::string gStr = "[" + tail->guildName + "]";
float gW = static_cast<float>(gStr.size()) * 8.0f * 0.9f;
float gW = TextWidth(gStr, 0.9f);
float totalW = gW;
bool hasMark = false;
float u0 = 0.0f, v0 = 0.0f, u1 = 0.0f, v1 = 0.0f;