port: CMapOutdoor + PythonBackground + minimap (1:1 40250)

GameLib map/area/terrain units, PRTerrainLib Terrain/TextureSet,
PythonBackground(+Module) and ColorTransitionHelper ported verbatim;
pending stand-ins and background module stubs removed. Hand edits:
BeginEnvironment's pointer tag via uintptr_t, LoadWaterMap reads the
file's 32-bit longs. Terrain draw passes stay platform no-ops (Godot
draws the terrain). RecordingDevice gains textures, buffers and render
targets; orthographic draws become UI commands so CPythonMiniMap's
masked tiles show through minimap_image_filter in python_ui_surface.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-24 03:50:09 +09:00
co-authored by Claude Opus 5.5
parent b69116992c
commit 2ead95756e
100 changed files with 17679 additions and 1514 deletions
@@ -0,0 +1,79 @@
// Platform implementation of 40250 GameLib/MapOutdoorCharacterShadow.cpp. The render-target lifecycle is
// the 40250 code as is; the shadow-map pass is not run (BeginRenderCharacterShadowToTexture reports it
// cannot render) because the terrain that samples the map is drawn by Godot, which casts its own
// character shadows (PORT-PLAN §3).
#include "GameLib/StdAfx.h"
#include "EterLib/StateManager.h"
#include "EterLib/Camera.h"
#include "GameLib/MapOutdoor.h"
static int recreate = false;
void CMapOutdoor::SetShadowTextureSize(WORD size)
{
if (m_wShadowMapSize != size)
{
recreate = true;
Tracenf("ShadowTextureSize changed %d -> %d", m_wShadowMapSize, size);
}
m_wShadowMapSize = size;
}
void CMapOutdoor::CreateCharacterShadowTexture()
{
extern bool GRAPHICS_CAPS_CAN_NOT_DRAW_SHADOW;
if (GRAPHICS_CAPS_CAN_NOT_DRAW_SHADOW)
return;
ReleaseCharacterShadowTexture();
if (IsLowTextureMemory())
SetShadowTextureSize(128);
m_ShadowMapViewport.X = 1;
m_ShadowMapViewport.Y = 1;
m_ShadowMapViewport.Width = m_wShadowMapSize - 2;
m_ShadowMapViewport.Height = m_wShadowMapSize - 2;
m_ShadowMapViewport.MinZ = 0.0f;
m_ShadowMapViewport.MaxZ = 1.0f;
if (FAILED(ms_lpd3dDevice->CreateTexture(m_wShadowMapSize, m_wShadowMapSize, 1, D3DUSAGE_RENDERTARGET, D3DFMT_R5G6B5, D3DPOOL_DEFAULT, &m_lpCharacterShadowMapTexture)))
{
TraceError("CMapOutdoor Unable to create Character Shadow render target texture\n");
return;
}
if (FAILED(m_lpCharacterShadowMapTexture->GetSurfaceLevel(0, &m_lpCharacterShadowMapRenderTargetSurface)))
{
TraceError("CMapOutdoor Unable to GetSurfaceLevel Character Shadow render target texture\n");
return;
}
if (FAILED(ms_lpd3dDevice->CreateDepthStencilSurface(m_wShadowMapSize, m_wShadowMapSize, D3DFMT_D16, D3DMULTISAMPLE_NONE, &m_lpCharacterShadowMapDepthSurface)))
{
TraceError("CMapOutdoor Unable to create Character Shadow depth Surface\n");
return;
}
}
void CMapOutdoor::ReleaseCharacterShadowTexture()
{
SAFE_RELEASE(m_lpCharacterShadowMapRenderTargetSurface);
SAFE_RELEASE(m_lpCharacterShadowMapDepthSurface);
SAFE_RELEASE(m_lpCharacterShadowMapTexture);
}
// PORT: no shadow-map pass (see the file comment); CPythonBackground::RenderCharacterShadowToTexture
// then skips the shadow instances.
bool CMapOutdoor::BeginRenderCharacterShadowToTexture()
{
return false;
}
// PORT: nothing to restore when the pass did not begin.
void CMapOutdoor::EndRenderCharacterShadowToTexture()
{
}