Files
2026-06-01 12:46:52 +02:00

935 lines
21 KiB
C++

/// 2010.11.17 - prodongi
#include "stdafx.h"
#include "SUIWorldAllMapWnd.h"
#include <kfile/KFileManager.h>
#include "SUIWorldMapWnd.h"
#include "SUIWorldDetailMapWnd.h"
//#include "Util.h"
//#include "SUIUtil.h"
//#include "SGameMessageUI.h"
#include "SGameMessage.h"
#include "SPlayerInfoMgr.h"
#include "SMessengerMgr.h"
#include "SChatType.h"
#include "SGameCamera.h"
#include "KUIControlStatic.h"
#include "SGameSystem.h"
extern SGameSystem* g_pCurrentGameSystem;
/*
*/
void SUIWorldAllMapWnd::sFieldMaskInfo::load()
{
byte* graymap = (byte*)KFileManager::Instance().readData("game_panel_image_worldmap_over_all.bmp");
if (!graymap)
{
assert(0 && "failed open world map field mask");
return ;
}
BITMAPFILEHEADER bf;
BITMAPINFOHEADER bi;
//
memcpy(&bf, graymap, sizeof (bf));
//
memcpy(&bi, graymap + sizeof (BITMAPFILEHEADER) , sizeof (bi));
if (8 != bi.biBitCount)
{
SAFE_DELETE_ARRAY(graymap);
assert(0 && "worldmap_test.bmp isn't gray scale map");
return ;
}
byte* filedata = graymap + bf.bfOffBits;
//
m_width = bi.biWidth;
m_height = bi.biHeight;
m_pitch = bi.biSizeImage/bi.biHeight;
m_dataSize = bi.biSizeImage;
//
SAFE_DELETE_ARRAY(m_data);
m_data = new byte[bi.biSizeImage];
//
int destPos, srcPos;
for (int h = 0; h < bi.biHeight; ++h)
{
destPos = (bi.biHeight - h - 1) * m_pitch;
srcPos = h * m_pitch;
memcpy(m_data + destPos, filedata + srcPos, m_pitch);
}
SAFE_DELETE_ARRAY(graymap);
}
/*
*/
int SUIWorldAllMapWnd::sFieldMaskInfo::picking(int mouseX, int mouseY, KUIWnd const* basisWnd)
{
if (!m_data)
return 255;
if (!basisWnd)
return 255;
int x = mouseX - basisWnd->GetRect().left;
int y = mouseY - basisWnd->GetRect().top;
if (x < 0 || x >= m_width) return 255;
if (y < 0 || y >= m_height) return 255;
return m_data[y * m_pitch + x];
}
/*
*/
float SUIWorldAllMapWnd::sFadeInOutField::calcS(DWORD elapsedtime)
{
float t = (float)elapsedtime/1000.0f;
return getAlphaV() * t;
}
/*
*/
bool SUIWorldAllMapWnd::sFadeOutField::update(DWORD elapsedtime)
{
if (0 > m_field) return true;
if (!m_wnd) return true;
float alpha = m_wnd->GetAlpha();
bool ret = false;
alpha += calcS(elapsedtime);
if (alpha >= 1.0f)
{
alpha = 1.0f;
ret = true;
}
m_wnd->ChangeAlpha(alpha);
return ret;
}
/*
*/
bool SUIWorldAllMapWnd::sFadeInField::update(DWORD elapsedtime)
{
if (0 > m_field) return true;
if (!m_wnd) return true;
float alpha = m_wnd->GetAlpha();
bool ret = false;
alpha -= calcS(elapsedtime);
if (alpha <= 0.0f)
{
alpha = 0.0f;
ret = true;
}
m_wnd->ChangeAlpha(alpha);
return ret;
}
/*
*/
SUIWorldAllMapWnd::SUIWorldAllMapWnd(SGameManager* pGameManager) : SUIWnd(pGameManager)
{
m_lastOverColor = 0;
m_mouseX = -1;
m_mouseY = -1;
m_playerWnd = NULL;
m_rtWorldWnd = NULL;
m_playerRealPos = KPoint(0, 0);
m_playerRadian = 0.0f;
m_bPointSign = FALSE;
m_dwPlayerPointTime = 0;
}
/*
*/
SUIWorldAllMapWnd::~SUIWorldAllMapWnd()
{
m_fadeInFieldList.clear();
}
/*
*/
SUIWnd* SUIWorldAllMapWnd::CreateWnd(const char* szNUIFileName, KUIWndManager* pWndManager, KPoint kPos, int nWindowID)
{
SUIWnd::CreateWnd(szNUIFileName, pWndManager, kPos, nWindowID);
SetChildShow("button_rondo_village_01", false);
SetChildShow("button_rondo_village_02", false);
SetChildShow("button_rondo_village_03", false);
SetChildShow("button_rondo_village_04", false);
m_villageWnd[0] = GetChild("button_village_01");
m_villageWnd[1] = GetChild("button_village_03");
m_villageWnd[2] = GetChild("button_village_04");
m_villageWnd[3] = GetChild("button_village_05");
m_villageWnd[4] = GetChild("button_village_06");
m_townWnd[0] = GetChild("village_rondo_over_area_01");
m_townDetailWnd[0] = GetChild("button_rondo_village_01");
m_townDetailWnd[1] = GetChild("button_rondo_village_02");
m_townDetailWnd[2] = GetChild("button_rondo_village_03");
m_townDetailWnd[3] = GetChild("button_rondo_village_04");
char str[128];
/// 오버랩 이미지 이동
for (int i = 0; i < WORLDMAP_FIELD_NUM; ++i)
{
sprintf(str, "worldmap_over_area_%02d", i+1);
m_fieldWnd[i] = GetChild(str);
m_fieldWnd[i]->MovePos(m_fieldWnd[i]->GetRect().left - 600, m_fieldWnd[i]->GetRect().top); /// -600한 이유는 nui사에 오른쪽으로 600만큼 이동되어 있기 때문이다.
m_fieldWnd[i]->SetShow(false);
}
return this;
}
/*
*/
void SUIWorldAllMapWnd::PumpUpMessage(LPCSTR lpszControlID, DWORD nMessage, DWORD lparam, DWORD wparam)
{
switch(nMessage)
{
case KUI_MESSAGE::KBUTTON_CLICK:
{
buttonClick(lpszControlID, lparam, wparam);
}
break;
case KUI_MESSAGE::KFOCUS_ACTIVATED:
#ifdef _DEV
MoveWorld(KPoint(lparam,wparam));
#else
if( GameRule::GetCurrentLocalBitSet() == GameRule::LOCAL_BITSET::KR &&
g_pCurrentGameSystem->GetLocalPlayerPermission() > 0 )
MoveWorld(KPoint(lparam,wparam));
#endif
break;
case KUI_MESSAGE::KICON_CLICK:
{
openFieldDetailMap();
}
break;
}
SUIWnd::PumpUpMessage( lpszControlID, nMessage, lparam, wparam );
}
/*
*/
bool SUIWorldAllMapWnd::InitControls( KPoint kPos )
{
if (!SUIWnd::InitControls(kPos))
return false;
return true;
}
/*
*/
bool SUIWorldAllMapWnd::InitData( bool bReload )
{
if (!SUIWnd::InitData(bReload))
return false;
m_rtWorldWnd = GetChild( "static_temp" );
m_playerWnd = GetChild("worldmap_player");
m_fieldMaskInfo.load();
return true;
}
/*
*/
void SUIWorldAllMapWnd::OnNotifyUIWindowOpen( bool bOpen, bool bLimitWnd )
{
if (bOpen)
{
SetChildShow("button_rondo_village_01", false);
SetChildShow("button_rondo_village_02", false);
SetChildShow("button_rondo_village_03", false);
SetChildShow("button_rondo_village_04", false);
m_fadeInFieldList.clear();
refreshPlayerPos();
for (int i = 0; i < WORLDMAP_FIELD_NUM; ++i)
{
m_fieldWnd[i]->SetShow(false);
m_fieldWnd[i]->ChangeAlpha(0.0f);
}
}
}
/*
*/
void SUIWorldAllMapWnd::ProcMsgAtStatic(SGameMessage* pMsg)
{
switch(pMsg->nType)
{
case IMSG_UI_2DPOS_INFO:
{
SIMSG_UI_2DPOS_INFO* p2DPosMsg = (SIMSG_UI_2DPOS_INFO*)pMsg;
switch( p2DPosMsg->nObjType )
{
case SIMSG_UI_2DPOS_INFO::TY_MY:
{
if( !m_PlayerInfoMgr.IsLocalPlayer(p2DPosMsg->handle) ) break;
setPlayerRealPos( p2DPosMsg->nReal_X, p2DPosMsg->nReal_Y );
if( p2DPosMsg->fRadian )
{
if( m_playerRadian != p2DPosMsg->fRadian )
{
m_playerRadian = p2DPosMsg->fRadian;
/// 2011.03.14 - prodongi
//((KUIControlStatic*)m_playerWnd)->SetRotate( (SGameCamera::PI/2) - m_playerRadian );
setPlayerRotation(p2DPosMsg->fRadian);
}
}
}
break;
case SIMSG_UI_2DPOS_INFO::TY_PLAYER:
{
//if( m_PartyMgr.IsExistMember(p2DPosMsg->handle) )
// refreshPartyPlayerPos();
}
break;
}
pMsg->bUse = true;
}
break;
/* /// 2011.03.14 카메라 방향은 설정 안 하기로 한다 - prodongi
case IMSG_UI_MY_DEGREE:
{
if (IsShow() && m_playerWnd)
{
SIMSG_UI_MY_DEGREE* pRotateMsg = (SIMSG_UI_MY_DEGREE*)pMsg;
/// 2011.03.14 - prodongi
//((KUIControlStatic*)m_playerWnd)->SetRotate( (SGameCamera::PI/2) - pRotateMsg->fRadian );
setPlayerRotation(pRotateMsg->fRadian);
pMsg->bUse = true;
}
}
break;
*/
case MSG_CHATTING:
{
SMSG_CHATTING* pChatMsg = ( SMSG_CHATTING* )pMsg;
// if( pChatMsg->nChatType == CHAT_PARTY_SYSTEM )
// RefreshPartyPlayerPos();
pMsg->bUse = true;
}
break;
/// 2011.03.15 test 코드, 혹시 몰르니 남겨둔다 - prodongi
/*
case IMSG_HOTKEY_EX:
{
SIMSG_HOTKEY_EX* pHotKey = static_cast<SIMSG_HOTKEY_EX*>(pMsg);
if( pHotKey->wParam == VK_SHIFT )
m_bShiftKey = (pHotKey->bUp == 0);
if (pHotKey->wParam == VK_CONTROL)
m_bControlKey = (pHotKey->bUp == 0);
if( pHotKey->wParam == VK_MENU )
m_bAltKey = (pHotKey->bUp == 0);
testKeyInput(pHotKey->wParam);
}
break;
*/
}
}
/* /// 2011.03.15 test 코드, 혹시 몰르니 남겨둔다 - prodongi
*/
/*
void SUIWorldAllMapWnd::testKeyInput(WPARAM wParam)
{
if( IsShow() )
{
KRect r(0, 0, 0, 0);
int mag = 1;
int dir = (m_bShiftKey) ? 1 : -1;
int offset = dir * mag;
if( wParam == VK_DOWN )
{
r.bottom += offset;
}
if( wParam == VK_UP )
{
r.top += offset;
}
if( wParam == VK_LEFT )
{
r.left += offset;
}
if( wParam == VK_RIGHT)
{
r.right += offset;
}
if (m_bControlKey)
{
if( wParam == VK_LEFT )
{
r.left -= mag;
r.right -= mag;
}
if( wParam == VK_RIGHT )
{
r.left += mag;
r.right += mag;
}
if( wParam == VK_UP )
{
r.top -= mag;
r.bottom -= mag;
}
if( wParam == VK_DOWN )
{
r.top += mag;
r.bottom += mag;
}
}
_oprint("%d, %d, %d, %d / ", r.left, r.top, r.right, r.bottom);
SUIWorldMapWnd* parentWnd = dynamicCast<SUIWorldMapWnd*>(GetParent());
parentWnd->refreshNpcPos(r);
}
}
*/
/*
*/
void SUIWorldAllMapWnd::Process(DWORD dwTime, DWORD elapsedtime)
{
KUIWnd::Process(dwTime);
procPicking();
procFadeInOutField(elapsedtime);
if ( dwTime-m_dwPlayerPointTime > WORLDSIGNTIME )
{
m_playerWnd->SetShow(m_bPointSign);
m_bPointSign = !m_bPointSign;
m_dwPlayerPointTime = dwTime;
}
}
/*
*/
void SUIWorldAllMapWnd::procPicking()
{
if (procPickingTownDetail())
{
resetFadeInOutField();
}
else
{
if (procPickingTown())
{
showTownDetail(true);
resetFadeInOutField();
}
else
{
showTownDetail(false);
if (procPickingVillage())
{
resetFadeInOutField();
}
else
{
procPickingField();
if (0 > m_fadeOutField.m_field)
{
m_pickInfo.clear();
}
}
}
}
}
/*
*/
bool SUIWorldAllMapWnd::procPickingTownDetail()
{
for (int i = 0; i < WORLDMAP_TOWN_DETAIL_NUM; ++i)
{
if (m_townDetailWnd[i]->IsInRect(m_mouseX, m_mouseY))
{
m_pickInfo.set(sPickInfo::TOWN_DETAIL, i);
return true;
}
}
return false;
}
/*/
*/
bool SUIWorldAllMapWnd::procPickingTown()
{
for (int i = 0; i < WORLDMAP_TOWN_NUM; ++i)
{
if (m_townWnd[i]->IsInRect(m_mouseX, m_mouseY))
{
m_pickInfo.set(sPickInfo::TOWN, i);
return true;
}
}
return false;
}
/*
*/
bool SUIWorldAllMapWnd::procPickingVillage()
{
for (int i = 0; i < WORLDMAP_VILLAGE_NUM; ++i)
{
if (m_villageWnd[i]->IsInRect(m_mouseX, m_mouseY))
{
m_pickInfo.set(sPickInfo::VILLAGE, i);
return true;
}
}
return false;
}
/*
*/
bool SUIWorldAllMapWnd::procPickingField()
{
int pickColor = m_fieldMaskInfo.picking(m_mouseX, m_mouseY, this);
if (pickColor != m_lastOverColor)
{
int field = colorToField(pickColor);
m_lastOverColor = pickColor;
addFadeInField(m_fadeOutField.m_field);
setFadeOutField(field);
m_pickInfo.set(sPickInfo::FIELD, field);
return true;
}
return false;
}
/*
*/
void SUIWorldAllMapWnd::resetFadeInOutField()
{
m_lastOverColor = 255;
addFadeInField(m_fadeOutField.m_field);
setFadeOutField(-1);
}
/*
*/
int SUIWorldAllMapWnd::colorToField(int color)
{
switch (color)
{
case 9: return 0;
case 15: return 1;
case 21: return 2;
case 28: return 3;
case 35: return 4;
case 43: return 5;
case 51: return 6;
case 60: return 7;
case 68: return 8;
case 78: return 9;
case 87: return 10;
case 97: return 11;
case 107: return 12;
case 118: return 13;
case 129: return 14;
case 139: return 15;
}
return -1;
}
/*
*/
void SUIWorldAllMapWnd::procFadeInOutField(DWORD elapsedtime)
{
std::vector<sFadeInField>::iterator it_in = m_fadeInFieldList.begin();
for (; it_in != m_fadeInFieldList.end();)
{
if (it_in->update(elapsedtime))
{
it_in->m_wnd->SetShow(false);
it_in = m_fadeInFieldList.erase(it_in);
}
else
{
++it_in;
}
}
m_fadeOutField.update(elapsedtime);
}
/*
*/
bool SUIWorldAllMapWnd::addFadeInField(int field)
{
if (0 > field) return false;
std::vector<sFadeInField>::iterator it_in = std::find(m_fadeInFieldList.begin(), m_fadeInFieldList.end(), field);
if (it_in == m_fadeInFieldList.end())
{
sFadeInField info;
info.m_field = field;
info.m_wnd = m_fieldWnd[field];
m_fadeInFieldList.push_back(info);
return true;
}
return false;
}
/*
*/
bool SUIWorldAllMapWnd::delFadeInField(int field)
{
std::vector<sFadeInField>::iterator it_in = std::find(m_fadeInFieldList.begin(), m_fadeInFieldList.end(), field);
if (it_in != m_fadeInFieldList.end())
{
m_fadeInFieldList.erase(it_in);
return true;
}
return false;
}
/*
*/
void SUIWorldAllMapWnd::setFadeOutField(int field)
{
m_fadeOutField.m_field = field;
if (0 <= field)
{
m_fadeOutField.m_wnd = m_fieldWnd[field];
m_fadeOutField.m_wnd->SetShow(true);
}
}
/*
*/
void SUIWorldAllMapWnd::delFadeOutField()
{
m_fadeOutField.m_field = 0;
}
/*
*/
void SUIWorldAllMapWnd::setMousePos(int x, int y)
{
m_mouseX = x;
m_mouseY = y;
}
/*
*/
void SUIWorldAllMapWnd::showTownDetail(bool show)
{
for (int i = 0; i < WORLDMAP_TOWN_DETAIL_NUM; ++i)
{
m_townDetailWnd[i]->SetShow(show);
}
}
/*
*/
void SUIWorldAllMapWnd::openFieldDetailMap()
{
if (sPickInfo::FIELD != m_pickInfo.m_type)
return ;
if (0 > m_pickInfo.m_index)
return ;
/// 필드의 월드 좌표를 구한다
KRect worldRect;
getFieldWndWorldRect(m_pickInfo.m_index, worldRect);
SUIWorldMapWnd* parentWnd = dynamicCast<SUIWorldMapWnd*>(GetParent());
parentWnd->readyOpenDetailMap(SUIWorldDetailMapWnd::FIELD, m_pickInfo.m_index, true, worldRect);
}
/*
*/
void SUIWorldAllMapWnd::openVillageDetailMap(int type, int index)
{
if (0 > index)
return ;
KRect worldRect;
getVillageWndWorldRect(type, index, worldRect);
SUIWorldMapWnd* parentWnd = dynamicCast<SUIWorldMapWnd*>(GetParent());
parentWnd->readyOpenDetailMap(type, index, true, worldRect);
}
/*
*/
void SUIWorldAllMapWnd::buttonClick(LPCSTR lpszControlID, DWORD lparam, DWORD wparam)
{
SUIWorldMapWnd* parentWnd = dynamicCast<SUIWorldMapWnd*>(GetParent());
if (parentWnd->isDetailMapShow())
return ;
if( ::_stricmp( lpszControlID, "button_village_01" ) == 0 )
{
openVillageDetailMap(SUIWorldDetailMapWnd::VILLAGE, 0);
}
else if( ::_stricmp( lpszControlID, "button_village_03" ) == 0 )
{
openVillageDetailMap(SUIWorldDetailMapWnd::VILLAGE, 2);
}
else if( ::_stricmp( lpszControlID, "button_village_04" ) == 0 )
{
openVillageDetailMap(SUIWorldDetailMapWnd::VILLAGE, 3);
}
else if( ::_stricmp( lpszControlID, "button_village_05" ) == 0 )
{
openVillageDetailMap(SUIWorldDetailMapWnd::VILLAGE, 4);
}
else if( ::_stricmp( lpszControlID, "button_village_06" ) == 0 ) /// 2011.06.02 - prodongi
{
openVillageDetailMap(SUIWorldDetailMapWnd::VILLAGE, 5);
}
else if( ::_stricmp( lpszControlID, "button_rondo_village_01" ) == 0 )
{
openVillageDetailMap(SUIWorldDetailMapWnd::TOWN, 0);
}
else if( ::_stricmp( lpszControlID, "button_rondo_village_02" ) == 0 )
{
openVillageDetailMap(SUIWorldDetailMapWnd::TOWN, 1);
}
else if( ::_stricmp( lpszControlID, "button_rondo_village_03" ) == 0 )
{
openVillageDetailMap(SUIWorldDetailMapWnd::TOWN, 2);
}
else if( ::_stricmp( lpszControlID, "button_rondo_village_04" ) == 0 )
{
openVillageDetailMap(SUIWorldDetailMapWnd::TOWN, 3);
}
}
/*
*/
void SUIWorldAllMapWnd::setPlayerRealPos(int realX, int realY)
{
m_playerRealPos.x = realX;
m_playerRealPos.y = realY;
if (IsShow())
refreshPlayerPos();
}
/*
*/
void SUIWorldAllMapWnd::refreshPlayerPos()
{
KPoint uiPos;
if( m_playerRealPos.x >= 209677 && m_playerRealPos.x <= 225786 &&
m_playerRealPos.y >= 16135 && m_playerRealPos.y <= 32238 ) //시크루트
{
uiPos.x = 489;
uiPos.y = 321;
}
else if( m_playerRealPos.x >= 193561 && m_playerRealPos.x <= 209663 &&
m_playerRealPos.y >= 64534 && m_playerRealPos.y <= 80000 ) //마리캣 마켓
{
uiPos.x = 115;
uiPos.y = 40;
}
//라크시 예외 처리
else if( m_playerRealPos.x < WORLDMAP_TILEWIDTH && m_playerRealPos.y < WORLDMAP_TILEHEIGHT )
{
uiPos.x = 205;
uiPos.y = 110;
}
else
{
SUIWorldMapWnd::convertWorldToUiPos(m_playerRealPos, uiPos, m_rtWorldWnd->GetRect(), KPoint(WORLDMAP_REALWIDTH_WITHOUT_DUNGEON, WORLDMAP_REALHEIGHT));
}
if(m_playerWnd)
{
m_playerWnd->MovePos(m_rtWorldWnd->GetRect().left + uiPos.x - (m_playerWnd->GetRect().GetWidth()/2),
m_rtWorldWnd->GetRect().top + uiPos.y - (m_playerWnd->GetRect().GetHeight()/2));
}
}
/*
*/
void SUIWorldAllMapWnd::getFieldWndWorldRect(int index, KRect& worldRect)
{
KRect fieldRect = m_fieldWnd[index]->GetRect();
convertUiToWorldRect(fieldRect, worldRect);
}
/*
*/
void SUIWorldAllMapWnd::getVillageWndWorldRect(int type, int index, KRect& worldRect)
{
/// 라크시 일때
if (SUIWorldDetailMapWnd::VILLAGE == type && 0 == index)
{
KUIWnd* uiRoundWnd = GetChild("worldmap_area_village_laksy_01");
KUIWnd* uiLaksyWnd = GetChild("worldmap_area_village_01");
float rateWidth = WORLDMAP_TILEWIDTH/(float)uiRoundWnd->GetRect().GetWidth();
float rateHeight = WORLDMAP_TILEHEIGHT/(float)uiRoundWnd->GetRect().GetHeight();
/// 2011.03.03 미묘한 차이 때문에 테스트 후에 값을 보정함 - prodongi
rateWidth += -2.1111f;
rateHeight += 1.8889f;
KRect laksyRect = uiLaksyWnd->GetRect();
laksyRect.OffsetRect(-GetRect().left, -GetRect().top);
worldRect.left = rateWidth * (float)(laksyRect.left);
worldRect.top = rateHeight * (float)(laksyRect.top);
worldRect.right = rateWidth * (float)(laksyRect.right);
worldRect.bottom = rateHeight * (float)(laksyRect.bottom);
}
else
{
char const* nuiName = "";
if (SUIWorldDetailMapWnd::VILLAGE == type)
{
switch (index)
{
case 2: nuiName = "worldmap_area_village_03"; break;
case 3: nuiName = "worldmap_area_village_04"; break;
case 4: nuiName = "worldmap_area_village_05"; break;
case 5: nuiName = "worldmap_area_village_06"; break;
}
}
else if (SUIWorldDetailMapWnd::TOWN == type)
{
switch (index)
{
case 0: nuiName = "worldmap_area_village_rondo_01"; break;
case 1: nuiName = "worldmap_area_village_rondo_02"; break;
case 2: nuiName = "worldmap_area_village_rondo_03"; break;
case 3: nuiName = "worldmap_area_village_rondo_04"; break;
}
}
KUIWnd* wnd = GetChild(nuiName);
KRect villageRect = wnd->GetRect();
convertUiToWorldRect(villageRect, worldRect);
}
}
/* /// 2011.03.02 - prodongi
*/
void SUIWorldAllMapWnd::convertUiToWorldRect(KRect& uiRect, KRect& worldRect)
{
KPoint worldPos;
KPoint worldSize(WORLDMAP_REALWIDTH_WITHOUT_DUNGEON, WORLDMAP_REALHEIGHT);
KPoint offset(m_rtWorldWnd->GetRect().left, m_rtWorldWnd->GetRect().top);
uiRect.OffsetRect(-offset.x, -offset.y);
SUIWorldMapWnd::convertUiToWorldPos(KPoint(uiRect.left, uiRect.top), worldPos, m_rtWorldWnd->GetRect(), worldSize);
worldRect.left = worldPos.x;
worldRect.top = worldPos.y;
SUIWorldMapWnd::convertUiToWorldPos(KPoint(uiRect.right, uiRect.bottom), worldPos, m_rtWorldWnd->GetRect(), worldSize);
worldRect.right = worldPos.x;
worldRect.bottom = worldPos.y;
swap(worldRect.top, worldRect.bottom);
}
/* /// 2011.03.14 - prodongi
*/
void SUIWorldAllMapWnd::setPlayerRotation(float radian)
{
float offset = SGameCamera::PI/4.0f;
((KUIControlStatic*)m_playerWnd)->SetRotate( (SGameCamera::PI/2) - radian + offset );
}
void SUIWorldAllMapWnd::convertWorldToUiPos(KPoint const& worldPos, KPoint& uiPos)
{
if( worldPos.x >= 209677 && worldPos.x <= 225786 &&
worldPos.y >= 16135 && worldPos.y <= 32238 ) //시크루트
{
uiPos.x = 489;
uiPos.y = 321;
}
else if( worldPos.x >= 193561 && worldPos.x <= 209663 &&
worldPos.y >= 64534 && worldPos.y <= 80000 ) //마리캣 마켓
{
uiPos.x = 115;
uiPos.y = 40;
}
//라크시 예외 처리
else if( worldPos.x < WORLDMAP_TILEWIDTH && worldPos.y < WORLDMAP_TILEHEIGHT )
{
uiPos.x = 205;
uiPos.y = 110;
}
else
{
SUIWorldMapWnd::convertWorldToUiPos(worldPos, uiPos, m_rtWorldWnd->GetRect(), KPoint(WORLDMAP_REALWIDTH_WITHOUT_DUNGEON, WORLDMAP_REALHEIGHT));
}
uiPos.x += m_rtWorldWnd->GetRect().left;
uiPos.y += m_rtWorldWnd->GetRect().top;
}
/// 2012.03.15 - prodongi
void SUIWorldAllMapWnd::createNpc(const vecNpcInfo &npcList)
{
KPoint uiPos;
std::string iconName;
vecNpcInfo::const_iterator it = npcList.begin();
for (; it != npcList.end(); ++it)
{
if (!it->is_render)
continue;
getNpcIconAniName(iconName, it->type, 0);
KUIWnd* wnd = m_pManager->CreateControl( KUIWND_CREATE_ARG( "iconstatic", it->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( wnd )
{
wnd->SetShow(true);
SUIWorldMapWnd::convertWorldToUiPos(KPoint(it->x, it->y), uiPos, m_rtWorldWnd->GetRect(), KPoint(WORLDMAP_REALWIDTH_WITHOUT_DUNGEON, WORLDMAP_REALHEIGHT));
wnd->MovePos(m_rtWorldWnd->GetRect().left + uiPos.x - (wnd->GetRect().GetWidth()/2),
m_rtWorldWnd->GetRect().top + uiPos.y - (wnd->GetRect().GetHeight()/2));
}
}
}
void SUIWorldAllMapWnd::MoveWorld(KPoint uiPos)
{
if( !HIBYTE(GetAsyncKeyState(VK_CONTROL)) )
return;
KPoint worldPos;
KPoint worldSize(WORLDMAP_REALWIDTH_WITHOUT_DUNGEON, WORLDMAP_REALHEIGHT);
KPoint offset(m_rtWorldWnd->GetRect().left, m_rtWorldWnd->GetRect().top);
uiPos.x -= offset.x;
uiPos.y -= offset.y;
if( uiPos.x >= 488 && uiPos.x <= 498 &&
uiPos.y >= 311 && uiPos.y <= 326 ) //시크루트
{
worldPos.x = 222133;
worldPos.y = 17990;
}
else if( uiPos.x >= 108 && uiPos.x <= 122 &&
uiPos.y >= 29 && uiPos.y <= 42 ) //마리캣 마켓
{
worldPos.x = 201526;
worldPos.y = 72511;
}
//라크시 예외 처리
else if( uiPos.x >= 184 && uiPos.x <= 244 &&
uiPos.y >= 20 && uiPos.y <= 139 )
{
worldPos.x = 6725;
worldPos.y = 6981;
}
else if ( uiPos.x < 0 || uiPos.y < 0 )
return;
else
{
SUIWorldMapWnd::convertUiToWorldPos(uiPos, worldPos, m_rtWorldWnd->GetRect(), worldSize);
}
g_pCurrentGameSystem->OnMsgMoveMap ( worldPos.x, worldPos.y );
SDEBUGLOG( "[map click pos ui= %d,%d world= %d,%d]", uiPos.x, uiPos.y, worldPos.x, worldPos.y );
}