Skip to content

Commit

Permalink
Merge pull request #163 from ko4life-net/ui-levelguide
Browse files Browse the repository at this point in the history
Implement leveling guide v1264 UIF.
  • Loading branch information
stevewgr authored Oct 23, 2022
2 parents ef91336 + 1436ee9 commit aff1a42
Show file tree
Hide file tree
Showing 11 changed files with 273 additions and 56 deletions.
10 changes: 9 additions & 1 deletion src/engine/N3Base/N3UIString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ void CN3UIString::ChangeFont(const std::string & szFont) {
#endif

int CN3UIString::GetStringRealWidth(int iNum) {
SIZE size;
SIZE size{};
BOOL bFlag = m_pDFont->GetTextExtent("", lstrlen(""), &size);
__ASSERT(bFlag, "cannot get size of dfont");
int iLength = iNum / 2;
Expand All @@ -482,6 +482,14 @@ int CN3UIString::GetStringRealWidth(int iNum) {
return (size.cx * iLength);
}

int CN3UIString::GetStringRealWidthRect() {
SIZE size{};
BOOL bFlag = m_pDFont->GetTextExtent("", lstrlen(""), &size);
__ASSERT(bFlag, "cannot get size of dfont");

return (size.cy > 0) ? (m_rcRegion.bottom - m_rcRegion.top) / size.cy : 0;
}

void CN3UIString::SetStyle(DWORD dwType, DWORD dwStyleEx) {
if (dwType == UI_STR_TYPE_LINE) {
DWORD dwStyle = m_dwStyle;
Expand Down
1 change: 1 addition & 0 deletions src/engine/N3Base/N3UIString.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class CN3UIString : public CN3UIBase {
int GetLineCount() const { return m_iLineCount; }
int GetStartLine() const { return m_iStartLine; }
int GetStringRealWidth(int iNum);
int GetStringRealWidthRect();

virtual DWORD MouseProc(DWORD dwFlags, const POINT & ptCur, const POINT & ptOld);
virtual void Render();
Expand Down
11 changes: 9 additions & 2 deletions src/game/GameBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ CN3TableBase<__TABLE_PLAYER_LOOKS> * CGameBase::s_pTbl_NPC_Looks =
CN3TableBase<__TABLE_QUEST_MENU> * CGameBase::s_pTbl_QuestMenu = NULL; // 퀘스트 선택 메뉴
CN3TableBase<__TABLE_QUEST_TALK> * CGameBase::s_pTbl_QuestTalk = NULL; // 퀘스트 지문
CN3TableBase<__TABLE_TEXTS> * CGameBase::s_pTbl_Texts = NULL;
CN3TableBase<__TABLE_HELP> * CGameBase::s_pTbl_Help = NULL;

CN3WorldManager * CGameBase::s_pWorldMgr = NULL; // 월드 매니져..
CPlayerOtherMgr * CGameBase::s_pOPMgr = NULL; // Other Player Manager - 다른 유저 관리 클래스..
Expand Down Expand Up @@ -73,6 +74,7 @@ void CGameBase::StaticMemberInit() {
s_pTbl_QuestMenu = new CN3TableBase<__TABLE_QUEST_MENU>;
s_pTbl_QuestTalk = new CN3TableBase<__TABLE_QUEST_TALK>;
s_pTbl_Texts = new CN3TableBase<__TABLE_TEXTS>;
s_pTbl_Help = new CN3TableBase<__TABLE_HELP>;

std::string szLangTail = ".tbl";
int iLangID = ::GetUserDefaultLangID();
Expand All @@ -96,6 +98,8 @@ void CGameBase::StaticMemberInit() {
s_pTbl_QuestTalk->LoadFromFile(szFN.c_str()); // 퀘스트 관련 지문
szFN = "Data\\Texts" + szLangTail;
s_pTbl_Texts->LoadFromFile(szFN.c_str());
szFN = "Data\\help" + szLangTail;
s_pTbl_Help->LoadFromFile(szFN.c_str());

for (int i = 0; i < MAX_ITEM_EXTENSION; i++) {
char szFNTmp[256] = "";
Expand Down Expand Up @@ -146,6 +150,8 @@ void CGameBase::StaticMemberRelease() {
s_pTbl_QuestTalk = NULL; // 퀘스트 관련 지문
delete s_pTbl_Texts;
s_pTbl_Texts = NULL;
delete s_pTbl_Help;
s_pTbl_Help = NULL;

delete s_pPlayer;
s_pPlayer = NULL; // Player Character
Expand Down Expand Up @@ -465,9 +471,10 @@ e_Class_Represent CGameBase::GetRepresentClass(e_Class eClass) {
case CLASS_EL_CLERIC:
case CLASS_EL_DRUID:
return CLASS_REPRESENT_PRIEST;
}

return CLASS_REPRESENT_UNKNOWN;
default:
return CLASS_REPRESENT_GENERIC;
}
}

bool CGameBase::GetTextByNation(e_Nation eNation, std::string & szText) {
Expand Down
3 changes: 2 additions & 1 deletion src/game/GameBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ class CGameBase : public CN3Base {
static CN3TableBase<struct __TABLE_FX> * s_pTbl_FXSource; // FX소스 정보 테이블..
static CN3TableBase<struct __TABLE_QUEST_MENU> * s_pTbl_QuestMenu; // 퀘스트 선택 메뉴
static CN3TableBase<struct __TABLE_QUEST_TALK> * s_pTbl_QuestTalk; // 퀘스트 지문
static CN3TableBase<struct __TABLE_TEXTS> * s_pTbl_Texts;
static CN3TableBase<struct __TABLE_TEXTS> * s_pTbl_Texts; // Localized strings
static CN3TableBase<struct __TABLE_HELP> * s_pTbl_Help; // Leveling Guide

static class CN3WorldManager * s_pWorldMgr; // 월드 매니져 클래스..
static class CPlayerOtherMgr * s_pOPMgr; // Other Player Manager - 다른 유저 관리 클래스..
Expand Down
10 changes: 10 additions & 0 deletions src/game/GameDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ enum e_Class_Represent {
CLASS_REPRESENT_ROGUE,
CLASS_REPRESENT_WIZARD,
CLASS_REPRESENT_PRIEST,
CLASS_REPRESENT_GENERIC = 100,
CLASS_REPRESENT_UNKNOWN = 0xffffffff
};

Expand Down Expand Up @@ -1275,6 +1276,15 @@ typedef struct __TABLE_QUEST_TALK {
std::string szTalk; // 퀘스트 지문
} TABLE_QUEST_TALK;

typedef struct __TABLE_HELP {
int iID;
int iLevelMin;
int iLevelMax;
e_Class_Represent eRepresentClass;
std::string szTitle;
std::string szDescription;
} TABLE_HELP;

typedef struct __TABLE_TEXTS {
DWORD dwID;
std::string szText;
Expand Down
50 changes: 46 additions & 4 deletions src/game/GameProcMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3889,11 +3889,10 @@ void CGameProcMain::InitUI() {
m_pUILevelGuide->Init(s_pUIMgr);
m_pUILevelGuide->LoadFromFile(pTbl->szLevelGuide);
m_pUILevelGuide->SetVisibleWithNoSound(false);
m_pUILevelGuide->SetStyle(UISTYLE_USER_MOVE_HIDE);
m_pUILevelGuide->SetStyle(m_pUILevelGuide->GetStyle() | UISTYLE_POS_RIGHT);
rc = m_pUILevelGuide->GetRegion();
iX = (iW - (rc.right - rc.left)) / 2;
iY = (iH - (rc.bottom - rc.top)) / 2;
m_pUILevelGuide->SetPos(iX, iY);
m_pUILevelGuide->SetPos(iW - (rc.right - rc.left), 10);
m_pUILevelGuide->SetState(UI_STATE_COMMON_NONE);

// dead ui
m_pUIDead->Init(s_pUIMgr);
Expand Down Expand Up @@ -4499,6 +4498,10 @@ bool CGameProcMain::CommandToggleUIInventory() {
m_pUINotice->Close();
}

if (m_pUILevelGuide->IsVisible()) {
m_pUILevelGuide->SetVisible(false);
}

if (m_pUIInventory->IsVisible()) {
m_pUIInventory->Close(true);
return bNeedOpen;
Expand Down Expand Up @@ -4536,6 +4539,9 @@ bool CGameProcMain::CommandToggleUISkillTree() {
if (m_pUINotice->IsVisible()) {
m_pUINotice->Close();
}
if (m_pUILevelGuide->IsVisible()) {
m_pUILevelGuide->SetVisible(false);
}

s_pUIMgr->SetFocusedUI(m_pUISkillTreeDlg);
m_pUISkillTreeDlg->Open();
Expand Down Expand Up @@ -4566,6 +4572,9 @@ bool CGameProcMain::CommandToggleUINotice() {
if (m_pUISkillTreeDlg->IsVisible()) {
m_pUISkillTreeDlg->Close();
}
if (m_pUILevelGuide->IsVisible()) {
m_pUILevelGuide->SetVisible(false);
}

s_pUIMgr->SetFocusedUI(m_pUINotice);
m_pUINotice->Open();
Expand All @@ -4576,6 +4585,39 @@ bool CGameProcMain::CommandToggleUINotice() {
return bNeedOpen;
}

bool CGameProcMain::CommandToggleUILevelGuide() {
bool bNeedOpen = !(m_pUILevelGuide->IsVisible());

if (m_pSubProcPerTrade->m_ePerTradeState != PER_TRADE_STATE_NONE) {
return bNeedOpen;
}

if (bNeedOpen) {
if (m_pUIInventory->IsVisible()) {
m_pUIInventory->Close();
}
if (m_pUITransactionDlg->IsVisible()) {
m_pUITransactionDlg->LeaveTransactionState();
}
if (m_pUIWareHouseDlg->IsVisible()) {
m_pUIWareHouseDlg->LeaveWareHouseState();
}
if (m_pUISkillTreeDlg->IsVisible()) {
m_pUISkillTreeDlg->Close();
}
if (m_pUINotice->IsVisible()) {
m_pUINotice->SetVisible(false);
}

s_pUIMgr->SetFocusedUI(m_pUILevelGuide);
m_pUILevelGuide->SetVisible(true);
} else {
m_pUILevelGuide->SetVisible(false);
}

return bNeedOpen;
}

bool CGameProcMain::CommandToggleUIMiniMap() {
return m_pUIStateBarAndMiniMap->ToggleMiniMap();
}
Expand Down
1 change: 1 addition & 0 deletions src/game/GameProcMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ class CGameProcMain : public CGameProcedure {
bool CommandToggleUISkillTree();
bool CommandToggleUIMiniMap();
bool CommandToggleUINotice();
bool CommandToggleUILevelGuide();

void CommandMove(e_MoveDirection eMD, bool bStartOrEnd); // 움직이는 방향(전후진, 멈춤), 움직이기 시작하는가?
void CommandEnableAttackContinous(bool bEnable, CPlayerBase * pTarget);
Expand Down
Loading

0 comments on commit aff1a42

Please sign in to comment.