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
@@ -298,19 +298,37 @@ auto CScreen::GetPickingPosition(float, float *, float *, float *) -> void
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CScreen::ProjectPosition(float, float, float, float *, float *) -> void
|
||||
// 40250 GrpScreen.cpp:749-779.
|
||||
void CScreen::ProjectPosition(float x, float y, float z, float * pfX, float * pfY)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
D3DXVECTOR3 Input(x, y, z);
|
||||
D3DXVECTOR3 Output;
|
||||
D3DXVec3Project(&Output, &Input, &ms_Viewport, &ms_matProj, &ms_matView, &ms_matWorld);
|
||||
|
||||
*pfX = Output.x;
|
||||
*pfY = Output.y;
|
||||
}
|
||||
|
||||
auto CScreen::ProjectPosition(float, float, float, float *, float *, float *) -> void
|
||||
void CScreen::ProjectPosition(float x, float y, float z, float * pfX, float * pfY, float * pfZ)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
D3DXVECTOR3 Input(x, y, z);
|
||||
D3DXVECTOR3 Output;
|
||||
D3DXVec3Project(&Output, &Input, &ms_Viewport, &ms_matProj, &ms_matView, &ms_matWorld);
|
||||
|
||||
*pfX = Output.x;
|
||||
*pfY = Output.y;
|
||||
*pfZ = Output.z;
|
||||
}
|
||||
|
||||
auto CScreen::UnprojectPosition(float, float, float, float *, float *, float *) -> void
|
||||
void CScreen::UnprojectPosition(float x, float y, float z, float * pfX, float * pfY, float * pfZ)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
D3DXVECTOR3 Input(x, y, z);
|
||||
D3DXVECTOR3 Output;
|
||||
D3DXVec3Unproject(&Output, &Input, &ms_Viewport, &ms_matProj, &ms_matView, &ms_matWorld);
|
||||
|
||||
*pfX = Output.x;
|
||||
*pfY = Output.y;
|
||||
*pfZ = Output.z;
|
||||
}
|
||||
|
||||
auto CScreen::IsLostDevice() -> BOOL
|
||||
|
||||
@@ -188,12 +188,6 @@ void AddStubConstants_systemSetting(PyObject* poModule)
|
||||
PyModule_AddIntConstant(poModule, "WINDOW_CHAT", CPythonSystem::WINDOW_CHAT);
|
||||
}
|
||||
|
||||
// 40250 UserInterface/PythonTextTailModule.cpp
|
||||
void AddStubConstants_textTail(PyObject* poModule)
|
||||
{
|
||||
(void) poModule;
|
||||
}
|
||||
|
||||
// 40250 UserInterface/PythonNetworkDatagramModule.cpp
|
||||
void AddStubConstants_udp(PyObject* poModule)
|
||||
{
|
||||
|
||||
@@ -19,7 +19,6 @@ void AddStubConstants_shop(PyObject* poModule);
|
||||
void AddStubConstants_skill(PyObject* poModule);
|
||||
void AddStubConstants_snd(PyObject* poModule);
|
||||
void AddStubConstants_systemSetting(PyObject* poModule);
|
||||
void AddStubConstants_textTail(PyObject* poModule);
|
||||
void AddStubConstants_udp(PyObject* poModule);
|
||||
|
||||
namespace {
|
||||
@@ -691,46 +690,6 @@ PyMethodDef methods_systemSetting[] = {
|
||||
{ "SetShadowLevel", stub_systemSetting_SetShadowLevel, METH_VARARGS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
// 40250 UserInterface/PythonTextTailModule.cpp: textTail export names.
|
||||
PyObject* stub_textTail_Clear(PyObject*, PyObject*) { return stub_call_named("textTail.Clear", Py_BuildNone()); }
|
||||
PyObject* stub_textTail_UpdateAllTextTail(PyObject*, PyObject*) { return stub_call_named("textTail.UpdateAllTextTail", Py_BuildNone()); }
|
||||
PyObject* stub_textTail_UpdateShowingTextTail(PyObject*, PyObject*) { return stub_call_named("textTail.UpdateShowingTextTail", Py_BuildNone()); }
|
||||
PyObject* stub_textTail_Render(PyObject*, PyObject*) { return stub_call_named("textTail.Render", Py_BuildNone()); }
|
||||
PyObject* stub_textTail_ShowCharacterTextTail(PyObject*, PyObject*) { return stub_call_named("textTail.ShowCharacterTextTail", Py_BuildNone()); }
|
||||
PyObject* stub_textTail_ShowItemTextTail(PyObject*, PyObject*) { return stub_call_named("textTail.ShowItemTextTail", Py_BuildNone()); }
|
||||
PyObject* stub_textTail_GetPosition(PyObject*, PyObject*) { return stub_call_named("textTail.GetPosition", Py_BuildValue("fff", 0.0, 0.0, 0.0)); }
|
||||
PyObject* stub_textTail_IsChat(PyObject*, PyObject*) { return stub_call_named("textTail.IsChat", Py_BuildValue("i", 0)); }
|
||||
PyObject* stub_textTail_ArrangeTextTail(PyObject*, PyObject*) { return stub_call_named("textTail.ArrangeTextTail", Py_BuildNone()); }
|
||||
PyObject* stub_textTail_HideAllTextTail(PyObject*, PyObject*) { return stub_call_named("textTail.HideAllTextTail", Py_BuildNone()); }
|
||||
PyObject* stub_textTail_ShowAllTextTail(PyObject*, PyObject*) { return stub_call_named("textTail.ShowAllTextTail", Py_BuildNone()); }
|
||||
PyObject* stub_textTail_Pick(PyObject*, PyObject*) { return stub_call_named("textTail.Pick", Py_BuildValue("i", 0)); }
|
||||
PyObject* stub_textTail_SelectItemName(PyObject*, PyObject*) { return stub_call_named("textTail.SelectItemName", Py_BuildNone()); }
|
||||
PyObject* stub_textTail_EnablePKTitle(PyObject*, PyObject*) { return stub_call_named("textTail.EnablePKTitle", Py_BuildNone()); }
|
||||
PyObject* stub_textTail_RegisterCharacterTextTail(PyObject*, PyObject*) { return stub_call_named("textTail.RegisterCharacterTextTail", Py_BuildNone()); }
|
||||
PyObject* stub_textTail_RegisterChatTail(PyObject*, PyObject*) { return stub_call_named("textTail.RegisterChatTail", Py_BuildNone()); }
|
||||
PyObject* stub_textTail_RegisterInfoTail(PyObject*, PyObject*) { return stub_call_named("textTail.RegisterInfoTail", Py_BuildNone()); }
|
||||
PyObject* stub_textTail_AttachTitle(PyObject*, PyObject*) { return stub_call_named("textTail.AttachTitle", Py_BuildNone()); }
|
||||
PyMethodDef methods_textTail[] = {
|
||||
{ "Clear", stub_textTail_Clear, METH_VARARGS },
|
||||
{ "UpdateAllTextTail", stub_textTail_UpdateAllTextTail, METH_VARARGS },
|
||||
{ "UpdateShowingTextTail", stub_textTail_UpdateShowingTextTail, METH_VARARGS },
|
||||
{ "Render", stub_textTail_Render, METH_VARARGS },
|
||||
{ "ShowCharacterTextTail", stub_textTail_ShowCharacterTextTail, METH_VARARGS },
|
||||
{ "ShowItemTextTail", stub_textTail_ShowItemTextTail, METH_VARARGS },
|
||||
{ "GetPosition", stub_textTail_GetPosition, METH_VARARGS },
|
||||
{ "IsChat", stub_textTail_IsChat, METH_VARARGS },
|
||||
{ "ArrangeTextTail", stub_textTail_ArrangeTextTail, METH_VARARGS },
|
||||
{ "HideAllTextTail", stub_textTail_HideAllTextTail, METH_VARARGS },
|
||||
{ "ShowAllTextTail", stub_textTail_ShowAllTextTail, METH_VARARGS },
|
||||
{ "Pick", stub_textTail_Pick, METH_VARARGS },
|
||||
{ "SelectItemName", stub_textTail_SelectItemName, METH_VARARGS },
|
||||
{ "EnablePKTitle", stub_textTail_EnablePKTitle, METH_VARARGS },
|
||||
{ "RegisterCharacterTextTail", stub_textTail_RegisterCharacterTextTail, METH_VARARGS },
|
||||
{ "RegisterChatTail", stub_textTail_RegisterChatTail, METH_VARARGS },
|
||||
{ "RegisterInfoTail", stub_textTail_RegisterInfoTail, METH_VARARGS },
|
||||
{ "AttachTitle", stub_textTail_AttachTitle, METH_VARARGS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
// 40250 UserInterface/PythonNetworkDatagramModule.cpp: udp export names.
|
||||
PyObject* stub_udp_Enable(PyObject*, PyObject*) { return stub_call_named("udp.Enable", Py_BuildNone()); }
|
||||
PyObject* stub_udp_Disable(PyObject*, PyObject*) { return stub_call_named("udp.Disable", Py_BuildNone()); }
|
||||
@@ -812,11 +771,6 @@ void init_2v0_gameplay_stubs() {
|
||||
PyModule_AddIntConstant(module, "__port_stub__", 1);
|
||||
AddStubConstants_systemSetting(module);
|
||||
}
|
||||
{
|
||||
PyObject* module = Py_InitModule("textTail", methods_textTail);
|
||||
PyModule_AddIntConstant(module, "__port_stub__", 1);
|
||||
AddStubConstants_textTail(module);
|
||||
}
|
||||
{
|
||||
PyObject* module = Py_InitModule("udp", methods_udp);
|
||||
PyModule_AddIntConstant(module, "__port_stub__", 1);
|
||||
|
||||
@@ -351,6 +351,7 @@ bool run_main_script_body(const char* lpCmdLine, std::string* error)
|
||||
initNonPlayer();
|
||||
initTrade();
|
||||
initChat();
|
||||
initTextTail();
|
||||
initnet();
|
||||
initeffect();
|
||||
initfly();
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "UserInterface/PythonNetworkStream.h"
|
||||
#include "UserInterface/AccountConnector.h"
|
||||
#include "UserInterface/PythonItem.h"
|
||||
#include "UserInterface/PythonTextTail.h"
|
||||
#include "UserInterface/PythonSkill.h"
|
||||
#include "UserInterface/PythonNonPlayer.h"
|
||||
#include "GameLib/ItemManager.h"
|
||||
@@ -124,6 +125,9 @@ bool CPythonApplication::Create(PyObject*, const char*, int, int, int)
|
||||
// 40250 m_pyItem.Create() (PythonApplication.cpp:1253): registers dropitem.mse with CEffectManager,
|
||||
// still a platform stub.
|
||||
CPythonItem::Instance().Create();
|
||||
|
||||
// 40250 PythonApplication.cpp:1260, after DefaultFont_Startup and the IME.
|
||||
CPythonTextTail::Instance().Initialize();
|
||||
return true;
|
||||
}
|
||||
// 40250 PythonApplication.cpp:105
|
||||
@@ -404,7 +408,6 @@ bool LoadLocaleData(const char* localePath)
|
||||
NANOEND
|
||||
return true;
|
||||
}
|
||||
void TextTail_SetLivingTime(long) { MT_PLATFORM_STUB(); }
|
||||
namespace {
|
||||
// The supplied 40250 Client/locale.cfg selects "en" (code page 1252).
|
||||
// Keep these mutable for app.ForceSetLocale, as Locale.cpp does.
|
||||
|
||||
@@ -26,6 +26,41 @@
|
||||
// 40250 UserInterface.cpp:49.
|
||||
bool __IS_TEST_SERVER_MODE__=false;
|
||||
|
||||
// 40250 UserInterface.cpp:98. PORT: LoadString reads the executable's STRINGTABLE; the one the supplied English
|
||||
// client resolves is UserInterface.rc's LANG_ENGLISH, SUBLANG_ENGLISH_US section (ids from resource.h).
|
||||
namespace
|
||||
{
|
||||
const char* LoadAppString(DWORD dwID)
|
||||
{
|
||||
switch (dwID)
|
||||
{
|
||||
case 1: return "Metin 2"; // IDS_APP_NAME
|
||||
case 2: return "'s"; // IDS_POSSESSIVE_MORPHENE
|
||||
case 3: return "IDS_WARN_BAD_DRIVER"; // IDS_WARN_BAD_DRIVER
|
||||
case 4: return "IDS_WARN_NO_TNL"; // IDS_WARN_NO_TNL
|
||||
case 5: return "Cannot read %s file"; // IDS_ERR_CANNOT_READ_FILE
|
||||
case 6: return "File '%s' is not latest version. Please launch patcher."; // IDS_ERR_NOT_LATEST_FILE
|
||||
case 7: return "Please run patcher."; // IDS_ERR_MUST_LAUNCH_FROM_PATCHER
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
std::map<DWORD, std::string> gs_kMap_dwID_stLocale;
|
||||
} // namespace
|
||||
|
||||
const std::string& ApplicationStringTable_GetString(DWORD dwID)
|
||||
{
|
||||
std::string& rstLocale=gs_kMap_dwID_stLocale[dwID];
|
||||
rstLocale=LoadAppString(dwID);
|
||||
|
||||
return rstLocale;
|
||||
}
|
||||
|
||||
const char* ApplicationStringTable_GetStringz(DWORD dwID)
|
||||
{
|
||||
return ApplicationStringTable_GetString(dwID).c_str();
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
// Lowercased file name -> on-disk spelling, for the files directly in `folder`.
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
// Stand-in for the 40250 logic unit UserInterface/PythonTextTail.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/PythonTextTail.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
CPythonTextTail::CPythonTextTail()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CPythonTextTail::~CPythonTextTail()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonTextTail::RegisterChatTail(DWORD, const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonTextTail::RegisterCharacterTextTail(DWORD, DWORD, const D3DXCOLOR &, float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonTextTail::SetCharacterTextTailColor(DWORD, const D3DXCOLOR &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonTextTail::DeleteCharacterTextTail(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonTextTail::AttachTitle(DWORD, const char *, const D3DXCOLOR &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonTextTail::DetachTitle(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonTextTail::AttachLevel(DWORD, const char *, const D3DXCOLOR &) -> void
|
||||
{
|
||||
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;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,235 @@
|
||||
#include "StdAfx.h"
|
||||
#include "PythonTextTail.h"
|
||||
#include "PythonCharacterManager.h"
|
||||
|
||||
PyObject * textTailClear(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
CPythonTextTail::Instance().Clear();
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * textTailUpdateAllTextTail(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
CPythonTextTail::Instance().UpdateAllTextTail();
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * textTailUpdateShowingTextTail(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
CPythonTextTail::Instance().UpdateShowingTextTail();
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * textTailRender(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
CPythonTextTail::Instance().Render();
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * textTailRegisterCharacterTextTail(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
int iGuildID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iGuildID))
|
||||
return Py_BuildException();
|
||||
int iVirtualID;
|
||||
if (!PyTuple_GetInteger(poArgs, 1, &iVirtualID))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonTextTail::Instance().RegisterCharacterTextTail(iGuildID, iVirtualID, D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * textTailGetPosition(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
int VirtualID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &VirtualID))
|
||||
return Py_BuildException();
|
||||
|
||||
float x=0.0f;
|
||||
float y=0.0f;
|
||||
float z=0.0f;
|
||||
bool isData=CPythonTextTail::Instance().GetTextTailPosition(VirtualID, &x, &y, &z);
|
||||
if (!isData)
|
||||
{
|
||||
CPythonCharacterManager& rkChrMgr=CPythonCharacterManager::Instance();
|
||||
CInstanceBase* pkInstMain=rkChrMgr.GetMainInstancePtr();
|
||||
if (pkInstMain)
|
||||
{
|
||||
const D3DXVECTOR3 & c_rv3Position = pkInstMain->GetGraphicThingInstanceRef().GetPosition();
|
||||
CPythonGraphic::Instance().ProjectPosition(c_rv3Position.x, c_rv3Position.y, c_rv3Position.z, &x, &y);
|
||||
}
|
||||
}
|
||||
|
||||
return Py_BuildValue("fff", x, y, z);
|
||||
}
|
||||
|
||||
PyObject * textTailIsChat(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
int VirtualID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &VirtualID))
|
||||
return Py_BuildException();
|
||||
|
||||
return Py_BuildValue("i", CPythonTextTail::Instance().IsChatTextTail(VirtualID));
|
||||
}
|
||||
|
||||
PyObject * textTailRegisterChatTail(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
int VirtualID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &VirtualID))
|
||||
return Py_BuildException();
|
||||
|
||||
char * szText;
|
||||
if (!PyTuple_GetString(poArgs, 1, &szText))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonTextTail::Instance().RegisterChatTail(VirtualID, szText);
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * textTailRegisterInfoTail(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
int VirtualID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &VirtualID))
|
||||
return Py_BuildException();
|
||||
|
||||
char * szText;
|
||||
if (!PyTuple_GetString(poArgs, 1, &szText))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonTextTail::Instance().RegisterInfoTail(VirtualID, szText);
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * textTailAttachTitle(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
int iVirtualID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iVirtualID))
|
||||
return Py_BuildException();
|
||||
char * szName;
|
||||
if (!PyTuple_GetString(poArgs, 1, &szName))
|
||||
return Py_BuildException();
|
||||
float fr;
|
||||
if (!PyTuple_GetFloat(poArgs, 2, &fr))
|
||||
return Py_BuildException();
|
||||
float fg;
|
||||
if (!PyTuple_GetFloat(poArgs, 3, &fg))
|
||||
return Py_BuildException();
|
||||
float fb;
|
||||
if (!PyTuple_GetFloat(poArgs, 4, &fb))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonTextTail::Instance().AttachTitle(iVirtualID, szName, D3DXCOLOR(fr, fg, fb, 1.0f));
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * textTailShowCharacterTextTail(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
int VirtualID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &VirtualID))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonTextTail::Instance().ShowCharacterTextTail(VirtualID);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * textTailShowItemTextTail(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
int VirtualID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &VirtualID))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonTextTail::Instance().ShowItemTextTail(VirtualID);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * textTailArrangeTextTail(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
CPythonTextTail::Instance().ArrangeTextTail();
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * textTailHideAllTextTail(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
CPythonTextTail::Instance().HideAllTextTail();
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * textTailShowAllTextTail(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
CPythonTextTail::Instance().ShowAllTextTail();
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * textTailPick(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
int ix;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &ix))
|
||||
return Py_BuildException();
|
||||
int iy;
|
||||
if (!PyTuple_GetInteger(poArgs, 1, &iy))
|
||||
return Py_BuildException();
|
||||
|
||||
int iValue = CPythonTextTail::Instance().Pick(ix, iy);
|
||||
return Py_BuildValue("i", iValue);
|
||||
}
|
||||
|
||||
PyObject * textTailSelectItemName(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
int iVirtualID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iVirtualID))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonTextTail::Instance().SelectItemName(iVirtualID);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * textTailEnablePKTitle(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
int iFlag;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iFlag))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonTextTail::Instance().EnablePKTitle(iFlag);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
void initTextTail()
|
||||
{
|
||||
static PyMethodDef s_methods[] =
|
||||
{
|
||||
{ "Clear", textTailClear, METH_VARARGS },
|
||||
|
||||
{ "UpdateAllTextTail", textTailUpdateAllTextTail, METH_VARARGS },
|
||||
{ "UpdateShowingTextTail", textTailUpdateShowingTextTail, METH_VARARGS },
|
||||
{ "Render", textTailRender, METH_VARARGS },
|
||||
|
||||
{ "ShowCharacterTextTail", textTailShowCharacterTextTail, METH_VARARGS },
|
||||
{ "ShowItemTextTail", textTailShowItemTextTail, METH_VARARGS },
|
||||
|
||||
{ "GetPosition", textTailGetPosition, METH_VARARGS },
|
||||
{ "IsChat", textTailIsChat, METH_VARARGS },
|
||||
|
||||
{ "ArrangeTextTail", textTailArrangeTextTail, METH_VARARGS },
|
||||
{ "HideAllTextTail", textTailHideAllTextTail, METH_VARARGS },
|
||||
{ "ShowAllTextTail", textTailShowAllTextTail, METH_VARARGS },
|
||||
|
||||
{ "Pick", textTailPick, METH_VARARGS },
|
||||
{ "SelectItemName", textTailSelectItemName, METH_VARARGS },
|
||||
|
||||
{ "EnablePKTitle", textTailEnablePKTitle, METH_VARARGS },
|
||||
|
||||
// For Test
|
||||
{ "RegisterCharacterTextTail", textTailRegisterCharacterTextTail, METH_VARARGS },
|
||||
{ "RegisterChatTail", textTailRegisterChatTail, METH_VARARGS },
|
||||
{ "RegisterInfoTail", textTailRegisterInfoTail, METH_VARARGS },
|
||||
{ "AttachTitle", textTailAttachTitle, METH_VARARGS },
|
||||
|
||||
{ NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
Py_InitModule("textTail", s_methods);
|
||||
}
|
||||
@@ -50,8 +50,15 @@ void initPlayer();
|
||||
void initItem();
|
||||
void initNonPlayer();
|
||||
void initTrade();
|
||||
void initTextTail();
|
||||
void initChat();
|
||||
void initnet();
|
||||
void initeffect();
|
||||
void initfly();
|
||||
void initServerStateChecker();
|
||||
|
||||
extern const std::string& ApplicationStringTable_GetString(DWORD dwID);
|
||||
extern const std::string& ApplicationStringTable_GetString(DWORD dwID, LPCSTR szKey);
|
||||
|
||||
extern const char* ApplicationStringTable_GetStringz(DWORD dwID);
|
||||
extern const char* ApplicationStringTable_GetStringz(DWORD dwID, LPCSTR szKey);
|
||||
|
||||
@@ -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