⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 maintitle.cpp

📁 墨香最新私服
💻 CPP
📖 第 1 页 / 共 2 页
字号:
// MainTitle.cpp: implementation of the CMainTitle class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"

#include "MainTitle.h"
#include "MainGame.h"

#include "cWindowSystemFunc.h"
#include "WindowIDEnum.h"
#include "MHCamera.h"

#include "AppearanceManager.h"
#include "./Interface/cWindowManager.h"
#include "./Interface/cEditBox.h"
#include "./Interface/cResourceManager.h"
#include "../[CC]Header/GameResourceManager.h"
#include "ItemManager.h"
#include "KyungGongManager.h"
#include "ChatManager.h"
#include "MHTimeManager.h"

#include "FilteringTable.h"
#include "cMsgBox.h"
#include "SkillManager_client.h"

#include "mhMap.h"
#include "./Input/Mouse.h"
#include "./Input/Keyboard.h"
#include "MotionManager.h"
#include "AbilityManager.h"
#include "AbilityUpdater_Interface.h"
#include "AbilityUpdater_ApplyData.h"
#include "ServerListDialog.h"
#include "CharSelect.h"
#include "cImageSelf.h"
#include "DissolutionManager.h"

#ifdef _GMTOOL_
#include "GMToolManager.h"
#endif


#define _LOGOWINDOW_

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
extern char g_DistributeAddr[16];
extern WORD g_DistributePort;
extern char g_AgentAddr[16];
extern WORD g_AgentPort;
extern char g_szHeroIDName[];


#define ALPHA_PROCESS_TIME	1200
#define WAIT_CONNECT_TIME	90000	//俊捞怜飘肺 立加扁促覆 矫埃 90檬


void SendOutMsg()
{
	MSGBASE msg;
	msg.Category = MP_USERCONN;
	msg.Protocol = MP_USERCONN_REQUEST_DISTOUT;
	NETWORK->Send(&msg, sizeof(msg));
/*
#ifdef TAIWAN_LOCAL
	cDialog* dlg = WINDOWMGR->GetWindowForID( MT_LOGINDLG );
	if( !dlg ) return;
	dlg->SetDisable( FALSE );
	dlg->GetWindowForID( MT_BTN_DYNAMIC )->SetActive( TRUE );
	((cCheckBox*)dlg->GetWindowForID( MT_BTN_DYNAMIC ))->SetChecked( FALSE );

	dlg->GetWindowForID( MT_STC_DYNAMIC )->SetActive( TRUE );
	dlg->GetWindowForID( MT_STC_COORD )->SetActive( FALSE );
	dlg->GetWindowForID( MT_STC_COORD_MAT )->SetActive( FALSE );

	((cButton*)dlg->GetWindowForID( MT_OKBTN ))->SetText( RESRCMGR->GetMsg(25), RGB_HALF(255,255,255), RGB_HALF(255,255,0), RGB_HALF(255,255,0) ); //login
#endif
*/
}

BOOL bFirst;
GLOBALTON(CMainTitle)
CMainTitle::CMainTitle()
{
#ifdef TAIWAN_LOCAL
	m_pAdvice		= NULL;
#endif
	m_pLogoWindow	= NULL;
	m_bInit			= FALSE;

	m_pServerListDlg = NULL;
	memset( m_DistributeAddr, 0, 16 );
	m_DistributePort = 0;
	m_bServerList = FALSE;

	m_bDisconntinToDist = FALSE;
	m_bDynamicDlg = FALSE;
}

CMainTitle::~CMainTitle()
{	
}

static BOOL g_bResourceLoaded = FALSE;
cImageSelf image;

