Files
mtgodot-poc/extension/src/port/UserInterface/PythonPlayerEventHandler.h
T
shenleiandClaude Opus 5.5 ff0983d3c8 2V3-a: walk with the keyboard through the ported player chain
PythonPlayer, PythonPlayerInput{,Keyboard,Mouse}, PythonPlayerEventHandler,
PythonPlayerSkill, PythonPlayerModule and GameType are verbatim copies; the
`player` stub module and the pending PythonPlayer/GameType stand-ins are gone.
Unported callees (CPythonSkill, CItemData, CItemManager, CPythonItem, ...) are
pending stubs. 64-bit fixes: emotion icon handles use Py_BuildPointer, and
PyDict_Next takes Py_ssize_t.

The actor did not move because GrannyUpdateModelMatrix passed the model matrix
through. Walk/run motions use constant root-motion extraction
(AccumulationFlags=AccumulationExtracted, LoopTranslation e.g. (0,-300,0) for
the warrior run, same as the .msa Accumulation). libgr2 now reads both fields
from TrackGroups[0], and the runtime moves by LoopTranslation over each
control's local-clock span, blended by control weight. VDA extraction is not
implemented.

port.login_flow presses DIK_UP; the actor walks more than 100 cm, and the fake
server parses CG packets and sees CG_MOVE FUNC_MOVE, then FUNC_WAIT at the new
position. port.login_live against the real server walked 132 cm.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 23:41:31 +09:00

89 lines
2.8 KiB
C++

#pragma once
#include "../GameLib/ActorInstance.h"
#include "../GameLib/FlyHandler.h"
#include "PythonNetworkStream.h"
#include "InstanceBase.h"
class CPythonPlayerEventHandler : public CActorInstance::IEventHandler
{
public:
static CPythonPlayerEventHandler& GetSingleton();
public:
virtual ~CPythonPlayerEventHandler();
virtual void OnSyncing(const SState& c_rkState);
virtual void OnWaiting(const SState& c_rkState);
virtual void OnMoving(const SState& c_rkState);
virtual void OnMove(const SState& c_rkState);
virtual void OnStop(const SState& c_rkState);
virtual void OnWarp(const SState& c_rkState);
virtual void OnClearAffects();
virtual void OnSetAffect(UINT uAffect);
virtual void OnResetAffect(UINT uAffect);
virtual void OnAttack(const SState& c_rkState, WORD wMotionIndex);
virtual void OnUseSkill(const SState& c_rkState, UINT uMotSkill, UINT uArg);
virtual void OnUpdate();
virtual void OnChangeShape();
virtual void OnHit(UINT uSkill, CActorInstance& rkActorVictim, BOOL isSendPacket);
void FlushVictimList();
protected:
CPythonPlayerEventHandler();
protected:
struct SVictim
{
DWORD m_dwVID;
long m_lPixelX;
long m_lPixelY;
};
protected:
std::vector<SVictim> m_kVctkVictim;
DWORD m_dwPrevComboIndex;
DWORD m_dwNextWaitingNotifyTime;
DWORD m_dwNextMovingNotifyTime;
TPixelPosition m_kPPosPrevWaiting;
private:
class CNormalBowAttack_FlyEventHandler_AutoClear : public IFlyEventHandler
{
public:
CNormalBowAttack_FlyEventHandler_AutoClear() {}
virtual ~CNormalBowAttack_FlyEventHandler_AutoClear() {}
void Set(CPythonPlayerEventHandler * pParent, CInstanceBase * pInstMain, CInstanceBase * pInstTarget);
void SetTarget(CInstanceBase* pInstTarget);
virtual void OnSetFlyTarget();
virtual void OnShoot(DWORD dwSkillIndex);
virtual void OnNoTarget() { /*Tracenf("Shoot : target이 없습니다.");*/ }
virtual void OnExplodingOutOfRange() { /*Tracenf("Shoot : 사정거리가 끝났습니다.");*/ }
virtual void OnExplodingAtBackground() { /*Tracenf("Shoot : 배경에 맞았습니다.");*/ }
virtual void OnExplodingAtAnotherTarget(DWORD dwSkillIndex, DWORD dwVID);
virtual void OnExplodingAtTarget(DWORD dwSkillIndex);
protected:
CPythonPlayerEventHandler * m_pParent;
CInstanceBase * m_pInstMain;
CInstanceBase * m_pInstTarget;
} m_NormalBowAttack_FlyEventHandler_AutoClear;
public:
IFlyEventHandler * GetNormalBowAttackFlyEventHandler(CInstanceBase* pInstMain, CInstanceBase* pInstTarget)
{
m_NormalBowAttack_FlyEventHandler_AutoClear.Set(this,pInstMain,pInstTarget);
return &m_NormalBowAttack_FlyEventHandler_AutoClear;
}
void ChangeFlyTarget(CInstanceBase* pInstTarget)
{
m_NormalBowAttack_FlyEventHandler_AutoClear.SetTarget(pInstTarget);
}
};