port: P3-e PythonMiniMap + miniMap module (1:1 40250)

Copy PythonMiniMap.cpp/PythonMiniMapModule.cpp and PRTerrainLib/StdAfx.cpp
verbatim, drop the pending stand-in and the miniMap module stub, register
initMiniMap() after initnet(). PR_FLOAT_TO_INTASM uses lrintf off MSVC;
D3DXColorModulate added. CMapOutdoor is not ported, so the pending
CMapManager::IsMapOutdoor() returns false (DIVERGENT) and the minimap's terrain
and atlas paths stay on 40250's no-outdoor-map branch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-24 01:18:57 +09:00
co-authored by Claude Opus 5.5
parent 070a27b2cb
commit 7358bf444a
18 changed files with 2429 additions and 158 deletions
@@ -104,21 +104,6 @@ void AddStubConstants_messenger(PyObject* poModule)
(void) poModule;
}
// 40250 UserInterface/PythonMiniMapModule.cpp
void AddStubConstants_miniMap(PyObject* poModule)
{
(void) poModule;
PyModule_AddIntConstant(poModule, "TYPE_OPC", CPythonMiniMap::TYPE_OPC);
PyModule_AddIntConstant(poModule, "TYPE_OPCPVP", CPythonMiniMap::TYPE_OPCPVP);
PyModule_AddIntConstant(poModule, "TYPE_OPCPVPSELF", CPythonMiniMap::TYPE_OPCPVPSELF);
PyModule_AddIntConstant(poModule, "TYPE_NPC", CPythonMiniMap::TYPE_NPC);
PyModule_AddIntConstant(poModule, "TYPE_MONSTER", CPythonMiniMap::TYPE_MONSTER);
PyModule_AddIntConstant(poModule, "TYPE_WARP", CPythonMiniMap::TYPE_WARP);
PyModule_AddIntConstant(poModule, "TYPE_WAYPOINT", CPythonMiniMap::TYPE_WAYPOINT);
PyModule_AddIntConstant(poModule, "TYPE_PARTY", CPythonMiniMap::TYPE_PARTY);
PyModule_AddIntConstant(poModule, "TYPE_EMPIRE", CPythonMiniMap::TYPE_EMPIRE);
}
// 40250 UserInterface/PythonProfilerModule.cpp
void AddStubConstants_profiler(PyObject* poModule)
{
@@ -11,7 +11,6 @@ void AddStubConstants_eventMgr(PyObject* poModule);
void AddStubConstants_guild(PyObject* poModule);
void AddStubConstants_ime(PyObject* poModule);
void AddStubConstants_messenger(PyObject* poModule);
void AddStubConstants_miniMap(PyObject* poModule);
void AddStubConstants_profiler(PyObject* poModule);
void AddStubConstants_quest(PyObject* poModule);
void AddStubConstants_safebox(PyObject* poModule);
@@ -341,64 +340,6 @@ PyMethodDef methods_messenger[] = {
{ "SetMessengerHandler", stub_messenger_SetMessengerHandler, METH_VARARGS },
{ NULL, NULL }
};
// 40250 UserInterface/PythonMiniMapModule.cpp: miniMap export names.
PyObject* stub_miniMap_SetScale(PyObject*, PyObject*) { return stub_call_named("miniMap.SetScale", Py_BuildNone()); }
PyObject* stub_miniMap_ScaleUp(PyObject*, PyObject*) { return stub_call_named("miniMap.ScaleUp", Py_BuildNone()); }
PyObject* stub_miniMap_ScaleDown(PyObject*, PyObject*) { return stub_call_named("miniMap.ScaleDown", Py_BuildNone()); }
PyObject* stub_miniMap_SetMiniMapSize(PyObject*, PyObject*) { return stub_call_named("miniMap.SetMiniMapSize", Py_BuildNone()); }
PyObject* stub_miniMap_SetCenterPosition(PyObject*, PyObject*) { return stub_call_named("miniMap.SetCenterPosition", Py_BuildNone()); }
PyObject* stub_miniMap_Destroy(PyObject*, PyObject*) { return stub_call_named("miniMap.Destroy", Py_BuildNone()); }
PyObject* stub_miniMap_Create(PyObject*, PyObject*) { return stub_call_named("miniMap.Create", Py_BuildNone()); }
PyObject* stub_miniMap_Update(PyObject*, PyObject*) { return stub_call_named("miniMap.Update", Py_BuildNone()); }
PyObject* stub_miniMap_Render(PyObject*, PyObject*) { return stub_call_named("miniMap.Render", Py_BuildNone()); }
PyObject* stub_miniMap_Show(PyObject*, PyObject*) { return stub_call_named("miniMap.Show", Py_BuildNone()); }
PyObject* stub_miniMap_Hide(PyObject*, PyObject*) { return stub_call_named("miniMap.Hide", Py_BuildNone()); }
PyObject* stub_miniMap_isShow(PyObject*, PyObject*) { return stub_call_named("miniMap.isShow", Py_BuildValue("b", 0)); }
PyObject* stub_miniMap_GetInfo(PyObject*, PyObject*) { return stub_call_named("miniMap.GetInfo", Py_BuildValue("isiil", 0, "", 0, 0, 0L)); }
PyObject* stub_miniMap_LoadAtlas(PyObject*, PyObject*) { return stub_call_named("miniMap.LoadAtlas", Py_BuildNone()); }
PyObject* stub_miniMap_UpdateAtlas(PyObject*, PyObject*) { return stub_call_named("miniMap.UpdateAtlas", Py_BuildNone()); }
PyObject* stub_miniMap_RenderAtlas(PyObject*, PyObject*) { return stub_call_named("miniMap.RenderAtlas", Py_BuildNone()); }
PyObject* stub_miniMap_ShowAtlas(PyObject*, PyObject*) { return stub_call_named("miniMap.ShowAtlas", Py_BuildNone()); }
PyObject* stub_miniMap_HideAtlas(PyObject*, PyObject*) { return stub_call_named("miniMap.HideAtlas", Py_BuildNone()); }
PyObject* stub_miniMap_isShowAtlas(PyObject*, PyObject*) { return stub_call_named("miniMap.isShowAtlas", Py_BuildValue("b", 0)); }
PyObject* stub_miniMap_IsAtlas(PyObject*, PyObject*) { return stub_call_named("miniMap.IsAtlas", Py_BuildValue("b", 0)); }
PyObject* stub_miniMap_GetAtlasInfo(PyObject*, PyObject*) { return stub_call_named("miniMap.GetAtlasInfo", Py_BuildValue("isiili", 0, "", 0, 0, 0L, 0)); }
PyObject* stub_miniMap_GetAtlasSize(PyObject*, PyObject*) { return stub_call_named("miniMap.GetAtlasSize", Py_BuildValue("bii", 0, 0, 0)); }
PyObject* stub_miniMap_AddWayPoint(PyObject*, PyObject*) { return stub_call_named("miniMap.AddWayPoint", Py_BuildNone()); }
PyObject* stub_miniMap_RemoveWayPoint(PyObject*, PyObject*) { return stub_call_named("miniMap.RemoveWayPoint", Py_BuildNone()); }
PyObject* stub_miniMap_RegisterAtlasWindow(PyObject*, PyObject*) { return stub_call_named("miniMap.RegisterAtlasWindow", Py_BuildNone()); }
PyObject* stub_miniMap_UnregisterAtlasWindow(PyObject*, PyObject*) { return stub_call_named("miniMap.UnregisterAtlasWindow", Py_BuildNone()); }
PyObject* stub_miniMap_GetGuildAreaID(PyObject*, PyObject*) { return stub_call_named("miniMap.GetGuildAreaID", Py_BuildValue("i", 0)); }
PyMethodDef methods_miniMap[] = {
{ "SetScale", stub_miniMap_SetScale, METH_VARARGS },
{ "ScaleUp", stub_miniMap_ScaleUp, METH_VARARGS },
{ "ScaleDown", stub_miniMap_ScaleDown, METH_VARARGS },
{ "SetMiniMapSize", stub_miniMap_SetMiniMapSize, METH_VARARGS },
{ "SetCenterPosition", stub_miniMap_SetCenterPosition, METH_VARARGS },
{ "Destroy", stub_miniMap_Destroy, METH_VARARGS },
{ "Create", stub_miniMap_Create, METH_VARARGS },
{ "Update", stub_miniMap_Update, METH_VARARGS },
{ "Render", stub_miniMap_Render, METH_VARARGS },
{ "Show", stub_miniMap_Show, METH_VARARGS },
{ "Hide", stub_miniMap_Hide, METH_VARARGS },
{ "isShow", stub_miniMap_isShow, METH_VARARGS },
{ "GetInfo", stub_miniMap_GetInfo, METH_VARARGS },
{ "LoadAtlas", stub_miniMap_LoadAtlas, METH_VARARGS },
{ "UpdateAtlas", stub_miniMap_UpdateAtlas, METH_VARARGS },
{ "RenderAtlas", stub_miniMap_RenderAtlas, METH_VARARGS },
{ "ShowAtlas", stub_miniMap_ShowAtlas, METH_VARARGS },
{ "HideAtlas", stub_miniMap_HideAtlas, METH_VARARGS },
{ "isShowAtlas", stub_miniMap_isShowAtlas, METH_VARARGS },
{ "IsAtlas", stub_miniMap_IsAtlas, METH_VARARGS },
{ "GetAtlasInfo", stub_miniMap_GetAtlasInfo, METH_VARARGS },
{ "GetAtlasSize", stub_miniMap_GetAtlasSize, METH_VARARGS },
{ "AddWayPoint", stub_miniMap_AddWayPoint, METH_VARARGS },
{ "RemoveWayPoint", stub_miniMap_RemoveWayPoint, METH_VARARGS },
{ "RegisterAtlasWindow", stub_miniMap_RegisterAtlasWindow, METH_VARARGS },
{ "UnregisterAtlasWindow", stub_miniMap_UnregisterAtlasWindow, METH_VARARGS },
{ "GetGuildAreaID", stub_miniMap_GetGuildAreaID, METH_VARARGS },
{ NULL, NULL }
};
// 40250 UserInterface/PythonProfilerModule.cpp: profiler export names.
PyObject* stub_profiler_Push(PyObject*, PyObject*) { return stub_call_named("profiler.Push", Py_BuildNone()); }
PyObject* stub_profiler_Pop(PyObject*, PyObject*) { return stub_call_named("profiler.Pop", Py_BuildNone()); }
@@ -731,11 +672,6 @@ void init_2v0_gameplay_stubs() {
PyModule_AddIntConstant(module, "__port_stub__", 1);
AddStubConstants_messenger(module);
}
{
PyObject* module = Py_InitModule("miniMap", methods_miniMap);
PyModule_AddIntConstant(module, "__port_stub__", 1);
AddStubConstants_miniMap(module);
}
{
PyObject* module = Py_InitModule("profiler", methods_profiler);
PyModule_AddIntConstant(module, "__port_stub__", 1);
@@ -353,6 +353,7 @@ bool run_main_script_body(const char* lpCmdLine, std::string* error)
initChat();
initTextTail();
initnet();
initMiniMap();
initeffect();
initfly();
initServerStateChecker();
@@ -343,3 +343,20 @@ bool CMapManager::IsMapReady()
auto found = s_native_maps.find(this);
return found != s_native_maps.end() && found->second.ready;
}
// 40250 MapManager.cpp: true when the current map is a CMapOutdoor. PORT: CMapOutdoor is not ported (the Godot
// terrain adapter draws the map), so there is no outdoor map object to hand out; false keeps the 40250 callers
// (CPythonMiniMap::Update/Render/LoadAtlas) on their "no outdoor map" path instead of reaching into one.
auto CMapManager::IsMapOutdoor() -> bool
{
MT_PLATFORM_STUB();
return false;
}
auto CMapManager::GetMapOutdoorRef() -> CMapOutdoor &
{
MT_PLATFORM_STUB();
// Never constructed (CMapOutdoor's constructor is not ported either); unreachable while IsMapOutdoor() is false.
alignas(CMapOutdoor) static unsigned char storage[sizeof(CMapOutdoor)];
return *reinterpret_cast<CMapOutdoor *>(storage);
}
@@ -0,0 +1,18 @@
// Stand-in for the 40250 logic unit GameLib/MapOutdoor.cpp, not ported yet: the members the ported units
// reference, as platform_stub.py stubs. Only reached behind CMapManager::IsMapOutdoor(), which is false until
// CMapOutdoor is ported. Delete this file in the commit that ports the unit into port/ (docs/PORT-PLAN.md).
#include "GameLib/StdAfx.h"
#include "GameLib/MapOutdoor.h"
#include "../../PlatformStub.h"
auto CMapOutdoor::GetTerrainPointer(BYTE, CTerrain **) -> BOOL
{
MT_PLATFORM_STUB();
return FALSE;
}
auto CMapOutdoor::GetBaseXY(DWORD *, DWORD *) -> void
{
MT_PLATFORM_STUB();
}
@@ -1,78 +0,0 @@
// Stand-in for the 40250 logic unit UserInterface/PythonMiniMap.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/PythonMiniMap.h"
#include "../../PlatformStub.h"
CPythonMiniMap::CPythonMiniMap()
{
MT_PLATFORM_STUB();
}
CPythonMiniMap::~CPythonMiniMap()
{
MT_PLATFORM_STUB();
}
auto CPythonMiniMap::AddObserver(DWORD, float, float) -> void
{
MT_PLATFORM_STUB();
}
auto CPythonMiniMap::MoveObserver(DWORD, float, float) -> void
{
MT_PLATFORM_STUB();
}
auto CPythonMiniMap::RemoveObserver(DWORD) -> void
{
MT_PLATFORM_STUB();
}
auto CPythonMiniMap::ClearAtlasMarkInfo() -> void
{
MT_PLATFORM_STUB();
}
auto CPythonMiniMap::RegisterAtlasMark(BYTE, const char *, long, long) -> void
{
MT_PLATFORM_STUB();
}
auto CPythonMiniMap::ClearGuildArea() -> void
{
MT_PLATFORM_STUB();
}
auto CPythonMiniMap::RegisterGuildArea(DWORD, DWORD, long, long, long, long) -> void
{
MT_PLATFORM_STUB();
}
auto CPythonMiniMap::CreateTarget(int, const char *) -> void
{
MT_PLATFORM_STUB();
}
auto CPythonMiniMap::CreateTarget(int, const char *, DWORD) -> void
{
MT_PLATFORM_STUB();
}
auto CPythonMiniMap::UpdateTarget(int, int, int) -> void
{
MT_PLATFORM_STUB();
}
auto CPythonMiniMap::DeleteTarget(int) -> void
{
MT_PLATFORM_STUB();
}
auto CPythonMiniMap::GetGuildAreaID(DWORD, DWORD) -> DWORD
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<DWORD>();
}
@@ -0,0 +1,10 @@
// stdafx.cpp : source file that includes just the standard includes
// PRTerrainLib.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "StdAfx.h"
/* Fast Float<->Integer conversion */
float PR_FCNV;
long PR_ICNV;
@@ -65,11 +65,17 @@ typedef struct
/* Converts a floating point number to an integer by truncation, using
the FISTP instruction */
#ifdef _MSC_VER
#define PR_FLOAT_TO_INTASM __asm \
{ \
__asm fld PR_FCNV \
__asm fistp PR_ICNV \
}
#else
// PORT: x87 fld/fistp stores PR_FCNV rounded in the current (default round-to-nearest-even) mode; lrintf is
// that conversion without inline x86 assembly.
#define PR_FLOAT_TO_INTASM (PR_ICNV = lrintf(PR_FCNV))
#endif
#define PR_FLOAT_TO_FIXED(inreal, outint) \
{ \
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,357 @@
#include "StdAfx.h"
#include "PythonMiniMap.h"
PyObject * miniMapSetScale(PyObject * poSelf, PyObject * poArgs)
{
float fScale;
if (!PyTuple_GetFloat(poArgs, 0, &fScale))
return Py_BuildException();
CPythonMiniMap::Instance().SetScale(fScale);
return Py_BuildNone();
}
PyObject * miniMapSetCenterPosition(PyObject * poSelf, PyObject * poArgs)
{
float fCenterX;
if (!PyTuple_GetFloat(poArgs, 0, &fCenterX))
return Py_BuildException();
float fCenterY;
if (!PyTuple_GetFloat(poArgs, 1, &fCenterY))
return Py_BuildException();
CPythonMiniMap::Instance().SetCenterPosition(fCenterX, fCenterY);
return Py_BuildNone();
}
PyObject * miniMapSetMiniMapSize(PyObject * poSelf, PyObject * poArgs)
{
float fWidth;
if (!PyTuple_GetFloat(poArgs, 0, &fWidth))
return Py_BuildException();
float fHeight;
if (!PyTuple_GetFloat(poArgs, 1, &fHeight))
return Py_BuildException();
CPythonMiniMap::Instance().SetMiniMapSize(fWidth, fHeight);
return Py_BuildNone();
}
PyObject * miniMapDestroy(PyObject * poSelf, PyObject * poArgs)
{
CPythonMiniMap::Instance().Destroy();
return Py_BuildNone();
}
PyObject * miniMapCreate(PyObject * poSelf, PyObject * poArgs)
{
CPythonMiniMap::Instance().Create();
return Py_BuildNone();
}
PyObject * miniMapUpdate(PyObject * poSelf, PyObject * poArgs)
{
float fCenterX;
if (!PyTuple_GetFloat(poArgs, 0, &fCenterX))
return Py_BuildException();
float fCenterY;
if (!PyTuple_GetFloat(poArgs, 1, &fCenterY))
return Py_BuildException();
CPythonMiniMap::Instance().Update(fCenterX, fCenterY);
return Py_BuildNone();
}
PyObject * miniMapRender(PyObject * poSelf, PyObject * poArgs)
{
float fScrrenX;
if (!PyTuple_GetFloat(poArgs, 0, &fScrrenX))
return Py_BuildException();
float fScrrenY;
if (!PyTuple_GetFloat(poArgs, 1, &fScrrenY))
return Py_BuildException();
CPythonMiniMap::Instance().Render(fScrrenX, fScrrenY);
return Py_BuildNone();
}
PyObject * miniMapShow(PyObject * poSelf, PyObject * poArgs)
{
CPythonMiniMap::Instance().Show();
return Py_BuildNone();
}
PyObject * miniMapHide(PyObject * poSelf, PyObject * poArgs)
{
CPythonMiniMap::Instance().Hide();
return Py_BuildNone();
}
PyObject * miniMapisShow(PyObject * poSelf, PyObject * poArgs)
{
bool bShow = CPythonMiniMap::Instance().CanShow();
return Py_BuildValue("b", bShow);
}
PyObject * miniMapScaleUp(PyObject * poSelf, PyObject * poArgs)
{
CPythonMiniMap::Instance().ScaleUp();
return Py_BuildNone();
}
PyObject * miniMapScaleDown(PyObject * poSelf, PyObject * poArgs)
{
CPythonMiniMap::Instance().ScaleDown();
return Py_BuildNone();
}
PyObject * miniMapGetInfo(PyObject * poSelf, PyObject * poArgs)
{
float fScrrenX;
if (!PyTuple_GetFloat(poArgs, 0, &fScrrenX))
return Py_BuildException();
float fScrrenY;
if (!PyTuple_GetFloat(poArgs, 1, &fScrrenY))
return Py_BuildException();
std::string aString;
float fPosX, fPosY;
DWORD dwTextColor;
bool bFind = CPythonMiniMap::Instance().GetPickedInstanceInfo(fScrrenX, fScrrenY, aString, &fPosX, &fPosY, &dwTextColor);
int iPosX, iPosY;
PR_FLOAT_TO_INT(fPosX, iPosX);
PR_FLOAT_TO_INT(fPosY, iPosY);
iPosX /= 100;
iPosY /= 100;
return Py_BuildValue("isiil", (int)bFind, aString.c_str(), iPosX, iPosY, (signed) dwTextColor);
}
//////////////////////////////////////////////////////////////////////////
// Atlas
PyObject * miniMapLoadAtlas(PyObject * poSelf, PyObject * poArgs)
{
if (!CPythonMiniMap::Instance().LoadAtlas())
TraceError("CPythonMiniMap::Instance().LoadAtlas() Failed");
return Py_BuildNone();
}
PyObject * miniMapUpdateAtlas(PyObject * poSelf, PyObject * poArgs)
{
CPythonMiniMap::Instance().UpdateAtlas();
return Py_BuildNone();
}
PyObject * miniMapRenderAtlas(PyObject * poSelf, PyObject * poArgs)
{
float fScrrenX;
if (!PyTuple_GetFloat(poArgs, 0, &fScrrenX))
return Py_BuildException();
float fScrrenY;
if (!PyTuple_GetFloat(poArgs, 1, &fScrrenY))
return Py_BuildException();
CPythonMiniMap::Instance().RenderAtlas(fScrrenX, fScrrenY);
return Py_BuildNone();
}
PyObject * miniMapShowAtlas(PyObject * poSelf, PyObject * poArgs)
{
CPythonMiniMap::Instance().ShowAtlas();
return Py_BuildNone();
}
PyObject * miniMapHideAtlas(PyObject * poSelf, PyObject * poArgs)
{
CPythonMiniMap::Instance().HideAtlas();
return Py_BuildNone();
}
PyObject * miniMapisShowAtlas(PyObject * poSelf, PyObject * poArgs)
{
bool bShow = CPythonMiniMap::Instance().CanShowAtlas();
return Py_BuildValue("b", bShow);
}
PyObject * miniMapIsAtlas(PyObject * poSelf, PyObject * poArgs)
{
bool isData = CPythonMiniMap::Instance().IsAtlas();
return Py_BuildValue("b", isData);
}
PyObject * miniMapGetAtlasInfo(PyObject * poSelf, PyObject * poArgs)
{
float fScrrenX;
if (!PyTuple_GetFloat(poArgs, 0, &fScrrenX))
return Py_BuildException();
float fScrrenY;
if (!PyTuple_GetFloat(poArgs, 1, &fScrrenY))
return Py_BuildException();
std::string aString = "";
float fPosX = 0.0f;
float fPosY = 0.0f;
DWORD dwTextColor = 0;
DWORD dwGuildID = 0;
bool bFind = CPythonMiniMap::Instance().GetAtlasInfo(fScrrenX, fScrrenY, aString, &fPosX, &fPosY, &dwTextColor, &dwGuildID);
int iPosX, iPosY;
PR_FLOAT_TO_INT(fPosX, iPosX);
PR_FLOAT_TO_INT(fPosY, iPosY);
iPosX /= 100;
iPosY /= 100;
return Py_BuildValue("isiili", (int)bFind, aString.c_str(), iPosX, iPosY, (signed) dwTextColor, dwGuildID);
}
PyObject * miniMapGetAtlasSize(PyObject * poSelf, PyObject * poArgs)
{
float fSizeX, fSizeY;
bool bGet = CPythonMiniMap::Instance().GetAtlasSize(&fSizeX, &fSizeY);
/*
float fSizeXoo256 = fSizeX / 256.0f;
float fSizeYoo256 = fSizeY / 256.0f;
if (fSizeXoo256 >= fSizeYoo256)
{
fSizeX /= fSizeYoo256;
fSizeY = 256.0f;
}
else
{
fSizeX = 256.0f;
fSizeY /= fSizeXoo256;
}
*/
int iSizeX, iSizeY;
PR_FLOAT_TO_INT(fSizeX, iSizeX);
PR_FLOAT_TO_INT(fSizeY, iSizeY);
return Py_BuildValue("bii", (int)bGet, iSizeX, iSizeY);
}
PyObject * miniMapAddWayPoint(PyObject * poSelf, PyObject * poArgs)
{
int iID;
if (!PyTuple_GetInteger(poArgs, 0, &iID))
return Py_BuildException();
float fX;
if (!PyTuple_GetFloat(poArgs, 1, &fX))
return Py_BuildException();
float fY;
if (!PyTuple_GetFloat(poArgs, 2, &fY))
return Py_BuildException();
char * buf;
if (!PyTuple_GetString(poArgs, 3, &buf))
return Py_BuildException();
CPythonMiniMap::Instance().AddWayPoint(CPythonMiniMap::TYPE_WAYPOINT, (DWORD)iID, fX, fY, buf);
return Py_BuildNone();
}
PyObject * miniMapRemoveWayPoint(PyObject * poSelf, PyObject * poArgs)
{
int iID;
if (!PyTuple_GetInteger(poArgs, 0, &iID))
return Py_BuildException();
CPythonMiniMap::Instance().RemoveWayPoint((DWORD)iID);
return Py_BuildNone();
}
PyObject* miniMapRegisterAtlasWindow(PyObject* poSelf, PyObject* poArgs)
{
PyObject * poHandler;
if (!PyTuple_GetObject(poArgs, 0, &poHandler))
return Py_BuildException();
CPythonMiniMap::Instance().RegisterAtlasWindow(poHandler);
return Py_BuildNone();
}
PyObject* miniMapUnregisterAtlasWindow(PyObject* poSelf, PyObject* poArgs)
{
CPythonMiniMap::Instance().UnregisterAtlasWindow();
return Py_BuildNone();
}
PyObject* miniMapGetGuildAreaID(PyObject* poSelf, PyObject* poArgs)
{
float fx;
if (!PyTuple_GetFloat(poArgs, 0, &fx))
return Py_BuildException();
float fy;
if (!PyTuple_GetFloat(poArgs, 1, &fy))
return Py_BuildException();
DWORD dwGuildID = CPythonMiniMap::Instance().GetGuildAreaID(fx, fy);
return Py_BuildValue("i", dwGuildID);
}
void initMiniMap()
{
static PyMethodDef s_methods[] =
{
{ "SetScale", miniMapSetScale, METH_VARARGS },
{ "ScaleUp", miniMapScaleUp, METH_VARARGS },
{ "ScaleDown", miniMapScaleDown, METH_VARARGS },
{ "SetMiniMapSize", miniMapSetMiniMapSize, METH_VARARGS },
{ "SetCenterPosition", miniMapSetCenterPosition, METH_VARARGS },
{ "Destroy", miniMapDestroy, METH_VARARGS },
{ "Create", miniMapCreate, METH_VARARGS },
{ "Update", miniMapUpdate, METH_VARARGS },
{ "Render", miniMapRender, METH_VARARGS },
{ "Show", miniMapShow, METH_VARARGS },
{ "Hide", miniMapHide, METH_VARARGS },
{ "isShow", miniMapisShow, METH_VARARGS },
{ "GetInfo", miniMapGetInfo, METH_VARARGS },
{ "LoadAtlas", miniMapLoadAtlas, METH_VARARGS },
{ "UpdateAtlas", miniMapUpdateAtlas, METH_VARARGS },
{ "RenderAtlas", miniMapRenderAtlas, METH_VARARGS },
{ "ShowAtlas", miniMapShowAtlas, METH_VARARGS },
{ "HideAtlas", miniMapHideAtlas, METH_VARARGS },
{ "isShowAtlas", miniMapisShowAtlas, METH_VARARGS },
{ "IsAtlas", miniMapIsAtlas, METH_VARARGS },
{ "GetAtlasInfo", miniMapGetAtlasInfo, METH_VARARGS },
{ "GetAtlasSize", miniMapGetAtlasSize, METH_VARARGS },
{ "AddWayPoint", miniMapAddWayPoint, METH_VARARGS },
{ "RemoveWayPoint", miniMapRemoveWayPoint, METH_VARARGS },
{ "RegisterAtlasWindow", miniMapRegisterAtlasWindow, METH_VARARGS },
{ "UnregisterAtlasWindow", miniMapUnregisterAtlasWindow, METH_VARARGS },
{ "GetGuildAreaID", miniMapGetGuildAreaID, METH_VARARGS },
{ NULL, NULL },
};
PyObject * poModule = Py_InitModule("miniMap", s_methods);
PyModule_AddIntConstant(poModule, "TYPE_OPC", CPythonMiniMap::TYPE_OPC);
PyModule_AddIntConstant(poModule, "TYPE_OPCPVP", CPythonMiniMap::TYPE_OPCPVP);
PyModule_AddIntConstant(poModule, "TYPE_OPCPVPSELF", CPythonMiniMap::TYPE_OPCPVPSELF);
PyModule_AddIntConstant(poModule, "TYPE_NPC", CPythonMiniMap::TYPE_NPC);
PyModule_AddIntConstant(poModule, "TYPE_MONSTER", CPythonMiniMap::TYPE_MONSTER);
PyModule_AddIntConstant(poModule, "TYPE_WARP", CPythonMiniMap::TYPE_WARP);
PyModule_AddIntConstant(poModule, "TYPE_WAYPOINT", CPythonMiniMap::TYPE_WAYPOINT);
PyModule_AddIntConstant(poModule, "TYPE_PARTY", CPythonMiniMap::TYPE_PARTY);
PyModule_AddIntConstant(poModule, "TYPE_EMPIRE", CPythonMiniMap::TYPE_EMPIRE);
}
@@ -11,6 +11,7 @@
#include "../GameLib/StdAfx.h" // 40250 PCH order: GameLib types precede UserInterface/GameType.h.
#include "../GameLib/RaceData.h"
#include "../EterPythonLib/StdAfx.h"
#include "../PRTerrainLib/StdAfx.h" // 40250 PCH: PR_FCNV/PR_ICNV for PR_FLOAT_TO_INT.
#include "Locale.h" // Before GameType.h, as in 40250: Locale_inc.h's feature macros shape its tables.
#include "GameType.h" // 40250's UserInterface precompiled header supplies these item types.
#include "../EterBase/tea.h"
@@ -51,6 +52,7 @@ void initItem();
void initNonPlayer();
void initTrade();
void initTextTail();
void initMiniMap();
void initChat();
void initnet();
void initeffect();
+8
View File
@@ -243,6 +243,14 @@ struct D3DXCOLOR
FLOAT r, g, b, a;
};
inline D3DXCOLOR* D3DXColorModulate(D3DXCOLOR* pOut, const D3DXCOLOR* pC1, const D3DXCOLOR* pC2)
{
pOut->r = pC1->r * pC2->r;
pOut->g = pC1->g * pC2->g;
pOut->b = pC1->b * pC2->b;
pOut->a = pC1->a * pC2->a;
return pOut;
}
static_assert(sizeof(D3DXVECTOR2) == 8 && sizeof(D3DXVECTOR3) == 12 && sizeof(D3DXVECTOR4) == 16, "D3DX vector layout");
static_assert(sizeof(D3DXMATRIX) == 64 && sizeof(D3DXQUATERNION) == 16 && sizeof(D3DXCOLOR) == 16, "D3DX layout");
+8
View File
@@ -501,6 +501,14 @@ int main(int argc, char** argv)
"assert item.GetItemType() == item.ITEM_TYPE_WEAPON and item.GetItemSubType() == item.WEAPON_SWORD\n"
"assert item.GetValue(3) > 0, 'min attack'"));
// miniMap module (PythonMiniMapModule.cpp): uiminimap.MiniMap created and showed it. CMapOutdoor is not
// ported, so CMapManager::IsMapOutdoor() is false and the atlas reports "not loaded" as 40250 does off an
// outdoor map.
CHECK(py("import miniMap\n"
"assert miniMap.isShow()\n"
"(bGet, x, y) = miniMap.GetAtlasSize()\n"
"assert not bGet, (bGet, x, y)"));
// Ground items (CPythonItem): the fake server put vnum 19 next to the actor at entergame (GC_ITEM_GROUND_ADD
// + GC_ITEM_OWNERSHIP). player.PickCloseItem finds it within __GetPickableDistance, sends CG_ITEM_PICKUP,
// and the server's GC_ITEM_GROUND_DEL removes it.