422 lines
11 KiB
C++
422 lines
11 KiB
C++
#pragma once
|
|
|
|
#include "XMiniMap.h"
|
|
//#include "SUIWnd.h"
|
|
#include "SUIDefine.h"
|
|
#include "SNPCResourceDB.h"
|
|
#include "KSmartPtr.h"
|
|
#include <toolkit/khash.h>
|
|
|
|
|
|
//#include <string>
|
|
|
|
class SUIDisplayInfo;
|
|
class SMessengerMgr;
|
|
class SGameAvatarEx;
|
|
|
|
typedef SNpcResourceDB::NPCRenderInfo NPC_INFO;
|
|
|
|
class KUIWnd;
|
|
typedef struct _tagPARTYINFO
|
|
{
|
|
AR_HANDLE handle;
|
|
K3DVector vecPlayerPos;
|
|
|
|
bool bLogin;
|
|
bool bNear;
|
|
std::string strName;
|
|
std::string strCtrlName;
|
|
|
|
KUIWnd* wnd;
|
|
KUIWnd* zoomWnd;
|
|
|
|
_tagPARTYINFO() : wnd(NULL), zoomWnd(NULL) {}
|
|
} PARTY_INFO;
|
|
|
|
struct sRAID_PARTY_INFO
|
|
{
|
|
~sRAID_PARTY_INFO()
|
|
{
|
|
m_vecPartyInfoList.clear();
|
|
}
|
|
std::string m_partyName;
|
|
std::vector<PARTY_INFO> m_vecPartyInfoList;
|
|
bool m_showStatus;
|
|
};
|
|
|
|
DECL_SPTR(K3DTexture)
|
|
|
|
struct sMinimapQuestIconCache
|
|
{
|
|
~sMinimapQuestIconCache()
|
|
{
|
|
clear();
|
|
}
|
|
void clear()
|
|
{
|
|
m_total.clear();
|
|
m_unused.clear();
|
|
}
|
|
void resetUnUsed()
|
|
{
|
|
m_unused.clear();
|
|
m_unused.assign(m_total.begin(), m_total.end());
|
|
}
|
|
void addTotal(KUIWnd* wnd)
|
|
{
|
|
m_total.push_back(wnd);
|
|
}
|
|
KUIWnd* getUnUsed()
|
|
{
|
|
if (m_unused.empty())
|
|
return NULL;
|
|
|
|
KUIWnd* wnd = m_unused.back();
|
|
m_unused.pop_back();
|
|
return wnd;
|
|
}
|
|
void setUnUsed(KUIWnd* wnd)
|
|
{
|
|
m_unused.push_back(wnd);
|
|
}
|
|
std::vector<KUIWnd*> m_total;
|
|
std::vector<KUIWnd*> m_unused;
|
|
};
|
|
|
|
class NPCMarker
|
|
{
|
|
public:
|
|
|
|
struct hashPr_mod_ENC_INT
|
|
{
|
|
typedef ENC_INT Key;
|
|
static inline unsigned getindex(const Key& key, int nCapacity)
|
|
{
|
|
return unsigned(key.hash_id()) % nCapacity;
|
|
}
|
|
static inline bool isequal(const Key& key1, const Key& key2)
|
|
{
|
|
return key1 == key2;
|
|
}
|
|
static inline bool isless(const Key& key1, const Key& key2)
|
|
{
|
|
return key1.prior(key2);
|
|
}
|
|
};
|
|
|
|
struct hashPr_mod_AR_HANDLE
|
|
{
|
|
typedef AR_HANDLE Key;
|
|
static inline unsigned getindex(const Key& key, int nCapacity)
|
|
{
|
|
return unsigned(key) % nCapacity;
|
|
}
|
|
static inline bool isequal(const Key& key1, const Key& key2)
|
|
{
|
|
return key1 == key2;
|
|
}
|
|
static inline bool isless(const Key& key1, const Key& key2)
|
|
{
|
|
return key1 < key2;
|
|
}
|
|
};
|
|
|
|
struct Marker
|
|
{
|
|
Marker() : marker(0), zoom_marker(0) {}
|
|
KUIControl* marker;
|
|
KUIControl* zoom_marker;
|
|
int npcType; /// 2011.03.18 - prodongi
|
|
};
|
|
|
|
struct MarkerInfo
|
|
{
|
|
AR_HANDLE handle;
|
|
unsigned status;
|
|
ENC_INT npc_id;
|
|
};
|
|
|
|
typedef KHash< Marker, hashPr_mod_ENC_INT > MarkerHash;
|
|
typedef MarkerHash::node* MarkerHashNode;
|
|
typedef KHash< MarkerInfo, hashPr_mod_AR_HANDLE > MarkerInfoHash;
|
|
typedef MarkerInfoHash::node* MarkerInfoHashNode;
|
|
|
|
|
|
public:
|
|
|
|
explicit NPCMarker(class SUIMinimapWnd* parent);
|
|
void add(const ENC_INT& key, KUIControl* marker, KUIControl* zoom_marker, int npcType); /// 2011.03.18 - prodongi
|
|
bool get(const ENC_INT& key, Marker& marker);
|
|
void addInfo(const AR_HANDLE& key, const MarkerInfo& info);
|
|
bool getInfo(const AR_HANDLE& key, MarkerInfo& info);
|
|
void modifyInfo(const AR_HANDLE& key, const MarkerInfo& info);
|
|
void clear();
|
|
void disappearAll();
|
|
|
|
private:
|
|
|
|
SUIMinimapWnd* m_pParent;
|
|
MarkerHash m_hashNpcMarkers;
|
|
MarkerInfoHash m_hashNpcMarkerInfos;
|
|
};
|
|
|
|
struct sPropMark
|
|
{
|
|
sPropMark() : m_marker(NULL), m_zoomMarker(NULL) {}
|
|
|
|
AR_HANDLE m_handle;
|
|
K3DVector m_pos;
|
|
KUIWnd* m_marker;
|
|
KUIWnd* m_zoomMarker;
|
|
};
|
|
|
|
#define MINIMAPSIGNTIME 500
|
|
|
|
class SUIMinimapWnd : public SUIWnd
|
|
{
|
|
public:
|
|
typedef std::vector<PARTY_INFO> party_list;
|
|
typedef std::map<std::string, sRAID_PARTY_INFO> raid_list;
|
|
typedef std::map<AR_HANDLE, sPropMark> prop_list;
|
|
|
|
public:
|
|
SUIMinimapWnd(SGameManager* pGameManager, SUIDisplayInfo* pDisplayInfo);
|
|
virtual ~SUIMinimapWnd();
|
|
|
|
static void SetRenderDevice(class K3DRenderDeviceDX* pDevice);
|
|
|
|
virtual void PumpUpMessage(LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam);
|
|
virtual bool InitData(bool bReload = false);
|
|
virtual void ProcMsgAtStatic(SGameMessage* pMsg);
|
|
virtual void OnNotifyUIWindowOpen(bool bOpen, bool bLimitWnd = true);
|
|
|
|
virtual void Process(DWORD dwTime);
|
|
virtual DWORD OnMouseMessage(DWORD dwMessage, int x, int y);
|
|
|
|
virtual void OnDeviceLost();
|
|
|
|
//---------------------------------
|
|
//¾²·¹µه ·خµù
|
|
static void BeginMinimapLoadingThread();
|
|
static void EndMinimapLoadingThread();
|
|
void PendLoading(const char* szName);
|
|
static bool IsPendLoading() { return s_bIsThreadPending; }
|
|
bool IsThreadLoading();
|
|
//---------------------------------
|
|
|
|
|
|
private:
|
|
|
|
// ¾²·¹µه ·خµù
|
|
//---------------------------------
|
|
static unsigned int __stdcall minimap_loader(void* pArg);
|
|
static volatile bool s_bStopThread;
|
|
static volatile bool s_bIsThreadLoading;
|
|
static volatile bool s_bIsThreadPending;
|
|
|
|
void addToLoadingList(const char* szName);
|
|
void removeFromLoadingList(const char* szName);
|
|
|
|
static void doLoading(const char* szName);
|
|
|
|
bool IsRenderNPC(ENC_INT id);
|
|
|
|
void FreeList();
|
|
|
|
void zoomin();
|
|
void zoomout();
|
|
|
|
/// ہ§ؤ، °»½إ ==============================
|
|
void RefreshPos();
|
|
|
|
/// اأ·¹ہج¾î ===============================
|
|
void RotatePlayer(float fRadian);
|
|
|
|
/// npc ====================================
|
|
void LoadNPCInfoFile();
|
|
void RefreshNPC();
|
|
|
|
/// party ==================================
|
|
void FreePartyControl(party_list& infoList);
|
|
void FreeRaidControl();
|
|
void addInfoList(party_list& infoList, AR_HANDLE handle, char const* name, bool isLogin, bool isNear, int x, int y, char const* sprName);
|
|
bool IsExistControl(AR_HANDLE handle, party_list const& infoList);
|
|
void UpdatePartyPlayerInfo(AR_HANDLE handle, party_list& infoList, bool bLogin, bool bNear, K3DVector vec);
|
|
/// ³»ءآا¥ ءك½ةہ¸·خ ئؤئ¼؟ّ ا¥½أ
|
|
void RefreshPartyPlayer(party_list& infoList, bool showStatus = true);
|
|
void RefreshRaidPlayer();
|
|
/// ±ظأ³ہا ئؤئ¼؟ّ ءآا¥ °»½إ
|
|
void UpdatePlayerPos(AR_HANDLE handle, party_list& infoList, int nX, int nY);
|
|
void refreshPartyTranslation(party_list const& infoList, bool showStatus = true);
|
|
void refreshRaidTranslation();
|
|
void hidePartyInfo(party_list& infoList);
|
|
void hideRaidInfo();
|
|
void procRaidInfoList();
|
|
void procPropList();
|
|
void updateRaidInfoControls();
|
|
void updateRaidInfoPos();
|
|
SGameAvatarEx* GetObject(AR_HANDLE handle);
|
|
/// ¸®½؛ئ® °»½إ
|
|
void RefreshPartyPlayerList(std::vector<std::string> const& vecText);
|
|
void setRaidInfoShowStatus(std::string const& partyName, bool showStatus);
|
|
void destroyParty(std::string const& partyName);
|
|
void addPropList(AR_HANDLE handle, int propId);
|
|
void addPropList(SGameAvatarEx* avatar, int type, int textId);
|
|
/// 2012.01.11 ؤع·¯؟ح °ل°è¼®ہ؛ ¸َ½؛إح·خ µé¾î؟آ´ظ - prodongi
|
|
void addPropListAtCoreConnector(AR_HANDLE handle, int mobId);
|
|
void delPropList(AR_HANDLE handle);
|
|
void updatePropList();
|
|
void createMarkControl(KUIWnd** mark, KUIWnd** zoomMark, AR_HANDLE handle, char const* sprName, char const* name);
|
|
void refreshPropZoomTranslation();
|
|
void refreshPropTranslation();
|
|
void checkValidPropList();
|
|
void hidePropInfo();
|
|
void FreePartyControl();
|
|
|
|
void RefreshMap(bool bIsLogin = false);
|
|
void RefreshMapName();
|
|
void RefreshMapImg();
|
|
void RefreshMapPos();
|
|
|
|
class K3DTexture* GetMiniMapTexture(const char* pTexName, bool bIsLogin);
|
|
|
|
// Toggle m_bShowDurability variable (durability display UI). If true, then makes it false. If false, then makes it true
|
|
void ToggleDurability() {
|
|
m_bShowDurability ^= TRUE;
|
|
}
|
|
|
|
void setZoomType(float value);
|
|
/// 2011.08.17 - prodongi
|
|
bool insertQuestMob(AR_HANDLE handle, int enc_id);
|
|
bool insertQuestProp(AR_HANDLE handle, int prop_id);
|
|
bool insertQuestIcon(AR_HANDLE handle);
|
|
void removeQuestIcon(AR_HANDLE handle);
|
|
void refreshQuestIcon();
|
|
void createQuestIcon();
|
|
bool isQuestIcon(AR_HANDLE handle);
|
|
void procQuestIcon();
|
|
|
|
private:
|
|
void RefreshLocalName(); ///< [sonador][7.0.3]¹ج´د¸ت أ¤³خ ہج¸§ أâ·آ ؟ہ·ù ¼ِء¤
|
|
|
|
bool TranslatePosition(int* nPosX, int* nPosY);
|
|
|
|
void FillMiniMap();
|
|
|
|
std::string GetMapMiniName(int nMapX, int nMapY);
|
|
bool m_bIsLogin;
|
|
SUIDisplayInfo* m_pDisplayInfo;
|
|
|
|
XSmoothMiniMap m_MiniMap;
|
|
|
|
DWORD m_dwLastDrawTime;
|
|
DWORD m_dwLastDeleteTime;
|
|
static K3DRenderDeviceDX* s_pDevice;
|
|
K3DTextureSPtr m_spMiniMapTexture;
|
|
std::vector< K3DTextureSPtr> m_vtLoadedMapTexture;
|
|
KHash< K3DTexture*, hashPr_string_nocase > m_hsLoadedMapTexture;
|
|
|
|
class CTerrainSeamlessWorldInfo* m_pSeamlessWorldInfo;
|
|
|
|
float m_fRadian;
|
|
|
|
bool m_bNpcDrawFlag;
|
|
int m_nPlayerRealPosX;
|
|
int m_nPlayerRealPosY;
|
|
int m_nMiniMapSize;
|
|
bool m_bMiniMapShow;
|
|
KRect m_rtShowTextureRect; // Texture size where the character exists
|
|
|
|
float m_fZoomType; // Related to zoom
|
|
|
|
std::string m_LocalName; // Local name (e.g., area name)
|
|
int m_nCurrentLocation; // Location type
|
|
// 2010.06.15 - prodongi
|
|
bool m_isDeathMatch; // Indicates if it's a deathmatch
|
|
|
|
bool m_bPartyListUpdate; // Party synchronization flag, just in case
|
|
|
|
std::vector<NPC_INFO> m_vecNPCInfoList;
|
|
std::vector<PARTY_INFO> m_vecPartyInfoList;
|
|
|
|
raid_list m_raidInfoList;
|
|
prop_list m_propInfoList;
|
|
sUpdateTime<float> m_raidInfoUpdateTime;
|
|
|
|
int m_zoom_map_type;
|
|
int m_display_positoin_x;
|
|
int m_display_positoin_y;
|
|
std::string m_strBlank_resource;
|
|
int m_blank_a;
|
|
int m_blank_r;
|
|
int m_blank_g;
|
|
int m_blank_b;
|
|
|
|
class K3DTexture* m_pNewTex;
|
|
|
|
K3DTextureSPtr m_spZoomMiniMapTexture;
|
|
class KUIControlMiniMapStatic* m_pZoomMiniMapWnd;
|
|
float m_fZoomAlphaValue;
|
|
float m_fZoomMinimapZoomValue;
|
|
|
|
|
|
XSmoothMiniMap m_ZoomMiniMap;
|
|
|
|
bool m_bColse;
|
|
DWORD m_dwAlphaTime;
|
|
DWORD m_dwTime;
|
|
DWORD m_dwPlayerPointTime;
|
|
|
|
bool m_bPointSign;
|
|
|
|
bool m_bNotColse;
|
|
|
|
struct _NPC_INSTANCE_INFO_
|
|
{
|
|
AR_HANDLE handle;
|
|
unsigned status;
|
|
ENC_INT npc_id;
|
|
};
|
|
|
|
void AddNpcInstanceInfo(const _NPC_INSTANCE_INFO_& info);
|
|
void UpdateNpcInstanceStatus(AR_HANDLE handle, unsigned status);
|
|
|
|
void _AssignSteamToNullTerminatedString(KStream* stream, char** ppStr);
|
|
|
|
friend class NPCMarker;
|
|
NPCMarker m_npcMarker;
|
|
|
|
void updateMap(bool bIsLogin, K3DTexture* pDst, std::vector< XMiniMap::DrawInfo >& vInfo, int nLocalIndexX, int nLocalIndexY, int nImgWidth, int nImgHeight);
|
|
|
|
std::vector< _NPC_INSTANCE_INFO_ > m_vNpcInstanceList;
|
|
|
|
void HideLocalInfo();
|
|
void LoadLocalInfo();
|
|
void RefreshLocal();
|
|
bool ZoomMapTranslatePosition(const KRect& rect, int* nPosX, int* nPosY);
|
|
|
|
/// ءِ؟ھ¸ي ا¥½أ
|
|
struct _LOCAL_INFO_
|
|
{
|
|
int nType;
|
|
int nCenterX;
|
|
int nCenterY;
|
|
int nLocalID;
|
|
std::string strLocalID;
|
|
|
|
KUIWnd* wnd;
|
|
KUIWnd* zoomWnd;
|
|
|
|
_LOCAL_INFO_() : wnd(NULL), zoomWnd(NULL) {}
|
|
};
|
|
|
|
std::vector< _LOCAL_INFO_ > m_vLocalInfoList;
|
|
|
|
KUIControlSimpleButton* m_pBtnDuribility; // Durability display button.
|
|
bool m_bShowDurability; // Whether to display durability.
|
|
KUIControlStatic* m_pMapFrame;
|
|
|
|
sMinimapQuestIconCache m_questIconCache; /// 2011.08.17 - prodongi
|
|
std::map<AR_HANDLE, KUIWnd*> m_questIconList;
|
|
};
|