BOOL CMainTitle::Init(void* pInitParam)
{
	image.LoadSprite("image/login.tif");
	//
	m_pLogoWindow	= NULL;
	m_bInit			= FALSE;
	m_pServerListDlg = NULL;
	memset( m_DistributeAddr, 0, 16 );
	m_DistributePort = 0;
	//
	
	m_bDisconntinToDist = FALSE;
	m_bNoDiconMsg		= FALSE;	//KES 蜡历啊 立加阑 谗菌阑锭绰 皋技瘤甫 救剁快扁困茄 函荐
	m_bDynamicDlg = FALSE;


	NETWORK->SetCurState(this);

	// 霸烙府家胶 肺靛///////////////////////////////////////////////////////////////////////
	if(MAP->IsInited() == FALSE)
		MAP->InitMap(102);
	if(g_bResourceLoaded == FALSE)
	{
		FILTERTABLE->Init();
		CHATMGR->Init();
		//捞吧 酒贰肺 郴啡歹聪 版肺啊 官差绢辑 颇老阑 肺靛且 荐 绝促.
		//酒贰吝 版肺甫 官操绢 初绰 巴捞 乐栏搁 力磊府肺 倒妨初栏矫坷~.
		MOTIONMGR->LoadMotionList();
		SKILLMGR->Init();
		ITEMMGR->LoadItemList();
		ITEMMGR->LoadItemToolTipList();	
		GAMERESRCMNGR->LoadMonsterList();
		GAMERESRCMNGR->LoadSMonsterList();
		GAMERESRCMNGR->LoadNpcChxList();
		GAMERESRCMNGR->LoadNpcList(GAMERESRCMNGR->m_NpcList);
		GAMERESRCMNGR->LoadExpPoint();
		GAMERESRCMNGR->LoadTacticStartInfoList();
		GAMERESRCMNGR->LoadPreDataTable();
		// JSD
		GAMERESRCMNGR->LoadServerList();

		KYUNGGONGMGR->Init();
		
		APPEARANCEMGR->Init();
		GAMERESRCMNGR->PreLoadData();
		ABILITYMGR->Init();
		ABILITYMGR->AddUpdater(CAbilityUpdater_Interface::GetInstance());
		ABILITYMGR->AddUpdater(CAbilityUpdater_ApplyData::GetInstance());
		
		DISSOLUTIONMGR->Init();	//KES

		g_bResourceLoaded = TRUE;
	}
	/////////////////////////////////////////////////////////////////////////////////////////

	VECTOR3 vPivot;
	vPivot.x = 25408;
	vPivot.y = 6545;
	vPivot.z = 4004;

	CAMERA->InitCamera(0, 0.0f, -1.0f, 2000, &vPivot);// 芭府 炼沥 
	CAMERA->SetCameraMode(eCM_LOGIN);
	CAMERA->SetCurCamera(0);

/* test
	MHCAMERAPOS MCPos;
	MCPos.m_AngleX = -2.0f;
	MCPos.m_AngleY = 17.0f;
	MCPos.m_Dist = 2000;
	MCPos.m_Pivot.x = 27740;
	MCPos.m_Pivot.y = 4960;
	MCPos.m_Pivot.z = 9104;	
	CAMERA->SetMovePos(eCP_CHARSEL, &MCPos);

	CAMERA->InitCamera(0, -2.0f, 17.0f, 2000, &MCPos.m_Pivot);// 芭府 炼沥 
	CAMERA->SetCameraMode(eCM_LOGIN);
	CAMERA->SetCurCamera(0);	

	// 某腐磐 积己 
	vPivot.x = 24480;
	vPivot.y = 6045;
	vPivot.z = 9604;
	MCPos.m_AngleX = -5.0f;
	MCPos.m_AngleY = 0.0f;
	MCPos.m_Dist = 2000;
	MCPos.m_Pivot = vPivot;
	CAMERA->SetMovePos(eCP_CHARMAKE, &MCPos);
//*/
	
	WINDOWMGR->SetcbDropProcess(cbDragDropProcess);
//	WINDOWMGR->CreatMousePoint();
//

	CreateMainTitle_m();	
	m_pLogoWindow = WINDOWMGR->GetWindowForID( MT_LOGODLG );
	if( m_pLogoWindow )
		m_pLogoWindow->SetActive( TRUE );

#ifdef TAIWAN_LOCAL
	m_pAdvice = WINDOWMGR->GetWindowForID( CNA_CNADVICEDLG );
#endif

	m_pServerListDlg = (CServerListDialog*)WINDOWMGR->GetWindowForID( SL_SERVERLISTDLG );
	if( m_pServerListDlg )
	{
		m_pServerListDlg->Linking();
		m_pServerListDlg->SetActive( FALSE );
	}
//
	WINDOWMGR->AfterInit();

///	MHTIMEMGR->Process();
	m_bWaitConnectToAgent = FALSE;
	bFirst = TRUE;
	
	
#ifndef _LOGOWINDOW_
	m_pLogoWindow = NULL;	
	m_bServerList = TRUE;
#endif
	
	return TRUE;
}

void CMainTitle::Release(CGameState* pNextGameState)
{
	image.Release();
	
	WINDOWMGR->DestroyWindowAll();
	RESRCMGR->ReleaseResource(24);

	if(pNextGameState == NULL)
		MAP->Release();
}

