port: P3-d PythonTextTail + textTail module (1:1 40250)
Copy PythonTextTail.cpp/PythonTextTailModule.cpp verbatim, drop the pending stand-in and the textTail module stub, register initTextTail() after initChat() and call CPythonTextTail::Initialize() in Create as 40250 does. Implement CScreen::ProjectPosition/UnprojectPosition (were stubs) with D3DXVec3Project/Unproject, and ApplicationStringTable_GetString(DWORD) over UserInterface.rc's English string table. port.login_flow projects the ground item's name tail in an ALT frame and picks it back by screen position. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
72b19b677d
commit
070a27b2cb
@@ -101,6 +101,45 @@ D3DXVECTOR3* D3DXVec3TransformCoord(D3DXVECTOR3* pOut, const D3DXVECTOR3* pV, co
|
||||
return pOut;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
// World * View * Projection, skipping the null ones.
|
||||
D3DXMATRIX world_view_projection(const D3DXMATRIX* pProjection, const D3DXMATRIX* pView, const D3DXMATRIX* pWorld)
|
||||
{
|
||||
D3DXMATRIX m;
|
||||
D3DXMatrixIdentity(&m);
|
||||
for (const D3DXMATRIX* p : {pWorld, pView, pProjection})
|
||||
if (p)
|
||||
D3DXMatrixMultiply(&m, &m, p);
|
||||
return m;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
D3DXVECTOR3* D3DXVec3Project(D3DXVECTOR3* pOut, const D3DXVECTOR3* pV, const D3DVIEWPORT8* pViewport,
|
||||
const D3DXMATRIX* pProjection, const D3DXMATRIX* pView, const D3DXMATRIX* pWorld)
|
||||
{
|
||||
const D3DXMATRIX m = world_view_projection(pProjection, pView, pWorld);
|
||||
D3DXVECTOR3 v;
|
||||
D3DXVec3TransformCoord(&v, pV, &m);
|
||||
pOut->x = pViewport->X + (1.0f + v.x) * pViewport->Width / 2.0f;
|
||||
pOut->y = pViewport->Y + (1.0f - v.y) * pViewport->Height / 2.0f;
|
||||
pOut->z = pViewport->MinZ + v.z * (pViewport->MaxZ - pViewport->MinZ);
|
||||
return pOut;
|
||||
}
|
||||
|
||||
D3DXVECTOR3* D3DXVec3Unproject(D3DXVECTOR3* pOut, const D3DXVECTOR3* pV, const D3DVIEWPORT8* pViewport,
|
||||
const D3DXMATRIX* pProjection, const D3DXMATRIX* pView, const D3DXMATRIX* pWorld)
|
||||
{
|
||||
D3DXMATRIX m = world_view_projection(pProjection, pView, pWorld);
|
||||
D3DXMatrixInverse(&m, nullptr, &m);
|
||||
D3DXVECTOR3 v;
|
||||
v.x = 2.0f * (pV->x - pViewport->X) / pViewport->Width - 1.0f;
|
||||
v.y = 1.0f - 2.0f * (pV->y - pViewport->Y) / pViewport->Height;
|
||||
v.z = (pV->z - pViewport->MinZ) / (pViewport->MaxZ - pViewport->MinZ);
|
||||
D3DXVec3TransformCoord(pOut, &v, &m);
|
||||
return pOut;
|
||||
}
|
||||
|
||||
D3DXVECTOR3* D3DXVec3TransformNormal(D3DXVECTOR3* pOut, const D3DXVECTOR3* pV, const D3DXMATRIX* pM)
|
||||
{
|
||||
D3DXVECTOR3 out;
|
||||
|
||||
@@ -337,6 +337,11 @@ D3DXVECTOR4* D3DXVec3Transform(D3DXVECTOR4* pOut, const D3DXVECTOR3* pV, const D
|
||||
D3DXVECTOR3* D3DXVec3TransformCoord(D3DXVECTOR3* pOut, const D3DXVECTOR3* pV, const D3DXMATRIX* pM);
|
||||
D3DXVECTOR3* D3DXVec3TransformNormal(D3DXVECTOR3* pOut, const D3DXVECTOR3* pV, const D3DXMATRIX* pM);
|
||||
D3DXVECTOR4* D3DXVec4Transform(D3DXVECTOR4* pOut, const D3DXVECTOR4* pV, const D3DXMATRIX* pM);
|
||||
// D3DX semantics: object space → viewport pixels (x, y) and depth in [MinZ, MaxZ], and back; a null matrix is identity.
|
||||
D3DXVECTOR3* D3DXVec3Project(D3DXVECTOR3* pOut, const D3DXVECTOR3* pV, const D3DVIEWPORT8* pViewport,
|
||||
const D3DXMATRIX* pProjection, const D3DXMATRIX* pView, const D3DXMATRIX* pWorld);
|
||||
D3DXVECTOR3* D3DXVec3Unproject(D3DXVECTOR3* pOut, const D3DXVECTOR3* pV, const D3DVIEWPORT8* pViewport,
|
||||
const D3DXMATRIX* pProjection, const D3DXMATRIX* pView, const D3DXMATRIX* pWorld);
|
||||
|
||||
// --- D3DXMATRIX ---
|
||||
inline D3DXMATRIX* D3DXMatrixIdentity(D3DXMATRIX* pOut)
|
||||
|
||||
Reference in New Issue
Block a user