2V2-e.5b: feed native map height and light into game render

This commit is contained in:
shenlei
2026-09-23 22:10:29 +09:00
parent 702fef7b47
commit 5a1df57e69
13 changed files with 678 additions and 76 deletions
@@ -3,27 +3,31 @@
// (docs/PORT-PLAN.md).
#include "UserInterface/StdAfx.h"
#include "UserInterface/PythonBackground.h"
#include "EterLib/StateManager.h"
#include "../../PlatformStub.h"
auto CPythonBackground::Destroy() -> void
{
MT_PLATFORM_STUB();
CMapManager::Destroy();
m_bVisibleGuildArea = FALSE;
}
auto CPythonBackground::Create() -> void
{
MT_PLATFORM_STUB();
CMapManager::Create();
}
auto CPythonBackground::GlobalPositionToLocalPosition(LONG &, LONG &) -> void
auto CPythonBackground::GlobalPositionToLocalPosition(LONG &x, LONG &y) -> void
{
MT_PLATFORM_STUB();
x -= m_dwBaseX;
y -= m_dwBaseY;
}
auto CPythonBackground::LocalPositionToGlobalPosition(LONG &, LONG &) -> void
auto CPythonBackground::LocalPositionToGlobalPosition(LONG &x, LONG &y) -> void
{
MT_PLATFORM_STUB();
x += m_dwBaseX;
y += m_dwBaseY;
}
auto CPythonBackground::RefreshShadowLevel() -> void
@@ -61,24 +65,41 @@ auto CPythonBackground::DeleteTargetEffect(DWORD) -> void
MT_PLATFORM_STUB();
}
auto CPythonBackground::Warp(DWORD, DWORD) -> void
auto CPythonBackground::Warp(DWORD x, DWORD y) -> void
{
MT_PLATFORM_STUB();
if (m_kVct_kMapInfo.empty())
Initialize();
auto found = std::find_if(m_kVct_kMapInfo.begin(), m_kVct_kMapInfo.end(),
[x, y](const TMapInfo &info) {
return x >= info.m_dwBaseX && x < info.m_dwEndX &&
y >= info.m_dwBaseY && y < info.m_dwEndY;
});
if (found == m_kVct_kMapInfo.end()) {
TraceError("NOT_FOUND_GLOBAL_POSITION(%u, %u)", x, y);
return;
}
if (!LoadMap(found->m_strName, float(x - found->m_dwBaseX),
float(y - found->m_dwBaseY), 0.0f)) {
TraceError("CPythonBackground::Warp map load failed: %s", found->m_strName.c_str());
return;
}
m_dwBaseX = found->m_dwBaseX;
m_dwBaseY = found->m_dwBaseY;
m_strMapName = found->m_strName;
}
auto CPythonBackground::GetWarpMapName() -> const char *
{
MT_PLATFORM_STUB();
// PORT: Keep the not-yet-ported map lookup safe for GamePhase's ShowMapName call.
return "";
return m_strMapName.c_str();
}
CPythonBackground::CPythonBackground()
{
MT_PLATFORM_STUB();
// PORT: the one member the stand-in's ported GetFarClip reads (PythonBackground.cpp:210); the
// view distance sets and Initialize() come with the unit.
m_eViewDistanceNum=0;
m_dwBaseX=0;
m_dwBaseY=0;
m_bVisibleGuildArea=FALSE;
m_iXMasTreeGrade=0;
}
CPythonBackground::~CPythonBackground()
@@ -166,10 +187,22 @@ auto CPythonBackground::RenderWater() -> void
auto CPythonBackground::SetBackgroundDirLight() -> void
{
MT_PLATFORM_STUB();
if (!IsMapReady() || !mc_pcurEnvironmentData)
return;
STATEMANAGER.SetLight(0, &mc_pcurEnvironmentData->DirLights[ENV_DIRLIGHT_BACKGROUND]);
}
auto CPythonBackground::SetCharacterDirLight() -> void
{
MT_PLATFORM_STUB();
if (!IsMapReady() || !mc_pcurEnvironmentData)
return;
STATEMANAGER.SetLight(0, &mc_pcurEnvironmentData->DirLights[ENV_DIRLIGHT_CHARACTER]);
}
void CPythonBackground::Initialize()
{
std::string atlas(LocaleService_GetLocalePath());
atlas += "/AtlasInfo.txt";
SetAtlasInfoFileName(atlas.c_str());
CMapManager::Initialize();
}