3363 lines
97 KiB
C++
3363 lines
97 KiB
C++
|
|
#include "stdafx.h"
|
|
#include "KDeviceManager.h"
|
|
#include "KResourceDX.h"
|
|
#include "KUIControlStatic.h"
|
|
#include "KUIControlButton.h"
|
|
#include "KUIControl3DStatic.h"
|
|
#include "KUITextureManager.h"
|
|
#include "SGameManager.h"
|
|
#include "SGameMessage.h"
|
|
//#include "SGameMessageUI.h"
|
|
#include "SUIMinimapWnd.h"
|
|
#include "SGameWorldKeymapping.h"
|
|
#include "SStringDB.h"
|
|
#include "SMessengerMgr.h"
|
|
#include <toolkit/XStringUtil.h>
|
|
#include "SGameOption.h"
|
|
#include <kfile/KFileManager.h>
|
|
#include "TerrainSeamlessWorldInfoForClient.h"
|
|
#include "SUIDefine.h"
|
|
#include "SPlayerInfoMgr.h"
|
|
#include <geometry/X2DBasicTypes.h>
|
|
#include "SChatType.h"
|
|
#include <toolkit/XEnv.h>
|
|
#include "SNpcResourceDB.h"
|
|
#include "SWorldLocationDB.h"
|
|
#include "GameDefine.h"
|
|
#include <process.h>
|
|
#include "SDebug_Util.h"
|
|
#include <time.h>
|
|
#include <sstream>
|
|
//#include "SUIUtil.h" /// 2011.03.18 - prodongi
|
|
#include "SQuestMgr.h" /// 2011.08.05 - prodongi
|
|
#include "SGameMob.h"
|
|
#include "SGameWorld.h"
|
|
#include "SFieldPropResourceDB.h"
|
|
#include "SGameFieldQuestProp.h"
|
|
#include "SCommandSystem.h"
|
|
#include <toolkit/bits_scramble.h>
|
|
#include "SMonsterDB.h"
|
|
#include "SGameInterface.h"
|
|
#include "SGameSystem.h"
|
|
|
|
#include "SUIChattingWnd.h"
|
|
extern SGameSystem* g_pCurrentGameSystem;
|
|
|
|
#ifndef NDEBUG
|
|
#include "./game/Console/ConsoleScreen.h"
|
|
#endif
|
|
//ZONE Epic 9.6 Minimap UI
|
|
namespace {
|
|
const float PI = 3.14159265358979f;
|
|
const char* c_szNPCInfoFileName = "NPCInfo.cfg";
|
|
const char* c_szSeamlessWorldInfoFileName = "TerrainSeamlessWorld.cfg";
|
|
const int MAP_PER_TILE_COUNT = 8;
|
|
|
|
const int MINIMAP_LIFE = 300000; // 5 minutes cache life time
|
|
|
|
const char* c_szLocalText = "static_local_text"; // Field name display
|
|
|
|
const int c_nTileLen = 256;
|
|
|
|
const int c_nTempTexSize = 2;
|
|
|
|
const float c_fZoomValue = 8.f;
|
|
|
|
const int c_nMapPerTileW = 2016; // The size of one tile in the real world
|
|
const int c_nMapPerTileH = 2016; // The size of one tile in the real world
|
|
|
|
|
|
enum OBJTYPE
|
|
{
|
|
TY_MY = 0,
|
|
TY_CREATURE,
|
|
TY_MOB,
|
|
TY_PLAYER,
|
|
TY_NPC,
|
|
};
|
|
|
|
const char* g_szBtnDurability[] = { "common_button_beamblue_repair_down", "common_button_beamblue_repair_up" };
|
|
};
|
|
|
|
volatile bool SUIMinimapWnd::s_bStopThread = false;
|
|
volatile bool SUIMinimapWnd::s_bIsThreadLoading = false;
|
|
volatile bool SUIMinimapWnd::s_bIsThreadPending = false;
|
|
|
|
static XCriticalSection s_MinimapLoadingLock;
|
|
static std::list< std::string > s_lstThreadLoadingMinimapName;
|
|
static std::list< K3DTextureSPtr > s_lstThreadLoadingMinimap;
|
|
extern void MsgSplit(const char* szMsg, std::vector<std::string>& vecText, const wchar_t* lpDelimiter, bool bProcSpecialCharacter = false);
|
|
|
|
void SUIMinimapWnd::BeginMinimapLoadingThread()
|
|
{
|
|
unsigned dwThreadID;
|
|
HANDLE hThread = reinterpret_cast<HANDLE>(_beginthreadex(NULL, 0, SUIMinimapWnd::minimap_loader, NULL, 0, &dwThreadID));
|
|
CloseHandle(hThread);
|
|
}
|
|
|
|
void SUIMinimapWnd::EndMinimapLoadingThread()
|
|
{
|
|
_oprint("**THREAD INFO : SUIMinimapWnd::EndMinimapLoadingThread\n");
|
|
|
|
if (s_bStopThread == false)
|
|
{
|
|
s_bStopThread = true;
|
|
|
|
while (s_bStopThread) Sleep(1);
|
|
}
|
|
}
|
|
|
|
unsigned int __stdcall SUIMinimapWnd::minimap_loader(void* pArg)
|
|
{
|
|
std::string strName;
|
|
|
|
while (!s_bStopThread)
|
|
{
|
|
s_MinimapLoadingLock.Lock();
|
|
|
|
if (s_lstThreadLoadingMinimapName.empty())
|
|
{
|
|
s_MinimapLoadingLock.UnLock();
|
|
#ifdef _DEBUG
|
|
Sleep(100);
|
|
#else
|
|
Sleep(50);
|
|
#endif
|
|
continue;
|
|
}
|
|
|
|
if (s_pDevice->TestCooperativeLevel() == S_OK)
|
|
{
|
|
strName = s_lstThreadLoadingMinimapName.front();
|
|
s_lstThreadLoadingMinimapName.pop_front();
|
|
|
|
s_bIsThreadLoading = true;
|
|
s_MinimapLoadingLock.UnLock();
|
|
|
|
doLoading(strName.c_str());
|
|
}
|
|
}
|
|
|
|
s_bStopThread = false;
|
|
|
|
//¾²·¹µه ؟د·ل µا¾ْہ¸¹ا·خ »èء¦
|
|
s_lstThreadLoadingMinimapName.erase(s_lstThreadLoadingMinimapName.begin(), s_lstThreadLoadingMinimapName.end());
|
|
|
|
K3DTexture* pTex = NULL;
|
|
while (!s_lstThreadLoadingMinimap.empty())
|
|
{
|
|
pTex = s_lstThreadLoadingMinimap.front();
|
|
s_lstThreadLoadingMinimap.pop_front();
|
|
pTex->Discard();
|
|
}
|
|
|
|
return 0;
|
|
}
|
|
|
|
void SUIMinimapWnd::removeFromLoadingList(const char* szName)
|
|
{
|
|
THREAD_SYNCRONIZE(s_MinimapLoadingLock);
|
|
|
|
if (!s_bIsThreadPending) return;
|
|
|
|
std::list< std::string >::iterator it;
|
|
|
|
for (it = s_lstThreadLoadingMinimapName.begin(); it != s_lstThreadLoadingMinimapName.end(); ++it)
|
|
{
|
|
if (stricmp((*it).c_str(), szName) == 0)
|
|
{
|
|
s_lstThreadLoadingMinimapName.erase(it);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIMinimapWnd::addToLoadingList(const char* szName)
|
|
{
|
|
THREAD_SYNCRONIZE(s_MinimapLoadingLock);
|
|
|
|
#ifdef _DEBUG
|
|
std::list< std::string >::iterator it;
|
|
for (it = s_lstThreadLoadingMinimapName.begin(); it != s_lstThreadLoadingMinimapName.end(); ++it)
|
|
{
|
|
if (stricmp((*it).c_str(), szName) == 0)
|
|
{
|
|
assert(0);
|
|
return;
|
|
}
|
|
}
|
|
#endif
|
|
|
|
// _performance_print( "MiniMap addToLoadingList - %s\n", szName );
|
|
|
|
s_bIsThreadPending = true;
|
|
|
|
s_lstThreadLoadingMinimapName.push_back(szName);
|
|
}
|
|
|
|
void SUIMinimapWnd::PendLoading(const char* szName)
|
|
{
|
|
if (s_bIsThreadPending) return;
|
|
addToLoadingList(szName);
|
|
}
|
|
|
|
void SUIMinimapWnd::doLoading(const char* szName)
|
|
{
|
|
struct _FlagRemover
|
|
{
|
|
_FlagRemover(volatile bool* volatile f) : pFlag(f) {}
|
|
|
|
~_FlagRemover() { *pFlag = false; }
|
|
|
|
volatile bool* volatile pFlag;
|
|
};
|
|
|
|
volatile _FlagRemover _remover0(&s_bIsThreadLoading);
|
|
volatile _FlagRemover _remover1(&s_bIsThreadPending);
|
|
|
|
//ہج¹ج ·خµùµب إط½؛أؤ
|
|
std::list< K3DTextureSPtr >::iterator it = s_lstThreadLoadingMinimap.begin();
|
|
for (; it != s_lstThreadLoadingMinimap.end(); it++)
|
|
{
|
|
K3DTexture* pTex = (*it);
|
|
if (stricmp(pTex->GetName(), szName) == 0)
|
|
return;
|
|
}
|
|
|
|
//ؤ³½¬؟، ¾ّ´ظ.
|
|
KStream* stream = KFileManager::Instance().CreateStreamFromResource(szName);
|
|
if (stream == NULL)
|
|
{
|
|
return;
|
|
}
|
|
|
|
// _performance_print( "MiniMap Thread Do Loading: %s\n", szName );
|
|
|
|
// _oprint( "MT:%s\n", pTexName );
|
|
|
|
K3DTextureDX* pSrcTex = new K3DTextureDX(s_pDevice);
|
|
pSrcTex->SetName(szName);
|
|
pSrcTex->Initialize(*stream, 0, D3DPOOL_DEFAULT, K3DFMT_A8R8G8B8);
|
|
|
|
//Load Time
|
|
pSrcTex->SetLoadedTime(GetSafeTickCount());
|
|
pSrcTex->AddRef();
|
|
|
|
s_pDevice->AddLostTexture(pSrcTex);
|
|
|
|
s_lstThreadLoadingMinimap.push_back(K3DTextureSPtr(pSrcTex));
|
|
|
|
KFileManager::Instance().DeleteStream(stream);
|
|
}
|
|
|
|
K3DRenderDeviceDX* SUIMinimapWnd::s_pDevice = NULL;
|
|
void SUIMinimapWnd::SetRenderDevice(class K3DRenderDeviceDX* pDevice)
|
|
{
|
|
s_pDevice = pDevice;
|
|
}
|
|
|
|
SUIMinimapWnd::SUIMinimapWnd(SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo)
|
|
: SUIWnd(pGameManager)
|
|
, m_pDisplayInfo(pDisplayInfo)
|
|
, m_hsLoadedMapTexture(10)
|
|
, m_npcMarker(this)
|
|
, m_nCurrentLocation(PLAYER_IN_WORLD)
|
|
{
|
|
m_pZoomMiniMapWnd = NULL;
|
|
|
|
m_bColse = true;
|
|
m_dwAlphaTime = 0;
|
|
m_dwTime = 0;
|
|
m_dwPlayerPointTime = 0;
|
|
m_bPointSign = false;
|
|
|
|
m_fZoomAlphaValue = 1.f;
|
|
|
|
m_bNotColse = false;
|
|
|
|
m_pSeamlessWorldInfo = NULL;
|
|
m_bNpcDrawFlag = false;
|
|
|
|
m_dwLastDrawTime = m_dwLastDeleteTime = GetSafeTickCount();
|
|
|
|
m_fRadian = 0.f;
|
|
m_pNewTex = NULL;
|
|
|
|
m_display_positoin_x = 0;
|
|
m_display_positoin_y = 0;
|
|
|
|
// 2010.06.15 - prodongi
|
|
m_isDeathMatch = false;
|
|
|
|
}
|
|
|
|
void ReleaseTexture(K3DTexture* pTex)
|
|
{
|
|
if (pTex->GetRefCount() > 0)
|
|
{
|
|
while (pTex->GetRefCount() != 1)
|
|
pTex->Release();
|
|
}
|
|
}
|
|
|
|
SUIMinimapWnd::~SUIMinimapWnd()
|
|
{
|
|
for (unsigned int i(0); m_vtLoadedMapTexture.size() > i; i++)
|
|
{
|
|
K3DTexture* pTex = m_vtLoadedMapTexture[i];
|
|
// _performance_print( "%d %s\n", pTex->GetRefCount(), pTex->GetName() );
|
|
|
|
ReleaseTexture(pTex);
|
|
}
|
|
m_vtLoadedMapTexture.clear();
|
|
|
|
SAFE_DELETE(m_pSeamlessWorldInfo);
|
|
|
|
SAFE_RELEASE(m_pNewTex);
|
|
// FreeList();
|
|
|
|
m_npcMarker.clear();
|
|
m_questIconCache.clear();
|
|
m_questIconList.clear();
|
|
|
|
m_vecNPCInfoList.clear();
|
|
m_propInfoList.clear();
|
|
m_raidInfoList.clear();
|
|
}
|
|
void SUIMinimapWnd::FreeList()
|
|
{
|
|
m_vecNPCInfoList.clear();
|
|
//m_vecMapTitleList.clear();
|
|
m_vecPartyInfoList.clear();
|
|
m_npcMarker.clear();
|
|
m_raidInfoList.clear();
|
|
}
|
|
|
|
void SUIMinimapWnd::OnDeviceLost()
|
|
{
|
|
if (m_vtLoadedMapTexture.empty())
|
|
return;
|
|
|
|
std::vector< std::string > minimap_list;
|
|
|
|
//ؤ³½¬؟، ہض´آءِ ب®ہخ.
|
|
for (unsigned int i(0); m_vtLoadedMapTexture.size() > i; i++)
|
|
{
|
|
K3DTexture* pTex = m_vtLoadedMapTexture[i];
|
|
minimap_list.push_back(pTex->GetName());
|
|
|
|
ReleaseTexture(pTex);
|
|
}
|
|
m_hsLoadedMapTexture.clear();
|
|
m_vtLoadedMapTexture.clear();
|
|
|
|
|
|
for (unsigned int i(0); minimap_list.size() > i; i++)
|
|
{
|
|
//ؤ³½¬؟، ¾ّ´ظ.
|
|
KStream* stream = KFileManager::Instance().CreateStreamFromResource(minimap_list[i].c_str());
|
|
if (stream == NULL)
|
|
continue;
|
|
|
|
K3DTextureDX* pSrcTex = new K3DTextureDX(s_pDevice);
|
|
pSrcTex->SetName(minimap_list[i].c_str());
|
|
pSrcTex->Initialize(*stream, 0, D3DPOOL_DEFAULT, K3DFMT_A8R8G8B8);
|
|
|
|
//Load Time
|
|
pSrcTex->SetLoadedTime(GetSafeTickCount());
|
|
|
|
//Device Lost
|
|
s_pDevice->AddLostTexture(pSrcTex);
|
|
m_vtLoadedMapTexture.push_back(K3DTextureSPtr(pSrcTex));
|
|
m_hsLoadedMapTexture.add(pSrcTex->GetName(), pSrcTex);
|
|
|
|
KFileManager::Instance().DeleteStream(stream);
|
|
}
|
|
|
|
minimap_list.clear();
|
|
|
|
RefreshMap(true);
|
|
|
|
}
|
|
|
|
bool SUIMinimapWnd::InitData(bool bReload)
|
|
{
|
|
m_pBtnDuribility = dynamicCast< KUIControlSimpleButton* >(GetChild("button_repairdown")); // ³»±¸µµأâ·آ ¹ِئ°.
|
|
m_pBtnDuribility->SetLazyTooltip(new KLazyTip(S(7233))); // إّئء.
|
|
m_bShowDurability = false; // ³»±¸µµأâ·آ؟©؛خ.
|
|
|
|
m_nMiniMapSize = 1; // Minimap Size // 0 - hidden; 1 - Normal 2 - big; 3 - huge; making 1 (normal) as default
|
|
m_pMapFrame = dynamicCast<KUIControlStatic*>(GetChild("map_frame"));
|
|
m_bMiniMapShow = true;
|
|
const KRect& clip_rect = GetClipRect();
|
|
KRect newRect = clip_rect;
|
|
newRect.left = clip_rect.left - 512;
|
|
newRect.bottom = clip_rect.bottom + 512;
|
|
ClipRect(newRect);
|
|
|
|
SetChildShow("static00", false); // Background
|
|
SetChildShow("static02", false); // PM <#8eff20><right><vcenter><font:Dotum>PM
|
|
SetChildShow("static03", false); // <#8eff20><left><vcenter><font:Dotum>00:00
|
|
|
|
// SetChildShow( "static05", false ); // <#ffd200><left><vcenter><font:Dotum>000.0
|
|
// SetChildShow( "static08", false ); // <#ffd200><left><vcenter><font:Dotum>000.0
|
|
|
|
m_bIsLogin = false;
|
|
setZoomType(2.0f);
|
|
|
|
int nMapTileLen = c_nTileLen;
|
|
int nMiniMapWidth = c_nMapPerTileW * m_fZoomType;
|
|
int nMiniMapHeight = c_nMapPerTileH * m_fZoomType;
|
|
|
|
int nMiniMapWndWidth = GetRect().GetWidth();
|
|
int nMiniMapWndHeight = GetRect().GetHeight();
|
|
|
|
int nExpX, nExpY;
|
|
K3DRenderDevice::GetSquareSize(nMiniMapWndWidth, nMiniMapWndHeight, nExpX, nExpY);
|
|
|
|
m_MiniMap.Init(c_nMapPerTileW, c_nMapPerTileH, nMapTileLen, nMapTileLen, nMiniMapWidth, nMiniMapHeight, nExpX, nExpY);
|
|
|
|
m_spMiniMapTexture = KDeviceManager::GetDeviceManager()->GetRenderDevice()->CreateTexture(nExpX, nExpY, KUSAGE_RENDERTARGET, K3DFMT_A8R8G8B8, D3DPOOL_DEFAULT);
|
|
assert(m_spMiniMapTexture != NULL && "MiniMap Create Failed");
|
|
|
|
m_pSeamlessWorldInfo = new CTerrainSeamlessWorldInfoForClient();
|
|
if (!m_pSeamlessWorldInfo->Initialize(c_szSeamlessWorldInfoFileName, false))
|
|
{
|
|
assert(false && "Failed to initialize Seamless world information file (due to cfg file syntax error or existence of abnormal map file)");
|
|
delete m_pSeamlessWorldInfo;
|
|
return false;
|
|
}
|
|
|
|
m_fZoomMinimapZoomValue = c_fZoomValue;
|
|
|
|
nExpX = 512;
|
|
nExpY = 512;
|
|
|
|
m_spZoomMiniMapTexture = KDeviceManager::GetDeviceManager()->GetRenderDevice()->CreateTexture(nExpX, nExpY, KUSAGE_RENDERTARGET, K3DFMT_A8R8G8B8, D3DPOOL_DEFAULT);
|
|
m_ZoomMiniMap.Init(c_nMapPerTileW, c_nMapPerTileH, nMapTileLen, nMapTileLen, nMiniMapWidth, nMiniMapHeight, nExpX, nExpY);
|
|
m_ZoomMiniMap.ChangeMiniMapSize(c_nMapPerTileW * m_fZoomMinimapZoomValue, c_nMapPerTileH * m_fZoomMinimapZoomValue);
|
|
|
|
KUIWND_CREATE_ARG minimap_arg;
|
|
minimap_arg.lpszID = "minimap_zoom";
|
|
minimap_arg.lpszClassName = "minimap_static";
|
|
minimap_arg.lpszSprName = "ui_frame.spr";
|
|
minimap_arg.rcRect = KRect(KPoint(-(nExpX * 2), 0), KSize(nExpX, nExpY));
|
|
minimap_arg.dwStyle = 0;
|
|
minimap_arg.dwFlag = KFLAG_NO_GET_MESSAGE;
|
|
minimap_arg.pParent = this;
|
|
minimap_arg.pWndManager = m_pManager;
|
|
|
|
m_pZoomMiniMapWnd = (KUIControlMiniMapStatic*)m_pManager->CreateControl(minimap_arg);
|
|
if (m_pZoomMiniMapWnd)
|
|
{
|
|
m_pZoomMiniMapWnd->SetShow(false);
|
|
m_pZoomMiniMapWnd->SetRenderTarget(m_spZoomMiniMapTexture);
|
|
|
|
m_pZoomMiniMapWnd->MovePos(-512 + GetRect().left, GetRect().top + 25);
|
|
}
|
|
|
|
//m_fMapLen = 0.f;
|
|
|
|
//m_fOriginalAlpha = -1.f;
|
|
//m_nPlayerRealPosX = 0;
|
|
//m_nPlayerRealPosY = 0;
|
|
m_bPartyListUpdate = true;
|
|
|
|
//m_rtShowTextureRect = KRect( 0, 0, 0, 0 );
|
|
|
|
//SetChildShow( "minimap_place", false );
|
|
//SetChildShow( "minimap_backimg", false );
|
|
|
|
//FreeList();
|
|
LoadLocalInfo();
|
|
LoadNPCInfoFile();
|
|
|
|
KUIWnd* pWnd = GetChild("minimap");
|
|
if (pWnd)
|
|
{
|
|
// m_fOriginalAlpha = pWnd->GetAlpha();
|
|
int nPosX = pWnd->GetRect().left + pWnd->GetRect().GetWidth() / 2;
|
|
int nPosY = pWnd->GetRect().top + pWnd->GetRect().GetHeight() / 2;
|
|
|
|
// Position the character and camera at the exact center
|
|
KUIWnd* pCameraWnd = GetChild("minimap_cameraviewpoint");
|
|
if (pCameraWnd)
|
|
pCameraWnd->MovePos(nPosX - (pCameraWnd->GetRect().GetWidth() / 2), nPosY - (pCameraWnd->GetRect().GetHeight() / 2));
|
|
KUIWnd* pPlayerWnd = GetChild("minimap_playerviewpoint");
|
|
if (pPlayerWnd)
|
|
pPlayerWnd->MovePos(nPosX - (pPlayerWnd->GetRect().GetWidth() / 2), nPosY - (pPlayerWnd->GetRect().GetHeight() / 2));
|
|
}
|
|
|
|
SetChildCaption("static_local_text", "");
|
|
|
|
SetChildAsTop("minimap_cameraviewpoint");
|
|
SetChildAsTop("minimap_playerviewpoint");
|
|
|
|
if (m_pMapFrame)
|
|
{
|
|
m_pMapFrame->SetAniName("common_panel_outframe_copper_gold2");
|
|
m_pMapFrame->SetShow(true);
|
|
}
|
|
|
|
m_raidInfoUpdateTime.begin(0.5f, true);
|
|
|
|
return SUIWnd::InitData(bReload);
|
|
}
|
|
|
|
void SUIMinimapWnd::OnNotifyUIWindowOpen(bool bOpen, bool bLimitWnd)
|
|
{
|
|
//SUIWnd::OnNotifyUIWindowOpen(bOpen);
|
|
SUIWnd* pWnd = m_pGameManager->GetGameInterface()->GetUIWindow(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DURABILITY);
|
|
if (pWnd)
|
|
{
|
|
int x = m_pBtnDuribility->GetRect().right - pWnd->GetRect().GetWidth();
|
|
int y = m_pBtnDuribility->GetRect().bottom;
|
|
|
|
m_pGameManager->PostMsgAtDynamic(new SIMSG_UI_MOVE(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DURABILITY, x, y));
|
|
}
|
|
|
|
if (bOpen /*&& GetGameOption().IsMinimapOpen()*/)
|
|
{
|
|
KUIControlMiniMapStatic* pMiniMapWnd = dynamicCast<KUIControlMiniMapStatic*>(GetChild("minimap"));
|
|
if (pMiniMapWnd)
|
|
{
|
|
pMiniMapWnd->SetRenderTarget(m_spMiniMapTexture);
|
|
}
|
|
// RefreshMapName();
|
|
|
|
// // إُ¸يµµ
|
|
// m_pGameManager->ProcMsgAtStatic( &SIMSG_UI_MINIMAP_ALPHA( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MINIMAP, GetGameOption().GetMinimapAlpha() ) );
|
|
}
|
|
//¸·ہ½ -N4-
|
|
// else
|
|
// {
|
|
// m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_FULLDOWN_MINIMAP, false ) );
|
|
// }
|
|
|
|
//if( !GetGameOption().IsMinimapOpen() ) m_pGameManager->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MINIMAP, false ) );
|
|
}
|
|
|
|
void SUIMinimapWnd::zoomin()
|
|
{
|
|
setZoomType(m_fZoomType - 2.85f);
|
|
m_MiniMap.ChangeMiniMapSize(c_nMapPerTileW * m_fZoomType, c_nMapPerTileH * m_fZoomType);
|
|
RefreshMap(true);
|
|
RefreshLocal();
|
|
}
|
|
|
|
void SUIMinimapWnd::zoomout()
|
|
{
|
|
setZoomType(m_fZoomType + 2.85f);
|
|
m_MiniMap.ChangeMiniMapSize(c_nMapPerTileW * m_fZoomType, c_nMapPerTileH * m_fZoomType);
|
|
RefreshMap(true);
|
|
RefreshLocal();
|
|
}
|
|
|
|
void SUIMinimapWnd::setZoomType(float value)
|
|
{
|
|
KUIControl* wndIn = dynamicCast<KUIControl*>(GetChild("zoomin"));
|
|
KUIControl* wndOut = dynamicCast<KUIControl*>(GetChild("zoomout"));
|
|
|
|
wndIn->Enable();
|
|
wndOut->Enable();
|
|
|
|
m_fZoomType = value;
|
|
if (m_fZoomType <= 1.f)
|
|
{
|
|
wndIn->Disable();
|
|
m_fZoomType = 1.f;
|
|
}
|
|
else if (m_fZoomType >= 5.0f)
|
|
{
|
|
wndOut->Disable();
|
|
m_fZoomType = 5.0f;
|
|
}
|
|
}
|
|
|
|
void SUIMinimapWnd::PumpUpMessage(LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam)
|
|
{
|
|
switch (nMessage)
|
|
{
|
|
case KUI_MESSAGE::KBUTTON_CLICK:
|
|
{
|
|
if (::_stricmp(lpszControlID, "button_repairdown") == 0) // Toggle gear durability table
|
|
{
|
|
ToggleDurability();
|
|
m_pBtnDuribility->SetAniName(g_szBtnDurability[m_bShowDurability]);
|
|
m_pGameManager->PostMsgAtDynamic(new SIMSG_TOGGLE_UIWINDOW(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DURABILITY));
|
|
|
|
KUIWnd* mapFrame = GetChild("map_frame");
|
|
if (m_pBtnDuribility)
|
|
{
|
|
switch (m_nMiniMapSize)
|
|
{
|
|
case 0: // Case when map is collapsed
|
|
{
|
|
// If minimap size is 0, means it's collapsed, so we need to bind the button to the outframe
|
|
KUIWnd* outFrame = GetChild("outframe_02");
|
|
m_pBtnDuribility->MovePos(GetRect().right - m_pBtnDuribility->GetRect().GetWidth(), outFrame->GetRect().bottom + 2);
|
|
}
|
|
break;
|
|
|
|
case 1: // Case when map is normal (size == 1)
|
|
{
|
|
if (mapFrame)
|
|
{
|
|
m_pBtnDuribility->MovePos(GetRect().right - m_pBtnDuribility->GetRect().GetWidth(), mapFrame->GetRect().bottom + 2);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case 2: // Case when map is big (size == 2)
|
|
{
|
|
if (mapFrame)
|
|
{
|
|
m_pBtnDuribility->MovePos(GetRect().right - m_pBtnDuribility->GetRect().GetWidth(), mapFrame->GetRect().bottom + 2);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case 3: // Case when map is huge (size == 3)
|
|
{
|
|
if (mapFrame)
|
|
{
|
|
m_pBtnDuribility->MovePos(GetRect().right - m_pBtnDuribility->GetRect().GetWidth(), mapFrame->GetRect().bottom + 2);
|
|
}
|
|
}
|
|
break;
|
|
|
|
default:
|
|
{
|
|
|
|
}
|
|
break;
|
|
}
|
|
|
|
// Update the position of the UIWINDOW_DURABILITY window immediately after the toggle
|
|
SUIWnd* durabilityWnd = m_pGameManager->GetGameInterface()->GetUIWindow(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DURABILITY);
|
|
if (durabilityWnd && m_bShowDurability)
|
|
{
|
|
durabilityWnd->MovePos(m_pBtnDuribility->GetRect().right - durabilityWnd->GetRect().GetWidth(), m_pBtnDuribility->GetRect().bottom + 4);
|
|
}
|
|
|
|
m_pBtnDuribility->SetShow(true);
|
|
}
|
|
|
|
break;
|
|
}
|
|
else if (::_stricmp(lpszControlID, "zoomin") == 0) // Minimap actual zoom
|
|
{
|
|
zoomin();
|
|
RefreshMap(true);
|
|
break;
|
|
}
|
|
else if (::_stricmp(lpszControlID, "map_zoomout") == 0) // Reduce minimap size
|
|
{
|
|
KUIWnd* minimap = GetChild("minimap");
|
|
KUIControlMiniMapStatic* pMiniMapWnd = dynamicCast<KUIControlMiniMapStatic*>(GetChild("minimap"));
|
|
|
|
if (minimap == NULL || pMiniMapWnd == NULL || m_pMapFrame == NULL || !m_bMiniMapShow || m_nMiniMapSize == 0) break;
|
|
|
|
_oprint("[map_zoomout] [before] m_nMiniMapSize: %i; zoomFactor: %f; OLD RECT: %i/%i/%i/%i; Minimap old RECT: %i/%i/%i/%i; ", m_nMiniMapSize, (m_fZoomType / 2.85f), m_pMapFrame->GetRect().top, m_pMapFrame->GetRect().bottom, m_pMapFrame->GetRect().left, m_pMapFrame->GetRect().right, minimap->GetRect().top, minimap->GetRect().bottom, minimap->GetRect().left, minimap->GetRect().right );
|
|
|
|
switch (m_nMiniMapSize)
|
|
{
|
|
case 0: // Calling zoomout when minimap is collapsed
|
|
{
|
|
KUIControlStatic* pMiniWnd = dynamicCast<KUIControlStatic*>(GetChild("outframe_02"));
|
|
|
|
// If minimap size is 0, means it's collapsed, so we need to bind the durability button to the outframe
|
|
// No other actions required, since all the logic for collapse is inside of case 1
|
|
KUIWnd* outFrame = GetChild("outframe_02");
|
|
m_pBtnDuribility->MovePos(GetRect().right - m_pBtnDuribility->GetRect().GetWidth(), outFrame->GetRect().bottom + 2);
|
|
|
|
// After binding durability button to the outframe, we check&bind (if exist) durability table to the button
|
|
SUIWnd* durabilityWnd = m_pGameManager->GetGameInterface()->GetUIWindow(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DURABILITY);
|
|
if (durabilityWnd && m_bShowDurability)
|
|
{
|
|
durabilityWnd->MovePos(m_pBtnDuribility->GetRect().right - durabilityWnd->GetRect().GetWidth(), (m_pBtnDuribility->GetRect().bottom + 4));
|
|
}
|
|
|
|
|
|
// Just in case
|
|
if (m_pMapFrame)
|
|
{
|
|
m_pMapFrame->SetShow(false);
|
|
}
|
|
|
|
if (KUIWnd* pCameraWnd = GetChild("minimap_cameraviewpoint"))
|
|
{
|
|
pCameraWnd->SetShow(false);
|
|
}
|
|
|
|
if (KUIWnd* pPlayerWnd = GetChild("minimap_playerviewpoint"))
|
|
{
|
|
pPlayerWnd->SetShow(false);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case 1: // Calling zoomout when minimap is normal (size == 1)
|
|
{
|
|
if (m_bMiniMapShow) // Making sure it's being shown (actually it can't be otherwise in case 1, but still...)
|
|
{
|
|
m_nMiniMapSize = 0;
|
|
|
|
m_bMiniMapShow = false;
|
|
|
|
minimap->SetShow(m_bMiniMapShow);
|
|
pMiniMapWnd->SetShow(m_bMiniMapShow);
|
|
pMiniMapWnd->SetRenderTarget(m_spMiniMapTexture);
|
|
|
|
// If minimap size is 0, means it's collapsed, so we need to bind the button to the outframe
|
|
KUIWnd* outFrame = GetChild("outframe_02");
|
|
m_pBtnDuribility->MovePos(GetRect().right - m_pBtnDuribility->GetRect().GetWidth(), outFrame->GetRect().bottom + 2);
|
|
|
|
KUIControlStatic* pMiniWnd = dynamicCast<KUIControlStatic*>(GetChild("outframe_02"));
|
|
m_pMapFrame->SetShow(m_bMiniMapShow);
|
|
|
|
if (KUIWnd* pCameraWnd = GetChild("minimap_cameraviewpoint"))
|
|
{
|
|
pCameraWnd->SetShow(false);
|
|
}
|
|
|
|
if (KUIWnd* pPlayerWnd = GetChild("minimap_playerviewpoint"))
|
|
{
|
|
pPlayerWnd->SetShow(false);
|
|
}
|
|
|
|
SUIWnd* durabilityWnd = m_pGameManager->GetGameInterface()->GetUIWindow(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DURABILITY);
|
|
if (durabilityWnd && m_bShowDurability)
|
|
{
|
|
durabilityWnd->MovePos(m_pBtnDuribility->GetRect().right - durabilityWnd->GetRect().GetWidth(), (m_pBtnDuribility->GetRect().bottom + 4));
|
|
}
|
|
|
|
float zoomFactor = m_fZoomType / 2.85f;
|
|
int newWidth = static_cast<int>(c_nMapPerTileW * zoomFactor);
|
|
int newHeight = static_cast<int>(c_nMapPerTileH * zoomFactor);
|
|
KRect currentFrameRect = m_pMapFrame->GetRect();
|
|
KRect currentMinimapRect = minimap->GetRect();
|
|
|
|
if (m_pMapFrame)
|
|
{
|
|
m_pMapFrame->Resize(KRect(currentFrameRect.left + (newWidth / 20), currentFrameRect.top, currentFrameRect.right, currentFrameRect.bottom - (newHeight / 20)));
|
|
}
|
|
|
|
minimap->SetRect(KRect(currentMinimapRect.left + (newWidth / 20), currentMinimapRect.top, currentMinimapRect.right, currentMinimapRect.bottom - (newHeight / 20)));
|
|
|
|
|
|
|
|
}
|
|
}
|
|
break;
|
|
|
|
case 2: // Calling zoomout when minimap is big (size == 2)
|
|
{
|
|
m_nMiniMapSize -= 1;
|
|
|
|
// Shrink the size by a percentage based on m_fZoomType
|
|
float zoomFactor = m_fZoomType / 2.85f;
|
|
int newWidth = static_cast<int>(c_nMapPerTileW * zoomFactor);
|
|
int newHeight = static_cast<int>(c_nMapPerTileH * zoomFactor);
|
|
|
|
KRect currentFrameRect = m_pMapFrame->GetRect();
|
|
KRect currentMinimapRect = minimap->GetRect();
|
|
|
|
if (m_pMapFrame)
|
|
{
|
|
m_pMapFrame->Resize(KRect(currentFrameRect.left + (newWidth / 20), currentFrameRect.top, currentFrameRect.right, currentFrameRect.bottom - (newHeight / 20)));
|
|
}
|
|
|
|
minimap->SetRect(KRect(currentMinimapRect.left + (newWidth / 20), currentMinimapRect.top, currentMinimapRect.right, currentMinimapRect.bottom - (newHeight / 20)));
|
|
|
|
if (m_pBtnDuribility && m_pMapFrame)
|
|
{
|
|
m_pBtnDuribility->MovePos(GetRect().right - m_pBtnDuribility->GetRect().GetWidth(), m_pMapFrame->GetRect().bottom + 1);
|
|
m_pBtnDuribility->SetShow(true);
|
|
|
|
// Update the position of the UIWINDOW_DURABILITY window
|
|
int mapBottom = m_pMapFrame->GetRect().bottom + 2; // y is vertical
|
|
SUIWnd* durabilityWnd = m_pGameManager->GetGameInterface()->GetUIWindow(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DURABILITY);
|
|
if (durabilityWnd && m_bShowDurability)
|
|
{
|
|
durabilityWnd->MovePos(m_pBtnDuribility->GetRect().right - durabilityWnd->GetRect().GetWidth(), mapBottom);
|
|
}
|
|
}
|
|
|
|
pMiniMapWnd->SetRenderTarget(m_spMiniMapTexture);
|
|
|
|
|
|
|
|
int nPosX = minimap->GetRect().left + minimap->GetRect().GetWidth() / 2;
|
|
int nPosY = minimap->GetRect().top + minimap->GetRect().GetHeight() / 2;
|
|
|
|
if (KUIWnd* pCameraWnd = GetChild("minimap_cameraviewpoint"))
|
|
{
|
|
pCameraWnd->MovePos(nPosX - (pCameraWnd->GetRect().GetWidth() / 2), nPosY - (pCameraWnd->GetRect().GetHeight() / 2));
|
|
}
|
|
|
|
if (KUIWnd* pPlayerWnd = GetChild("minimap_playerviewpoint"))
|
|
{
|
|
pPlayerWnd->MovePos(nPosX - (pPlayerWnd->GetRect().GetWidth() / 2), nPosY - (pPlayerWnd->GetRect().GetHeight() / 2));
|
|
}
|
|
|
|
|
|
}
|
|
break;
|
|
|
|
case 3: // Calling zoomout when minimap is huge (size == 3)
|
|
{
|
|
m_nMiniMapSize -= 1;
|
|
|
|
// Shrink the size by a percentage based on m_fZoomType
|
|
float zoomFactor = m_fZoomType / 2.85f;
|
|
int newWidth = static_cast<int>(c_nMapPerTileW * zoomFactor);
|
|
int newHeight = static_cast<int>(c_nMapPerTileH * zoomFactor);
|
|
|
|
KRect currentFrameRect = m_pMapFrame->GetRect();
|
|
KRect currentMinimapRect = minimap->GetRect();
|
|
|
|
if (m_pMapFrame)
|
|
{
|
|
m_pMapFrame->Resize(KRect(currentFrameRect.left + (newWidth / 20), currentFrameRect.top, currentFrameRect.right, currentFrameRect.bottom - (newHeight / 20)));
|
|
}
|
|
|
|
minimap->SetRect(KRect(currentMinimapRect.left + (newWidth / 20), currentMinimapRect.top, currentMinimapRect.right, currentMinimapRect.bottom - (newHeight / 20)));
|
|
|
|
if (m_pBtnDuribility && m_pMapFrame)
|
|
{
|
|
m_pBtnDuribility->MovePos(GetRect().right - m_pBtnDuribility->GetRect().GetWidth(), m_pMapFrame->GetRect().bottom + 1);
|
|
m_pBtnDuribility->SetShow(true);
|
|
|
|
// Update the position of the UIWINDOW_DURABILITY window
|
|
int mapBottom = m_pMapFrame->GetRect().bottom + 2; // y is vertical
|
|
SUIWnd* durabilityWnd = m_pGameManager->GetGameInterface()->GetUIWindow(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DURABILITY);
|
|
if (durabilityWnd && m_bShowDurability)
|
|
{
|
|
durabilityWnd->MovePos(m_pBtnDuribility->GetRect().right - durabilityWnd->GetRect().GetWidth(), mapBottom);
|
|
}
|
|
}
|
|
|
|
pMiniMapWnd->SetRenderTarget(m_spMiniMapTexture);
|
|
|
|
// Adjust transparency in case of huge minimap
|
|
if (minimap) minimap->ChangeAlpha(0.8f);
|
|
if (pMiniMapWnd) pMiniMapWnd->ChangeAlpha(0.8f);
|
|
|
|
int nPosX = minimap->GetRect().left + minimap->GetRect().GetWidth() / 2;
|
|
int nPosY = minimap->GetRect().top + minimap->GetRect().GetHeight() / 2;
|
|
|
|
if (KUIWnd* pCameraWnd = GetChild("minimap_cameraviewpoint"))
|
|
{
|
|
pCameraWnd->MovePos(nPosX - (pCameraWnd->GetRect().GetWidth() / 2), nPosY - (pCameraWnd->GetRect().GetHeight() / 2));
|
|
}
|
|
|
|
if (KUIWnd* pPlayerWnd = GetChild("minimap_playerviewpoint"))
|
|
{
|
|
pPlayerWnd->MovePos(nPosX - (pPlayerWnd->GetRect().GetWidth() / 2), nPosY - (pPlayerWnd->GetRect().GetHeight() / 2));
|
|
}
|
|
|
|
m_pBtnDuribility->SetShow(true); // Showing durability button, so it would appear (because at case 3, the huge map, it vanishes)
|
|
|
|
|
|
}
|
|
break;
|
|
|
|
default: // Other cases
|
|
{
|
|
|
|
}
|
|
break;
|
|
}
|
|
|
|
_oprint("[map_zoomout] [after] m_nMiniMapSize: %i; zoomFactor: %f; NEW RECT: %i/%i/%i/%i; minimap NEW RECT: %i/%i/%i/%i; \n", m_nMiniMapSize, (m_fZoomType / 2.85f), m_pMapFrame->GetRect().top, m_pMapFrame->GetRect().bottom, m_pMapFrame->GetRect().left, m_pMapFrame->GetRect().right, minimap->GetRect().top, minimap->GetRect().bottom, minimap->GetRect().left, minimap->GetRect().right);
|
|
|
|
// Post-process
|
|
RefreshMap(true);
|
|
RefreshNPC();
|
|
|
|
break;
|
|
}
|
|
else if (::_stricmp(lpszControlID, "map_zoomin") == 0) // Increase minimap size
|
|
{
|
|
if (m_nMiniMapSize >= 3) break;
|
|
KUIWnd* minimap = GetChild("minimap");
|
|
KUIControlMiniMapStatic* pMiniMapWnd = dynamicCast<KUIControlMiniMapStatic*>(GetChild("minimap"));
|
|
|
|
if (minimap == NULL || pMiniMapWnd == NULL || m_pMapFrame == NULL) break;
|
|
|
|
_oprint("[map_zoomin] [before] m_nMiniMapSize: %i; zoomFactor: %f; OLD RECT: %i/%i/%i/%i; Minimap old RECT: %i/%i/%i/%i; ", m_nMiniMapSize, (m_fZoomType / 2.85f), m_pMapFrame->GetRect().top, m_pMapFrame->GetRect().bottom, m_pMapFrame->GetRect().left, m_pMapFrame->GetRect().right, minimap->GetRect().top, minimap->GetRect().bottom, minimap->GetRect().left, minimap->GetRect().right);
|
|
|
|
switch (m_nMiniMapSize)
|
|
{
|
|
case 0: // Calling zoomin when minimap is collapsed
|
|
{
|
|
m_nMiniMapSize += 1;
|
|
|
|
// Minimap is collapsed, so we're uncollapsing it here
|
|
m_pMapFrame->SetShow(true);
|
|
minimap->SetShow(true);
|
|
pMiniMapWnd->SetShow(true);
|
|
m_bMiniMapShow = true;
|
|
|
|
// Increase the size based on m_fZoomType
|
|
float zoomFactor = m_fZoomType / 2.85f;
|
|
int newWidth = static_cast<int>(c_nMapPerTileW * zoomFactor);
|
|
int newHeight = static_cast<int>(c_nMapPerTileH * zoomFactor);
|
|
|
|
KRect currentFrameRect = m_pMapFrame->GetRect();
|
|
KRect currentMinimapRect = minimap->GetRect();
|
|
|
|
KRect newFrameSize = KRect(currentFrameRect.left - (newWidth / 20), currentFrameRect.top, currentFrameRect.right, currentFrameRect.bottom + (newHeight / 20) );
|
|
KRect newMinimapSize = KRect(currentMinimapRect.left - (newWidth / 20), currentMinimapRect.top, currentMinimapRect.right, currentMinimapRect.bottom + (newHeight / 20) );
|
|
|
|
m_pMapFrame->Resize(newFrameSize);
|
|
|
|
minimap->SetRect(newMinimapSize);
|
|
|
|
|
|
|
|
// Since minimap is collapsed, here will be no map frame ( m_pMapFrame ), so we are binding durability array to the button
|
|
if (m_pBtnDuribility && m_pMapFrame)
|
|
{
|
|
m_pBtnDuribility->MovePos(GetRect().right - m_pBtnDuribility->GetRect().GetWidth(), (m_pMapFrame->GetRect().bottom + 4));
|
|
}
|
|
|
|
if (SUIWnd* durabilityWnd = m_pGameManager->GetGameInterface()->GetUIWindow(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DURABILITY))
|
|
{
|
|
if (m_bShowDurability)
|
|
{
|
|
durabilityWnd->MovePos(m_pBtnDuribility->GetRect().right - durabilityWnd->GetRect().GetWidth(), (m_pBtnDuribility->GetRect().bottom + 4));
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
|
|
case 1: // Calling zoomin when minimap is normal (size == 1)
|
|
{
|
|
m_nMiniMapSize += 1;
|
|
|
|
// Increase the size based on m_fZoomType
|
|
float zoomFactor = m_fZoomType / 2.85f;
|
|
int newWidth = static_cast<int>(c_nMapPerTileW * zoomFactor);
|
|
int newHeight = static_cast<int>(c_nMapPerTileH * zoomFactor);
|
|
|
|
KRect currentFrameRect = m_pMapFrame->GetRect();
|
|
KRect currentMinimapRect = minimap->GetRect();
|
|
|
|
m_pMapFrame->Resize(KRect(currentFrameRect.left - (newWidth / 20), currentFrameRect.top, currentFrameRect.right, currentFrameRect.bottom + (newHeight / 20)));
|
|
|
|
minimap->SetRect(KRect(currentMinimapRect.left - (newWidth / 20), currentMinimapRect.top, currentMinimapRect.right, currentMinimapRect.bottom + (newHeight / 20)));
|
|
|
|
if (m_pBtnDuribility && m_pMapFrame)
|
|
{
|
|
m_pBtnDuribility->MovePos(GetRect().right - m_pBtnDuribility->GetRect().GetWidth(), m_pMapFrame->GetRect().bottom + 1);
|
|
}
|
|
|
|
if (SUIWnd* durabilityWnd = m_pGameManager->GetGameInterface()->GetUIWindow(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DURABILITY))
|
|
{
|
|
if (m_bShowDurability)
|
|
{
|
|
durabilityWnd->MovePos(m_pBtnDuribility->GetRect().right - durabilityWnd->GetRect().GetWidth(), (m_pBtnDuribility->GetRect().bottom + 4));
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
|
|
case 2: // Calling zoomin when minimap is big (size == 2)
|
|
{
|
|
m_nMiniMapSize += 1;
|
|
|
|
// Increase the size based on m_fZoomType
|
|
float zoomFactor = m_fZoomType / 2.85f;
|
|
int newWidth = static_cast<int>(c_nMapPerTileW * zoomFactor);
|
|
int newHeight = static_cast<int>(c_nMapPerTileH * zoomFactor);
|
|
|
|
KRect currentFrameRect = m_pMapFrame->GetRect();
|
|
KRect currentMinimapRect = minimap->GetRect();
|
|
|
|
m_pMapFrame->Resize(KRect(currentFrameRect.left - (newWidth / 20), currentFrameRect.top, currentFrameRect.right, currentFrameRect.bottom + (newHeight / 20)));
|
|
|
|
minimap->SetRect(KRect(currentMinimapRect.left - (newWidth / 20), currentMinimapRect.top, currentMinimapRect.right, currentMinimapRect.bottom + (newHeight / 20)));
|
|
|
|
// Since it's 2nd, we are changing alpha directly here, because it will become huge (size 3) after this case
|
|
if (minimap) minimap->ChangeAlpha(0.8f);
|
|
if (pMiniMapWnd) pMiniMapWnd->ChangeAlpha(0.8f);
|
|
|
|
if (SUIWnd* durabilityWnd = m_pGameManager->GetGameInterface()->GetUIWindow(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DURABILITY))
|
|
{
|
|
durabilityWnd->MovePos(m_pMapFrame->GetRect().right - durabilityWnd->GetRect().GetWidth(), (m_pMapFrame->GetRect().bottom + 4));
|
|
}
|
|
|
|
m_pBtnDuribility->SetShow(false); // Hiding a button like in original
|
|
|
|
}
|
|
break;
|
|
|
|
case 3: // Calling zoomin when minimap is huge (size == 3) (Actually it shouldnt even trigger)
|
|
{
|
|
// Increase the size based on m_fZoomType
|
|
float zoomFactor = m_fZoomType / 2.85f;
|
|
int newWidth = static_cast<int>(c_nMapPerTileW * zoomFactor);
|
|
int newHeight = static_cast<int>(c_nMapPerTileH * zoomFactor);
|
|
|
|
KRect currentFrameRect = m_pMapFrame->GetRect();
|
|
KRect currentMinimapRect = minimap->GetRect();
|
|
|
|
m_pMapFrame->Resize(KRect(currentFrameRect.left - (newWidth / 20), currentFrameRect.top, currentFrameRect.right, currentFrameRect.bottom + (newHeight / 20)));
|
|
|
|
minimap->SetRect(KRect(currentMinimapRect.left - (newWidth / 20), currentMinimapRect.top, currentMinimapRect.right, currentMinimapRect.bottom + (newHeight / 20)));
|
|
|
|
// Shouldn't be anything in case of huge map, but we are hiding a button like in original just in case
|
|
m_pBtnDuribility->SetShow(false);
|
|
|
|
if (SUIWnd* durabilityWnd = m_pGameManager->GetGameInterface()->GetUIWindow(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DURABILITY))
|
|
{
|
|
durabilityWnd->MovePos(m_pMapFrame->GetRect().right - durabilityWnd->GetRect().GetWidth(), (m_pMapFrame->GetRect().bottom + 4));
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
|
|
_oprint("[map_zoomin] [after] m_nMiniMapSize: %i; zoomFactor: %f; NEW RECT: %i/%i/%i/%i; minimap NEW RECT: %i/%i/%i/%i; \n", m_nMiniMapSize, (m_fZoomType / 2.85f), m_pMapFrame->GetRect().top, m_pMapFrame->GetRect().bottom, m_pMapFrame->GetRect().left, m_pMapFrame->GetRect().right, minimap->GetRect().top, minimap->GetRect().bottom, minimap->GetRect().left, minimap->GetRect().right);
|
|
|
|
|
|
|
|
pMiniMapWnd->SetRenderTarget(m_spMiniMapTexture);
|
|
|
|
|
|
int nPosX = minimap->GetRect().left + minimap->GetRect().GetWidth() / 2;
|
|
int nPosY = minimap->GetRect().top + minimap->GetRect().GetHeight() / 2;
|
|
|
|
if (KUIWnd* pCameraWnd = GetChild("minimap_cameraviewpoint"))
|
|
{
|
|
pCameraWnd->MovePos(nPosX - (pCameraWnd->GetRect().GetWidth() / 2), nPosY - (pCameraWnd->GetRect().GetHeight() / 2));
|
|
}
|
|
|
|
if (KUIWnd* pPlayerWnd = GetChild("minimap_playerviewpoint"))
|
|
{
|
|
pPlayerWnd->MovePos(nPosX - (pPlayerWnd->GetRect().GetWidth() / 2), nPosY - (pPlayerWnd->GetRect().GetHeight() / 2));
|
|
}
|
|
|
|
RefreshMap(true);
|
|
RefreshNPC();
|
|
|
|
break;
|
|
}
|
|
else if (::_stricmp(lpszControlID, "zoomout") == 0)
|
|
{
|
|
zoomout();
|
|
RefreshMap(true);
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
|
|
case KUI_MESSAGE::KMINIMAP_PRESSING:
|
|
{
|
|
if (::_stricmp(lpszControlID, "minimap") == 0)
|
|
{
|
|
m_dwAlphaTime = m_dwTime;
|
|
return;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
|
|
SUIWnd::PumpUpMessage(lpszControlID, nMessage, lparam, wparam);
|
|
}
|
|
|
|
void SUIMinimapWnd::Process(DWORD dwTime)
|
|
{
|
|
KUIWnd::Process(dwTime);
|
|
DWORD elapsedtime = 0;
|
|
if (m_dwTime)
|
|
elapsedtime = dwTime - m_dwTime;
|
|
|
|
m_dwTime = dwTime;
|
|
|
|
float fAlphaValue(0.0f);
|
|
bool bChangeAlphaComplete(false);
|
|
|
|
if (m_dwAlphaTime != 0)
|
|
{
|
|
if (m_bColse) //Close
|
|
{
|
|
float fTempAlphaValue = m_fZoomAlphaValue - (float(dwTime - m_dwAlphaTime)) / 500.f;
|
|
fAlphaValue = max(fTempAlphaValue, 0.f);
|
|
if (fAlphaValue <= 0.f)
|
|
{
|
|
m_dwAlphaTime = 0;
|
|
if (m_pZoomMiniMapWnd) m_pZoomMiniMapWnd->SetShow(false);
|
|
}
|
|
}
|
|
else //Open
|
|
{
|
|
float fTempAlphaValue = (float(dwTime - m_dwAlphaTime)) / 500.f;
|
|
fAlphaValue = min(fTempAlphaValue, m_fZoomAlphaValue);
|
|
if (fAlphaValue >= m_fZoomAlphaValue)
|
|
{
|
|
m_dwAlphaTime = 0;
|
|
}
|
|
}
|
|
|
|
if (m_pZoomMiniMapWnd)
|
|
m_pZoomMiniMapWnd->ChangeAlpha(fAlphaValue);
|
|
}
|
|
#ifdef _KUI_INVALIDATION
|
|
// { [sonador]
|
|
InvalidateWnd();
|
|
// }
|
|
#endif
|
|
|
|
procQuestIcon(); /// 2011.08.17 - prodongi
|
|
|
|
float e = (float)elapsedtime / 1000.0f;
|
|
if (!m_raidInfoUpdateTime.update(e))
|
|
{
|
|
m_raidInfoUpdateTime.begin(0.5f, true); /// m_elapsedTimeہ» 0ہ¸·خ أت±âب اد±â ہ§اط¼
|
|
procRaidInfoList();
|
|
procPropList();
|
|
}
|
|
if (!m_bMiniMapShow)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
if (dwTime - m_dwPlayerPointTime > MINIMAPSIGNTIME)
|
|
{
|
|
|
|
SetChildShow("minimap_playerviewpoint", m_bPointSign);
|
|
m_bPointSign = !m_bPointSign;
|
|
m_dwPlayerPointTime = dwTime;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
K3DTexture* SUIMinimapWnd::GetMiniMapTexture(const char* pTexName, bool bIsLogin) {
|
|
if (strlen(pTexName) <= 0) return nullptr;
|
|
|
|
DWORD cur_time = GetSafeTickCount();
|
|
|
|
// Check if the texture is already loaded
|
|
K3DTexture* pCache = nullptr;
|
|
if (m_hsLoadedMapTexture.lookup(pTexName, pCache)) {
|
|
pCache->SetLoadedTime(cur_time);
|
|
return pCache;
|
|
}
|
|
|
|
// If not loaded, load the texture
|
|
if (bIsLogin) {
|
|
KStream* stream = KFileManager::Instance().CreateStreamFromResource(pTexName);
|
|
if (!stream) return nullptr;
|
|
|
|
K3DTextureDX* pSrcTex = new K3DTextureDX(s_pDevice);
|
|
pSrcTex->SetName(pTexName);
|
|
pSrcTex->Initialize(*stream, 0, D3DPOOL_DEFAULT, K3DFMT_A8R8G8B8);
|
|
pSrcTex->SetLoadedTime(cur_time);
|
|
s_pDevice->AddLostTexture(pSrcTex);
|
|
|
|
m_vtLoadedMapTexture.push_back(K3DTextureSPtr(pSrcTex));
|
|
m_hsLoadedMapTexture.add(pSrcTex->GetName(), pSrcTex);
|
|
|
|
KFileManager::Instance().DeleteStream(stream);
|
|
return pSrcTex;
|
|
}
|
|
else {
|
|
PendLoading(pTexName);
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
|
|
|
|
void SUIMinimapWnd::updateMap(bool bIsLogin, K3DTexture* pDst, std::vector< XMiniMap::DrawInfo >& vInfo, int nLocalIndexX, int nLocalIndexY, int nImgWidth, int nImgHeight)
|
|
{
|
|
for (size_t i = 0; i < vInfo.size(); ++i)
|
|
{
|
|
if (vInfo[i].x >= 192 || vInfo[i].y >= 256) continue;
|
|
if (vInfo[i].x < 0 || vInfo[i].y < 0) continue;
|
|
|
|
if (m_zoom_map_type == 1)
|
|
{
|
|
int nMapX_Index = vInfo[i].x / MAP_PER_TILE_COUNT; //MAP_PER_TILE_COUNTہ؛ ار ¸ت؟، µé¾î°،´آ ¹ج´د¸ت إ¸ہد °¹¼ِ
|
|
int nMapY_Index = vInfo[i].y / MAP_PER_TILE_COUNT; //MAP_PER_TILE_COUNTہ؛ ار ¸ت؟، µé¾î°،´آ ¹ج´د¸ت إ¸ہد °¹¼ِ
|
|
|
|
if (nLocalIndexX != nMapX_Index || nLocalIndexY != nMapY_Index) continue;
|
|
}
|
|
|
|
K3DTexture* pTex = GetMiniMapTexture(GetMapMiniName(vInfo[i].x, vInfo[i].y).c_str(), bIsLogin);
|
|
if (!pTex) continue;
|
|
|
|
if (pTex->GetWidth() < c_nTileLen) continue;
|
|
if (pTex->GetHeight() < c_nTileLen) continue;
|
|
|
|
RECT src, dst;
|
|
src.left = vInfo[i].from_x;
|
|
src.top = vInfo[i].from_y;
|
|
src.right = vInfo[i].from_x + vInfo[i].from_width;
|
|
src.bottom = vInfo[i].from_y + vInfo[i].from_height; // ¾َ¸¸إہ»
|
|
|
|
dst.left = vInfo[i].to_x;
|
|
dst.top = vInfo[i].to_y;
|
|
dst.right = vInfo[i].to_x + vInfo[i].to_width;
|
|
dst.bottom = vInfo[i].to_y + vInfo[i].to_height;
|
|
|
|
// if(dst.bottom == 0)
|
|
// {
|
|
// char buf[512];
|
|
// sprintf_s(buf, "src l=%d t=%d r=%d b=%d || dst l=%d t=%d r=%d b=%d\n", src.left, src.top, src.right, src.bottom, dst.left, dst.top, dst.right, dst.bottom);
|
|
// OutputDebugString(buf);
|
|
// }
|
|
|
|
// 2011.12.01 - servantes : (src.bottom-src.top) < 0 , (dst.bottom-dst.top) <= 0ء¶°ا ء¦°إ
|
|
// if( (src.right-src.left) <= 0 || (src.bottom-src.top) <= 0 || (dst.right-dst.left) <= 0 || (dst.bottom-dst.top) <= 0 )
|
|
// if( (src.right-src.left) <= 0 || (dst.right-dst.left) <= 0 )
|
|
if ((src.right - src.left) < 0 || (src.bottom - src.top) < 0 || (dst.right - dst.left) < 0 || (dst.bottom - dst.top) < 0)
|
|
{
|
|
// assert(0 && "Invalid Rect: zero-area" );
|
|
continue;
|
|
}
|
|
|
|
// if( src.right <= 0 || src.bottom <= 0 )
|
|
if (src.right < 0 || src.bottom < 0)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
// if( dst.right <= 0 || dst.bottom <= 0 )
|
|
if (dst.right < 0 || dst.bottom < 0)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
if (dst.left >= nImgWidth)
|
|
{
|
|
// assert(0);
|
|
continue;
|
|
}
|
|
|
|
if (dst.right > nImgWidth)
|
|
{
|
|
int nDiff = dst.right - nImgWidth;
|
|
float fDiff = (float(nDiff) / nImgWidth);
|
|
|
|
float fSrcDiff = fDiff * pTex->GetWidth();
|
|
|
|
dst.right = nImgWidth;
|
|
src.right -= fSrcDiff;
|
|
|
|
// assert(0);
|
|
// continue;
|
|
}
|
|
|
|
if (dst.top >= nImgHeight)
|
|
{
|
|
// assert(0);
|
|
continue;
|
|
}
|
|
|
|
if (dst.bottom > nImgHeight)
|
|
{
|
|
// assert(0);
|
|
int nDiff = dst.bottom - nImgHeight;
|
|
float fDiff = (float(nDiff) / nImgHeight);
|
|
|
|
float fSrcDiff = fDiff * pTex->GetHeight();
|
|
|
|
dst.bottom = nImgHeight;
|
|
src.bottom -= fSrcDiff;
|
|
}
|
|
|
|
// if(dst.bottom == 0)
|
|
// {
|
|
// char buf[512];
|
|
// sprintf_s(buf, "===2=== src l=%d t=%d r=%d b=%d || dst l=%d t=%d r=%d b=%d\n", src.left, src.top, src.right, src.bottom, dst.left, dst.top, dst.right, dst.bottom);
|
|
// OutputDebugString(buf);
|
|
// }
|
|
|
|
if (s_pDevice->StretchRect(pTex, &src, pDst, &dst) != D3D_OK)
|
|
{
|
|
assert(0);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void SUIMinimapWnd::RefreshMap(bool bIsLogin/*=false*/)
|
|
{
|
|
DWORD dwCurTime = GetSafeTickCount();
|
|
|
|
if (!bIsLogin && !s_bIsThreadLoading && !s_bIsThreadPending && !s_lstThreadLoadingMinimap.empty())
|
|
{
|
|
K3DTexture* pTex = NULL;
|
|
while (!s_lstThreadLoadingMinimap.empty())
|
|
{
|
|
pTex = s_lstThreadLoadingMinimap.front();
|
|
s_lstThreadLoadingMinimap.pop_front();
|
|
|
|
// _performance_print( "MiniMap RefreshMap %s\n", pTex->GetName() );
|
|
|
|
K3DTexture* pFindTex = NULL;
|
|
if (m_hsLoadedMapTexture.lookup(pTex->GetName(), pFindTex))
|
|
{
|
|
//ہج¹ج ·خµù ؟د·ل µب °و؟ى
|
|
pTex->Discard();
|
|
continue;
|
|
}
|
|
|
|
m_vtLoadedMapTexture.push_back(K3DTextureSPtr(pTex));
|
|
m_hsLoadedMapTexture.add(pTex->GetName(), pTex);
|
|
}
|
|
}
|
|
|
|
KUIWnd* pX = GetChild("static05"); //<#ffd200><left><vcenter><font:µ¸؟ٍ>000.0
|
|
KUIWnd* pY = GetChild("static08"); //<#ffd200><left><vcenter><font:µ¸؟ٍ>000.0
|
|
|
|
float fPosX, fPosY;
|
|
fPosX = fPosY = 0.f;
|
|
if (m_zoom_map_type == 1)
|
|
{
|
|
fPosX = m_display_positoin_x / 2000.f;
|
|
fPosY = m_display_positoin_y / 2000.f;
|
|
}
|
|
else
|
|
{
|
|
fPosX = m_nPlayerRealPosX / 2000.f;
|
|
fPosY = m_nPlayerRealPosY / 2000.f;
|
|
}
|
|
|
|
if (pX) pX->SetCaption(CStringUtil::StringFormat("<#ffd200><left><vcenter>%s%03.01f", S(6425), fPosX).c_str());
|
|
if (pY) pY->SetCaption(CStringUtil::StringFormat("<#ffd200><left><vcenter>%s%03.01f", S(6425), fPosY).c_str());
|
|
if (g_GMDEV)
|
|
SetChildCaption("static_local_text", CStringUtil::StringFormat("<#ffd200><size:10><hcenter><vcenter>pos : %d %d", m_nPlayerRealPosX, m_nPlayerRealPosY).c_str());
|
|
std::vector< XMiniMap::DrawInfo > vInfo;
|
|
m_MiniMap.GetDrawInfo(m_nPlayerRealPosX, m_nPlayerRealPosY, vInfo);
|
|
|
|
int nLocalIndexX = m_nPlayerRealPosX / 16128;
|
|
int nLocalIndexY = m_nPlayerRealPosY / 16128;
|
|
|
|
if (m_zoom_map_type == 1)
|
|
{
|
|
FillMiniMap();
|
|
}
|
|
|
|
updateMap(bIsLogin, m_spMiniMapTexture, vInfo, nLocalIndexX, nLocalIndexY, m_MiniMap.GetMapImageWidth(), m_MiniMap.GetMapImageHeight());
|
|
|
|
vInfo.clear();
|
|
|
|
if (m_pZoomMiniMapWnd && m_pZoomMiniMapWnd->IsShow())
|
|
{
|
|
//vInfo.erase( vInfo.begin(), vInfo.end() );
|
|
//m_ZoomMiniMap.GetDrawInfo( m_nPlayerRealPosX, m_nPlayerRealPosY, vInfo );
|
|
//updateMap( bIsLogin, m_spZoomMiniMapTexture, vInfo, nLocalIndexX, nLocalIndexY, m_ZoomMiniMap.GetMapImageWidth(), m_ZoomMiniMap.GetMapImageHeight() );
|
|
|
|
std::vector< XMiniMap::DrawInfo > vZoomInfo;
|
|
m_ZoomMiniMap.GetDrawInfo(m_nPlayerRealPosX, m_nPlayerRealPosY, vZoomInfo);
|
|
|
|
// 2011.12.01 - servantes : µً¹ِ±ë
|
|
int nCount = (int)vZoomInfo.size();
|
|
char buf[64];
|
|
sprintf_s(buf, "draw count = %d\n", nCount);
|
|
::OutputDebugString(buf);
|
|
|
|
updateMap(bIsLogin, m_spZoomMiniMapTexture, vZoomInfo, nLocalIndexX, nLocalIndexY, m_ZoomMiniMap.GetMapImageWidth(), m_ZoomMiniMap.GetMapImageHeight());
|
|
vZoomInfo.clear();
|
|
}
|
|
|
|
// ؟ہ·،µب ¹ج´د¸ت إط½؛أ³ »èء¦
|
|
if (m_dwLastDeleteTime + MINIMAP_LIFE < dwCurTime)
|
|
{
|
|
int nCnt = 0;
|
|
//؟ہ·،µب ا׸ٌ °ث»ç.
|
|
std::vector< K3DTextureSPtr>::iterator it = m_vtLoadedMapTexture.begin();
|
|
for (; it != m_vtLoadedMapTexture.end(); )
|
|
{
|
|
if (nCnt > 4) break; //5°³±îءِ¸¸ ءِ؟î´ظ. delete ء¦ار
|
|
|
|
const K3DTextureSPtr& spSrc = (*it);
|
|
if (dwCurTime - spSrc->GetLoadedTime() > MINIMAP_LIFE)
|
|
{
|
|
m_hsLoadedMapTexture.erase((*it)->GetName());
|
|
|
|
ReleaseTexture((*it));
|
|
|
|
it = m_vtLoadedMapTexture.erase(it);
|
|
|
|
nCnt++;
|
|
}
|
|
else
|
|
it++;
|
|
}
|
|
|
|
m_dwLastDeleteTime = dwCurTime;
|
|
}
|
|
|
|
m_dwLastDrawTime = dwCurTime;
|
|
}
|
|
|
|
void SUIMinimapWnd::RefreshLocalName()
|
|
{
|
|
std::string strMsg;
|
|
SPlayerInfo& info = m_PlayerInfoMgr.GetPlayerInfo();
|
|
// 2010.06.15 - prodongi
|
|
if (m_isDeathMatch)
|
|
{
|
|
strMsg = CStringUtil::StringFormat("<font:font_02><size:10><hcenter><vcenter>%s #%02d", m_LocalName.c_str(), info.GetChannel()).c_str();
|
|
}
|
|
// { [sonador][7.0.3] ¹ج´د¸ت أ¤³خ ہج¸§ أâ·آ ؟ہ·ù ¼ِء¤
|
|
// 2010.06.15 - prodongi
|
|
//if( m_nCurrentLocation == PLAYER_IN_DUNGEON ||
|
|
else if (m_nCurrentLocation == PLAYER_IN_DUNGEON ||
|
|
m_nCurrentLocation == PLAYER_IN_DUNGEON_SIEGE ||
|
|
m_nCurrentLocation == PLAYER_IN_DUNGEON_RAID)
|
|
// }
|
|
{
|
|
//ہد¹ف ´ّہü 0
|
|
//½أءî ´ّہü 1
|
|
//·¹ہجµه ´ّہü 2~254
|
|
//°ü¸® ´ّہü 255
|
|
if (info.GetChannel() > 0)
|
|
{
|
|
if (info.GetChannel() == 255)
|
|
strMsg = CStringUtil::StringFormat("<font:font_02><size:10><hcenter><vcenter>%s %s", m_LocalName.c_str(), S(6417)).c_str(); //°ü¸®
|
|
else if (info.GetChannel() == 1)
|
|
strMsg = CStringUtil::StringFormat("<font:font_02><size:10><hcenter><vcenter>%s %s", m_LocalName.c_str(), S(6419)).c_str(); //½أءî
|
|
else
|
|
strMsg = CStringUtil::StringFormat("<font:font_02><size:10><hcenter><vcenter>%s #%02d %s", m_LocalName.c_str(), info.GetChannel(), S(6418)).c_str(); //·¹ہجµه
|
|
}
|
|
else
|
|
strMsg = CStringUtil::StringFormat("<font:font_02><size:10><hcenter><vcenter>%s", m_LocalName.c_str()).c_str();
|
|
}
|
|
else if (m_nCurrentLocation == PLAYER_IN_INSTANCE_DUNGEON_AUTO) // 2011.07.19 - servantes
|
|
{
|
|
strMsg = CStringUtil::StringFormat("<font:font_02><size:10><hcenter><vcenter>%s #%02d", m_LocalName.c_str(), info.GetChannel()).c_str();
|
|
}
|
|
else
|
|
{
|
|
if (info.GetChannel() > 0)
|
|
strMsg = CStringUtil::StringFormat("<font:font_02><size:10><hcenter><vcenter>%s #%02d", m_LocalName.c_str(), info.GetChannel()).c_str();
|
|
else
|
|
strMsg = CStringUtil::StringFormat("<font:font_02><size:10><hcenter><vcenter>%s", m_LocalName.c_str()).c_str();
|
|
}
|
|
|
|
SetChildCaption("static_local_text", strMsg.c_str());
|
|
}
|
|
|
|
void SUIMinimapWnd::AddNpcInstanceInfo(const _NPC_INSTANCE_INFO_& info)
|
|
{
|
|
for (unsigned int i(0); m_vNpcInstanceList.size() > i; i++)
|
|
{
|
|
if (m_vNpcInstanceList[i].handle == info.handle)
|
|
return;
|
|
}
|
|
|
|
_NPC_INSTANCE_INFO_ add_info;
|
|
add_info.handle = info.handle;
|
|
add_info.npc_id = info.npc_id;
|
|
add_info.status = info.status;
|
|
|
|
m_vNpcInstanceList.push_back(add_info);
|
|
}
|
|
|
|
/// 2011.03.18 - prodongi
|
|
void ChangeIcon(KUIControlIconStatic* pNPC, unsigned status, unsigned int type)
|
|
{
|
|
if (pNPC == NULL) return;
|
|
|
|
/// 2011.03.02 - prodongi
|
|
std::string iconName;
|
|
getNpcIconAniName(iconName, type, status);
|
|
pNPC->SetIcon("ui_frame.spr", iconName.c_str());
|
|
/*
|
|
if( status == 0 )
|
|
{
|
|
pNPC->SetIcon( "ui_frame.spr", "common_mark_minimap_npc" );
|
|
return;
|
|
}
|
|
|
|
if( status & TS_ENTER::NPCInfo::FLAG_HAS_STARTABLE_QUEST )
|
|
{
|
|
pNPC->SetIcon( "ui_frame.spr", "common_mark_minimap_npc_quest01" );
|
|
// m_bQuestFlag[0] = true;
|
|
}
|
|
|
|
if( status & TS_ENTER::NPCInfo::FLAG_HAS_IN_PROGRESS_QUEST )
|
|
{
|
|
pNPC->SetIcon( "ui_frame.spr", "common_mark_minimap_npc_quest02" );
|
|
// m_bQuestFlag[1] = true;
|
|
}
|
|
|
|
if( status & TS_ENTER::NPCInfo::FLAG_HAS_FINISHABLE_QUEST )
|
|
{
|
|
pNPC->SetIcon( "ui_frame.spr", "common_mark_minimap_npc_quest03" );
|
|
// m_bQuestFlag[2] = true;
|
|
}
|
|
*/
|
|
}
|
|
|
|
void SUIMinimapWnd::UpdateNpcInstanceStatus(AR_HANDLE handle, unsigned status)
|
|
{
|
|
NPCMarker::MarkerInfo info;
|
|
if (m_npcMarker.getInfo(handle, info))
|
|
{
|
|
info.status = status;
|
|
m_npcMarker.modifyInfo(handle, info);
|
|
NPCMarker::Marker marker;
|
|
if (m_npcMarker.get(info.npc_id, marker))
|
|
{
|
|
/// 2011.03.18 - prodongi
|
|
ChangeIcon(dynamicCast< KUIControlIconStatic* >(marker.marker), status, marker.npcType);
|
|
ChangeIcon(dynamicCast< KUIControlIconStatic* >(marker.zoom_marker), status, marker.npcType);
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIMinimapWnd::ProcMsgAtStatic(SGameMessage* pMsg)
|
|
{
|
|
switch (pMsg->nType)
|
|
{
|
|
// ³»±¸µµأâ·آUI ؟ہاآ. ( ´ـأàإ°·خ ؟ہاآار °و؟ى ).
|
|
case IMSG_DURABILITY_TOGGLE:
|
|
ToggleDurability();
|
|
m_pBtnDuribility->SetAniName(g_szBtnDurability[m_bShowDurability]);
|
|
break;
|
|
|
|
// { [sonador][7.0.3] ¹ج´د¸ت أ¤³خ ہج¸§ أâ·آ ؟ہ·ù ¼ِء¤
|
|
case MSG_PROPERTY: //ہد´ـ ءض¼® IMSG_UI_DISPLAY_LOCAL_NAME ؟©±â¼ أ³¸®ار´ظ by metarrgear
|
|
{
|
|
SMSG_PROPERTY* pPropertyMsg = (SMSG_PROPERTY*)(pMsg);
|
|
if (pPropertyMsg->nPropertyType == SMSG_PROPERTY::PROPERTY_CHANNEL)
|
|
{
|
|
RefreshLocalName();
|
|
}
|
|
}
|
|
break;
|
|
// }
|
|
|
|
case IMSG_UI_CHANGE_WIN_ALPHA:
|
|
{
|
|
SIMSG_UI_CHANGE_WIN_ALPHA* pAlpha = dynamicCast<SIMSG_UI_CHANGE_WIN_ALPHA*>(pMsg);
|
|
if (m_pZoomMiniMapWnd)
|
|
{
|
|
m_pZoomMiniMapWnd->ChangeAlpha(pAlpha->fAlpha);
|
|
m_fZoomAlphaValue = pAlpha->fAlpha;
|
|
if (m_fZoomAlphaValue <= 0.f)
|
|
m_fZoomAlphaValue = 0.1f;
|
|
}
|
|
}
|
|
break;
|
|
|
|
case IMSG_UI_WARP_COMPLETE:
|
|
{
|
|
SIMSG_UI_WARP_COMPLETE* pData = (SIMSG_UI_WARP_COMPLETE*)pMsg;
|
|
|
|
m_nPlayerRealPosX = pData->nWarpX;
|
|
m_nPlayerRealPosY = pData->nWarpY;
|
|
RefreshMap(true);
|
|
RefreshMapPos();
|
|
RefreshPos();
|
|
}
|
|
break;
|
|
case IMSG_UI_SEND_DATA:
|
|
{
|
|
SIMSG_UI_SEND_DATA* pData = (SIMSG_UI_SEND_DATA*)pMsg;
|
|
|
|
if (pData->m_strString == "party_update")
|
|
{
|
|
RefreshPartyPlayer(m_vecPartyInfoList);
|
|
}
|
|
else if (pData->m_strString == "quest_list_updated")
|
|
{
|
|
refreshQuestIcon();
|
|
}
|
|
else if (pData->m_strString == "quest_status_updated")
|
|
{
|
|
refreshQuestIcon();
|
|
}
|
|
else if (pData->m_strString == "show_party_wnd2")
|
|
{
|
|
setRaidInfoShowStatus(pData->m_strText, true);
|
|
}
|
|
else if (pData->m_strString == "hide_party_wnd2")
|
|
{
|
|
setRaidInfoShowStatus(pData->m_strText, false);
|
|
}
|
|
}
|
|
break;
|
|
case IMSG_UI_DISPLAY_LOCAL_NAME:
|
|
{
|
|
SIMSG_UI_DISPLAY_LOCAL_NAME* pLocalNameMsg = (SIMSG_UI_DISPLAY_LOCAL_NAME*)pMsg;
|
|
m_LocalName = pLocalNameMsg->strLocalName;
|
|
// { [sonador][7.0.3] ¹ج´د¸ت أ¤³خ ہج¸§ أâ·آ ؟ہ·ù ¼ِء¤
|
|
m_nCurrentLocation = pLocalNameMsg->nCurrentLocation;
|
|
// 2010.06.15 - prodongi
|
|
m_isDeathMatch = pLocalNameMsg->bDeathMatch;
|
|
RefreshLocalName();
|
|
// }
|
|
}
|
|
break;
|
|
|
|
case MSG_ENTER:
|
|
{
|
|
SMSG_ENTER* pEnterMsg = (SMSG_ENTER*)pMsg;
|
|
if (pEnterMsg->ObjType == TS_ENTER::GAME_NPC)
|
|
{
|
|
SMSG_ENTER::NPCInfo* pNPCInfo = ((SMSG_ENTER::NPCInfo*)(pEnterMsg + 1));
|
|
|
|
NPCMarker::Marker marker;
|
|
if (m_npcMarker.get(pNPCInfo->npc_id, marker))
|
|
{
|
|
/// 2011.03.18 - prodongi
|
|
ChangeIcon(dynamicCast< KUIControlIconStatic* >(marker.marker), pNPCInfo->status, marker.npcType);
|
|
ChangeIcon(dynamicCast< KUIControlIconStatic* >(marker.zoom_marker), pNPCInfo->status, marker.npcType);
|
|
|
|
NPCMarker::MarkerInfo add_info;
|
|
add_info.handle = pEnterMsg->handle;
|
|
add_info.npc_id = pNPCInfo->npc_id;
|
|
add_info.status = pNPCInfo->status;
|
|
m_npcMarker.addInfo(add_info.handle, add_info);
|
|
}
|
|
}
|
|
/// 2011.08.17 - prodongi
|
|
else if (pEnterMsg->ObjType == TS_ENTER::GAME_MOB)
|
|
{
|
|
SMSG_ENTER::MonsterInfo* info = ((SMSG_ENTER::MonsterInfo*)(pEnterMsg + 1));
|
|
|
|
/// ´ّہüؤع¾î؟ح °ل°è¼®ہ؛ ¸÷ہ¸·خ ³¯¶َ؟آ´ظ. - prodongi
|
|
if (!insertQuestMob(pEnterMsg->handle, info->monster_id))
|
|
addPropListAtCoreConnector(pEnterMsg->handle, info->monster_id);
|
|
}
|
|
else if (pEnterMsg->ObjType == TS_ENTER::GAME_FIELD_PROP)
|
|
{
|
|
SMSG_ENTER::FieldPropInfo* info = ((SMSG_ENTER::FieldPropInfo*)(pEnterMsg + 1));
|
|
insertQuestProp(pEnterMsg->handle, info->prop_id);
|
|
|
|
addPropList(pEnterMsg->handle, info->prop_id);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case MSG_LEAVE:
|
|
{
|
|
SMSG_LEAVE* msg = dynamicCast<SMSG_LEAVE*>(pMsg);
|
|
if (msg)
|
|
{
|
|
removeQuestIcon(msg->handle);
|
|
|
|
delPropList(msg->handle);
|
|
}
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
|
|
case MSG_STATUS_CHANGE:
|
|
{
|
|
SMSG_STATUS_CHANGE* pStatus = (SMSG_STATUS_CHANGE*)pMsg;
|
|
|
|
UpdateNpcInstanceStatus(pStatus->handle, pStatus->status);
|
|
}
|
|
break;
|
|
|
|
case MSG_LOGIN:
|
|
{
|
|
if (!m_bIsLogin)
|
|
{
|
|
SMSG_LOGIN* pLoginMsg = (SMSG_LOGIN*)pMsg;
|
|
|
|
m_nPlayerRealPosX = pLoginMsg->x;
|
|
m_nPlayerRealPosY = pLoginMsg->y;
|
|
RefreshMap(true);
|
|
RefreshMapPos();
|
|
RefreshPos();
|
|
|
|
//Zoom °»½إ
|
|
std::vector< XMiniMap::DrawInfo > vInfo;
|
|
int nLocalIndexX = m_nPlayerRealPosX / 16128;
|
|
int nLocalIndexY = m_nPlayerRealPosY / 16128;
|
|
|
|
m_ZoomMiniMap.GetDrawInfo(m_nPlayerRealPosX, m_nPlayerRealPosY, vInfo);
|
|
updateMap(true, m_spZoomMiniMapTexture, vInfo, nLocalIndexX, nLocalIndexY, m_ZoomMiniMap.GetMapImageWidth(), m_ZoomMiniMap.GetMapImageHeight());
|
|
vInfo.clear();
|
|
|
|
m_bIsLogin = true;
|
|
}
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case IMSG_UI_2DPOS_INFO:
|
|
{
|
|
{
|
|
if (!m_bNpcDrawFlag)
|
|
{
|
|
m_bNpcDrawFlag = true;
|
|
RefreshNPC();
|
|
}
|
|
|
|
SIMSG_UI_2DPOS_INFO* p2DPosMsg = (SIMSG_UI_2DPOS_INFO*)pMsg;
|
|
|
|
switch (p2DPosMsg->nObjType)
|
|
{
|
|
case TY_MY:
|
|
{
|
|
if (!m_PlayerInfoMgr.IsLocalPlayer(p2DPosMsg->handle)) break;
|
|
SGameAvatarEx* pplayer = g_pCurrentGameSystem->GetLocalPlayer();
|
|
if (pplayer) p2DPosMsg->fRadian = pplayer->GetTargetRoll();
|
|
|
|
if (m_fRadian != p2DPosMsg->fRadian)
|
|
{
|
|
m_fRadian = p2DPosMsg->fRadian;
|
|
|
|
KUIWnd* pWnd = GetChild("minimap_playerviewpoint");
|
|
if (pWnd) ((KUIControlStatic*)pWnd)->SetRotate((PI / 2.f) - m_fRadian);
|
|
|
|
KUIWnd* pZoomWnd = GetChild("zoom_minimap_playerviewpoint");
|
|
if (pZoomWnd) ((KUIControlStatic*)pZoomWnd)->SetRotate((PI / 2.f) - m_fRadian);
|
|
}
|
|
|
|
|
|
//ءـہج ¾ئ´د¸é
|
|
if (!m_MiniMap.IsZooming())
|
|
{
|
|
if (m_nPlayerRealPosX == p2DPosMsg->nReal_X &&
|
|
m_nPlayerRealPosY == p2DPosMsg->nReal_Y)
|
|
return;
|
|
}
|
|
|
|
m_nPlayerRealPosX = p2DPosMsg->nReal_X;
|
|
m_nPlayerRealPosY = p2DPosMsg->nReal_Y;
|
|
|
|
RefreshMap();
|
|
RefreshMapPos();
|
|
RefreshPos();
|
|
RefreshLocal();
|
|
}
|
|
break;
|
|
case TY_PLAYER:
|
|
{
|
|
UpdatePlayerPos(p2DPosMsg->handle, m_vecPartyInfoList, p2DPosMsg->nReal_X, p2DPosMsg->nReal_Y); break;
|
|
}
|
|
case TY_NPC: break;
|
|
case TY_MOB: break;
|
|
}
|
|
}
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case IMSG_HOTKEY_EX:
|
|
{
|
|
SIMSG_HOTKEY_EX* pHotKeyEx = dynamicCast<SIMSG_HOTKEY_EX*>(pMsg);
|
|
if (GetGameKeymapping().GetHotKeyState(HOTKEYCODE::MINIMAPZOOMIN) == KEYSTATE::DOWN)
|
|
{
|
|
zoomin();
|
|
RefreshMap(true);
|
|
}
|
|
else if (GetGameKeymapping().GetHotKeyState(HOTKEYCODE::MINIMAPZOOMOUT) == KEYSTATE::DOWN)
|
|
{
|
|
zoomout();
|
|
RefreshMap(true);
|
|
}
|
|
|
|
break;
|
|
}
|
|
case IMSG_UI_MY_DEGREE:
|
|
{
|
|
RotatePlayer(((SIMSG_UI_MY_DEGREE*)pMsg)->fRadian);
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case IMSG_UI_MINIMAP_INFO:
|
|
{
|
|
|
|
RefreshNPC();
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
case MSG_CHATTING:
|
|
{
|
|
SMSG_CHATTING* pChatMsg = (SMSG_CHATTING*)pMsg;
|
|
|
|
if (pChatMsg->nChatType == CHAT_PARTY_SYSTEM)
|
|
{
|
|
std::vector<std::string> vecText;
|
|
MsgSplit(pChatMsg->strText.c_str(), vecText, L"|");
|
|
|
|
if (vecText.size() < 1) return;
|
|
|
|
|
|
// sonador 3.12.1 ئؤئ¼؟ّ ءآا¥ °»½إ ±â´ة أك°،
|
|
RefreshPartyPlayerList(vecText);
|
|
RefreshPartyPlayer(m_vecPartyInfoList);
|
|
RefreshLocal();
|
|
vecText.clear();
|
|
}
|
|
|
|
pMsg->bUse = true;
|
|
}
|
|
break;
|
|
|
|
case IMSG_UI_CHANGE_MAP_PROCESS:
|
|
{
|
|
SIMSG_UI_CHANGE_MAP_PROCESS* pChangeMapProcMsg = (SIMSG_UI_CHANGE_MAP_PROCESS*)pMsg;
|
|
|
|
m_zoom_map_type = pChangeMapProcMsg->m_zoom_map_type;
|
|
m_display_positoin_x = pChangeMapProcMsg->m_display_positoin_x;
|
|
m_display_positoin_y = pChangeMapProcMsg->m_display_positoin_y;
|
|
m_strBlank_resource = pChangeMapProcMsg->m_strBlank_resource;
|
|
m_blank_a = pChangeMapProcMsg->m_blank_a;
|
|
m_blank_r = pChangeMapProcMsg->m_blank_r;
|
|
m_blank_g = pChangeMapProcMsg->m_blank_g;
|
|
m_blank_b = pChangeMapProcMsg->m_blank_b;
|
|
|
|
m_fZoomMinimapZoomValue = (float)pChangeMapProcMsg->zoom_minimap;
|
|
|
|
m_ZoomMiniMap.ChangeMiniMapSize(c_nMapPerTileW * m_fZoomMinimapZoomValue, c_nMapPerTileH * m_fZoomMinimapZoomValue);
|
|
|
|
if (m_pNewTex == NULL)
|
|
{
|
|
if (KUITextureManager::GetHWType() == KUITextureManager::HW_SUPPORT)
|
|
{
|
|
m_pNewTex = KDeviceManager::GetDeviceManager()->GetRenderDevice()->CreateTexture(c_nTempTexSize, c_nTempTexSize, KUSAGE_DYNAMIC, K3DFMT_A8R8G8B8, D3DPOOL_DEFAULT);
|
|
}
|
|
else
|
|
{
|
|
//Intel Chip °è؟؟،¼ ءِ؟ّ ¾ب µا´آ ³رµéہج ہضہ½.
|
|
m_pNewTex = KDeviceManager::GetDeviceManager()->GetRenderDevice()->CreateTexture(c_nTempTexSize, c_nTempTexSize, K3DFMT_A8R8G8B8, D3DPOOL_MANAGED);
|
|
}
|
|
|
|
if (m_pNewTex && m_spMiniMapTexture)
|
|
{
|
|
m_pNewTex->AddRef();
|
|
|
|
char* pBuf = NULL;
|
|
int nStride;
|
|
|
|
m_pNewTex->LockRect(NULL, (void**)&pBuf, nStride);
|
|
if (pBuf == NULL)
|
|
{
|
|
m_pNewTex->Release();
|
|
m_pNewTex = NULL;
|
|
assert(0 && "WorldMapTexture Lock Failed!!!");
|
|
return;
|
|
}
|
|
|
|
KColor* pColor;
|
|
for (UINT y = 0; y < m_pNewTex->GetHeight(); y++)
|
|
{
|
|
pColor = (KColor*)pBuf;
|
|
for (UINT x = 0; x < m_pNewTex->GetWidth(); x++)
|
|
{
|
|
KColor col;
|
|
col.r = m_blank_r;
|
|
col.g = m_blank_g;
|
|
col.b = m_blank_b;
|
|
col.a = m_blank_a;
|
|
pColor[x] = col;
|
|
}
|
|
pBuf += nStride;
|
|
}
|
|
m_pNewTex->Unlock();
|
|
}
|
|
}
|
|
|
|
FillMiniMap();
|
|
|
|
RefreshMap(true);
|
|
}
|
|
break;
|
|
case IMSG_MOUSEMOVE:
|
|
{
|
|
SIMSG_MOUSEMOVE* pMouseMove = (SIMSG_MOUSEMOVE*)pMsg;
|
|
|
|
//½أ°£ ؤ«¸ق¶َ·خ ¹ظ²ظہع~
|
|
int x = ((int)(short)LOWORD(pMouseMove->lParam));
|
|
int y = ((int)(short)HIWORD(pMouseMove->lParam));
|
|
|
|
if (x > GetRect().left && x < GetRect().right &&
|
|
y > GetRect().top && y < GetRect().top + 25 /*GetRect().bottom*/)
|
|
{
|
|
}
|
|
else
|
|
{
|
|
if (m_bNotColse) return; //
|
|
|
|
if (m_bColse == false)
|
|
{
|
|
m_bColse = true;
|
|
m_dwAlphaTime = m_dwTime;
|
|
HideLocalInfo();
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
|
|
|
|
// اط»َµµ؛¯°و.
|
|
case IMSG_UI_CHANGE_RESOLUTION:
|
|
{
|
|
// ³»±¸µµأâ·آUI ہ§ؤ،¼³ء¤.
|
|
m_pGameManager->PostMsgAtDynamic(new SIMSG_UI_MOVE(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DURABILITY,
|
|
m_pBtnDuribility->GetRect().left,
|
|
m_pBtnDuribility->GetRect().bottom));
|
|
}
|
|
break;
|
|
|
|
}
|
|
}
|
|
|
|
DWORD SUIMinimapWnd::OnMouseMessage(DWORD dwMessage, int x, int y)
|
|
{
|
|
//SIMSG_MOUSEMOVE* pMouseMove = (SIMSG_MOUSEMOVE* )pMsg;
|
|
|
|
////½أ°£ ؤ«¸ق¶َ·خ ¹ظ²ظہع~
|
|
//int x = ((int)(short)LOWORD(pMouseMove->lParam));
|
|
//int y = ((int)(short)HIWORD(pMouseMove->lParam));
|
|
|
|
if (x > GetRect().left && x < GetRect().right &&
|
|
y > GetRect().top && y < GetRect().top + 25 /*GetRect().bottom*/)
|
|
{
|
|
//if (m_bColse == true)
|
|
//{
|
|
// m_bColse = false;
|
|
// m_dwAlphaTime = m_dwTime;
|
|
// m_pZoomMiniMapWnd->SetShow(true);
|
|
//
|
|
// std::vector< XMiniMap::DrawInfo > vInfo;
|
|
// int nLocalIndexX = m_nPlayerRealPosX / 16128;
|
|
// int nLocalIndexY = m_nPlayerRealPosY / 16128;
|
|
//
|
|
// m_ZoomMiniMap.GetDrawInfo(m_nPlayerRealPosX, m_nPlayerRealPosY, vInfo);
|
|
// updateMap(true, m_spZoomMiniMapTexture, vInfo, nLocalIndexX, nLocalIndexY, m_ZoomMiniMap.GetMapImageWidth(), m_ZoomMiniMap.GetMapImageHeight());
|
|
// vInfo.clear();
|
|
//
|
|
// if (m_pZoomMiniMapWnd)
|
|
// {
|
|
// RefreshLocal();
|
|
// }
|
|
//}
|
|
}
|
|
//else
|
|
//{
|
|
// if( m_bColse == false )
|
|
// {
|
|
// m_bColse = true;
|
|
// m_dwAlphaTime = m_dwTime;
|
|
// HideLocalInfo();
|
|
// }
|
|
//}
|
|
|
|
return SUIWnd::OnMouseMessage(dwMessage, x, y);
|
|
}
|
|
|
|
void SUIMinimapWnd::FillMiniMap()
|
|
{
|
|
if (m_pNewTex == NULL) return;
|
|
if (!m_pNewTex->IsValid()) return;
|
|
|
|
if (m_spMiniMapTexture == NULL) return;
|
|
if (!m_spMiniMapTexture->IsValid()) return;
|
|
|
|
RECT src, dst;
|
|
src.left = 0;
|
|
src.top = 0;
|
|
src.right = m_pNewTex->GetWidth();
|
|
src.bottom = m_pNewTex->GetHeight();
|
|
|
|
dst.left = 0;
|
|
dst.top = 0;
|
|
dst.right = m_spMiniMapTexture->GetWidth();
|
|
dst.bottom = m_spMiniMapTexture->GetHeight();
|
|
|
|
//Normal
|
|
if (s_pDevice->StretchRect(m_pNewTex, &src, m_spMiniMapTexture, &dst) != D3D_OK)
|
|
{
|
|
assert(0);
|
|
}
|
|
|
|
if (m_pZoomMiniMapWnd)
|
|
{
|
|
//Zoom
|
|
dst.left = 0;
|
|
dst.top = 0;
|
|
dst.right = m_spZoomMiniMapTexture->GetWidth();
|
|
dst.bottom = m_spZoomMiniMapTexture->GetHeight();
|
|
|
|
if (s_pDevice->StretchRect(m_pNewTex, &src, m_spZoomMiniMapTexture, &dst) != D3D_OK)
|
|
{
|
|
assert(0);
|
|
}
|
|
}
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// ¸ت ء¤؛¸
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void SUIMinimapWnd::RefreshMapPos()
|
|
{
|
|
//int nMapPosX = m_nPlayerRealPosX / m_fMapLen;
|
|
//int nMapPosY = m_nPlayerRealPosY / m_fMapLen;
|
|
|
|
//if( nMapPosX != m_nMapPosX || nMapPosY != m_nMapPosY )
|
|
//{
|
|
// m_nMapPosX = nMapPosX;
|
|
// m_nMapPosY = nMapPosY;
|
|
|
|
// RefreshMapName();
|
|
// RefreshMapImg();
|
|
//}
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// ہ§ؤ، °»½إ
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void SUIMinimapWnd::RefreshPos()
|
|
{
|
|
// اأ·¹ہج¾î ءآا¥ °»½إ
|
|
// UpdateMapUV( m_nPlayerRealPosX, m_nPlayerRealPosY );
|
|
// ¸َ½؛إح ءآا¥ °»½إ
|
|
RefreshNPC();
|
|
// ئؤئ¼؟ّ ءآا¥ °»½إ
|
|
RefreshPartyPlayer(m_vecPartyInfoList);
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// اأ·¹ہج¾î
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void SUIMinimapWnd::RotatePlayer(float fRadian)
|
|
{
|
|
KUIWnd* pWnd = GetChild("minimap_cameraviewpoint");
|
|
if (pWnd == NULL) return;
|
|
((KUIControlStatic*)pWnd)->SetRotate((PI / 2.f) - fRadian);
|
|
|
|
KUIWnd* pZoomWnd = GetChild("zoom_minimap_cameraviewpoint");
|
|
if (pZoomWnd == NULL) return;
|
|
((KUIControlStatic*)pZoomWnd)->SetRotate((PI / 2.f) - fRadian);
|
|
}
|
|
|
|
std::string SUIMinimapWnd::GetMapMiniName(int nMapX, int nMapY)
|
|
{
|
|
int nMapX_Index = nMapX / MAP_PER_TILE_COUNT; //MAP_PER_TILE_COUNTہ؛ ار ¸ت؟، µé¾î°،´آ ¹ج´د¸ت إ¸ہد °¹¼ِ
|
|
int nMapY_Index = nMapY / MAP_PER_TILE_COUNT; //MAP_PER_TILE_COUNTہ؛ ار ¸ت؟، µé¾î°،´آ ¹ج´د¸ت إ¸ہد °¹¼ِ
|
|
|
|
std::string strMapName, strResult;
|
|
strMapName = m_pSeamlessWorldInfo->GetMiniMapName(nMapX_Index, nMapY_Index);
|
|
|
|
int nTileX_Index = nMapY % MAP_PER_TILE_COUNT;
|
|
int nTileY_Index = nMapX % MAP_PER_TILE_COUNT;
|
|
|
|
strResult = CStringUtil::StringFormat("V256_%s_%d_%d.jpg", strMapName.c_str(), nTileX_Index, nTileY_Index);
|
|
|
|
if (!KFileManager::Instance().IsValidResource(strResult.c_str()))
|
|
strResult = "V256_M000_000_0_0.jpg"; //بہدہج ¾ّ´آ °و؟ى
|
|
return strResult;
|
|
}
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// npc
|
|
//////////////////////////////////////////////////////////////////////////
|
|
|
|
bool SUIMinimapWnd::TranslatePosition(int* nPosX, int* nPosY)
|
|
{
|
|
int nMapW = 16128 / 6; //¸ت اد³ھ´ç ½ا ¼¼°èہا إ©±â
|
|
int nMapH = 16128 / 6; //¸ت اد³ھ´ç ½ا ¼¼°èہا إ©±â
|
|
|
|
X2D::Rect< int > rect(m_nPlayerRealPosX - (nMapW * m_fZoomType / 2), m_nPlayerRealPosY - (nMapH * m_fZoomType / 2),
|
|
m_nPlayerRealPosX + (nMapW * m_fZoomType / 2), m_nPlayerRealPosY + (nMapH * m_fZoomType / 2));
|
|
|
|
// if( !rect.IsInclude( X2D::Point<int>( *nPosX, *nPosY ) ) ) return false;
|
|
|
|
KUIWnd* pMiniMapWnd = GetChild("minimap");
|
|
int nMiniMapWndWidth = pMiniMapWnd->GetRect().GetWidth(); //¹ج´د¸ت ہ©µµ؟ى إ©±â °،·خ
|
|
int nMiniMapWndHeight = pMiniMapWnd->GetRect().GetHeight(); //¹ج´د¸ت ہ©µµ؟ى إ©±â ¼¼·خ
|
|
|
|
nMiniMapWndHeight -= 38;
|
|
|
|
//Pos
|
|
int nX = *nPosX - m_nPlayerRealPosX + (c_nMapPerTileW * m_fZoomType / 2);
|
|
int nY = *nPosY - m_nPlayerRealPosY + (c_nMapPerTileH * m_fZoomType / 2);
|
|
nX = pMiniMapWnd->GetRect().left + (nX * nMiniMapWndWidth) / (c_nMapPerTileW * m_fZoomType);
|
|
nY = pMiniMapWnd->GetRect().GetHeight() - (GetRect().top + ((nY * nMiniMapWndHeight) / (c_nMapPerTileH * m_fZoomType)));
|
|
|
|
|
|
// nY += 10/m_fZoomType;
|
|
bool bIsOver_here = false;
|
|
/// 2011.01.12 - prodongi
|
|
//KRect bound(68, 28, -15, -92);
|
|
|
|
KRect bound(7, 28, -15, -15);
|
|
|
|
if (nY < (pMiniMapWnd->GetRect().top)) { nY = (pMiniMapWnd->GetRect().top); bIsOver_here = true; }
|
|
if (nY > (pMiniMapWnd->GetRect().bottom - 8)) { nY = (pMiniMapWnd->GetRect().bottom - 8); bIsOver_here = true; }
|
|
|
|
if (nX < (pMiniMapWnd->GetRect().left)) { nX = (pMiniMapWnd->GetRect().left); bIsOver_here = true; }
|
|
if (nX > (pMiniMapWnd->GetRect().right - 15)) { nX = (pMiniMapWnd->GetRect().right - 15); bIsOver_here = true; }
|
|
|
|
//؟ّ
|
|
//if( bIsOver_here )
|
|
//{
|
|
// K3DVector2 v1 = K3DVector2(nMyX,nMyY) - K3DVector2(nX,nY);
|
|
// v1.Normalize(80.f);
|
|
|
|
// *nPosX = nMyX + v1.x;// nX;
|
|
// *nPosY = nMyY + v1.y;// nY;
|
|
//}
|
|
//else
|
|
{
|
|
*nPosX = nX;
|
|
*nPosY = nY;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
bool SUIMinimapWnd::IsRenderNPC(ENC_INT id)
|
|
{
|
|
//std::string strCountry;
|
|
//strCountry = ENV().GetString("country");
|
|
|
|
NpcResourceBase* pNpcRes(NULL);
|
|
NpcEventPeriodResourceBase* pNpcPrdRes(NULL);
|
|
pNpcRes = GetNpcResourceDB().GetNpcInfo(id);
|
|
if (!pNpcRes) return false;
|
|
|
|
if (pNpcPrdRes = GetNpcResourceDB().GetNpcPeriodInfo(id))
|
|
{
|
|
time_t nowtime;
|
|
time(&nowtime);
|
|
if (pNpcPrdRes->begin_of_period > nowtime
|
|
|| pNpcPrdRes->end_of_period < nowtime)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
int nlocal_flag(pNpcRes->local_flag);
|
|
|
|
if ((GameRule::EXCLUDE_TEST_SERV & nlocal_flag) && (ENV().GetString("tserver") == "test"))
|
|
return false;
|
|
|
|
if ((GameRule::EXCLUDE_SERVICE_SERV & nlocal_flag) && (ENV().GetString("tserver") != "test"))
|
|
return false;
|
|
|
|
// Fraun test no npc render
|
|
if(ENV().GetInt("no_npc_render") == 1) return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
void SUIMinimapWnd::RefreshNPC()
|
|
{
|
|
KUIWnd* pWnd = GetChild("minimap");
|
|
if (pWnd == NULL) return;
|
|
|
|
std::vector<NPC_INFO>::iterator it = m_vecNPCInfoList.begin();
|
|
|
|
if (m_MiniMap.IsZooming())
|
|
{
|
|
m_npcMarker.disappearAll();
|
|
return;
|
|
}
|
|
|
|
int nLocalIndexX = m_nPlayerRealPosX / 16128;
|
|
int nLocalIndexY = m_nPlayerRealPosY / 16128;
|
|
if (!m_bMiniMapShow)
|
|
{
|
|
m_npcMarker.disappearAll();
|
|
return;
|
|
}
|
|
|
|
for (it = m_vecNPCInfoList.begin(); it != m_vecNPCInfoList.end(); ++it)
|
|
{
|
|
KUIWnd* pNPC = (*it).wnd;
|
|
if (!pNPC) continue;
|
|
|
|
pNPC->SetShow(false);
|
|
|
|
int nX = (*it).x;
|
|
int nY = (*it).y;
|
|
|
|
// إضافة شرط المسافة
|
|
const int MAX_RENDER_DISTANCE = 2500; // يمكنك تعديل هذه القيمة بناءً على احتياجات اللعبة //SHOW NPC IN MAP
|
|
int distanceX = abs(m_nPlayerRealPosX - nX);
|
|
int distanceY = abs(m_nPlayerRealPosY - nY);
|
|
if (distanceX > MAX_RENDER_DISTANCE || distanceY > MAX_RENDER_DISTANCE)
|
|
{
|
|
continue; // تخطي النقطة إذا كانت بعيدة جدًا
|
|
}
|
|
|
|
if (m_zoom_map_type == 1)
|
|
{
|
|
int nMapX_Index = nX / 16128;
|
|
int nMapY_Index = nY / 16128;
|
|
|
|
if (nLocalIndexX != nMapX_Index || nLocalIndexY != nMapY_Index) continue;
|
|
}
|
|
|
|
if ((*it).is_periodic)
|
|
{
|
|
time_t nowtime;
|
|
time(&nowtime);
|
|
|
|
if ((*it).begin_of_period > nowtime || (*it).end_of_period < nowtime)
|
|
(*it).is_render = false;
|
|
else
|
|
(*it).is_render = true;
|
|
}
|
|
|
|
if (!(*it).is_render)
|
|
pNPC->SetShow(false);
|
|
else if (!TranslatePosition(&nX, &nY))
|
|
pNPC->SetShow(false);
|
|
else
|
|
{
|
|
pNPC->MovePos(nX, nY);
|
|
pNPC->SetShow(true);
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIMinimapWnd::LoadNPCInfoFile()
|
|
{
|
|
/// 2011.06.07 npcµéہ» »¼؛اد±â ہü؟، topہ¸·خ ¼³ء¤ار´ظ(npc°، ´ُ ہ§·خ ؟ح¾ك µا±â ¶§¹®؟،)
|
|
SetChildAsTop("minimap_cameraviewpoint");
|
|
SetChildAsTop("minimap_playerviewpoint");
|
|
|
|
m_npcMarker.clear();
|
|
|
|
GetNpcResourceDB().EnumNPC(&m_vecNPCInfoList);
|
|
|
|
std::string iconName; /// 2011.03.18 - prodongi
|
|
std::string strName;
|
|
for (size_t i = 0; i < m_vecNPCInfoList.size(); i++)
|
|
{
|
|
// ·خ±× ات؟ناد¸é ب°¼؛ب اد¼¼؟ن
|
|
//_oprint( "LoadNPC %s %d %d\n", m_vecNPCInfoList[i].strName.c_str(), m_vecNPCInfoList[i].x, m_vecNPCInfoList[i].y );
|
|
|
|
if (IsRenderNPC(m_vecNPCInfoList[i].nID))
|
|
{
|
|
// ؤءئ®·ر »¼؛ار´ظ
|
|
/// 2011.03.02 - prodongi
|
|
getNpcIconAniName(iconName, m_vecNPCInfoList[i].type, 0); /// 2011.03.18 - prodongi
|
|
KUIWnd* pNewWnd = m_pManager->CreateControl(KUIWND_CREATE_ARG("iconstatic", m_vecNPCInfoList[i].strName.c_str(), " ", KRect(-1, -1, -1, -1), 0, 0, this, iconName.c_str(), "ui_frame.spr", m_pManager, 0, "", KANCHOR_LEFT | KANCHOR_TOP));
|
|
|
|
if (pNewWnd)
|
|
{
|
|
pNewWnd->SetShow(false);
|
|
((KUIControlIconStatic*)pNewWnd)->SetTooltip(m_vecNPCInfoList[i].strName.c_str());
|
|
}
|
|
|
|
XStringUtil::Format(strName, "%s_zoom", m_vecNPCInfoList[i].strName.c_str());
|
|
|
|
// Zoom ؤءئ®·ر »¼؛ار´ظ
|
|
/// 2011.03.02 - prodongi
|
|
KUIWnd* pZoomNewWnd = m_pManager->CreateControl(KUIWND_CREATE_ARG("iconstatic", strName.c_str(), " ", KRect(-1, -1, -1, -1), 0, 0, this, iconName.c_str(), "ui_frame.spr", m_pManager, 0, "", KANCHOR_LEFT | KANCHOR_TOP));
|
|
if (pZoomNewWnd)
|
|
{
|
|
pZoomNewWnd->SetShow(false);
|
|
((KUIControlIconStatic*)pZoomNewWnd)->SetTooltip(m_vecNPCInfoList[i].strName.c_str());
|
|
}
|
|
|
|
if (pNewWnd && pZoomNewWnd)
|
|
{
|
|
/// 2011.03.18 - prodongi
|
|
m_npcMarker.add(m_vecNPCInfoList[i].nID, (KUIControl*)pNewWnd, (KUIControl*)pZoomNewWnd, m_vecNPCInfoList[i].type);
|
|
}
|
|
|
|
m_vecNPCInfoList[i].is_render = true;//IsRenderNPC(m_vecNPCInfoList[i].nID );
|
|
m_vecNPCInfoList[i].wnd = pNewWnd;
|
|
m_vecNPCInfoList[i].zoomWnd = pZoomNewWnd;
|
|
//XStringUtil::Format( strName, "txt_%s", m_vecNPCInfoList[i].strName.c_str() );
|
|
}
|
|
|
|
//// Zoom ؤءئ®·ر »¼؛ار´ظ
|
|
//KUIWnd* pTxtNewWnd = m_pManager->CreateControl( KUIWND_CREATE_ARG( "static", strName.c_str(), " ", KRect( KPoint(0,0),KSize(100,12) ), 0, 0, this, "", "ui_frame.spr", m_pManager, 0, "", KANCHOR_LEFT | KANCHOR_TOP ) );
|
|
//if( pTxtNewWnd )
|
|
//{
|
|
// pTxtNewWnd->SetShow(false);
|
|
// pTxtNewWnd->SetCaption( CStringUtil::StringFormat( "<SHADOW><#FF8040>%s%s</SHADOW>", S(6425), m_vecNPCInfoList[i].strName.c_str() ).c_str() );
|
|
//}
|
|
}
|
|
|
|
createQuestIcon(); /// 2011.08.17 - prodongi
|
|
|
|
//SetChildAsTop( "minimap_static" );
|
|
//SetChildAsTop( "minimap" );
|
|
// SetChildShow( "window", false );
|
|
SetChildAsTop("zoomin");
|
|
SetChildAsTop("zoomout");
|
|
SetChildAsTop("static_local_text");
|
|
SetChildAsTop("window_N");
|
|
SetChildAsTop("window_S");
|
|
SetChildAsTop("window_E");
|
|
SetChildAsTop("window_W");
|
|
|
|
/// 2011.01.12 - prodongi
|
|
SetChildAsTop("button_repairdown");
|
|
|
|
// SetChildAsTop( "zoom_minimap_cameraviewpoint" );
|
|
// SetChildAsTop( "zoom_minimap_playerviewpoint" );
|
|
|
|
// SetChildAsTop( "minimap_zoom" );
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// party
|
|
//////////////////////////////////////////////////////////////////////////
|
|
void SUIMinimapWnd::RefreshPartyPlayerList(std::vector<std::string> const& vecText)
|
|
{
|
|
m_bPartyListUpdate = true;
|
|
|
|
char const* szType = vecText[0].c_str();
|
|
if (::_stricmp(szType, "DESTROY") == 0)
|
|
{
|
|
destroyParty(vecText[1]);
|
|
}
|
|
|
|
if (!m_PartyMgr.IsExist() || m_PartyMgr.GetMemberCount() < 1)
|
|
{
|
|
FreePartyControl(m_vecPartyInfoList);
|
|
|
|
m_bPartyListUpdate = false;
|
|
return;
|
|
}
|
|
|
|
// ¸â¹ِہا »èء¦°، ہد¾î³ھ¸é ¸®½؛ئ® »ُ·خ ¸¸µç´ظ
|
|
if (::_stricmp(szType, "LOGOUT") == 0 || ::_stricmp(szType, "LEAVE") == 0 || ::_stricmp(szType, "KICK") == 0)
|
|
FreePartyControl(m_vecPartyInfoList);
|
|
|
|
const std::vector<SPlayerSlot*>& vecPartyList = m_PartyMgr.GetMemberList();
|
|
std::vector<SPlayerSlot*>::const_iterator it;
|
|
for (it = vecPartyList.begin(); it != vecPartyList.end(); it++)
|
|
{
|
|
SPlayerSlot* pSlot = (*it);
|
|
if (pSlot->GetHandle() == m_PlayerInfoMgr.GetPlayerHandle()) continue;
|
|
if (pSlot->GetHandle() == NULL) continue;
|
|
|
|
// ہج¹ج ء¸ہçاد´آ ؤ³¸¯ہج¸é ¾÷µ¥ہجئ®
|
|
if (IsExistControl(pSlot->GetHandle(), m_vecPartyInfoList))
|
|
{
|
|
UpdatePartyPlayerInfo(pSlot->GetHandle(), m_vecPartyInfoList, pSlot->IsLogin(), pSlot->IsNear(), K3DVector(pSlot->GetXPos(), pSlot->GetYPos(), 0.f));
|
|
continue;
|
|
}
|
|
|
|
addInfoList(m_vecPartyInfoList, pSlot->GetHandle(), pSlot->GetName(), pSlot->IsLogin(), pSlot->IsNear(), pSlot->GetXPos(), pSlot->GetYPos(), "common_mark_minimap_npc_party");
|
|
}
|
|
m_bPartyListUpdate = false;
|
|
}
|
|
|
|
void SUIMinimapWnd::UpdatePlayerPos(AR_HANDLE handle, party_list& infoList, int nX, int nY)
|
|
{
|
|
if (m_bPartyListUpdate) return;
|
|
if (!IsExistControl(handle, infoList)) return;
|
|
|
|
UpdatePartyPlayerInfo(handle, infoList, true, true, K3DVector(nX, nY, 0.0f));
|
|
RefreshPartyPlayer(infoList);
|
|
}
|
|
|
|
void SUIMinimapWnd::FreePartyControl()
|
|
{
|
|
FreePartyControl(m_vecPartyInfoList);
|
|
FreeRaidControl();
|
|
}
|
|
|
|
void SUIMinimapWnd::FreePartyControl(party_list& infoList)
|
|
{
|
|
if (infoList.empty()) return;
|
|
|
|
OffToolTipWnd();
|
|
|
|
// ؤءئ®·ر ¸ًµخ »èء¦اد°ي ¸®½؛ئ® »èء¦ار´ظ
|
|
std::vector<PARTY_INFO>::iterator it = infoList.begin();
|
|
std::string strZoomName;
|
|
while (it != infoList.end())
|
|
{
|
|
XStringUtil::Format(strZoomName, "zoom_member_%d", (*it).handle);
|
|
RemoveControl(strZoomName.c_str()); //Zoom
|
|
RemoveControl((*it).strCtrlName.c_str());
|
|
|
|
it++;
|
|
}
|
|
infoList.clear();
|
|
}
|
|
|
|
void SUIMinimapWnd::FreeRaidControl()
|
|
{
|
|
raid_list::iterator it = m_raidInfoList.begin();
|
|
for (; it != m_raidInfoList.end(); ++it)
|
|
FreePartyControl(it->second.m_vecPartyInfoList);
|
|
m_raidInfoList.clear();
|
|
}
|
|
|
|
bool SUIMinimapWnd::IsExistControl(AR_HANDLE handle, party_list const& infoList)
|
|
{
|
|
if (infoList.empty()) return false;
|
|
|
|
std::vector<PARTY_INFO>::const_iterator it = infoList.begin();
|
|
while (it != infoList.end())
|
|
{
|
|
PARTY_INFO info = (*it);
|
|
if (info.handle == handle) return true;
|
|
it++;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
void SUIMinimapWnd::UpdatePartyPlayerInfo(AR_HANDLE handle, party_list& infoList, bool bLogin, bool bNear, K3DVector vec)
|
|
{
|
|
if (infoList.empty()) return;
|
|
|
|
std::vector<PARTY_INFO>::iterator it = infoList.begin();
|
|
while (it != infoList.end())
|
|
{
|
|
PARTY_INFO info = (*it);
|
|
if (info.handle == handle)
|
|
{
|
|
(*it).bLogin = bLogin;
|
|
(*it).bNear = bNear;
|
|
(*it).vecPlayerPos = vec;
|
|
//SetChildShow( CStringUtil::StringFormat( "member_%d", (*it).handle ).c_str(), false );
|
|
if ((*it).wnd)
|
|
(*it).wnd->SetShow(false);
|
|
return;
|
|
}
|
|
it++;
|
|
}
|
|
}
|
|
|
|
void SUIMinimapWnd::RefreshPartyPlayer(party_list& infoList, bool showStatus)
|
|
{
|
|
//if( m_bPartyListUpdate ) return;
|
|
if (infoList.empty()) return;
|
|
|
|
std::string strZoomName;
|
|
|
|
party_list::iterator it;
|
|
for (it = infoList.begin(); it != infoList.end(); it++)
|
|
{
|
|
PARTY_INFO info = (*it);
|
|
if ((*it).wnd)
|
|
(*it).wnd->SetShow(false);
|
|
|
|
if (!info.bLogin) continue;
|
|
if (!showStatus) continue;
|
|
|
|
int nX = info.vecPlayerPos.x;
|
|
int nY = info.vecPlayerPos.y;
|
|
|
|
if (!TranslatePosition(&nX, &nY)) continue;
|
|
|
|
if ((*it).wnd)
|
|
{
|
|
(*it).wnd->SetShow(true);
|
|
(*it).wnd->MovePos(nX, nY);
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIMinimapWnd::createMarkControl(KUIWnd** mark, KUIWnd** zoomMark, AR_HANDLE handle, char const* sprName, char const* name)
|
|
{
|
|
std::string ctrlName;
|
|
|
|
XStringUtil::Format(ctrlName, "member_%d", handle);
|
|
// ؤءئ®·ر »¼؛
|
|
*mark = m_pManager->CreateControl(KUIWND_CREATE_ARG("iconstatic", ctrlName.c_str(), " ", KRect(-1, -1, -1, -1), 0, 0, this, sprName, "ui_frame.spr", m_pManager, 0, "", KANCHOR_LEFT | KANCHOR_TOP));
|
|
if (*mark)
|
|
{
|
|
(*mark)->SetShow(false);
|
|
((KUIControlIconStatic*)(*mark))->SetTooltip(name);
|
|
}
|
|
|
|
XStringUtil::Format(ctrlName, "zoom_member_%d", handle);
|
|
// Zoom ؤءئ®·ر »¼؛
|
|
*zoomMark = m_pManager->CreateControl(KUIWND_CREATE_ARG("iconstatic", ctrlName.c_str(), " ", KRect(-1, -1, -1, -1), 0, 0, this, sprName, "ui_frame.spr", m_pManager, 0, "", KANCHOR_LEFT | KANCHOR_TOP));
|
|
if (*zoomMark)
|
|
{
|
|
(*zoomMark)->SetShow(false);
|
|
((KUIControlIconStatic*)(*zoomMark))->SetTooltip(name);
|
|
}
|
|
}
|
|
|
|
void SUIMinimapWnd::addInfoList(std::vector<PARTY_INFO>& infoList, AR_HANDLE handle, char const* name, bool isLogin, bool isNear, int x, int y, char const* sprName)
|
|
{
|
|
PARTY_INFO info;
|
|
info.handle = handle;
|
|
info.strName = name;
|
|
info.bLogin = isLogin;
|
|
info.bNear = isNear;
|
|
info.vecPlayerPos = K3DVector(x, y, 0.0f);
|
|
info.strCtrlName = CStringUtil::StringFormat("member_%d", info.handle);
|
|
|
|
createMarkControl(&info.wnd, &info.zoomWnd, info.handle, sprName, info.strName.c_str());
|
|
/*
|
|
std::string strZoomMember;
|
|
XStringUtil::Format( strZoomMember, "zoom_member_%d", info.handle );
|
|
|
|
// ؤءئ®·ر »¼؛
|
|
KUIWnd* pNewWnd = m_pManager->CreateControl( KUIWND_CREATE_ARG( "iconstatic", info.strCtrlName.c_str(), " ", KRect(-1,-1,-1, -1), 0, 0, this, sprName, "ui_frame.spr", m_pManager, 0, "", KANCHOR_LEFT | KANCHOR_TOP ) );
|
|
if( pNewWnd )
|
|
{
|
|
pNewWnd->SetShow(false);
|
|
(( KUIControlIconStatic*)pNewWnd)->SetTooltip( info.strName.c_str() );
|
|
}
|
|
|
|
// Zoom ؤءئ®·ر »¼؛
|
|
KUIWnd* pZoomNewWnd = m_pManager->CreateControl( KUIWND_CREATE_ARG( "iconstatic", strZoomMember.c_str(), " ", KRect(-1,-1,-1, -1), 0, 0, this, sprName, "ui_frame.spr", m_pManager, 0, "", KANCHOR_LEFT | KANCHOR_TOP ) );
|
|
if( pZoomNewWnd )
|
|
{
|
|
pZoomNewWnd->SetShow(false);
|
|
(( KUIControlIconStatic*)pZoomNewWnd)->SetTooltip( info.strName.c_str() );
|
|
}
|
|
|
|
info.wnd = pNewWnd;
|
|
info.zoomWnd = pZoomNewWnd;
|
|
*/
|
|
infoList.push_back(info);
|
|
}
|
|
|
|
void SUIMinimapWnd::refreshRaidTranslation()
|
|
{
|
|
raid_list::iterator it = m_raidInfoList.begin();
|
|
for (; it != m_raidInfoList.end(); ++it)
|
|
refreshPartyTranslation(it->second.m_vecPartyInfoList, it->second.m_showStatus);
|
|
}
|
|
|
|
void SUIMinimapWnd::refreshPartyTranslation(party_list const& infoList, bool showStatus)
|
|
{
|
|
const KRect& map_rect = m_pZoomMiniMapWnd->GetRect();
|
|
std::vector<PARTY_INFO>::const_iterator it;
|
|
std::string strZoomName;
|
|
for (it = infoList.begin(); it != infoList.end(); it++)
|
|
{
|
|
PARTY_INFO info = (*it);
|
|
KUIWnd* pPlayerWnd = (*it).zoomWnd;
|
|
if (!pPlayerWnd) return;
|
|
|
|
pPlayerWnd->SetShow(false);
|
|
if (!info.bLogin) return;
|
|
if (!showStatus) return;
|
|
|
|
int nX = info.vecPlayerPos.x;
|
|
int nY = info.vecPlayerPos.y;
|
|
|
|
if (!ZoomMapTranslatePosition(map_rect, &nX, &nY))
|
|
{
|
|
pPlayerWnd->SetShow(false);
|
|
}
|
|
else
|
|
{
|
|
pPlayerWnd->MovePos(nX, nY);
|
|
pPlayerWnd->SetShow(true);
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIMinimapWnd::hidePartyInfo(party_list& infoList)
|
|
{
|
|
std::vector<PARTY_INFO>::iterator it;
|
|
std::string strZoomName;
|
|
for (it = infoList.begin(); it != infoList.end(); it++)
|
|
{
|
|
PARTY_INFO info = (*it);
|
|
KUIWnd* pPlayerWnd = (*it).zoomWnd;
|
|
if (!pPlayerWnd) continue;
|
|
pPlayerWnd->SetShow(false);
|
|
}
|
|
}
|
|
|
|
void SUIMinimapWnd::hideRaidInfo()
|
|
{
|
|
raid_list::iterator it = m_raidInfoList.begin();
|
|
for (; it != m_raidInfoList.end(); ++it)
|
|
hidePartyInfo(it->second.m_vecPartyInfoList);
|
|
}
|
|
|
|
void SUIMinimapWnd::procRaidInfoList()
|
|
{
|
|
if (0 == m_PartyMgr.GetPartyCount())
|
|
{
|
|
/// "DESTROY"ہد ¶§, »èء¦ از·ء°ي اكہ¸³ھ, "DESTROY"¸¦ ¹قہ» ¶§ آë؟،´آ °ü·أ µ¥ہجإ¸°، »èء¦°، µب بؤ¶َ¼, ہع½إہا ئؤئ¼ہخءِ أ£ہ» ¼ِ°، ¾ّ´ظ. ±×·،¼ ؟©±â¼ »èء¦اش - prodongi
|
|
if (!m_raidInfoList.empty())
|
|
{
|
|
FreeRaidControl();
|
|
}
|
|
return;
|
|
}
|
|
|
|
updateRaidInfoControls();
|
|
updateRaidInfoPos();
|
|
RefreshRaidPlayer();
|
|
}
|
|
|
|
void SUIMinimapWnd::updateRaidInfoPos()
|
|
{
|
|
raid_list::iterator it_raid = m_raidInfoList.begin();
|
|
for (; it_raid != m_raidInfoList.end(); ++it_raid)
|
|
{
|
|
if (!it_raid->second.m_showStatus)
|
|
continue;
|
|
|
|
party_list& partyList = it_raid->second.m_vecPartyInfoList;
|
|
size_t num = partyList.size();
|
|
for (size_t i = 0; i < num; ++i)
|
|
{
|
|
if (!partyList[i].bLogin)
|
|
continue;
|
|
SGameAvatarEx* avatar = GetObject(partyList[i].handle);
|
|
if (!avatar)
|
|
continue;
|
|
partyList[i].vecPlayerPos = *avatar->GetPosition();
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIMinimapWnd::updateRaidInfoControls()
|
|
{
|
|
std::string sprName;
|
|
std::vector< SRaidInfo* >& raidInfoList = m_RaidMgr.GetRaidInfoList();
|
|
size_t listNum = raidInfoList.size();
|
|
for (size_t i = 0; i < listNum; ++i)
|
|
{
|
|
std::string partyName = raidInfoList[i]->GetPartyName();
|
|
SPartyMgr* party = m_PartyMgr.GetParty(&partyName);
|
|
if (!party || party->IsMyParty())
|
|
continue;
|
|
|
|
raid_list::iterator it_raid = m_raidInfoList.find(partyName);
|
|
if (it_raid == m_raidInfoList.end())
|
|
{
|
|
sRAID_PARTY_INFO raidInfo;
|
|
raidInfo.m_partyName = partyName;
|
|
raidInfo.m_showStatus = false;
|
|
m_raidInfoList.insert(std::make_pair(partyName, raidInfo));
|
|
it_raid = m_raidInfoList.find(partyName);
|
|
}
|
|
party_list& partyList = it_raid->second.m_vecPartyInfoList;
|
|
|
|
int realNumber = m_RaidMgr.getNumberAtPartyName(partyName);
|
|
XStringUtil::Format(sprName, "common_mark_titanium_minimap_attackteam_%02d", realNumber + 1);
|
|
|
|
std::vector<SPlayerSlot*>& memberList = party->GetMemberList();
|
|
size_t memberNum = memberList.size();
|
|
for (size_t n = 0; n < memberNum; ++n)
|
|
{
|
|
SPlayerSlot* player = memberList[n];
|
|
if (!IsExistControl(player->GetHandle(), partyList))
|
|
{
|
|
addInfoList(partyList, player->GetHandle(), player->GetName(), player->IsLogin(), player->IsNear(), player->GetXPos(), player->GetYPos(), sprName.c_str());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIMinimapWnd::RefreshRaidPlayer()
|
|
{
|
|
raid_list::iterator it = m_raidInfoList.begin();
|
|
for (; it != m_raidInfoList.end(); ++it)
|
|
RefreshPartyPlayer(it->second.m_vecPartyInfoList, it->second.m_showStatus);
|
|
}
|
|
|
|
SGameAvatarEx* SUIMinimapWnd::GetObject(AR_HANDLE handle)
|
|
{
|
|
SGame* pGame = m_pGameManager->GetActiveGame();
|
|
if (!pGame || pGame->GetGameType() != GAME_TYPE_WORLD)
|
|
return NULL;
|
|
|
|
return (SGameAvatarEx*)(pGame->GetGameObject(handle));
|
|
}
|
|
|
|
void SUIMinimapWnd::setRaidInfoShowStatus(const std::string& partyName, bool showStatus)
|
|
{
|
|
raid_list::iterator it = m_raidInfoList.find(partyName);
|
|
if (it == m_raidInfoList.end())
|
|
return;
|
|
|
|
it->second.m_showStatus = showStatus;
|
|
}
|
|
|
|
void SUIMinimapWnd::destroyParty(std::string const& partyName)
|
|
{
|
|
raid_list::iterator it = m_raidInfoList.find(partyName);
|
|
if (it == m_raidInfoList.end())
|
|
return;
|
|
FreePartyControl(it->second.m_vecPartyInfoList);
|
|
m_raidInfoList.erase(it);
|
|
}
|
|
|
|
void SUIMinimapWnd::addPropList(AR_HANDLE handle, int propId)
|
|
{
|
|
SGameAvatarEx* avatar = GetObject(handle);
|
|
if (!avatar)
|
|
return;
|
|
if (TS_ENTER::GAME_FIELD_PROP != avatar->GetObjType())
|
|
return;
|
|
|
|
prop_list::iterator it = m_propInfoList.find(handle);
|
|
if (it != m_propInfoList.end())
|
|
return;
|
|
|
|
FieldPropResource* res = GetFieldPropResourceDB().GetFieldPropResource(propId);
|
|
if (!res)
|
|
return;
|
|
|
|
// ´ّہü ہش±¸, أⱸ, ´ّہü ؤع¾î, ء¦¾î ہهؤ، ہج؟ـہا اء¶ّہ؛ ¸®إد
|
|
int type = res->type;
|
|
if (94 != type && 95 != type)
|
|
return;
|
|
|
|
addPropList(avatar, res->type, res->text_id);
|
|
}
|
|
|
|
void SUIMinimapWnd::addPropList(SGameAvatarEx* avatar, int type, int textId)
|
|
{
|
|
char const* aniName = "";
|
|
switch (type)
|
|
{
|
|
case 94: aniName = "common_mark_titanium_minimap_dungeoncore"; break; /// ؤع¾î
|
|
case 95: aniName = "common_mark_titanium_minimap_controlunit"; break; /// ء¦¾î ہهؤ،
|
|
case 96: aniName = "common_mark_titanium_minimap_barrierstone"; break; /// °ل°è¼®
|
|
}
|
|
|
|
std::string name(S(textId));
|
|
sPropMark mark;
|
|
mark.m_handle = avatar->GetArID();
|
|
mark.m_pos = *avatar->GetPosition();
|
|
createMarkControl(&mark.m_marker, &mark.m_zoomMarker, mark.m_handle, aniName, name.c_str());
|
|
m_propInfoList.insert(std::make_pair(mark.m_handle, mark));
|
|
}
|
|
|
|
void SUIMinimapWnd::addPropListAtCoreConnector(AR_HANDLE handle, int mobId)
|
|
{
|
|
_MONSTER_INFO_FILE* data = GetMonsterDB().GetMonsterData(mobId);
|
|
if (!data)
|
|
return;
|
|
|
|
/// ؤع¾î؟ح °ل°è¼®ہ؛ ¸َ½؛إح·خ µé¾î؟ہ´آµ¥, ؤع¾îہخءِ °ل°è¼®ہخءِ ¾ث ¼ِ ہض´آ ¹و¹ہج ¾ّ´ظ. ±×·،¼ إ¸ہشہ¸·خ أ¼إ©اش
|
|
|
|
int group = data->monster_group;
|
|
if (20001 != group && 20000 != group)
|
|
return;
|
|
SGameAvatarEx* avatar = GetObject(handle);
|
|
if (!avatar)
|
|
return;
|
|
|
|
int type;
|
|
if (20001 == group) type = 96;
|
|
else type = 94;
|
|
addPropList(avatar, type, data->name_id);
|
|
}
|
|
|
|
void SUIMinimapWnd::delPropList(AR_HANDLE handle)
|
|
{
|
|
prop_list::iterator it = m_propInfoList.find(handle);
|
|
if (it == m_propInfoList.end())
|
|
return;
|
|
|
|
OffToolTipWnd();
|
|
|
|
if (it->second.m_marker)
|
|
RemoveControl(it->second.m_marker->GetID());
|
|
if (it->second.m_zoomMarker)
|
|
RemoveControl(it->second.m_zoomMarker->GetID());
|
|
m_propInfoList.erase(it);
|
|
}
|
|
|
|
void SUIMinimapWnd::checkValidPropList()
|
|
{
|
|
prop_list::iterator it = m_propInfoList.begin();
|
|
for (; it != m_propInfoList.end(); )
|
|
{
|
|
SGameAvatarEx* avatar = GetObject(it->second.m_handle);
|
|
if (avatar)
|
|
{
|
|
it->second.m_pos = *avatar->GetPosition();
|
|
++it;
|
|
}
|
|
else
|
|
{
|
|
OffToolTipWnd();
|
|
|
|
if (it->second.m_marker)
|
|
RemoveControl(it->second.m_marker->GetID());
|
|
if (it->second.m_zoomMarker)
|
|
RemoveControl(it->second.m_zoomMarker->GetID());
|
|
it = m_propInfoList.erase(it);
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIMinimapWnd::refreshPropZoomTranslation()
|
|
{
|
|
const KRect& map_rect = m_pZoomMiniMapWnd->GetRect();
|
|
prop_list::iterator it = m_propInfoList.begin();
|
|
for (; it != m_propInfoList.end(); ++it)
|
|
{
|
|
int x = it->second.m_pos.x;
|
|
int y = it->second.m_pos.y;
|
|
|
|
KUIWnd* wnd = it->second.m_zoomMarker;
|
|
if (!ZoomMapTranslatePosition(map_rect, &x, &y))
|
|
{
|
|
wnd->SetShow(false);
|
|
}
|
|
else
|
|
{
|
|
wnd->SetShow(true);
|
|
wnd->MovePos(x, y);
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIMinimapWnd::refreshPropTranslation()
|
|
{
|
|
const KRect& map_rect = m_pZoomMiniMapWnd->GetRect();
|
|
prop_list::iterator it = m_propInfoList.begin();
|
|
for (; it != m_propInfoList.end(); ++it)
|
|
{
|
|
int x = it->second.m_pos.x;
|
|
int y = it->second.m_pos.y;
|
|
|
|
if (!TranslatePosition(&x, &y)) continue;
|
|
KUIWnd* wnd = it->second.m_marker;
|
|
if (wnd)
|
|
{
|
|
wnd->SetShow(true);
|
|
wnd->MovePos(x, y);
|
|
}
|
|
}
|
|
}
|
|
|
|
void SUIMinimapWnd::hidePropInfo()
|
|
{
|
|
prop_list::iterator it = m_propInfoList.begin();
|
|
for (; it != m_propInfoList.end(); ++it)
|
|
{
|
|
KUIWnd* wnd = it->second.m_zoomMarker;
|
|
if (wnd)
|
|
{
|
|
wnd->SetShow(false);
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
void SUIMinimapWnd::procPropList()
|
|
{
|
|
checkValidPropList();
|
|
refreshPropTranslation();
|
|
}
|
|
|
|
void SUIMinimapWnd::RefreshLocal()
|
|
{
|
|
if (!m_pZoomMiniMapWnd) return;
|
|
if (!m_pZoomMiniMapWnd->IsShow()) return;
|
|
|
|
if (m_bColse) return;
|
|
|
|
const KRect& map_rect = m_pZoomMiniMapWnd->GetRect();
|
|
|
|
// ؤ³¸¯إح, ؤ«¸ق¶َ ء¤ءك¾س ہ§ؤ،
|
|
int nX = m_nPlayerRealPosX;
|
|
int nY = m_nPlayerRealPosY;
|
|
ZoomMapTranslatePosition(map_rect, &nX, &nY);
|
|
|
|
KUIWnd* pCameraWnd = GetChild("zoom_minimap_cameraviewpoint");
|
|
if (pCameraWnd)
|
|
{
|
|
pCameraWnd->MovePos(nX - (pCameraWnd->GetRect().GetWidth() / 2), nY - (pCameraWnd->GetRect().GetHeight() / 2));
|
|
pCameraWnd->SetShow(true);
|
|
}
|
|
KUIWnd* pPlayerWnd = GetChild("zoom_minimap_playerviewpoint");
|
|
if (pPlayerWnd)
|
|
{
|
|
pPlayerWnd->MovePos(nX - (pPlayerWnd->GetRect().GetWidth() / 2), nY - (pPlayerWnd->GetRect().GetHeight() / 2));
|
|
pPlayerWnd->SetShow(true);
|
|
}
|
|
|
|
int nLocalIndexX = m_nPlayerRealPosX / 16128;
|
|
int nLocalIndexY = m_nPlayerRealPosY / 16128;
|
|
|
|
std::vector<_LOCAL_INFO_>::iterator it = m_vLocalInfoList.begin();
|
|
for (it = m_vLocalInfoList.begin(); it != m_vLocalInfoList.end(); ++it)
|
|
{
|
|
KUIWnd* pLocal = (*it).wnd;//GetChild( (*it).strLocalID.c_str() );
|
|
if (!pLocal) continue;
|
|
|
|
pLocal->SetShow(false);
|
|
|
|
int nX = (*it).nCenterX;
|
|
int nY = (*it).nCenterY;
|
|
|
|
if (m_zoom_map_type == 1)
|
|
{
|
|
int nMapX_Index = nX / 16128;
|
|
int nMapY_Index = nY / 16128;
|
|
|
|
if (nLocalIndexX != nMapX_Index || nLocalIndexY != nMapY_Index) continue;
|
|
}
|
|
|
|
if (!ZoomMapTranslatePosition(map_rect, &nX, &nY))
|
|
pLocal->SetShow(false);
|
|
else
|
|
{
|
|
bool bShow = false;
|
|
if (map_rect.left <= nX && map_rect.top <= nY)
|
|
{
|
|
KSize size = pLocal->GetCaptionPhraseSize();
|
|
if (map_rect.right >= nX + size.cx && map_rect.bottom >= nY + size.cy)
|
|
{
|
|
pLocal->MovePos(nX, nY);
|
|
bShow = true;
|
|
}
|
|
}
|
|
|
|
pLocal->SetShow(bShow);
|
|
}
|
|
}
|
|
|
|
//Zoom NPC
|
|
{
|
|
std::string strName, strNameTxt;
|
|
std::vector<NPC_INFO>::iterator it = m_vecNPCInfoList.begin();
|
|
for (it = m_vecNPCInfoList.begin(); it != m_vecNPCInfoList.end(); ++it)
|
|
{
|
|
//XStringUtil::Format( strName , "%s_zoom", (*it).strName.c_str() );
|
|
//KUIWnd* pLocal = GetChild( strName.c_str() );
|
|
|
|
// XStringUtil::Format( strNameTxt, "txt_%s" , (*it).strName.c_str() );
|
|
// KUIWnd* pLocal = GetChild( strNameTxt.c_str() );
|
|
|
|
KUIWnd* pLocal = (*it).zoomWnd;
|
|
if (!pLocal) continue;
|
|
|
|
pLocal->SetShow(false);
|
|
|
|
int nX = (*it).x;
|
|
int nY = (*it).y;
|
|
|
|
if (m_zoom_map_type == 1)
|
|
{
|
|
int nMapX_Index = nX / 16128;
|
|
int nMapY_Index = nY / 16128;
|
|
|
|
if (nLocalIndexX != nMapX_Index || nLocalIndexY != nMapY_Index) continue;
|
|
}
|
|
|
|
//
|
|
if ((*it).is_periodic)
|
|
{
|
|
time_t nowtime;
|
|
time(&nowtime);
|
|
|
|
if ((*it).begin_of_period > nowtime || (*it).end_of_period < nowtime)
|
|
(*it).is_render = false;
|
|
else
|
|
(*it).is_render = true;
|
|
}
|
|
|
|
//if( !IsRenderNPC((*it).nID) )
|
|
if (!(*it).is_render)
|
|
{
|
|
pLocal->SetShow(false);
|
|
}
|
|
else if (!ZoomMapTranslatePosition(map_rect, &nX, &nY))
|
|
{
|
|
pLocal->SetShow(false);
|
|
}
|
|
else
|
|
{
|
|
pLocal->MovePos(nX, nY);
|
|
pLocal->SetShow(true);
|
|
}
|
|
}
|
|
}
|
|
|
|
refreshPartyTranslation(m_vecPartyInfoList);
|
|
refreshRaidTranslation();
|
|
refreshPropZoomTranslation();
|
|
}
|
|
|
|
void SUIMinimapWnd::_AssignSteamToNullTerminatedString(KStream* stream, char** ppStr)
|
|
{
|
|
size_t nLen = stream->GetLength();
|
|
*ppStr = new char[nLen + 1];
|
|
(*ppStr)[nLen] = '\0';
|
|
for (size_t i(0); nLen > i; i++)
|
|
{
|
|
stream->Read(&(*ppStr)[i], 1);
|
|
}
|
|
}
|
|
|
|
void SUIMinimapWnd::LoadLocalInfo()
|
|
{
|
|
KStream* pRes = KFileManager::Instance().CreateStreamFromResource("LocalInfo.txt");
|
|
if (!pRes) return;
|
|
|
|
char* pstrResource;
|
|
_AssignSteamToNullTerminatedString(pRes, &pstrResource);
|
|
|
|
std::vector< std::string > vString;
|
|
MsgSplit(pstrResource, vString, L"|\r\n");
|
|
|
|
int nLoop = (int)vString.size() / 4;
|
|
|
|
int n = 0;
|
|
std::string strLocalName;
|
|
for (int i(0); nLoop > i; i++)
|
|
{
|
|
_LOCAL_INFO_ local_info;
|
|
|
|
local_info.nType = atoi(vString[n++].c_str());
|
|
local_info.nCenterX = atoi(vString[n++].c_str());
|
|
local_info.nCenterY = atoi(vString[n++].c_str());
|
|
local_info.nLocalID = atoi(vString[n++].c_str());
|
|
|
|
if (local_info.nType == 1) //MapTool ؟،¼ »¼؛µب
|
|
{
|
|
int nTextID = GetWorldLocationDB().GetWLTextID(local_info.nLocalID);
|
|
|
|
//¾ّ°إ³ھ, ہû؟ë ؟©؛خ°، 0 ہخ °حہس.
|
|
if (nTextID == -1)
|
|
continue;
|
|
|
|
strLocalName = GetStringDB().GetString(nTextID);
|
|
}
|
|
else if (local_info.nType == 2) //ء÷ء¢ ½؛ئ®¸µ ID¸¦ ہش·آار µ¥ہجإ¸
|
|
strLocalName = GetStringDB().GetString(local_info.nLocalID);
|
|
|
|
local_info.strLocalID = CStringUtil::StringFormat("%s%d", strLocalName.c_str(), i);
|
|
|
|
// _oprint( "%d %d %d\n", local_info.nCenterX, local_info.nCenterY, local_info.nLocalID );
|
|
|
|
// ؤءئ®·ر »¼؛ار´ظ
|
|
KUIWnd* pNewWnd = m_pManager->CreateControl(KUIWND_CREATE_ARG("static", local_info.strLocalID.c_str(), " ", KRect(KPoint(0, 0), KSize(150, 12)), 0, KFLAG_NO_GET_MESSAGE, this, "", "ui_frame.spr", m_pManager, 0, "", KANCHOR_LEFT | KANCHOR_TOP));
|
|
if (pNewWnd)
|
|
{
|
|
pNewWnd->SetShow(false);
|
|
pNewWnd->SetCaption(CStringUtil::StringFormat("<SHADOW>%s%s</SHADOW>", S(6425), strLocalName.c_str()).c_str());
|
|
}
|
|
|
|
local_info.wnd = pNewWnd;
|
|
m_vLocalInfoList.push_back(local_info);
|
|
};
|
|
|
|
KUIWnd* pCamera = m_pManager->CreateControl(KUIWND_CREATE_ARG("static", "zoom_minimap_cameraviewpoint", " ", KRect(KPoint(0, 0), KSize(188 - 4, 207 - 23)), 0, KFLAG_NO_GET_MESSAGE, this, "static_minimap_playersight00", "ui_frame.spr", m_pManager, 0, "", KANCHOR_LEFT | KANCHOR_TOP));
|
|
if (pCamera) pCamera->SetShow(false);
|
|
KUIWnd* pPlayer = m_pManager->CreateControl(KUIWND_CREATE_ARG("static", "zoom_minimap_playerviewpoint", " ", KRect(KPoint(0, 0), KSize(106 - 90, 123 - 103)), 0, KFLAG_NO_GET_MESSAGE, this, "static_minimap_mainplayer", "ui_frame.spr", m_pManager, 0, "", KANCHOR_LEFT | KANCHOR_TOP));
|
|
if (pPlayer) pPlayer->SetShow(false);
|
|
|
|
SetChildShow("zoom_minimap_cameraviewpoint", false);
|
|
SetChildShow("zoom_minimap_playerviewpoint", false);
|
|
|
|
delete[] pstrResource;
|
|
|
|
delete pRes;
|
|
|
|
vString.clear();
|
|
}
|
|
|
|
bool SUIMinimapWnd::ZoomMapTranslatePosition(const KRect& map_rect, int* nPosX, int* nPosY)
|
|
{
|
|
int nMapW = 16128; //¸ت اد³ھ´ç ½ا ¼¼°èہا إ©±â
|
|
int nMapH = 16128; //¸ت اد³ھ´ç ½ا ¼¼°èہا إ©±â
|
|
|
|
X2D::Rect< int > rect(m_nPlayerRealPosX - (nMapW * m_fZoomMinimapZoomValue / 2), m_nPlayerRealPosY - (nMapH * m_fZoomMinimapZoomValue / 2),
|
|
m_nPlayerRealPosX + (nMapW * m_fZoomMinimapZoomValue / 2), m_nPlayerRealPosY + (nMapH * m_fZoomMinimapZoomValue / 2));
|
|
|
|
if (!rect.IsInclude(X2D::Point<int>(*nPosX, *nPosY))) return false;
|
|
|
|
int nMiniMapWndWidth = map_rect.GetWidth(); //¹ج´د¸ت ہ©µµ؟ى إ©±â °،·خ
|
|
int nMiniMapWndHeight = map_rect.GetHeight(); //¹ج´د¸ت ہ©µµ؟ى إ©±â ¼¼·خ
|
|
|
|
// nMiniMapWndHeight -= 18;
|
|
|
|
////MyPos
|
|
//int nMyX = (c_nMapPerTileW*m_fZoomType/2);
|
|
//int nMyY = (c_nMapPerTileW*m_fZoomType/2);
|
|
//nMyX = map_rect.left + ( nMyX * nMiniMapWndWidth ) / ( c_nMapPerTileW*m_fZoomType );
|
|
//nMyY = map_rect.GetHeight() - ( map_rect.top + (( nMyY * nMiniMapWndHeight ) / ( c_nMapPerTileH*m_fZoomType )) );
|
|
|
|
//Pos
|
|
int nX = *nPosX - m_nPlayerRealPosX + (c_nMapPerTileW * m_fZoomMinimapZoomValue / 2);
|
|
int nY = *nPosY - m_nPlayerRealPosY + (c_nMapPerTileH * m_fZoomMinimapZoomValue / 2);
|
|
nX = map_rect.left + (nX * nMiniMapWndWidth) / (c_nMapPerTileW * m_fZoomMinimapZoomValue);
|
|
nY = map_rect.GetHeight() - (map_rect.top + ((nY * nMiniMapWndHeight) / (c_nMapPerTileH * m_fZoomMinimapZoomValue))); //¹فہü °ھ
|
|
nY = map_rect.top + map_rect.top + nY;
|
|
|
|
|
|
// nY += 10/m_fZoomMinimapZoomValue;
|
|
bool bIsOver_here = false;
|
|
if (nY < (map_rect.top)) return false; //{ nY = ( map_rect.top ); bIsOver_here = true; }
|
|
if (nY > (map_rect.bottom)) return false; //{ nY = ( map_rect.bottom); bIsOver_here = true; }
|
|
|
|
if (nX < (map_rect.left)) return false; //{ nX = ( map_rect.left ); bIsOver_here = true; }
|
|
if (nX > (map_rect.right)) return false; //{ nX = ( map_rect.right); bIsOver_here = true; }
|
|
|
|
{
|
|
*nPosX = nX;
|
|
*nPosY = nY;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
void SUIMinimapWnd::HideLocalInfo()
|
|
{
|
|
std::vector<_LOCAL_INFO_>::iterator it = m_vLocalInfoList.begin();
|
|
|
|
for (it = m_vLocalInfoList.begin(); it != m_vLocalInfoList.end(); ++it)
|
|
{
|
|
KUIWnd* pLocal = (*it).wnd;//GetChild( (*it).strLocalID.c_str() );
|
|
if (!pLocal) continue;
|
|
pLocal->SetShow(false);
|
|
}
|
|
|
|
{
|
|
std::vector<NPC_INFO>::iterator it = m_vecNPCInfoList.begin();
|
|
std::string strNameTxt;
|
|
for (it = m_vecNPCInfoList.begin(); it != m_vecNPCInfoList.end(); ++it)
|
|
{
|
|
//XStringUtil::Format( strNameTxt, "%s_zoom" , (*it).strName.c_str() );
|
|
// XStringUtil::Format( strNameTxt, "txt_%s" , (*it).strName.c_str() );
|
|
|
|
KUIWnd* pLocal = (*it).zoomWnd;//GetChild( strNameTxt.c_str() );
|
|
if (!pLocal) continue;
|
|
pLocal->SetShow(false);
|
|
}
|
|
}
|
|
|
|
hidePartyInfo(m_vecPartyInfoList);
|
|
hideRaidInfo();
|
|
hidePropInfo();
|
|
|
|
SetChildShow("zoom_minimap_cameraviewpoint", false);
|
|
SetChildShow("zoom_minimap_playerviewpoint", false);
|
|
}
|
|
|
|
void SUIMinimapWnd::createQuestIcon()
|
|
{
|
|
KUIWND_CREATE_ARG arg;
|
|
arg.lpszClassName = "iconstatic";
|
|
arg.lpszID = "";
|
|
arg.rcRect = KRect(-1, -1, -1, -1);
|
|
arg.pParent = this;
|
|
arg.lpszAniName = "common_mark_minimap_quest_target";
|
|
arg.lpszSprName = "ui_frame.spr";
|
|
arg.pWndManager = m_pManager;
|
|
arg.dwAnchor = KANCHOR_LEFT | KANCHOR_TOP;
|
|
|
|
int maxQuestIcon = 50;
|
|
for (int i = 0; i < maxQuestIcon; ++i)
|
|
{
|
|
XStringUtil::Format(arg.lpszID, "questIcon%d", i);
|
|
KUIWnd* icon = m_pManager->CreateControl(arg);
|
|
icon->SetShow(false);
|
|
m_questIconCache.addTotal(icon);
|
|
}
|
|
}
|
|
|
|
bool SUIMinimapWnd::insertQuestMob(AR_HANDLE handle, int enc_id)
|
|
{
|
|
if (isQuestIcon(handle))
|
|
return false;
|
|
|
|
if (SQuestMgr::GetInstance().isQuestMarkMob(enc_id, true))
|
|
{
|
|
return insertQuestIcon(handle);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool SUIMinimapWnd::insertQuestProp(AR_HANDLE handle, int prop_id)
|
|
{
|
|
if (isQuestIcon(handle))
|
|
return false;
|
|
|
|
FieldPropResource* res = GetFieldPropResourceDB().GetFieldPropResource(prop_id);
|
|
if (!res)
|
|
return false;
|
|
|
|
if (SQuestMgr::GetInstance().isQuestMarkDropItem(res->drop_item_id_00, true))
|
|
{
|
|
return insertQuestIcon(handle);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
bool SUIMinimapWnd::insertQuestIcon(AR_HANDLE handle)
|
|
{
|
|
KUIWnd* wnd = m_questIconCache.getUnUsed();
|
|
if (wnd)
|
|
{
|
|
wnd->SetShow(true);
|
|
m_questIconList.insert(std::make_pair(handle, wnd));
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
void SUIMinimapWnd::removeQuestIcon(AR_HANDLE handle)
|
|
{
|
|
if (!isQuestIcon(handle))
|
|
return;
|
|
|
|
std::map<AR_HANDLE, KUIWnd*>::iterator it = m_questIconList.find(handle);
|
|
KUIWnd* wnd = it->second;
|
|
wnd->SetShow(false);
|
|
m_questIconCache.setUnUsed(wnd);
|
|
m_questIconList.erase(handle);
|
|
}
|
|
|
|
void SUIMinimapWnd::refreshQuestIcon()
|
|
{
|
|
SGameWorld* gameWorld = dynamicCast<SGameWorld*>(m_pGameManager->GetActiveGame());
|
|
if (!gameWorld)
|
|
return;
|
|
|
|
std::map<AR_HANDLE, KUIWnd*>::iterator it = m_questIconList.begin();
|
|
for (; it != m_questIconList.end(); ++it)
|
|
{
|
|
it->second->SetShow(false);
|
|
}
|
|
m_questIconCache.resetUnUsed();
|
|
m_questIconList.clear();
|
|
|
|
std::vector<SGameAvatarEx*> objList;
|
|
gameWorld->GetCommandSystem()->getOtherObjectList(objList);
|
|
|
|
std::vector<SGameAvatarEx*>::iterator it_obj = objList.begin();
|
|
for (; it_obj != objList.end(); ++it_obj)
|
|
{
|
|
SGameAvatarEx* obj = *it_obj;
|
|
if (obj->IsDead())
|
|
continue;
|
|
int objType = obj->GetObjType();
|
|
if (TS_ENTER::GAME_MOB == objType)
|
|
{
|
|
SGameMob* mob = dynamicCast<SGameMob*>(obj);
|
|
int enc_id_value = mob->GetContentID().value();
|
|
insertQuestMob(obj->GetArID(), enc_id_value);
|
|
}
|
|
else if (TS_ENTER::GAME_FIELD_PROP == objType)
|
|
{
|
|
SGameFieldQuestProp* prop = dynamicCast<SGameFieldQuestProp*>(obj);
|
|
insertQuestProp(obj->GetArID(), prop->GetQuestPropDBID());
|
|
}
|
|
}
|
|
}
|
|
|
|
bool SUIMinimapWnd::isQuestIcon(AR_HANDLE handle)
|
|
{
|
|
std::map<AR_HANDLE, KUIWnd*>::iterator it = m_questIconList.find(handle);
|
|
return it != m_questIconList.end();
|
|
}
|
|
|
|
void SUIMinimapWnd::procQuestIcon()
|
|
{
|
|
SGameWorld* gameWorld = dynamicCast<SGameWorld*>(m_pGameManager->GetActiveGame());
|
|
if (!gameWorld)
|
|
return;
|
|
|
|
std::map<AR_HANDLE, KUIWnd*>::iterator it = m_questIconList.begin();
|
|
for (; it != m_questIconList.end();)
|
|
{
|
|
AR_HANDLE handle = it->first;
|
|
KUIWnd* wnd = it->second;
|
|
|
|
SGameAvatarEx* obj = dynamicCast<SGameAvatarEx*>(gameWorld->GetGameObject(handle));
|
|
if (!obj || obj->IsDead())
|
|
{
|
|
wnd->SetShow(false);
|
|
m_questIconCache.setUnUsed(wnd);
|
|
m_questIconList.erase(it++);
|
|
continue;
|
|
}
|
|
|
|
K3DVector* pos = obj->GetPosition();
|
|
int x = pos->x;
|
|
int y = pos->y;
|
|
|
|
if (!TranslatePosition(&x, &y))
|
|
{
|
|
wnd->SetShow(false);
|
|
}
|
|
else
|
|
{
|
|
wnd->MovePos(x, y);
|
|
wnd->SetShow(true);
|
|
}
|
|
++it;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NPCMarker::NPCMarker(SUIMinimapWnd* parent)
|
|
: m_pParent(parent)
|
|
{
|
|
assert(m_pParent);
|
|
}
|
|
/// 2011.03.18 - prodongi
|
|
void NPCMarker::add(const ENC_INT& key, KUIControl* marker, KUIControl* zoom_marker, int npcType)
|
|
{
|
|
if (m_hashNpcMarkers.has(key)) return;
|
|
Marker item;
|
|
item.marker = marker;
|
|
item.zoom_marker = zoom_marker;
|
|
item.npcType = npcType; /// 2011.03.18 - prodongi
|
|
m_hashNpcMarkers.add(key, item);
|
|
}
|
|
|
|
bool NPCMarker::get(const ENC_INT& key, Marker& marker)
|
|
{
|
|
if (m_hashNpcMarkers.lookup(key, marker))
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
void NPCMarker::addInfo(const AR_HANDLE& key, const MarkerInfo& info)
|
|
{
|
|
if (m_hashNpcMarkerInfos.has(key)) return;
|
|
m_hashNpcMarkerInfos.add(key, info);
|
|
}
|
|
|
|
bool NPCMarker::getInfo(const AR_HANDLE& key, MarkerInfo& info)
|
|
{
|
|
if (m_hashNpcMarkerInfos.lookup(key, info))
|
|
return true;
|
|
return false;
|
|
}
|
|
|
|
void NPCMarker::modifyInfo(const AR_HANDLE& key, const MarkerInfo& info)
|
|
{
|
|
m_hashNpcMarkerInfos.modify(key, info);
|
|
}
|
|
|
|
void NPCMarker::clear()
|
|
{
|
|
m_hashNpcMarkers.clear();
|
|
}
|
|
|
|
void NPCMarker::disappearAll()
|
|
{
|
|
Marker npc;
|
|
bool bExist = m_hashNpcMarkers.get_first_value(npc);
|
|
while (bExist)
|
|
{
|
|
npc.marker->SetShow(false);
|
|
bExist = m_hashNpcMarkers.get_next_value(npc);
|
|
}
|
|
} |