Opublikowano 10 Lipca10 Lip Cześć, walczył ktoś z tym ścierwem? Official Render Target z dopisanym kodem dla przedmiotów(coś na wzór PythonIllustratedManager)Model pojawia się na sekunde i zaraz znika(widać na wylot)PythonMyShopDecoManager robi to samoPythonItemPreviewManager.cpp/** Item Preview Manager for __BL_RENDER_TARGET__*/#include "StdAfx.h"#include "PythonApplication.h"#include "PythonItemPreviewManager.h"#include "PythonPlayer.h"#include "../eterLib/Camera.h"#include "../EterBase/Stl.h"#include "../GameLib/ItemManager.h"CPythonItemPreviewManager::CPythonItemPreviewManager(){Initialize();}CPythonItemPreviewManager::~CPythonItemPreviewManager(){Destroy();}bool CPythonItemPreviewManager::Initialize(DWORD dwWidth, DWORD dwHeight){if (dwWidth 0 || dwHeight 0) {dwWidth = 240;dwHeight = 306;}if (dwWidth < 240) dwWidth = 240;if (dwHeight < 306) dwHeight = 306;Initialize();return CreateBackground(dwWidth, dwHeight);}void CPythonItemPreviewManager::Initialize(){m_pModelInstance = nullptr;m_pBackgroundImage = nullptr;m_bShow = false;m_dwCurrentRace = 0;m_dwArmorVnum = 0;m_dwWeaponVnum = 0;m_dwAcceVnum = 0;m_dwHairVnum = 0;m_fRotation = 0.0f;m_iEnchantLevel = 0;m_fHeight = 0.0f;m_fZoomDistance = 0.0f;m_fUpDown = 0.0f;m_fZoomStep = 0.0f;m_fUpDownStep = 0.0f;}void CPythonItemPreviewManager::Destroy(){if (m_pModelInstance) {delete m_pModelInstance;m_pModelInstance = nullptr;}if (m_pBackgroundImage) {delete m_pBackgroundImage;m_pBackgroundImage = nullptr;}m_bShow = false;m_dwCurrentRace = 0;m_dwArmorVnum = 0;m_dwWeaponVnum = 0;m_dwAcceVnum = 0;m_dwHairVnum = 0;m_fRotation = 0.0f;m_iEnchantLevel = 0;m_fHeight = 0.0f;m_fZoomDistance = 0.0f;m_fZoomStep = 0.0f;m_fUpDown = 0.0f;m_fUpDownStep = 0.0f;}bool CPythonItemPreviewManager::CreateBackground(DWORD dwWidth, DWORD dwHeight){if (m_pBackgroundImage) {delete m_pBackgroundImage;m_pBackgroundImage = nullptr;}CResource* pResource = CResourceManager::Instance().GetResourcePointer("d:/ymir work/ui/game/monster_card/model_view_bg.sub");if (!pResource) {return false;}m_pBackgroundImage = new CGraphicImageInstance;m_pBackgroundImage->SetImagePointer(static_cast<CGraphicImage*>(pResource));float scaleX = static_cast<float>(dwWidth) / 240.0f;float scaleY = static_cast<float>(dwHeight) / 306.0f;m_pBackgroundImage->SetScale(scaleX, scaleY);return true;}void CPythonItemPreviewManager::RenderBackground() const{if (!m_bShow || !m_pBackgroundImage)return;RECT rectRender;if (!CRenderTargetManager::instance().GetRenderTargetRect(CRenderTargetManager::ERENDERTARGETINDEX::RENDER_TARGET_INDEX_ITEM_PREVIEW, &rectRender))return;if (!CRenderTargetManager::instance().ChangeRenderTarget(CRenderTargetManager::ERENDERTARGETINDEX::RENDER_TARGET_INDEX_ITEM_PREVIEW))return;CRenderTargetManager::instance().ClearRenderTarget();CPythonGraphic::Instance().SetInterfaceRenderState();m_pBackgroundImage->Render();CRenderTargetManager::instance().ResetRenderTarget();}bool CPythonItemPreviewManager::CreateModelInstance(DWORD dwRace){if (m_pModelInstance && m_dwCurrentRace == dwRace)return true;// Delete old instanceif (m_pModelInstance) {delete m_pModelInstance;m_pModelInstance = nullptr;}CInstanceBase::SCreateData kCreateData;memset(&kCreateData, 0, sizeof(kCreateData));kCreateData.m_bType = CActorInstance::TYPE_PC;kCreateData.m_dwRace = dwRace;CInstanceBase* pModel = new CInstanceBase();if (!pModel->Create(kCreateData)){delete pModel;return false;}m_pModelInstance = pModel;m_dwCurrentRace = dwRace;return true;}CInstanceBase* CPythonItemPreviewManager::GetModelInstance() const{return m_pModelInstance;}bool CPythonItemPreviewManager::SelectModel(DWORD dwVnum){DWORD dwRace = CPythonPlayer::Instance().GetRace();if (!CreateModelInstance(dwRace))return false;// FIXED: Clear effects and setup model properlym_pModelInstance->GetGraphicThingInstancePtr()->ClearAttachingEffect();m_pModelInstance->Refresh(CRaceMotionData::NAME_WAIT, true);m_pModelInstance->SetLoopMotion(CRaceMotionData::NAME_WAIT, 0.0f, 0.0f);m_pModelInstance->SetLODLimits(0, 100.0f);m_pModelInstance->SetAlwaysRender(true);m_pModelInstance->SetRotation(0.0f);m_pModelInstance->NEW_SetPixelPosition(TPixelPosition(0.0f, 0.0f, 0.0f));CActorInstance& rkActor = m_pModelInstance->GetGraphicThingInstanceRef();m_fHeight = rkActor.GetHeight();m_fZoomDistance = 0.0f;m_fUpDown = 0.0f;m_fZoomStep = m_fHeight * 8.9f / 140.0f;m_fUpDownStep = m_fHeight / 35.0f;CCameraManager::instance().SetCurrentCamera(CCameraManager::DEFAULT_ITEM_PREVIEW_CAMERA);CCamera* pCam = CCameraManager::instance().GetCurrentCamera();if (!pCam) {CCameraManager::instance().SetCurrentCamera(CCameraManager::DEFAULT_ILLUSTRATED_CAMERA);pCam = CCameraManager::instance().GetCurrentCamera();}if (pCam) {pCam->SetTargetHeight(m_fHeight / 2.0f);}CCameraManager::instance().ResetToPreviousCamera();SetShow(true);if (dwVnum > 0) {CItemData* pItemData;if (CItemManager::Instance().GetItemDataPointer(dwVnum, &pItemData)) {int itemType = pItemData->GetType();int itemSubType = pItemData->GetSubType();if (itemType == CItemData::ITEM_TYPE_ARMOR) {SetArmor(dwVnum);}else if (itemType == CItemData::ITEM_TYPE_WEAPON) {SetWeapon(dwVnum);}#ifdef ENABLE_COSTUME_SYSTEMelse if (itemType == CItemData::ITEM_TYPE_COSTUME) {if (itemSubType == CItemData::COSTUME_BODY) {SetArmor(dwVnum);}else if (itemSubType == CItemData::COSTUME_HAIR) {SetHair(dwVnum);}else if (itemSubType == CItemData::COSTUME_WEAPON) {SetWeapon(dwVnum);}}#endif}}return true;}void CPythonItemPreviewManager::UpdateModel() const{if (!m_bShow || !m_pModelInstance)return;m_pModelInstance->Transform();CActorInstance& rkModelActor = m_pModelInstance->GetGraphicThingInstanceRef();rkModelActor.RotationProcess();}void CPythonItemPreviewManager::DeformModel() const{if (!m_bShow || !m_pModelInstance)return;m_pModelInstance->Deform();}void CPythonItemPreviewManager::RenderModel() const{if (!m_bShow)return;RECT rectRender;if (!CRenderTargetManager::instance().GetRenderTargetRect(CRenderTargetManager::ERENDERTARGETINDEX::RENDER_TARGET_INDEX_ITEM_PREVIEW, &rectRender)){return;}if (!CRenderTargetManager::instance().ChangeRenderTarget(CRenderTargetManager::ERENDERTARGETINDEX::RENDER_TARGET_INDEX_ITEM_PREVIEW))return;if (!m_pModelInstance){CRenderTargetManager::instance().ResetRenderTarget();return;}CPythonGraphic::Instance().ClearDepthBuffer();const float fFov = CPythonGraphic::Instance().GetFOV();const float fAspect = CPythonGraphic::Instance().GetAspect();const float fNearY = CPythonGraphic::Instance().GetNearY();const float fFarY = CPythonGraphic::Instance().GetFarY();#if defined(__BL_FOG_FIX__)const BOOL bIsFog = CPythonBackground::Instance().GetFogMode();#elseconst BOOL bIsFog = STATEMANAGER.GetRenderState(D3DRS_FOGENABLE);#endifSTATEMANAGER.SetRenderState(D3DRS_FOGENABLE, 0);const float fWidth = static_cast<float>(rectRender.right - rectRender.left);const float fHeight = static_cast<float>(rectRender.bottom - rectRender.top);CCameraManager::instance().SetCurrentCamera(CCameraManager::DEFAULT_ITEM_PREVIEW_CAMERA);CCamera* pCam = CCameraManager::instance().GetCurrentCamera();CPythonGraphic::Instance().PushState();pCam->SetViewParams(D3DXVECTOR3(0.0f, -(m_fHeight * 8.9f + m_fZoomDistance), 0.0f),D3DXVECTOR3(0.0f, m_fUpDown, 0.0f),D3DXVECTOR3(0.0f, 0.0f, 1.0f));CPythonApplication::Instance().SetItemPreviewCameraPosition();CPythonGraphic::Instance().SetPerspective(10.0f, fWidth / fHeight, 100.0f, 15000.0f);m_pModelInstance->Render();CCameraManager::instance().ResetToPreviousCamera();CPythonGraphic::Instance().PopState();CPythonGraphic::Instance().SetPerspective(fFov, fAspect, fNearY, fFarY);CRenderTargetManager::instance().ResetRenderTarget();STATEMANAGER.SetRenderState(D3DRS_FOGENABLE, bIsFog);}void CPythonItemPreviewManager::SetArmor(DWORD dwVnum){m_dwArmorVnum = dwVnum;if (m_pModelInstance && m_bShow) {m_pModelInstance->ChangeArmor(dwVnum);}}void CPythonItemPreviewManager::SetWeapon(DWORD dwVnum){m_dwWeaponVnum = dwVnum;if (m_pModelInstance && m_bShow) {m_pModelInstance->ChangeWeapon(dwVnum);}}void CPythonItemPreviewManager::SetAcce(DWORD dwVnum){m_dwAcceVnum = dwVnum;if (m_pModelInstance && m_bShow) {m_pModelInstance->ChangeAcce(dwVnum);}}void CPythonItemPreviewManager::SetHair(DWORD dwVnum){m_dwHairVnum = dwVnum;if (m_pModelInstance && m_bShow) {m_pModelInstance->ChangeHair(dwVnum);}}void CPythonItemPreviewManager::ModelZoom(bool bZoomIn){if (!m_pModelInstance)return;if (bZoomIn) {m_fZoomDistance -= m_fZoomStep;float minZoom = -(m_fHeight 8.9f - m_fHeight 3.0f);m_fZoomDistance = fmax(minZoom, m_fZoomDistance);}else {m_fZoomDistance += m_fZoomStep;float maxZoom1 = 14000.0f - m_fHeight * 8.9f;float maxZoom2 = m_fHeight 8.9f + m_fHeight 5.0f;m_fZoomDistance = fmin(m_fZoomDistance, maxZoom1);m_fZoomDistance = fmin(m_fZoomDistance, maxZoom2);}}void CPythonItemPreviewManager::ModelUpDown(bool bUp){if (!m_pModelInstance)return;if (bUp) {m_fUpDown += m_fUpDownStep;m_fUpDown = fmin(m_fHeight, m_fUpDown);}else {m_fUpDown -= m_fUpDownStep;m_fUpDown = fmax(-m_fHeight / 2.0f, m_fUpDown);}}void CPythonItemPreviewManager::ClearEquipment(){if (m_pModelInstance){m_pModelInstance->ChangeArmor(0);m_pModelInstance->ChangeWeapon(0);m_pModelInstance->ChangeAcce(0);m_pModelInstance->ChangeHair(0);}m_dwArmorVnum = 0;m_dwWeaponVnum = 0;m_dwAcceVnum = 0;m_dwHairVnum = 0;}void CPythonItemPreviewManager::SetShow(bool bShow){m_bShow = bShow;}void CPythonItemPreviewManager::ModelRotation(float fRotation){m_fRotation = fmod(fRotation, 360.0f);if (m_pModelInstance)m_pModelInstance->SetRotation(m_fRotation);}void CPythonItemPreviewManager::ModelViewReset(){m_fRotation = 0.0f;m_fZoomDistance = 0.0f;m_fUpDown = 0.0f;if (m_pModelInstance) {m_pModelInstance->SetRotation(0.0f);m_pModelInstance->NEW_SetPixelPosition(TPixelPosition(0.0f, 0.0f, 0.0f));}}void CPythonItemPreviewManager::SetEnchantLevel(int enchantLevel){m_iEnchantLevel = enchantLevel;}PythonMyShopDecoManager.cpp/** blackdragonx61 / Mali*/#include "StdAfx.h"#include "PythonApplication.h"#include "PythonMyShopDecoManager.h"#include "../eterLib/Camera.h"#include "../EterBase/Stl.h"CPythonMyShopDecoManager::CPythonMyShopDecoManager(){Initialize();}CPythonMyShopDecoManager::~CPythonMyShopDecoManager(){Destroy();}void CPythonMyShopDecoManager::Initialize(){m_pBackgroundImage = nullptr;m_pModelInstance = nullptr;m_bShow = false;m_fRot = 0.0f;}void CPythonMyShopDecoManager::Destroy(){m_bShow = false;m_fRot = 0.0f;m_pModelInstance = nullptr;if (m_pBackgroundImage) {delete m_pBackgroundImage;m_pBackgroundImage = nullptr;}stl_wipe_second(m_ModelInstanceMap);}bool CPythonMyShopDecoManager::CreateBackground(DWORD dwWidth, DWORD dwHeight){if (!m_pBackgroundImage){CResource* pResource = CResourceManager::Instance().GetResourcePointer("d:/ymir work/ui/game/myshop_deco/model_view_bg.sub");m_pBackgroundImage = new CGraphicImageInstance;m_pBackgroundImage->SetImagePointer(static_cast<CGraphicImage*>(pResource));m_pBackgroundImage->SetScale(static_cast<float>(dwWidth) / 190.0f, static_cast<float>(dwHeight) / 210.0f);}return true;}void CPythonMyShopDecoManager::RenderBackground() const{if (!m_bShow)return;if (!m_pBackgroundImage)return;RECT rectRender;if (!CRenderTargetManager::instance().GetRenderTargetRect(CRenderTargetManager::ERENDERTARGETINDEX::RENDER_TARGET_INDEX_MYSHOPDECO, &rectRender))return;if (!CRenderTargetManager::instance().ChangeRenderTarget(CRenderTargetManager::ERENDERTARGETINDEX::RENDER_TARGET_INDEX_MYSHOPDECO))return;CRenderTargetManager::instance().ClearRenderTarget();CPythonGraphic::Instance().SetInterfaceRenderState();m_pBackgroundImage->Render();CRenderTargetManager::instance().ResetRenderTarget();}bool CPythonMyShopDecoManager::CreateModelInstance(DWORD dwVnum){if (GetModelInstance(dwVnum))return true;CInstanceBase::SCreateData kCreateData;memset(&kCreateData, 0, sizeof(kCreateData));kCreateData.m_bType = CActorInstance::TYPE_OBJECT;kCreateData.m_dwRace = dwVnum;CInstanceBase* pModel = new CInstanceBase();if (!pModel->Create(kCreateData)){delete pModel;return false;}m_ModelInstanceMap.emplace(dwVnum, pModel);return true;}CInstanceBase* CPythonMyShopDecoManager::GetModelInstance(DWORD dwVnum) const{const auto it = m_ModelInstanceMap.find(dwVnum);if (m_ModelInstanceMap.end() == it)return nullptr;return it->second;}bool CPythonMyShopDecoManager::SelectModel(DWORD dwVnum){if (!dwVnum){m_pModelInstance = nullptr;return false;}if (!CreateModelInstance(dwVnum)){m_pModelInstance = nullptr;return false;}m_pModelInstance = GetModelInstance(dwVnum);if (!m_pModelInstance)return false;m_pModelInstance->GetGraphicThingInstancePtr()->ClearAttachingEffect();m_fRot = 0.0f;m_pModelInstance->Refresh(CRaceMotionData::NAME_WAIT, true);m_pModelInstance->SetLoopMotion(CRaceMotionData::NAME_WAIT, 0.0f, 0.0f);m_pModelInstance->SetLODLimits(0, 100.0f);m_pModelInstance->SetAlwaysRender(true);m_pModelInstance->SetRotation(0.0f);m_pModelInstance->NEW_SetPixelPosition(TPixelPosition(0.0f, 0.0f, 0.0f));CCameraManager::instance().SetCurrentCamera(CCameraManager::DEFAULT_MYSHOPDECO_CAMERA);CCamera* pCam = CCameraManager::instance().GetCurrentCamera();pCam->SetTargetHeight(110.0f);CCameraManager::instance().ResetToPreviousCamera();return true;}void CPythonMyShopDecoManager::UpdateModel(){if (!m_bShow)return;if (!m_pModelInstance)return;if (m_fRot < 360.0f)m_fRot += 1.0f;elsem_fRot = 0.0f;m_pModelInstance->SetRotation(m_fRot);m_pModelInstance->Transform();CActorInstance& rkModelActor = m_pModelInstance->GetGraphicThingInstanceRef();rkModelActor.RotationProcess();}void CPythonMyShopDecoManager::DeformModel() const{if (!m_bShow)return;if (!m_pModelInstance)return;m_pModelInstance->Deform();}void CPythonMyShopDecoManager::RenderModel() const{if (!m_bShow)return;RECT rectRender;if (!CRenderTargetManager::instance().GetRenderTargetRect(CRenderTargetManager::ERENDERTARGETINDEX::RENDER_TARGET_INDEX_MYSHOPDECO, &rectRender))return;if (!CRenderTargetManager::instance().ChangeRenderTarget(CRenderTargetManager::ERENDERTARGETINDEX::RENDER_TARGET_INDEX_MYSHOPDECO))return;if (!m_pModelInstance){CRenderTargetManager::instance().ResetRenderTarget();return;}CPythonGraphic::Instance().ClearDepthBuffer();const float fFov = CPythonGraphic::Instance().GetFOV();const float fAspect = CPythonGraphic::Instance().GetAspect();const float fNearY = CPythonGraphic::Instance().GetNearY();const float fFarY = CPythonGraphic::Instance().GetFarY();#if defined(__BL_FOG_FIX__)const BOOL bIsFog = CPythonBackground::Instance().GetFogMode();#elseconst BOOL bIsFog = STATEMANAGER.GetRenderState(D3DRS_FOGENABLE);#endifSTATEMANAGER.SetRenderState(D3DRS_FOGENABLE, 0);const float fWidth = static_cast<float>(rectRender.right - rectRender.left);const float fHeight = static_cast<float>(rectRender.bottom - rectRender.top);CCameraManager::instance().SetCurrentCamera(CCameraManager::DEFAULT_MYSHOPDECO_CAMERA);CCamera* pCam = CCameraManager::instance().GetCurrentCamera();CPythonGraphic::Instance().PushState();pCam->SetViewParams(D3DXVECTOR3(0.0f, -1500.0f, 600.0f),D3DXVECTOR3(0.0f, 0.0f, 0.0f),D3DXVECTOR3(0.0f, 0.0f, 1.0f));CPythonApplication::Instance().SetMyShopDecoCameraPosition();CPythonGraphic::Instance().SetPerspective(10.0f, fWidth / fHeight, 100.0f, 15000.0f);m_pModelInstance->Render();CCameraManager::instance().ResetToPreviousCamera();CPythonGraphic::Instance().PopState();CPythonGraphic::Instance().SetPerspective(fFov, fAspect, fNearY, fFarY);CRenderTargetManager::instance().ResetRenderTarget();STATEMANAGER.SetRenderState(D3DRS_FOGENABLE, bIsFog);}void CPythonMyShopDecoManager::SetShow(bool bShow){m_bShow = bShow;} Edytowane 10 Lipca10 Lip przez wojciech74
Opublikowano 10 Lipca10 Lip 🎯Wskazówki dotyczące szybszego udzielania pomocyNasza społeczność postara się pomóc tak szybko, jak to możliwe, Zanim otrzymasz odpowiedź, zapoznaj się z poniższymi wskazówkami‼️🏷️Co warto dołączyć do tematu?Pliki logów są kluczowe dołącz sysser, syslog z odpowiedniego kanału, klienta gry, a także db lub auth. Jeśli problem dotyczy uruchamiania dołącz również plik start.logOpisz dokładną sytuację, co się dzieje i kiedy pojawia się problem.Wskaż, co zmieniałeś, jakie pliki edytowałeś przed wystąpieniem problemu.Poinformuj nad z jakich plików serwerowych / źródła korzystasz.Jeśli to problem z systemem, który dodawałeś, napisz nam, co to za system i ewentualnie wstaw link lub załącznik do niego. (o ile to publiczne rozwiązanie)💡Dobre praktykiDodajesz kod? Skorzystaj z bloku kodu. W edytorze wybierz blok kodu z pierwszej opcji na pasku. Wklej tam kod i wybierz odpowiedni język programowania wtedy składnia zostanie podświetlona i łatwiej go przeanalizowaćNie pisz posta pod postem użyj opcji edytowania tematu. Jeśli post został edytowany widzimy to.Nie wysyłaj zawartości pliku sysser, syslog wklejając go w edytor! Po prostu dołącz te pliki jako załącznik do tematu.Jeśli sam znajdziesz rozwiązanie problemu wcześniej - podziel się nim pomoże nam to budować bazę wiedzy dla innych.🏷️Awaria serwera gry (padły kanały)W tym przypadku sytuacja jest nieco inna. Podczas awarii serwera gry zostanie utworzony zrzut pamięci. Taki plik zostanie wygenerowany w folderze z plikami serwerowymi w kanale gry, db lub auth w zależności który z procesów uległ awarii. Chcemy się dowiedzieć, co było przyczyną i właśnie w tym pliku znajdziemy odpowiedź. Jednak wcześniej musimy ten plik zdebugować tu podrzucam link do tematu: poradnik debugowania pliku .core następnie wstawić do tematu z prośbą o pomoc sam screen lub skopiować log po zdebugowaniu pliku .core.
Opublikowano 11 Lipca11 Lip Mam ten z deva i śmiga. Pare poprawek trzeba zrobić tylko głownie w eterlib chyba