2V3-b: click on the ground to walk; read the terrain attribute map
CScreen::SetCursorPosition and CPythonGraphic::SetCursorPosition are the 40250 bodies, so RenderGame builds the pick ray under the cursor each frame. CPythonBackground::GetPickingPoint* march that ray as CMapOutdoor::__PickTerrainHeight does, against the native CMapManager height (PR_FLOAT_TO_INT's x87 rounding becomes floor); object picking waits for CMapOutdoor. CMapManager::isAttrOn reads the packed <map>/<xxxyyy>/attr.atr as CMapOutdoor::isAttrOn + CTerrain::isAttrOn do, and CheckAdvancing with its collision checkers is verbatim (no map objects are registered yet). All of this stays in the pending/platform layer and is marked ADAPTED. port.login_flow clicks the ground below the actor after the key walk. The actor walks to the picked point (334 cm offline), and the fake server sees FUNC_MOVE, then FUNC_WAIT. It also checks that the actor's cell is free and that its terrain block has blocked cells. port.login_live against the real server passed (key 133 cm, click 296 cm), and python_game_render_test.sh passes offline. MT_TEST_MODE=python_ui now adds the 3D surface, so the port route can be played by hand. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ff0983d3c8
commit
8b4700f008
@@ -244,9 +244,35 @@ auto CScreen::SetClearStencil(DWORD) -> void
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CScreen::SetCursorPosition(int, int, int, int) -> void
|
||||
// 40250 GrpScreen.cpp:487, verbatim: the pick ray through the cursor.
|
||||
void CScreen::SetCursorPosition(int x, int y, int hres, int vres)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
D3DXVECTOR3 v;
|
||||
v.x = -(((2.0f * x) / hres) - 1) / ms_matProj._11;
|
||||
v.y = (((2.0f * y) / vres) - 1) / ms_matProj._22;
|
||||
v.z = 1.0f;
|
||||
|
||||
D3DXMATRIX matViewInverse=ms_matInverseView;
|
||||
//D3DXMatrixInverse(&matViewInverse, NULL, &ms_matView);
|
||||
|
||||
ms_vtPickRayDir.x = v.x * matViewInverse._11 +
|
||||
v.y * matViewInverse._21 +
|
||||
v.z * matViewInverse._31;
|
||||
|
||||
ms_vtPickRayDir.y = v.x * matViewInverse._12 +
|
||||
v.y * matViewInverse._22 +
|
||||
v.z * matViewInverse._32;
|
||||
|
||||
ms_vtPickRayDir.z = v.x * matViewInverse._13 +
|
||||
v.y * matViewInverse._23 +
|
||||
v.z * matViewInverse._33;
|
||||
|
||||
ms_vtPickRayOrig.x = matViewInverse._41;
|
||||
ms_vtPickRayOrig.y = matViewInverse._42;
|
||||
ms_vtPickRayOrig.z = matViewInverse._43;
|
||||
|
||||
ms_Ray.SetStartPoint(ms_vtPickRayOrig);
|
||||
ms_Ray.SetDirection(-ms_vtPickRayDir, 51200.0f);
|
||||
}
|
||||
|
||||
auto CScreen::GetCursorPosition(float *, float *, float *) -> bool
|
||||
|
||||
Reference in New Issue
Block a user