port: PythonItem + item module (batch 2 P3-b)

Verbatim 40250 CPythonItem and the item Python module replace the
pending stand-in and the module stub; CPythonApplication::Create calls
m_pyItem.Create() in 40250 order. itemGetIconImage returns its handle
through Py_BuildPointer (the ILP32 int truncated it and wndMgr.SetSlot
crashed on the live inventory). CMapManager::GetNormal evaluates
CTerrain::CalculateNormal on the native height tile; the item text-tail
members stay stubs, Pick answering -1 like an empty tail map.

The fake server drops vnum 19 next to the actor at entergame and answers
CG_ITEM_PICKUP with GC_ITEM_GROUND_DEL; login_flow picks it up through
player.PickCloseItem and checks item.SelectItem(19).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-24 00:50:16 +09:00
co-authored by Claude Opus 5.5
parent f0564a7f12
commit 9298500df9
19 changed files with 2178 additions and 454 deletions
@@ -1,103 +0,0 @@
// Stand-in for the 40250 logic unit UserInterface/PythonItem.cpp, not ported yet: the members the ported units
// reference, as platform_stub.py stubs. Delete this file in the commit that ports the unit into port/
// (docs/PORT-PLAN.md).
#include "UserInterface/StdAfx.h"
#include "UserInterface/PythonItem.h"
#include "../../PlatformStub.h"
CPythonItem::CPythonItem()
{
MT_PLATFORM_STUB();
}
CPythonItem::~CPythonItem()
{
MT_PLATFORM_STUB();
}
auto CPythonItem::Destroy() -> void
{
MT_PLATFORM_STUB();
}
auto CPythonItem::PlayUseSound(DWORD) -> void
{
MT_PLATFORM_STUB();
}
auto CPythonItem::PlayDropSound(DWORD) -> void
{
MT_PLATFORM_STUB();
}
auto CPythonItem::PlayUsePotionSound() -> void
{
MT_PLATFORM_STUB();
}
auto CPythonItem::CreateItem(DWORD, DWORD, float, float, float, bool) -> void
{
MT_PLATFORM_STUB();
}
auto CPythonItem::DeleteItem(DWORD) -> void
{
MT_PLATFORM_STUB();
}
auto CPythonItem::DeleteAllItems() -> void
{
MT_PLATFORM_STUB();
}
auto CPythonItem::SetOwnership(DWORD, const char *) -> void
{
MT_PLATFORM_STUB();
}
auto CPythonItem::Render() -> void
{
MT_PLATFORM_STUB();
}
auto CPythonItem::Update(const POINT &) -> void
{
MT_PLATFORM_STUB();
}
auto CPythonItem::GetOwnership(DWORD, const char **) -> bool
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<bool>();
}
auto CPythonItem::GetGroundItemPosition(DWORD, TPixelPosition *) -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonItem::GetPickedItemID(DWORD *) -> bool
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<bool>();
}
auto CPythonItem::GetCloseItem(const TPixelPosition &, DWORD *, DWORD) -> bool
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<bool>();
}
auto CPythonItem::GetCloseMoney(const TPixelPosition &, DWORD *, DWORD) -> bool
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<bool>();
}
auto CPythonItem::GetVirtualNumberOfGroundItem(DWORD) -> DWORD
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<DWORD>();
}
@@ -50,3 +50,26 @@ auto CPythonTextTail::AttachLevel(DWORD, const char *, const D3DXCOLOR &) -> voi
{
MT_PLATFORM_STUB();
}
auto CPythonTextTail::RegisterItemTextTail(DWORD, const char *, CGraphicObjectInstance *) -> void
{
MT_PLATFORM_STUB();
}
auto CPythonTextTail::DeleteItemTextTail(DWORD) -> void
{
MT_PLATFORM_STUB();
}
auto CPythonTextTail::SetItemTextTailOwner(DWORD, const char *) -> void
{
MT_PLATFORM_STUB();
}
// 40250 returns -1 when no item text tail is under the mouse; RegisterItemTextTail is still a stub, so
// m_ItemTextTailMap stays empty and that is always the answer (0 would pick ground item VID 0).
auto CPythonTextTail::Pick(int, int) -> int
{
MT_PLATFORM_STUB();
return -1;
}