port 2V2-b: GamePhase dispatch consumes the Entergame burst
PythonNetworkStreamPhaseGame/PhaseGameActor/PhaseGameItem/Command, NetworkActorManager and PythonChat/PythonChatModule are ported verbatim and dispatched at runtime; the 2V0 chat stub module is removed and initChat() runs before initnet() as in 40250. InstanceBase, PythonCharacterManager and GameLib ActorInstance/RaceData/RaceManager compile but stay TODO until 2V2-c/d wire them. Units not ported yet get their singletons from PythonBoot's GameSingletons (CPythonApplication member order) and platform/pending stand-ins generated by platform_stub.py pending; const char* stand-ins return "". port.login_flow's fake server now sends the CInputLogin::Entergame order (actor insert, NPC positions, PHASE_GAME, land list, time, channel, greet notice, ping) and a TraceError observer asserts no unknown packet header. port.login_live passes against the real server for 10 s of game phase. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
d16fabf61c
commit
62b6e23bfc
@@ -7,6 +7,7 @@
|
||||
#include "../PlatformStub.h"
|
||||
#include "EterBase/Timer.h"
|
||||
#include "LogBox.h"
|
||||
#include "TraceErrorObserver.h"
|
||||
|
||||
#include <cstdarg>
|
||||
#include <cstdio>
|
||||
@@ -15,6 +16,16 @@
|
||||
|
||||
const DWORD DEBUG_STRING_MAX_LEN = 1024;
|
||||
|
||||
namespace
|
||||
{
|
||||
TraceErrorObserver g_trace_error_observer = nullptr;
|
||||
}
|
||||
|
||||
void SetTraceErrorObserver(TraceErrorObserver observer)
|
||||
{
|
||||
g_trace_error_observer = observer;
|
||||
}
|
||||
|
||||
auto SetLogLevel(UINT) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
@@ -91,6 +102,8 @@ void TraceError(const char* c_szFormat, ...)
|
||||
ELTimer_GetMSec() % 60000,
|
||||
szBuf + 8);
|
||||
fflush(stderr);
|
||||
if (g_trace_error_observer)
|
||||
g_trace_error_observer(szBuf + 8);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
// Test hook: sees every TraceError line (without the "SYSERR: " prefix) after it is written to stderr.
|
||||
// The 40250 client only writes these to syserr.txt; tests use it to fail on, e.g., the stream's
|
||||
// "Unknown packet header" (CPythonNetworkStream::CheckPacket), which otherwise only clears the buffer.
|
||||
|
||||
using TraceErrorObserver = void (*)(const char* line);
|
||||
|
||||
void SetTraceErrorObserver(TraceErrorObserver observer);
|
||||
@@ -35,6 +35,12 @@ T mt_platform_stub_return()
|
||||
return static_cast<T>(*reinterpret_cast<U*>(storage));
|
||||
}
|
||||
}
|
||||
else if constexpr (std::is_same_v<T, const char*>)
|
||||
{
|
||||
// Callers strcmp/strlen/format the names these return (CPythonPlayer::GetName in RecvGuild); a
|
||||
// null string would crash where the real function never returns one.
|
||||
return "";
|
||||
}
|
||||
else if constexpr (std::is_default_constructible_v<T>)
|
||||
{
|
||||
return T{};
|
||||
|
||||
@@ -75,28 +75,6 @@ void AddStubConstants_background(PyObject* poModule)
|
||||
PyModule_AddIntConstant(poModule, "TEXTURE_SORT", CMapOutdoor::TEXTURE_SORT);
|
||||
}
|
||||
|
||||
// 40250 UserInterface/PythonChatModule.cpp
|
||||
void AddStubConstants_chat(PyObject* poModule)
|
||||
{
|
||||
(void) poModule;
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_TALKING", CHAT_TYPE_TALKING);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_INFO", CHAT_TYPE_INFO);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_NOTICE", CHAT_TYPE_NOTICE);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_PARTY", CHAT_TYPE_PARTY);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_GUILD", CHAT_TYPE_GUILD);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_COMMAND", CHAT_TYPE_COMMAND);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_SHOUT", CHAT_TYPE_SHOUT);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_WHISPER", CHAT_TYPE_WHISPER);
|
||||
PyModule_AddIntConstant(poModule, "WHISPER_TYPE_CHAT", CPythonChat::WHISPER_TYPE_CHAT);
|
||||
PyModule_AddIntConstant(poModule, "WHISPER_TYPE_SYSTEM", CPythonChat::WHISPER_TYPE_SYSTEM);
|
||||
PyModule_AddIntConstant(poModule, "WHISPER_TYPE_GM", CPythonChat::WHISPER_TYPE_GM);
|
||||
PyModule_AddIntConstant(poModule, "BOARD_STATE_VIEW", CPythonChat::BOARD_STATE_VIEW);
|
||||
PyModule_AddIntConstant(poModule, "BOARD_STATE_EDIT", CPythonChat::BOARD_STATE_EDIT);
|
||||
PyModule_AddIntConstant(poModule, "BOARD_STATE_LOG", CPythonChat::BOARD_STATE_LOG);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_SET_CHAT_WINDOW", 0);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_SET_LOG_WINDOW", 1);
|
||||
}
|
||||
|
||||
// 40250 UserInterface/PythonCharacterModule.cpp
|
||||
void AddStubConstants_chr(PyObject* poModule)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
// GameplayModuleConstants.cpp: each module's 40250 constants.
|
||||
void AddStubConstants_ServerStateChecker(PyObject* poModule);
|
||||
void AddStubConstants_background(PyObject* poModule);
|
||||
void AddStubConstants_chat(PyObject* poModule);
|
||||
void AddStubConstants_chr(PyObject* poModule);
|
||||
void AddStubConstants_chrmgr(PyObject* poModule);
|
||||
void AddStubConstants_effect(PyObject* poModule);
|
||||
@@ -154,70 +153,6 @@ PyMethodDef methods_background[] = {
|
||||
{ "WarpTest", stub_background_WarpTest, METH_VARARGS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
// 40250 UserInterface/PythonChatModule.cpp: chat export names.
|
||||
PyObject* stub_chat_SetChatColor(PyObject*, PyObject*) { return stub_call_named("chat.SetChatColor", Py_BuildNone()); }
|
||||
PyObject* stub_chat_Clear(PyObject*, PyObject*) { return stub_call_named("chat.Clear", Py_BuildNone()); }
|
||||
PyObject* stub_chat_Close(PyObject*, PyObject*) { return stub_call_named("chat.Close", Py_BuildNone()); }
|
||||
PyObject* stub_chat_CreateChatSet(PyObject*, PyObject*) { return stub_call_named("chat.CreateChatSet", Py_BuildValue("i", 0)); }
|
||||
PyObject* stub_chat_Update(PyObject*, PyObject*) { return stub_call_named("chat.Update", Py_BuildNone()); }
|
||||
PyObject* stub_chat_Render(PyObject*, PyObject*) { return stub_call_named("chat.Render", Py_BuildNone()); }
|
||||
PyObject* stub_chat_SetBoardState(PyObject*, PyObject*) { return stub_call_named("chat.SetBoardState", Py_BuildNone()); }
|
||||
PyObject* stub_chat_SetPosition(PyObject*, PyObject*) { return stub_call_named("chat.SetPosition", Py_BuildNone()); }
|
||||
PyObject* stub_chat_SetHeight(PyObject*, PyObject*) { return stub_call_named("chat.SetHeight", Py_BuildNone()); }
|
||||
PyObject* stub_chat_SetStep(PyObject*, PyObject*) { return stub_call_named("chat.SetStep", Py_BuildNone()); }
|
||||
PyObject* stub_chat_ToggleChatMode(PyObject*, PyObject*) { return stub_call_named("chat.ToggleChatMode", Py_BuildNone()); }
|
||||
PyObject* stub_chat_EnableChatMode(PyObject*, PyObject*) { return stub_call_named("chat.EnableChatMode", Py_BuildNone()); }
|
||||
PyObject* stub_chat_DisableChatMode(PyObject*, PyObject*) { return stub_call_named("chat.DisableChatMode", Py_BuildNone()); }
|
||||
PyObject* stub_chat_SetEndPos(PyObject*, PyObject*) { return stub_call_named("chat.SetEndPos", Py_BuildNone()); }
|
||||
PyObject* stub_chat_GetLineCount(PyObject*, PyObject*) { return stub_call_named("chat.GetLineCount", Py_BuildValue("i", 0)); }
|
||||
PyObject* stub_chat_GetVisibleLineCount(PyObject*, PyObject*) { return stub_call_named("chat.GetVisibleLineCount", Py_BuildValue("i", 0)); }
|
||||
PyObject* stub_chat_GetLineStep(PyObject*, PyObject*) { return stub_call_named("chat.GetLineStep", Py_BuildValue("i", 0)); }
|
||||
PyObject* stub_chat_AppendChat(PyObject*, PyObject*) { return stub_call_named("chat.AppendChat", Py_BuildNone()); }
|
||||
PyObject* stub_chat_AppendChatWithDelay(PyObject*, PyObject*) { return stub_call_named("chat.AppendChatWithDelay", Py_BuildNone()); }
|
||||
PyObject* stub_chat_ArrangeShowingChat(PyObject*, PyObject*) { return stub_call_named("chat.ArrangeShowingChat", Py_BuildNone()); }
|
||||
PyObject* stub_chat_IgnoreCharacter(PyObject*, PyObject*) { return stub_call_named("chat.IgnoreCharacter", Py_BuildNone()); }
|
||||
PyObject* stub_chat_IsIgnoreCharacter(PyObject*, PyObject*) { return stub_call_named("chat.IsIgnoreCharacter", Py_BuildNone()); }
|
||||
PyObject* stub_chat_CreateWhisper(PyObject*, PyObject*) { return stub_call_named("chat.CreateWhisper", Py_BuildNone()); }
|
||||
PyObject* stub_chat_AppendWhisper(PyObject*, PyObject*) { return stub_call_named("chat.AppendWhisper", Py_BuildNone()); }
|
||||
PyObject* stub_chat_RenderWhisper(PyObject*, PyObject*) { return stub_call_named("chat.RenderWhisper", Py_BuildNone()); }
|
||||
PyObject* stub_chat_SetWhisperBoxSize(PyObject*, PyObject*) { return stub_call_named("chat.SetWhisperBoxSize", Py_BuildNone()); }
|
||||
PyObject* stub_chat_SetWhisperPosition(PyObject*, PyObject*) { return stub_call_named("chat.SetWhisperPosition", Py_BuildNone()); }
|
||||
PyObject* stub_chat_ClearWhisper(PyObject*, PyObject*) { return stub_call_named("chat.ClearWhisper", Py_BuildNone()); }
|
||||
PyObject* stub_chat_InitWhisper(PyObject*, PyObject*) { return stub_call_named("chat.InitWhisper", Py_BuildNone()); }
|
||||
PyObject* stub_chat_GetLinkFromHyperlink(PyObject*, PyObject*) { return stub_call_named("chat.GetLinkFromHyperlink", Py_BuildValue("s", "")); }
|
||||
PyMethodDef methods_chat[] = {
|
||||
{ "SetChatColor", stub_chat_SetChatColor, METH_VARARGS },
|
||||
{ "Clear", stub_chat_Clear, METH_VARARGS },
|
||||
{ "Close", stub_chat_Close, METH_VARARGS },
|
||||
{ "CreateChatSet", stub_chat_CreateChatSet, METH_VARARGS },
|
||||
{ "Update", stub_chat_Update, METH_VARARGS },
|
||||
{ "Render", stub_chat_Render, METH_VARARGS },
|
||||
{ "SetBoardState", stub_chat_SetBoardState, METH_VARARGS },
|
||||
{ "SetPosition", stub_chat_SetPosition, METH_VARARGS },
|
||||
{ "SetHeight", stub_chat_SetHeight, METH_VARARGS },
|
||||
{ "SetStep", stub_chat_SetStep, METH_VARARGS },
|
||||
{ "ToggleChatMode", stub_chat_ToggleChatMode, METH_VARARGS },
|
||||
{ "EnableChatMode", stub_chat_EnableChatMode, METH_VARARGS },
|
||||
{ "DisableChatMode", stub_chat_DisableChatMode, METH_VARARGS },
|
||||
{ "SetEndPos", stub_chat_SetEndPos, METH_VARARGS },
|
||||
{ "GetLineCount", stub_chat_GetLineCount, METH_VARARGS },
|
||||
{ "GetVisibleLineCount", stub_chat_GetVisibleLineCount, METH_VARARGS },
|
||||
{ "GetLineStep", stub_chat_GetLineStep, METH_VARARGS },
|
||||
{ "AppendChat", stub_chat_AppendChat, METH_VARARGS },
|
||||
{ "AppendChatWithDelay", stub_chat_AppendChatWithDelay, METH_VARARGS },
|
||||
{ "ArrangeShowingChat", stub_chat_ArrangeShowingChat, METH_VARARGS },
|
||||
{ "IgnoreCharacter", stub_chat_IgnoreCharacter, METH_VARARGS },
|
||||
{ "IsIgnoreCharacter", stub_chat_IsIgnoreCharacter, METH_VARARGS },
|
||||
{ "CreateWhisper", stub_chat_CreateWhisper, METH_VARARGS },
|
||||
{ "AppendWhisper", stub_chat_AppendWhisper, METH_VARARGS },
|
||||
{ "RenderWhisper", stub_chat_RenderWhisper, METH_VARARGS },
|
||||
{ "SetWhisperBoxSize", stub_chat_SetWhisperBoxSize, METH_VARARGS },
|
||||
{ "SetWhisperPosition", stub_chat_SetWhisperPosition, METH_VARARGS },
|
||||
{ "ClearWhisper", stub_chat_ClearWhisper, METH_VARARGS },
|
||||
{ "InitWhisper", stub_chat_InitWhisper, METH_VARARGS },
|
||||
{ "GetLinkFromHyperlink", stub_chat_GetLinkFromHyperlink, METH_VARARGS },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
// 40250 UserInterface/PythonCharacterModule.cpp: chr export names.
|
||||
PyObject* stub_chr_DismountHorse(PyObject*, PyObject*) { return stub_call_named("chr.DismountHorse", Py_BuildNone()); }
|
||||
PyObject* stub_chr_MountHorse(PyObject*, PyObject*) { return stub_call_named("chr.MountHorse", Py_BuildNone()); }
|
||||
@@ -1502,11 +1437,6 @@ void init_2v0_gameplay_stubs() {
|
||||
PyModule_AddIntConstant(module, "__port_stub__", 1);
|
||||
AddStubConstants_background(module);
|
||||
}
|
||||
{
|
||||
PyObject* module = Py_InitModule("chat", methods_chat);
|
||||
PyModule_AddIntConstant(module, "__port_stub__", 1);
|
||||
AddStubConstants_chat(module);
|
||||
}
|
||||
{
|
||||
PyObject* module = Py_InitModule("chr", methods_chr);
|
||||
PyModule_AddIntConstant(module, "__port_stub__", 1);
|
||||
|
||||
@@ -12,12 +12,31 @@
|
||||
#include "UserInterface/PythonPlayer.h"
|
||||
#include "GameLib/FlyingObjectManager.h"
|
||||
#include "EffectLib/EffectManager.h"
|
||||
#include "GameLib/ItemManager.h"
|
||||
#include "UserInterface/PythonCharacterManager.h"
|
||||
#include "UserInterface/PythonItem.h"
|
||||
#include "UserInterface/PythonShop.h"
|
||||
#include "UserInterface/PythonExchange.h"
|
||||
#include "UserInterface/PythonChat.h"
|
||||
#include "UserInterface/PythonTextTail.h"
|
||||
#include "UserInterface/PythonNonPlayer.h"
|
||||
#include "UserInterface/PythonMiniMap.h"
|
||||
#include "UserInterface/PythonEventManager.h"
|
||||
#include "UserInterface/PythonBackground.h"
|
||||
#include "UserInterface/PythonQuest.h"
|
||||
#include "UserInterface/PythonMessenger.h"
|
||||
#include "UserInterface/PythonSafeBox.h"
|
||||
#include "UserInterface/PythonGuild.h"
|
||||
#include "UserInterface/AbstractApplication.h"
|
||||
#include "UserInterface/PythonApplication.h"
|
||||
#include "EterBase/Timer.h"
|
||||
#include "PythonBoot.h"
|
||||
#include "PythonHost.h"
|
||||
#include "../EterLib/UIRenderCommands.h"
|
||||
#include "../EterBase/LogBox.h"
|
||||
|
||||
#include <condition_variable>
|
||||
#include <cstdlib>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <pthread.h>
|
||||
@@ -39,6 +58,61 @@ std::unique_ptr<CAccountConnector> g_account_connector;
|
||||
std::unique_ptr<CPythonPlayer> g_player;
|
||||
std::unique_ptr<CFlyingManager> g_flying_manager;
|
||||
std::unique_ptr<CEffectManager> g_effect_manager;
|
||||
// PORT: CPythonApplication is not constructed by the Godot host yet. GamePhase calls the
|
||||
// 40250 IAbstractApplication singleton, so expose the host's current timer and camera surface.
|
||||
class GameApplicationAdapter final : public IAbstractApplication
|
||||
{
|
||||
public:
|
||||
void GetMousePosition(POINT* point) override { if (point) *point = {}; }
|
||||
float GetGlobalTime() override { return CTimer::Instance().GetCurrentSecond(); }
|
||||
float GetGlobalElapsedTime() override { return CTimer::Instance().GetElapsedSecond(); }
|
||||
void SkipRenderBuffering(DWORD) override {}
|
||||
void SetServerTime(time_t) override {}
|
||||
void SetCenterPosition(float x, float y, float z) override
|
||||
{
|
||||
CPythonApplication::Instance().SetCenterPosition(x, y, z);
|
||||
}
|
||||
void SetEventCamera(const SCameraSetting& setting) override
|
||||
{
|
||||
CPythonApplication::Instance().SetEventCamera(setting);
|
||||
}
|
||||
void BlendEventCamera(const SCameraSetting&, float) override {}
|
||||
void SetDefaultCamera() override { CPythonApplication::Instance().SetDefaultCamera(); }
|
||||
void RunIMEUpdate() override {}
|
||||
void RunIMETabEvent() override {}
|
||||
void RunIMEReturnEvent() override {}
|
||||
void RunIMEChangeCodePage() override {}
|
||||
void RunIMEOpenCandidateListEvent() override {}
|
||||
void RunIMECloseCandidateListEvent() override {}
|
||||
void RunIMEOpenReadingWndEvent() override {}
|
||||
void RunIMECloseReadingWndEvent() override {}
|
||||
};
|
||||
std::unique_ptr<GameApplicationAdapter> g_game_application;
|
||||
// The CPythonApplication members the game phase reaches through Instance() (批次 2V2), in 40250's member
|
||||
// order. All are platform/pending stand-ins so far: their stub constructors leave scalar members unset, so
|
||||
// the object is built in zeroed storage and inline header accessors read null/0 rather than garbage.
|
||||
struct GameSingletons
|
||||
{
|
||||
static void* operator new(size_t size) { return std::calloc(1, size); }
|
||||
static void operator delete(void* p) { std::free(p); }
|
||||
|
||||
CItemManager kItemMgr;
|
||||
CPythonCharacterManager kChrMgr;
|
||||
CPythonItem pyItem;
|
||||
CPythonShop pyShop;
|
||||
CPythonExchange pyExchange;
|
||||
CPythonChat pyChat;
|
||||
CPythonTextTail pyTextTail;
|
||||
CPythonNonPlayer pyNonPlayer;
|
||||
CPythonMiniMap pyMiniMap;
|
||||
CPythonEventManager pyEventManager;
|
||||
CPythonBackground pyBackground;
|
||||
CPythonQuest pyQuest;
|
||||
CPythonMessenger pyManager;
|
||||
CPythonSafeBox pySafeBox;
|
||||
CPythonGuild pyGuild;
|
||||
};
|
||||
std::unique_ptr<GameSingletons> g_game_singletons;
|
||||
|
||||
bool fail(std::string* error, const std::string& text)
|
||||
{
|
||||
@@ -225,6 +299,8 @@ bool Start(const char* stdlib_path, std::string* error)
|
||||
g_player = std::make_unique<CPythonPlayer>();
|
||||
g_flying_manager = std::make_unique<CFlyingManager>();
|
||||
g_effect_manager = std::make_unique<CEffectManager>();
|
||||
g_game_application = std::make_unique<GameApplicationAdapter>();
|
||||
g_game_singletons = std::make_unique<GameSingletons>();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -245,6 +321,7 @@ bool run_main_script_body(const char* lpCmdLine, std::string* error)
|
||||
initgrpText();
|
||||
initwndMgr();
|
||||
initapp();
|
||||
initChat();
|
||||
initnet();
|
||||
init_2v0_gameplay_stubs();
|
||||
|
||||
@@ -411,6 +488,8 @@ void Stop()
|
||||
// 40250 Main(): pyLauncher.Clear() runs before app->Destroy()/delete app, so the window manager
|
||||
// (a CPythonApplication member) is still alive while Py_Finalize runs the windows' __del__.
|
||||
g_launcher->Clear();
|
||||
g_game_singletons.reset();
|
||||
g_game_application.reset();
|
||||
g_effect_manager.reset();
|
||||
g_flying_manager.reset();
|
||||
g_player.reset();
|
||||
|
||||
@@ -169,15 +169,11 @@ void CMovieMan::PlayLogo(const char*) { MT_PLATFORM_STUB(); }
|
||||
float GetDegreeDifference(float, float) { MT_PLATFORM_STUB(); return 0; }
|
||||
int GetRotatingDirection(float, float) { MT_PLATFORM_STUB(); return 0; }
|
||||
|
||||
BOOL HAIR_COLOR_ENABLE = FALSE;
|
||||
BOOL PERF_CHECKER_RENDER_GAME = FALSE;
|
||||
BOOL RIDE_HORSE_ENABLE = FALSE;
|
||||
BOOL SKILL_EFFECT_UPGRADE_ENABLE = FALSE;
|
||||
BOOL USE_ARMOR_SPECULAR = FALSE;
|
||||
BOOL USE_WEAPON_SPECULAR = FALSE;
|
||||
D3DXCOLOR g_fSpecularColor;
|
||||
double g_specularSpd = 0;
|
||||
int g_iAccumulationTime = 0;
|
||||
|
||||
bool LoadLocaleData(const char*) { MT_PLATFORM_STUB(); return false; }
|
||||
void SetGuildSymbolPath(const char*) { MT_PLATFORM_STUB(); }
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
// Stand-in for the 40250 logic unit EterLib/AttributeInstance.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 "EterLib/StdAfx.h"
|
||||
#include "EterLib/AttributeInstance.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
auto CAttributeInstance::Clear() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CAttributeInstance::GetHeight(float, float, float *) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CAttributeInstance::Delete(CAttributeInstance *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Stand-in for the 40250 logic unit EterLib/CollisionData.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 "EterLib/StdAfx.h"
|
||||
#include "EterLib/CollisionData.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
auto CSphereCollisionInstance::GetAttribute() -> TSphereData &
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return m_attribute;
|
||||
}
|
||||
|
||||
auto CSphereCollisionInstance::GetAttribute() const -> const TSphereData & { return m_attribute; }
|
||||
auto CSphereCollisionInstance::Render(D3DFILLMODE) -> void { MT_PLATFORM_STUB(); }
|
||||
auto CSphereCollisionInstance::OnDestroy() -> void { MT_PLATFORM_STUB(); }
|
||||
auto CSphereCollisionInstance::OnMovementCollisionDynamicSphere(const CDynamicSphereInstance&) const -> bool
|
||||
{ MT_PLATFORM_STUB(); return false; }
|
||||
auto CSphereCollisionInstance::OnCollisionDynamicSphere(const CDynamicSphereInstance&) const -> bool
|
||||
{ MT_PLATFORM_STUB(); return false; }
|
||||
auto CSphereCollisionInstance::OnGetCollisionMovementAdjust(const CDynamicSphereInstance&) const -> D3DXVECTOR3
|
||||
{ MT_PLATFORM_STUB(); return D3DXVECTOR3(0, 0, 0); }
|
||||
@@ -0,0 +1,565 @@
|
||||
// Stand-in for the 40250 logic unit GameLib/ActorInstance.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 "GameLib/StdAfx.h"
|
||||
#include "GameLib/ActorInstance.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
auto CActorInstance::IEventHandler::GetEmptyPtr() -> IEventHandler *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<IEventHandler *>();
|
||||
}
|
||||
|
||||
auto CActorInstance::IsDirLine() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetMaterialColor(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetEventHandler(IEventHandler *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetRace(DWORD) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetHair(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetVirtualID(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetShape(DWORD, float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::ChangeMaterial(const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::GetRace() -> DWORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<DWORD>();
|
||||
}
|
||||
|
||||
auto CActorInstance::GetVirtualID() -> DWORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<DWORD>();
|
||||
}
|
||||
|
||||
auto CActorInstance::CanAct() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::CanMove() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::CanAttack() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::CanUseSkill() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::AttachWeapon(DWORD, DWORD, DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::RefreshActorInstance() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::GetPartItemID(DWORD) -> DWORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<DWORD>();
|
||||
}
|
||||
|
||||
auto CActorInstance::UpdateAttachingInstances() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetMotionMode(int) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::GetMotionMode() -> int
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<int>();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetLoopMotion(DWORD, float, float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::InterceptOnceMotion(DWORD, float, UINT, float) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::InterceptLoopMotion(DWORD, float) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::IsPushing() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::IsUsingSkill() -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CActorInstance::CanCancelSkill() -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CActorInstance::UpdatePointInstance() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::TestCollisionWithDynamicSphere(const CDynamicSphereInstance &) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::UpdateAdvancingPointInstance() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::AvoidObject(const CGraphicObjectInstance &) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::IsBlockObject(const CGraphicObjectInstance &) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::BlockMovement() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::TestPhysicsBlendingCollision(CActorInstance &) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CActorInstance::isAttacking() -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CActorInstance::IsUsingMovingSkill() -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CActorInstance::IsActEmotion() -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetBlendingPosition(const TPixelPosition &, float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetBattleHitEffect(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::GetMovementVectorRef() -> const D3DXVECTOR3 &
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<const D3DXVECTOR3 &>();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetCurPixelPosition(const TPixelPosition &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::NEW_SetSrcPixelPosition(const TPixelPosition &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::NEW_SetDstPixelPosition(const TPixelPosition &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::NEW_SetDstPixelPositionZ(float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::NEW_GetCurPixelPositionRef() -> const TPixelPosition &
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<const TPixelPosition &>();
|
||||
}
|
||||
|
||||
auto CActorInstance::NEW_GetSrcPixelPositionRef() -> const TPixelPosition &
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<const TPixelPosition &>();
|
||||
}
|
||||
|
||||
auto CActorInstance::NEW_GetDstPixelPositionRef() -> const TPixelPosition &
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<const TPixelPosition &>();
|
||||
}
|
||||
|
||||
auto CActorInstance::NEW_GetLastPixelPositionRef() -> const TPixelPosition &
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<const TPixelPosition &>();
|
||||
}
|
||||
|
||||
auto CActorInstance::GetPixelPosition(TPixelPosition *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::GetRotation() -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
|
||||
auto CActorInstance::GetTargetRotation() -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
|
||||
auto CActorInstance::GetAdvancingRotation() -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetRotation(float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetAdvancingRotation(float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::RestoreRenderMode() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetBlendRenderMode() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetAlphaValue(float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::GetAlphaValue() -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
|
||||
auto CActorInstance::BlendAlphaValue(float, float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetAddRenderMode() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetAddColor(const D3DXCOLOR &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetModulateRenderMode() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetRenderMode(int) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::RenderTrace() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::RenderCollisionData() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::RenderToShadowMap() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::UpdateAttribute() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::CanFishing() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::IsFishing() -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CActorInstance::OnGetFlyTargetPosition() -> D3DXVECTOR3
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<D3DXVECTOR3>();
|
||||
}
|
||||
|
||||
auto CActorInstance::OnShootDamage() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::AddFlyTarget(const CFlyTarget &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::SetFlyTarget(const CFlyTarget &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::CanChangeTarget() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::HORSE_MotionProcess(BOOL) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::MotionProcess(BOOL) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::RotationProcess() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::ComboProcess() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::ShakeProcess() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::TraceProcess() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::OnRender() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::__ClearAttachingEffect() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::__ClearCombo() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::__ClearMotion() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::__IsWaitMotion() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::__IsMoveMotion() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::__IsDamageMotion() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::__IsKnockDownMotion() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::__IsDieMotion() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::__GetCurrentMotionIndex() -> WORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<WORD>();
|
||||
}
|
||||
|
||||
auto CActorInstance::__DestroyWeaponTrace() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::__InitializePositionData() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::__OnSyncing() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::__OnWaiting() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::__OnMoving() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::EnableSkipCollision() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::DisableSkipCollision() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::__InitializeCollisionData() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::__BlendAlpha_Initialize() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::__BlendAlpha_Update() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::__IsSyncing() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CActorInstance::__OnStop() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CActorInstance::TEMP_Push(int, int) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
// Stand-in for the 40250 logic unit GameLib/FlyTarget.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 "GameLib/StdAfx.h"
|
||||
#include "GameLib/FlyTarget.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
CFlyTarget::CFlyTarget(IFlyTargetableObject *)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CFlyTarget::CFlyTarget(const D3DXVECTOR3 &)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CFlyTarget::~CFlyTarget()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CFlyTarget::CFlyTarget()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CFlyTarget::NotifyTargetClear() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
// Stand-in for the 40250 logic unit GameLib/ItemData.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 "GameLib/StdAfx.h"
|
||||
#include "GameLib/ItemData.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
auto CItemData::GetName() const -> const char *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<const char *>();
|
||||
}
|
||||
|
||||
auto CItemData::GetType() const -> BYTE
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BYTE>();
|
||||
}
|
||||
|
||||
auto CItemData::GetValue(BYTE) const -> long
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<long>();
|
||||
}
|
||||
|
||||
auto CItemData::GetIndex() const -> DWORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<DWORD>();
|
||||
}
|
||||
|
||||
auto CItemData::GetSubType() const -> BYTE
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BYTE>();
|
||||
}
|
||||
|
||||
auto CItemData::GetRefine() const -> UINT
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<UINT>();
|
||||
}
|
||||
|
||||
auto CItemData::GetWeaponType() const -> DWORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<DWORD>();
|
||||
}
|
||||
|
||||
auto CItemData::GetSocketCount() const -> int
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<int>();
|
||||
}
|
||||
|
||||
auto CItemData::GetSpecularPowerf() const -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// Stand-in for the 40250 logic unit GameLib/ItemManager.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 "GameLib/StdAfx.h"
|
||||
#include "GameLib/ItemManager.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
CItemManager::CItemManager()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CItemManager::~CItemManager()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CItemManager::GetItemDataPointer(DWORD, CItemData **) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
// Stand-in for the 40250 logic unit GameLib/MapManager.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 "GameLib/StdAfx.h"
|
||||
#include "GameLib/MapManager.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
auto CMapManager::GetHeight(float, float) -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
|
||||
CMapManager::CMapManager()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CMapManager::~CMapManager()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CMapManager::Clear() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CMapManager::AllocMap() -> CMapBase *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CMapBase *>();
|
||||
}
|
||||
|
||||
auto CMapManager::LoadMap(const std::string &, float, float, float) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CMapManager::isPhysicalCollision(const D3DXVECTOR3 &) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CMapManager::GetWaterHeight(int, int, long *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CMapManager::GetShadowMapColor(float, float) -> DWORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<DWORD>();
|
||||
}
|
||||
|
||||
auto CMapManager::isAttrOn(float, float, BYTE) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CMapManager::isAttrOn(int, int, BYTE) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Pending MapType.cpp dependency of InstanceBase; the full unit is not ported yet.
|
||||
#include "GameLib/StdAfx.h"
|
||||
#include "GameLib/MapType.h"
|
||||
|
||||
float SPixelPosition_CalculateDistanceSq3d(const TPixelPosition& left, const TPixelPosition& right)
|
||||
{
|
||||
float dx = left.x - right.x;
|
||||
float dy = left.y - right.y;
|
||||
float dz = left.z - right.z;
|
||||
return dx * dx + dy * dy + dz * dz;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// Pending MapUtil.cpp dependency of the physics object. The interpolation unit remains 2V3 work.
|
||||
#include "GameLib/StdAfx.h"
|
||||
#include "GameLib/MapUtil.h"
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
CEaseOutInterpolation::CEaseOutInterpolation() { MT_PLATFORM_STUB(); }
|
||||
CEaseOutInterpolation::~CEaseOutInterpolation() { MT_PLATFORM_STUB(); }
|
||||
@@ -0,0 +1,43 @@
|
||||
// Stand-in for the 40250 logic unit GameLib/PhysicsObject.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 "GameLib/StdAfx.h"
|
||||
#include "GameLib/PhysicsObject.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
decltype(IObjectManager::ms_ObjManager) IObjectManager::ms_ObjManager{};
|
||||
|
||||
decltype(IPhysicsWorld::ms_pWorld) IPhysicsWorld::ms_pWorld{};
|
||||
|
||||
CPhysicsObject::CPhysicsObject()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CPhysicsObject::~CPhysicsObject()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPhysicsObject::Initialize() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPhysicsObject::Update(float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPhysicsObject::GetXMovement() -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
|
||||
auto CPhysicsObject::GetYMovement() -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
// Stand-in for the 40250 logic unit GameLib/PropertyManager.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 "GameLib/StdAfx.h"
|
||||
#include "GameLib/PropertyManager.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
CPropertyManager::CPropertyManager()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CPropertyManager::~CPropertyManager()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// Stand-in for the 40250 logic unit GameLib/RaceData.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 "GameLib/StdAfx.h"
|
||||
#include "GameLib/RaceData.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
auto CRaceData::GetNormalAttackIndex(WORD, WORD *) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// Pending GameType.cpp dependency of InstanceBase; the full unit is not ported yet.
|
||||
#include "UserInterface/StdAfx.h"
|
||||
#include "UserInterface/GameType.h"
|
||||
|
||||
std::string g_strGuildSymbolPathName = "mark/10/";
|
||||
|
||||
const char* GetGuildSymbolFileName(DWORD dwGuildID)
|
||||
{
|
||||
return _getf("%s%03d.jpg", g_strGuildSymbolPathName.c_str(), dwGuildID);
|
||||
}
|
||||
@@ -0,0 +1,389 @@
|
||||
// Stand-in for the 40250 logic unit UserInterface/InstanceBase.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/InstanceBase.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
auto CInstanceBase::RegisterEffect(UINT, const char *, const char *, bool) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CInstanceBase::__AttachEffect(UINT) -> DWORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<DWORD>();
|
||||
}
|
||||
|
||||
auto CInstanceBase::__DetachEffect(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::CreateSpecialEffect(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::AttachSpecialEffect(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
decltype(CInstanceBase::ms_adwCRCAffectEffect) CInstanceBase::ms_adwCRCAffectEffect{};
|
||||
|
||||
decltype(CInstanceBase::ms_fDustGap) CInstanceBase::ms_fDustGap{};
|
||||
|
||||
decltype(CInstanceBase::ms_fHorseDustGap) CInstanceBase::ms_fHorseDustGap{};
|
||||
|
||||
auto CInstanceBase::DeleteBlendOut() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::AttachTextTail() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::DetachTextTail() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::UpdateTextTailLevel(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::RefreshTextTail() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::RefreshTextTailTitle() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::UpdateDeleting() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CInstanceBase::ActDualEmotion(CInstanceBase &, WORD, WORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::ActEmotion(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::LevelUp() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::SkillUp() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::Stun() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::Die() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::IsPVPInstance(CInstanceBase &) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CInstanceBase::IsAffect(UINT) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CInstanceBase::SetEventHandler(CActorInstance::IEventHandler *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::NEW_UseSkill(UINT, UINT, UINT, bool) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CInstanceBase::NEW_GetDistanceFromDestPixelPosition(const TPixelPosition &) -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
|
||||
auto CInstanceBase::NEW_GetDistanceFromDestInstance(CInstanceBase &) -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
|
||||
auto CInstanceBase::NEW_SetPixelPosition(const TPixelPosition &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::RunNormalAttack(float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::RunComboAttack(float, DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::CheckAdvancing() -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CInstanceBase::StartFishing(float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::StopFishing() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::ReactFishing() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::CatchSuccess() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::CatchFail() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::SCRIPT_SetPixelPosition(float, float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::NEW_GetPixelPosition(TPixelPosition *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::NEW_LookAtDestInstance(CInstanceBase &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::GetRotation() -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
|
||||
auto CInstanceBase::GetAdvancingRotation() -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
|
||||
auto CInstanceBase::SetRotation(float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::BlendRotation(float, float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::SetMotionMode(int) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::PushOnceMotion(WORD, float, float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::__ClearAffects() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::SetAffectFlagContainer(const CAffectFlagContainer &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::SetEmoticon(UINT) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::SetFishEmoticon() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::__EnableChangingTCPState() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::__ComboProcess() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::AttackProcess() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::__AttachSelectEffect() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::__DetachSelectEffect() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::__AttachTargetEffect() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::__DetachTargetEffect() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::__AttachEmpireEffect(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::__EffectContainer_Initialize() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::__EffectContainer_Destroy() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::__StoneSmoke_Inialize() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::__StoneSmoke_Destroy() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::ProcessDamage() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::AddDamageEffect(DWORD, BYTE, BOOL, BOOL) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::ClearPVPKeySystem() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::InsertPVPKey(DWORD, DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::RemovePVPKey(DWORD, DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::InsertGVGKey(DWORD, DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::RemoveGVGKey(DWORD, DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::InsertDUELKey(DWORD, DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CInstanceBase::__FindDUELKey(DWORD, DWORD) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CInstanceBase::GetEventHandlerRef() -> CActorInstance::IEventHandler &
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CActorInstance::IEventHandler &>();
|
||||
}
|
||||
|
||||
auto CInstanceBase::IsUsingSkill() -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CInstanceBase::isLock() -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CInstanceBase::__EffectContainer_AttachEffect(DWORD) -> DWORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<DWORD>();
|
||||
}
|
||||
|
||||
auto CInstanceBase::__EffectContainer_DetachEffect(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
@@ -1,177 +0,0 @@
|
||||
// Stand-in for the 40250 logic unit UserInterface/NetworkActorManager.cpp, not ported yet: the platform_stub.py skeleton of its
|
||||
// header, so the units that call it (批次 2V1, the network slice) link. Delete this file in the commit
|
||||
// that ports the unit into port/ (docs/PORT-PLAN.md 2V1).
|
||||
#include "UserInterface/StdAfx.h"
|
||||
#include "UserInterface/NetworkActorManager.h"
|
||||
#include "UserInterface/PythonCharacterManager.h" // the __GetCharacterManager return type
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
SNetworkActorData::SNetworkActorData()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto SNetworkActorData::SetDstPosition(DWORD, LONG, LONG, DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto SNetworkActorData::SetPosition(LONG, LONG) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto SNetworkActorData::UpdatePosition() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
SNetworkActorData::SNetworkActorData(const SNetworkActorData &)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto SNetworkActorData::operator=(const SNetworkActorData &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto SNetworkActorData::__copy__(const SNetworkActorData &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CNetworkActorManager::CNetworkActorManager()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CNetworkActorManager::~CNetworkActorManager()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::Destroy() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::SetMainActorVID(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::RemoveActor(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::AppendActor(const SNetworkActorData &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::UpdateActor(const SNetworkUpdateActorData &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::MoveActor(const SNetworkMoveActorData &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::SyncActor(DWORD, LONG, LONG) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::SetActorOwner(DWORD, DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::Update() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::__OLD_Update() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::__UpdateMainActor() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::__IsVisiblePos(LONG, LONG) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::__IsVisibleActor(const SNetworkActorData &) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::__IsMainActorVID(DWORD) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::__RemoveAllGroundItems() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::__RemoveAllActors() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::__RemoveDynamicActors() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::__RemoveCharacterManagerActor(SNetworkActorData &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::__FindActorData(DWORD) -> SNetworkActorData *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<SNetworkActorData *>();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::__AppendCharacterManagerActor(SNetworkActorData &) -> CInstanceBase *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CInstanceBase *>();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::__FindActor(SNetworkActorData &) -> CInstanceBase *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CInstanceBase *>();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::__FindActor(SNetworkActorData &, LONG, LONG) -> CInstanceBase *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CInstanceBase *>();
|
||||
}
|
||||
|
||||
auto CNetworkActorManager::__GetCharacterManager() -> CPythonCharacterManager &
|
||||
{
|
||||
// PORT: the 40250 body (NetworkActorManager.cpp:310-313); a stub's default reference would construct a
|
||||
// character manager.
|
||||
return CPythonCharacterManager::Instance();
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
// Stand-in for the 40250 logic unit UserInterface/PythonBackground.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/PythonBackground.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
auto CPythonBackground::Destroy() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonBackground::Create() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonBackground::GlobalPositionToLocalPosition(LONG &, LONG &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonBackground::LocalPositionToGlobalPosition(LONG &, LONG &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonBackground::RefreshShadowLevel() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonBackground::Update(float, float, float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonBackground::ClearGuildArea() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonBackground::RegisterGuildArea(int, int, int, int) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonBackground::CreateTargetEffect(DWORD, DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonBackground::CreateTargetEffect(DWORD, long, long) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonBackground::DeleteTargetEffect(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonBackground::Warp(DWORD, DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonBackground::GetWarpMapName() -> const char *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
// PORT: Keep the not-yet-ported map lookup safe for GamePhase's ShowMapName call.
|
||||
return "";
|
||||
}
|
||||
|
||||
CPythonBackground::CPythonBackground()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CPythonBackground::~CPythonBackground()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonBackground::CheckAdvancing(CInstanceBase *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// Stand-in for the 40250 logic unit UserInterface/PythonEventManager.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/PythonEventManager.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
CPythonEventManager::CPythonEventManager()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CPythonEventManager::~CPythonEventManager()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonEventManager::RegisterEventSetFromString(const std::string &) -> int
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<int>();
|
||||
}
|
||||
|
||||
auto CPythonEventManager::SetVisibleLineCount(int, int) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
// Stand-in for the 40250 logic unit UserInterface/PythonExchange.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/PythonExchange.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
CPythonExchange::CPythonExchange()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CPythonExchange::~CPythonExchange()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonExchange::Clear() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonExchange::Start() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonExchange::End() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonExchange::isTrading() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CPythonExchange::SetSelfName(const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonExchange::SetTargetName(const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonExchange::SetElkToTarget(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonExchange::SetElkToSelf(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonExchange::SetItemToTarget(DWORD, DWORD, BYTE) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonExchange::SetItemToSelf(DWORD, DWORD, BYTE) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonExchange::SetItemMetinSocketToTarget(int, int, DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonExchange::SetItemMetinSocketToSelf(int, int, DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonExchange::SetItemAttributeToTarget(int, int, BYTE, short) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonExchange::SetItemAttributeToSelf(int, int, BYTE, short) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonExchange::DelItemOfTarget(BYTE) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonExchange::DelItemOfSelf(BYTE) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonExchange::SetAcceptToTarget(BYTE) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonExchange::SetAcceptToSelf(BYTE) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
@@ -11,3 +11,123 @@ BOOL CPythonGuild::GetMemberDataPtrByName(const char *, TGuildMemberData **)
|
||||
MT_PLATFORM_STUB();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
auto CPythonGuild::Destroy() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonGuild::EnableGuild() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonGuild::SetGuildMoney(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonGuild::SetGuildEXP(BYTE, DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonGuild::SetGradeData(BYTE, TGuildGradeData &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonGuild::SetGradeName(BYTE, const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonGuild::SetGradeAuthority(BYTE, BYTE) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonGuild::ClearComment() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonGuild::RegisterComment(DWORD, const char *, const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonGuild::RegisterMember(TGuildMemberData &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonGuild::ChangeGuildMemberGrade(DWORD, BYTE) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonGuild::ChangeGuildMemberGeneralFlag(DWORD, BYTE) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonGuild::RemoveMember(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonGuild::RegisterGuildName(DWORD, const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonGuild::IsMainPlayer(DWORD) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CPythonGuild::GetGuildInfoRef() -> TGuildInfo &
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<TGuildInfo &>();
|
||||
}
|
||||
|
||||
auto CPythonGuild::GetMemberDataPtrByPID(DWORD, TGuildMemberData **) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CPythonGuild::GetGuildSkillDataRef() -> TGuildSkillData &
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<TGuildSkillData &>();
|
||||
}
|
||||
|
||||
auto CPythonGuild::GetGuildName(DWORD, std::string *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CPythonGuild::StartGuildWar(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonGuild::EndGuildWar(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CPythonGuild::CPythonGuild()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CPythonGuild::~CPythonGuild()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
// 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();
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
// Stand-in for the 40250 logic unit UserInterface/PythonMessenger.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/PythonMessenger.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
CPythonMessenger::CPythonMessenger()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CPythonMessenger::~CPythonMessenger()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonMessenger::OnFriendLogin(const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonMessenger::OnFriendLogout(const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonMessenger::SetMobile(const char *, BYTE) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonMessenger::AppendGuildMember(const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonMessenger::RemoveGuildMember(const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonMessenger::RemoveAllGuildMember() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonMessenger::LoginGuildMember(const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonMessenger::LogoutGuildMember(const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// 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();
|
||||
}
|
||||
@@ -1,335 +0,0 @@
|
||||
// Stand-in for the 40250 logic unit UserInterface/PythonNetworkStreamPhaseGame.cpp, not ported yet: the CPythonNetworkStream
|
||||
// members it defines that the ported network slice (批次 2V1) references, as MT_PLATFORM_STUB()s. Delete this
|
||||
// file in the commit that ports the unit into port/ (docs/PORT-PLAN.md 2V1).
|
||||
#include "UserInterface/StdAfx.h"
|
||||
#include "UserInterface/PythonNetworkStream.h"
|
||||
#include "EterBase/Filename.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
BOOL gs_bEmpireLanuageEnable = TRUE;
|
||||
|
||||
void CPythonNetworkStream::GamePhase()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
// PORT: consumes the packet only, so the loading phase keeps reading; the handler body comes with the unit.
|
||||
bool CPythonNetworkStream::RecvPointChange()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
TPacketGCPointChange PointChange;
|
||||
return Recv(sizeof(PointChange), &PointChange);
|
||||
}
|
||||
|
||||
void CPythonNetworkStream::RegisterEmoticonString(const char *)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendAnswerMakeGuildPacket(const char *)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendCharacterPositionPacket(BYTE)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendChatPacket(const char *, BYTE)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
// PORT: the 40250 body verbatim ahead of its unit: the loading phase sends it on the main-character packet.
|
||||
bool CPythonNetworkStream::SendClientVersionPacket()
|
||||
{
|
||||
std::string filename;
|
||||
|
||||
GetExcutedFileName(filename);
|
||||
|
||||
filename = CFileNameHelper::NoPath(filename);
|
||||
CFileNameHelper::ChangeDosPath(filename);
|
||||
|
||||
if (LocaleService_IsEUROPE() && false == LocaleService_IsYMIR())
|
||||
{
|
||||
TPacketCGClientVersion2 kVersionPacket;
|
||||
kVersionPacket.header = HEADER_CG_CLIENT_VERSION2;
|
||||
strncpy(kVersionPacket.filename, filename.c_str(), sizeof(kVersionPacket.filename)-1);
|
||||
strncpy(kVersionPacket.timestamp, "1215955205", sizeof(kVersionPacket.timestamp)-1); // # python time.time 앞자리
|
||||
//strncpy(kVersionPacket.timestamp, __TIMESTAMP__, sizeof(kVersionPacket.timestamp)-1); // old_string_ver
|
||||
//strncpy(kVersionPacket.timestamp, "1218055205", sizeof(kVersionPacket.timestamp)-1); // new_future
|
||||
//strncpy(kVersionPacket.timestamp, "1214055205", sizeof(kVersionPacket.timestamp)-1); // old_past
|
||||
|
||||
if (!Send(sizeof(kVersionPacket), &kVersionPacket))
|
||||
Tracef("SendClientReportPacket Error");
|
||||
}
|
||||
else
|
||||
{
|
||||
TPacketCGClientVersion kVersionPacket;
|
||||
kVersionPacket.header = HEADER_CG_CLIENT_VERSION;
|
||||
strncpy(kVersionPacket.filename, filename.c_str(), sizeof(kVersionPacket.filename)-1);
|
||||
strncpy(kVersionPacket.timestamp, __TIMESTAMP__, sizeof(kVersionPacket.timestamp)-1);
|
||||
|
||||
if (!Send(sizeof(kVersionPacket), &kVersionPacket))
|
||||
Tracef("SendClientReportPacket Error");
|
||||
}
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendExchangeAcceptPacket()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendExchangeElkAddPacket(DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendExchangeExitPacket()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendExchangeItemAddPacket(TItemPos, BYTE)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendExchangeItemDelPacket(BYTE)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendExchangeStartPacket(DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendGiveItemPacket(DWORD, TItemPos, int)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendGuildAddMemberPacket(DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendGuildChangeGradeAuthorityPacket(BYTE, BYTE)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendGuildChangeGradeNamePacket(BYTE, const char *)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendGuildChangeMemberGeneralPacket(DWORD, BYTE)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendGuildChangeMemberGradePacket(DWORD, BYTE)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendGuildChargeGSPPacket(DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendGuildDeleteCommentPacket(DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendGuildDepositMoneyPacket(DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendGuildInviteAnswerPacket(DWORD, BYTE)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendGuildOfferPacket(DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendGuildPostCommentPacket(const char *)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendGuildRefreshCommentsPacket(DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendGuildRemoveMemberPacket(DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendGuildUseSkillPacket(DWORD, DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendGuildWithdrawMoneyPacket(DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendMessengerAddByNamePacket(const char *)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendMessengerAddByVIDPacket(DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendMessengerRemovePacket(const char *, const char *)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendMobileMessagePacket(const char *, const char *)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendOnClickPacket(DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendPartyInviteAnswerPacket(DWORD, BYTE)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendPartyInvitePacket(DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendPartyParameterPacket(BYTE)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendPartyRemovePacket(DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendPartySetStatePacket(DWORD, BYTE, BYTE)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendPartyUseSkillPacket(BYTE, DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendQuestConfirmPacket(BYTE, DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendQuestInputStringPacket(const char *)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendRefinePacket(BYTE, BYTE)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendSelectItemPacket(DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendWhisperPacket(const char *, const char *)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
void CPythonNetworkStream::SetGamePhase()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
void CPythonNetworkStream::ToggleGameDebugInfo()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
void CPythonNetworkStream::Warp(LONG, LONG)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
void CPythonNetworkStream::__InitializeGamePhase()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
void CPythonNetworkStream::__TEST_SetSkillGroupFake(int)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
// Stand-in for the 40250 logic unit UserInterface/PythonNetworkStreamPhaseGameActor.cpp, not ported yet: the CPythonNetworkStream
|
||||
// members it defines that the ported network slice (批次 2V1) references, as MT_PLATFORM_STUB()s. Delete this
|
||||
// file in the commit that ports the unit into port/ (docs/PORT-PLAN.md 2V1).
|
||||
#include "UserInterface/StdAfx.h"
|
||||
#include "UserInterface/PythonNetworkStream.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
// PORT: consumes the packet only, so the loading phase keeps reading; the handler body comes with the unit.
|
||||
bool CPythonNetworkStream::RecvCharacterUpdatePacket()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
TPacketGCCharacterUpdate chrUpdatePacket;
|
||||
return Recv(sizeof(chrUpdatePacket), &chrUpdatePacket);
|
||||
}
|
||||
@@ -1,113 +0,0 @@
|
||||
// Stand-in for the 40250 logic unit UserInterface/PythonNetworkStreamPhaseGameItem.cpp, not ported yet: the CPythonNetworkStream
|
||||
// members it defines that the ported network slice (批次 2V1) references, as MT_PLATFORM_STUB()s. Delete this
|
||||
// file in the commit that ports the unit into port/ (docs/PORT-PLAN.md 2V1).
|
||||
#include "UserInterface/StdAfx.h"
|
||||
#include "UserInterface/PythonNetworkStream.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
// PORT: consumes the packet only, so the loading phase keeps reading; the handler body comes with the unit.
|
||||
bool CPythonNetworkStream::RecvItemSetPacket()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
TPacketGCItemSet packet_item_set;
|
||||
return Recv(sizeof(packet_item_set), &packet_item_set);
|
||||
}
|
||||
|
||||
// PORT: consumes the packet only, so the loading phase keeps reading; the handler body comes with the unit.
|
||||
bool CPythonNetworkStream::RecvQuickSlotAddPacket()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
TPacketGCQuickSlotAdd packet_quick_slot_add;
|
||||
return Recv(sizeof(packet_quick_slot_add), &packet_quick_slot_add);
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendItemDropPacket(TItemPos, DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendItemDropPacketNew(TItemPos, DWORD, DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendItemMovePacket(TItemPos, TItemPos, BYTE)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendItemPickUpPacket(DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendItemUsePacket(TItemPos)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendItemUseToItemPacket(TItemPos, TItemPos)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendMallCheckoutPacket(BYTE, TItemPos)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendSafeBoxCheckinPacket(TItemPos, BYTE)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendSafeBoxCheckoutPacket(BYTE, TItemPos)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendSafeBoxItemMovePacket(BYTE, BYTE, BYTE)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendSafeBoxMoneyPacket(BYTE, DWORD)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendShopBuyPacket(BYTE)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendShopEndPacket()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendShopSellPacket(BYTE)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendShopSellPacketNew(BYTE, BYTE)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// Stand-in for the 40250 logic unit UserInterface/PythonNonPlayer.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/PythonNonPlayer.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
CPythonNonPlayer::CPythonNonPlayer()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CPythonNonPlayer::~CPythonNonPlayer()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonNonPlayer::GetName(DWORD, const char **) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CPythonNonPlayer::GetInstanceType(DWORD, BYTE *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CPythonNonPlayer::GetEventType(DWORD) -> BYTE
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BYTE>();
|
||||
}
|
||||
|
||||
auto CPythonNonPlayer::GetMonsterColor(DWORD) -> DWORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<DWORD>();
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
// Stand-in for the 40250 logic unit UserInterface/PythonQuest.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/PythonQuest.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
CPythonQuest::CPythonQuest()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CPythonQuest::~CPythonQuest()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonQuest::RegisterQuestInstance(const SQuestInstance &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonQuest::DeleteQuestInstance(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonQuest::IsQuest(DWORD) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CPythonQuest::MakeQuest(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonQuest::SetQuestTitle(DWORD, const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonQuest::SetQuestClockName(DWORD, const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonQuest::SetQuestCounterName(DWORD, const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonQuest::SetQuestClockValue(DWORD, int) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonQuest::SetQuestCounterValue(DWORD, int) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonQuest::SetQuestIconFileName(DWORD, const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
// Stand-in for the 40250 logic unit UserInterface/PythonSafeBox.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/PythonSafeBox.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
CPythonSafeBox::CPythonSafeBox()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CPythonSafeBox::~CPythonSafeBox()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonSafeBox::OpenSafeBox(int) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonSafeBox::SetItemData(DWORD, const TItemData &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonSafeBox::DelItemData(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonSafeBox::SetMoney(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonSafeBox::GetSlotItemID(DWORD, DWORD *) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CPythonSafeBox::OpenMall(int) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonSafeBox::SetMallItemData(DWORD, const TItemData &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonSafeBox::DelMallItemData(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonSafeBox::GetSlotMallItemID(DWORD, DWORD *) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
// Stand-in for the 40250 logic unit UserInterface/PythonShop.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/PythonShop.h"
|
||||
|
||||
#include "../../PlatformStub.h"
|
||||
|
||||
CPythonShop::CPythonShop()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CPythonShop::~CPythonShop()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonShop::Clear() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonShop::SetItemData(DWORD, const TShopItemData &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonShop::SetItemData(BYTE, DWORD, const TShopItemData &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonShop::SetTabCoinType(BYTE, BYTE) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonShop::SetTabName(BYTE, const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CPythonShop::IsOpen() -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// 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();
|
||||
}
|
||||
@@ -0,0 +1,979 @@
|
||||
#include "StdAfx.h"
|
||||
#include "ActorInstance.h"
|
||||
#include "AreaTerrain.h"
|
||||
#include "RaceData.h"
|
||||
#include "../SpeedTreeLib/SpeedTreeForestDirectX8.h"
|
||||
#include "../SpeedTreeLib/SpeedTreeWrapper.h"
|
||||
|
||||
enum
|
||||
{
|
||||
MAIN_RACE_MAX_NUM = 8,
|
||||
};
|
||||
|
||||
void CActorInstance::INSTANCEBASE_Deform()
|
||||
{
|
||||
Deform();
|
||||
TraceProcess();
|
||||
}
|
||||
|
||||
void CActorInstance::INSTANCEBASE_Transform()
|
||||
{
|
||||
if (m_pkHorse)
|
||||
{
|
||||
m_pkHorse->INSTANCEBASE_Transform();
|
||||
|
||||
m_x = m_pkHorse->NEW_GetCurPixelPositionRef().x;
|
||||
m_y = -m_pkHorse->NEW_GetCurPixelPositionRef().y;
|
||||
m_z = m_pkHorse->NEW_GetCurPixelPositionRef().z;
|
||||
m_bNeedUpdateCollision = TRUE;
|
||||
}
|
||||
|
||||
//DWORD t2=ELTimer_GetMSec();
|
||||
Update();
|
||||
//DWORD t3=ELTimer_GetMSec();
|
||||
TransformProcess();
|
||||
//DWORD t4=ELTimer_GetMSec();
|
||||
Transform();
|
||||
//DWORD t5=ELTimer_GetMSec();
|
||||
UpdatePointInstance();
|
||||
//DWORD t6=ELTimer_GetMSec();
|
||||
ShakeProcess();
|
||||
//DWORD t7=ELTimer_GetMSec();
|
||||
UpdateBoundingSphere();
|
||||
//DWORD t8=ELTimer_GetMSec();
|
||||
UpdateAttribute();
|
||||
}
|
||||
|
||||
/*
|
||||
void CActorInstance::TEMP_Update()
|
||||
{
|
||||
//DWORD t1=ELTimer_GetMSec();
|
||||
OnUpdate();
|
||||
//DWORD t2=ELTimer_GetMSec();
|
||||
UpdateBoundingSphere();
|
||||
//DWORD t3=ELTimer_GetMSec();
|
||||
|
||||
#ifdef __PERFORMANCE_CHECKER__
|
||||
{
|
||||
static FILE* fp=fopen("perf_actor_update.txt", "w");
|
||||
|
||||
if (t3-t1>3)
|
||||
{
|
||||
fprintf(fp, "AIU.Total %d (Time %f)\n",
|
||||
t3-t1, ELTimer_GetMSec()/1000.0f);
|
||||
fprintf(fp, "AIU.UP %d\n", t2-t1);
|
||||
fprintf(fp, "AIU.UBS %d\n", t3-t2);
|
||||
fprintf(fp, "-------------------------------- \n");
|
||||
fflush(fp);
|
||||
}
|
||||
fflush(fp);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
|
||||
void CActorInstance::OnUpdate()
|
||||
{
|
||||
#ifdef __PERFORMANCE_CHECKER__
|
||||
DWORD t1=ELTimer_GetMSec();
|
||||
#endif
|
||||
if (!IsParalysis())
|
||||
CGraphicThingInstance::OnUpdate();
|
||||
#ifdef __PERFORMANCE_CHECKER__
|
||||
DWORD t2=ELTimer_GetMSec();
|
||||
#endif
|
||||
|
||||
UpdateAttachingInstances();
|
||||
|
||||
#ifdef __PERFORMANCE_CHECKER__
|
||||
DWORD t3=ELTimer_GetMSec();
|
||||
#endif
|
||||
|
||||
__BlendAlpha_Update();
|
||||
|
||||
#ifdef __PERFORMANCE_CHECKER__
|
||||
DWORD t4=ELTimer_GetMSec();
|
||||
{
|
||||
static FILE* fp=fopen("perf_actor_update2.txt", "w");
|
||||
|
||||
if (t4-t1>3)
|
||||
{
|
||||
fprintf(fp, "AIU2.Total %d (Time %f)\n",
|
||||
t4-t1, ELTimer_GetMSec()/1000.0f);
|
||||
fprintf(fp, "AIU2.GU %d\n", t2-t1);
|
||||
fprintf(fp, "AIU2.UAI %d\n", t3-t2);
|
||||
fprintf(fp, "AIU2.BAU %d\n", t4-t3);
|
||||
fprintf(fp, "-------------------------------- \n");
|
||||
fflush(fp);
|
||||
}
|
||||
fflush(fp);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
// 2004.07.05.myevan. 궁신탄영 맵에 끼이는 문제해결
|
||||
IBackground& CActorInstance::GetBackground()
|
||||
{
|
||||
return IBackground::Instance();
|
||||
}
|
||||
|
||||
|
||||
void CActorInstance::SetMainInstance()
|
||||
{
|
||||
m_isMain=true;
|
||||
}
|
||||
|
||||
void CActorInstance::SetParalysis(bool isParalysis)
|
||||
{
|
||||
m_isParalysis=isParalysis;
|
||||
}
|
||||
|
||||
void CActorInstance::SetFaint(bool isFaint)
|
||||
{
|
||||
m_isFaint=isFaint;
|
||||
}
|
||||
|
||||
void CActorInstance::SetSleep(bool isSleep)
|
||||
{
|
||||
m_isSleep=isSleep;
|
||||
|
||||
Stop();
|
||||
}
|
||||
|
||||
void CActorInstance::SetResistFallen(bool isResistFallen)
|
||||
{
|
||||
m_isResistFallen=isResistFallen;
|
||||
}
|
||||
|
||||
void CActorInstance::SetReachScale(float fScale)
|
||||
{
|
||||
m_fReachScale=fScale;
|
||||
}
|
||||
|
||||
float CActorInstance::__GetReachScale()
|
||||
{
|
||||
return m_fReachScale;
|
||||
}
|
||||
|
||||
float CActorInstance::__GetAttackSpeed()
|
||||
{
|
||||
return m_fAtkSpd;
|
||||
}
|
||||
|
||||
WORD CActorInstance::__GetCurrentComboType()
|
||||
{
|
||||
if (IsBowMode())
|
||||
return 0;
|
||||
if (IsHandMode())
|
||||
return 0;
|
||||
if (__IsMountingHorse())
|
||||
return 0;
|
||||
|
||||
return m_wcurComboType;
|
||||
}
|
||||
|
||||
void CActorInstance::SetComboType(WORD wComboType)
|
||||
{
|
||||
m_wcurComboType = wComboType;
|
||||
}
|
||||
|
||||
void CActorInstance::SetAttackSpeed(float fAtkSpd)
|
||||
{
|
||||
m_fAtkSpd=fAtkSpd;
|
||||
}
|
||||
|
||||
void CActorInstance::SetMoveSpeed(float fMovSpd)
|
||||
{
|
||||
if (m_fMovSpd==fMovSpd)
|
||||
return;
|
||||
|
||||
m_fMovSpd=fMovSpd;
|
||||
|
||||
if (__IsMoveMotion())
|
||||
{
|
||||
Stop();
|
||||
Move();
|
||||
}
|
||||
}
|
||||
|
||||
void CActorInstance::SetFishingPosition(D3DXVECTOR3 & rv3Position)
|
||||
{
|
||||
m_v3FishingPosition = rv3Position;
|
||||
}
|
||||
|
||||
// ActorInstanceMotion.cpp 에 넣도록 하자
|
||||
void CActorInstance::Move()
|
||||
{
|
||||
if (m_isWalking)
|
||||
{
|
||||
SetLoopMotion(CRaceMotionData::NAME_WALK, 0.15f, m_fMovSpd);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetLoopMotion(CRaceMotionData::NAME_RUN, 0.15f, m_fMovSpd);
|
||||
}
|
||||
}
|
||||
|
||||
void CActorInstance::Stop(float fBlendingTime)
|
||||
{
|
||||
__ClearMotion();
|
||||
SetLoopMotion(CRaceMotionData::NAME_WAIT, fBlendingTime);
|
||||
}
|
||||
|
||||
void CActorInstance::SetOwner(DWORD dwOwnerVID)
|
||||
{
|
||||
m_fOwnerBaseTime=GetLocalTime();
|
||||
m_dwOwnerVID=dwOwnerVID;
|
||||
}
|
||||
|
||||
void CActorInstance::SetActorType(UINT eType)
|
||||
{
|
||||
m_eActorType=eType;
|
||||
}
|
||||
|
||||
UINT CActorInstance::GetActorType() const
|
||||
{
|
||||
return m_eActorType;
|
||||
}
|
||||
|
||||
bool CActorInstance::IsHandMode()
|
||||
{
|
||||
if (CRaceMotionData::MODE_GENERAL==GetMotionMode())
|
||||
return true;
|
||||
|
||||
if (CRaceMotionData::MODE_HORSE==GetMotionMode())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CActorInstance::IsTwoHandMode()
|
||||
{
|
||||
if (CRaceMotionData::MODE_TWOHAND_SWORD==GetMotionMode())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CActorInstance::IsBowMode()
|
||||
{
|
||||
if (CRaceMotionData::MODE_BOW==GetMotionMode())
|
||||
return true;
|
||||
|
||||
if (CRaceMotionData::MODE_HORSE_BOW==GetMotionMode())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CActorInstance::IsPoly()
|
||||
{
|
||||
if (TYPE_POLY==m_eActorType)
|
||||
return true;
|
||||
|
||||
if (TYPE_PC==m_eActorType)
|
||||
if (m_eRace >= MAIN_RACE_MAX_NUM)
|
||||
return TRUE;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CActorInstance::IsPC()
|
||||
{
|
||||
if (TYPE_PC==m_eActorType)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CActorInstance::IsNPC()
|
||||
{
|
||||
if (TYPE_NPC==m_eActorType)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CActorInstance::IsEnemy()
|
||||
{
|
||||
if (TYPE_ENEMY==m_eActorType)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CActorInstance::IsStone()
|
||||
{
|
||||
if (TYPE_STONE==m_eActorType)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CActorInstance::IsWarp()
|
||||
{
|
||||
if (TYPE_WARP==m_eActorType)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CActorInstance::IsGoto()
|
||||
{
|
||||
if (TYPE_GOTO==m_eActorType)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CActorInstance::IsBuilding()
|
||||
{
|
||||
if (TYPE_BUILDING==m_eActorType)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CActorInstance::IsDoor()
|
||||
{
|
||||
if (TYPE_DOOR==m_eActorType)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CActorInstance::IsObject()
|
||||
{
|
||||
if (TYPE_OBJECT==m_eActorType)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CActorInstance::DestroySystem()
|
||||
{
|
||||
}
|
||||
|
||||
void CActorInstance::DieEnd()
|
||||
{
|
||||
Die();
|
||||
|
||||
CGraphicThingInstance::SetMotionAtEnd();
|
||||
}
|
||||
|
||||
void CActorInstance::Die()
|
||||
{
|
||||
if (m_isRealDead)
|
||||
return;
|
||||
|
||||
if (__IsMoveMotion())
|
||||
Stop();
|
||||
|
||||
SetAdvancingRotation(GetRotation());
|
||||
|
||||
if (IsStone())
|
||||
{
|
||||
InterceptOnceMotion(CRaceMotionData::NAME_DEAD);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!__IsDieMotion())
|
||||
{
|
||||
InterceptOnceMotion(CRaceMotionData::NAME_DEAD);
|
||||
}
|
||||
}
|
||||
|
||||
m_isRealDead = TRUE;
|
||||
}
|
||||
|
||||
BOOL CActorInstance::IsSleep()
|
||||
{
|
||||
return m_isSleep;
|
||||
}
|
||||
|
||||
BOOL CActorInstance::IsParalysis()
|
||||
{
|
||||
return m_isParalysis;
|
||||
}
|
||||
|
||||
BOOL CActorInstance::IsFaint()
|
||||
{
|
||||
return m_isFaint;
|
||||
}
|
||||
|
||||
BOOL CActorInstance::IsResistFallen()
|
||||
{
|
||||
return m_isResistFallen;
|
||||
}
|
||||
|
||||
BOOL CActorInstance::IsMoving()
|
||||
{
|
||||
return __IsMoveMotion();
|
||||
}
|
||||
|
||||
BOOL CActorInstance::IsWaiting()
|
||||
{
|
||||
return __IsWaitMotion();
|
||||
}
|
||||
|
||||
BOOL CActorInstance::IsDead()
|
||||
{
|
||||
return m_isRealDead;
|
||||
}
|
||||
|
||||
BOOL CActorInstance::IsKnockDown()
|
||||
{
|
||||
return __IsKnockDownMotion();
|
||||
}
|
||||
|
||||
BOOL CActorInstance::IsDamage()
|
||||
{
|
||||
return __IsDamageMotion();
|
||||
}
|
||||
|
||||
BOOL CActorInstance::IsAttacked()
|
||||
{
|
||||
if (IsPushing())
|
||||
return TRUE;
|
||||
|
||||
if (__IsDamageMotion())
|
||||
return TRUE;
|
||||
|
||||
if (__IsKnockDownMotion())
|
||||
return TRUE;
|
||||
|
||||
if (__IsDieMotion())
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Process
|
||||
void CActorInstance::PhysicsProcess()
|
||||
{
|
||||
m_PhysicsObject.Update(m_fSecondElapsed);
|
||||
AddMovement(m_PhysicsObject.GetXMovement(), m_PhysicsObject.GetYMovement(), 0.0f);
|
||||
}
|
||||
|
||||
void CActorInstance::__AccumulationMovement(float fRot)
|
||||
{
|
||||
// NOTE - 일단은 WAIT로 미끄러짐 방지
|
||||
// 추후에는 RaceMotionData가 이동되는 모션인지에 대한 Flag를 갖고 있게끔 한다. - [levites]
|
||||
if (CRaceMotionData::NAME_WAIT == __GetCurrentMotionIndex())
|
||||
return;
|
||||
|
||||
D3DXMATRIX s_matRotationZ;
|
||||
D3DXMatrixRotationZ(&s_matRotationZ, D3DXToRadian(fRot));
|
||||
UpdateTransform(&s_matRotationZ, GetAverageSecondElapsed());
|
||||
|
||||
AddMovement(s_matRotationZ._41, s_matRotationZ._42, s_matRotationZ._43);
|
||||
}
|
||||
|
||||
void CActorInstance::AccumulationMovement()
|
||||
{
|
||||
if (m_pkTree)
|
||||
return;
|
||||
|
||||
if (m_pkHorse)
|
||||
{
|
||||
m_pkHorse->__AccumulationMovement(m_fcurRotation);
|
||||
return;
|
||||
}
|
||||
|
||||
__AccumulationMovement(m_fAdvancingRotation);
|
||||
}
|
||||
|
||||
void CActorInstance::TransformProcess()
|
||||
{
|
||||
if (!IsParalysis())
|
||||
{
|
||||
m_x += m_v3Movement.x;
|
||||
m_y += m_v3Movement.y;
|
||||
m_z += m_v3Movement.z;
|
||||
}
|
||||
|
||||
__InitializeMovement();
|
||||
|
||||
SetPosition(m_x, m_y, m_z);
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Process
|
||||
|
||||
void CActorInstance::OnUpdateCollisionData(const CStaticCollisionDataVector * pscdVector)
|
||||
{
|
||||
assert(pscdVector);
|
||||
CStaticCollisionDataVector::const_iterator it;
|
||||
for(it = pscdVector->begin();it!=pscdVector->end();++it)
|
||||
{
|
||||
const CStaticCollisionData & c_rColliData = *it;
|
||||
const D3DXMATRIX & c_rMatrix = GetTransform();
|
||||
AddCollision(&c_rColliData, &c_rMatrix);
|
||||
}
|
||||
}
|
||||
|
||||
void CActorInstance::OnUpdateHeighInstance(CAttributeInstance * pAttributeInstance)
|
||||
{
|
||||
assert(pAttributeInstance);
|
||||
SetHeightInstance(pAttributeInstance);
|
||||
}
|
||||
|
||||
bool CActorInstance::OnGetObjectHeight(float fX, float fY, float * pfHeight)
|
||||
{
|
||||
if (!m_pHeightAttributeInstance)
|
||||
return false;
|
||||
|
||||
if (TYPE_BUILDING != GetType())
|
||||
return false;
|
||||
|
||||
return m_pHeightAttributeInstance->GetHeight(fX, fY, pfHeight) == 1 ? true : false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Battle
|
||||
void CActorInstance::Revive()
|
||||
{
|
||||
m_isSleep = FALSE;
|
||||
m_isParalysis = FALSE;
|
||||
m_isFaint = FALSE;
|
||||
m_isRealDead = FALSE;
|
||||
m_isStun = FALSE;
|
||||
m_isWalking = FALSE;
|
||||
m_isMain = FALSE;
|
||||
m_isResistFallen = FALSE;
|
||||
|
||||
__InitializeCollisionData();
|
||||
}
|
||||
|
||||
BOOL CActorInstance::IsStun()
|
||||
{
|
||||
return m_isStun;
|
||||
}
|
||||
|
||||
void CActorInstance::Stun()
|
||||
{
|
||||
m_isStun = TRUE;
|
||||
}
|
||||
|
||||
void CActorInstance::SetWalkMode()
|
||||
{
|
||||
m_isWalking = TRUE;
|
||||
if (CRaceMotionData::NAME_RUN == GET_MOTION_INDEX(m_kCurMotNode.dwMotionKey))
|
||||
SetLoopMotion(CRaceMotionData::NAME_WALK, 0.15f, m_fMovSpd);
|
||||
}
|
||||
|
||||
void CActorInstance::SetRunMode()
|
||||
{
|
||||
m_isWalking = FALSE;
|
||||
if (CRaceMotionData::NAME_WALK == GET_MOTION_INDEX(m_kCurMotNode.dwMotionKey))
|
||||
SetLoopMotion(CRaceMotionData::NAME_RUN, 0.15f, m_fMovSpd);
|
||||
}
|
||||
|
||||
MOTION_KEY CActorInstance::GetNormalAttackIndex()
|
||||
{
|
||||
WORD wMotionIndex;
|
||||
m_pkCurRaceData->GetNormalAttackIndex(GetMotionMode(), &wMotionIndex);
|
||||
|
||||
return MAKE_MOTION_KEY(GetMotionMode(), wMotionIndex);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////
|
||||
// Movement
|
||||
void CActorInstance::__InitializeMovement()
|
||||
{
|
||||
m_v3Movement.x = 0.0f;
|
||||
m_v3Movement.y = 0.0f;
|
||||
m_v3Movement.z = 0.0f;
|
||||
}
|
||||
|
||||
void CActorInstance::AddMovement(float fx, float fy, float fz)
|
||||
{
|
||||
m_v3Movement.x += fx;
|
||||
m_v3Movement.y += fy;
|
||||
m_v3Movement.z += fz;
|
||||
}
|
||||
|
||||
const float gc_fActorSlideMoveSpeed = 5.0f;
|
||||
|
||||
void CActorInstance::AdjustDynamicCollisionMovement(const CActorInstance * c_pActorInstance)
|
||||
{
|
||||
if (m_pkHorse)
|
||||
{
|
||||
m_pkHorse->AdjustDynamicCollisionMovement(c_pActorInstance);
|
||||
return;
|
||||
}
|
||||
|
||||
// NOTE : 기존의 Sphere Overlap됬을경우 처리가 비비기를 하면은 Penetration될 위험이 많아서 ( 실제로도 나왔고 --)
|
||||
// Sphere간 Collision이 생겼을 경우 이전위치로 RollBack하는 방식으로 바꿨다.
|
||||
// 단 BGObject에 대해서만.
|
||||
|
||||
if (isAttacking() )
|
||||
return;
|
||||
|
||||
UINT uActorType = c_pActorInstance->GetActorType();
|
||||
if( (uActorType == TYPE_BUILDING) || (uActorType == TYPE_OBJECT) || (uActorType == TYPE_DOOR) || (uActorType == TYPE_STONE))
|
||||
{
|
||||
BlockMovement();
|
||||
|
||||
//Movement초기화
|
||||
/* m_v3Movement = D3DXVECTOR3(0.f,0.f,0.f);
|
||||
|
||||
TCollisionPointInstanceListIterator itMain = m_BodyPointInstanceList.begin();
|
||||
for (; itMain != m_BodyPointInstanceList.end(); ++itMain)
|
||||
{
|
||||
CDynamicSphereInstanceVector & c_rMainSphereVector = (*itMain).SphereInstanceVector;
|
||||
for (DWORD i = 0; i < c_rMainSphereVector.size(); ++i)
|
||||
{
|
||||
CDynamicSphereInstance & c_rMainSphere = c_rMainSphereVector[i];
|
||||
c_rMainSphere.v3Position =c_rMainSphere.v3LastPosition;
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
float move_length = D3DXVec3Length(&m_v3Movement);
|
||||
if (move_length>gc_fActorSlideMoveSpeed)
|
||||
m_v3Movement*=gc_fActorSlideMoveSpeed/move_length;
|
||||
|
||||
TCollisionPointInstanceListIterator itMain = m_BodyPointInstanceList.begin();
|
||||
for (; itMain != m_BodyPointInstanceList.end(); ++itMain)
|
||||
{
|
||||
CDynamicSphereInstanceVector & c_rMainSphereVector = (*itMain).SphereInstanceVector;
|
||||
for (DWORD i = 0; i < c_rMainSphereVector.size(); ++i)
|
||||
{
|
||||
CDynamicSphereInstance & c_rMainSphere = c_rMainSphereVector[i];
|
||||
|
||||
TCollisionPointInstanceList::const_iterator itOpp = c_pActorInstance->m_BodyPointInstanceList.begin();
|
||||
for(;itOpp != c_pActorInstance->m_BodyPointInstanceList.end();++itOpp)
|
||||
{
|
||||
CSphereCollisionInstance s;
|
||||
s.GetAttribute().fRadius=itOpp->SphereInstanceVector[0].fRadius;
|
||||
s.GetAttribute().v3Position=itOpp->SphereInstanceVector[0].v3Position;
|
||||
D3DXVECTOR3 v3Delta = s.GetCollisionMovementAdjust(c_rMainSphere);
|
||||
m_v3Movement+=v3Delta;
|
||||
c_rMainSphere.v3Position+=v3Delta;
|
||||
|
||||
if (v3Delta.x !=0.0f || v3Delta.y !=0.0f || v3Delta.z !=0.0f )
|
||||
{
|
||||
move_length = D3DXVec3Length(&m_v3Movement);
|
||||
if (move_length>gc_fActorSlideMoveSpeed)
|
||||
{
|
||||
m_v3Movement*=gc_fActorSlideMoveSpeed/move_length;
|
||||
c_rMainSphere.v3Position = c_rMainSphere.v3LastPosition;
|
||||
c_rMainSphere.v3Position+=m_v3Movement;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CActorInstance::__AdjustCollisionMovement(const CGraphicObjectInstance * c_pGraphicObjectInstance)
|
||||
{
|
||||
if (m_pkHorse)
|
||||
{
|
||||
m_pkHorse->__AdjustCollisionMovement(c_pGraphicObjectInstance);
|
||||
return;
|
||||
}
|
||||
|
||||
// Body는 하나임을 가정합니다.
|
||||
|
||||
if (m_v3Movement.x == 0.0f && m_v3Movement.y == 0.0f && m_v3Movement.z == 0.0f)
|
||||
return;
|
||||
|
||||
float move_length = D3DXVec3Length(&m_v3Movement);
|
||||
if (move_length>gc_fActorSlideMoveSpeed)
|
||||
m_v3Movement*=gc_fActorSlideMoveSpeed/move_length;
|
||||
|
||||
TCollisionPointInstanceListIterator itMain = m_BodyPointInstanceList.begin();
|
||||
for (; itMain != m_BodyPointInstanceList.end(); ++itMain)
|
||||
{
|
||||
CDynamicSphereInstanceVector & c_rMainSphereVector = (*itMain).SphereInstanceVector;
|
||||
for (DWORD i = 0; i < c_rMainSphereVector.size(); ++i)
|
||||
{
|
||||
CDynamicSphereInstance & c_rMainSphere = c_rMainSphereVector[i];
|
||||
|
||||
D3DXVECTOR3 v3Delta = c_pGraphicObjectInstance->GetCollisionMovementAdjust(c_rMainSphere);
|
||||
m_v3Movement+=v3Delta;
|
||||
c_rMainSphere.v3Position+=v3Delta;
|
||||
|
||||
if (v3Delta.x !=0.0f || v3Delta.y !=0.0f || v3Delta.z !=0.0f )
|
||||
{
|
||||
move_length = D3DXVec3Length(&m_v3Movement);
|
||||
if (move_length>gc_fActorSlideMoveSpeed)
|
||||
{
|
||||
m_v3Movement*=gc_fActorSlideMoveSpeed/move_length;
|
||||
c_rMainSphere.v3Position = c_rMainSphere.v3LastPosition;
|
||||
c_rMainSphere.v3Position+=m_v3Movement;
|
||||
}
|
||||
}
|
||||
|
||||
/*if (c_pObjectInstance->CollisionDynamicSphere(c_rMainSphere))
|
||||
{
|
||||
const D3DXVECTOR3 & c_rv3Position = c_pObjectInstance->GetPosition();
|
||||
//if (GetVector3Distance(c_rMainSphere.v3Position, c_rv3Position) <
|
||||
// GetVector3Distance(c_rMainSphere.v3LastPosition, c_rv3Position))
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CActorInstance::IsMovement()
|
||||
{
|
||||
if (m_pkHorse)
|
||||
if (m_pkHorse->IsMovement())
|
||||
return TRUE;
|
||||
|
||||
if (0.0f != m_v3Movement.x)
|
||||
return TRUE;
|
||||
if (0.0f != m_v3Movement.y)
|
||||
return TRUE;
|
||||
if (0.0f != m_v3Movement.z)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
float CActorInstance::GetHeight()
|
||||
{
|
||||
return CGraphicThingInstance::GetHeight();
|
||||
}
|
||||
|
||||
bool CActorInstance::IntersectDefendingSphere()
|
||||
{
|
||||
for (TCollisionPointInstanceList::iterator it = m_DefendingPointInstanceList.begin(); it != m_DefendingPointInstanceList.end(); ++it)
|
||||
{
|
||||
CDynamicSphereInstanceVector & rSphereInstanceVector = (*it).SphereInstanceVector;
|
||||
|
||||
CDynamicSphereInstanceVector::iterator it2 = rSphereInstanceVector.begin();
|
||||
for (; it2 != rSphereInstanceVector.end(); ++it2)
|
||||
{
|
||||
CDynamicSphereInstance & rInstance = *it2;
|
||||
D3DXVECTOR3 v3SpherePosition = rInstance.v3Position;
|
||||
float fRadius = rInstance.fRadius;
|
||||
|
||||
D3DXVECTOR3 v3Orig;
|
||||
D3DXVECTOR3 v3Dir;
|
||||
float fRange;
|
||||
ms_Ray.GetStartPoint(&v3Orig);
|
||||
ms_Ray.GetDirection(&v3Dir, &fRange);
|
||||
|
||||
D3DXVECTOR3 v3Distance = v3Orig - v3SpherePosition;
|
||||
float b = D3DXVec3Dot(&v3Dir, &v3Distance);
|
||||
float c = D3DXVec3Dot(&v3Distance, &v3Distance) - fRadius*fRadius;
|
||||
|
||||
if (b*b - c >= 0)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CActorInstance::__IsMountingHorse()
|
||||
{
|
||||
return NULL != m_pkHorse;
|
||||
}
|
||||
|
||||
void CActorInstance::MountHorse(CActorInstance * pkHorse)
|
||||
{
|
||||
m_pkHorse = pkHorse;
|
||||
|
||||
if (m_pkHorse)
|
||||
{
|
||||
m_pkHorse->SetCurPixelPosition(NEW_GetCurPixelPositionRef());
|
||||
m_pkHorse->SetRotation(GetRotation());
|
||||
m_pkHorse->SetAdvancingRotation(GetRotation());
|
||||
}
|
||||
}
|
||||
|
||||
void CActorInstance::__CreateTree(const char * c_szFileName)
|
||||
{
|
||||
__DestroyTree();
|
||||
|
||||
CSpeedTreeForestDirectX8& rkForest=CSpeedTreeForestDirectX8::Instance();
|
||||
m_pkTree=rkForest.CreateInstance(m_x, m_y, m_z, GetCaseCRC32(c_szFileName, strlen(c_szFileName)), c_szFileName);
|
||||
m_pkTree->SetPosition(m_x, m_y, m_z);
|
||||
m_pkTree->UpdateBoundingSphere();
|
||||
m_pkTree->UpdateCollisionData();
|
||||
}
|
||||
|
||||
void CActorInstance::__DestroyTree()
|
||||
{
|
||||
if (!m_pkTree)
|
||||
return;
|
||||
|
||||
CSpeedTreeForestDirectX8::Instance().DeleteInstance(m_pkTree);
|
||||
}
|
||||
|
||||
void CActorInstance::__SetTreePosition(float fx, float fy, float fz)
|
||||
{
|
||||
if (!m_pkTree)
|
||||
return;
|
||||
if (m_x == fx && m_y == fy && m_z == fz)
|
||||
return;
|
||||
|
||||
m_pkTree->SetPosition(fx, fy, fz);
|
||||
m_pkTree->UpdateBoundingSphere();
|
||||
m_pkTree->UpdateCollisionData();
|
||||
}
|
||||
|
||||
void CActorInstance::ClearAttachingEffect()
|
||||
{
|
||||
__ClearAttachingEffect();
|
||||
}
|
||||
|
||||
void CActorInstance::Destroy()
|
||||
{
|
||||
ClearFlyTargeter();
|
||||
|
||||
m_HitDataMap.clear();
|
||||
m_MotionDeque.clear();
|
||||
|
||||
if (m_pAttributeInstance)
|
||||
{
|
||||
m_pAttributeInstance->Clear();
|
||||
CAttributeInstance::Delete(m_pAttributeInstance);
|
||||
m_pAttributeInstance = NULL;
|
||||
}
|
||||
|
||||
__ClearAttachingEffect();
|
||||
|
||||
CGraphicThingInstance::Clear();
|
||||
|
||||
__DestroyWeaponTrace();
|
||||
__DestroyTree();
|
||||
//m_PhysicsObject.SetActorInstance(NULL);
|
||||
|
||||
|
||||
__Initialize();
|
||||
}
|
||||
|
||||
void CActorInstance::__InitializeRotationData()
|
||||
{
|
||||
m_fAtkDirRot = 0.0f;
|
||||
m_fcurRotation = 0.0f;
|
||||
m_rotBegin = 0.0f;
|
||||
m_rotEnd = 0.0f;
|
||||
m_rotEndTime = 0.0f;
|
||||
m_rotBeginTime = 0.0f;
|
||||
m_rotBlendTime = 0.0f;
|
||||
m_fAdvancingRotation = 0.0f;
|
||||
m_rotX = 0.0f;
|
||||
m_rotY = 0.0f;
|
||||
}
|
||||
|
||||
|
||||
void CActorInstance::__InitializeStateData()
|
||||
{
|
||||
m_bEffectInitialized = false;
|
||||
|
||||
m_isPreInput = FALSE;
|
||||
m_isNextPreInput = FALSE;
|
||||
|
||||
m_isSleep = FALSE;
|
||||
m_isParalysis = FALSE;
|
||||
m_isFaint = FALSE;
|
||||
m_isRealDead = FALSE;
|
||||
m_isWalking = FALSE;
|
||||
m_isMain = FALSE;
|
||||
m_isStun = FALSE;
|
||||
m_isHiding = FALSE;
|
||||
m_isResistFallen = FALSE;
|
||||
|
||||
m_iRenderMode = RENDER_MODE_NORMAL;
|
||||
m_fAlphaValue = 0.0f;
|
||||
m_AddColor = D3DXCOLOR(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
m_dwMtrlColor=0xffffffff;
|
||||
m_dwMtrlAlpha=0xff000000;
|
||||
|
||||
m_dwBattleHitEffectID = 0;
|
||||
m_dwBattleAttachEffectID = 0;
|
||||
}
|
||||
|
||||
void CActorInstance::__InitializeMotionData()
|
||||
{
|
||||
m_wcurMotionMode = CRaceMotionData::MODE_GENERAL;
|
||||
m_wcurComboType = 0;
|
||||
|
||||
m_fReachScale=1.0f;
|
||||
m_fMovSpd=1.0f;
|
||||
m_fAtkSpd=1.0f;
|
||||
|
||||
m_fInvisibleTime = 0.0f;
|
||||
|
||||
m_kSplashArea.isEnableHitProcess=TRUE;
|
||||
m_kSplashArea.uSkill=0;
|
||||
m_kSplashArea.MotionKey=0;
|
||||
m_kSplashArea.fDisappearingTime = 0.0f;
|
||||
m_kSplashArea.SphereInstanceVector.clear();
|
||||
m_kSplashArea.HittedInstanceMap.clear();
|
||||
|
||||
memset(&m_kCurMotNode, 0, sizeof(m_kCurMotNode));
|
||||
|
||||
__ClearCombo();
|
||||
}
|
||||
|
||||
void CActorInstance::__Initialize()
|
||||
{
|
||||
m_pkCurRaceMotionData=NULL;
|
||||
m_pkCurRaceData=NULL;
|
||||
m_pkHorse=NULL;
|
||||
m_pkTree=NULL;
|
||||
|
||||
m_fOwnerBaseTime=0.0f;
|
||||
|
||||
m_eActorType = TYPE_PC;
|
||||
m_eRace = 0;
|
||||
|
||||
m_eShape = 0;
|
||||
m_eHair = 0;
|
||||
|
||||
m_dwSelfVID = 0;
|
||||
m_dwOwnerVID = 0;
|
||||
|
||||
m_pkEventHandler = NULL;
|
||||
|
||||
m_PhysicsObject.Initialize();
|
||||
|
||||
m_pAttributeInstance = NULL;
|
||||
|
||||
m_pFlyEventHandler = 0;
|
||||
|
||||
m_v3FishingPosition = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
|
||||
m_iFishingEffectID = -1;
|
||||
|
||||
m_pkHorse = NULL;
|
||||
|
||||
__InitializePositionData();
|
||||
__InitializeRotationData();
|
||||
__InitializeMotionData();
|
||||
__InitializeStateData();
|
||||
__InitializeCollisionData();
|
||||
|
||||
__BlendAlpha_Initialize();
|
||||
|
||||
ClearFlyTargeter();
|
||||
}
|
||||
|
||||
CActorInstance::CActorInstance()
|
||||
{
|
||||
__Initialize();
|
||||
m_PhysicsObject.SetActorInstance(this);
|
||||
}
|
||||
|
||||
CActorInstance::~CActorInstance()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
@@ -0,0 +1,358 @@
|
||||
#include "StdAfx.h"
|
||||
#include "ActorInstance.h"
|
||||
#include "RaceManager.h"
|
||||
#include "ItemManager.h"
|
||||
#include "RaceData.h"
|
||||
|
||||
#include "../EterLib/ResourceManager.h"
|
||||
#include "../EterGrnLib/Util.h"
|
||||
|
||||
DWORD CActorInstance::GetVirtualID()
|
||||
{
|
||||
return m_dwSelfVID;
|
||||
}
|
||||
|
||||
void CActorInstance::SetVirtualID(DWORD dwVID)
|
||||
{
|
||||
m_dwSelfVID=dwVID;
|
||||
}
|
||||
|
||||
void CActorInstance::UpdateAttribute()
|
||||
{
|
||||
if (!m_pAttributeInstance)
|
||||
return;
|
||||
|
||||
if (!m_bNeedUpdateCollision)
|
||||
return;
|
||||
|
||||
m_bNeedUpdateCollision = FALSE;
|
||||
|
||||
const CStaticCollisionDataVector & c_rkVec_ColliData = m_pAttributeInstance->GetObjectPointer()->GetCollisionDataVector();
|
||||
UpdateCollisionData(&c_rkVec_ColliData);
|
||||
|
||||
m_pAttributeInstance->RefreshObject(GetTransform());
|
||||
UpdateHeightInstance(m_pAttributeInstance);
|
||||
|
||||
//BOOL isHeightData = m_pAttributeInstance->IsEmpty();
|
||||
}
|
||||
|
||||
void CActorInstance::__CreateAttributeInstance(CAttributeData * pData)
|
||||
{
|
||||
m_pAttributeInstance = CAttributeInstance::New();
|
||||
m_pAttributeInstance->Clear();
|
||||
m_pAttributeInstance->SetObjectPointer(pData);
|
||||
if (pData->IsEmpty())
|
||||
{
|
||||
m_pAttributeInstance->Clear();
|
||||
CAttributeInstance::Delete(m_pAttributeInstance);
|
||||
}
|
||||
}
|
||||
|
||||
DWORD CActorInstance::GetRace()
|
||||
{
|
||||
return m_eRace;
|
||||
}
|
||||
|
||||
bool CActorInstance::SetRace(DWORD eRace)
|
||||
{
|
||||
CRaceData * pRaceData;
|
||||
if (!CRaceManager::Instance().GetRaceDataPointer(eRace, &pRaceData))
|
||||
{
|
||||
m_eRace=0;
|
||||
m_pkCurRaceData=NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
m_eRace=eRace;
|
||||
m_pkCurRaceData = pRaceData;
|
||||
|
||||
CAttributeData * pAttributeData = pRaceData->GetAttributeDataPtr();
|
||||
if (pAttributeData)
|
||||
{
|
||||
__CreateAttributeInstance(pAttributeData);
|
||||
}
|
||||
|
||||
memset(m_adwPartItemID, 0, sizeof(m_adwPartItemID));
|
||||
|
||||
// Setup Graphic ResourceData
|
||||
__ClearAttachingEffect();
|
||||
|
||||
CGraphicThingInstance::Clear();
|
||||
|
||||
//NOTE : PC만 Part별로 다 생성하게 해준다.
|
||||
if( IsPC())
|
||||
{
|
||||
CGraphicThingInstance::ReserveModelThing(CRaceData::PART_MAX_NUM);
|
||||
CGraphicThingInstance::ReserveModelInstance(CRaceData::PART_MAX_NUM);
|
||||
}
|
||||
else
|
||||
{
|
||||
CGraphicThingInstance::ReserveModelThing(1);
|
||||
CGraphicThingInstance::ReserveModelInstance(1);
|
||||
}
|
||||
|
||||
|
||||
CRaceData::TMotionModeDataIterator itor;
|
||||
|
||||
if (pRaceData->CreateMotionModeIterator(itor))
|
||||
{
|
||||
do
|
||||
{
|
||||
WORD wMotionMode = itor->first;
|
||||
CRaceData::TMotionModeData * pMotionModeData = itor->second;
|
||||
|
||||
CRaceData::TMotionVectorMap::iterator itorMotion = pMotionModeData->MotionVectorMap.begin();
|
||||
for (; itorMotion != pMotionModeData->MotionVectorMap.end(); ++itorMotion)
|
||||
{
|
||||
WORD wMotionIndex = itorMotion->first;
|
||||
const CRaceData::TMotionVector & c_rMotionVector = itorMotion->second;
|
||||
CRaceData::TMotionVector::const_iterator it;
|
||||
DWORD i;
|
||||
for (i = 0, it = c_rMotionVector.begin(); it != c_rMotionVector.end(); ++i, ++it)
|
||||
{
|
||||
DWORD dwMotionKey = MAKE_RANDOM_MOTION_KEY(wMotionMode, wMotionIndex, i);
|
||||
CGraphicThingInstance::RegisterMotionThing(dwMotionKey, it->pMotion);
|
||||
}
|
||||
}
|
||||
}
|
||||
while (pRaceData->NextMotionModeIterator(itor));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CActorInstance::SetHair(DWORD eHair)
|
||||
{
|
||||
m_eHair = eHair;
|
||||
|
||||
CRaceData * pRaceData;
|
||||
|
||||
if (!CRaceManager::Instance().GetRaceDataPointer(m_eRace, &pRaceData))
|
||||
return;
|
||||
|
||||
CRaceData::SHair* pkHair=pRaceData->FindHair(eHair);
|
||||
if (pkHair)
|
||||
{
|
||||
if (!pkHair->m_stModelFileName.empty())
|
||||
{
|
||||
CGraphicThing * pkHairThing = (CGraphicThing *)CResourceManager::Instance().GetResourcePointer(pkHair->m_stModelFileName.c_str());
|
||||
RegisterModelThing(CRaceData::PART_HAIR, pkHairThing);
|
||||
SetModelInstance(CRaceData::PART_HAIR, CRaceData::PART_HAIR, 0, CRaceData::PART_MAIN);
|
||||
}
|
||||
|
||||
const std::vector<CRaceData::SSkin>& c_rkVct_kSkin = pkHair->m_kVct_kSkin;
|
||||
std::vector<CRaceData::SSkin>::const_iterator i;
|
||||
for (i = c_rkVct_kSkin.begin(); i != c_rkVct_kSkin.end(); ++i)
|
||||
{
|
||||
const CRaceData::SSkin& c_rkSkinItem = *i;
|
||||
|
||||
CResource * pkRes = CResourceManager::Instance().GetResourcePointer(c_rkSkinItem.m_stDstFileName.c_str());
|
||||
|
||||
if (pkRes)
|
||||
SetMaterialImagePointer(CRaceData::PART_HAIR, c_rkSkinItem.m_stSrcFileName.c_str(), static_cast<CGraphicImage*>(pkRes));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CActorInstance::SetShape(DWORD eShape, float fSpecular)
|
||||
{
|
||||
m_eShape = eShape;
|
||||
|
||||
CRaceData * pRaceData;
|
||||
if (!CRaceManager::Instance().GetRaceDataPointer(m_eRace, &pRaceData))
|
||||
return;
|
||||
|
||||
CRaceData::SShape* pkShape=pRaceData->FindShape(eShape);
|
||||
if (pkShape)
|
||||
{
|
||||
CResourceManager& rkResMgr=CResourceManager::Instance();
|
||||
|
||||
if (pkShape->m_stModelFileName.empty())
|
||||
{
|
||||
CGraphicThing* pModelThing = pRaceData->GetBaseModelThing();
|
||||
RegisterModelThing(0, pModelThing);
|
||||
}
|
||||
else
|
||||
{
|
||||
CGraphicThing* pModelThing = (CGraphicThing *)rkResMgr.GetResourcePointer(pkShape->m_stModelFileName.c_str());
|
||||
RegisterModelThing(0, pModelThing);
|
||||
}
|
||||
|
||||
{
|
||||
std::string stLODModelFileName;
|
||||
|
||||
char szLODModelFileNameEnd[256];
|
||||
for (UINT uLODIndex=1; uLODIndex<=3; ++uLODIndex)
|
||||
{
|
||||
sprintf(szLODModelFileNameEnd, "_lod_%.2d.gr2", uLODIndex);
|
||||
stLODModelFileName = CFileNameHelper::NoExtension(pkShape->m_stModelFileName) + szLODModelFileNameEnd;
|
||||
if (!rkResMgr.IsFileExist(stLODModelFileName.c_str()))
|
||||
break;
|
||||
|
||||
CGraphicThing* pLODModelThing = (CGraphicThing *)rkResMgr.GetResourcePointer(stLODModelFileName.c_str());
|
||||
if (!pLODModelThing)
|
||||
break;
|
||||
|
||||
RegisterLODThing(0, pLODModelThing);
|
||||
}
|
||||
}
|
||||
|
||||
SetModelInstance(0, 0, 0);
|
||||
|
||||
const std::vector<CRaceData::SSkin>& c_rkVct_kSkin = pkShape->m_kVct_kSkin;
|
||||
std::vector<CRaceData::SSkin>::const_iterator i;
|
||||
for (i = c_rkVct_kSkin.begin(); i != c_rkVct_kSkin.end(); ++i)
|
||||
{
|
||||
const CRaceData::SSkin& c_rkSkinItem = *i;
|
||||
|
||||
CResource * pkRes = CResourceManager::Instance().GetResourcePointer(c_rkSkinItem.m_stDstFileName.c_str());
|
||||
|
||||
if (pkRes)
|
||||
{
|
||||
if (fSpecular > 0.0f)
|
||||
{
|
||||
SMaterialData kMaterialData;
|
||||
kMaterialData.pImage = static_cast<CGraphicImage*>(pkRes);
|
||||
kMaterialData.isSpecularEnable = TRUE;
|
||||
kMaterialData.fSpecularPower = fSpecular;
|
||||
kMaterialData.bSphereMapIndex = 0;
|
||||
SetMaterialData(c_rkSkinItem.m_ePart, c_rkSkinItem.m_stSrcFileName.c_str(), kMaterialData);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetMaterialImagePointer(c_rkSkinItem.m_ePart, c_rkSkinItem.m_stSrcFileName.c_str(), static_cast<CGraphicImage*>(pkRes));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pRaceData->IsTree())
|
||||
{
|
||||
__CreateTree(pRaceData->GetTreeFileName());
|
||||
}
|
||||
else
|
||||
{
|
||||
CGraphicThing* pModelThing = pRaceData->GetBaseModelThing();
|
||||
RegisterModelThing(0, pModelThing);
|
||||
|
||||
CGraphicThing* pLODModelThing = pRaceData->GetLODModelThing();
|
||||
RegisterLODThing(0, pLODModelThing);
|
||||
|
||||
SetModelInstance(0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Attaching Objects
|
||||
for (DWORD i = 0; i < pRaceData->GetAttachingDataCount(); ++i)
|
||||
{
|
||||
const NRaceData::TAttachingData * c_pAttachingData;
|
||||
if (!pRaceData->GetAttachingDataPointer(i, &c_pAttachingData))
|
||||
continue;
|
||||
|
||||
switch (c_pAttachingData->dwType)
|
||||
{
|
||||
case NRaceData::ATTACHING_DATA_TYPE_EFFECT:
|
||||
if (c_pAttachingData->isAttaching)
|
||||
{
|
||||
AttachEffectByName(0, c_pAttachingData->strAttachingBoneName.c_str(), c_pAttachingData->pEffectData->strFileName.c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
AttachEffectByName(0, 0, c_pAttachingData->pEffectData->strFileName.c_str());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CActorInstance::ChangeMaterial(const char * c_szFileName)
|
||||
{
|
||||
CRaceData * pRaceData;
|
||||
if (!CRaceManager::Instance().GetRaceDataPointer(m_eRace, &pRaceData))
|
||||
return;
|
||||
|
||||
CRaceData::SShape* pkShape=pRaceData->FindShape(m_eShape);
|
||||
if (!pkShape)
|
||||
return;
|
||||
|
||||
const std::vector<CRaceData::SSkin>& c_rkVct_kSkin = pkShape->m_kVct_kSkin;
|
||||
if (c_rkVct_kSkin.empty())
|
||||
return;
|
||||
|
||||
std::vector<CRaceData::SSkin>::const_iterator i = c_rkVct_kSkin.begin();
|
||||
const CRaceData::SSkin& c_rkSkinItem = *i;
|
||||
|
||||
std::string dstFileName = "d:/ymir work/npc/guild_symbol/guild_symbol.dds";
|
||||
dstFileName = c_szFileName;
|
||||
|
||||
CResource * pkRes = CResourceManager::Instance().GetResourcePointer(dstFileName.c_str());
|
||||
if (!pkRes)
|
||||
return;
|
||||
|
||||
SetMaterialImagePointer(c_rkSkinItem.m_ePart, c_rkSkinItem.m_stSrcFileName.c_str(), static_cast<CGraphicImage*>(pkRes));
|
||||
}
|
||||
/*
|
||||
void CActorInstance::SetPart(DWORD dwPartIndex, DWORD dwItemID)
|
||||
{
|
||||
if (dwPartIndex>=CRaceData::PART_MAX_NUM)
|
||||
return;
|
||||
|
||||
if (!m_pkCurRaceData)
|
||||
{
|
||||
assert(m_pkCurRaceData);
|
||||
return;
|
||||
}
|
||||
|
||||
CItemData * pItemData;
|
||||
if (!CItemManager::Instance().GetItemDataPointer(dwItemID, &pItemData))
|
||||
return;
|
||||
|
||||
RegisterModelThing(dwPartIndex, pItemData->GetModelThing());
|
||||
for (DWORD i = 0; i < pItemData->GetLODModelThingCount(); ++i)
|
||||
{
|
||||
CGraphicThing * pThing;
|
||||
if (!pItemData->GetLODModelThingPointer(i, &pThing))
|
||||
continue;
|
||||
|
||||
RegisterLODThing(dwPartIndex, pThing);
|
||||
}
|
||||
SetModelInstance(dwPartIndex, dwPartIndex, 0);
|
||||
|
||||
m_adwPartItemID[dwPartIndex] = dwItemID;
|
||||
}
|
||||
*/
|
||||
|
||||
DWORD CActorInstance::GetPartItemID(DWORD dwPartIndex)
|
||||
{
|
||||
if (dwPartIndex>=CRaceData::PART_MAX_NUM)
|
||||
{
|
||||
TraceError("CActorInstance::GetPartIndex(dwPartIndex=%d/CRaceData::PART_MAX_NUM=%d)", dwPartIndex, CRaceData::PART_MAX_NUM);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return m_adwPartItemID[dwPartIndex];
|
||||
}
|
||||
|
||||
void CActorInstance::SetSpecularInfo(BOOL bEnable, int iPart, float fAlpha)
|
||||
{
|
||||
CRaceData * pkRaceData;
|
||||
if (!CRaceManager::Instance().GetRaceDataPointer(m_eRace, &pkRaceData))
|
||||
return;
|
||||
|
||||
CRaceData::SShape * pkShape = pkRaceData->FindShape(m_eShape);
|
||||
if (pkShape->m_kVct_kSkin.empty())
|
||||
return;
|
||||
|
||||
std::string filename = pkShape->m_kVct_kSkin[0].m_stSrcFileName.c_str();
|
||||
CFileNameHelper::ChangeDosPath(filename);
|
||||
|
||||
CGraphicThingInstance::SetSpecularInfo(iPart, filename.c_str(), bEnable, fAlpha);
|
||||
}
|
||||
|
||||
void CActorInstance::SetSpecularInfoForce(BOOL bEnable, int iPart, float fAlpha)
|
||||
{
|
||||
CGraphicThingInstance::SetSpecularInfo(iPart, NULL, bEnable, fAlpha);
|
||||
}
|
||||
@@ -0,0 +1,598 @@
|
||||
#include "StdAfx.h"
|
||||
#include "../EterLib/ResourceManager.h"
|
||||
#include "../EterLib/AttributeInstance.h"
|
||||
#include "../EterBase/Utils.h"
|
||||
#include "RaceData.h"
|
||||
#include "RaceMotionData.h"
|
||||
#include "../EterBase/Filename.h"
|
||||
|
||||
CDynamicPool<CRaceData> CRaceData::ms_kPool;
|
||||
CDynamicPool<CRaceData::TMotionModeData> CRaceData::ms_MotionModeDataPool;
|
||||
|
||||
const std::string& CRaceData::GetSmokeBone()
|
||||
{
|
||||
return m_strSmokeBoneName;
|
||||
}
|
||||
|
||||
DWORD CRaceData::GetSmokeEffectID(UINT eSmoke)
|
||||
{
|
||||
if(eSmoke>=SMOKE_NUM)
|
||||
{
|
||||
TraceError("CRaceData::GetSmokeEffectID(eSmoke=%d)", eSmoke);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return m_adwSmokeEffectID[eSmoke];
|
||||
}
|
||||
|
||||
CRaceData::SHair* CRaceData::FindHair(UINT eHair)
|
||||
{
|
||||
std::map<DWORD, SHair>::iterator f=m_kMap_dwHairKey_kHair.find(eHair);
|
||||
if (m_kMap_dwHairKey_kHair.end()==f)
|
||||
{
|
||||
if (eHair != 0)
|
||||
TraceError("Hair number %d is not exist.",eHair);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &f->second;
|
||||
}
|
||||
|
||||
void CRaceData::SetHairSkin(UINT eHair, UINT ePart, const char * c_szModelFileName, const char* c_szSrcFileName, const char* c_szDstFileName)
|
||||
{
|
||||
SSkin kSkin;
|
||||
kSkin.m_ePart=ePart;
|
||||
kSkin.m_stSrcFileName=c_szSrcFileName;
|
||||
kSkin.m_stDstFileName=c_szDstFileName;
|
||||
|
||||
CFileNameHelper::ChangeDosPath(kSkin.m_stSrcFileName);
|
||||
m_kMap_dwHairKey_kHair[eHair].m_kVct_kSkin.push_back(kSkin);
|
||||
m_kMap_dwHairKey_kHair[eHair].m_stModelFileName = c_szModelFileName;
|
||||
}
|
||||
|
||||
CRaceData::SShape* CRaceData::FindShape(UINT eShape)
|
||||
{
|
||||
std::map<DWORD, SShape>::iterator f=m_kMap_dwShapeKey_kShape.find(eShape);
|
||||
if (m_kMap_dwShapeKey_kShape.end()==f)
|
||||
return NULL;
|
||||
|
||||
return &f->second;
|
||||
}
|
||||
|
||||
void CRaceData::SetShapeModel(UINT eShape, const char* c_szModelFileName)
|
||||
{
|
||||
m_kMap_dwShapeKey_kShape[eShape].m_stModelFileName=c_szModelFileName;
|
||||
}
|
||||
|
||||
void CRaceData::AppendShapeSkin(UINT eShape, UINT ePart, const char* c_szSrcFileName, const char* c_szDstFileName)
|
||||
{
|
||||
SSkin kSkin;
|
||||
kSkin.m_ePart=ePart;
|
||||
kSkin.m_stSrcFileName=c_szSrcFileName;
|
||||
kSkin.m_stDstFileName=c_szDstFileName;
|
||||
|
||||
CFileNameHelper::ChangeDosPath(kSkin.m_stSrcFileName);
|
||||
m_kMap_dwShapeKey_kShape[eShape].m_kVct_kSkin.push_back(kSkin);
|
||||
}
|
||||
|
||||
CRaceData* CRaceData::New()
|
||||
{
|
||||
return ms_kPool.Alloc();
|
||||
}
|
||||
|
||||
void CRaceData::Delete(CRaceData* pkRaceData)
|
||||
{
|
||||
pkRaceData->Destroy();
|
||||
ms_kPool.Free(pkRaceData);
|
||||
}
|
||||
|
||||
void CRaceData::CreateSystem(UINT uCapacity, UINT uMotModeCapacity)
|
||||
{
|
||||
ms_MotionModeDataPool.Create(uMotModeCapacity);
|
||||
ms_kPool.Create(uCapacity);
|
||||
}
|
||||
|
||||
void CRaceData::DestroySystem()
|
||||
{
|
||||
ms_kPool.Destroy();
|
||||
ms_MotionModeDataPool.Destroy();
|
||||
}
|
||||
|
||||
BOOL CRaceData::CreateMotionModeIterator(TMotionModeDataIterator & itor)
|
||||
{
|
||||
if (m_pMotionModeDataMap.empty())
|
||||
return FALSE;
|
||||
|
||||
itor = m_pMotionModeDataMap.begin();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
BOOL CRaceData::NextMotionModeIterator(TMotionModeDataIterator & itor)
|
||||
{
|
||||
++itor;
|
||||
|
||||
return m_pMotionModeDataMap.end() != itor;
|
||||
}
|
||||
|
||||
BOOL CRaceData::GetMotionKey(WORD wMotionModeIndex, WORD wMotionIndex, MOTION_KEY * pMotionKey)
|
||||
{
|
||||
TMotionModeData * pMotionModeData;
|
||||
if (!GetMotionModeDataPointer(wMotionModeIndex, &pMotionModeData))
|
||||
return FALSE;
|
||||
|
||||
if (pMotionModeData->MotionVectorMap.end() == pMotionModeData->MotionVectorMap.find(wMotionIndex))
|
||||
{
|
||||
WORD wGeneralMode=CRaceMotionData::MODE_GENERAL;
|
||||
|
||||
switch(wMotionModeIndex)
|
||||
{
|
||||
case CRaceMotionData::MODE_HORSE_ONEHAND_SWORD:
|
||||
case CRaceMotionData::MODE_HORSE_TWOHAND_SWORD:
|
||||
case CRaceMotionData::MODE_HORSE_DUALHAND_SWORD:
|
||||
case CRaceMotionData::MODE_HORSE_FAN:
|
||||
case CRaceMotionData::MODE_HORSE_BELL:
|
||||
case CRaceMotionData::MODE_HORSE_BOW:
|
||||
wGeneralMode=CRaceMotionData::MODE_HORSE;
|
||||
break;
|
||||
|
||||
default:
|
||||
wGeneralMode=CRaceMotionData::MODE_GENERAL;
|
||||
break;
|
||||
}
|
||||
|
||||
TMotionModeData * pMotionModeGeneralData;
|
||||
if (!GetMotionModeDataPointer(wGeneralMode, &pMotionModeGeneralData))
|
||||
return FALSE;
|
||||
|
||||
if (pMotionModeGeneralData->MotionVectorMap.end() == pMotionModeGeneralData->MotionVectorMap.find(wMotionIndex))
|
||||
return FALSE;
|
||||
|
||||
*pMotionKey = MAKE_MOTION_KEY(wGeneralMode, wMotionIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
*pMotionKey = MAKE_MOTION_KEY(wMotionModeIndex, wMotionIndex);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CRaceData::GetMotionModeDataPointer(WORD wMotionMode, TMotionModeData ** ppMotionModeData)
|
||||
{
|
||||
TMotionModeDataIterator itor = m_pMotionModeDataMap.find(wMotionMode);
|
||||
if (itor == m_pMotionModeDataMap.end())
|
||||
return FALSE;
|
||||
|
||||
*ppMotionModeData = itor->second;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CRaceData::GetModelDataPointer(DWORD dwModelIndex, const TModelData ** c_ppModelData)
|
||||
{
|
||||
TModelDataMapIterator itor = m_ModelDataMap.find(dwModelIndex);
|
||||
if (m_ModelDataMap.end() == itor)
|
||||
return false;
|
||||
|
||||
*c_ppModelData = &itor->second;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL CRaceData::GetMotionVectorPointer(WORD wMotionMode, WORD wMotionIndex, TMotionVector ** ppMotionVector)
|
||||
{
|
||||
TMotionModeData * pMotionModeData;
|
||||
if (!GetMotionModeDataPointer(wMotionMode, &pMotionModeData))
|
||||
return FALSE;
|
||||
|
||||
TMotionVectorMap::iterator itor = pMotionModeData->MotionVectorMap.find(wMotionIndex);
|
||||
if (pMotionModeData->MotionVectorMap.end() == itor)
|
||||
return FALSE;
|
||||
|
||||
*ppMotionVector = &itor->second;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CRaceData::GetMotionDataPointer(WORD wMotionMode, WORD wMotionIndex, WORD wMotionSubIndex, CRaceMotionData ** c_ppMotionData)
|
||||
{
|
||||
const TMotionVector * c_pMotionVector;
|
||||
if (!GetMotionVectorPointer(wMotionMode, wMotionIndex, &c_pMotionVector))
|
||||
return FALSE;
|
||||
|
||||
if (wMotionSubIndex >= c_pMotionVector->size())
|
||||
return FALSE;
|
||||
|
||||
const TMotion & c_rMotion = c_pMotionVector->at(wMotionSubIndex);
|
||||
|
||||
if (!c_rMotion.pMotionData)
|
||||
return FALSE;
|
||||
|
||||
*c_ppMotionData = c_rMotion.pMotionData;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CRaceData::GetMotionDataPointer(DWORD dwMotionKey, CRaceMotionData ** c_ppMotionData)
|
||||
{
|
||||
return GetMotionDataPointer(GET_MOTION_MODE(dwMotionKey), GET_MOTION_INDEX(dwMotionKey), GET_MOTION_SUB_INDEX(dwMotionKey), c_ppMotionData);
|
||||
}
|
||||
|
||||
BOOL CRaceData::GetMotionVectorPointer(WORD wMotionMode, WORD wMotionIndex, const TMotionVector ** c_ppMotionVector)
|
||||
{
|
||||
TMotionVector * pMotionVector;
|
||||
if (!GetMotionVectorPointer(wMotionMode, wMotionIndex, &pMotionVector))
|
||||
return FALSE;
|
||||
|
||||
*c_ppMotionVector = pMotionVector;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DWORD CRaceData::GetAttachingDataCount()
|
||||
{
|
||||
return m_AttachingDataVector.size();
|
||||
}
|
||||
|
||||
BOOL CRaceData::GetAttachingDataPointer(DWORD dwIndex, const NRaceData::TAttachingData ** c_ppAttachingData)
|
||||
{
|
||||
if (dwIndex >= GetAttachingDataCount())
|
||||
return FALSE;
|
||||
|
||||
*c_ppAttachingData = &m_AttachingDataVector[dwIndex];
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CRaceData::GetCollisionDataPointer(DWORD dwIndex, const NRaceData::TAttachingData ** c_ppAttachingData)
|
||||
{
|
||||
if (dwIndex >= GetAttachingDataCount())
|
||||
return FALSE;
|
||||
|
||||
if (NRaceData::ATTACHING_DATA_TYPE_COLLISION_DATA != m_AttachingDataVector[dwIndex].dwType)
|
||||
return FALSE;
|
||||
|
||||
*c_ppAttachingData = &m_AttachingDataVector[dwIndex];
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CRaceData::GetBodyCollisionDataPointer(const NRaceData::TAttachingData ** c_ppAttachingData)
|
||||
{
|
||||
for (DWORD i = 0; i < m_AttachingDataVector.size(); ++i)
|
||||
{
|
||||
const NRaceData::TAttachingData * pAttachingData = &m_AttachingDataVector[i];
|
||||
|
||||
if (NRaceData::ATTACHING_DATA_TYPE_COLLISION_DATA == pAttachingData->dwType)
|
||||
if (NRaceData::COLLISION_TYPE_BODY == pAttachingData->pCollisionData->iCollisionType)
|
||||
{
|
||||
*c_ppAttachingData = pAttachingData;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void CRaceData::SetRace(DWORD dwRaceIndex)
|
||||
{
|
||||
m_dwRaceIndex = dwRaceIndex;
|
||||
}
|
||||
|
||||
void CRaceData::RegisterAttachingBoneName(DWORD dwPartIndex, const char * c_szBoneName)
|
||||
{
|
||||
m_AttachingBoneNameMap.insert(TAttachingBoneNameMap::value_type(dwPartIndex, c_szBoneName));
|
||||
}
|
||||
|
||||
void CRaceData::RegisterMotionMode(WORD wMotionModeIndex)
|
||||
{
|
||||
TMotionModeData * pMotionModeData = ms_MotionModeDataPool.Alloc();
|
||||
pMotionModeData->wMotionModeIndex = wMotionModeIndex;
|
||||
pMotionModeData->MotionVectorMap.clear();
|
||||
m_pMotionModeDataMap.insert(TMotionModeDataMap::value_type(wMotionModeIndex, pMotionModeData));
|
||||
}
|
||||
|
||||
CGraphicThing* CRaceData::NEW_RegisterMotion(CRaceMotionData* pkMotionData, WORD wMotionModeIndex, WORD wMotionIndex, const char * c_szFileName, BYTE byPercentage)
|
||||
{
|
||||
CGraphicThing * pMotionThing = (CGraphicThing *)CResourceManager::Instance().GetResourcePointer(c_szFileName);
|
||||
|
||||
TMotionModeData * pMotionModeData;
|
||||
if (!GetMotionModeDataPointer(wMotionModeIndex, &pMotionModeData))
|
||||
{
|
||||
AssertLog("Failed getting motion mode data!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
TMotion kMotion;
|
||||
kMotion.byPercentage = byPercentage;
|
||||
kMotion.pMotion = pMotionThing;
|
||||
kMotion.pMotionData = pkMotionData;
|
||||
pMotionModeData->MotionVectorMap[wMotionIndex].push_back(kMotion);
|
||||
|
||||
return pMotionThing;
|
||||
}
|
||||
|
||||
CGraphicThing* CRaceData::RegisterMotionData(WORD wMotionMode, WORD wMotionIndex, const char * c_szFileName, BYTE byPercentage)
|
||||
{
|
||||
CRaceMotionData * pRaceMotionData = CRaceMotionData::New();
|
||||
if (!pRaceMotionData->LoadMotionData(c_szFileName))
|
||||
{
|
||||
TraceError("CRaceData::RegisterMotionData - LoadMotionData(c_szFileName=%s) ERROR", c_szFileName);
|
||||
CRaceMotionData::Delete(pRaceMotionData);
|
||||
pRaceMotionData = NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// 2004. 3. 15. myevan. 원래는 모션내 인덱스 정보가 있어야 한다.
|
||||
pRaceMotionData->SetName(wMotionIndex);
|
||||
|
||||
/////
|
||||
|
||||
// FIXME : 이미 GR2가 로드 되어 있을 경우에는 어떻게 해야 하는가?
|
||||
// 현재는 똑같은 것이 하나 더 추가 되어 버린다. - [levites]
|
||||
|
||||
return NEW_RegisterMotion(pRaceMotionData, wMotionMode, wMotionIndex, pRaceMotionData->GetMotionFileName(), byPercentage);
|
||||
|
||||
// 2004.09.03.myevan.새로운함수로 대처
|
||||
//TMotion Motion;
|
||||
//Motion.byPercentage = byPercentage;
|
||||
//Motion.pMotion = (CGraphicThing *)CResourceManager::Instance().GetResourcePointer(pRaceMotionData->GetMotionFileName());
|
||||
//Motion.pMotionData = pRaceMotionData;
|
||||
//__OLD_RegisterMotion(wMotionMode, wMotionIndex, Motion);
|
||||
//return true;
|
||||
}
|
||||
|
||||
|
||||
void CRaceData::OLD_RegisterMotion(WORD wMotionModeIndex, WORD wMotionIndex, const char * c_szFileName, BYTE byPercentage)
|
||||
{
|
||||
CGraphicThing * pThing = (CGraphicThing *)CResourceManager::Instance().GetResourcePointer(c_szFileName);
|
||||
|
||||
TMotion Motion;
|
||||
Motion.byPercentage = byPercentage;
|
||||
Motion.pMotion = pThing;
|
||||
Motion.pMotionData = NULL;
|
||||
__OLD_RegisterMotion(wMotionModeIndex, wMotionIndex, Motion);
|
||||
}
|
||||
|
||||
void CRaceData::__OLD_RegisterMotion(WORD wMotionMode, WORD wMotionIndex, const TMotion & rMotion)
|
||||
{
|
||||
TMotionModeData * pMotionModeData;
|
||||
if (!GetMotionModeDataPointer(wMotionMode, &pMotionModeData))
|
||||
{
|
||||
AssertLog("Failed getting motion mode data!");
|
||||
return;
|
||||
}
|
||||
|
||||
TMotionVectorMap::iterator itor = pMotionModeData->MotionVectorMap.find(wMotionIndex);
|
||||
if (pMotionModeData->MotionVectorMap.end() == itor)
|
||||
{
|
||||
TMotionVector MotionVector;
|
||||
MotionVector.push_back(rMotion);
|
||||
|
||||
pMotionModeData->MotionVectorMap.insert(TMotionVectorMap::value_type(wMotionIndex, MotionVector));
|
||||
}
|
||||
else
|
||||
{
|
||||
TMotionVector & rMotionVector = itor->second;
|
||||
rMotionVector.push_back(rMotion);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool CRaceData::SetMotionRandomWeight(WORD wMotionModeIndex, WORD wMotionIndex, WORD wMotionSubIndex, BYTE byPercentage)
|
||||
{
|
||||
TMotionModeData * pMotionModeData;
|
||||
|
||||
if (!GetMotionModeDataPointer(wMotionModeIndex, &pMotionModeData))
|
||||
{
|
||||
//AssertLog("Failed getting motion mode data!");
|
||||
return false;
|
||||
}
|
||||
|
||||
TMotionVectorMap::iterator itor = pMotionModeData->MotionVectorMap.find(wMotionIndex);
|
||||
|
||||
if (pMotionModeData->MotionVectorMap.end() != itor)
|
||||
{
|
||||
TMotionVector & rMotionVector = itor->second;
|
||||
if (wMotionSubIndex < rMotionVector.size())
|
||||
{
|
||||
rMotionVector[wMotionSubIndex].byPercentage = byPercentage;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceError("CRaceData::SetMotionRandomWeight(wMotionModeIndex=%d, wMotionIndex=%d, wMotionSubIndex=%d, byPercentage=%d) - Find Motion(wMotionIndex=%d) FAILED",
|
||||
wMotionModeIndex, wMotionIndex, wMotionSubIndex, byPercentage, wMotionModeIndex);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CRaceData::RegisterNormalAttack(WORD wMotionModeIndex, WORD wMotionIndex)
|
||||
{
|
||||
m_NormalAttackIndexMap.insert(TNormalAttackIndexMap::value_type(wMotionModeIndex, wMotionIndex));
|
||||
}
|
||||
BOOL CRaceData::GetNormalAttackIndex(WORD wMotionModeIndex, WORD * pwMotionIndex)
|
||||
{
|
||||
TNormalAttackIndexMap::iterator itor = m_NormalAttackIndexMap.find(wMotionModeIndex);
|
||||
|
||||
if (m_NormalAttackIndexMap.end() == itor)
|
||||
return FALSE;
|
||||
|
||||
*pwMotionIndex = itor->second;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CRaceData::ReserveComboAttack(WORD wMotionModeIndex, WORD wComboType, DWORD dwComboCount)
|
||||
{
|
||||
TComboData ComboData;
|
||||
ComboData.ComboIndexVector.clear();
|
||||
ComboData.ComboIndexVector.resize(dwComboCount);
|
||||
m_ComboAttackDataMap.insert(TComboAttackDataMap::value_type(MAKE_COMBO_KEY(wMotionModeIndex, wComboType), ComboData));
|
||||
}
|
||||
|
||||
void CRaceData::RegisterComboAttack(WORD wMotionModeIndex, WORD wComboType, DWORD dwComboIndex, WORD wMotionIndex)
|
||||
{
|
||||
TComboAttackDataIterator itor = m_ComboAttackDataMap.find(MAKE_COMBO_KEY(wMotionModeIndex, wComboType));
|
||||
if (m_ComboAttackDataMap.end() == itor)
|
||||
return;
|
||||
|
||||
TComboIndexVector & rComboIndexVector = itor->second.ComboIndexVector;
|
||||
if (dwComboIndex >= rComboIndexVector.size())
|
||||
{
|
||||
AssertLog("CRaceData::RegisterCombo - Strange combo index!");
|
||||
return;
|
||||
}
|
||||
|
||||
rComboIndexVector[dwComboIndex] = wMotionIndex;
|
||||
}
|
||||
|
||||
BOOL CRaceData::GetComboDataPointer(WORD wMotionModeIndex, WORD wComboType, TComboData ** ppComboData)
|
||||
{
|
||||
TComboAttackDataIterator itor = m_ComboAttackDataMap.find(MAKE_COMBO_KEY(wMotionModeIndex, wComboType));
|
||||
|
||||
if (m_ComboAttackDataMap.end() == itor)
|
||||
return FALSE;
|
||||
|
||||
*ppComboData = &itor->second;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
const char * CRaceData::GetBaseModelFileName() const
|
||||
{
|
||||
return m_strBaseModelFileName.c_str();
|
||||
}
|
||||
|
||||
const char * CRaceData::GetAttributeFileName() const
|
||||
{
|
||||
return m_strAttributeFileName.c_str();
|
||||
}
|
||||
|
||||
const char* CRaceData::GetMotionListFileName() const
|
||||
{
|
||||
return m_strMotionListFileName.c_str();
|
||||
}
|
||||
|
||||
CGraphicThing * CRaceData::GetBaseModelThing()
|
||||
{
|
||||
if (!m_pBaseModelThing)
|
||||
{
|
||||
m_pBaseModelThing = (CGraphicThing *)CResourceManager::Instance().GetResourcePointer(m_strBaseModelFileName.c_str());
|
||||
}
|
||||
|
||||
return m_pBaseModelThing;
|
||||
}
|
||||
|
||||
CGraphicThing * CRaceData::GetLODModelThing()
|
||||
{
|
||||
if (!m_pLODModelThing)
|
||||
{
|
||||
std::string strLODFileName = CFileNameHelper::NoExtension(m_strBaseModelFileName) + "_lod_01.gr2";
|
||||
if (CResourceManager::Instance().IsFileExist(strLODFileName.c_str()))
|
||||
{
|
||||
m_pLODModelThing = (CGraphicThing *)CResourceManager::Instance().GetResourcePointer(strLODFileName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return m_pLODModelThing;
|
||||
}
|
||||
|
||||
CAttributeData * CRaceData::GetAttributeDataPtr()
|
||||
{
|
||||
if (m_strAttributeFileName.empty())
|
||||
return NULL;
|
||||
|
||||
if (!CResourceManager::Instance().IsFileExist(m_strAttributeFileName.c_str()))
|
||||
return NULL;
|
||||
|
||||
return (CAttributeData *)CResourceManager::Instance().GetResourcePointer(m_strAttributeFileName.c_str());
|
||||
}
|
||||
|
||||
BOOL CRaceData::GetAttachingBoneName(DWORD dwPartIndex, const char ** c_pszBoneName)
|
||||
{
|
||||
TAttachingBoneNameMap::iterator itor = m_AttachingBoneNameMap.find(dwPartIndex);
|
||||
if (itor == m_AttachingBoneNameMap.end())
|
||||
return FALSE;
|
||||
|
||||
const std::string & c_rstrBoneName = itor->second;
|
||||
|
||||
*c_pszBoneName = c_rstrBoneName.c_str();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CRaceData::IsTree()
|
||||
{
|
||||
return !m_strTreeFileName.empty();
|
||||
}
|
||||
|
||||
const char * CRaceData::GetTreeFileName()
|
||||
{
|
||||
return m_strTreeFileName.c_str();
|
||||
}
|
||||
|
||||
void CRaceData::Destroy()
|
||||
{
|
||||
m_kMap_dwHairKey_kHair.clear();
|
||||
m_kMap_dwShapeKey_kShape.clear();
|
||||
|
||||
m_strBaseModelFileName = "";
|
||||
m_strTreeFileName = "";
|
||||
m_strAttributeFileName = "";
|
||||
m_strMotionListFileName = "motlist.txt";
|
||||
|
||||
m_AttachingBoneNameMap.clear();
|
||||
m_ModelDataMap.clear();
|
||||
|
||||
m_NormalAttackIndexMap.clear();
|
||||
m_ComboAttackDataMap.clear();
|
||||
|
||||
TMotionModeDataMap::iterator itorMode = m_pMotionModeDataMap.begin();
|
||||
for (; itorMode != m_pMotionModeDataMap.end(); ++itorMode)
|
||||
{
|
||||
TMotionModeData * pMotionModeData = itorMode->second;
|
||||
|
||||
TMotionVectorMap::iterator itorMotion = pMotionModeData->MotionVectorMap.begin();
|
||||
for (; itorMotion != pMotionModeData->MotionVectorMap.end(); ++itorMotion)
|
||||
{
|
||||
TMotionVector & rMotionVector = itorMotion->second;
|
||||
for (DWORD i = 0; i < rMotionVector.size(); ++i)
|
||||
{
|
||||
CRaceMotionData::Delete(rMotionVector[i].pMotionData);
|
||||
}
|
||||
}
|
||||
|
||||
ms_MotionModeDataPool.Free(pMotionModeData);
|
||||
}
|
||||
m_pMotionModeDataMap.clear();
|
||||
|
||||
__Initialize();
|
||||
}
|
||||
|
||||
void CRaceData::__Initialize()
|
||||
{
|
||||
m_strMotionListFileName = "motlist.txt";
|
||||
|
||||
m_pBaseModelThing = NULL;
|
||||
m_pLODModelThing = NULL;
|
||||
|
||||
m_dwRaceIndex = 0;
|
||||
|
||||
memset(m_adwSmokeEffectID, 0, sizeof(m_adwSmokeEffectID));
|
||||
}
|
||||
|
||||
CRaceData::CRaceData()
|
||||
{
|
||||
__Initialize();
|
||||
}
|
||||
CRaceData::~CRaceData()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
@@ -0,0 +1,451 @@
|
||||
#include "StdAfx.h"
|
||||
#include "RaceManager.h"
|
||||
#include "RaceMotionData.h"
|
||||
#include "../EterPack/EterPackManager.h"
|
||||
|
||||
bool __IsGuildRace(unsigned race)
|
||||
{
|
||||
if (race >= 14000 && race < 15000)
|
||||
return true;
|
||||
|
||||
if (20043 == race)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool __IsNPCRace(unsigned race)
|
||||
{
|
||||
if (race > 9000)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void __GetRaceResourcePathes(unsigned race, std::vector <std::string>& vec_stPathes)
|
||||
{
|
||||
if (__IsGuildRace(race))
|
||||
{
|
||||
vec_stPathes.push_back ("d:/ymir work/guild/");
|
||||
vec_stPathes.push_back ("d:/ymir work/npc/");
|
||||
vec_stPathes.push_back ("d:/ymir work/npc2/");
|
||||
vec_stPathes.push_back ("d:/ymir work/monster/");
|
||||
vec_stPathes.push_back ("d:/ymir work/monster2/");
|
||||
}
|
||||
else if (__IsNPCRace(race))
|
||||
{
|
||||
if (race >= 30000)
|
||||
{
|
||||
vec_stPathes.push_back ("d:/ymir work/npc2/");
|
||||
vec_stPathes.push_back ("d:/ymir work/npc/");
|
||||
vec_stPathes.push_back ("d:/ymir work/monster/");
|
||||
vec_stPathes.push_back ("d:/ymir work/monster2/");
|
||||
vec_stPathes.push_back ("d:/ymir work/guild/");
|
||||
}
|
||||
else
|
||||
{
|
||||
vec_stPathes.push_back ("d:/ymir work/npc/");
|
||||
vec_stPathes.push_back ("d:/ymir work/npc2/");
|
||||
vec_stPathes.push_back ("d:/ymir work/monster/");
|
||||
vec_stPathes.push_back ("d:/ymir work/monster2/");
|
||||
vec_stPathes.push_back ("d:/ymir work/guild/");
|
||||
}
|
||||
}
|
||||
// 만우절 이벤트용 예외 몬스터
|
||||
else if (8507 == race || 8510 == race)
|
||||
{
|
||||
vec_stPathes.push_back ("d:/ymir work/monster2/");
|
||||
vec_stPathes.push_back ("d:/ymir work/monster/");
|
||||
vec_stPathes.push_back ("d:/ymir work/npc/");
|
||||
vec_stPathes.push_back ("d:/ymir work/npc2/");
|
||||
vec_stPathes.push_back ("d:/ymir work/guild/");
|
||||
}
|
||||
else if (race > 8000)
|
||||
{
|
||||
vec_stPathes.push_back ("d:/ymir work/monster/");
|
||||
vec_stPathes.push_back ("d:/ymir work/monster2/");
|
||||
vec_stPathes.push_back ("d:/ymir work/npc/");
|
||||
vec_stPathes.push_back ("d:/ymir work/npc2/");
|
||||
vec_stPathes.push_back ("d:/ymir work/guild/");
|
||||
}
|
||||
else if (race > 2000)
|
||||
{
|
||||
vec_stPathes.push_back ("d:/ymir work/monster2/");
|
||||
vec_stPathes.push_back ("d:/ymir work/monster/");
|
||||
vec_stPathes.push_back ("d:/ymir work/npc/");
|
||||
vec_stPathes.push_back ("d:/ymir work/npc2/");
|
||||
vec_stPathes.push_back ("d:/ymir work/guild/");
|
||||
}
|
||||
else if (race>=1400 && race<=1700)
|
||||
{
|
||||
vec_stPathes.push_back ("d:/ymir work/monster2/");
|
||||
vec_stPathes.push_back ("d:/ymir work/monster/");
|
||||
vec_stPathes.push_back ("d:/ymir work/npc/");
|
||||
vec_stPathes.push_back ("d:/ymir work/npc2/");
|
||||
vec_stPathes.push_back ("d:/ymir work/guild/");
|
||||
}
|
||||
else
|
||||
{
|
||||
vec_stPathes.push_back ("d:/ymir work/monster/");
|
||||
vec_stPathes.push_back ("d:/ymir work/monster2/");
|
||||
vec_stPathes.push_back ("d:/ymir work/npc/");
|
||||
vec_stPathes.push_back ("d:/ymir work/npc2/");
|
||||
vec_stPathes.push_back ("d:/ymir work/guild/");
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
CRaceData* CRaceManager::__LoadRaceData(DWORD dwRaceIndex)
|
||||
{
|
||||
std::map<DWORD, std::string>::iterator fRaceName=m_kMap_dwRaceKey_stRaceName.find(dwRaceIndex);
|
||||
if (m_kMap_dwRaceKey_stRaceName.end()==fRaceName)
|
||||
return NULL;
|
||||
|
||||
const std::string& c_rstRaceName=fRaceName->second;
|
||||
|
||||
if (c_rstRaceName.empty())
|
||||
return NULL;
|
||||
|
||||
// LOAD_LOCAL_RESOURCE
|
||||
if (c_rstRaceName[0] == '#')
|
||||
{
|
||||
const char* pathName = c_rstRaceName.c_str() + 1;
|
||||
char shapeFileName[256];
|
||||
char motionListFileName[256];
|
||||
_snprintf(shapeFileName, sizeof(shapeFileName), "%sshape.msm", pathName);
|
||||
_snprintf(motionListFileName, sizeof(motionListFileName), "%smotlist.txt", pathName);
|
||||
|
||||
CRaceData * pRaceData = CRaceData::New();
|
||||
pRaceData->SetRace(dwRaceIndex);
|
||||
if (!pRaceData->LoadRaceData(shapeFileName))
|
||||
{
|
||||
TraceError("CRaceManager::RegisterRacePath(race=%u).LoadRaceData(%s)", dwRaceIndex, shapeFileName);
|
||||
CRaceData::Delete(pRaceData);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
__LoadRaceMotionList(*pRaceData, pathName, motionListFileName);
|
||||
|
||||
return pRaceData;
|
||||
}
|
||||
// END_OF_LOAD_LOCAL_RESOURCE
|
||||
std::vector <std::string> vec_stFullPathName;
|
||||
__GetRaceResourcePathes(dwRaceIndex, vec_stFullPathName);
|
||||
|
||||
CRaceData * pRaceData = CRaceData::New();
|
||||
pRaceData->SetRace(dwRaceIndex);
|
||||
|
||||
for (int i = 0; i < vec_stFullPathName.size(); i++)
|
||||
{
|
||||
std::string stFullPathName = vec_stFullPathName[i];
|
||||
{
|
||||
std::map<std::string, std::string>::iterator fRaceSrcName=m_kMap_stRaceName_stSrcName.find(c_rstRaceName);
|
||||
if (m_kMap_stRaceName_stSrcName.end()==fRaceSrcName)
|
||||
stFullPathName+=c_rstRaceName;
|
||||
else
|
||||
stFullPathName+=fRaceSrcName->second;
|
||||
}
|
||||
|
||||
stFullPathName+="/";
|
||||
|
||||
std::string stMSMFileName=stFullPathName;
|
||||
stMSMFileName+=c_rstRaceName;
|
||||
stMSMFileName+=".msm";
|
||||
|
||||
if (!pRaceData->LoadRaceData(stMSMFileName.c_str()))
|
||||
{
|
||||
if (i != vec_stFullPathName.size() - 1)
|
||||
{
|
||||
TraceError("CRaceManager::RegisterRacePath : RACE[%u] LOAD MSMFILE[%s] ERROR. Will Find Another Path.", dwRaceIndex, stMSMFileName.c_str());
|
||||
continue;
|
||||
}
|
||||
|
||||
TraceError("CRaceManager::RegisterRacePath : RACE[%u] LOAD MSMFILE[%s] ERROR", dwRaceIndex, stMSMFileName.c_str());
|
||||
CRaceData::Delete(pRaceData);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
std::string stMotionListFileName=stFullPathName;
|
||||
stMotionListFileName+=pRaceData->GetMotionListFileName();
|
||||
|
||||
__LoadRaceMotionList(*pRaceData, stFullPathName.c_str(), stMotionListFileName.c_str());
|
||||
|
||||
return pRaceData;
|
||||
}
|
||||
TraceError("CRaceManager::RegisterRacePath : RACE[%u] HAVE NO PATH ERROR", dwRaceIndex);
|
||||
CRaceData::Delete(pRaceData);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CRaceManager::__LoadRaceMotionList(CRaceData& rkRaceData, const char* pathName, const char* motionListFileName)
|
||||
{
|
||||
static std::map<std::string, DWORD> s_kMap_stType_dwIndex;
|
||||
static bool s_isInit=false;
|
||||
|
||||
if (!s_isInit)
|
||||
{
|
||||
s_isInit=true;
|
||||
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("SPAWN", CRaceMotionData::NAME_SPAWN));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("WAIT", CRaceMotionData::NAME_WAIT));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("WAIT1", CRaceMotionData::NAME_WAIT));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("WAIT2", CRaceMotionData::NAME_WAIT));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("WALK", CRaceMotionData::NAME_WALK));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("WALK1", CRaceMotionData::NAME_WALK));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("WALK2", CRaceMotionData::NAME_WALK));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("RUN", CRaceMotionData::NAME_RUN));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("RUN1", CRaceMotionData::NAME_RUN));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("RUN2", CRaceMotionData::NAME_RUN));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("STOP", CRaceMotionData::NAME_STOP));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("DEAD", CRaceMotionData::NAME_DEAD));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("COMBO_ATTACK", CRaceMotionData::NAME_COMBO_ATTACK_1));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("COMBO_ATTACK1", CRaceMotionData::NAME_COMBO_ATTACK_2));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("COMBO_ATTACK2", CRaceMotionData::NAME_COMBO_ATTACK_3));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("NORMAL_ATTACK", CRaceMotionData::NAME_NORMAL_ATTACK));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("NORMAL_ATTACK1", CRaceMotionData::NAME_NORMAL_ATTACK));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("NORMAL_ATTACK2", CRaceMotionData::NAME_NORMAL_ATTACK));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("FRONT_DAMAGE", CRaceMotionData::NAME_DAMAGE));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("FRONT_DAMAGE1", CRaceMotionData::NAME_DAMAGE));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("FRONT_DAMAGE2", CRaceMotionData::NAME_DAMAGE));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("FRONT_DAMAGE3", CRaceMotionData::NAME_DAMAGE));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("FRONT_DEAD", CRaceMotionData::NAME_DEAD));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("FRONT_DEAD1", CRaceMotionData::NAME_DEAD));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("FRONT_DEAD2", CRaceMotionData::NAME_DEAD));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("FRONT_KNOCKDOWN", CRaceMotionData::NAME_DAMAGE_FLYING));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("FRONT_KNOCKDOWN1", CRaceMotionData::NAME_DAMAGE_FLYING));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("FRONT_STANDUP", CRaceMotionData::NAME_STAND_UP));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("FRONT_STANDUP1", CRaceMotionData::NAME_STAND_UP));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("BACK_DAMAGE", CRaceMotionData::NAME_DAMAGE_BACK));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("BACK_DAMAGE1", CRaceMotionData::NAME_DAMAGE_BACK));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("BACK_DEAD", CRaceMotionData::NAME_DEAD_BACK));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("BACK_DEAD1", CRaceMotionData::NAME_DEAD_BACK));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("BACK_DEAD2", CRaceMotionData::NAME_DEAD_BACK));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("BACK_KNOCKDOWN", CRaceMotionData::NAME_DAMAGE_FLYING_BACK));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("BACK_KNOCKDOWN1", CRaceMotionData::NAME_DAMAGE_FLYING_BACK));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("BACK_STANDUP", CRaceMotionData::NAME_STAND_UP_BACK));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("BACK_STANDUP1", CRaceMotionData::NAME_STAND_UP_BACK));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("SPECIAL", CRaceMotionData::NAME_SPECIAL_1));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("SPECIAL1", CRaceMotionData::NAME_SPECIAL_2));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("SPECIAL2", CRaceMotionData::NAME_SPECIAL_3));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("SPECIAL3", CRaceMotionData::NAME_SPECIAL_4));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("SPECIAL4", CRaceMotionData::NAME_SPECIAL_5));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("SPECIAL5", CRaceMotionData::NAME_SPECIAL_6));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("SKILL1", CRaceMotionData::NAME_SKILL+121));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("SKILL2", CRaceMotionData::NAME_SKILL+122));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("SKILL3", CRaceMotionData::NAME_SKILL+123));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("SKILL4", CRaceMotionData::NAME_SKILL+124));
|
||||
s_kMap_stType_dwIndex.insert(std::map<std::string, DWORD>::value_type("SKILL5", CRaceMotionData::NAME_SKILL+125));
|
||||
}
|
||||
|
||||
const void* pvData;
|
||||
CMappedFile kMappedFile;
|
||||
if (!CEterPackManager::Instance().Get(kMappedFile, motionListFileName, &pvData))
|
||||
return false;
|
||||
|
||||
|
||||
CMemoryTextFileLoader kTextFileLoader;
|
||||
kTextFileLoader.Bind(kMappedFile.Size(), pvData);
|
||||
|
||||
rkRaceData.RegisterMotionMode(CRaceMotionData::MODE_GENERAL);
|
||||
|
||||
char szMode[256];
|
||||
char szType[256];
|
||||
char szFile[256];
|
||||
int nPercent = 0;
|
||||
|
||||
bool isSpawn=false;
|
||||
|
||||
static std::string stSpawnMotionFileName;
|
||||
static std::string stMotionFileName;
|
||||
|
||||
stSpawnMotionFileName = "";
|
||||
stMotionFileName = "";
|
||||
|
||||
UINT uLineCount=kTextFileLoader.GetLineCount();
|
||||
for (UINT uLineIndex=0; uLineIndex<uLineCount; ++uLineIndex)
|
||||
{
|
||||
DWORD motionType = CRaceMotionData::NAME_NONE;
|
||||
|
||||
const std::string& c_rstLine=kTextFileLoader.GetLineString(uLineIndex);
|
||||
sscanf(c_rstLine.c_str(), "%s %s %s %d", szMode, szType, szFile, &nPercent);
|
||||
|
||||
std::map<std::string, DWORD>::iterator fTypeIndex=s_kMap_stType_dwIndex.find(szType);
|
||||
|
||||
if (s_kMap_stType_dwIndex.end() == fTypeIndex)
|
||||
{
|
||||
// 모션 목록에 WAIT, WAIT4, WAIT20 이런 식으로 등록되어 있을 때,
|
||||
// WAIT4, WAIT20을 WAIT로 인식할 수 있도록 처리
|
||||
const size_t c_cutLengthLimit = 2;
|
||||
bool bFound = false;
|
||||
|
||||
if (c_cutLengthLimit < strlen(szType) + 1)
|
||||
{
|
||||
for (size_t i = 1; i <= c_cutLengthLimit; ++i)
|
||||
{
|
||||
std::string typeName = std::string(szType).substr(0, strlen(szType) - i);
|
||||
fTypeIndex = s_kMap_stType_dwIndex.find(typeName);
|
||||
|
||||
if (s_kMap_stType_dwIndex.end() != fTypeIndex)
|
||||
{
|
||||
bFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (false == bFound)
|
||||
continue;
|
||||
}
|
||||
|
||||
motionType = fTypeIndex->second;
|
||||
|
||||
stMotionFileName = pathName;
|
||||
stMotionFileName += szFile;
|
||||
|
||||
rkRaceData.RegisterMotionData(CRaceMotionData::MODE_GENERAL, motionType, stMotionFileName.c_str(), nPercent);
|
||||
|
||||
switch (motionType)
|
||||
{
|
||||
case CRaceMotionData::NAME_SPAWN:
|
||||
isSpawn=true;
|
||||
break;
|
||||
case CRaceMotionData::NAME_DAMAGE:
|
||||
stSpawnMotionFileName=stMotionFileName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isSpawn && stSpawnMotionFileName!="")
|
||||
{
|
||||
rkRaceData.RegisterMotionData(CRaceMotionData::MODE_GENERAL, CRaceMotionData::NAME_SPAWN, stSpawnMotionFileName.c_str(), nPercent);
|
||||
}
|
||||
|
||||
rkRaceData.RegisterNormalAttack(CRaceMotionData::MODE_GENERAL, CRaceMotionData::NAME_NORMAL_ATTACK);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CRaceManager::RegisterRaceSrcName(const char * c_szName, const char * c_szSrcName)
|
||||
{
|
||||
m_kMap_stRaceName_stSrcName.insert(std::map<std::string, std::string>::value_type(c_szName, c_szSrcName));
|
||||
}
|
||||
|
||||
void CRaceManager::RegisterRaceName(DWORD dwRaceIndex, const char * c_szName)
|
||||
{
|
||||
m_kMap_dwRaceKey_stRaceName.insert(std::map<DWORD, std::string>::value_type(dwRaceIndex, c_szName));
|
||||
}
|
||||
|
||||
void CRaceManager::CreateRace(DWORD dwRaceIndex)
|
||||
{
|
||||
if (m_RaceDataMap.end() != m_RaceDataMap.find(dwRaceIndex))
|
||||
{
|
||||
TraceError("RaceManager::CreateRace : Race %u already created", dwRaceIndex);
|
||||
return;
|
||||
}
|
||||
|
||||
CRaceData * pRaceData = CRaceData::New();
|
||||
pRaceData->SetRace(dwRaceIndex);
|
||||
m_RaceDataMap.insert(TRaceDataMap::value_type(dwRaceIndex, pRaceData));
|
||||
|
||||
Tracenf("CRaceManager::CreateRace(dwRaceIndex=%d)", dwRaceIndex);
|
||||
}
|
||||
|
||||
void CRaceManager::SelectRace(DWORD dwRaceIndex)
|
||||
{
|
||||
TRaceDataIterator itor = m_RaceDataMap.find(dwRaceIndex);
|
||||
if (m_RaceDataMap.end() == itor)
|
||||
{
|
||||
assert(!"Failed to select race data!");
|
||||
return;
|
||||
}
|
||||
|
||||
m_pSelectedRaceData = itor->second;
|
||||
}
|
||||
|
||||
CRaceData * CRaceManager::GetSelectedRaceDataPointer()
|
||||
{
|
||||
return m_pSelectedRaceData;
|
||||
}
|
||||
|
||||
BOOL CRaceManager::GetRaceDataPointer(DWORD dwRaceIndex, CRaceData ** ppRaceData)
|
||||
{
|
||||
TRaceDataIterator itor = m_RaceDataMap.find(dwRaceIndex);
|
||||
|
||||
if (m_RaceDataMap.end() == itor)
|
||||
{
|
||||
CRaceData* pRaceData = __LoadRaceData(dwRaceIndex);
|
||||
|
||||
if (pRaceData)
|
||||
{
|
||||
m_RaceDataMap.insert(TRaceDataMap::value_type(dwRaceIndex, pRaceData));
|
||||
*ppRaceData = pRaceData;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
TraceError("CRaceManager::GetRaceDataPointer: cannot load data by dwRaceIndex %lu", dwRaceIndex);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
*ppRaceData = itor->second;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CRaceManager::SetPathName(const char * c_szPathName)
|
||||
{
|
||||
m_strPathName = c_szPathName;
|
||||
}
|
||||
|
||||
const char * CRaceManager::GetFullPathFileName(const char * c_szFileName)
|
||||
{
|
||||
static std::string s_stFileName;
|
||||
|
||||
if (c_szFileName[0] != '.')
|
||||
{
|
||||
s_stFileName = m_strPathName;
|
||||
s_stFileName += c_szFileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
s_stFileName = c_szFileName;
|
||||
}
|
||||
|
||||
return s_stFileName.c_str();
|
||||
}
|
||||
|
||||
|
||||
void CRaceManager::Create()
|
||||
{
|
||||
CRaceMotionData::CreateSystem(2048);
|
||||
CRaceData::CreateSystem(256, 512);
|
||||
}
|
||||
|
||||
void CRaceManager::__Initialize()
|
||||
{
|
||||
m_pSelectedRaceData = NULL;
|
||||
}
|
||||
|
||||
void CRaceManager::__DestroyRaceDataMap()
|
||||
{
|
||||
TRaceDataMap::iterator i;
|
||||
for (i=m_RaceDataMap.begin(); i!=m_RaceDataMap.end(); ++i)
|
||||
CRaceData::Delete(i->second);
|
||||
|
||||
m_RaceDataMap.clear();
|
||||
}
|
||||
|
||||
void CRaceManager::Destroy()
|
||||
{
|
||||
__DestroyRaceDataMap();
|
||||
|
||||
__Initialize();
|
||||
}
|
||||
|
||||
CRaceManager::CRaceManager()
|
||||
{
|
||||
__Initialize();
|
||||
}
|
||||
|
||||
CRaceManager::~CRaceManager()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -658,7 +658,7 @@ class CInstanceBase
|
||||
bool NEW_GetInstanceVectorInCircleRange(float fSkillDistance, std::vector<CInstanceBase*>* pkVct_pkInst);
|
||||
|
||||
void NEW_SetOwner(DWORD dwOwnerVID);
|
||||
void NEW_SyncPixelPosition(long & nPPosX, long & nPPosY);
|
||||
void NEW_SyncPixelPosition(LONG & nPPosX, LONG & nPPosY); // PORT: 40250 Win32 long is 32-bit.
|
||||
void NEW_SyncCurrentPixelPosition();
|
||||
|
||||
void NEW_SetPixelPosition(const TPixelPosition& c_rkPPosDst);
|
||||
@@ -1129,4 +1129,4 @@ inline int RaceToSex(int race)
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,356 @@
|
||||
#include "StdAfx.h"
|
||||
#include "InstanceBase.h"
|
||||
#include "PythonBackground.h"
|
||||
#include "../EterLib/GrpMath.h"
|
||||
|
||||
void CInstanceBase::SetAttackSpeed(UINT uAtkSpd)
|
||||
{
|
||||
if (uAtkSpd > 1100)
|
||||
uAtkSpd = 0;
|
||||
|
||||
m_GraphicThingInstance.SetAttackSpeed(uAtkSpd/100.0f);
|
||||
m_kHorse.SetAttackSpeed(uAtkSpd);
|
||||
}
|
||||
|
||||
void CInstanceBase::SetMoveSpeed(UINT uMovSpd)
|
||||
{
|
||||
if (uMovSpd > 1100)
|
||||
uMovSpd = 0;
|
||||
|
||||
m_GraphicThingInstance.SetMoveSpeed(uMovSpd/100.0f);
|
||||
m_kHorse.SetMoveSpeed(uMovSpd);
|
||||
}
|
||||
|
||||
|
||||
void CInstanceBase::SetRotationSpeed(float fRotSpd)
|
||||
{
|
||||
m_fMaxRotSpd = fRotSpd;
|
||||
}
|
||||
|
||||
void CInstanceBase::NEW_Stop()
|
||||
{
|
||||
if (__IsSyncing())
|
||||
return;
|
||||
|
||||
if (isLock())
|
||||
return;
|
||||
|
||||
if (IsUsingSkill())
|
||||
return;
|
||||
|
||||
if (!IsWaiting())
|
||||
EndWalking();
|
||||
|
||||
m_GraphicThingInstance.__OnStop();
|
||||
}
|
||||
|
||||
void CInstanceBase::NEW_SyncPixelPosition(LONG & nPPosX, LONG & nPPosY) // PORT: 40250 Win32 long is 32-bit.
|
||||
{
|
||||
m_GraphicThingInstance.TEMP_Push(nPPosX, nPPosY);
|
||||
}
|
||||
|
||||
bool CInstanceBase::NEW_CanMoveToDestPixelPosition(const TPixelPosition& c_rkPPosDst)
|
||||
{
|
||||
TPixelPosition kPPosCur;
|
||||
NEW_GetPixelPosition(&kPPosCur);
|
||||
|
||||
if (kPPosCur.x==c_rkPPosDst.x && kPPosCur.y==c_rkPPosDst.y)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
float CInstanceBase_GetDegreeFromPosition(float x, float y)
|
||||
{
|
||||
D3DXVECTOR3 vtDir(floor(x), floor(y), 0.0f);
|
||||
D3DXVec3Normalize(&vtDir, &vtDir);
|
||||
|
||||
D3DXVECTOR3 vtStan(0, -1, 0);
|
||||
float ret = D3DXToDegree(acosf(D3DXVec3Dot(&vtDir, &vtStan)));
|
||||
|
||||
if (vtDir.x < 0.0f)
|
||||
ret = 360.0f - ret;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
float CInstanceBase::NEW_GetAdvancingRotationFromDirPixelPosition(const TPixelPosition& c_rkPPosDir)
|
||||
{
|
||||
float fDirRot=CInstanceBase_GetDegreeFromPosition(c_rkPPosDir.x, -c_rkPPosDir.y);
|
||||
float fClampDirRot=ClampDegree(fDirRot);
|
||||
|
||||
return fClampDirRot;
|
||||
}
|
||||
|
||||
float CInstanceBase::NEW_GetAdvancingRotationFromDestPixelPosition(const TPixelPosition& c_rkPPosDst)
|
||||
{
|
||||
TPixelPosition kPPosCur;
|
||||
NEW_GetPixelPosition(&kPPosCur);
|
||||
return NEW_GetAdvancingRotationFromPixelPosition(kPPosCur, c_rkPPosDst);
|
||||
}
|
||||
|
||||
float CInstanceBase::NEW_GetAdvancingRotationFromPixelPosition(const TPixelPosition& c_rkPPosSrc, const TPixelPosition& c_rkPPosDst)
|
||||
{
|
||||
TPixelPosition kPPosDelta;
|
||||
kPPosDelta=c_rkPPosDst-c_rkPPosSrc;
|
||||
return NEW_GetAdvancingRotationFromDirPixelPosition(kPPosDelta);
|
||||
}
|
||||
|
||||
|
||||
void CInstanceBase::NEW_SetAdvancingRotationFromDirPixelPosition(const TPixelPosition& c_rkPPosDir)
|
||||
{
|
||||
float fClampDirRot=NEW_GetAdvancingRotationFromDirPixelPosition(c_rkPPosDir);
|
||||
m_GraphicThingInstance.SetAdvancingRotation(fClampDirRot);
|
||||
|
||||
float fCurRot=m_GraphicThingInstance.GetRotation();
|
||||
float fAdvRot=m_GraphicThingInstance.GetAdvancingRotation();
|
||||
|
||||
m_iRotatingDirection = GetRotatingDirection(fCurRot, fAdvRot);
|
||||
}
|
||||
|
||||
|
||||
void CInstanceBase::NEW_SetAdvancingRotationFromPixelPosition(const TPixelPosition& c_rkPPosSrc, const TPixelPosition& c_rkPPosDst)
|
||||
{
|
||||
TPixelPosition kPPosDelta;
|
||||
kPPosDelta=c_rkPPosDst-c_rkPPosSrc;
|
||||
|
||||
NEW_SetAdvancingRotationFromDirPixelPosition(kPPosDelta);
|
||||
}
|
||||
|
||||
bool CInstanceBase::NEW_SetAdvancingRotationFromDestPixelPosition(const TPixelPosition& c_rkPPosDst)
|
||||
{
|
||||
if (!NEW_CanMoveToDestPixelPosition(c_rkPPosDst))
|
||||
{
|
||||
Tracenf("Failed to move next position (%f,%f, %f)", c_rkPPosDst.x, c_rkPPosDst.y, c_rkPPosDst.z);
|
||||
return false;
|
||||
}
|
||||
|
||||
TPixelPosition kPPosSrc;
|
||||
NEW_GetPixelPosition(&kPPosSrc);
|
||||
NEW_SetAdvancingRotationFromPixelPosition(kPPosSrc, c_rkPPosDst);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void CInstanceBase::SetAdvancingRotation(float fRotation)
|
||||
{
|
||||
float frotDifference = GetDegreeDifference(GetRotation(), fRotation);
|
||||
|
||||
if (frotDifference > 45.0f)
|
||||
m_fRotSpd = m_fMaxRotSpd;
|
||||
else
|
||||
m_fRotSpd = m_fMaxRotSpd * 5 / 12;
|
||||
|
||||
m_GraphicThingInstance.SetAdvancingRotation(ClampDegree(fRotation));
|
||||
m_iRotatingDirection = GetRotatingDirection(m_GraphicThingInstance.GetRotation(),
|
||||
m_GraphicThingInstance.GetAdvancingRotation());
|
||||
}
|
||||
|
||||
void CInstanceBase::StartWalking()
|
||||
{
|
||||
m_GraphicThingInstance.Move();
|
||||
|
||||
if (IsAffect(AFFECT_GYEONGGONG))
|
||||
{
|
||||
m_adwCRCAffectEffect[AFFECT_GYEONGGONG] = __EffectContainer_AttachEffect(EFFECT_AFFECT_GYEONGGONG);
|
||||
}
|
||||
else if (IsAffect(AFFECT_KWAESOK))
|
||||
{
|
||||
m_adwCRCAffectEffect[AFFECT_KWAESOK] = __EffectContainer_AttachEffect(EFFECT_AFFECT_KWAESOK);
|
||||
}
|
||||
}
|
||||
|
||||
void CInstanceBase::EndWalking(float fBlendingTime)
|
||||
{
|
||||
assert (!IsWaiting() && "CInstanceBase::EndWalking");
|
||||
|
||||
m_isGoing = FALSE;
|
||||
|
||||
// 걷고 있을때는 무조건 멈추게 해야 한다
|
||||
if (IsWalking()||!IsAttacked())
|
||||
{
|
||||
m_GraphicThingInstance.Stop(fBlendingTime);
|
||||
if (IsAffect(AFFECT_GYEONGGONG))
|
||||
{
|
||||
__EffectContainer_DetachEffect(EFFECT_AFFECT_GYEONGGONG);
|
||||
}
|
||||
else if (IsAffect(AFFECT_KWAESOK))
|
||||
{
|
||||
__EffectContainer_DetachEffect(EFFECT_AFFECT_KWAESOK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CInstanceBase::EndWalkingWithoutBlending()
|
||||
{
|
||||
EndWalking(0.0f);
|
||||
}
|
||||
|
||||
BOOL CInstanceBase::IsWaiting()
|
||||
{
|
||||
return m_GraphicThingInstance.IsWaiting();
|
||||
}
|
||||
|
||||
BOOL CInstanceBase::IsWalking()
|
||||
{
|
||||
return m_GraphicThingInstance.IsMoving();
|
||||
}
|
||||
|
||||
BOOL CInstanceBase::IsPushing()
|
||||
{
|
||||
return m_GraphicThingInstance.IsPushing();
|
||||
}
|
||||
|
||||
BOOL CInstanceBase::IsAttacked()
|
||||
{
|
||||
return m_GraphicThingInstance.IsAttacked();
|
||||
}
|
||||
|
||||
BOOL CInstanceBase::IsKnockDown()
|
||||
{
|
||||
if (!m_GraphicThingInstance.IsKnockDown())
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CInstanceBase::IsAttacking()
|
||||
{
|
||||
return m_GraphicThingInstance.isAttacking();
|
||||
}
|
||||
|
||||
BOOL CInstanceBase::IsActingEmotion()
|
||||
{
|
||||
return m_GraphicThingInstance.IsActEmotion();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
BOOL CInstanceBase::IsGoing()
|
||||
{
|
||||
return m_isGoing;
|
||||
}
|
||||
|
||||
void CInstanceBase::NEW_MoveToDestInstanceDirection(CInstanceBase & rkInstDst)
|
||||
{
|
||||
TPixelPosition kPPosDst;
|
||||
rkInstDst.NEW_GetPixelPosition(&kPPosDst);
|
||||
|
||||
NEW_MoveToDestPixelPositionDirection(kPPosDst);
|
||||
}
|
||||
|
||||
bool CInstanceBase::NEW_MoveToDestPixelPositionDirection(const TPixelPosition & c_rkPPosDst)
|
||||
{
|
||||
TPixelPosition kPPosCur;
|
||||
NEW_GetPixelPosition(&kPPosCur);
|
||||
float fDstRot = NEW_GetAdvancingRotationFromPixelPosition(kPPosCur, c_rkPPosDst);
|
||||
|
||||
return NEW_Goto(c_rkPPosDst, fDstRot);
|
||||
}
|
||||
|
||||
bool CInstanceBase::NEW_Goto(const TPixelPosition& c_rkPPosDst, float fDstRot)
|
||||
{
|
||||
if (__IsSyncing())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_GraphicThingInstance.IsUsingMovingSkill())
|
||||
{
|
||||
SetAdvancingRotation(fDstRot);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isLock())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!NEW_CanMoveToDestPixelPosition(c_rkPPosDst))
|
||||
{
|
||||
if (!IsWaiting())
|
||||
EndWalking();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
NEW_SetSrcPixelPosition(NEW_GetCurPixelPositionRef());
|
||||
NEW_SetDstPixelPosition(c_rkPPosDst);
|
||||
NEW_SetDstPixelPositionZ(NEW_GetSrcPixelPositionRef().z);
|
||||
m_fDstRot=fDstRot;
|
||||
m_isGoing = TRUE;
|
||||
|
||||
if (!IsWalking())
|
||||
{
|
||||
StartWalking();
|
||||
}
|
||||
|
||||
NEW_SetAdvancingRotationFromPixelPosition(NEW_GetSrcPixelPositionRef(), NEW_GetDstPixelPositionRef());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CInstanceBase::NEW_MoveToDirection(float fDirRot)
|
||||
{
|
||||
if (__IsSyncing())
|
||||
return;
|
||||
|
||||
if (m_GraphicThingInstance.IsUsingMovingSkill())
|
||||
{
|
||||
SetAdvancingRotation(fDirRot);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isLock())
|
||||
return;
|
||||
|
||||
m_isGoing = FALSE;
|
||||
|
||||
SetAdvancingRotation(fDirRot);
|
||||
|
||||
if (!IsWalking())
|
||||
{
|
||||
StartWalking();
|
||||
}
|
||||
|
||||
TPixelPosition kPPosCur;
|
||||
NEW_GetPixelPosition(&kPPosCur);
|
||||
|
||||
D3DXVECTOR3 kD3DVt3Cur(kPPosCur.x, -kPPosCur.y, kPPosCur.z);
|
||||
D3DXVECTOR3 kD3DVt3Dst;
|
||||
|
||||
D3DXVECTOR3 kD3DVt3AdvDir(0.0f, -1.0f, 0.0f);
|
||||
D3DXMATRIX kD3DMatAdv;
|
||||
D3DXMatrixRotationZ(&kD3DMatAdv, D3DXToRadian(fDirRot));
|
||||
D3DXVec3TransformCoord(&kD3DVt3AdvDir, &kD3DVt3AdvDir, &kD3DMatAdv);
|
||||
D3DXVec3Scale(&kD3DVt3AdvDir, &kD3DVt3AdvDir, 300.0f);
|
||||
D3DXVec3Add(&kD3DVt3Dst, &kD3DVt3AdvDir, &kD3DVt3Cur);
|
||||
|
||||
TPixelPosition kPPosDst;
|
||||
kPPosDst.x = +kD3DVt3Dst.x;
|
||||
kPPosDst.y = -kD3DVt3Dst.y;
|
||||
kPPosDst.z = +kD3DVt3Dst.z;
|
||||
|
||||
NEW_SetSrcPixelPosition(kPPosCur);
|
||||
NEW_SetDstPixelPosition(kPPosDst);
|
||||
}
|
||||
|
||||
void CInstanceBase::EndGoing()
|
||||
{
|
||||
if (!IsWaiting())
|
||||
EndWalking();
|
||||
|
||||
//Tracen("EndGoing");
|
||||
|
||||
m_isGoing = FALSE;
|
||||
}
|
||||
|
||||
void CInstanceBase::SetRunMode()
|
||||
{
|
||||
m_GraphicThingInstance.SetRunMode();
|
||||
}
|
||||
|
||||
void CInstanceBase::SetWalkMode()
|
||||
{
|
||||
m_GraphicThingInstance.SetWalkMode();
|
||||
}
|
||||
@@ -0,0 +1,582 @@
|
||||
#include "StdAfx.h"
|
||||
#include "NetworkActorManager.h"
|
||||
#include "PythonCharacterManager.h"
|
||||
#include "PythonItem.h"
|
||||
|
||||
#include "AbstractPlayer.h"
|
||||
|
||||
void SNetworkActorData::UpdatePosition()
|
||||
{
|
||||
DWORD dwClientCurTime=ELTimer_GetMSec();
|
||||
DWORD dwElapsedTime=dwClientCurTime-m_dwClientSrcTime;
|
||||
|
||||
if (dwElapsedTime<m_dwDuration)
|
||||
{
|
||||
float fRate=float(dwElapsedTime)/float(m_dwDuration);
|
||||
m_lCurX=LONG((m_lDstX-m_lSrcX)*fRate+m_lSrcX);
|
||||
m_lCurY=LONG((m_lDstY-m_lSrcY)*fRate+m_lSrcY);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_lCurX=m_lDstX;
|
||||
m_lCurY=m_lDstY;
|
||||
}
|
||||
}
|
||||
|
||||
void SNetworkActorData::SetDstPosition(DWORD dwServerTime, LONG lDstX, LONG lDstY, DWORD dwDuration)
|
||||
{
|
||||
m_lSrcX=m_lCurX;
|
||||
m_lSrcY=m_lCurY;
|
||||
m_lDstX=lDstX;
|
||||
m_lDstY=lDstY;
|
||||
|
||||
m_dwDuration=dwDuration;
|
||||
m_dwServerSrcTime=dwServerTime;
|
||||
m_dwClientSrcTime=ELTimer_GetMSec();
|
||||
}
|
||||
|
||||
void SNetworkActorData::SetPosition(LONG lPosX, LONG lPosY)
|
||||
{
|
||||
m_lDstX=m_lSrcX=m_lCurX=lPosX;
|
||||
m_lDstY=m_lSrcY=m_lCurY=lPosY;
|
||||
}
|
||||
|
||||
// NETWORK_ACTOR_DATA_COPY
|
||||
SNetworkActorData::SNetworkActorData(const SNetworkActorData& src)
|
||||
{
|
||||
__copy__(src);
|
||||
}
|
||||
|
||||
void SNetworkActorData::operator=(const SNetworkActorData& src)
|
||||
{
|
||||
__copy__(src);
|
||||
}
|
||||
|
||||
void SNetworkActorData::__copy__(const SNetworkActorData& src)
|
||||
{
|
||||
m_bType = src.m_bType;
|
||||
m_dwVID = src.m_dwVID;
|
||||
m_dwStateFlags = src.m_dwStateFlags;
|
||||
m_dwEmpireID = src.m_dwEmpireID;
|
||||
m_dwRace = src.m_dwRace;
|
||||
m_dwMovSpd = src.m_dwMovSpd;
|
||||
m_dwAtkSpd = src.m_dwAtkSpd;
|
||||
m_fRot = src.m_fRot;
|
||||
m_lCurX = src.m_lCurX;
|
||||
m_lCurY = src.m_lCurY;
|
||||
m_lSrcX = src.m_lSrcX;
|
||||
m_lSrcY = src.m_lSrcY;
|
||||
m_lDstX = src.m_lDstX;
|
||||
m_lDstY = src.m_lDstY;
|
||||
m_kAffectFlags.CopyInstance(src.m_kAffectFlags);
|
||||
|
||||
m_dwServerSrcTime = src.m_dwServerSrcTime;
|
||||
m_dwClientSrcTime = src.m_dwClientSrcTime;
|
||||
m_dwDuration = src.m_dwDuration;
|
||||
|
||||
m_dwArmor = src.m_dwArmor;
|
||||
m_dwWeapon = src.m_dwWeapon;
|
||||
m_dwHair = src.m_dwHair;
|
||||
|
||||
m_dwOwnerVID = src.m_dwOwnerVID;
|
||||
|
||||
m_sAlignment = src.m_sAlignment;
|
||||
m_byPKMode = src.m_byPKMode;
|
||||
m_dwMountVnum = src.m_dwMountVnum;
|
||||
|
||||
m_dwGuildID = src.m_dwGuildID;
|
||||
m_dwLevel = src.m_dwLevel;
|
||||
m_stName = src.m_stName;
|
||||
}
|
||||
// END_OF_NETWORK_ACTOR_DATA_COPY
|
||||
|
||||
SNetworkActorData::SNetworkActorData()
|
||||
{
|
||||
SetPosition(0, 0);
|
||||
|
||||
m_bType=0;
|
||||
m_dwVID=0;
|
||||
m_dwStateFlags=0;
|
||||
m_dwRace=0;
|
||||
m_dwMovSpd=0;
|
||||
m_dwAtkSpd=0;
|
||||
m_fRot=0.0f;
|
||||
m_dwArmor=0;
|
||||
m_dwWeapon=0;
|
||||
m_dwHair=0;
|
||||
m_dwEmpireID=0;
|
||||
|
||||
m_dwOwnerVID=0;
|
||||
|
||||
m_dwDuration=0;
|
||||
m_dwClientSrcTime=0;
|
||||
m_dwServerSrcTime=0;
|
||||
|
||||
m_sAlignment=0;
|
||||
m_byPKMode=0;
|
||||
m_dwMountVnum=0;
|
||||
|
||||
m_stName="";
|
||||
|
||||
m_kAffectFlags.Clear();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CNetworkActorManager::CNetworkActorManager()
|
||||
{
|
||||
m_dwMainVID=0;
|
||||
}
|
||||
|
||||
CNetworkActorManager::~CNetworkActorManager()
|
||||
{
|
||||
}
|
||||
|
||||
void CNetworkActorManager::Destroy()
|
||||
{
|
||||
m_kNetActorDict.clear();
|
||||
|
||||
m_dwMainVID=0;
|
||||
m_lMainPosX=0;
|
||||
m_lMainPosY=0;
|
||||
}
|
||||
|
||||
void CNetworkActorManager::SetMainActorVID(DWORD dwVID)
|
||||
{
|
||||
m_dwMainVID=dwVID;
|
||||
m_lMainPosX=0;
|
||||
m_lMainPosY=0;
|
||||
|
||||
m_kNetActorDict.clear();
|
||||
}
|
||||
|
||||
void CNetworkActorManager::Update()
|
||||
{
|
||||
__OLD_Update();
|
||||
}
|
||||
|
||||
void CNetworkActorManager::__OLD_Update()
|
||||
{
|
||||
__UpdateMainActor();
|
||||
|
||||
CPythonCharacterManager& rkChrMgr=__GetCharacterManager();
|
||||
|
||||
std::map<DWORD, SNetworkActorData>::iterator i;
|
||||
for (i=m_kNetActorDict.begin(); i!=m_kNetActorDict.end(); ++i)
|
||||
{
|
||||
SNetworkActorData& rkNetActorData=i->second;
|
||||
rkNetActorData.UpdatePosition();
|
||||
|
||||
CInstanceBase * pkInstFind = rkChrMgr.GetInstancePtr(rkNetActorData.m_dwVID);
|
||||
if (!pkInstFind)
|
||||
{
|
||||
if (__IsVisibleActor(rkNetActorData))
|
||||
__AppendCharacterManagerActor(rkNetActorData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CInstanceBase* CNetworkActorManager::__FindActor(SNetworkActorData& rkNetActorData, LONG lDstX, LONG lDstY)
|
||||
{
|
||||
CPythonCharacterManager& rkChrMgr=__GetCharacterManager();
|
||||
CInstanceBase * pkInstFind = rkChrMgr.GetInstancePtr(rkNetActorData.m_dwVID);
|
||||
if (!pkInstFind)
|
||||
{
|
||||
if (__IsVisiblePos(lDstX, lDstY))
|
||||
return __AppendCharacterManagerActor(rkNetActorData);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pkInstFind;
|
||||
}
|
||||
|
||||
CInstanceBase* CNetworkActorManager::__FindActor(SNetworkActorData& rkNetActorData)
|
||||
{
|
||||
CPythonCharacterManager& rkChrMgr=__GetCharacterManager();
|
||||
CInstanceBase * pkInstFind = rkChrMgr.GetInstancePtr(rkNetActorData.m_dwVID);
|
||||
if (!pkInstFind)
|
||||
{
|
||||
if (__IsVisibleActor(rkNetActorData))
|
||||
return __AppendCharacterManagerActor(rkNetActorData);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return pkInstFind;
|
||||
}
|
||||
|
||||
void CNetworkActorManager::__RemoveAllGroundItems()
|
||||
{
|
||||
CPythonItem& rkItemMgr=CPythonItem::Instance();
|
||||
rkItemMgr.DeleteAllItems();
|
||||
}
|
||||
|
||||
void CNetworkActorManager::__RemoveAllActors()
|
||||
{
|
||||
m_kNetActorDict.clear();
|
||||
|
||||
CPythonCharacterManager & rkChrMgr = CPythonCharacterManager::Instance();
|
||||
rkChrMgr.DeleteAllInstances();
|
||||
}
|
||||
|
||||
void CNetworkActorManager::__RemoveDynamicActors()
|
||||
{
|
||||
//copy it
|
||||
std::vector<DWORD> dwCharacterVIDList;
|
||||
|
||||
CPythonCharacterManager& rkChrMgr=CPythonCharacterManager::Instance();
|
||||
for(CPythonCharacterManager::CharacterIterator i = rkChrMgr.CharacterInstanceBegin(); i!=rkChrMgr.CharacterInstanceEnd(); ++i)
|
||||
{
|
||||
dwCharacterVIDList.push_back( (*i)->GetVirtualID() );
|
||||
}
|
||||
|
||||
for( int i = 0; i < dwCharacterVIDList.size(); ++i )
|
||||
{
|
||||
CInstanceBase* pkInstEach = rkChrMgr.GetInstancePtr( dwCharacterVIDList[i] );
|
||||
if( !pkInstEach )
|
||||
continue;
|
||||
|
||||
CActorInstance* rkActorEach=pkInstEach->GetGraphicThingInstancePtr();
|
||||
if( rkActorEach->IsPC() || rkActorEach->IsNPC() || rkActorEach->IsEnemy() )
|
||||
{
|
||||
rkChrMgr.DeleteInstance(dwCharacterVIDList[i]);
|
||||
std::map<DWORD, SNetworkActorData>::iterator it =m_kNetActorDict.find(dwCharacterVIDList[i]);
|
||||
if (it != m_kNetActorDict.end())
|
||||
{
|
||||
m_kNetActorDict.erase(it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rkChrMgr.DestroyDeadInstanceList();
|
||||
}
|
||||
|
||||
void CNetworkActorManager::__UpdateMainActor()
|
||||
{
|
||||
CPythonCharacterManager & rkChrMgr = CPythonCharacterManager::Instance();
|
||||
CInstanceBase* pkInstMain=rkChrMgr.GetMainInstancePtr();
|
||||
if (!pkInstMain)
|
||||
return;
|
||||
|
||||
TPixelPosition kPPosMain;
|
||||
pkInstMain->NEW_GetPixelPosition(&kPPosMain);
|
||||
|
||||
m_lMainPosX=LONG(kPPosMain.x);
|
||||
m_lMainPosY=LONG(kPPosMain.y);
|
||||
}
|
||||
|
||||
extern bool IsWall(unsigned race);
|
||||
|
||||
bool CNetworkActorManager::__IsVisibleActor(const SNetworkActorData& c_rkNetActorData)
|
||||
{
|
||||
if (__IsMainActorVID(c_rkNetActorData.m_dwVID))
|
||||
return true;
|
||||
|
||||
// 2004.08.02.myevan.항상 보이기 플래그
|
||||
if (c_rkNetActorData.m_kAffectFlags.IsSet(CInstanceBase::AFFECT_SHOW_ALWAYS))
|
||||
return true;
|
||||
|
||||
if (__IsVisiblePos(c_rkNetActorData.m_lCurX, c_rkNetActorData.m_lCurY))
|
||||
return true;
|
||||
|
||||
if (IsWall(c_rkNetActorData.m_dwRace))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CNetworkActorManager::__IsVisiblePos(LONG lPosX, LONG lPosY)
|
||||
{
|
||||
LONG dx = lPosX-m_lMainPosX;
|
||||
LONG dy = lPosY-m_lMainPosY;
|
||||
LONG len = (LONG)sqrt(double(dx * dx + dy * dy));
|
||||
|
||||
extern int CHAR_STAGE_VIEW_BOUND;
|
||||
if (len < CHAR_STAGE_VIEW_BOUND) // 거리제한 cm
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CNetworkActorManager::__IsMainActorVID(DWORD dwVID)
|
||||
{
|
||||
if (dwVID == m_dwMainVID)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
CPythonCharacterManager& CNetworkActorManager::__GetCharacterManager()
|
||||
{
|
||||
return CPythonCharacterManager::Instance();
|
||||
}
|
||||
|
||||
void CNetworkActorManager::__RemoveCharacterManagerActor(SNetworkActorData& rkNetActorData)
|
||||
{
|
||||
CPythonCharacterManager & rkChrMgr = CPythonCharacterManager::Instance();
|
||||
|
||||
if (__IsMainActorVID(rkNetActorData.m_dwVID))
|
||||
{
|
||||
rkChrMgr.DeleteInstance(rkNetActorData.m_dwVID);
|
||||
}
|
||||
else
|
||||
{
|
||||
rkChrMgr.DeleteInstanceByFade(rkNetActorData.m_dwVID);
|
||||
}
|
||||
}
|
||||
|
||||
CInstanceBase* CNetworkActorManager::__AppendCharacterManagerActor(SNetworkActorData& rkNetActorData)
|
||||
{
|
||||
Lognf(0, "CNetworkActorManager::__AppendCharacterManagerActor(%d, %s)", rkNetActorData.m_dwVID, rkNetActorData.m_stName.c_str());
|
||||
|
||||
DWORD dwVID=rkNetActorData.m_dwVID;
|
||||
|
||||
CPythonCharacterManager & rkChrMgr = CPythonCharacterManager::Instance();
|
||||
|
||||
|
||||
CInstanceBase::SCreateData kCreateData;
|
||||
kCreateData.m_bType=rkNetActorData.m_bType;
|
||||
kCreateData.m_dwLevel=rkNetActorData.m_dwLevel;
|
||||
kCreateData.m_dwGuildID=rkNetActorData.m_dwGuildID;
|
||||
kCreateData.m_dwEmpireID=rkNetActorData.m_dwEmpireID;
|
||||
kCreateData.m_dwVID=rkNetActorData.m_dwVID;
|
||||
kCreateData.m_dwMountVnum=rkNetActorData.m_dwMountVnum;
|
||||
kCreateData.m_dwRace=rkNetActorData.m_dwRace;
|
||||
kCreateData.m_fRot=rkNetActorData.m_fRot;
|
||||
kCreateData.m_lPosX=rkNetActorData.m_lCurX;
|
||||
kCreateData.m_lPosY=rkNetActorData.m_lCurY;
|
||||
kCreateData.m_stName=rkNetActorData.m_stName;
|
||||
kCreateData.m_dwStateFlags=rkNetActorData.m_dwStateFlags;
|
||||
kCreateData.m_dwMovSpd=rkNetActorData.m_dwMovSpd;
|
||||
kCreateData.m_dwAtkSpd=rkNetActorData.m_dwAtkSpd;
|
||||
kCreateData.m_sAlignment=rkNetActorData.m_sAlignment;
|
||||
kCreateData.m_byPKMode=rkNetActorData.m_byPKMode;
|
||||
kCreateData.m_kAffectFlags=rkNetActorData.m_kAffectFlags;
|
||||
kCreateData.m_dwArmor=rkNetActorData.m_dwArmor;
|
||||
kCreateData.m_dwWeapon=rkNetActorData.m_dwWeapon;
|
||||
kCreateData.m_dwHair=rkNetActorData.m_dwHair;
|
||||
kCreateData.m_isMain=__IsMainActorVID(dwVID);
|
||||
|
||||
CInstanceBase* pOldInstance = rkChrMgr.GetInstancePtr(dwVID);
|
||||
if (pOldInstance)
|
||||
{
|
||||
TPixelPosition oldPos;
|
||||
pOldInstance->GetGraphicThingInstancePtr()->GetPixelPosition( &oldPos );
|
||||
|
||||
bool bIsMountingHorse = pOldInstance->IsMountingHorse();
|
||||
if( (bIsMountingHorse && kCreateData.m_dwMountVnum == 0) ||
|
||||
(!bIsMountingHorse && kCreateData.m_dwMountVnum != 0) )
|
||||
{
|
||||
//Override Pos
|
||||
kCreateData.m_lPosX = oldPos.x;
|
||||
kCreateData.m_lPosY = -oldPos.y;
|
||||
}
|
||||
|
||||
rkChrMgr.DeleteInstance(dwVID);
|
||||
}
|
||||
|
||||
|
||||
CInstanceBase* pNewInstance = rkChrMgr.CreateInstance(kCreateData);
|
||||
if (!pNewInstance)
|
||||
return NULL;
|
||||
|
||||
if (kCreateData.m_isMain)
|
||||
{
|
||||
IAbstractPlayer & rkPlayer = IAbstractPlayer::GetSingleton();
|
||||
rkPlayer.SetMainCharacterIndex(dwVID);
|
||||
|
||||
|
||||
m_lMainPosX=rkNetActorData.m_lCurX;
|
||||
m_lMainPosY=rkNetActorData.m_lCurY;
|
||||
}
|
||||
|
||||
DWORD dwClientCurTime=ELTimer_GetMSec();
|
||||
DWORD dwElapsedTime=dwClientCurTime-rkNetActorData.m_dwClientSrcTime;
|
||||
|
||||
if (dwElapsedTime<rkNetActorData.m_dwDuration)
|
||||
{
|
||||
TPixelPosition kPPosDst;
|
||||
kPPosDst.x=float(rkNetActorData.m_lDstX);
|
||||
kPPosDst.y=float(rkNetActorData.m_lDstY);
|
||||
kPPosDst.z=0;
|
||||
pNewInstance->PushTCPState(rkNetActorData.m_dwServerSrcTime+dwElapsedTime, kPPosDst, rkNetActorData.m_fRot, CInstanceBase::FUNC_MOVE, 0);
|
||||
}
|
||||
return pNewInstance;
|
||||
}
|
||||
|
||||
void CNetworkActorManager::AppendActor(const SNetworkActorData& c_rkNetActorData)
|
||||
{
|
||||
if (__IsMainActorVID(c_rkNetActorData.m_dwVID))
|
||||
{
|
||||
bool bChangeMountStatus = false;
|
||||
|
||||
CInstanceBase* pMainInstance = CPythonCharacterManager::Instance().GetInstancePtr(c_rkNetActorData.m_dwVID);
|
||||
if( pMainInstance )
|
||||
{
|
||||
bool bIsMountingHorse = pMainInstance->IsMountingHorse();
|
||||
bChangeMountStatus = (bIsMountingHorse && c_rkNetActorData.m_dwMountVnum == 0) || (!bIsMountingHorse && c_rkNetActorData.m_dwMountVnum != 0);
|
||||
}
|
||||
|
||||
if( !bChangeMountStatus )
|
||||
{
|
||||
//__RemoveAllActors();
|
||||
__RemoveDynamicActors();
|
||||
__RemoveAllGroundItems();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
SNetworkActorData& rkNetActorData=m_kNetActorDict[c_rkNetActorData.m_dwVID];
|
||||
rkNetActorData=c_rkNetActorData;
|
||||
|
||||
if (__IsVisibleActor(rkNetActorData))
|
||||
{
|
||||
if (!__AppendCharacterManagerActor(rkNetActorData))
|
||||
m_kNetActorDict.erase(c_rkNetActorData.m_dwVID);
|
||||
}
|
||||
}
|
||||
|
||||
void CNetworkActorManager::RemoveActor(DWORD dwVID)
|
||||
{
|
||||
std::map<DWORD, SNetworkActorData>::iterator f=m_kNetActorDict.find(dwVID);
|
||||
if (m_kNetActorDict.end()==f)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
TraceError("CNetworkActorManager::RemoveActor(dwVID=%d) - NOT EXIST VID", dwVID);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
SNetworkActorData& rkNetActorData=f->second;
|
||||
__RemoveCharacterManagerActor(rkNetActorData);
|
||||
|
||||
m_kNetActorDict.erase(f);
|
||||
}
|
||||
|
||||
void CNetworkActorManager::UpdateActor(const SNetworkUpdateActorData& c_rkNetUpdateActorData)
|
||||
{
|
||||
std::map<DWORD, SNetworkActorData>::iterator f=m_kNetActorDict.find(c_rkNetUpdateActorData.m_dwVID);
|
||||
if (m_kNetActorDict.end()==f)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
TraceError("CNetworkActorManager::UpdateActor(dwVID=%d) - NOT EXIST VID", c_rkNetUpdateActorData.m_dwVID);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
SNetworkActorData& rkNetActorData=f->second;
|
||||
|
||||
CInstanceBase* pkInstFind=__FindActor(rkNetActorData);
|
||||
if (pkInstFind)
|
||||
{
|
||||
pkInstFind->ChangeArmor(c_rkNetUpdateActorData.m_dwArmor);
|
||||
pkInstFind->ChangeWeapon(c_rkNetUpdateActorData.m_dwWeapon);
|
||||
pkInstFind->ChangeHair(c_rkNetUpdateActorData.m_dwHair);
|
||||
pkInstFind->ChangeGuild(c_rkNetUpdateActorData.m_dwGuildID);
|
||||
pkInstFind->SetAffectFlagContainer(c_rkNetUpdateActorData.m_kAffectFlags);
|
||||
pkInstFind->SetMoveSpeed(c_rkNetUpdateActorData.m_dwMovSpd);
|
||||
pkInstFind->SetAttackSpeed(c_rkNetUpdateActorData.m_dwAtkSpd);
|
||||
pkInstFind->SetAlignment(c_rkNetUpdateActorData.m_sAlignment);
|
||||
pkInstFind->SetPKMode(c_rkNetUpdateActorData.m_byPKMode);
|
||||
pkInstFind->SetStateFlags(c_rkNetUpdateActorData.m_dwStateFlags);
|
||||
|
||||
//if( c_rkNetUpdateActorData.m_dwMountVnum != 0 )
|
||||
//{
|
||||
// pkInstFind->MountHorse(c_rkNetUpdateActorData.m_dwMountVnum);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// if( pkInstFind->IsMountingHorse() )
|
||||
// {
|
||||
// pkInstFind->DismountHorse();
|
||||
// }
|
||||
//}
|
||||
}
|
||||
|
||||
rkNetActorData.m_kAffectFlags=c_rkNetUpdateActorData.m_kAffectFlags;
|
||||
rkNetActorData.m_dwGuildID=c_rkNetUpdateActorData.m_dwGuildID;
|
||||
//rkNetActorData.m_dwLevel=c_rkNetUpdateActorData.m_dwLevel;
|
||||
rkNetActorData.m_dwMovSpd=c_rkNetUpdateActorData.m_dwMovSpd;
|
||||
rkNetActorData.m_dwAtkSpd=c_rkNetUpdateActorData.m_dwAtkSpd;
|
||||
rkNetActorData.m_dwArmor=c_rkNetUpdateActorData.m_dwArmor;
|
||||
rkNetActorData.m_dwWeapon=c_rkNetUpdateActorData.m_dwWeapon;
|
||||
rkNetActorData.m_dwHair=c_rkNetUpdateActorData.m_dwHair;
|
||||
rkNetActorData.m_sAlignment=c_rkNetUpdateActorData.m_sAlignment;
|
||||
rkNetActorData.m_byPKMode=c_rkNetUpdateActorData.m_byPKMode;
|
||||
}
|
||||
|
||||
void CNetworkActorManager::MoveActor(const SNetworkMoveActorData& c_rkNetMoveActorData)
|
||||
{
|
||||
std::map<DWORD, SNetworkActorData>::iterator f=m_kNetActorDict.find(c_rkNetMoveActorData.m_dwVID);
|
||||
if (m_kNetActorDict.end()==f)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
TraceError("CNetworkActorManager::MoveActor(dwVID=%d) - NOT EXIST VID", c_rkNetMoveActorData.m_dwVID);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
SNetworkActorData& rkNetActorData=f->second;
|
||||
|
||||
CInstanceBase* pkInstFind=__FindActor(rkNetActorData, c_rkNetMoveActorData.m_lPosX, c_rkNetMoveActorData.m_lPosY);
|
||||
if (pkInstFind)
|
||||
{
|
||||
TPixelPosition kPPosDst;
|
||||
kPPosDst.x=float(c_rkNetMoveActorData.m_lPosX);
|
||||
kPPosDst.y=float(c_rkNetMoveActorData.m_lPosY);
|
||||
kPPosDst.z=0.0f;
|
||||
|
||||
pkInstFind->PushTCPState(c_rkNetMoveActorData.m_dwTime, kPPosDst,
|
||||
c_rkNetMoveActorData.m_fRot, c_rkNetMoveActorData.m_dwFunc, c_rkNetMoveActorData.m_dwArg);
|
||||
}
|
||||
|
||||
rkNetActorData.SetDstPosition(c_rkNetMoveActorData.m_dwTime,
|
||||
c_rkNetMoveActorData.m_lPosX, c_rkNetMoveActorData.m_lPosY, c_rkNetMoveActorData.m_dwDuration);
|
||||
rkNetActorData.m_fRot=c_rkNetMoveActorData.m_fRot;
|
||||
}
|
||||
|
||||
void CNetworkActorManager::SyncActor(DWORD dwVID, LONG lPosX, LONG lPosY)
|
||||
{
|
||||
std::map<DWORD, SNetworkActorData>::iterator f=m_kNetActorDict.find(dwVID);
|
||||
if (m_kNetActorDict.end()==f)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
TraceError("CNetworkActorManager::SyncActor(dwVID=%d) - NOT EXIST VID", dwVID);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
SNetworkActorData& rkNetActorData=f->second;
|
||||
|
||||
CInstanceBase* pkInstFind=__FindActor(rkNetActorData);
|
||||
if (pkInstFind)
|
||||
{
|
||||
pkInstFind->NEW_SyncPixelPosition(lPosX, lPosY);
|
||||
}
|
||||
|
||||
rkNetActorData.SetPosition(lPosX, lPosY);
|
||||
}
|
||||
|
||||
void CNetworkActorManager::SetActorOwner(DWORD dwOwnerVID, DWORD dwVictimVID)
|
||||
{
|
||||
std::map<DWORD, SNetworkActorData>::iterator f=m_kNetActorDict.find(dwVictimVID);
|
||||
if (m_kNetActorDict.end()==f)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
TraceError("CNetworkActorManager::SetActorOwner(dwOwnerVID=%d, dwVictimVID=%d) - NOT EXIST VID", dwOwnerVID, dwVictimVID);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
SNetworkActorData& rkNetActorData=f->second;
|
||||
rkNetActorData.m_dwOwnerVID=dwOwnerVID;
|
||||
|
||||
CInstanceBase* pkInstFind=__FindActor(rkNetActorData);
|
||||
if (pkInstFind)
|
||||
{
|
||||
pkInstFind->NEW_SetOwner(rkNetActorData.m_dwOwnerVID);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -2319,8 +2319,9 @@ typedef struct SPacketGCShopSign
|
||||
typedef struct SPacketGCTime
|
||||
{
|
||||
BYTE bHeader;
|
||||
time_t time;
|
||||
LONG time; // PORT: _USE_32BIT_TIME_T in 40250 Win32; wire time is 32 bits on LP64.
|
||||
} TPacketGCTime;
|
||||
static_assert(sizeof(TPacketGCTime) == 5);
|
||||
|
||||
enum
|
||||
{
|
||||
|
||||
@@ -0,0 +1,965 @@
|
||||
#include "StdAfx.h"
|
||||
#include "PythonCharacterManager.h"
|
||||
#include "PythonBackground.h"
|
||||
#include "PythonNonPlayer.h"
|
||||
#include "AbstractPlayer.h"
|
||||
#include "Packet.h"
|
||||
|
||||
#include "../EterLib/Camera.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Frame Process
|
||||
|
||||
int CHAR_STAGE_VIEW_BOUND = 200*100;
|
||||
|
||||
struct FCharacterManagerCharacterInstanceUpdate
|
||||
{
|
||||
inline void operator () (const std::pair<DWORD,CInstanceBase *>& cr_Pair)
|
||||
{
|
||||
cr_Pair.second->Update();
|
||||
}
|
||||
};
|
||||
|
||||
void CPythonCharacterManager::AdjustCollisionWithOtherObjects(CActorInstance* pInst )
|
||||
{
|
||||
if( !pInst->IsPC() )
|
||||
return;
|
||||
|
||||
CPythonCharacterManager& rkChrMgr=CPythonCharacterManager::Instance();
|
||||
for(CPythonCharacterManager::CharacterIterator i = rkChrMgr.CharacterInstanceBegin(); i!=rkChrMgr.CharacterInstanceEnd();++i)
|
||||
{
|
||||
CInstanceBase* pkInstEach=*i;
|
||||
CActorInstance* rkActorEach=pkInstEach->GetGraphicThingInstancePtr();
|
||||
|
||||
if (rkActorEach==pInst)
|
||||
continue;
|
||||
|
||||
if( rkActorEach->IsPC() || rkActorEach->IsNPC() || rkActorEach->IsEnemy() )
|
||||
continue;
|
||||
|
||||
if(pInst->TestPhysicsBlendingCollision(*rkActorEach) )
|
||||
{
|
||||
// NOTE : 일단 기존위치로 원복
|
||||
// TODO : 향후 조금더 잘 처리한다면 physic movement거리를 steping해서 iteration처리해야 함.
|
||||
TPixelPosition curPos;
|
||||
pInst->GetPixelPosition(&curPos);
|
||||
pInst->SetBlendingPosition(curPos);
|
||||
//Tracef("!!!!!! Collision Adjusted\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CPythonCharacterManager::EnableSortRendering(bool isEnable)
|
||||
{
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::InsertPVPKey(DWORD dwVIDSrc, DWORD dwVIDDst)
|
||||
{
|
||||
CInstanceBase::InsertPVPKey(dwVIDSrc, dwVIDDst);
|
||||
|
||||
CInstanceBase* pkInstSrc=GetInstancePtr(dwVIDSrc);
|
||||
if (pkInstSrc)
|
||||
pkInstSrc->RefreshTextTail();
|
||||
|
||||
CInstanceBase* pkInstDst=GetInstancePtr(dwVIDDst);
|
||||
if (pkInstDst)
|
||||
pkInstDst->RefreshTextTail();
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::RemovePVPKey(DWORD dwVIDSrc, DWORD dwVIDDst)
|
||||
{
|
||||
CInstanceBase::RemovePVPKey(dwVIDSrc, dwVIDDst);
|
||||
|
||||
CInstanceBase* pkInstSrc=GetInstancePtr(dwVIDSrc);
|
||||
if (pkInstSrc)
|
||||
pkInstSrc->RefreshTextTail();
|
||||
|
||||
CInstanceBase* pkInstDst=GetInstancePtr(dwVIDDst);
|
||||
if (pkInstDst)
|
||||
pkInstDst->RefreshTextTail();
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::ChangeGVG(DWORD dwSrcGuildID, DWORD dwDstGuildID)
|
||||
{
|
||||
TCharacterInstanceMap::iterator itor;
|
||||
for (itor = m_kAliveInstMap.begin(); itor != m_kAliveInstMap.end(); itor++)
|
||||
{
|
||||
CInstanceBase * pInstance = itor->second;
|
||||
|
||||
DWORD dwInstanceGuildID = pInstance->GetGuildID();
|
||||
if (dwSrcGuildID == dwInstanceGuildID || dwDstGuildID == dwInstanceGuildID)
|
||||
{
|
||||
pInstance->RefreshTextTail();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::ClearMainInstance()
|
||||
{
|
||||
m_pkInstMain=NULL;
|
||||
}
|
||||
|
||||
bool CPythonCharacterManager::SetMainInstance(DWORD dwVID)
|
||||
{
|
||||
m_pkInstMain=GetInstancePtr(dwVID);
|
||||
|
||||
if (!m_pkInstMain)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CInstanceBase* CPythonCharacterManager::GetMainInstancePtr()
|
||||
{
|
||||
return m_pkInstMain;
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::GetInfo(std::string* pstInfo)
|
||||
{
|
||||
pstInfo->append("Actor: ");
|
||||
|
||||
CInstanceBase::GetInfo(pstInfo);
|
||||
|
||||
char szInfo[256];
|
||||
sprintf(szInfo, "Container - Live %d, Dead %d", m_kAliveInstMap.size(), m_kDeadInstList.size());
|
||||
pstInfo->append(szInfo);
|
||||
}
|
||||
|
||||
|
||||
bool CPythonCharacterManager::IsCacheMode()
|
||||
{
|
||||
static bool s_isOldCacheMode=false;
|
||||
|
||||
bool isCacheMode=s_isOldCacheMode;
|
||||
if (s_isOldCacheMode)
|
||||
{
|
||||
if (m_kAliveInstMap.size()<30)
|
||||
isCacheMode=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_kAliveInstMap.size()>40)
|
||||
isCacheMode=true;
|
||||
}
|
||||
s_isOldCacheMode=isCacheMode;
|
||||
|
||||
return isCacheMode;
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::Update()
|
||||
{
|
||||
#ifdef __PERFORMANCE_CHECKER__
|
||||
DWORD t1=timeGetTime();
|
||||
#endif
|
||||
CInstanceBase::ResetPerformanceCounter();
|
||||
|
||||
CInstanceBase* pkInstMain=GetMainInstancePtr();
|
||||
#ifdef __PERFORMANCE_CHECKER__
|
||||
DWORD t2=timeGetTime();
|
||||
#endif
|
||||
DWORD dwDeadInstCount=0;
|
||||
DWORD dwForceVisibleInstCount=0;
|
||||
|
||||
TCharacterInstanceMap::iterator i=m_kAliveInstMap.begin();
|
||||
while (m_kAliveInstMap.end()!=i)
|
||||
{
|
||||
TCharacterInstanceMap::iterator c=i++;
|
||||
|
||||
CInstanceBase* pkInstEach=c->second;
|
||||
pkInstEach->Update();
|
||||
|
||||
if (pkInstMain)
|
||||
{
|
||||
if (pkInstEach->IsForceVisible())
|
||||
{
|
||||
dwForceVisibleInstCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
int nDistance = int(pkInstEach->NEW_GetDistanceFromDestInstance(*pkInstMain));
|
||||
if (nDistance > CHAR_STAGE_VIEW_BOUND + 10)
|
||||
{
|
||||
__DeleteBlendOutInstance(pkInstEach);
|
||||
m_kAliveInstMap.erase(c);
|
||||
dwDeadInstCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef __PERFORMANCE_CHECKER__
|
||||
DWORD t3=timeGetTime();
|
||||
#endif
|
||||
UpdateTransform();
|
||||
#ifdef __PERFORMANCE_CHECKER__
|
||||
DWORD t4=timeGetTime();
|
||||
#endif
|
||||
|
||||
UpdateDeleting();
|
||||
#ifdef __PERFORMANCE_CHECKER__
|
||||
DWORD t5=timeGetTime();
|
||||
#endif
|
||||
|
||||
__NEW_Pick();
|
||||
#ifdef __PERFORMANCE_CHECKER__
|
||||
DWORD t6=timeGetTime();
|
||||
#endif
|
||||
|
||||
#ifdef __PERFORMANCE_CHECKER__
|
||||
{
|
||||
static FILE* fp=fopen("perf_chrmgr_update.txt", "w");
|
||||
|
||||
if (t6-t1>1)
|
||||
{
|
||||
fprintf(fp, "CU.Total %d (Time %d, Alive %d, Dead %d)\n",
|
||||
t6-t1, ELTimer_GetMSec(),
|
||||
m_kAliveInstMap.size(),
|
||||
m_kDeadInstList.size());
|
||||
fprintf(fp, "CU.Counter %d\n", t2-t1);
|
||||
fprintf(fp, "CU.ForEach %d\n", t3-t2);
|
||||
fprintf(fp, "CU.Trans %d\n", t4-t3);
|
||||
fprintf(fp, "CU.Del %d\n", t5-t4);
|
||||
fprintf(fp, "CU.Pick %d\n", t6-t5);
|
||||
fprintf(fp, "CU.AI %d\n", m_kAliveInstMap.size());
|
||||
fprintf(fp, "CU.DI %d\n", dwDeadInstCount);
|
||||
fprintf(fp, "CU.FVI %d\n", dwForceVisibleInstCount);
|
||||
fprintf(fp, "-------------------------------- \n");
|
||||
fflush(fp);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::ShowPointEffect(DWORD ePoint, DWORD dwVID)
|
||||
{
|
||||
CInstanceBase * pkInstSel = (dwVID == 0xffffffff) ? GetMainInstancePtr() : GetInstancePtr(dwVID);
|
||||
|
||||
if (!pkInstSel)
|
||||
return;
|
||||
|
||||
switch (ePoint)
|
||||
{
|
||||
case POINT_LEVEL:
|
||||
pkInstSel->LevelUp();
|
||||
break;
|
||||
case POINT_LEVEL_STEP:
|
||||
pkInstSel->SkillUp();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool CPythonCharacterManager::RegisterPointEffect(DWORD ePoint, const char* c_szFileName)
|
||||
{
|
||||
if (ePoint>=POINT_MAX_NUM)
|
||||
return false;
|
||||
|
||||
CEffectManager& rkEftMgr=CEffectManager::Instance();
|
||||
rkEftMgr.RegisterEffect2(c_szFileName, &m_adwPointEffect[ePoint]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::UpdateTransform()
|
||||
{
|
||||
#ifdef __PERFORMANCE_CHECKER__
|
||||
DWORD t1=timeGetTime();
|
||||
DWORD t2=timeGetTime();
|
||||
#endif
|
||||
|
||||
CInstanceBase * pMainInstance = GetMainInstancePtr();
|
||||
if (pMainInstance)
|
||||
{
|
||||
CPythonBackground& rkBG=CPythonBackground::Instance();
|
||||
for (TCharacterInstanceMap::iterator i = m_kAliveInstMap.begin(); i != m_kAliveInstMap.end(); ++i)
|
||||
{
|
||||
CInstanceBase * pSrcInstance = i->second;
|
||||
|
||||
pSrcInstance->CheckAdvancing();
|
||||
|
||||
// 2004.08.02.myevan.IsAttacked 일 경우 죽었을때도 체크하므로,
|
||||
// 실질적으로 거리가 변경되는 IsPushing일때만 체크하도록 한다
|
||||
if (pSrcInstance->IsPushing())
|
||||
rkBG.CheckAdvancing(pSrcInstance);
|
||||
}
|
||||
#ifdef __PERFORMANCE_CHECKER__
|
||||
t2=timeGetTime();
|
||||
#endif
|
||||
|
||||
#ifdef __MOVIE_MODE__
|
||||
if (!m_pkInstMain->IsMovieMode())
|
||||
{
|
||||
rkBG.CheckAdvancing(m_pkInstMain);
|
||||
}
|
||||
#else
|
||||
rkBG.CheckAdvancing(m_pkInstMain);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef __PERFORMANCE_CHECKER__
|
||||
DWORD t3=timeGetTime();
|
||||
#endif
|
||||
|
||||
{
|
||||
for (TCharacterInstanceMap::iterator itor = m_kAliveInstMap.begin(); itor != m_kAliveInstMap.end(); ++itor)
|
||||
{
|
||||
CInstanceBase * pInstance = itor->second;
|
||||
pInstance->Transform();
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __PERFORMANCE_CHECKER__
|
||||
DWORD t4=timeGetTime();
|
||||
#endif
|
||||
|
||||
#ifdef __PERFORMANCE_CHECKER__
|
||||
{
|
||||
static FILE* fp=fopen("perf_chrmgr_updatetransform.txt", "w");
|
||||
|
||||
if (t4-t1>5)
|
||||
{
|
||||
fprintf(fp, "CUT.Total %d (Time %f, Alive %d, Dead %d)\n",
|
||||
t4-t1, ELTimer_GetMSec()/1000.0f,
|
||||
m_kAliveInstMap.size(),
|
||||
m_kDeadInstList.size());
|
||||
fprintf(fp, "CUT.ChkAdvInst %d\n", t2-t1);
|
||||
fprintf(fp, "CUT.ChkAdvBG %d\n", t3-t2);
|
||||
fprintf(fp, "CUT.Trans %d\n", t4-t3);
|
||||
|
||||
fprintf(fp, "-------------------------------- \n");
|
||||
fflush(fp);
|
||||
}
|
||||
|
||||
fflush(fp);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
void CPythonCharacterManager::UpdateDeleting()
|
||||
{
|
||||
TCharacterInstanceList::iterator itor = m_kDeadInstList.begin();
|
||||
for (; itor != m_kDeadInstList.end();)
|
||||
{
|
||||
CInstanceBase * pInstance = *itor;
|
||||
|
||||
if (pInstance->UpdateDeleting())
|
||||
{
|
||||
++itor;
|
||||
}
|
||||
else
|
||||
{
|
||||
CInstanceBase::Delete(pInstance);
|
||||
itor = m_kDeadInstList.erase(itor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct FCharacterManagerCharacterInstanceDeform
|
||||
{
|
||||
inline void operator () (const std::pair<DWORD,CInstanceBase *>& cr_Pair)
|
||||
{
|
||||
cr_Pair.second->Deform();
|
||||
//pInstance->Update();
|
||||
}
|
||||
};
|
||||
struct FCharacterManagerCharacterInstanceListDeform
|
||||
{
|
||||
inline void operator () (CInstanceBase * pInstance)
|
||||
{
|
||||
pInstance->Deform();
|
||||
}
|
||||
};
|
||||
|
||||
void CPythonCharacterManager::Deform()
|
||||
{
|
||||
std::for_each(m_kAliveInstMap.begin(), m_kAliveInstMap.end(), FCharacterManagerCharacterInstanceDeform());
|
||||
std::for_each(m_kDeadInstList.begin(), m_kDeadInstList.end(), FCharacterManagerCharacterInstanceListDeform());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
bool CPythonCharacterManager::OLD_GetPickedInstanceVID(DWORD* pdwPickedActorID)
|
||||
{
|
||||
if (!m_pkInstPick)
|
||||
return false;
|
||||
|
||||
*pdwPickedActorID=m_pkInstPick->GetVirtualID();
|
||||
return true;
|
||||
}
|
||||
|
||||
CInstanceBase * CPythonCharacterManager::OLD_GetPickedInstancePtr()
|
||||
{
|
||||
return m_pkInstPick;
|
||||
}
|
||||
|
||||
D3DXVECTOR2 & CPythonCharacterManager::OLD_GetPickedInstPosReference()
|
||||
{
|
||||
return m_v2PickedInstProjPos;
|
||||
}
|
||||
|
||||
bool CPythonCharacterManager::IsRegisteredVID(DWORD dwVID)
|
||||
{
|
||||
if (m_kAliveInstMap.end()==m_kAliveInstMap.find(dwVID))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonCharacterManager::IsAliveVID(DWORD dwVID)
|
||||
{
|
||||
return m_kAliveInstMap.find(dwVID)!=m_kAliveInstMap.end();
|
||||
}
|
||||
|
||||
bool CPythonCharacterManager::IsDeadVID(DWORD dwVID)
|
||||
{
|
||||
for (TCharacterInstanceList::iterator f=m_kDeadInstList.begin(); f!=m_kDeadInstList.end(); ++f)
|
||||
{
|
||||
if ((*f)->GetVirtualID()==dwVID)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
struct LessCharacterInstancePtrRenderOrder
|
||||
{
|
||||
bool operator() (CInstanceBase* pkLeft, CInstanceBase* pkRight)
|
||||
{
|
||||
return pkLeft->LessRenderOrder(pkRight);
|
||||
}
|
||||
};
|
||||
|
||||
struct FCharacterManagerCharacterInstanceRender
|
||||
{
|
||||
inline void operator () (const std::pair<DWORD,CInstanceBase *>& cr_Pair)
|
||||
{
|
||||
cr_Pair.second->Render();
|
||||
cr_Pair.second->RenderTrace();
|
||||
}
|
||||
};
|
||||
struct FCharacterInstanceRender
|
||||
{
|
||||
inline void operator () (CInstanceBase * pInstance)
|
||||
{
|
||||
pInstance->Render();
|
||||
}
|
||||
};
|
||||
struct FCharacterInstanceRenderTrace
|
||||
{
|
||||
inline void operator () (CInstanceBase * pInstance)
|
||||
{
|
||||
pInstance->RenderTrace();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
void CPythonCharacterManager::__RenderSortedAliveActorList()
|
||||
{
|
||||
static std::vector<CInstanceBase*> s_kVct_pkInstAliveSort;
|
||||
s_kVct_pkInstAliveSort.clear();
|
||||
|
||||
TCharacterInstanceMap& rkMap_pkInstAlive=m_kAliveInstMap;
|
||||
TCharacterInstanceMap::iterator i;
|
||||
for (i=rkMap_pkInstAlive.begin(); i!=rkMap_pkInstAlive.end(); ++i)
|
||||
s_kVct_pkInstAliveSort.push_back(i->second);
|
||||
|
||||
std::sort(s_kVct_pkInstAliveSort.begin(), s_kVct_pkInstAliveSort.end(), LessCharacterInstancePtrRenderOrder());
|
||||
std::for_each(s_kVct_pkInstAliveSort.begin(), s_kVct_pkInstAliveSort.end(), FCharacterInstanceRender());
|
||||
std::for_each(s_kVct_pkInstAliveSort.begin(), s_kVct_pkInstAliveSort.end(), FCharacterInstanceRenderTrace());
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::__RenderSortedDeadActorList()
|
||||
{
|
||||
static std::vector<CInstanceBase*> s_kVct_pkInstDeadSort;
|
||||
s_kVct_pkInstDeadSort.clear();
|
||||
|
||||
TCharacterInstanceList& rkLst_pkInstDead=m_kDeadInstList;
|
||||
TCharacterInstanceList::iterator i;
|
||||
for (i=rkLst_pkInstDead.begin(); i!=rkLst_pkInstDead.end(); ++i)
|
||||
s_kVct_pkInstDeadSort.push_back(*i);
|
||||
|
||||
std::sort(s_kVct_pkInstDeadSort.begin(), s_kVct_pkInstDeadSort.end(), LessCharacterInstancePtrRenderOrder());
|
||||
std::for_each(s_kVct_pkInstDeadSort.begin(), s_kVct_pkInstDeadSort.end(), FCharacterInstanceRender());
|
||||
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::Render()
|
||||
{
|
||||
STATEMANAGER.SetTexture(0, NULL);
|
||||
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
|
||||
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_CURRENT);
|
||||
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||
STATEMANAGER.SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
|
||||
STATEMANAGER.SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
|
||||
|
||||
STATEMANAGER.SetTexture(1, NULL);
|
||||
STATEMANAGER.SetTextureStageState(1, D3DTSS_COLOROP, D3DTOP_DISABLE);
|
||||
STATEMANAGER.SetTextureStageState(1, D3DTSS_ALPHAOP, D3DTOP_DISABLE);
|
||||
|
||||
|
||||
__RenderSortedAliveActorList();
|
||||
__RenderSortedDeadActorList();
|
||||
|
||||
CInstanceBase * pkPickedInst = OLD_GetPickedInstancePtr();
|
||||
if (pkPickedInst)
|
||||
{
|
||||
const D3DXVECTOR3 & c_rv3Position = pkPickedInst->GetGraphicThingInstanceRef().GetPosition();
|
||||
CPythonGraphic::Instance().ProjectPosition(c_rv3Position.x, c_rv3Position.y, c_rv3Position.z, &m_v2PickedInstProjPos.x, &m_v2PickedInstProjPos.y);
|
||||
}
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::RenderShadowMainInstance()
|
||||
{
|
||||
CInstanceBase* pkInstMain=GetMainInstancePtr();
|
||||
if (pkInstMain)
|
||||
pkInstMain->RenderToShadowMap();
|
||||
}
|
||||
|
||||
struct FCharacterManagerCharacterInstanceRenderToShadowMap
|
||||
{
|
||||
inline void operator () (const std::pair<DWORD,CInstanceBase *>& cr_Pair)
|
||||
{
|
||||
cr_Pair.second->RenderToShadowMap();
|
||||
}
|
||||
};
|
||||
|
||||
void CPythonCharacterManager::RenderShadowAllInstances()
|
||||
{
|
||||
std::for_each(m_kAliveInstMap.begin(), m_kAliveInstMap.end(), FCharacterManagerCharacterInstanceRenderToShadowMap());
|
||||
}
|
||||
|
||||
struct FCharacterManagerCharacterInstanceRenderCollision
|
||||
{
|
||||
inline void operator () (const std::pair<DWORD,CInstanceBase *>& cr_Pair)
|
||||
{
|
||||
cr_Pair.second->RenderCollision();
|
||||
}
|
||||
};
|
||||
|
||||
void CPythonCharacterManager::RenderCollision()
|
||||
{
|
||||
std::for_each(m_kAliveInstMap.begin(), m_kAliveInstMap.end(), FCharacterManagerCharacterInstanceRenderCollision());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Managing Process
|
||||
|
||||
CInstanceBase * CPythonCharacterManager::CreateInstance(const CInstanceBase::SCreateData& c_rkCreateData)
|
||||
{
|
||||
CInstanceBase * pCharacterInstance = RegisterInstance(c_rkCreateData.m_dwVID);
|
||||
if (!pCharacterInstance)
|
||||
{
|
||||
TraceError("CPythonCharacterManager::CreateInstance: VID[%d] - ALREADY EXIST\n", c_rkCreateData.m_dwVID); // PORT: MSVC accepted a struct through varargs; pass the intended VID.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!pCharacterInstance->Create(c_rkCreateData))
|
||||
{
|
||||
TraceError("CPythonCharacterManager::CreateInstance VID[%d] Race[%d]", c_rkCreateData.m_dwVID, c_rkCreateData.m_dwRace);
|
||||
DeleteInstance(c_rkCreateData.m_dwVID);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (c_rkCreateData.m_isMain)
|
||||
SelectInstance(c_rkCreateData.m_dwVID);
|
||||
|
||||
return (pCharacterInstance);
|
||||
}
|
||||
|
||||
CInstanceBase * CPythonCharacterManager::RegisterInstance(DWORD VirtualID)
|
||||
{
|
||||
TCharacterInstanceMap::iterator itor = m_kAliveInstMap.find(VirtualID);
|
||||
|
||||
if (m_kAliveInstMap.end() != itor)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CInstanceBase * pCharacterInstance = CInstanceBase::New();
|
||||
m_kAliveInstMap.insert(TCharacterInstanceMap::value_type(VirtualID, pCharacterInstance));
|
||||
|
||||
return (pCharacterInstance);
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::DeleteInstance(DWORD dwDelVID)
|
||||
{
|
||||
TCharacterInstanceMap::iterator itor = m_kAliveInstMap.find(dwDelVID);
|
||||
|
||||
if (m_kAliveInstMap.end() == itor)
|
||||
{
|
||||
Tracef("DeleteCharacterInstance: no vid by %d\n", dwDelVID);
|
||||
return;
|
||||
}
|
||||
|
||||
CInstanceBase * pkInstDel = itor->second;
|
||||
|
||||
if (pkInstDel == m_pkInstBind)
|
||||
m_pkInstBind = NULL;
|
||||
|
||||
if (pkInstDel == m_pkInstMain)
|
||||
m_pkInstMain = NULL;
|
||||
|
||||
if (pkInstDel == m_pkInstPick)
|
||||
m_pkInstPick = NULL;
|
||||
|
||||
CInstanceBase::Delete(pkInstDel);
|
||||
|
||||
m_kAliveInstMap.erase(itor);
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::__DeleteBlendOutInstance(CInstanceBase* pkInstDel)
|
||||
{
|
||||
pkInstDel->DeleteBlendOut();
|
||||
m_kDeadInstList.push_back(pkInstDel);
|
||||
|
||||
IAbstractPlayer& rkPlayer=IAbstractPlayer::GetSingleton();
|
||||
rkPlayer.NotifyCharacterDead(pkInstDel->GetVirtualID());
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::DeleteInstanceByFade(DWORD dwVID)
|
||||
{
|
||||
TCharacterInstanceMap::iterator f = m_kAliveInstMap.find(dwVID);
|
||||
if (m_kAliveInstMap.end() == f)
|
||||
{
|
||||
return;
|
||||
}
|
||||
__DeleteBlendOutInstance(f->second);
|
||||
m_kAliveInstMap.erase(f);
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::SelectInstance(DWORD VirtualID)
|
||||
{
|
||||
TCharacterInstanceMap::iterator itor = m_kAliveInstMap.find(VirtualID);
|
||||
|
||||
if (m_kAliveInstMap.end() == itor)
|
||||
{
|
||||
Tracef("SelectCharacterInstance: no vid by %d\n", VirtualID);
|
||||
return;
|
||||
}
|
||||
|
||||
m_pkInstBind = itor->second;
|
||||
}
|
||||
|
||||
CInstanceBase * CPythonCharacterManager::GetInstancePtr(DWORD VirtualID)
|
||||
{
|
||||
TCharacterInstanceMap::iterator itor = m_kAliveInstMap.find(VirtualID);
|
||||
|
||||
if (m_kAliveInstMap.end() == itor)
|
||||
return NULL;
|
||||
|
||||
return itor->second;
|
||||
}
|
||||
|
||||
CInstanceBase * CPythonCharacterManager::GetInstancePtrByName(const char *name)
|
||||
{
|
||||
TCharacterInstanceMap::iterator itor;
|
||||
|
||||
for (itor = m_kAliveInstMap.begin(); itor != m_kAliveInstMap.end(); itor++)
|
||||
{
|
||||
CInstanceBase * pInstance = itor->second;
|
||||
|
||||
if (!strcmp(pInstance->GetNameString(), name))
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CInstanceBase * CPythonCharacterManager::GetSelectedInstancePtr()
|
||||
{
|
||||
return m_pkInstBind;
|
||||
}
|
||||
|
||||
CInstanceBase* CPythonCharacterManager::FindClickableInstancePtr()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::__UpdateSortPickedActorList()
|
||||
{
|
||||
__UpdatePickedActorList();
|
||||
__SortPickedActorList();
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::__UpdatePickedActorList()
|
||||
{
|
||||
m_kVct_pkInstPicked.clear();
|
||||
|
||||
TCharacterInstanceMap::iterator i;
|
||||
for (i=m_kAliveInstMap.begin(); i!=m_kAliveInstMap.end(); ++i)
|
||||
{
|
||||
CInstanceBase* pkInstEach=i->second;
|
||||
// 2004.07.17.levites.isShow를 ViewFrustumCheck로 변경
|
||||
if (pkInstEach->CanPickInstance())
|
||||
{
|
||||
if (pkInstEach->IsDead())
|
||||
{
|
||||
if (pkInstEach->IntersectBoundingBox())
|
||||
m_kVct_pkInstPicked.push_back(pkInstEach);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pkInstEach->IntersectDefendingSphere())
|
||||
m_kVct_pkInstPicked.push_back(pkInstEach);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct CInstanceBase_SLessCameraDistance
|
||||
{
|
||||
TPixelPosition m_kPPosEye;
|
||||
|
||||
bool operator() (CInstanceBase* pkInstLeft, CInstanceBase* pkInstRight)
|
||||
{
|
||||
int nLeftDeadPoint=pkInstLeft->IsDead();
|
||||
int nRightDeadPoint=pkInstRight->IsDead();
|
||||
|
||||
if (nLeftDeadPoint<nRightDeadPoint)
|
||||
return true;
|
||||
|
||||
if (pkInstLeft->CalculateDistanceSq3d(m_kPPosEye)<pkInstRight->CalculateDistanceSq3d(m_kPPosEye))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
void CPythonCharacterManager::__SortPickedActorList()
|
||||
{
|
||||
CCamera * pCamera = CCameraManager::Instance().GetCurrentCamera();
|
||||
const D3DXVECTOR3& c_rv3EyePos=pCamera->GetEye();
|
||||
|
||||
CInstanceBase_SLessCameraDistance kLess;
|
||||
kLess.m_kPPosEye=TPixelPosition(+c_rv3EyePos.x, -c_rv3EyePos.y, +c_rv3EyePos.z);
|
||||
|
||||
std::sort(m_kVct_pkInstPicked.begin(), m_kVct_pkInstPicked.end(), kLess);
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::__NEW_Pick()
|
||||
{
|
||||
__UpdateSortPickedActorList();
|
||||
|
||||
CInstanceBase* pkInstMain=GetMainInstancePtr();
|
||||
|
||||
#ifdef __MOVIE_MODE
|
||||
if (pkInstMain)
|
||||
if (pkInstMain->IsMovieMode())
|
||||
{
|
||||
if (m_pkInstPick)
|
||||
m_pkInstPick->OnUnselected();
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
// 정밀한 체크
|
||||
{
|
||||
std::vector<CInstanceBase*>::iterator f;
|
||||
for (f=m_kVct_pkInstPicked.begin(); f!=m_kVct_pkInstPicked.end(); ++f)
|
||||
{
|
||||
CInstanceBase* pkInstEach=*f;
|
||||
if (pkInstEach!=pkInstMain && pkInstEach->IntersectBoundingBox())
|
||||
{
|
||||
if (m_pkInstPick)
|
||||
if (m_pkInstPick!=pkInstEach)
|
||||
m_pkInstPick->OnUnselected();
|
||||
|
||||
if (pkInstEach->CanPickInstance())
|
||||
{
|
||||
m_pkInstPick = pkInstEach;
|
||||
m_pkInstPick->OnSelected();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 못찾겠으면 걍 순서대로
|
||||
{
|
||||
std::vector<CInstanceBase*>::iterator f;
|
||||
for (f=m_kVct_pkInstPicked.begin(); f!=m_kVct_pkInstPicked.end(); ++f)
|
||||
{
|
||||
CInstanceBase* pkInstEach=*f;
|
||||
if (pkInstEach!=pkInstMain)
|
||||
{
|
||||
if (m_pkInstPick)
|
||||
if (m_pkInstPick!=pkInstEach)
|
||||
m_pkInstPick->OnUnselected();
|
||||
|
||||
if (pkInstEach->CanPickInstance())
|
||||
{
|
||||
m_pkInstPick = pkInstEach;
|
||||
m_pkInstPick->OnSelected();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (pkInstMain)
|
||||
if (pkInstMain->CanPickInstance())
|
||||
if (m_kVct_pkInstPicked.end() != std::find(m_kVct_pkInstPicked.begin(), m_kVct_pkInstPicked.end(), pkInstMain))
|
||||
{
|
||||
if (m_pkInstPick)
|
||||
if (m_pkInstPick!=pkInstMain)
|
||||
m_pkInstPick->OnUnselected();
|
||||
|
||||
m_pkInstPick = pkInstMain;
|
||||
m_pkInstPick->OnSelected();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_pkInstPick)
|
||||
{
|
||||
m_pkInstPick->OnUnselected();
|
||||
m_pkInstPick=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::__OLD_Pick()
|
||||
{
|
||||
for (TCharacterInstanceMap::iterator itor = m_kAliveInstMap.begin(); itor != m_kAliveInstMap.end(); ++itor)
|
||||
{
|
||||
CInstanceBase * pkInstEach = itor->second;
|
||||
|
||||
if (pkInstEach == m_pkInstMain)
|
||||
continue;
|
||||
|
||||
if (pkInstEach->IntersectDefendingSphere())
|
||||
{
|
||||
if (m_pkInstPick)
|
||||
if (m_pkInstPick!=pkInstEach)
|
||||
m_pkInstPick->OnUnselected();
|
||||
|
||||
m_pkInstPick = pkInstEach;
|
||||
m_pkInstPick->OnSelected();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_pkInstPick)
|
||||
{
|
||||
m_pkInstPick->OnUnselected();
|
||||
m_pkInstPick=NULL;
|
||||
}
|
||||
}
|
||||
|
||||
int CPythonCharacterManager::PickAll()
|
||||
{
|
||||
for (TCharacterInstanceMap::iterator itor = m_kAliveInstMap.begin(); itor != m_kAliveInstMap.end(); ++itor)
|
||||
{
|
||||
CInstanceBase * pInstance = itor->second;
|
||||
|
||||
if (pInstance->IntersectDefendingSphere())
|
||||
return pInstance->GetVirtualID();
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
CInstanceBase * CPythonCharacterManager::GetCloseInstance(CInstanceBase * pInstance)
|
||||
{
|
||||
float fMinDistance = 10000.0f;
|
||||
CInstanceBase * pCloseInstance = NULL;
|
||||
|
||||
TCharacterInstanceMap::iterator itor = m_kAliveInstMap.begin();
|
||||
for (; itor != m_kAliveInstMap.end(); ++itor)
|
||||
{
|
||||
CInstanceBase * pTargetInstance = itor->second;
|
||||
|
||||
if (pTargetInstance == pInstance)
|
||||
continue;
|
||||
|
||||
DWORD dwVirtualNumber = pTargetInstance->GetVirtualNumber();
|
||||
if (CPythonNonPlayer::ON_CLICK_EVENT_BATTLE != CPythonNonPlayer::Instance().GetEventType(dwVirtualNumber))
|
||||
continue;
|
||||
|
||||
float fDistance = pInstance->GetDistance(pTargetInstance);
|
||||
if (fDistance < fMinDistance)
|
||||
{
|
||||
fMinDistance = fDistance;
|
||||
pCloseInstance = pTargetInstance;
|
||||
}
|
||||
}
|
||||
|
||||
return pCloseInstance;
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::RefreshAllPCTextTail()
|
||||
{
|
||||
CPythonCharacterManager::CharacterIterator itor = CharacterInstanceBegin();
|
||||
CPythonCharacterManager::CharacterIterator itorEnd = CharacterInstanceEnd();
|
||||
for (; itor != itorEnd; ++itor)
|
||||
{
|
||||
CInstanceBase * pInstance = *itor;
|
||||
if (!pInstance->IsPC())
|
||||
continue;
|
||||
|
||||
pInstance->RefreshTextTail();
|
||||
}
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::RefreshAllGuildMark()
|
||||
{
|
||||
CPythonCharacterManager::CharacterIterator itor = CharacterInstanceBegin();
|
||||
CPythonCharacterManager::CharacterIterator itorEnd = CharacterInstanceEnd();
|
||||
for (; itor != itorEnd; ++itor)
|
||||
{
|
||||
CInstanceBase * pInstance = *itor;
|
||||
if (!pInstance->IsPC())
|
||||
continue;
|
||||
|
||||
pInstance->ChangeGuild(pInstance->GetGuildID());
|
||||
pInstance->RefreshTextTail();
|
||||
}
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::DeleteAllInstances()
|
||||
{
|
||||
DestroyAliveInstanceMap();
|
||||
DestroyDeadInstanceList();
|
||||
}
|
||||
|
||||
|
||||
void CPythonCharacterManager::DestroyAliveInstanceMap()
|
||||
{
|
||||
for (TCharacterInstanceMap::iterator i = m_kAliveInstMap.begin(); i != m_kAliveInstMap.end(); ++i)
|
||||
CInstanceBase::Delete(i->second);
|
||||
|
||||
m_kAliveInstMap.clear();
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::DestroyDeadInstanceList()
|
||||
{
|
||||
std::for_each(m_kDeadInstList.begin(), m_kDeadInstList.end(), CInstanceBase::Delete);
|
||||
m_kDeadInstList.clear();
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::Destroy()
|
||||
{
|
||||
DeleteAllInstances();
|
||||
|
||||
CInstanceBase::DestroySystem();
|
||||
|
||||
__Initialize();
|
||||
}
|
||||
|
||||
void CPythonCharacterManager::__Initialize()
|
||||
{
|
||||
memset(m_adwPointEffect, 0, sizeof(m_adwPointEffect));
|
||||
m_pkInstMain = NULL;
|
||||
m_pkInstBind = NULL;
|
||||
m_pkInstPick = NULL;
|
||||
m_v2PickedInstProjPos = D3DXVECTOR2(0.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
CPythonCharacterManager::CPythonCharacterManager()
|
||||
{
|
||||
__Initialize();
|
||||
}
|
||||
|
||||
CPythonCharacterManager::~CPythonCharacterManager()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
@@ -0,0 +1,834 @@
|
||||
#include "StdAfx.h"
|
||||
#include "PythonChat.h"
|
||||
|
||||
#include "AbstractApplication.h"
|
||||
#include "PythonCharacterManager.h"
|
||||
#include "../EterBase/Timer.h"
|
||||
|
||||
int CPythonChat::TChatSet::ms_iChatModeSize = CHAT_TYPE_MAX_NUM;
|
||||
|
||||
const float c_fStartDisappearingTime = 5.0f;
|
||||
const int c_iMaxLineCount = 5;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CDynamicPool<CPythonChat::SChatLine> CPythonChat::SChatLine::ms_kPool;
|
||||
|
||||
void CPythonChat::SetChatColor(UINT eType, UINT r, UINT g, UINT b)
|
||||
{
|
||||
if (eType>=CHAT_TYPE_MAX_NUM)
|
||||
return;
|
||||
|
||||
DWORD dwColor=(0xff000000)|(r<<16)|(g<<8)|(b);
|
||||
m_akD3DXClrChat[eType]=D3DXCOLOR(dwColor);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CPythonChat::SChatLine* CPythonChat::SChatLine::New()
|
||||
{
|
||||
return ms_kPool.Alloc();
|
||||
}
|
||||
|
||||
void CPythonChat::SChatLine::Delete(CPythonChat::SChatLine* pkChatLine)
|
||||
{
|
||||
pkChatLine->Instance.Destroy();
|
||||
ms_kPool.Free(pkChatLine);
|
||||
}
|
||||
|
||||
void CPythonChat::SChatLine::DestroySystem()
|
||||
{
|
||||
ms_kPool.Destroy();
|
||||
}
|
||||
|
||||
void CPythonChat::SChatLine::SetColor(DWORD dwID, DWORD dwColor)
|
||||
{
|
||||
assert(dwID < CHAT_LINE_COLOR_ARRAY_MAX_NUM);
|
||||
|
||||
if (dwID >= CHAT_LINE_COLOR_ARRAY_MAX_NUM)
|
||||
return;
|
||||
|
||||
aColor[dwID] = dwColor;
|
||||
}
|
||||
|
||||
void CPythonChat::SChatLine::SetColorAll(DWORD dwColor)
|
||||
{
|
||||
for (int i = 0; i < CHAT_LINE_COLOR_ARRAY_MAX_NUM; ++i)
|
||||
aColor[i] = dwColor;
|
||||
}
|
||||
|
||||
D3DXCOLOR & CPythonChat::SChatLine::GetColorRef(DWORD dwID)
|
||||
{
|
||||
assert(dwID < CHAT_LINE_COLOR_ARRAY_MAX_NUM);
|
||||
|
||||
if (dwID >= CHAT_LINE_COLOR_ARRAY_MAX_NUM)
|
||||
{
|
||||
static D3DXCOLOR color(1.0f, 0.0f, 0.0f, 1.0f);
|
||||
return color;
|
||||
}
|
||||
|
||||
return aColor[dwID];
|
||||
}
|
||||
|
||||
CPythonChat::SChatLine::SChatLine()
|
||||
{
|
||||
for (int i = 0; i < CHAT_LINE_COLOR_ARRAY_MAX_NUM; ++i)
|
||||
aColor[i] = 0xff0000ff;
|
||||
}
|
||||
CPythonChat::SChatLine::~SChatLine()
|
||||
{
|
||||
Instance.Destroy();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int CPythonChat::CreateChatSet(DWORD dwID)
|
||||
{
|
||||
m_ChatSetMap.insert(std::make_pair(dwID, TChatSet()));
|
||||
return dwID;
|
||||
}
|
||||
|
||||
void CPythonChat::UpdateViewMode(DWORD dwID)
|
||||
{
|
||||
IAbstractApplication& rApp=IAbstractApplication::GetSingleton();
|
||||
|
||||
float fcurTime = rApp.GetGlobalTime();
|
||||
//float felapsedTime = rApp.GetGlobalElapsedTime();
|
||||
|
||||
TChatSet * pChatSet = GetChatSetPtr(dwID);
|
||||
if (!pChatSet)
|
||||
return;
|
||||
|
||||
TChatLineList * pLineList = &(pChatSet->m_ShowingChatLineList);
|
||||
int iLineIndex = pLineList->size();
|
||||
int iHeight = -(int(pLineList->size()+1) * pChatSet->m_iStep);
|
||||
|
||||
TChatLineList::iterator itor;
|
||||
for (itor = pLineList->begin(); itor != pLineList->end();)
|
||||
{
|
||||
TChatLine * pChatLine = (*itor);
|
||||
|
||||
D3DXCOLOR & rColor = pChatLine->GetColorRef(dwID);
|
||||
|
||||
float fElapsedTime = (fcurTime - pChatLine->fAppendedTime);
|
||||
if (fElapsedTime >= c_fStartDisappearingTime || iLineIndex >= c_iMaxLineCount)
|
||||
{
|
||||
rColor.a -= rColor.a / 10.0f;
|
||||
|
||||
if (rColor.a <= 0.1f)
|
||||
{
|
||||
itor = pLineList->erase(itor);
|
||||
}
|
||||
else
|
||||
{
|
||||
++itor;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
++itor;
|
||||
}
|
||||
|
||||
/////
|
||||
|
||||
iHeight += pChatSet->m_iStep;
|
||||
--iLineIndex;
|
||||
|
||||
pChatLine->Instance.SetPosition(pChatSet->m_ix, pChatSet->m_iy + iHeight);
|
||||
pChatLine->Instance.SetColor(rColor);
|
||||
pChatLine->Instance.Update();
|
||||
}
|
||||
}
|
||||
|
||||
void CPythonChat::UpdateEditMode(DWORD dwID)
|
||||
{
|
||||
TChatSet * pChatSet = GetChatSetPtr(dwID);
|
||||
if (!pChatSet)
|
||||
return;
|
||||
|
||||
const int c_iAlphaLine = max(0, GetVisibleLineCount(dwID) - GetEditableLineCount(dwID) + 2);
|
||||
|
||||
int iLineIndex = 0;
|
||||
float fAlpha = 0.0f;
|
||||
float fAlphaStep = 0.0f;
|
||||
|
||||
if (c_iAlphaLine > 0)
|
||||
fAlphaStep = 1.0f / float(c_iAlphaLine);
|
||||
|
||||
TChatLineList * pLineList = &(pChatSet->m_ShowingChatLineList);
|
||||
int iHeight = -(int(pLineList->size()+1) * pChatSet->m_iStep);
|
||||
|
||||
for (TChatLineList::iterator itor = pLineList->begin(); itor != pLineList->end(); ++itor)
|
||||
{
|
||||
TChatLine * pChatLine = (*itor);
|
||||
|
||||
D3DXCOLOR & rColor = pChatLine->GetColorRef(dwID);
|
||||
|
||||
if (iLineIndex < c_iAlphaLine)
|
||||
{
|
||||
rColor.a += (fAlpha - rColor.a) / 10.0f;
|
||||
fAlpha = fMIN(fAlpha+fAlphaStep, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
rColor.a = fMIN(rColor.a+0.05f, 1.0f);
|
||||
}
|
||||
|
||||
iHeight += pChatSet->m_iStep;
|
||||
pChatLine->Instance.SetPosition(pChatSet->m_ix, pChatSet->m_iy + iHeight);
|
||||
pChatLine->Instance.SetColor(rColor);
|
||||
pChatLine->Instance.Update();
|
||||
}
|
||||
}
|
||||
|
||||
void CPythonChat::UpdateLogMode(DWORD dwID)
|
||||
{
|
||||
TChatSet * pChatSet = GetChatSetPtr(dwID);
|
||||
if (!pChatSet)
|
||||
return;
|
||||
|
||||
TChatLineList * pLineList = &(pChatSet->m_ShowingChatLineList);
|
||||
int iHeight = 0;
|
||||
|
||||
for (TChatLineList::reverse_iterator itor = pLineList->rbegin(); itor != pLineList->rend(); ++itor)
|
||||
{
|
||||
TChatLine * pChatLine = (*itor);
|
||||
|
||||
iHeight -= pChatSet->m_iStep;
|
||||
pChatLine->Instance.SetPosition(pChatSet->m_ix, pChatSet->m_iy + iHeight);
|
||||
pChatLine->Instance.SetColor(pChatLine->GetColorRef(dwID));
|
||||
pChatLine->Instance.Update();
|
||||
}
|
||||
}
|
||||
|
||||
void CPythonChat::Update(DWORD dwID)
|
||||
{
|
||||
TChatSet * pChatSet = GetChatSetPtr(dwID);
|
||||
if (!pChatSet)
|
||||
return;
|
||||
|
||||
switch (pChatSet->m_iBoardState)
|
||||
{
|
||||
case BOARD_STATE_VIEW:
|
||||
UpdateViewMode(dwID);
|
||||
break;
|
||||
case BOARD_STATE_EDIT:
|
||||
UpdateEditMode(dwID);
|
||||
break;
|
||||
case BOARD_STATE_LOG:
|
||||
UpdateLogMode(dwID);
|
||||
break;
|
||||
}
|
||||
|
||||
DWORD dwcurTime = CTimer::Instance().GetCurrentMillisecond();
|
||||
for (TWaitChatList::iterator itor = m_WaitChatList.begin(); itor != m_WaitChatList.end();)
|
||||
{
|
||||
TWaitChat & rWaitChat = *itor;
|
||||
|
||||
if (rWaitChat.dwAppendingTime < dwcurTime)
|
||||
{
|
||||
AppendChat(rWaitChat.iType, rWaitChat.strChat.c_str());
|
||||
|
||||
itor = m_WaitChatList.erase(itor);
|
||||
}
|
||||
else
|
||||
{
|
||||
++itor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPythonChat::Render(DWORD dwID)
|
||||
{
|
||||
TChatLineList * pLineList = GetChatLineListPtr(dwID);
|
||||
if (!pLineList)
|
||||
return;
|
||||
|
||||
for (TChatLineList::iterator itor = pLineList->begin(); itor != pLineList->end(); ++itor)
|
||||
{
|
||||
CGraphicTextInstance & rInstance = (*itor)->Instance;
|
||||
rInstance.Render();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CPythonChat::SetBoardState(DWORD dwID, int iState)
|
||||
{
|
||||
TChatSet * pChatSet = GetChatSetPtr(dwID);
|
||||
if (!pChatSet)
|
||||
return;
|
||||
|
||||
pChatSet->m_iBoardState = iState;
|
||||
ArrangeShowingChat(dwID);
|
||||
}
|
||||
void CPythonChat::SetPosition(DWORD dwID, int ix, int iy)
|
||||
{
|
||||
TChatSet * pChatSet = GetChatSetPtr(dwID);
|
||||
if (!pChatSet)
|
||||
return;
|
||||
|
||||
pChatSet->m_ix = ix;
|
||||
pChatSet->m_iy = iy;
|
||||
}
|
||||
void CPythonChat::SetHeight(DWORD dwID, int iHeight)
|
||||
{
|
||||
TChatSet * pChatSet = GetChatSetPtr(dwID);
|
||||
if (!pChatSet)
|
||||
return;
|
||||
|
||||
pChatSet->m_iHeight = iHeight;
|
||||
}
|
||||
void CPythonChat::SetStep(DWORD dwID, int iStep)
|
||||
{
|
||||
TChatSet * pChatSet = GetChatSetPtr(dwID);
|
||||
if (!pChatSet)
|
||||
return;
|
||||
|
||||
pChatSet->m_iStep = iStep;
|
||||
}
|
||||
void CPythonChat::ToggleChatMode(DWORD dwID, int iMode)
|
||||
{
|
||||
TChatSet * pChatSet = GetChatSetPtr(dwID);
|
||||
if (!pChatSet)
|
||||
return;
|
||||
|
||||
pChatSet->m_iMode[iMode] = 1 - pChatSet->m_iMode[iMode];
|
||||
// Tracef("ToggleChatMode : %d\n", iMode);
|
||||
ArrangeShowingChat(dwID);
|
||||
}
|
||||
void CPythonChat::EnableChatMode(DWORD dwID, int iMode)
|
||||
{
|
||||
TChatSet * pChatSet = GetChatSetPtr(dwID);
|
||||
if (!pChatSet)
|
||||
return;
|
||||
|
||||
pChatSet->m_iMode[iMode] = TRUE;
|
||||
// Tracef("EnableChatMode : %d\n", iMode);
|
||||
ArrangeShowingChat(dwID);
|
||||
}
|
||||
void CPythonChat::DisableChatMode(DWORD dwID, int iMode)
|
||||
{
|
||||
TChatSet * pChatSet = GetChatSetPtr(dwID);
|
||||
if (!pChatSet)
|
||||
return;
|
||||
|
||||
pChatSet->m_iMode[iMode] = FALSE;
|
||||
// Tracef("DisableChatMode : %d\n", iMode);
|
||||
ArrangeShowingChat(dwID);
|
||||
}
|
||||
void CPythonChat::SetEndPos(DWORD dwID, float fPos)
|
||||
{
|
||||
TChatSet * pChatSet = GetChatSetPtr(dwID);
|
||||
if (!pChatSet)
|
||||
return;
|
||||
|
||||
fPos = max(0.0f, fPos);
|
||||
fPos = min(1.0f, fPos);
|
||||
if (pChatSet->m_fEndPos != fPos)
|
||||
{
|
||||
pChatSet->m_fEndPos = fPos;
|
||||
ArrangeShowingChat(dwID);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int CPythonChat::GetVisibleLineCount(DWORD dwID)
|
||||
{
|
||||
TChatLineList * pLineList = GetChatLineListPtr(dwID);
|
||||
if (!pLineList)
|
||||
return 0;
|
||||
|
||||
return pLineList->size();
|
||||
}
|
||||
|
||||
int CPythonChat::GetEditableLineCount(DWORD dwID)
|
||||
{
|
||||
TChatSet * pChatSet = GetChatSetPtr(dwID);
|
||||
if (!pChatSet)
|
||||
return 0;
|
||||
|
||||
return pChatSet->m_iHeight / pChatSet->m_iStep + 1;
|
||||
}
|
||||
|
||||
int CPythonChat::GetLineCount(DWORD dwID)
|
||||
{
|
||||
TChatSet * pChatSet = GetChatSetPtr(dwID);
|
||||
if (!pChatSet)
|
||||
return 0;
|
||||
|
||||
int iCount = 0;
|
||||
for (DWORD i = 0; i < m_ChatLineDeque.size(); ++i)
|
||||
{
|
||||
if (!pChatSet->CheckMode(m_ChatLineDeque[i]->iType))
|
||||
continue;
|
||||
|
||||
++iCount;
|
||||
}
|
||||
|
||||
return iCount;
|
||||
}
|
||||
|
||||
int CPythonChat::GetLineStep(DWORD dwID)
|
||||
{
|
||||
TChatSet * pChatSet = GetChatSetPtr(dwID);
|
||||
if (!pChatSet)
|
||||
return 0;
|
||||
|
||||
return pChatSet->m_iStep;
|
||||
}
|
||||
|
||||
CPythonChat::TChatLineList * CPythonChat::GetChatLineListPtr(DWORD dwID)
|
||||
{
|
||||
TChatSetMap::iterator itor = m_ChatSetMap.find(dwID);
|
||||
if (m_ChatSetMap.end() == itor)
|
||||
return NULL;
|
||||
|
||||
TChatSet & rChatSet = itor->second;
|
||||
return &(rChatSet.m_ShowingChatLineList);
|
||||
}
|
||||
|
||||
CPythonChat::TChatSet * CPythonChat::GetChatSetPtr(DWORD dwID)
|
||||
{
|
||||
TChatSetMap::iterator itor = m_ChatSetMap.find(dwID);
|
||||
if (m_ChatSetMap.end() == itor)
|
||||
return NULL;
|
||||
|
||||
TChatSet & rChatSet = itor->second;
|
||||
return &rChatSet;
|
||||
}
|
||||
|
||||
void CPythonChat::ArrangeShowingChat(DWORD dwID)
|
||||
{
|
||||
TChatSet * pChatSet = GetChatSetPtr(dwID);
|
||||
if (!pChatSet)
|
||||
return;
|
||||
|
||||
pChatSet->m_ShowingChatLineList.clear();
|
||||
|
||||
TChatLineDeque TempChatLineDeque;
|
||||
for (TChatLineDeque::iterator itor = m_ChatLineDeque.begin(); itor != m_ChatLineDeque.end(); ++itor)
|
||||
{
|
||||
TChatLine * pChatLine = *itor;
|
||||
if (pChatSet->CheckMode(pChatLine->iType))
|
||||
TempChatLineDeque.push_back(pChatLine);
|
||||
}
|
||||
|
||||
int icurLineCount = TempChatLineDeque.size();
|
||||
int iVisibleLineCount = min(icurLineCount, (pChatSet->m_iHeight + pChatSet->m_iStep) / pChatSet->m_iStep);
|
||||
int iEndLine = iVisibleLineCount + int(float(icurLineCount - iVisibleLineCount - 1) * pChatSet->m_fEndPos);
|
||||
|
||||
/////
|
||||
|
||||
int iHeight = 12;
|
||||
for (int i = min(icurLineCount-1, iEndLine); i >= 0; --i)
|
||||
{
|
||||
if (!pChatSet->CheckMode(TempChatLineDeque[i]->iType))
|
||||
continue;
|
||||
|
||||
if (pChatSet->m_iHeight + pChatSet->m_iStep <= iHeight)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
pChatSet->m_ShowingChatLineList.push_front(TempChatLineDeque[i]);
|
||||
|
||||
iHeight += pChatSet->m_iStep;
|
||||
}
|
||||
}
|
||||
|
||||
void CPythonChat::AppendChat(int iType, const char * c_szChat)
|
||||
{
|
||||
// DEFAULT_FONT
|
||||
//static CResource * s_pResource = CResourceManager::Instance().GetResourcePointer(g_strDefaultFontName.c_str());
|
||||
|
||||
CGraphicText* pkDefaultFont = static_cast<CGraphicText*>(DefaultFont_GetResource());
|
||||
if (!pkDefaultFont)
|
||||
{
|
||||
TraceError("CPythonChat::AppendChat - CANNOT_FIND_DEFAULT_FONT");
|
||||
return;
|
||||
}
|
||||
// END_OF_DEFAULT_FONT
|
||||
|
||||
IAbstractApplication& rApp=IAbstractApplication::GetSingleton();
|
||||
SChatLine * pChatLine = SChatLine::New();
|
||||
pChatLine->iType = iType;
|
||||
pChatLine->Instance.SetValue(c_szChat);
|
||||
|
||||
// DEFAULT_FONT
|
||||
pChatLine->Instance.SetTextPointer(pkDefaultFont);
|
||||
// END_OF_DEFAULT_FONT
|
||||
|
||||
pChatLine->fAppendedTime = rApp.GetGlobalTime();
|
||||
pChatLine->SetColorAll(GetChatColor(iType));
|
||||
|
||||
m_ChatLineDeque.push_back(pChatLine);
|
||||
if (m_ChatLineDeque.size() > CHAT_LINE_MAX_NUM)
|
||||
{
|
||||
SChatLine * pChatLine = m_ChatLineDeque.front();
|
||||
SChatLine::Delete(pChatLine);
|
||||
m_ChatLineDeque.pop_front();
|
||||
}
|
||||
|
||||
for (TChatSetMap::iterator itor = m_ChatSetMap.begin(); itor != m_ChatSetMap.end(); ++itor)
|
||||
{
|
||||
TChatSet * pChatSet = &(itor->second);
|
||||
//pChatLine->SetColor(itor->first, GetChatColor(iType));
|
||||
|
||||
// Edit Mode 를 억지로 끼워 맞추기 위해 추가
|
||||
if (BOARD_STATE_EDIT == pChatSet->m_iBoardState)
|
||||
{
|
||||
ArrangeShowingChat(itor->first);
|
||||
}
|
||||
else// if (BOARD_STATE_VIEW == pChatSet->m_iBoardState)
|
||||
{
|
||||
pChatSet->m_ShowingChatLineList.push_back(pChatLine);
|
||||
if (pChatSet->m_ShowingChatLineList.size() > CHAT_LINE_MAX_NUM)
|
||||
{
|
||||
pChatSet->m_ShowingChatLineList.pop_front();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPythonChat::AppendChatWithDelay(int iType, const char * c_szChat, int iDelay)
|
||||
{
|
||||
TWaitChat WaitChat;
|
||||
WaitChat.iType = iType;
|
||||
WaitChat.strChat = c_szChat;
|
||||
WaitChat.dwAppendingTime = CTimer::Instance().GetCurrentMillisecond() + iDelay;
|
||||
m_WaitChatList.push_back(WaitChat);
|
||||
}
|
||||
|
||||
DWORD CPythonChat::GetChatColor(int iType)
|
||||
{
|
||||
if (iType<CHAT_TYPE_MAX_NUM)
|
||||
{
|
||||
return m_akD3DXClrChat[iType];
|
||||
}
|
||||
|
||||
return D3DXCOLOR(0.0f, 0.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
void CPythonChat::IgnoreCharacter(const char * c_szName)
|
||||
{
|
||||
TIgnoreCharacterSet::iterator itor = m_IgnoreCharacterSet.find(c_szName);
|
||||
// NOTE : 이미 차단 중이라면..
|
||||
if (m_IgnoreCharacterSet.end() != itor)
|
||||
{
|
||||
m_IgnoreCharacterSet.erase(itor);
|
||||
}
|
||||
// NOTE : 차단이 되지 않은 캐릭터라면..
|
||||
else
|
||||
{
|
||||
m_IgnoreCharacterSet.insert(c_szName);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CPythonChat::IsIgnoreCharacter(const char * c_szName)
|
||||
{
|
||||
TIgnoreCharacterSet::iterator itor = m_IgnoreCharacterSet.find(c_szName);
|
||||
|
||||
if (m_IgnoreCharacterSet.end() == itor)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
CWhisper * CPythonChat::CreateWhisper(const char * c_szName)
|
||||
{
|
||||
CWhisper * pWhisper = CWhisper::New();
|
||||
m_WhisperMap.insert(TWhisperMap::value_type(c_szName, pWhisper));
|
||||
return pWhisper;
|
||||
}
|
||||
|
||||
void CPythonChat::AppendWhisper(int iType, const char * c_szName, const char * c_szChat)
|
||||
{
|
||||
TWhisperMap::iterator itor = m_WhisperMap.find(c_szName);
|
||||
|
||||
CWhisper * pWhisper;
|
||||
if (itor == m_WhisperMap.end())
|
||||
{
|
||||
pWhisper = CreateWhisper(c_szName);
|
||||
}
|
||||
else
|
||||
{
|
||||
pWhisper = itor->second;
|
||||
}
|
||||
|
||||
pWhisper->AppendChat(iType, c_szChat);
|
||||
}
|
||||
|
||||
void CPythonChat::ClearWhisper(const char * c_szName)
|
||||
{
|
||||
TWhisperMap::iterator itor = m_WhisperMap.find(c_szName);
|
||||
|
||||
if (itor != m_WhisperMap.end())
|
||||
{
|
||||
CWhisper * pWhisper = itor->second;
|
||||
CWhisper::Delete(pWhisper);
|
||||
|
||||
m_WhisperMap.erase(itor);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CPythonChat::GetWhisper(const char * c_szName, CWhisper ** ppWhisper)
|
||||
{
|
||||
TWhisperMap::iterator itor = m_WhisperMap.find(c_szName);
|
||||
|
||||
if (itor == m_WhisperMap.end())
|
||||
return FALSE;
|
||||
|
||||
*ppWhisper = itor->second;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CPythonChat::InitWhisper(PyObject * ppyObject)
|
||||
{
|
||||
TWhisperMap::iterator itor = m_WhisperMap.begin();
|
||||
for (; itor != m_WhisperMap.end(); ++itor)
|
||||
{
|
||||
std::string strName = itor->first;
|
||||
PyCallClassMemberFunc(ppyObject, "MakeWhisperButton", Py_BuildValue("(s)", strName.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
void CPythonChat::__DestroyWhisperMap()
|
||||
{
|
||||
TWhisperMap::iterator itor = m_WhisperMap.begin();
|
||||
for (; itor != m_WhisperMap.end(); ++itor)
|
||||
{
|
||||
CWhisper::Delete(itor->second);
|
||||
}
|
||||
m_WhisperMap.clear();
|
||||
}
|
||||
|
||||
void CPythonChat::Close()
|
||||
{
|
||||
TChatSetMap::iterator itor = m_ChatSetMap.begin();
|
||||
for (; itor != m_ChatSetMap.end(); ++itor)
|
||||
{
|
||||
TChatSet & rChatSet = itor->second;
|
||||
TChatLineList * pLineList = &(rChatSet.m_ShowingChatLineList);
|
||||
for (TChatLineList::iterator itor = pLineList->begin(); itor != pLineList->end(); ++itor)
|
||||
{
|
||||
TChatLine * pChatLine = (*itor);
|
||||
pChatLine->fAppendedTime = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CPythonChat::Destroy()
|
||||
{
|
||||
__DestroyWhisperMap();
|
||||
|
||||
m_ShowingChatLineList.clear();
|
||||
m_ChatSetMap.clear();
|
||||
m_ChatLineDeque.clear();
|
||||
|
||||
SChatLine::DestroySystem();
|
||||
CWhisper::DestroySystem();
|
||||
|
||||
__Initialize();
|
||||
}
|
||||
|
||||
void CPythonChat::__Initialize()
|
||||
{
|
||||
m_akD3DXClrChat[CHAT_TYPE_TALKING] = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
m_akD3DXClrChat[CHAT_TYPE_INFO] = D3DXCOLOR(1.0f, 0.785f, 0.785f, 1.0f);
|
||||
m_akD3DXClrChat[CHAT_TYPE_NOTICE] = D3DXCOLOR(1.0f, 0.902f, 0.730f, 1.0f);
|
||||
m_akD3DXClrChat[CHAT_TYPE_PARTY] = D3DXCOLOR(0.542f, 1.0f, 0.949f, 1.0f);
|
||||
m_akD3DXClrChat[CHAT_TYPE_GUILD] = D3DXCOLOR(0.906f, 0.847f, 1.0f, 1.0f);
|
||||
m_akD3DXClrChat[CHAT_TYPE_COMMAND] = D3DXCOLOR(0.658f, 1.0f, 0.835f, 1.0f);
|
||||
m_akD3DXClrChat[CHAT_TYPE_SHOUT] = D3DXCOLOR(0.658f, 1.0f, 0.835f, 1.0f);
|
||||
m_akD3DXClrChat[CHAT_TYPE_WHISPER] = D3DXCOLOR(0xff4AE14A);
|
||||
m_akD3DXClrChat[CHAT_TYPE_BIG_NOTICE] = D3DXCOLOR(1.0f, 0.902f, 0.730f, 1.0f);
|
||||
}
|
||||
|
||||
CPythonChat::CPythonChat()
|
||||
{
|
||||
__Initialize();
|
||||
}
|
||||
|
||||
CPythonChat::~CPythonChat()
|
||||
{
|
||||
assert(m_ChatLineDeque.empty());
|
||||
assert(m_ShowingChatLineList.empty());
|
||||
assert(m_ChatSetMap.empty());
|
||||
assert(m_WhisperMap.empty());
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
CDynamicPool<CWhisper> CWhisper::ms_kPool;
|
||||
|
||||
CWhisper* CWhisper::New()
|
||||
{
|
||||
return ms_kPool.Alloc();
|
||||
}
|
||||
|
||||
void CWhisper::Delete(CWhisper* pkWhisper)
|
||||
{
|
||||
pkWhisper->Destroy();
|
||||
ms_kPool.Free(pkWhisper);
|
||||
}
|
||||
|
||||
void CWhisper::DestroySystem()
|
||||
{
|
||||
ms_kPool.Destroy();
|
||||
|
||||
SChatLine::DestroySystem();
|
||||
}
|
||||
|
||||
void CWhisper::SetPosition(float fPosition)
|
||||
{
|
||||
m_fcurPosition = fPosition;
|
||||
__ArrangeChat();
|
||||
}
|
||||
|
||||
void CWhisper::SetBoxSize(float fWidth, float fHeight)
|
||||
{
|
||||
m_fWidth = fWidth;
|
||||
m_fHeight = fHeight;
|
||||
|
||||
for (TChatLineDeque::iterator itor = m_ChatLineDeque.begin(); itor != m_ChatLineDeque.end(); ++itor)
|
||||
{
|
||||
TChatLine * pChatLine = *itor;
|
||||
pChatLine->Instance.SetLimitWidth(fWidth);
|
||||
}
|
||||
}
|
||||
|
||||
void CWhisper::AppendChat(int iType, const char * c_szChat)
|
||||
{
|
||||
// DEFAULT_FONT
|
||||
//static CResource * s_pResource = CResourceManager::Instance().GetResourcePointer(g_strDefaultFontName.c_str());
|
||||
|
||||
#if defined(LOCALE_SERVICE_YMIR) || defined(LOCALE_SERVICE_JAPAN) || defined(LOCALE_SERVICE_HONGKONG) || defined(LOCALE_SERVICE_TAIWAN) || defined(LOCALE_SERVICE_NEWCIBN)
|
||||
CGraphicText* pkDefaultFont = static_cast<CGraphicText*>(DefaultFont_GetResource());
|
||||
#else
|
||||
CGraphicText* pkDefaultFont = (iType == CPythonChat::WHISPER_TYPE_GM) ? static_cast<CGraphicText*>(DefaultItalicFont_GetResource()) : static_cast<CGraphicText*>(DefaultFont_GetResource());
|
||||
#endif
|
||||
|
||||
if (!pkDefaultFont)
|
||||
{
|
||||
TraceError("CWhisper::AppendChat - CANNOT_FIND_DEFAULT_FONT");
|
||||
return;
|
||||
}
|
||||
// END_OF_DEFAULT_FONT
|
||||
|
||||
SChatLine * pChatLine = SChatLine::New();
|
||||
pChatLine->Instance.SetValue(c_szChat);
|
||||
|
||||
// DEFAULT_FONT
|
||||
pChatLine->Instance.SetTextPointer(pkDefaultFont);
|
||||
// END_OF_DEFAULT_FONT
|
||||
|
||||
pChatLine->Instance.SetLimitWidth(m_fWidth);
|
||||
pChatLine->Instance.SetMultiLine(TRUE);
|
||||
|
||||
switch(iType)
|
||||
{
|
||||
case CPythonChat::WHISPER_TYPE_SYSTEM:
|
||||
pChatLine->Instance.SetColor(D3DXCOLOR(1.0f, 0.785f, 0.785f, 1.0f));
|
||||
break;
|
||||
case CPythonChat::WHISPER_TYPE_GM:
|
||||
pChatLine->Instance.SetColor(D3DXCOLOR(1.0f, 0.632f, 0.0f, 1.0f));
|
||||
break;
|
||||
case CPythonChat::WHISPER_TYPE_CHAT:
|
||||
default:
|
||||
pChatLine->Instance.SetColor(0xffffffff);
|
||||
break;
|
||||
}
|
||||
|
||||
m_ChatLineDeque.push_back(pChatLine);
|
||||
|
||||
__ArrangeChat();
|
||||
}
|
||||
|
||||
void CWhisper::__ArrangeChat()
|
||||
{
|
||||
for (TChatLineDeque::iterator itor = m_ChatLineDeque.begin(); itor != m_ChatLineDeque.end(); ++itor)
|
||||
{
|
||||
TChatLine * pChatLine = *itor;
|
||||
pChatLine->Instance.Update();
|
||||
}
|
||||
}
|
||||
|
||||
void CWhisper::Render(float fx, float fy)
|
||||
{
|
||||
float fHeight = fy + m_fHeight;
|
||||
|
||||
int iViewCount = int(m_fHeight / m_fLineStep) - 1;
|
||||
int iLineCount = int(m_ChatLineDeque.size());
|
||||
int iStartLine = -1;
|
||||
if (iLineCount > iViewCount)
|
||||
{
|
||||
iStartLine = int(float(iLineCount-iViewCount) * m_fcurPosition) + iViewCount - 1;
|
||||
}
|
||||
else if (!m_ChatLineDeque.empty())
|
||||
{
|
||||
iStartLine = iLineCount - 1;
|
||||
}
|
||||
|
||||
// PORT: RECT holds the 32-bit Win32 LONG, so static_cast<long> would narrow here.
|
||||
RECT Rect = { static_cast<LONG>(fx), static_cast<LONG>(fy), static_cast<LONG>(fx+m_fWidth), static_cast<LONG>(fy+m_fHeight) };
|
||||
|
||||
for (int i = iStartLine; i >= 0; --i)
|
||||
{
|
||||
assert(i >= 0 && i < int(m_ChatLineDeque.size()));
|
||||
TChatLine * pChatLine = m_ChatLineDeque[i];
|
||||
|
||||
WORD wLineCount = pChatLine->Instance.GetTextLineCount();
|
||||
fHeight -= wLineCount * m_fLineStep;
|
||||
|
||||
pChatLine->Instance.SetPosition(fx, fHeight);
|
||||
pChatLine->Instance.Render(&Rect);
|
||||
|
||||
if (fHeight < fy)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CWhisper::__Initialize()
|
||||
{
|
||||
m_fLineStep = 15.0f;
|
||||
m_fWidth = 300.0f;
|
||||
m_fHeight = 120.0f;
|
||||
m_fcurPosition = 1.0f;
|
||||
}
|
||||
|
||||
void CWhisper::Destroy()
|
||||
{
|
||||
std::for_each(m_ChatLineDeque.begin(), m_ChatLineDeque.end(), SChatLine::Delete);
|
||||
m_ChatLineDeque.clear();
|
||||
m_ShowingChatLineList.clear();
|
||||
}
|
||||
|
||||
CWhisper::CWhisper()
|
||||
{
|
||||
__Initialize();
|
||||
}
|
||||
|
||||
CWhisper::~CWhisper()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CDynamicPool<CWhisper::SChatLine> CWhisper::SChatLine::ms_kPool;
|
||||
|
||||
CWhisper::SChatLine* CWhisper::SChatLine::New()
|
||||
{
|
||||
return ms_kPool.Alloc();
|
||||
}
|
||||
|
||||
void CWhisper::SChatLine::Delete(CWhisper::SChatLine* pkChatLine)
|
||||
{
|
||||
pkChatLine->Instance.Destroy();
|
||||
ms_kPool.Free(pkChatLine);
|
||||
}
|
||||
|
||||
void CWhisper::SChatLine::DestroySystem()
|
||||
{
|
||||
ms_kPool.Destroy();
|
||||
}
|
||||
@@ -0,0 +1,520 @@
|
||||
#include "StdAfx.h"
|
||||
#include "PythonChat.h"
|
||||
#include "PythonItem.h"
|
||||
#include "../GameLib/ItemManager.h"
|
||||
|
||||
PyObject * chatSetChatColor(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iType;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iType))
|
||||
return Py_BuildException();
|
||||
|
||||
int r;
|
||||
if (!PyTuple_GetInteger(poArgs, 1, &r))
|
||||
return Py_BuildException();
|
||||
|
||||
int g;
|
||||
if (!PyTuple_GetInteger(poArgs, 2, &g))
|
||||
return Py_BuildException();
|
||||
|
||||
int b;
|
||||
if (!PyTuple_GetInteger(poArgs, 3, &b))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().SetChatColor(iType, r, g, b);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatClear(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
CPythonChat::Instance().Destroy();
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatClose(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
CPythonChat::Instance().Close();
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatCreateChatSet(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iID))
|
||||
return Py_BuildException();
|
||||
|
||||
return Py_BuildValue("i", CPythonChat::Instance().CreateChatSet(iID));
|
||||
}
|
||||
|
||||
PyObject * chatUpdate(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iID))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().Update(iID);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatRender(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iID))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().Render(iID);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatSetBoardState(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iID))
|
||||
return Py_BuildException();
|
||||
int iState;
|
||||
if (!PyTuple_GetInteger(poArgs, 1, &iState))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().SetBoardState(iID, iState);
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatSetPosition(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iID))
|
||||
return Py_BuildException();
|
||||
int ix;
|
||||
if (!PyTuple_GetInteger(poArgs, 1, &ix))
|
||||
return Py_BuildException();
|
||||
int iy;
|
||||
if (!PyTuple_GetInteger(poArgs, 2, &iy))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().SetPosition(iID, ix, iy);
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatSetHeight(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iID))
|
||||
return Py_BuildException();
|
||||
int iHeight;
|
||||
if (!PyTuple_GetInteger(poArgs, 1, &iHeight))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().SetHeight(iID, iHeight);
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatSetStep(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iID))
|
||||
return Py_BuildException();
|
||||
int iStep;
|
||||
if (!PyTuple_GetInteger(poArgs, 1, &iStep))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().SetStep(iID, iStep);
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatToggleChatMode(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iID))
|
||||
return Py_BuildException();
|
||||
int iType;
|
||||
if (!PyTuple_GetInteger(poArgs, 1, &iType))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().ToggleChatMode(iID, iType);
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatEnableChatMode(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iID))
|
||||
return Py_BuildException();
|
||||
int iType;
|
||||
if (!PyTuple_GetInteger(poArgs, 1, &iType))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().EnableChatMode(iID, iType);
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatDisableChatMode(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iID))
|
||||
return Py_BuildException();
|
||||
int iType;
|
||||
if (!PyTuple_GetInteger(poArgs, 1, &iType))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().DisableChatMode(iID, iType);
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatSetEndPos(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iID))
|
||||
return Py_BuildException();
|
||||
float fPos;
|
||||
if (!PyTuple_GetFloat(poArgs, 1, &fPos))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().SetEndPos(iID, fPos);
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatGetLineCount(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iID))
|
||||
return Py_BuildException();
|
||||
|
||||
return Py_BuildValue("i", CPythonChat::Instance().GetLineCount(iID));
|
||||
}
|
||||
|
||||
PyObject * chatGetVisibleLineCount(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iID))
|
||||
return Py_BuildException();
|
||||
|
||||
return Py_BuildValue("i", CPythonChat::Instance().GetVisibleLineCount(iID));
|
||||
}
|
||||
|
||||
PyObject * chatGetLineStep(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iID))
|
||||
return Py_BuildException();
|
||||
|
||||
return Py_BuildValue("i", CPythonChat::Instance().GetLineStep(iID));
|
||||
}
|
||||
|
||||
PyObject * chatAppendChat(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iType;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iType))
|
||||
return Py_BuildException();
|
||||
|
||||
char * szChat;
|
||||
if (!PyTuple_GetString(poArgs, 1, &szChat))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().AppendChat(iType, szChat);
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatAppendChatWithDelay(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iType;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iType))
|
||||
return Py_BuildException();
|
||||
|
||||
char * szChat;
|
||||
if (!PyTuple_GetString(poArgs, 1, &szChat))
|
||||
return Py_BuildException();
|
||||
|
||||
int iDelay;
|
||||
if (!PyTuple_GetInteger(poArgs, 2, &iDelay))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().AppendChatWithDelay(iType, szChat, iDelay);
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatArrangeShowingChat(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iID;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iID))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().ArrangeShowingChat(iID);
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatIgnoreCharacter(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
char * szName;
|
||||
if (!PyTuple_GetString(poArgs, 0, &szName))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().IgnoreCharacter(szName);
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatIsIgnoreCharacter(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
char * szName;
|
||||
if (!PyTuple_GetString(poArgs, 0, &szName))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().IsIgnoreCharacter(szName);
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatCreateWhisper(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
char * szName;
|
||||
if (!PyTuple_GetString(poArgs, 0, &szName))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().CreateWhisper(szName);
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatAppendWhisper(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
int iType;
|
||||
if (!PyTuple_GetInteger(poArgs, 0, &iType))
|
||||
return Py_BuildException();
|
||||
|
||||
char * szName;
|
||||
if (!PyTuple_GetString(poArgs, 1, &szName))
|
||||
return Py_BuildException();
|
||||
|
||||
char * szChat;
|
||||
if (!PyTuple_GetString(poArgs, 2, &szChat))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().AppendWhisper(iType, szName, szChat);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatRenderWhisper(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
char * szName;
|
||||
if (!PyTuple_GetString(poArgs, 0, &szName))
|
||||
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();
|
||||
|
||||
CWhisper * pWhisper;
|
||||
if (CPythonChat::Instance().GetWhisper(szName, &pWhisper))
|
||||
{
|
||||
pWhisper->Render(fx, fy);
|
||||
}
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatSetWhisperBoxSize(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
char * szName;
|
||||
if (!PyTuple_GetString(poArgs, 0, &szName))
|
||||
return Py_BuildException();
|
||||
|
||||
float fWidth;
|
||||
if (!PyTuple_GetFloat(poArgs, 1, &fWidth))
|
||||
return Py_BuildException();
|
||||
|
||||
float fHeight;
|
||||
if (!PyTuple_GetFloat(poArgs, 2, &fHeight))
|
||||
return Py_BuildException();
|
||||
|
||||
CWhisper * pWhisper;
|
||||
if (CPythonChat::Instance().GetWhisper(szName, &pWhisper))
|
||||
{
|
||||
pWhisper->SetBoxSize(fWidth, fHeight);
|
||||
}
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatSetWhisperPosition(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
char * szName;
|
||||
if (!PyTuple_GetString(poArgs, 0, &szName))
|
||||
return Py_BuildException();
|
||||
|
||||
float fPosition;
|
||||
if (!PyTuple_GetFloat(poArgs, 1, &fPosition))
|
||||
return Py_BuildException();
|
||||
|
||||
CWhisper * pWhisper;
|
||||
if (CPythonChat::Instance().GetWhisper(szName, &pWhisper))
|
||||
{
|
||||
pWhisper->SetPosition(fPosition);
|
||||
}
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatClearWhisper(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
char * szName;
|
||||
if (!PyTuple_GetString(poArgs, 0, &szName))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().ClearWhisper(szName);
|
||||
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatInitWhisper(PyObject* poSelf, PyObject* poArgs)
|
||||
{
|
||||
PyObject * poInterface;
|
||||
if (!PyTuple_GetObject(poArgs, 0, &poInterface))
|
||||
return Py_BuildException();
|
||||
|
||||
CPythonChat::Instance().InitWhisper(poInterface);
|
||||
return Py_BuildNone();
|
||||
}
|
||||
|
||||
PyObject * chatGetLinkFromHyperlink(PyObject * poSelf, PyObject * poArgs)
|
||||
{
|
||||
char * szHyperlink;
|
||||
|
||||
if (!PyTuple_GetString(poArgs, 0, &szHyperlink))
|
||||
return Py_BuildException();
|
||||
|
||||
std::string stHyperlink(szHyperlink);
|
||||
std::vector<std::string> results;
|
||||
|
||||
split_string(stHyperlink, ":", results, false);
|
||||
|
||||
// item:vnum:flag:socket0:socket1:socket2
|
||||
if (0 == results[0].compare("item"))
|
||||
{
|
||||
if (results.size() < 6)
|
||||
return Py_BuildValue("s", "");
|
||||
|
||||
CItemData * pItemData = NULL;
|
||||
|
||||
if (CItemManager::Instance().GetItemDataPointer(htoi(results[1].c_str()), &pItemData))
|
||||
{
|
||||
char buf[1024] = { 0 };
|
||||
char itemlink[256];
|
||||
int len;
|
||||
bool isAttr = false;
|
||||
|
||||
len = snprintf(itemlink, sizeof(itemlink), "item:%x:%x:%x:%x:%x",
|
||||
htoi(results[1].c_str()),
|
||||
htoi(results[2].c_str()),
|
||||
htoi(results[3].c_str()),
|
||||
htoi(results[4].c_str()),
|
||||
htoi(results[5].c_str()));
|
||||
|
||||
if (results.size() >= 8)
|
||||
{
|
||||
for (int i = 6; i < results.size(); i += 2)
|
||||
{
|
||||
len += snprintf(itemlink + len, sizeof(itemlink) - len, ":%x:%I64d",
|
||||
htoi(results[i].c_str()),
|
||||
atoi(results[i+1].c_str()));
|
||||
isAttr = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isAttr)
|
||||
//"item:번호:플래그:소켓0:소켓1:소켓2"
|
||||
snprintf(buf, sizeof(buf), "|cffffc700|H%s|h[%s]|h|r", itemlink, pItemData->GetName());
|
||||
else
|
||||
snprintf(buf, sizeof(buf), "|cfff1e6c0|H%s|h[%s]|h|r", itemlink, pItemData->GetName());
|
||||
|
||||
return Py_BuildValue("s", buf);
|
||||
}
|
||||
}
|
||||
|
||||
return Py_BuildValue("s", "");
|
||||
}
|
||||
|
||||
void initChat()
|
||||
{
|
||||
static PyMethodDef s_methods[] =
|
||||
{
|
||||
{ "SetChatColor", chatSetChatColor, METH_VARARGS },
|
||||
{ "Clear", chatClear, METH_VARARGS },
|
||||
{ "Close", chatClose, METH_VARARGS },
|
||||
|
||||
{ "CreateChatSet", chatCreateChatSet, METH_VARARGS },
|
||||
{ "Update", chatUpdate, METH_VARARGS },
|
||||
{ "Render", chatRender, METH_VARARGS },
|
||||
|
||||
{ "SetBoardState", chatSetBoardState, METH_VARARGS },
|
||||
{ "SetPosition", chatSetPosition, METH_VARARGS },
|
||||
{ "SetHeight", chatSetHeight, METH_VARARGS },
|
||||
{ "SetStep", chatSetStep, METH_VARARGS },
|
||||
{ "ToggleChatMode", chatToggleChatMode, METH_VARARGS },
|
||||
{ "EnableChatMode", chatEnableChatMode, METH_VARARGS },
|
||||
{ "DisableChatMode", chatDisableChatMode, METH_VARARGS },
|
||||
{ "SetEndPos", chatSetEndPos, METH_VARARGS },
|
||||
|
||||
{ "GetLineCount", chatGetLineCount, METH_VARARGS },
|
||||
{ "GetVisibleLineCount", chatGetVisibleLineCount, METH_VARARGS },
|
||||
{ "GetLineStep", chatGetLineStep, METH_VARARGS },
|
||||
|
||||
// Chat
|
||||
{ "AppendChat", chatAppendChat, METH_VARARGS },
|
||||
{ "AppendChatWithDelay", chatAppendChatWithDelay, METH_VARARGS },
|
||||
{ "ArrangeShowingChat", chatArrangeShowingChat, METH_VARARGS },
|
||||
|
||||
// Ignore
|
||||
{ "IgnoreCharacter", chatIgnoreCharacter, METH_VARARGS },
|
||||
{ "IsIgnoreCharacter", chatIsIgnoreCharacter, METH_VARARGS },
|
||||
|
||||
// Whisper
|
||||
{ "CreateWhisper", chatCreateWhisper, METH_VARARGS },
|
||||
{ "AppendWhisper", chatAppendWhisper, METH_VARARGS },
|
||||
{ "RenderWhisper", chatRenderWhisper, METH_VARARGS },
|
||||
{ "SetWhisperBoxSize", chatSetWhisperBoxSize, METH_VARARGS },
|
||||
{ "SetWhisperPosition", chatSetWhisperPosition, METH_VARARGS },
|
||||
{ "ClearWhisper", chatClearWhisper, METH_VARARGS },
|
||||
{ "InitWhisper", chatInitWhisper, METH_VARARGS },
|
||||
|
||||
// Link
|
||||
{ "GetLinkFromHyperlink", chatGetLinkFromHyperlink, METH_VARARGS },
|
||||
|
||||
{ NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
PyObject * poModule = Py_InitModule("chat", s_methods);
|
||||
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_TALKING", CHAT_TYPE_TALKING);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_INFO", CHAT_TYPE_INFO);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_NOTICE", CHAT_TYPE_NOTICE);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_PARTY", CHAT_TYPE_PARTY);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_GUILD", CHAT_TYPE_GUILD);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_COMMAND", CHAT_TYPE_COMMAND);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_SHOUT", CHAT_TYPE_SHOUT);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_TYPE_WHISPER", CHAT_TYPE_WHISPER);
|
||||
PyModule_AddIntConstant(poModule, "WHISPER_TYPE_CHAT", CPythonChat::WHISPER_TYPE_CHAT);
|
||||
PyModule_AddIntConstant(poModule, "WHISPER_TYPE_SYSTEM", CPythonChat::WHISPER_TYPE_SYSTEM);
|
||||
PyModule_AddIntConstant(poModule, "WHISPER_TYPE_GM", CPythonChat::WHISPER_TYPE_GM);
|
||||
|
||||
PyModule_AddIntConstant(poModule, "BOARD_STATE_VIEW", CPythonChat::BOARD_STATE_VIEW);
|
||||
PyModule_AddIntConstant(poModule, "BOARD_STATE_EDIT", CPythonChat::BOARD_STATE_EDIT);
|
||||
PyModule_AddIntConstant(poModule, "BOARD_STATE_LOG", CPythonChat::BOARD_STATE_LOG);
|
||||
|
||||
PyModule_AddIntConstant(poModule, "CHAT_SET_CHAT_WINDOW", 0);
|
||||
PyModule_AddIntConstant(poModule, "CHAT_SET_LOG_WINDOW", 1);
|
||||
}
|
||||
@@ -0,0 +1,557 @@
|
||||
#include "StdAfx.h"
|
||||
#include "PythonNetworkStream.h"
|
||||
#include "PythonNonPlayer.h"
|
||||
#include "AbstractApplication.h"
|
||||
#include "AbstractPlayer.h"
|
||||
#include "AbstractCharacterManager.h"
|
||||
#include "AbstractChat.h"
|
||||
#include "InstanceBase.h"
|
||||
|
||||
#define ishan(ch) (((ch) & 0xE0) > 0x90)
|
||||
#define ishanasc(ch) (isascii(ch) || ishan(ch))
|
||||
#define ishanalp(ch) (isalpha(ch) || ishan(ch))
|
||||
#define isnhdigit(ch) (!ishan(ch) && isdigit(ch))
|
||||
#define isnhspace(ch) (!ishan(ch) && isspace(ch))
|
||||
|
||||
#define LOWER(c) (((c) >= 'A' && (c) <= 'Z') ? ((c) + ('a' - 'A')) : (c))
|
||||
#define UPPER(c) (((c) >= 'a' && (c) <= 'z') ? ((c) + ('A' - 'a')) : (c))
|
||||
|
||||
void SkipSpaces(char **string)
|
||||
{
|
||||
for (; **string != '\0' && isnhspace((unsigned char) **string); ++(*string));
|
||||
}
|
||||
|
||||
char *OneArgument(char *argument, char *first_arg)
|
||||
{
|
||||
char mark = FALSE;
|
||||
|
||||
if (!argument)
|
||||
{
|
||||
*first_arg = '\0';
|
||||
return NULL;
|
||||
}
|
||||
|
||||
SkipSpaces(&argument);
|
||||
|
||||
while (*argument)
|
||||
{
|
||||
if (*argument == '\"')
|
||||
{
|
||||
mark = !mark;
|
||||
++argument;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!mark && isnhspace((unsigned char) *argument))
|
||||
break;
|
||||
|
||||
*(first_arg++) = LOWER(*argument);
|
||||
++argument;
|
||||
}
|
||||
|
||||
*first_arg = '\0';
|
||||
|
||||
SkipSpaces(&argument);
|
||||
return (argument);
|
||||
}
|
||||
|
||||
void AppendMonsterList(const CPythonNonPlayer::TMobTableList & c_rMobTableList, const char * c_szHeader, int iType)
|
||||
{
|
||||
DWORD dwMonsterCount = 0;
|
||||
std::string strMonsterList = c_szHeader;
|
||||
|
||||
CPythonNonPlayer::TMobTableList::const_iterator itor = c_rMobTableList.begin();
|
||||
for (; itor!=c_rMobTableList.end(); ++itor)
|
||||
{
|
||||
const CPythonNonPlayer::TMobTable * c_pMobTable = *itor;
|
||||
if (iType == c_pMobTable->bRank)
|
||||
{
|
||||
if (dwMonsterCount != 0)
|
||||
strMonsterList += ", ";
|
||||
strMonsterList += c_pMobTable->szLocaleName;
|
||||
if (++dwMonsterCount > 5)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (dwMonsterCount > 0)
|
||||
{
|
||||
IAbstractChat& rkChat=IAbstractChat::GetSingleton();
|
||||
rkChat.AppendChat(CHAT_TYPE_INFO, strMonsterList.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::ClientCommand(const char * c_szCommand)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SplitToken(const char * c_szLine, CTokenVector * pstTokenVector, const char * c_szDelimeter = " ")
|
||||
{
|
||||
pstTokenVector->reserve(10);
|
||||
pstTokenVector->clear();
|
||||
|
||||
std::string stToken;
|
||||
std::string strLine = c_szLine;
|
||||
|
||||
DWORD basePos = 0;
|
||||
|
||||
do
|
||||
{
|
||||
int beginPos = strLine.find_first_not_of(c_szDelimeter, basePos);
|
||||
if (beginPos < 0)
|
||||
return false;
|
||||
|
||||
int endPos;
|
||||
|
||||
if (strLine[beginPos] == '"')
|
||||
{
|
||||
++beginPos;
|
||||
endPos = strLine.find_first_of("\"", beginPos);
|
||||
|
||||
if (endPos < 0)
|
||||
return false;
|
||||
|
||||
basePos = endPos + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
endPos = strLine.find_first_of(c_szDelimeter, beginPos);
|
||||
basePos = endPos;
|
||||
}
|
||||
|
||||
pstTokenVector->push_back(strLine.substr(beginPos, endPos - beginPos));
|
||||
|
||||
// 추가 코드. 맨뒤에 탭이 있는 경우를 체크한다. - [levites]
|
||||
if (int(strLine.find_first_not_of(c_szDelimeter, basePos)) < 0)
|
||||
break;
|
||||
} while (basePos < strLine.length());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CPythonNetworkStream::ServerCommand(char * c_szCommand)
|
||||
{
|
||||
// #0000811: [M2EU] 콘솔창 기능 차단
|
||||
if (strcmpi(c_szCommand, "ConsoleEnable") == 0)
|
||||
return;
|
||||
|
||||
if (m_apoPhaseWnd[PHASE_WINDOW_GAME])
|
||||
{
|
||||
bool isTrue;
|
||||
if (PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME],
|
||||
"BINARY_ServerCommand_Run",
|
||||
Py_BuildValue("(s)", c_szCommand),
|
||||
&isTrue
|
||||
))
|
||||
{
|
||||
if (isTrue)
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (m_poSerCommandParserWnd)
|
||||
{
|
||||
bool isTrue;
|
||||
if (PyCallClassMemberFunc(m_poSerCommandParserWnd,
|
||||
"BINARY_ServerCommand_Run",
|
||||
Py_BuildValue("(s)", c_szCommand),
|
||||
&isTrue
|
||||
))
|
||||
{
|
||||
if (isTrue)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
CTokenVector TokenVector;
|
||||
if (!SplitToken(c_szCommand, &TokenVector))
|
||||
return;
|
||||
if (TokenVector.empty())
|
||||
return;
|
||||
|
||||
const char * szCmd = TokenVector[0].c_str();
|
||||
|
||||
if (!strcmpi(szCmd, "quit"))
|
||||
{
|
||||
PostQuitMessage(0);
|
||||
}
|
||||
else if (!strcmpi(szCmd, "BettingMoney"))
|
||||
{
|
||||
if (2 != TokenVector.size())
|
||||
{
|
||||
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %s", c_szCommand);
|
||||
return;
|
||||
}
|
||||
|
||||
//UINT uMoney= atoi(TokenVector[1].c_str());
|
||||
|
||||
}
|
||||
// GIFT NOTIFY
|
||||
else if (!strcmpi(szCmd, "gift"))
|
||||
{
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "Gift_Show", Py_BuildValue("()"));
|
||||
}
|
||||
// CUBE
|
||||
else if (!strcmpi(szCmd, "cube"))
|
||||
{
|
||||
if (TokenVector.size() < 2)
|
||||
{
|
||||
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %s", c_szCommand);
|
||||
return;
|
||||
}
|
||||
|
||||
if ("open" == TokenVector[1])
|
||||
{
|
||||
if (3 > TokenVector.size())
|
||||
{
|
||||
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %s", c_szCommand);
|
||||
return;
|
||||
}
|
||||
|
||||
DWORD npcVNUM = (DWORD)atoi(TokenVector[2].c_str());
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_Cube_Open", Py_BuildValue("(i)", npcVNUM));
|
||||
}
|
||||
else if ("close" == TokenVector[1])
|
||||
{
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_Cube_Close", Py_BuildValue("()"));
|
||||
}
|
||||
else if ("info" == TokenVector[1])
|
||||
{
|
||||
if (5 != TokenVector.size())
|
||||
{
|
||||
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %s", c_szCommand);
|
||||
return;
|
||||
}
|
||||
|
||||
UINT gold = atoi(TokenVector[2].c_str());
|
||||
UINT itemVnum = atoi(TokenVector[3].c_str());
|
||||
UINT count = atoi(TokenVector[4].c_str());
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_Cube_UpdateInfo", Py_BuildValue("(iii)", gold, itemVnum, count));
|
||||
}
|
||||
else if ("success" == TokenVector[1])
|
||||
{
|
||||
if (4 != TokenVector.size())
|
||||
{
|
||||
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %s", c_szCommand);
|
||||
return;
|
||||
}
|
||||
|
||||
UINT itemVnum = atoi(TokenVector[2].c_str());
|
||||
UINT count = atoi(TokenVector[3].c_str());
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_Cube_Succeed", Py_BuildValue("(ii)", itemVnum, count));
|
||||
}
|
||||
else if ("fail" == TokenVector[1])
|
||||
{
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_Cube_Failed", Py_BuildValue("()"));
|
||||
}
|
||||
else if ("r_list" == TokenVector[1])
|
||||
{
|
||||
// result list (/cube r_list npcVNUM resultCount resultText)
|
||||
// 20383 4 72723,1/72725,1/72730.1/50001,5 <- 이런식으로 "/" 문자로 구분된 리스트를 줌
|
||||
if (5 != TokenVector.size())
|
||||
{
|
||||
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %d", c_szCommand, 5);
|
||||
return;
|
||||
}
|
||||
|
||||
DWORD npcVNUM = (DWORD)atoi(TokenVector[2].c_str());
|
||||
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_Cube_ResultList", Py_BuildValue("(is)", npcVNUM, TokenVector[4].c_str()));
|
||||
}
|
||||
else if ("m_info" == TokenVector[1])
|
||||
{
|
||||
// material list (/cube m_info requestStartIndex resultCount MaterialText)
|
||||
// ex) requestStartIndex: 0, resultCount : 5 - 해당 NPC가 만들수 있는 아이템 중 0~4번째에 해당하는 아이템을 만드는 데 필요한 모든 재료들이 MaterialText에 들어있음
|
||||
// 위 예시처럼 아이템이 다수인 경우 구분자 "@" 문자를 사용
|
||||
// 0 5 125,1|126,2|127,2|123,5&555,5&555,4/120000 <- 이런식으로 서버에서 클라로 리스트를 줌
|
||||
|
||||
if (5 != TokenVector.size())
|
||||
{
|
||||
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %d", c_szCommand, 5);
|
||||
return;
|
||||
}
|
||||
|
||||
UINT requestStartIndex = (UINT)atoi(TokenVector[2].c_str());
|
||||
UINT resultCount = (UINT)atoi(TokenVector[3].c_str());
|
||||
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_Cube_MaterialInfo", Py_BuildValue("(iis)", requestStartIndex, resultCount, TokenVector[4].c_str()));
|
||||
}
|
||||
}
|
||||
// CUEBE_END
|
||||
else if (!strcmpi(szCmd, "ObserverCount"))
|
||||
{
|
||||
if (2 != TokenVector.size())
|
||||
{
|
||||
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %s", c_szCommand);
|
||||
return;
|
||||
}
|
||||
|
||||
UINT uObserverCount= atoi(TokenVector[1].c_str());
|
||||
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME],
|
||||
"BINARY_BettingGuildWar_UpdateObserverCount",
|
||||
Py_BuildValue("(i)", uObserverCount)
|
||||
);
|
||||
}
|
||||
else if (!strcmpi(szCmd, "ObserverMode"))
|
||||
{
|
||||
if (2 != TokenVector.size())
|
||||
{
|
||||
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %s", c_szCommand);
|
||||
return;
|
||||
}
|
||||
|
||||
UINT uMode= atoi(TokenVector[1].c_str());
|
||||
|
||||
IAbstractPlayer& rkPlayer=IAbstractPlayer::GetSingleton();
|
||||
rkPlayer.SetObserverMode(uMode ? true : false);
|
||||
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME],
|
||||
"BINARY_BettingGuildWar_SetObserverMode",
|
||||
Py_BuildValue("(i)", uMode)
|
||||
);
|
||||
}
|
||||
else if (!strcmpi(szCmd, "ObserverTeamInfo"))
|
||||
{
|
||||
}
|
||||
else if (!strcmpi(szCmd, "StoneDetect"))
|
||||
{
|
||||
if (4 != TokenVector.size())
|
||||
{
|
||||
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %s", c_szCommand);
|
||||
return;
|
||||
}
|
||||
|
||||
// vid distance(1-3) angle(0-360)
|
||||
DWORD dwVID = atoi(TokenVector[1].c_str());
|
||||
BYTE byDistance = atoi(TokenVector[2].c_str());
|
||||
float fAngle = atof(TokenVector[3].c_str());
|
||||
fAngle = fmod(540.0f - fAngle, 360.0f);
|
||||
Tracef("StoneDetect [VID:%d] [Distance:%d] [Angle:%d->%f]\n", dwVID, byDistance, atoi(TokenVector[3].c_str()), fAngle);
|
||||
|
||||
IAbstractCharacterManager& rkChrMgr=IAbstractCharacterManager::GetSingleton();
|
||||
|
||||
CInstanceBase * pInstance = rkChrMgr.GetInstancePtr(dwVID);
|
||||
if (!pInstance)
|
||||
{
|
||||
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Not Exist Instance", c_szCommand);
|
||||
return;
|
||||
}
|
||||
|
||||
TPixelPosition PixelPosition;
|
||||
D3DXVECTOR3 v3Rotation(0.0f, 0.0f, fAngle);
|
||||
pInstance->NEW_GetPixelPosition(&PixelPosition);
|
||||
|
||||
PixelPosition.y *= -1.0f;
|
||||
|
||||
switch (byDistance)
|
||||
{
|
||||
case 0:
|
||||
CEffectManager::Instance().RegisterEffect("d:/ymir work/effect/etc/firecracker/find_out.mse");
|
||||
CEffectManager::Instance().CreateEffect("d:/ymir work/effect/etc/firecracker/find_out.mse", PixelPosition, v3Rotation);
|
||||
break;
|
||||
case 1:
|
||||
CEffectManager::Instance().RegisterEffect("d:/ymir work/effect/etc/compass/appear_small.mse");
|
||||
CEffectManager::Instance().CreateEffect("d:/ymir work/effect/etc/compass/appear_small.mse", PixelPosition, v3Rotation);
|
||||
break;
|
||||
case 2:
|
||||
CEffectManager::Instance().RegisterEffect("d:/ymir work/effect/etc/compass/appear_middle.mse");
|
||||
CEffectManager::Instance().CreateEffect("d:/ymir work/effect/etc/compass/appear_middle.mse", PixelPosition, v3Rotation);
|
||||
break;
|
||||
case 3:
|
||||
CEffectManager::Instance().RegisterEffect("d:/ymir work/effect/etc/compass/appear_large.mse");
|
||||
CEffectManager::Instance().CreateEffect("d:/ymir work/effect/etc/compass/appear_large.mse", PixelPosition, v3Rotation);
|
||||
break;
|
||||
default:
|
||||
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Distance", c_szCommand);
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
IAbstractChat& rkChat=IAbstractChat::GetSingleton();
|
||||
rkChat.AppendChat(CHAT_TYPE_INFO, c_szCommand);
|
||||
#endif
|
||||
}
|
||||
else if (!strcmpi(szCmd, "StartStaminaConsume"))
|
||||
{
|
||||
if (3 != TokenVector.size())
|
||||
{
|
||||
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %s", c_szCommand);
|
||||
return;
|
||||
}
|
||||
|
||||
DWORD dwConsumePerSec = atoi(TokenVector[1].c_str());
|
||||
DWORD dwCurrentStamina = atoi(TokenVector[2].c_str());
|
||||
|
||||
IAbstractPlayer& rPlayer=IAbstractPlayer::GetSingleton();
|
||||
rPlayer.StartStaminaConsume(dwConsumePerSec, dwCurrentStamina);
|
||||
}
|
||||
|
||||
else if (!strcmpi(szCmd, "StopStaminaConsume"))
|
||||
{
|
||||
if (2 != TokenVector.size())
|
||||
{
|
||||
TraceError("CPythonNetworkStream::ServerCommand(c_szCommand=%s) - Strange Parameter Count : %d", c_szCommand, TokenVector.size());
|
||||
return;
|
||||
}
|
||||
|
||||
DWORD dwCurrentStamina = atoi(TokenVector[1].c_str());
|
||||
|
||||
IAbstractPlayer& rPlayer=IAbstractPlayer::GetSingleton();
|
||||
rPlayer.StopStaminaConsume(dwCurrentStamina);
|
||||
}
|
||||
else if (!strcmpi(szCmd, "sms"))
|
||||
{
|
||||
IAbstractPlayer& rPlayer=IAbstractPlayer::GetSingleton();
|
||||
rPlayer.SetMobileFlag(TRUE);
|
||||
}
|
||||
else if (!strcmpi(szCmd, "nosms"))
|
||||
{
|
||||
IAbstractPlayer& rPlayer=IAbstractPlayer::GetSingleton();
|
||||
rPlayer.SetMobileFlag(FALSE);
|
||||
}
|
||||
else if (!strcmpi(szCmd, "mobile_auth"))
|
||||
{
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OnMobileAuthority", Py_BuildValue("()"));
|
||||
}
|
||||
else if (!strcmpi(szCmd, "messenger_auth"))
|
||||
{
|
||||
const std::string & c_rstrName = TokenVector[1].c_str();
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OnMessengerAddFriendQuestion", Py_BuildValue("(s)", c_rstrName.c_str()));
|
||||
}
|
||||
else if (!strcmpi(szCmd, "combo"))
|
||||
{
|
||||
int iFlag = atoi(TokenVector[1].c_str());
|
||||
IAbstractPlayer& rPlayer=IAbstractPlayer::GetSingleton();
|
||||
rPlayer.SetComboSkillFlag(iFlag);
|
||||
m_bComboSkillFlag = iFlag ? true : false;
|
||||
}
|
||||
else if (!strcmpi(szCmd, "setblockmode"))
|
||||
{
|
||||
int iFlag = atoi(TokenVector[1].c_str());
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OnBlockMode", Py_BuildValue("(i)", iFlag));
|
||||
}
|
||||
// Emotion Start
|
||||
else if (!strcmpi(szCmd, "french_kiss"))
|
||||
{
|
||||
int iVID1 = atoi(TokenVector[1].c_str());
|
||||
int iVID2 = atoi(TokenVector[2].c_str());
|
||||
|
||||
IAbstractCharacterManager & rkChrMgr = IAbstractCharacterManager::GetSingleton();
|
||||
CInstanceBase * pInstance1 = rkChrMgr.GetInstancePtr(iVID1);
|
||||
CInstanceBase * pInstance2 = rkChrMgr.GetInstancePtr(iVID2);
|
||||
if (pInstance1 && pInstance2)
|
||||
pInstance1->ActDualEmotion(*pInstance2, CRaceMotionData::NAME_FRENCH_KISS_START, CRaceMotionData::NAME_FRENCH_KISS_START);
|
||||
}
|
||||
else if (!strcmpi(szCmd, "kiss"))
|
||||
{
|
||||
int iVID1 = atoi(TokenVector[1].c_str());
|
||||
int iVID2 = atoi(TokenVector[2].c_str());
|
||||
|
||||
IAbstractCharacterManager & rkChrMgr = IAbstractCharacterManager::GetSingleton();
|
||||
CInstanceBase * pInstance1 = rkChrMgr.GetInstancePtr(iVID1);
|
||||
CInstanceBase * pInstance2 = rkChrMgr.GetInstancePtr(iVID2);
|
||||
if (pInstance1 && pInstance2)
|
||||
pInstance1->ActDualEmotion(*pInstance2, CRaceMotionData::NAME_KISS_START, CRaceMotionData::NAME_KISS_START);
|
||||
}
|
||||
else if (!strcmpi(szCmd, "slap"))
|
||||
{
|
||||
int iVID1 = atoi(TokenVector[1].c_str());
|
||||
int iVID2 = atoi(TokenVector[2].c_str());
|
||||
|
||||
IAbstractCharacterManager & rkChrMgr = IAbstractCharacterManager::GetSingleton();
|
||||
CInstanceBase * pInstance1 = rkChrMgr.GetInstancePtr(iVID1);
|
||||
CInstanceBase * pInstance2 = rkChrMgr.GetInstancePtr(iVID2);
|
||||
if (pInstance1 && pInstance2)
|
||||
pInstance1->ActDualEmotion(*pInstance2, CRaceMotionData::NAME_SLAP_HURT_START, CRaceMotionData::NAME_SLAP_HIT_START);
|
||||
}
|
||||
else if (!strcmpi(szCmd, "clap"))
|
||||
{
|
||||
int iVID = atoi(TokenVector[1].c_str());
|
||||
IAbstractCharacterManager & rkChrMgr = IAbstractCharacterManager::GetSingleton();
|
||||
CInstanceBase * pInstance = rkChrMgr.GetInstancePtr(iVID);
|
||||
if (pInstance)
|
||||
pInstance->ActEmotion(CRaceMotionData::NAME_CLAP);
|
||||
}
|
||||
else if (!strcmpi(szCmd, "cheer1"))
|
||||
{
|
||||
int iVID = atoi(TokenVector[1].c_str());
|
||||
IAbstractCharacterManager & rkChrMgr = IAbstractCharacterManager::GetSingleton();
|
||||
CInstanceBase * pInstance = rkChrMgr.GetInstancePtr(iVID);
|
||||
if (pInstance)
|
||||
pInstance->ActEmotion(CRaceMotionData::NAME_CHEERS_1);
|
||||
}
|
||||
else if (!strcmpi(szCmd, "cheer2"))
|
||||
{
|
||||
int iVID = atoi(TokenVector[1].c_str());
|
||||
IAbstractCharacterManager & rkChrMgr = IAbstractCharacterManager::GetSingleton();
|
||||
CInstanceBase * pInstance = rkChrMgr.GetInstancePtr(iVID);
|
||||
if (pInstance)
|
||||
pInstance->ActEmotion(CRaceMotionData::NAME_CHEERS_2);
|
||||
}
|
||||
else if (!strcmpi(szCmd, "dance1"))
|
||||
{
|
||||
int iVID = atoi(TokenVector[1].c_str());
|
||||
IAbstractCharacterManager & rkChrMgr = IAbstractCharacterManager::GetSingleton();
|
||||
CInstanceBase * pInstance = rkChrMgr.GetInstancePtr(iVID);
|
||||
if (pInstance)
|
||||
pInstance->ActEmotion(CRaceMotionData::NAME_DANCE_1);
|
||||
}
|
||||
else if (!strcmpi(szCmd, "dance2"))
|
||||
{
|
||||
int iVID = atoi(TokenVector[1].c_str());
|
||||
IAbstractCharacterManager & rkChrMgr = IAbstractCharacterManager::GetSingleton();
|
||||
CInstanceBase * pInstance = rkChrMgr.GetInstancePtr(iVID);
|
||||
if (pInstance)
|
||||
pInstance->ActEmotion(CRaceMotionData::NAME_DANCE_2);
|
||||
}
|
||||
else if (!strcmpi(szCmd, "dig_motion"))
|
||||
{
|
||||
int iVID = atoi(TokenVector[1].c_str());
|
||||
IAbstractCharacterManager & rkChrMgr = IAbstractCharacterManager::GetSingleton();
|
||||
CInstanceBase * pInstance = rkChrMgr.GetInstancePtr(iVID);
|
||||
if (pInstance)
|
||||
pInstance->ActEmotion(CRaceMotionData::NAME_DIG);
|
||||
}
|
||||
// Emotion End
|
||||
else
|
||||
{
|
||||
static std::map<std::string, int> s_emotionDict;
|
||||
|
||||
static bool s_isFirst = true;
|
||||
if (s_isFirst)
|
||||
{
|
||||
s_isFirst = false;
|
||||
|
||||
s_emotionDict["dance3"] = CRaceMotionData::NAME_DANCE_3;
|
||||
s_emotionDict["dance4"] = CRaceMotionData::NAME_DANCE_4;
|
||||
s_emotionDict["dance5"] = CRaceMotionData::NAME_DANCE_5;
|
||||
s_emotionDict["dance6"] = CRaceMotionData::NAME_DANCE_6;
|
||||
s_emotionDict["congratulation"] = CRaceMotionData::NAME_CONGRATULATION;
|
||||
s_emotionDict["forgive"] = CRaceMotionData::NAME_FORGIVE;
|
||||
s_emotionDict["angry"] = CRaceMotionData::NAME_ANGRY;
|
||||
s_emotionDict["attractive"] = CRaceMotionData::NAME_ATTRACTIVE;
|
||||
s_emotionDict["sad"] = CRaceMotionData::NAME_SAD;
|
||||
s_emotionDict["shy"] = CRaceMotionData::NAME_SHY;
|
||||
s_emotionDict["cheerup"] = CRaceMotionData::NAME_CHEERUP;
|
||||
s_emotionDict["banter"] = CRaceMotionData::NAME_BANTER;
|
||||
s_emotionDict["joy"] = CRaceMotionData::NAME_JOY;
|
||||
}
|
||||
|
||||
std::map<std::string, int>::iterator f = s_emotionDict.find(szCmd);
|
||||
if (f == s_emotionDict.end())
|
||||
{
|
||||
TraceError("Unknown Server Command %s | %s", c_szCommand, szCmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
int emotionIndex = f->second;
|
||||
|
||||
int iVID = atoi(TokenVector[1].c_str());
|
||||
IAbstractCharacterManager & rkChrMgr = IAbstractCharacterManager::GetSingleton();
|
||||
CInstanceBase * pInstance = rkChrMgr.GetInstancePtr(iVID);
|
||||
|
||||
if (pInstance)
|
||||
pInstance->ActEmotion(emotionIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,454 @@
|
||||
#include "StdAfx.h"
|
||||
#include "PythonNetworkStream.h"
|
||||
#include "NetworkActorManager.h"
|
||||
#include "PythonBackground.h"
|
||||
|
||||
#include "PythonApplication.h"
|
||||
#include "AbstractPlayer.h"
|
||||
#include "../GameLib/ActorInstance.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void CPythonNetworkStream::__GlobalPositionToLocalPosition(LONG& rGlobalX, LONG& rGlobalY)
|
||||
{
|
||||
CPythonBackground&rkBgMgr=CPythonBackground::Instance();
|
||||
rkBgMgr.GlobalPositionToLocalPosition(rGlobalX, rGlobalY);
|
||||
}
|
||||
|
||||
void CPythonNetworkStream::__LocalPositionToGlobalPosition(LONG& rLocalX, LONG& rLocalY)
|
||||
{
|
||||
CPythonBackground&rkBgMgr=CPythonBackground::Instance();
|
||||
rkBgMgr.LocalPositionToGlobalPosition(rLocalX, rLocalY);
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::__CanActMainInstance()
|
||||
{
|
||||
CPythonCharacterManager& rkChrMgr=CPythonCharacterManager::Instance();
|
||||
CInstanceBase* pkInstMain=rkChrMgr.GetMainInstancePtr();
|
||||
if (!pkInstMain)
|
||||
return false;
|
||||
|
||||
return pkInstMain->CanAct();
|
||||
}
|
||||
|
||||
void CPythonNetworkStream::__ClearNetworkActorManager()
|
||||
{
|
||||
m_rokNetActorMgr->Destroy();
|
||||
}
|
||||
|
||||
void __SetWeaponPower(IAbstractPlayer& rkPlayer, DWORD dwWeaponID)
|
||||
{
|
||||
DWORD minPower=0;
|
||||
DWORD maxPower=0;
|
||||
DWORD minMagicPower=0;
|
||||
DWORD maxMagicPower=0;
|
||||
DWORD addPower=0;
|
||||
|
||||
CItemData* pkWeapon;
|
||||
if (CItemManager::Instance().GetItemDataPointer(dwWeaponID, &pkWeapon))
|
||||
{
|
||||
if (pkWeapon->GetType()==CItemData::ITEM_TYPE_WEAPON)
|
||||
{
|
||||
minPower=pkWeapon->GetValue(3);
|
||||
maxPower=pkWeapon->GetValue(4);
|
||||
minMagicPower=pkWeapon->GetValue(1);
|
||||
maxMagicPower=pkWeapon->GetValue(2);
|
||||
addPower=pkWeapon->GetValue(5);
|
||||
}
|
||||
}
|
||||
|
||||
rkPlayer.SetWeaponPower(minPower, maxPower, minMagicPower, maxMagicPower, addPower);
|
||||
}
|
||||
|
||||
//테이블에서 이름이 "." 인 것들
|
||||
//차후에 서버에서 보내주지 않게 되면 없어질 함수..(서버님께 꼭!!협박; )
|
||||
bool IsInvisibleRace(WORD raceNum)
|
||||
{
|
||||
switch(raceNum)
|
||||
{
|
||||
case 20025:
|
||||
case 20038:
|
||||
case 20039:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static SNetworkActorData s_kNetActorData;
|
||||
|
||||
|
||||
bool CPythonNetworkStream::RecvCharacterAppendPacket()
|
||||
{
|
||||
TPacketGCCharacterAdd chrAddPacket;
|
||||
if (!Recv(sizeof(chrAddPacket), &chrAddPacket))
|
||||
return false;
|
||||
|
||||
__GlobalPositionToLocalPosition(chrAddPacket.x, chrAddPacket.y);
|
||||
|
||||
SNetworkActorData kNetActorData;
|
||||
kNetActorData.m_bType=chrAddPacket.bType;
|
||||
kNetActorData.m_dwMovSpd=chrAddPacket.bMovingSpeed;
|
||||
kNetActorData.m_dwAtkSpd=chrAddPacket.bAttackSpeed;
|
||||
kNetActorData.m_dwRace=chrAddPacket.wRaceNum;
|
||||
|
||||
kNetActorData.m_dwStateFlags=chrAddPacket.bStateFlag;
|
||||
kNetActorData.m_dwVID=chrAddPacket.dwVID;
|
||||
kNetActorData.m_fRot=chrAddPacket.angle;
|
||||
|
||||
kNetActorData.m_stName="";
|
||||
|
||||
kNetActorData.m_stName="";
|
||||
kNetActorData.m_kAffectFlags.CopyData(0, sizeof(chrAddPacket.dwAffectFlag[0]), &chrAddPacket.dwAffectFlag[0]);
|
||||
kNetActorData.m_kAffectFlags.CopyData(32, sizeof(chrAddPacket.dwAffectFlag[1]), &chrAddPacket.dwAffectFlag[1]);
|
||||
|
||||
kNetActorData.SetPosition(chrAddPacket.x, chrAddPacket.y);
|
||||
|
||||
kNetActorData.m_sAlignment=0;/*chrAddPacket.sAlignment*/;
|
||||
kNetActorData.m_byPKMode=0;/*chrAddPacket.bPKMode*/;
|
||||
kNetActorData.m_dwGuildID=0;/*chrAddPacket.dwGuild*/;
|
||||
kNetActorData.m_dwEmpireID=0;/*chrAddPacket.bEmpire*/;
|
||||
kNetActorData.m_dwArmor=0;/*chrAddPacket.awPart[CHR_EQUIPPART_ARMOR]*/;
|
||||
kNetActorData.m_dwWeapon=0;/*chrAddPacket.awPart[CHR_EQUIPPART_WEAPON]*/;
|
||||
kNetActorData.m_dwHair=0;/*chrAddPacket.awPart[CHR_EQUIPPART_HAIR]*/;
|
||||
kNetActorData.m_dwMountVnum=0;/*chrAddPacket.dwMountVnum*/;
|
||||
|
||||
kNetActorData.m_dwLevel = 0; // 몬스터 레벨 표시 안함
|
||||
|
||||
if(kNetActorData.m_bType != CActorInstance::TYPE_PC &&
|
||||
kNetActorData.m_bType != CActorInstance::TYPE_NPC)
|
||||
{
|
||||
const char * c_szName;
|
||||
CPythonNonPlayer& rkNonPlayer=CPythonNonPlayer::Instance();
|
||||
if (rkNonPlayer.GetName(kNetActorData.m_dwRace, &c_szName))
|
||||
kNetActorData.m_stName = c_szName;
|
||||
//else
|
||||
// kNetActorData.m_stName=chrAddPacket.name;
|
||||
|
||||
__RecvCharacterAppendPacket(&kNetActorData);
|
||||
}
|
||||
else
|
||||
{
|
||||
s_kNetActorData = kNetActorData;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvCharacterAdditionalInfo()
|
||||
{
|
||||
TPacketGCCharacterAdditionalInfo chrInfoPacket;
|
||||
if (!Recv(sizeof(chrInfoPacket), &chrInfoPacket))
|
||||
return false;
|
||||
|
||||
|
||||
SNetworkActorData kNetActorData = s_kNetActorData;
|
||||
if (IsInvisibleRace(kNetActorData.m_dwRace))
|
||||
return true;
|
||||
|
||||
if(kNetActorData.m_dwVID == chrInfoPacket.dwVID)
|
||||
{
|
||||
kNetActorData.m_stName = chrInfoPacket.name;
|
||||
kNetActorData.m_dwGuildID = chrInfoPacket.dwGuildID;
|
||||
kNetActorData.m_dwLevel = chrInfoPacket.dwLevel;
|
||||
kNetActorData.m_sAlignment=chrInfoPacket.sAlignment;
|
||||
kNetActorData.m_byPKMode=chrInfoPacket.bPKMode;
|
||||
kNetActorData.m_dwGuildID=chrInfoPacket.dwGuildID;
|
||||
kNetActorData.m_dwEmpireID=chrInfoPacket.bEmpire;
|
||||
kNetActorData.m_dwArmor=chrInfoPacket.awPart[CHR_EQUIPPART_ARMOR];
|
||||
kNetActorData.m_dwWeapon=chrInfoPacket.awPart[CHR_EQUIPPART_WEAPON];
|
||||
kNetActorData.m_dwHair=chrInfoPacket.awPart[CHR_EQUIPPART_HAIR];
|
||||
kNetActorData.m_dwMountVnum=chrInfoPacket.dwMountVnum;
|
||||
|
||||
__RecvCharacterAppendPacket(&kNetActorData);
|
||||
}
|
||||
else
|
||||
{
|
||||
TraceError("TPacketGCCharacterAdditionalInfo name=%s vid=%d race=%d Error",chrInfoPacket.name,chrInfoPacket.dwVID,kNetActorData.m_dwRace);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvCharacterAppendPacketNew()
|
||||
{
|
||||
TraceError("TPacketGCCharacterAdd2\264\302 \276\262\301\366 \276\312\264\302 \306\320\305\266\300\324\264\317\264\331.");
|
||||
TPacketGCCharacterAdd2 chrAddPacket;
|
||||
if (!Recv(sizeof(chrAddPacket), &chrAddPacket))
|
||||
return false;
|
||||
if(IsInvisibleRace(chrAddPacket.wRaceNum))
|
||||
return true;
|
||||
|
||||
__GlobalPositionToLocalPosition(chrAddPacket.x, chrAddPacket.y);
|
||||
|
||||
SNetworkActorData kNetActorData;
|
||||
kNetActorData.m_dwLevel = 0;
|
||||
kNetActorData.m_bType=chrAddPacket.bType;
|
||||
kNetActorData.m_dwGuildID=chrAddPacket.dwGuild;
|
||||
kNetActorData.m_dwEmpireID=chrAddPacket.bEmpire;
|
||||
kNetActorData.m_dwMovSpd=chrAddPacket.bMovingSpeed;
|
||||
kNetActorData.m_dwAtkSpd=chrAddPacket.bAttackSpeed;
|
||||
kNetActorData.m_dwRace=chrAddPacket.wRaceNum;
|
||||
kNetActorData.m_dwArmor=chrAddPacket.awPart[CHR_EQUIPPART_ARMOR];
|
||||
kNetActorData.m_dwWeapon=chrAddPacket.awPart[CHR_EQUIPPART_WEAPON];
|
||||
kNetActorData.m_dwHair=chrAddPacket.awPart[CHR_EQUIPPART_HAIR];
|
||||
kNetActorData.m_dwStateFlags=chrAddPacket.bStateFlag;
|
||||
kNetActorData.m_dwVID=chrAddPacket.dwVID;
|
||||
kNetActorData.m_dwMountVnum=chrAddPacket.dwMountVnum;
|
||||
kNetActorData.m_fRot=chrAddPacket.angle;
|
||||
kNetActorData.m_kAffectFlags.CopyData(0, sizeof(chrAddPacket.dwAffectFlag[0]), &chrAddPacket.dwAffectFlag[0]);
|
||||
kNetActorData.m_kAffectFlags.CopyData(32, sizeof(chrAddPacket.dwAffectFlag[1]), &chrAddPacket.dwAffectFlag[1]);
|
||||
kNetActorData.SetPosition(chrAddPacket.x, chrAddPacket.y);
|
||||
kNetActorData.m_sAlignment=chrAddPacket.sAlignment;
|
||||
kNetActorData.m_byPKMode=chrAddPacket.bPKMode;
|
||||
kNetActorData.m_stName=chrAddPacket.name;
|
||||
__RecvCharacterAppendPacket(&kNetActorData);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvCharacterUpdatePacket()
|
||||
{
|
||||
TPacketGCCharacterUpdate chrUpdatePacket;
|
||||
if (!Recv(sizeof(chrUpdatePacket), &chrUpdatePacket))
|
||||
return false;
|
||||
|
||||
SNetworkUpdateActorData kNetUpdateActorData;
|
||||
kNetUpdateActorData.m_dwGuildID=chrUpdatePacket.dwGuildID;
|
||||
kNetUpdateActorData.m_dwMovSpd=chrUpdatePacket.bMovingSpeed;
|
||||
kNetUpdateActorData.m_dwAtkSpd=chrUpdatePacket.bAttackSpeed;
|
||||
kNetUpdateActorData.m_dwArmor=chrUpdatePacket.awPart[CHR_EQUIPPART_ARMOR];
|
||||
kNetUpdateActorData.m_dwWeapon=chrUpdatePacket.awPart[CHR_EQUIPPART_WEAPON];
|
||||
kNetUpdateActorData.m_dwHair=chrUpdatePacket.awPart[CHR_EQUIPPART_HAIR];
|
||||
kNetUpdateActorData.m_dwVID=chrUpdatePacket.dwVID;
|
||||
kNetUpdateActorData.m_kAffectFlags.CopyData(0, sizeof(chrUpdatePacket.dwAffectFlag[0]), &chrUpdatePacket.dwAffectFlag[0]);
|
||||
kNetUpdateActorData.m_kAffectFlags.CopyData(32, sizeof(chrUpdatePacket.dwAffectFlag[1]), &chrUpdatePacket.dwAffectFlag[1]);
|
||||
kNetUpdateActorData.m_sAlignment=chrUpdatePacket.sAlignment;
|
||||
kNetUpdateActorData.m_byPKMode=chrUpdatePacket.bPKMode;
|
||||
kNetUpdateActorData.m_dwStateFlags=chrUpdatePacket.bStateFlag;
|
||||
kNetUpdateActorData.m_dwMountVnum=chrUpdatePacket.dwMountVnum;
|
||||
__RecvCharacterUpdatePacket(&kNetUpdateActorData);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvCharacterUpdatePacketNew()
|
||||
{
|
||||
TPacketGCCharacterUpdate2 chrUpdatePacket;
|
||||
if (!Recv(sizeof(chrUpdatePacket), &chrUpdatePacket))
|
||||
return false;
|
||||
|
||||
SNetworkUpdateActorData kNetUpdateActorData;
|
||||
kNetUpdateActorData.m_dwGuildID=chrUpdatePacket.dwGuildID;
|
||||
kNetUpdateActorData.m_dwMovSpd=chrUpdatePacket.bMovingSpeed;
|
||||
kNetUpdateActorData.m_dwAtkSpd=chrUpdatePacket.bAttackSpeed;
|
||||
kNetUpdateActorData.m_dwArmor=chrUpdatePacket.awPart[CHR_EQUIPPART_ARMOR];
|
||||
kNetUpdateActorData.m_dwWeapon=chrUpdatePacket.awPart[CHR_EQUIPPART_WEAPON];
|
||||
kNetUpdateActorData.m_dwHair=chrUpdatePacket.awPart[CHR_EQUIPPART_HAIR];
|
||||
kNetUpdateActorData.m_dwVID=chrUpdatePacket.dwVID;
|
||||
kNetUpdateActorData.m_kAffectFlags.CopyData(0, sizeof(chrUpdatePacket.dwAffectFlag[0]), &chrUpdatePacket.dwAffectFlag[0]);
|
||||
kNetUpdateActorData.m_kAffectFlags.CopyData(32, sizeof(chrUpdatePacket.dwAffectFlag[1]), &chrUpdatePacket.dwAffectFlag[1]);
|
||||
kNetUpdateActorData.m_sAlignment=chrUpdatePacket.sAlignment;
|
||||
kNetUpdateActorData.m_byPKMode=chrUpdatePacket.bPKMode;
|
||||
kNetUpdateActorData.m_dwStateFlags=chrUpdatePacket.bStateFlag;
|
||||
kNetUpdateActorData.m_dwMountVnum=chrUpdatePacket.dwMountVnum;
|
||||
__RecvCharacterUpdatePacket(&kNetUpdateActorData);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CPythonNetworkStream::__RecvCharacterAppendPacket(SNetworkActorData * pkNetActorData)
|
||||
{
|
||||
// NOTE : 카메라가 땅에 묻히는 문제의 해결을 위해 메인 캐릭터가 지형에 올려지기
|
||||
// 전에 맵을 업데이트 해 높이를 구할 수 있도록 해놓아야 합니다.
|
||||
// 단, 게임이 들어갈때가 아닌 이미 캐릭터가 추가 된 이후에만 합니다.
|
||||
// 헌데 이동인데 왜 Move로 안하고 Append로 하는지..? - [levites]
|
||||
IAbstractPlayer& rkPlayer = IAbstractPlayer::GetSingleton();
|
||||
if (rkPlayer.IsMainCharacterIndex(pkNetActorData->m_dwVID))
|
||||
{
|
||||
rkPlayer.SetRace(pkNetActorData->m_dwRace);
|
||||
|
||||
__SetWeaponPower(rkPlayer, pkNetActorData->m_dwWeapon);
|
||||
|
||||
if (rkPlayer.NEW_GetMainActorPtr())
|
||||
{
|
||||
CPythonBackground::Instance().Update(pkNetActorData->m_lCurX, pkNetActorData->m_lCurY, 0.0f);
|
||||
CPythonCharacterManager::Instance().Update();
|
||||
|
||||
// NOTE : 사귀 타워일 경우 GOTO 로 이동시에도 맵 이름을 출력하도록 처리
|
||||
{
|
||||
std::string strMapName = CPythonBackground::Instance().GetWarpMapName();
|
||||
if (strMapName == "metin2_map_deviltower1")
|
||||
__ShowMapName(pkNetActorData->m_lCurX, pkNetActorData->m_lCurY);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__ShowMapName(pkNetActorData->m_lCurX, pkNetActorData->m_lCurY);
|
||||
}
|
||||
}
|
||||
|
||||
m_rokNetActorMgr->AppendActor(*pkNetActorData);
|
||||
|
||||
if (GetMainActorVID()==pkNetActorData->m_dwVID)
|
||||
{
|
||||
rkPlayer.SetTarget(0);
|
||||
if (m_bComboSkillFlag)
|
||||
rkPlayer.SetComboSkillFlag(m_bComboSkillFlag);
|
||||
|
||||
__SetGuildID(pkNetActorData->m_dwGuildID);
|
||||
//CPythonApplication::Instance().SkipRenderBuffering(10000);
|
||||
}
|
||||
}
|
||||
|
||||
void CPythonNetworkStream::__RecvCharacterUpdatePacket(SNetworkUpdateActorData * pkNetUpdateActorData)
|
||||
{
|
||||
m_rokNetActorMgr->UpdateActor(*pkNetUpdateActorData);
|
||||
|
||||
IAbstractPlayer& rkPlayer = IAbstractPlayer::GetSingleton();
|
||||
if (rkPlayer.IsMainCharacterIndex(pkNetUpdateActorData->m_dwVID))
|
||||
{
|
||||
__SetGuildID(pkNetUpdateActorData->m_dwGuildID);
|
||||
__SetWeaponPower(rkPlayer, pkNetUpdateActorData->m_dwWeapon);
|
||||
|
||||
__RefreshStatus();
|
||||
__RefreshAlignmentWindow();
|
||||
__RefreshEquipmentWindow();
|
||||
__RefreshInventoryWindow();
|
||||
}
|
||||
else
|
||||
{
|
||||
rkPlayer.NotifyCharacterUpdate(pkNetUpdateActorData->m_dwVID);
|
||||
}
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvCharacterDeletePacket()
|
||||
{
|
||||
TPacketGCCharacterDelete chrDelPacket;
|
||||
|
||||
if (!Recv(sizeof(chrDelPacket), &chrDelPacket))
|
||||
{
|
||||
TraceError("CPythonNetworkStream::RecvCharacterDeletePacket - Recv Error");
|
||||
return false;
|
||||
}
|
||||
|
||||
m_rokNetActorMgr->RemoveActor(chrDelPacket.dwVID);
|
||||
|
||||
// 캐릭터가 사라질때 개인 상점도 없애줍니다.
|
||||
// Key Check 를 하기때문에 없어도 상관은 없습니다.
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME],
|
||||
"BINARY_PrivateShop_Disappear",
|
||||
Py_BuildValue("(i)", chrDelPacket.dwVID)
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CPythonNetworkStream::RecvCharacterMovePacket()
|
||||
{
|
||||
TPacketGCMove kMovePacket;
|
||||
if (!Recv(sizeof(TPacketGCMove), &kMovePacket))
|
||||
{
|
||||
Tracen("CPythonNetworkStream::RecvCharacterMovePacket - PACKET READ ERROR");
|
||||
return false;
|
||||
}
|
||||
|
||||
__GlobalPositionToLocalPosition(kMovePacket.lX, kMovePacket.lY);
|
||||
|
||||
SNetworkMoveActorData kNetMoveActorData;
|
||||
kNetMoveActorData.m_dwArg=kMovePacket.bArg;
|
||||
kNetMoveActorData.m_dwFunc=kMovePacket.bFunc;
|
||||
kNetMoveActorData.m_dwTime=kMovePacket.dwTime;
|
||||
kNetMoveActorData.m_dwVID=kMovePacket.dwVID;
|
||||
kNetMoveActorData.m_fRot=kMovePacket.bRot*5.0f;
|
||||
kNetMoveActorData.m_lPosX=kMovePacket.lX;
|
||||
kNetMoveActorData.m_lPosY=kMovePacket.lY;
|
||||
kNetMoveActorData.m_dwDuration=kMovePacket.dwDuration;
|
||||
|
||||
m_rokNetActorMgr->MoveActor(kNetMoveActorData);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvOwnerShipPacket()
|
||||
{
|
||||
TPacketGCOwnership kPacketOwnership;
|
||||
|
||||
if (!Recv(sizeof(kPacketOwnership), &kPacketOwnership))
|
||||
return false;
|
||||
|
||||
m_rokNetActorMgr->SetActorOwner(kPacketOwnership.dwOwnerVID, kPacketOwnership.dwVictimVID);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvSyncPositionPacket()
|
||||
{
|
||||
TPacketGCSyncPosition kPacketSyncPos;
|
||||
if (!Recv(sizeof(kPacketSyncPos), &kPacketSyncPos))
|
||||
return false;
|
||||
|
||||
TPacketGCSyncPositionElement kSyncPos;
|
||||
|
||||
UINT uSyncPosCount=(kPacketSyncPos.wSize-sizeof(kPacketSyncPos))/sizeof(kSyncPos);
|
||||
for (UINT iSyncPos=0; iSyncPos<uSyncPosCount; ++iSyncPos)
|
||||
{
|
||||
if (!Recv(sizeof(TPacketGCSyncPositionElement), &kSyncPos))
|
||||
return false;
|
||||
|
||||
#ifdef __MOVIE_MODE__
|
||||
return true;
|
||||
#endif __MOVIE_MODE__
|
||||
|
||||
//Tracenf("CPythonNetworkStream::RecvSyncPositionPacket %d (%d, %d)", kSyncPos.dwVID, kSyncPos.lX, kSyncPos.lY);
|
||||
|
||||
__GlobalPositionToLocalPosition(kSyncPos.lX, kSyncPos.lY);
|
||||
m_rokNetActorMgr->SyncActor(kSyncPos.dwVID, kSyncPos.lX, kSyncPos.lY);
|
||||
|
||||
/*
|
||||
CPythonCharacterManager & rkChrMgr = CPythonCharacterManager::Instance();
|
||||
CInstanceBase * pkChrInst = rkChrMgr.GetInstancePtr(kSyncPos.dwVID);
|
||||
|
||||
if (pkChrInst)
|
||||
{
|
||||
pkChrInst->NEW_SyncPixelPosition(kSyncPos.lX, kSyncPos.lY);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
bool CPythonNetworkStream::RecvCharacterAppendPacket()
|
||||
{
|
||||
TPacketGCCharacterAdd chrAddPacket;
|
||||
|
||||
if (!Recv(sizeof(chrAddPacket), &chrAddPacket))
|
||||
return false;
|
||||
|
||||
__GlobalPositionToLocalPosition(chrAddPacket.lX, chrAddPacket.lY);
|
||||
|
||||
SNetworkActorData kNetActorData;
|
||||
kNetActorData.m_dwGuildID=chrAddPacket.dwGuild;
|
||||
kNetActorData.m_dwEmpireID=chrAddPacket.bEmpire;
|
||||
kNetActorData.m_dwMovSpd=chrAddPacket.bMovingSpeed;
|
||||
kNetActorData.m_dwAtkSpd=chrAddPacket.bAttackSpeed;
|
||||
kNetActorData.m_dwRace=chrAddPacket.wRaceNum;
|
||||
kNetActorData.m_dwShape=chrAddPacket.parts[CRaceData::PART_MAIN];
|
||||
kNetActorData.m_dwStateFlags=chrAddPacket.bStateFlag;
|
||||
kNetActorData.m_dwVID=chrAddPacket.dwVID;
|
||||
kNetActorData.m_dwWeapon=chrAddPacket.parts[CRaceData::PART_WEAPON];
|
||||
kNetActorData.m_fRot=chrAddPacket.angle;
|
||||
kNetActorData.m_kAffectFlags.CopyData(0, sizeof(chrAddPacket.dwAffectFlag[0]), &chrAddPacket.dwAffectFlag[0]);
|
||||
kNetActorData.m_kAffectFlags.CopyData(32, sizeof(chrAddPacket.dwAffectFlag[1]), &chrAddPacket.dwAffectFlag[1]);
|
||||
kNetActorData.SetPosition(chrAddPacket.lX, chrAddPacket.lY);
|
||||
kNetActorData.m_stName=chrAddPacket.name;
|
||||
__RecvCharacterAppendPacket(&kNetActorData);
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,940 @@
|
||||
#include "StdAfx.h"
|
||||
#include "PythonNetworkStream.h"
|
||||
#include "PythonItem.h"
|
||||
#include "PythonShop.h"
|
||||
#include "PythonExchange.h"
|
||||
#include "PythonSafeBox.h"
|
||||
#include "PythonCharacterManager.h"
|
||||
|
||||
#include "AbstractPlayer.h"
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// SafeBox
|
||||
|
||||
bool CPythonNetworkStream::SendSafeBoxMoneyPacket(BYTE byState, DWORD dwMoney)
|
||||
{
|
||||
assert(!"CPythonNetworkStream::SendSafeBoxMoneyPacket - \273\347\277\353\307\317\301\366 \276\312\264\302 \307\324\274\366");
|
||||
return false;
|
||||
|
||||
// TPacketCGSafeboxMoney kSafeboxMoney;
|
||||
// kSafeboxMoney.bHeader = HEADER_CG_SAFEBOX_MONEY;
|
||||
// kSafeboxMoney.bState = byState;
|
||||
// kSafeboxMoney.dwMoney = dwMoney;
|
||||
// if (!Send(sizeof(kSafeboxMoney), &kSafeboxMoney))
|
||||
// return false;
|
||||
//
|
||||
// return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendSafeBoxCheckinPacket(TItemPos InventoryPos, BYTE bySafeBoxPos)
|
||||
{
|
||||
__PlayInventoryItemDropSound(InventoryPos);
|
||||
|
||||
TPacketCGSafeboxCheckin kSafeboxCheckin;
|
||||
kSafeboxCheckin.bHeader = HEADER_CG_SAFEBOX_CHECKIN;
|
||||
kSafeboxCheckin.ItemPos = InventoryPos;
|
||||
kSafeboxCheckin.bSafePos = bySafeBoxPos;
|
||||
if (!Send(sizeof(kSafeboxCheckin), &kSafeboxCheckin))
|
||||
return false;
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendSafeBoxCheckoutPacket(BYTE bySafeBoxPos, TItemPos InventoryPos)
|
||||
{
|
||||
__PlaySafeBoxItemDropSound(bySafeBoxPos);
|
||||
|
||||
TPacketCGSafeboxCheckout kSafeboxCheckout;
|
||||
kSafeboxCheckout.bHeader = HEADER_CG_SAFEBOX_CHECKOUT;
|
||||
kSafeboxCheckout.bSafePos = bySafeBoxPos;
|
||||
kSafeboxCheckout.ItemPos = InventoryPos;
|
||||
if (!Send(sizeof(kSafeboxCheckout), &kSafeboxCheckout))
|
||||
return false;
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendSafeBoxItemMovePacket(BYTE bySourcePos, BYTE byTargetPos, BYTE byCount)
|
||||
{
|
||||
__PlaySafeBoxItemDropSound(bySourcePos);
|
||||
|
||||
TPacketCGItemMove kItemMove;
|
||||
kItemMove.header = HEADER_CG_SAFEBOX_ITEM_MOVE;
|
||||
kItemMove.pos = TItemPos(INVENTORY, bySourcePos);
|
||||
kItemMove.num = byCount;
|
||||
kItemMove.change_pos = TItemPos(INVENTORY, byTargetPos);
|
||||
if (!Send(sizeof(kItemMove), &kItemMove))
|
||||
return false;
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvSafeBoxSetPacket()
|
||||
{
|
||||
TPacketGCItemSet2 kItemSet;
|
||||
if (!Recv(sizeof(kItemSet), &kItemSet))
|
||||
return false;
|
||||
|
||||
TItemData kItemData;
|
||||
kItemData.vnum = kItemSet.vnum;
|
||||
kItemData.count = kItemSet.count;
|
||||
kItemData.flags = kItemSet.flags;
|
||||
kItemData.anti_flags = kItemSet.anti_flags;
|
||||
for (int isocket=0; isocket<ITEM_SOCKET_SLOT_MAX_NUM; ++isocket)
|
||||
kItemData.alSockets[isocket] = kItemSet.alSockets[isocket];
|
||||
for (int iattr=0; iattr<ITEM_ATTRIBUTE_SLOT_MAX_NUM; ++iattr)
|
||||
kItemData.aAttr[iattr] = kItemSet.aAttr[iattr];
|
||||
|
||||
CPythonSafeBox::Instance().SetItemData(kItemSet.Cell.cell, kItemData);
|
||||
|
||||
__RefreshSafeboxWindow();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvSafeBoxDelPacket()
|
||||
{
|
||||
TPacketGCItemDel kItemDel;
|
||||
if (!Recv(sizeof(kItemDel), &kItemDel))
|
||||
return false;
|
||||
|
||||
CPythonSafeBox::Instance().DelItemData(kItemDel.pos);
|
||||
|
||||
__RefreshSafeboxWindow();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvSafeBoxWrongPasswordPacket()
|
||||
{
|
||||
TPacketGCSafeboxWrongPassword kSafeboxWrongPassword;
|
||||
|
||||
if (!Recv(sizeof(kSafeboxWrongPassword), &kSafeboxWrongPassword))
|
||||
return false;
|
||||
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OnSafeBoxError", Py_BuildValue("()"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvSafeBoxSizePacket()
|
||||
{
|
||||
TPacketGCSafeboxSize kSafeBoxSize;
|
||||
if (!Recv(sizeof(kSafeBoxSize), &kSafeBoxSize))
|
||||
return false;
|
||||
|
||||
CPythonSafeBox::Instance().OpenSafeBox(kSafeBoxSize.bSize);
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OpenSafeboxWindow", Py_BuildValue("(i)", kSafeBoxSize.bSize));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvSafeBoxMoneyChangePacket()
|
||||
{
|
||||
TPacketGCSafeboxMoneyChange kMoneyChange;
|
||||
if (!Recv(sizeof(kMoneyChange), &kMoneyChange))
|
||||
return false;
|
||||
|
||||
CPythonSafeBox::Instance().SetMoney(kMoneyChange.dwMoney);
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "RefreshSafeboxMoney", Py_BuildValue("()"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// SafeBox
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Mall
|
||||
bool CPythonNetworkStream::SendMallCheckoutPacket(BYTE byMallPos, TItemPos InventoryPos)
|
||||
{
|
||||
__PlayMallItemDropSound(byMallPos);
|
||||
|
||||
TPacketCGMallCheckout kMallCheckoutPacket;
|
||||
kMallCheckoutPacket.bHeader = HEADER_CG_MALL_CHECKOUT;
|
||||
kMallCheckoutPacket.bMallPos = byMallPos;
|
||||
kMallCheckoutPacket.ItemPos = InventoryPos;
|
||||
if (!Send(sizeof(kMallCheckoutPacket), &kMallCheckoutPacket))
|
||||
return false;
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvMallOpenPacket()
|
||||
{
|
||||
TPacketGCMallOpen kMallOpen;
|
||||
if (!Recv(sizeof(kMallOpen), &kMallOpen))
|
||||
return false;
|
||||
|
||||
CPythonSafeBox::Instance().OpenMall(kMallOpen.bSize);
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "OpenMallWindow", Py_BuildValue("(i)", kMallOpen.bSize));
|
||||
|
||||
return true;
|
||||
}
|
||||
bool CPythonNetworkStream::RecvMallItemSetPacket()
|
||||
{
|
||||
TPacketGCItemSet2 kItemSet;
|
||||
if (!Recv(sizeof(kItemSet), &kItemSet))
|
||||
return false;
|
||||
|
||||
TItemData kItemData;
|
||||
kItemData.vnum = kItemSet.vnum;
|
||||
kItemData.count = kItemSet.count;
|
||||
kItemData.flags = kItemSet.flags;
|
||||
kItemData.anti_flags = kItemSet.anti_flags;
|
||||
for (int isocket=0; isocket<ITEM_SOCKET_SLOT_MAX_NUM; ++isocket)
|
||||
kItemData.alSockets[isocket] = kItemSet.alSockets[isocket];
|
||||
for (int iattr=0; iattr<ITEM_ATTRIBUTE_SLOT_MAX_NUM; ++iattr)
|
||||
kItemData.aAttr[iattr] = kItemSet.aAttr[iattr];
|
||||
|
||||
CPythonSafeBox::Instance().SetMallItemData(kItemSet.Cell.cell, kItemData);
|
||||
|
||||
__RefreshMallWindow();
|
||||
|
||||
return true;
|
||||
}
|
||||
bool CPythonNetworkStream::RecvMallItemDelPacket()
|
||||
{
|
||||
TPacketGCItemDel kItemDel;
|
||||
if (!Recv(sizeof(kItemDel), &kItemDel))
|
||||
return false;
|
||||
|
||||
CPythonSafeBox::Instance().DelMallItemData(kItemDel.pos);
|
||||
|
||||
__RefreshMallWindow();
|
||||
Tracef(" >> CPythonNetworkStream::RecvMallItemDelPacket\n");
|
||||
|
||||
return true;
|
||||
}
|
||||
// Mall
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Item
|
||||
// Recieve
|
||||
bool CPythonNetworkStream::RecvItemSetPacket()
|
||||
{
|
||||
TPacketGCItemSet packet_item_set;
|
||||
|
||||
if (!Recv(sizeof(TPacketGCItemSet), &packet_item_set))
|
||||
return false;
|
||||
|
||||
TItemData kItemData;
|
||||
kItemData.vnum = packet_item_set.vnum;
|
||||
kItemData.count = packet_item_set.count;
|
||||
kItemData.flags = 0;
|
||||
for (int i=0; i<ITEM_SOCKET_SLOT_MAX_NUM; ++i)
|
||||
kItemData.alSockets[i]=packet_item_set.alSockets[i];
|
||||
for (int j=0; j<ITEM_ATTRIBUTE_SLOT_MAX_NUM; ++j)
|
||||
kItemData.aAttr[j]=packet_item_set.aAttr[j];
|
||||
|
||||
IAbstractPlayer& rkPlayer=IAbstractPlayer::GetSingleton();
|
||||
|
||||
rkPlayer.SetItemData(packet_item_set.Cell, kItemData);
|
||||
|
||||
__RefreshInventoryWindow();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvItemSetPacket2()
|
||||
{
|
||||
TPacketGCItemSet2 packet_item_set;
|
||||
|
||||
if (!Recv(sizeof(TPacketGCItemSet2), &packet_item_set))
|
||||
return false;
|
||||
|
||||
TItemData kItemData;
|
||||
kItemData.vnum = packet_item_set.vnum;
|
||||
kItemData.count = packet_item_set.count;
|
||||
kItemData.flags = packet_item_set.flags;
|
||||
kItemData.anti_flags = packet_item_set.anti_flags;
|
||||
|
||||
for (int i=0; i<ITEM_SOCKET_SLOT_MAX_NUM; ++i)
|
||||
kItemData.alSockets[i]=packet_item_set.alSockets[i];
|
||||
for (int j=0; j<ITEM_ATTRIBUTE_SLOT_MAX_NUM; ++j)
|
||||
kItemData.aAttr[j]=packet_item_set.aAttr[j];
|
||||
|
||||
IAbstractPlayer& rkPlayer=IAbstractPlayer::GetSingleton();
|
||||
rkPlayer.SetItemData(packet_item_set.Cell, kItemData);
|
||||
|
||||
if (packet_item_set.highlight)
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_Highlight_Item", Py_BuildValue("(ii)", packet_item_set.Cell.window_type, packet_item_set.Cell.cell));
|
||||
|
||||
__RefreshInventoryWindow();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CPythonNetworkStream::RecvItemUsePacket()
|
||||
{
|
||||
TPacketGCItemUse packet_item_use;
|
||||
|
||||
if (!Recv(sizeof(TPacketGCItemUse), &packet_item_use))
|
||||
return false;
|
||||
|
||||
__RefreshInventoryWindow();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvItemUpdatePacket()
|
||||
{
|
||||
TPacketGCItemUpdate packet_item_update;
|
||||
|
||||
if (!Recv(sizeof(TPacketGCItemUpdate), &packet_item_update))
|
||||
return false;
|
||||
|
||||
IAbstractPlayer& rkPlayer=IAbstractPlayer::GetSingleton();
|
||||
rkPlayer.SetItemCount(packet_item_update.Cell, packet_item_update.count);
|
||||
for (int i = 0; i < ITEM_SOCKET_SLOT_MAX_NUM; ++i)
|
||||
rkPlayer.SetItemMetinSocket(packet_item_update.Cell, i, packet_item_update.alSockets[i]);
|
||||
for (int j = 0; j < ITEM_ATTRIBUTE_SLOT_MAX_NUM; ++j)
|
||||
rkPlayer.SetItemAttribute(packet_item_update.Cell, j, packet_item_update.aAttr[j].bType, packet_item_update.aAttr[j].sValue);
|
||||
|
||||
__RefreshInventoryWindow();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvItemGroundAddPacket()
|
||||
{
|
||||
TPacketGCItemGroundAdd packet_item_ground_add;
|
||||
|
||||
if (!Recv(sizeof(TPacketGCItemGroundAdd), &packet_item_ground_add))
|
||||
return false;
|
||||
|
||||
__GlobalPositionToLocalPosition(packet_item_ground_add.lX, packet_item_ground_add.lY);
|
||||
|
||||
CPythonItem::Instance().CreateItem(packet_item_ground_add.dwVID,
|
||||
packet_item_ground_add.dwVnum,
|
||||
packet_item_ground_add.lX,
|
||||
packet_item_ground_add.lY,
|
||||
packet_item_ground_add.lZ);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CPythonNetworkStream::RecvItemOwnership()
|
||||
{
|
||||
TPacketGCItemOwnership p;
|
||||
|
||||
if (!Recv(sizeof(TPacketGCItemOwnership), &p))
|
||||
return false;
|
||||
|
||||
CPythonItem::Instance().SetOwnership(p.dwVID, p.szName);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvItemGroundDelPacket()
|
||||
{
|
||||
TPacketGCItemGroundDel packet_item_ground_del;
|
||||
|
||||
if (!Recv(sizeof(TPacketGCItemGroundDel), &packet_item_ground_del))
|
||||
return false;
|
||||
|
||||
CPythonItem::Instance().DeleteItem(packet_item_ground_del.vid);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvQuickSlotAddPacket()
|
||||
{
|
||||
TPacketGCQuickSlotAdd packet_quick_slot_add;
|
||||
|
||||
if (!Recv(sizeof(TPacketGCQuickSlotAdd), &packet_quick_slot_add))
|
||||
return false;
|
||||
|
||||
IAbstractPlayer& rkPlayer=IAbstractPlayer::GetSingleton();
|
||||
rkPlayer.AddQuickSlot(packet_quick_slot_add.pos, packet_quick_slot_add.slot.Type, packet_quick_slot_add.slot.Position);
|
||||
|
||||
__RefreshInventoryWindow();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvQuickSlotDelPacket()
|
||||
{
|
||||
TPacketGCQuickSlotDel packet_quick_slot_del;
|
||||
|
||||
if (!Recv(sizeof(TPacketGCQuickSlotDel), &packet_quick_slot_del))
|
||||
return false;
|
||||
|
||||
IAbstractPlayer& rkPlayer=IAbstractPlayer::GetSingleton();
|
||||
rkPlayer.DeleteQuickSlot(packet_quick_slot_del.pos);
|
||||
|
||||
__RefreshInventoryWindow();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvQuickSlotMovePacket()
|
||||
{
|
||||
TPacketGCQuickSlotSwap packet_quick_slot_swap;
|
||||
|
||||
if (!Recv(sizeof(TPacketGCQuickSlotSwap), &packet_quick_slot_swap))
|
||||
return false;
|
||||
|
||||
IAbstractPlayer& rkPlayer=IAbstractPlayer::GetSingleton();
|
||||
rkPlayer.MoveQuickSlot(packet_quick_slot_swap.pos, packet_quick_slot_swap.change_pos);
|
||||
|
||||
__RefreshInventoryWindow();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool CPythonNetworkStream::SendShopEndPacket()
|
||||
{
|
||||
if (!__CanActMainInstance())
|
||||
return true;
|
||||
|
||||
TPacketCGShop packet_shop;
|
||||
packet_shop.header = HEADER_CG_SHOP;
|
||||
packet_shop.subheader = SHOP_SUBHEADER_CG_END;
|
||||
|
||||
if (!Send(sizeof(packet_shop), &packet_shop))
|
||||
{
|
||||
Tracef("SendShopEndPacket Error\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendShopBuyPacket(BYTE bPos)
|
||||
{
|
||||
if (!__CanActMainInstance())
|
||||
return true;
|
||||
|
||||
TPacketCGShop PacketShop;
|
||||
PacketShop.header = HEADER_CG_SHOP;
|
||||
PacketShop.subheader = SHOP_SUBHEADER_CG_BUY;
|
||||
|
||||
if (!Send(sizeof(TPacketCGShop), &PacketShop))
|
||||
{
|
||||
Tracef("SendShopBuyPacket Error\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
BYTE bCount=1;
|
||||
if (!Send(sizeof(BYTE), &bCount))
|
||||
{
|
||||
Tracef("SendShopBuyPacket Error\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Send(sizeof(BYTE), &bPos))
|
||||
{
|
||||
Tracef("SendShopBuyPacket Error\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendShopSellPacket(BYTE bySlot)
|
||||
{
|
||||
if (!__CanActMainInstance())
|
||||
return true;
|
||||
|
||||
TPacketCGShop PacketShop;
|
||||
PacketShop.header = HEADER_CG_SHOP;
|
||||
PacketShop.subheader = SHOP_SUBHEADER_CG_SELL;
|
||||
|
||||
if (!Send(sizeof(TPacketCGShop), &PacketShop))
|
||||
{
|
||||
Tracef("SendShopSellPacket Error\n");
|
||||
return false;
|
||||
}
|
||||
if (!Send(sizeof(BYTE), &bySlot))
|
||||
{
|
||||
Tracef("SendShopAddSellPacket Error\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendShopSellPacketNew(BYTE bySlot, BYTE byCount)
|
||||
{
|
||||
if (!__CanActMainInstance())
|
||||
return true;
|
||||
|
||||
TPacketCGShop PacketShop;
|
||||
PacketShop.header = HEADER_CG_SHOP;
|
||||
PacketShop.subheader = SHOP_SUBHEADER_CG_SELL2;
|
||||
|
||||
if (!Send(sizeof(TPacketCGShop), &PacketShop))
|
||||
{
|
||||
Tracef("SendShopSellPacket Error\n");
|
||||
return false;
|
||||
}
|
||||
if (!Send(sizeof(BYTE), &bySlot))
|
||||
{
|
||||
Tracef("SendShopAddSellPacket Error\n");
|
||||
return false;
|
||||
}
|
||||
if (!Send(sizeof(BYTE), &byCount))
|
||||
{
|
||||
Tracef("SendShopAddSellPacket Error\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
Tracef(" SendShopSellPacketNew(bySlot=%d, byCount=%d)\n", bySlot, byCount);
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
// Send
|
||||
bool CPythonNetworkStream::SendItemUsePacket(TItemPos pos)
|
||||
{
|
||||
if (!__CanActMainInstance())
|
||||
return true;
|
||||
|
||||
if (__IsEquipItemInSlot(pos))
|
||||
{
|
||||
if (CPythonExchange::Instance().isTrading())
|
||||
{
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_AppendNotifyMessage", Py_BuildValue("(s)", "CANNOT_EQUIP_EXCHANGE"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (CPythonShop::Instance().IsOpen())
|
||||
{
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_AppendNotifyMessage", Py_BuildValue("(s)", "CANNOT_EQUIP_SHOP"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (__IsPlayerAttacking())
|
||||
return true;
|
||||
}
|
||||
|
||||
__PlayInventoryItemUseSound(pos);
|
||||
|
||||
TPacketCGItemUse itemUsePacket;
|
||||
itemUsePacket.header = HEADER_CG_ITEM_USE;
|
||||
itemUsePacket.pos = pos;
|
||||
|
||||
if (!Send(sizeof(TPacketCGItemUse), &itemUsePacket))
|
||||
{
|
||||
Tracen("SendItemUsePacket Error");
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendItemUseToItemPacket(TItemPos source_pos, TItemPos target_pos)
|
||||
{
|
||||
if (!__CanActMainInstance())
|
||||
return true;
|
||||
|
||||
TPacketCGItemUseToItem itemUseToItemPacket;
|
||||
itemUseToItemPacket.header = HEADER_CG_ITEM_USE_TO_ITEM;
|
||||
itemUseToItemPacket.source_pos = source_pos;
|
||||
itemUseToItemPacket.target_pos = target_pos;
|
||||
|
||||
if (!Send(sizeof(TPacketCGItemUseToItem), &itemUseToItemPacket))
|
||||
{
|
||||
Tracen("SendItemUseToItemPacket Error");
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
Tracef(" << SendItemUseToItemPacket(src=%d, dst=%d)\n", source_pos, target_pos);
|
||||
#endif
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendItemDropPacket(TItemPos pos, DWORD elk)
|
||||
{
|
||||
if (!__CanActMainInstance())
|
||||
return true;
|
||||
|
||||
TPacketCGItemDrop itemDropPacket;
|
||||
itemDropPacket.header = HEADER_CG_ITEM_DROP;
|
||||
itemDropPacket.pos = pos;
|
||||
itemDropPacket.elk = elk;
|
||||
|
||||
if (!Send(sizeof(TPacketCGItemDrop), &itemDropPacket))
|
||||
{
|
||||
Tracen("SendItemDropPacket Error");
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendItemDropPacketNew(TItemPos pos, DWORD elk, DWORD count)
|
||||
{
|
||||
if (!__CanActMainInstance())
|
||||
return true;
|
||||
|
||||
TPacketCGItemDrop2 itemDropPacket;
|
||||
itemDropPacket.header = HEADER_CG_ITEM_DROP2;
|
||||
itemDropPacket.pos = pos;
|
||||
itemDropPacket.gold = elk;
|
||||
itemDropPacket.count = count;
|
||||
|
||||
if (!Send(sizeof(itemDropPacket), &itemDropPacket))
|
||||
{
|
||||
Tracen("SendItemDropPacket Error");
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::__IsEquipItemInSlot(TItemPos uSlotPos)
|
||||
{
|
||||
IAbstractPlayer& rkPlayer=IAbstractPlayer::GetSingleton();
|
||||
return rkPlayer.IsEquipItemInSlot(uSlotPos);
|
||||
}
|
||||
|
||||
void CPythonNetworkStream::__PlayInventoryItemUseSound(TItemPos uSlotPos)
|
||||
{
|
||||
IAbstractPlayer& rkPlayer=IAbstractPlayer::GetSingleton();
|
||||
DWORD dwItemID=rkPlayer.GetItemIndex(uSlotPos);
|
||||
|
||||
CPythonItem& rkItem=CPythonItem::Instance();
|
||||
rkItem.PlayUseSound(dwItemID);
|
||||
}
|
||||
|
||||
void CPythonNetworkStream::__PlayInventoryItemDropSound(TItemPos uSlotPos)
|
||||
{
|
||||
IAbstractPlayer& rkPlayer=IAbstractPlayer::GetSingleton();
|
||||
DWORD dwItemID=rkPlayer.GetItemIndex(uSlotPos);
|
||||
|
||||
CPythonItem& rkItem=CPythonItem::Instance();
|
||||
rkItem.PlayDropSound(dwItemID);
|
||||
}
|
||||
|
||||
//void CPythonNetworkStream::__PlayShopItemDropSound(UINT uSlotPos)
|
||||
//{
|
||||
// DWORD dwItemID;
|
||||
// CPythonShop& rkShop=CPythonShop::Instance();
|
||||
// if (!rkShop.GetSlotItemID(uSlotPos, &dwItemID))
|
||||
// return;
|
||||
//
|
||||
// CPythonItem& rkItem=CPythonItem::Instance();
|
||||
// rkItem.PlayDropSound(dwItemID);
|
||||
//}
|
||||
|
||||
void CPythonNetworkStream::__PlaySafeBoxItemDropSound(UINT uSlotPos)
|
||||
{
|
||||
DWORD dwItemID;
|
||||
CPythonSafeBox& rkSafeBox=CPythonSafeBox::Instance();
|
||||
if (!rkSafeBox.GetSlotItemID(uSlotPos, &dwItemID))
|
||||
return;
|
||||
|
||||
CPythonItem& rkItem=CPythonItem::Instance();
|
||||
rkItem.PlayDropSound(dwItemID);
|
||||
}
|
||||
|
||||
void CPythonNetworkStream::__PlayMallItemDropSound(UINT uSlotPos)
|
||||
{
|
||||
DWORD dwItemID;
|
||||
CPythonSafeBox& rkSafeBox=CPythonSafeBox::Instance();
|
||||
if (!rkSafeBox.GetSlotMallItemID(uSlotPos, &dwItemID))
|
||||
return;
|
||||
|
||||
CPythonItem& rkItem=CPythonItem::Instance();
|
||||
rkItem.PlayDropSound(dwItemID);
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendItemMovePacket(TItemPos pos, TItemPos change_pos, BYTE num)
|
||||
{
|
||||
if (!__CanActMainInstance())
|
||||
return true;
|
||||
|
||||
if (__IsEquipItemInSlot(pos))
|
||||
{
|
||||
if (CPythonExchange::Instance().isTrading())
|
||||
{
|
||||
if (pos.IsEquipCell() || change_pos.IsEquipCell())
|
||||
{
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_AppendNotifyMessage", Py_BuildValue("(s)", "CANNOT_EQUIP_EXCHANGE"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (CPythonShop::Instance().IsOpen())
|
||||
{
|
||||
if (pos.IsEquipCell() || change_pos.IsEquipCell())
|
||||
{
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_AppendNotifyMessage", Py_BuildValue("(s)", "CANNOT_EQUIP_SHOP"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (__IsPlayerAttacking())
|
||||
return true;
|
||||
}
|
||||
|
||||
__PlayInventoryItemDropSound(pos);
|
||||
|
||||
TPacketCGItemMove itemMovePacket;
|
||||
itemMovePacket.header = HEADER_CG_ITEM_MOVE;
|
||||
itemMovePacket.pos = pos;
|
||||
itemMovePacket.change_pos = change_pos;
|
||||
itemMovePacket.num = num;
|
||||
|
||||
if (!Send(sizeof(TPacketCGItemMove), &itemMovePacket))
|
||||
{
|
||||
Tracen("SendItemMovePacket Error");
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendItemPickUpPacket(DWORD vid)
|
||||
{
|
||||
if (!__CanActMainInstance())
|
||||
return true;
|
||||
|
||||
TPacketCGItemPickUp itemPickUpPacket;
|
||||
itemPickUpPacket.header = HEADER_CG_ITEM_PICKUP;
|
||||
itemPickUpPacket.vid = vid;
|
||||
|
||||
if (!Send(sizeof(TPacketCGItemPickUp), &itemPickUpPacket))
|
||||
{
|
||||
Tracen("SendItemPickUpPacket Error");
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
|
||||
bool CPythonNetworkStream::SendQuickSlotAddPacket(BYTE wpos, BYTE type, BYTE pos)
|
||||
{
|
||||
if (!__CanActMainInstance())
|
||||
return true;
|
||||
|
||||
TPacketCGQuickSlotAdd quickSlotAddPacket;
|
||||
|
||||
quickSlotAddPacket.header = HEADER_CG_QUICKSLOT_ADD;
|
||||
quickSlotAddPacket.pos = wpos;
|
||||
quickSlotAddPacket.slot.Type = type;
|
||||
quickSlotAddPacket.slot.Position = pos;
|
||||
|
||||
if (!Send(sizeof(TPacketCGQuickSlotAdd), &quickSlotAddPacket))
|
||||
{
|
||||
Tracen("SendQuickSlotAddPacket Error");
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendQuickSlotDelPacket(BYTE pos)
|
||||
{
|
||||
if (!__CanActMainInstance())
|
||||
return true;
|
||||
|
||||
TPacketCGQuickSlotDel quickSlotDelPacket;
|
||||
|
||||
quickSlotDelPacket.header = HEADER_CG_QUICKSLOT_DEL;
|
||||
quickSlotDelPacket.pos = pos;
|
||||
|
||||
if (!Send(sizeof(TPacketCGQuickSlotDel), &quickSlotDelPacket))
|
||||
{
|
||||
Tracen("SendQuickSlotDelPacket Error");
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::SendQuickSlotMovePacket(BYTE pos, BYTE change_pos)
|
||||
{
|
||||
if (!__CanActMainInstance())
|
||||
return true;
|
||||
|
||||
TPacketCGQuickSlotSwap quickSlotSwapPacket;
|
||||
|
||||
quickSlotSwapPacket.header = HEADER_CG_QUICKSLOT_SWAP;
|
||||
quickSlotSwapPacket.pos = pos;
|
||||
quickSlotSwapPacket.change_pos = change_pos;
|
||||
|
||||
if (!Send(sizeof(TPacketCGQuickSlotSwap), &quickSlotSwapPacket))
|
||||
{
|
||||
Tracen("SendQuickSlotSwapPacket Error");
|
||||
return false;
|
||||
}
|
||||
|
||||
return SendSequence();
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvSpecialEffect()
|
||||
{
|
||||
TPacketGCSpecialEffect kSpecialEffect;
|
||||
if (!Recv(sizeof(kSpecialEffect), &kSpecialEffect))
|
||||
return false;
|
||||
|
||||
DWORD effect = -1;
|
||||
bool bPlayPotionSound = false; //포션을 먹을 경우는 포션 사운드를 출력하자.!!
|
||||
bool bAttachEffect = true; //캐리터에 붙는 어태치 이펙트와 일반 이펙트 구분.!!
|
||||
switch (kSpecialEffect.type)
|
||||
{
|
||||
case SE_HPUP_RED:
|
||||
effect = CInstanceBase::EFFECT_HPUP_RED;
|
||||
bPlayPotionSound = true;
|
||||
break;
|
||||
case SE_SPUP_BLUE:
|
||||
effect = CInstanceBase::EFFECT_SPUP_BLUE;
|
||||
bPlayPotionSound = true;
|
||||
break;
|
||||
case SE_SPEEDUP_GREEN:
|
||||
effect = CInstanceBase::EFFECT_SPEEDUP_GREEN;
|
||||
bPlayPotionSound = true;
|
||||
break;
|
||||
case SE_DXUP_PURPLE:
|
||||
effect = CInstanceBase::EFFECT_DXUP_PURPLE;
|
||||
bPlayPotionSound = true;
|
||||
break;
|
||||
case SE_CRITICAL:
|
||||
effect = CInstanceBase::EFFECT_CRITICAL;
|
||||
break;
|
||||
case SE_PENETRATE:
|
||||
effect = CInstanceBase::EFFECT_PENETRATE;
|
||||
break;
|
||||
case SE_BLOCK:
|
||||
effect = CInstanceBase::EFFECT_BLOCK;
|
||||
break;
|
||||
case SE_DODGE:
|
||||
effect = CInstanceBase::EFFECT_DODGE;
|
||||
break;
|
||||
case SE_CHINA_FIREWORK:
|
||||
effect = CInstanceBase::EFFECT_FIRECRACKER;
|
||||
bAttachEffect = false;
|
||||
break;
|
||||
case SE_SPIN_TOP:
|
||||
effect = CInstanceBase::EFFECT_SPIN_TOP;
|
||||
bAttachEffect = false;
|
||||
break;
|
||||
case SE_SUCCESS :
|
||||
effect = CInstanceBase::EFFECT_SUCCESS ;
|
||||
bAttachEffect = false ;
|
||||
break ;
|
||||
case SE_FAIL :
|
||||
effect = CInstanceBase::EFFECT_FAIL ;
|
||||
break ;
|
||||
case SE_FR_SUCCESS:
|
||||
effect = CInstanceBase::EFFECT_FR_SUCCESS;
|
||||
bAttachEffect = false ;
|
||||
break;
|
||||
case SE_LEVELUP_ON_14_FOR_GERMANY: //레벨업 14일때 ( 독일전용 )
|
||||
effect = CInstanceBase::EFFECT_LEVELUP_ON_14_FOR_GERMANY;
|
||||
bAttachEffect = false ;
|
||||
break;
|
||||
case SE_LEVELUP_UNDER_15_FOR_GERMANY: //레벨업 15일때 ( 독일전용 )
|
||||
effect = CInstanceBase::EFFECT_LEVELUP_UNDER_15_FOR_GERMANY;
|
||||
bAttachEffect = false ;
|
||||
break;
|
||||
case SE_PERCENT_DAMAGE1:
|
||||
effect = CInstanceBase::EFFECT_PERCENT_DAMAGE1;
|
||||
break;
|
||||
case SE_PERCENT_DAMAGE2:
|
||||
effect = CInstanceBase::EFFECT_PERCENT_DAMAGE2;
|
||||
break;
|
||||
case SE_PERCENT_DAMAGE3:
|
||||
effect = CInstanceBase::EFFECT_PERCENT_DAMAGE3;
|
||||
break;
|
||||
case SE_AUTO_HPUP:
|
||||
effect = CInstanceBase::EFFECT_AUTO_HPUP;
|
||||
break;
|
||||
case SE_AUTO_SPUP:
|
||||
effect = CInstanceBase::EFFECT_AUTO_SPUP;
|
||||
break;
|
||||
case SE_EQUIP_RAMADAN_RING:
|
||||
effect = CInstanceBase::EFFECT_RAMADAN_RING_EQUIP;
|
||||
break;
|
||||
case SE_EQUIP_HALLOWEEN_CANDY:
|
||||
effect = CInstanceBase::EFFECT_HALLOWEEN_CANDY_EQUIP;
|
||||
break;
|
||||
case SE_EQUIP_HAPPINESS_RING:
|
||||
effect = CInstanceBase::EFFECT_HAPPINESS_RING_EQUIP;
|
||||
break;
|
||||
case SE_EQUIP_LOVE_PENDANT:
|
||||
effect = CInstanceBase::EFFECT_LOVE_PENDANT_EQUIP;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
TraceError("%d \264\302 \276\370\264\302 \275\272\306\344\274\310 \300\314\306\345\306\256 \271\370\310\243\300\324\264\317\264\331.TPacketGCSpecialEffect",kSpecialEffect.type);
|
||||
break;
|
||||
}
|
||||
|
||||
if (bPlayPotionSound)
|
||||
{
|
||||
IAbstractPlayer& rkPlayer=IAbstractPlayer::GetSingleton();
|
||||
if(rkPlayer.IsMainCharacterIndex(kSpecialEffect.vid))
|
||||
{
|
||||
CPythonItem& rkItem=CPythonItem::Instance();
|
||||
rkItem.PlayUsePotionSound();
|
||||
}
|
||||
}
|
||||
|
||||
if (-1 != effect)
|
||||
{
|
||||
CInstanceBase * pInstance = CPythonCharacterManager::Instance().GetInstancePtr(kSpecialEffect.vid);
|
||||
if (pInstance)
|
||||
{
|
||||
if(bAttachEffect)
|
||||
pInstance->AttachSpecialEffect(effect);
|
||||
else
|
||||
pInstance->CreateSpecialEffect(effect);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CPythonNetworkStream::RecvSpecificEffect()
|
||||
{
|
||||
TPacketGCSpecificEffect kSpecificEffect;
|
||||
if (!Recv(sizeof(kSpecificEffect), &kSpecificEffect))
|
||||
return false;
|
||||
|
||||
CInstanceBase * pInstance = CPythonCharacterManager::Instance().GetInstancePtr(kSpecificEffect.vid);
|
||||
//EFFECT_TEMP
|
||||
if (pInstance)
|
||||
{
|
||||
CInstanceBase::RegisterEffect(CInstanceBase::EFFECT_TEMP, "", kSpecificEffect.effect_file, false);
|
||||
pInstance->AttachSpecialEffect(CInstanceBase::EFFECT_TEMP);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CPythonNetworkStream::RecvDragonSoulRefine()
|
||||
{
|
||||
TPacketGCDragonSoulRefine kDragonSoul;
|
||||
|
||||
if (!Recv(sizeof(kDragonSoul), &kDragonSoul))
|
||||
return false;
|
||||
|
||||
|
||||
switch (kDragonSoul.bSubType)
|
||||
{
|
||||
case DS_SUB_HEADER_OPEN:
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_DragonSoulRefineWindow_Open", Py_BuildValue("()"));
|
||||
break;
|
||||
case DS_SUB_HEADER_REFINE_FAIL:
|
||||
case DS_SUB_HEADER_REFINE_FAIL_MAX_REFINE:
|
||||
case DS_SUB_HEADER_REFINE_FAIL_INVALID_MATERIAL:
|
||||
case DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MONEY:
|
||||
case DS_SUB_HEADER_REFINE_FAIL_NOT_ENOUGH_MATERIAL:
|
||||
case DS_SUB_HEADER_REFINE_FAIL_TOO_MUCH_MATERIAL:
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_DragonSoulRefineWindow_RefineFail", Py_BuildValue("(iii)",
|
||||
kDragonSoul.bSubType, kDragonSoul.Pos.window_type, kDragonSoul.Pos.cell));
|
||||
break;
|
||||
case DS_SUB_HEADER_REFINE_SUCCEED:
|
||||
PyCallClassMemberFunc(m_apoPhaseWnd[PHASE_WINDOW_GAME], "BINARY_DragonSoulRefineWindow_RefineSucceed",
|
||||
Py_BuildValue("(ii)", kDragonSoul.Pos.window_type, kDragonSoul.Pos.cell));
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -44,4 +44,5 @@ enum
|
||||
// Listed here as 40250 lists them; only the ported ones are defined.
|
||||
void initpack();
|
||||
void initapp();
|
||||
void initChat();
|
||||
void initnet();
|
||||
|
||||
@@ -302,6 +302,16 @@ typedef enum _D3DTEXTURESTAGESTATETYPE
|
||||
D3DTSS_FORCE_DWORD = 0x7fffffff,
|
||||
} D3DTEXTURESTAGESTATETYPE;
|
||||
|
||||
// D3D8 texture-stage arguments and operations used by the character renderer.
|
||||
enum : DWORD {
|
||||
D3DTA_DIFFUSE = 0,
|
||||
D3DTA_CURRENT = 1,
|
||||
D3DTA_TEXTURE = 2,
|
||||
D3DTOP_DISABLE = 1,
|
||||
D3DTOP_SELECTARG1 = 2,
|
||||
D3DTOP_MODULATE = 4,
|
||||
};
|
||||
|
||||
#define D3DTS_WORLDMATRIX(index) (D3DTRANSFORMSTATETYPE)(index + 256)
|
||||
#define D3DTS_WORLD D3DTS_WORLDMATRIX(0)
|
||||
#define D3DTS_WORLD1 D3DTS_WORLDMATRIX(1)
|
||||
|
||||
@@ -38,6 +38,7 @@ inline int _strnicmp(const char* a, const char* b, size_t n) { return strncasecm
|
||||
inline int strnicmp(const char* a, const char* b, size_t n) { return strncasecmp(a, b, n); }
|
||||
|
||||
inline int _strcmpi(const char* a, const char* b) { return strcasecmp(a, b); }
|
||||
inline int strcmpi(const char* a, const char* b) { return strcasecmp(a, b); }
|
||||
|
||||
char* _strlwr(char* s);
|
||||
char* _strupr(char* s);
|
||||
|
||||
@@ -440,6 +440,72 @@ bool FakeLoginServer::ServeGame(Connection& c, int index)
|
||||
return Fail(name + ": CG_ENTERGAME: " + error);
|
||||
Event(name + ":entergame");
|
||||
|
||||
// CInputLogin::Entergame order: ch->Show inserts the main actor while the client is still in
|
||||
// the loading phase (CHARACTER::EncodeInsertPacket = ADD + ADDITIONAL_INFO, then UpdatePacket),
|
||||
// then SendNPCPosition, PHASE_GAME, SendLandList, TIME, CHANNEL and the greet notice.
|
||||
GCCharacterAdd actor = zeroed<GCCharacterAdd>();
|
||||
actor.header = HDR_GC_CHARACTER_ADD;
|
||||
actor.vid = kMainVID;
|
||||
actor.x = kX;
|
||||
actor.y = kY;
|
||||
actor.type = 0; // CHAR_TYPE_PC
|
||||
actor.race = 0; // warrior male
|
||||
actor.moving_speed = 100;
|
||||
actor.attack_speed = 100;
|
||||
GCCharAddInfo info = zeroed<GCCharAddInfo>();
|
||||
info.header = HDR_GC_CHAR_ADDITIONAL_INFO;
|
||||
info.vid = kMainVID;
|
||||
std::strncpy(info.name, kCharacterName, sizeof(info.name) - 1);
|
||||
info.empire = 1;
|
||||
info.level = 10;
|
||||
GCCharacterUpdate update = zeroed<GCCharacterUpdate>();
|
||||
update.header = HDR_GC_CHARACTER_UPDATE;
|
||||
update.vid = kMainVID;
|
||||
update.moving_speed = 100;
|
||||
update.attack_speed = 100;
|
||||
if (!c.Send(actor) || !c.Send(info) || !c.Send(update))
|
||||
return Fail(name + ": send main actor");
|
||||
|
||||
// packet_npc_position = DynHead + count, then TNPCPosition entries.
|
||||
NPCPosition34 npc = zeroed<NPCPosition34>();
|
||||
npc.type = 1; // CHAR_TYPE_NPC
|
||||
std::strncpy(npc.name, "Npc", sizeof(npc.name) - 1);
|
||||
npc.x = kX + 500;
|
||||
npc.y = kY + 500;
|
||||
DynHead npc_head = {HDR_GC_NPC_POSITION, static_cast<std::uint16_t>(sizeof(DynHead) + sizeof(GCNPCPositionHead) + sizeof(npc))};
|
||||
GCNPCPositionHead npc_count = {1};
|
||||
if (!c.Send(npc_head) || !c.Send(npc_count) || !c.Send(npc))
|
||||
return Fail(name + ": send NPC positions");
|
||||
|
||||
if (!c.Phase(PHASE_GAME))
|
||||
return Fail(name + ": send PHASE_GAME");
|
||||
|
||||
LandPacketElement24 land = zeroed<LandPacketElement24>();
|
||||
land.id = 1;
|
||||
land.x = kX + 1000;
|
||||
land.y = kY + 1000;
|
||||
land.width = 2000;
|
||||
land.height = 2000;
|
||||
DynHead land_head = {HDR_GC_LAND_LIST, static_cast<std::uint16_t>(sizeof(DynHead) + sizeof(land))};
|
||||
GCTime game_time = {HDR_GC_TIME, static_cast<std::int32_t>(now_ms())};
|
||||
GCChannel channel = {HDR_GC_CHANNEL, 1};
|
||||
if (!c.Send(land_head) || !c.Send(land) || !c.Send(game_time) || !c.Send(channel))
|
||||
return Fail(name + ": send land/time/channel");
|
||||
|
||||
// SendGreetMessage: a CHAT_TYPE_NOTICE line with no speaker.
|
||||
const char greet[] = "Welcome";
|
||||
GCChatHead chat = {HDR_GC_CHAT, static_cast<std::uint16_t>(sizeof(GCChatHead) + sizeof(greet)), 2 /* CHAT_TYPE_NOTICE */, 0, 1};
|
||||
if (!c.Send(chat) || !c.Send(greet, sizeof(greet)))
|
||||
return Fail(name + ": send greet notice");
|
||||
Event(name + ":burst_sent");
|
||||
|
||||
// A ping after the burst proves that GamePhase consumed every packet above and can reply.
|
||||
Blank ping = {HDR_GC_PING};
|
||||
Blank pong = {};
|
||||
if (!c.Send(ping) || read_packet(c, HDR_CG_PONG, &pong, sizeof(pong), &error) != 1)
|
||||
return Fail(name + ": CG_PONG after the entergame burst: " + error);
|
||||
Event(name + ":burst_pong");
|
||||
|
||||
// Hold the connection until the test stops us.
|
||||
std::uint8_t byte = 0;
|
||||
while (!m_stop && c.Read(&byte, 1) == 1)
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
// 5. PHASE_LOADING, GC_MAIN_CHARACTER, GC_CHARACTER_POINTS: the loading phase answers the main
|
||||
// character with CG_CLIENT_VERSION(2), the server's proof the client reached Loading;
|
||||
// 6. (批次 2V2) the loading steps end in net.StartGame(): networkModule.SetGamePhase opens
|
||||
// game.GameWindow, whose Open sends CG_ENTERGAME.
|
||||
// game.GameWindow, whose Open sends CG_ENTERGAME;
|
||||
// 7. the server's Entergame answer (the actor's insert packets, PHASE_GAME, the Entergame burst) is
|
||||
// read by the ported GamePhase without an unknown packet, and a final ping gets its pong.
|
||||
//
|
||||
// The server checks every sequence byte against the 40250 table, so a skipped or extra sequenced
|
||||
// packet fails the run.
|
||||
@@ -25,7 +27,8 @@
|
||||
// With `live` (批次 2V1-e, ctest port.login_live) the same path runs against a real 40250 server and
|
||||
// the client's own state is the proof: the character list arrived, the loading window got
|
||||
// LoadData from GC_MAIN_CHARACTER, which CPythonNetworkStream::RecvMainCharacter answers with
|
||||
// CG_CLIENT_VERSION, and game.GameWindow is open, which sent CG_ENTERGAME. Everything about the
|
||||
// CG_CLIENT_VERSION, game.GameWindow is open, which sent CG_ENTERGAME, and 10 s of the real game
|
||||
// phase later it is still open and connected with no unknown packet. Everything about the
|
||||
// server comes from the environment and nothing of it is printed:
|
||||
//
|
||||
// MT_LIVE_HOST, MT_LIVE_LOGIN, MT_LIVE_PASSWORD required; without them the test is skipped
|
||||
@@ -36,6 +39,7 @@
|
||||
#include "../src/platform/ScriptLib/PythonBoot.h"
|
||||
#include "../src/platform/ScriptLib/PythonHost.h"
|
||||
#include "../src/platform/UserInterface/UserInterface.h"
|
||||
#include "../src/platform/EterBase/TraceErrorObserver.h"
|
||||
#include "port_login_flow_server.h"
|
||||
|
||||
#include <memory>
|
||||
@@ -44,6 +48,7 @@
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <functional>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include <vector>
|
||||
@@ -59,6 +64,25 @@ static int g_failures = 0;
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
// TraceError lines; the script thread writes them while the host thread waits for its baton.
|
||||
static std::mutex g_syserr_mutex;
|
||||
static std::vector<std::string> g_syserr;
|
||||
|
||||
static void on_trace_error(const char* line)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(g_syserr_mutex);
|
||||
g_syserr.emplace_back(line);
|
||||
}
|
||||
|
||||
static int count_syserr(const char* needle)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(g_syserr_mutex);
|
||||
int n = 0;
|
||||
for (const auto& line : g_syserr)
|
||||
n += line.find(needle) != std::string::npos;
|
||||
return n;
|
||||
}
|
||||
|
||||
static bool py(const std::string& source)
|
||||
{
|
||||
std::string error;
|
||||
@@ -162,6 +186,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
auto failed = [&] { return server && server->Failed(); };
|
||||
|
||||
SetTraceErrorObserver(on_trace_error);
|
||||
PackSingletons();
|
||||
CHECK(PackInitialize("pack"));
|
||||
|
||||
@@ -239,12 +264,29 @@ int main(int argc, char** argv)
|
||||
return failed() || (py_true(gaming) && (!server || server->Has("game2:entergame")));
|
||||
});
|
||||
CHECK(entered && !failed());
|
||||
|
||||
// 7. (批次 2V2-b) The server answers CG_ENTERGAME with the character's own insert packets and
|
||||
// PHASE_GAME, then the Entergame burst (PVP/land list, time, channel, greet chat, ...). GamePhase
|
||||
// has to read all of it: an unknown or mis-sized packet makes CheckPacket log "Unknown packet
|
||||
// header" and drop the receive buffer. Offline the fake server ends with a ping the client
|
||||
// must answer; live the stream has to stay in the game window and connected for 10 s.
|
||||
const bool burst = pump_until(live ? 10 : 30, [&] {
|
||||
return failed() || (server && server->Has("game2:burst_pong"));
|
||||
});
|
||||
CHECK(live || (burst && !failed()));
|
||||
CHECK(py_true(gaming));
|
||||
CHECK(py("import net\nassert net.IsConnect(), 'disconnected in the game phase'"));
|
||||
CHECK(count_syserr("Unknown packet header") == 0);
|
||||
// The fake greet notice went through RecvChatPacket into the ported CPythonChat, where
|
||||
// uichat's chat set (created by the game interface) counts it.
|
||||
CHECK(live || py("import chat\nassert any(chat.GetLineCount(i) > 0 for i in range(4)), 'greet notice not in chat'"));
|
||||
}
|
||||
if (server)
|
||||
{
|
||||
const std::vector<std::string> expected = {
|
||||
"auth:handshake", "auth:login3", "game1:handshake", "game1:login2", "auth:closed",
|
||||
"game1:closed", "game2:handshake", "game2:login2", "game2:select", "game2:client_version", "game2:entergame",
|
||||
"game2:burst_sent", "game2:burst_pong",
|
||||
};
|
||||
auto events = server->Events();
|
||||
// auth:closed races game1's handshake; compare the order within each connection.
|
||||
|
||||
Reference in New Issue
Block a user