void CameraRotate(CKeyboard& Keyboard,CMouse& Mouse);
void CameraWheelZoom(CKeyboard& Keyboard,CMouse& Mouse);
#include "ObjectGuagen.h"
void CMainTitle::Process()
{
	//浚柳捞惑 -_-
	if(bFirst == TRUE)	//捞犯霸 秦档 柄瘤绰单?
	{
		bFirst = FALSE;
		CAMERA->MouseRotate(1,0);
		m_dwStartTime = MHTIMEMGR->GetNewCalcCurTime();
	}

//	MHTIMEMGR->Process();
//	CAMERA->Process();	
	
//	if( !m_bInit ) return;

	if( m_pLogoWindow )
	{
		DWORD dwElapsed = MHTIMEMGR->GetNewCalcCurTime() - m_dwStartTime;
		
		if( dwElapsed > ALPHA_PROCESS_TIME )
		{
			m_pLogoWindow->SetAlpha( 0 );
			WINDOWMGR->AddListDestroyWindow( m_pLogoWindow );
			m_pLogoWindow = NULL;
			
#ifdef TAIWAN_LOCAL
			m_pAdvice->SetActive( TRUE );
#else
			m_bServerList = TRUE;
#endif
		}
		else
		{
			m_pLogoWindow->SetAlpha( (BYTE)(255 - ( dwElapsed * 255 / ALPHA_PROCESS_TIME )) );
		}
	}

	if( m_bServerList )
	{
		m_pServerListDlg->SetActive( TRUE );
		m_bServerList = FALSE;
	}

	// Dist Server俊 立加登菌促搁...
	if( m_bInit )
	{
		if( m_bDynamicDlg == FALSE )
		{
			cDialog* pDlg = WINDOWMGR->GetWindowForID( MT_LOGINDLG );
			if( pDlg )
			if( !pDlg->IsActive() )
			{
				pDlg->SetDisable( FALSE );
				pDlg->SetActive( TRUE );
				cEditBox* pEdit = (cEditBox*)pDlg->GetWindowForID( MT_IDEDITBOX );
				pEdit->SetFocusEdit( TRUE );
			}	
		}

		//立加扁促府绰 吝捞扼搁
		if( m_bWaitConnectToAgent == TRUE )
		{
			DWORD dwElapsed = gCurTime - m_dwWaitTime;
		
			if( dwElapsed > WAIT_CONNECT_TIME )
			{
				//秒家滚瓢阑 穿弗巴 贸烦
				cMsgBox* pMsgBox = (cMsgBox*)WINDOWMGR->GetWindowForID( MBI_WAIT_LOGINCHECK );
				if( pMsgBox )
					pMsgBox->ForceClose();

				m_bWaitConnectToAgent = FALSE;

				WINDOWMGR->MsgBox( MBI_TIMEOVER_TOCONNECT, MBT_OK, CHATMGR->GetChatMsg( 445 ) );
				//辑滚府胶飘甫 皑眠磊???
				m_pServerListDlg->SetActive( FALSE );
				m_bServerList = FALSE;
			}
		}
	}	
}


void CMainTitle::BeforeRender()
{
	g_pExecutive->GetRenderer()->BeginRender(0,0,0);
	g_pExecutive->GetRenderer()->EndRender();
	MAP->Process( gCurTime );
}
void CMainTitle::AfterRender()
{
	VECTOR2 t;
	t.x = t.y = 0;
	image.RenderSprite(0,0,0,&t,0xffffffff);
	WINDOWMGR->Render();
}
void CMainTitle::NetworkMsgParse(BYTE Category,BYTE Protocol,void* pMsg)
{
	switch(Category)
	{
	case MP_USERCONN:
		{
			switch(Protocol) 
			{
#ifdef _GMTOOL_
			case MP_CHEAT_CHECKIP_ACK:
				{
					m_bInit = TRUE;
				}
				break;
			case MP_CHEAT_CHECKIP_NACK:
				{
					if( NETWORK->IsConnected() )
						NETWORK->Disconnect();
					WINDOWMGR->MsgBox( MBI_NOT_GM, MBT_NOBTN, CHATMGR->GetChatMsg( 162 ) );
				}
				break;
#endif
			case MP_USERCONN_USE_DYNAMIC_ACK:
				{
					StartWaitConnectToAgent( FALSE );
					cDialog* pDlg = WINDOWMGR->GetWindowForID( MT_LOGINDLG );
					if( pDlg )
					{
						pDlg->SetDisable( FALSE );
						pDlg->SetActive( FALSE );
					}
					cMsgBox* pMsgBox = (cMsgBox*)WINDOWMGR->GetWindowForID( MBI_WAIT_LOGINCHECK );
					if( pMsgBox )
					{
						pMsgBox->SetDisable( FALSE );
						pMsgBox->SetActive( FALSE );
					}

					MSG_USE_DYNAMIC_ACK* pmsg = (MSG_USE_DYNAMIC_ACK*)pMsg;
					m_bDynamicDlg = TRUE;
					pDlg = WINDOWMGR->GetWindowForID(MT_DYNAMICDLG);
					if( pDlg )
					{
						pDlg->SetDisable( FALSE );
						pDlg->SetActive( TRUE );

						cStatic* pStc = (cStatic*)pDlg->GetWindowForID( MT_STC_DYNAMICID );
						pStc->SetStaticText( g_szHeroIDName );
						pStc = (cStatic*)pDlg->GetWindowForID( MT_STC_COORD );
//						pStc->SetStaticText( "Dynamic Password" );
						pStc = (cStatic*)pDlg->GetWindowForID( MT_STC_COORD_MAT );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -