1745 lines
45 KiB
C++
1745 lines
45 KiB
C++
#include "stdafx.h"
|
|
|
|
#include <network/XSyncStreamConnection.h>
|
|
|
|
#include "KRenderObject.h"
|
|
#include "KUITextureManager.h"
|
|
|
|
#include "SGameViewPort.h"
|
|
#include "SGameCursor.h"
|
|
|
|
#include "KRenderDeviceDX.h"
|
|
#include "KResourceManager.h"
|
|
#include "KPrimitiveSpriteMng.h"
|
|
#include "KUIWndManager.h"
|
|
|
|
#include "resource.h"
|
|
|
|
#include "sgame.h"
|
|
#include "SGameLoad.h"
|
|
#include "SGameWorld.h"
|
|
#include "SGameSound.h"
|
|
#include "SGameVM.h"
|
|
#include "SGameInterface.h"
|
|
#include "SGameOption.h"
|
|
#include "GameDefine.h"
|
|
#include "SUISysMsgDefine.h"
|
|
|
|
#include "SGameManager.h"
|
|
#include "SBotManager.h"
|
|
|
|
#include <network/XNetworkUtil.h>
|
|
#include <toolkit/XEnv.h>
|
|
|
|
#include "SBasicStat.h"
|
|
#include "SGameMessage.h"
|
|
#include "SNetMessage.h"
|
|
|
|
#include "SRenderFlag.h"
|
|
|
|
#include "SGameSky.h"
|
|
|
|
#include "SGameAvatarEx.h"
|
|
#include "SGameLobbyDefine.h"
|
|
#include "SUIMinimapWnd.h"
|
|
|
|
#include "SGameMilesSoundMgr.h"
|
|
// 2010.05.20 - prodongi
|
|
#include "ErrorCode/ErrorCode.h"
|
|
|
|
|
|
const char* GAME_CLIENT_VERSION = "201507090";
|
|
|
|
// "201507080"; GrindingLegend
|
|
// "201507090"; Funzone 1
|
|
// " ";
|
|
// " ";
|
|
|
|
////////////////////////////////////////////
|
|
//////////////인증서버 버전///////////////
|
|
const char * AUTH_VER = GAME_CLIENT_VERSION;
|
|
////////////////////////////////////////////
|
|
|
|
////////////////////////////////////////////
|
|
//////////////클라이언트 버전///////////////
|
|
const char * CLIENT_VER = GAME_CLIENT_VERSION;
|
|
////////////////////////////////////////////
|
|
|
|
extern HWND g_hWnd;
|
|
/// 2010.11.10 - prodongi
|
|
//#ifdef _DEV
|
|
//extern bool g_bDebugMode;
|
|
//#endif
|
|
extern SBotManager * g_pSBotMng;
|
|
|
|
std::string GetOSInfo();
|
|
|
|
//=============================================================================
|
|
//SGameManager
|
|
|
|
SGameManager::SGameManager
|
|
( SGameVM* pGameVM
|
|
, SGameInterface* pGameInterface
|
|
, K3DRenderDeviceDX *pRenderDevice
|
|
, SSoundManager * pSoundMng
|
|
, KTextureManager * pTextureMng
|
|
, KNX3Manager * pNX3Mng
|
|
, KViewportObject** ppViewportList
|
|
, int nViewportCount
|
|
, SGameMilesSoundMgr* pMSoundMgr )
|
|
: m_pGameVM(pGameVM)
|
|
, m_pGameInterface(pGameInterface)
|
|
, m_pGraphics(pRenderDevice)
|
|
, m_pSoundMng(pSoundMng)
|
|
, m_pTextureManager(pTextureMng)
|
|
, m_pNX3Mgr(pNX3Mng)
|
|
, m_ppViewportList(ppViewportList)
|
|
, m_nViewportCount(nViewportCount)
|
|
, m_pMSoundMgr(pMSoundMgr)
|
|
{
|
|
m_nActiveGame = DEFAULT_ACTIVE;
|
|
m_nMngState = true;
|
|
m_bThProcessExit = false;
|
|
m_bThRenderExit = false;
|
|
m_pGameConn = new XSyncStreamConnection( true, true );
|
|
m_pRecvQueue = IQueue::MakeQueue( 4*1024 );
|
|
m_usRestDummy = 0;
|
|
m_usRestDummyIconUpload = 0;
|
|
|
|
m_bRecvLoginResult = FALSE;
|
|
|
|
m_dwTime = 0;
|
|
m_dwInterfaceTime = 0;
|
|
m_dwNetWorkTime = 0;
|
|
|
|
m_nResolutionOption_Width = GetGameOption().GetResolution_Width() ; // 해상도 옵션
|
|
m_nResolutionOption_Height= GetGameOption().GetResolution_Height(); // 해상도 옵션
|
|
|
|
m_dwMovieTime = 1;
|
|
m_bMovieMode = false;
|
|
|
|
m_nCreatureRange = 0;
|
|
|
|
m_nTimesyncCount = 0;
|
|
}
|
|
|
|
SGameManager::~SGameManager(void)
|
|
{
|
|
for( unsigned int i(0); m_UIMsgList.size()>i; i++ )
|
|
{
|
|
delete m_UIMsgList[i];
|
|
}
|
|
m_UIMsgList.clear();
|
|
|
|
for( unsigned int i(0); m_vGameList.size()>i; i++ )
|
|
{
|
|
delete m_vGameList[i];
|
|
}
|
|
m_vGameList.clear();
|
|
|
|
SAFE_DELETE( m_pGameConn );
|
|
SAFE_DELETE( m_pRecvQueue );
|
|
SAFE_DELETE( m_pLoginResult );
|
|
}
|
|
|
|
void SGameManager::Init()
|
|
{
|
|
m_bTryConnect = FALSE;
|
|
m_pLoginResult = new SMSG_LOGIN;
|
|
|
|
SetOption();
|
|
}
|
|
|
|
void SGameManager::ApplyOption( int nOptionType )
|
|
{
|
|
SGame * pGame = GetActiveGame();
|
|
if( pGame )
|
|
{
|
|
pGame->ApplyOption( nOptionType );
|
|
}
|
|
}
|
|
|
|
void SGameManager::SetOption()
|
|
{
|
|
m_Object.SetInterface( this );
|
|
}
|
|
|
|
void SGameManager::GameSet()
|
|
{
|
|
m_pLoadGame = new SGameLoad( this, 0, m_pGraphics, m_pSoundMng, m_pTextureManager, m_pNX3Mgr, m_pMSoundMgr );
|
|
m_pLoadGame->SetViewPort( (SGameViewPort *)m_ppViewportList[0] );
|
|
m_pLoadGame->LoadGame( GAME_TYPE_LOGIN );
|
|
|
|
m_vGameList.push_back( m_pLoadGame );
|
|
|
|
SetActiveGame( GAME_TYPE_LOAD );
|
|
|
|
// 임시 뮤직 플레이 by Testors
|
|
//m_pSoundMng->PlayMusic( KResourceManager::GetValidFileName( "title.mp3" ).c_str() );
|
|
}
|
|
|
|
void SGameManager::SetActiveGame( int nGameType )
|
|
{
|
|
if( nGameType < 0 ) return;
|
|
|
|
m_nActiveGame = nGameType;
|
|
}
|
|
|
|
//for Thread_Render
|
|
SGame* SGameManager::GetActiveGame()
|
|
{
|
|
if( m_vGameList.empty() ) return NULL;
|
|
|
|
for( unsigned int i(0); m_vGameList.size()>i; i++ )
|
|
{
|
|
if( m_vGameList[i]->GetGameType() == m_nActiveGame )
|
|
return m_vGameList[i];
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
void SGameManager::GameExit()
|
|
{
|
|
_oprint( "게임 종료\n" );
|
|
|
|
if( m_pMSoundMgr ) m_pMSoundMgr->StopMusic();
|
|
if( m_pMSoundMgr ) m_pMSoundMgr->StopBgm();
|
|
|
|
if( ::DestroyWindow( g_hWnd ) == 0 )
|
|
{
|
|
DWORD err = GetLastError();
|
|
}
|
|
}
|
|
|
|
void SGameManager::SetRenderFlag( int nFlag )
|
|
{
|
|
SGame * pGame = GetActiveGame();
|
|
if( pGame )
|
|
pGame->SetRenderFlag( nFlag );
|
|
}
|
|
|
|
int SGameManager::GetScreenWidth()
|
|
{
|
|
return m_ppViewportList[0]->GetViewportWidth();
|
|
}
|
|
|
|
int SGameManager::GetScreenHeight()
|
|
{
|
|
return m_ppViewportList[0]->GetViewportHeight();
|
|
}
|
|
|
|
void SGameManager::AfterRender( unsigned long uRenderBitVector )
|
|
{
|
|
SGame * pGame = GetActiveGame();
|
|
|
|
if( pGame )
|
|
pGame->AfterRender( uRenderBitVector );
|
|
}
|
|
|
|
void SGameManager::Render( unsigned long uRenderBitVector )
|
|
{
|
|
SGame * pGame = GetActiveGame();
|
|
|
|
if( uRenderBitVector & Game_RenderAct )
|
|
{
|
|
if( pGame )
|
|
pGame->Render( uRenderBitVector, m_ppViewportList, m_nViewportCount );
|
|
}
|
|
|
|
static bool bRender = true;
|
|
if( bRender && !m_bMovieMode )
|
|
{
|
|
if( uRenderBitVector & Game_RenderInterface )
|
|
{
|
|
if( pGame ) //인터페이스도 게임에 영향을 받는다.
|
|
{
|
|
if( m_pLoadGame && pGame->GetGameType() == GAME_TYPE_LOGIN )
|
|
m_pGameInterface->Render( m_ppViewportList[0], false, true);
|
|
else
|
|
m_pGameInterface->Render( m_ppViewportList[0] );
|
|
}
|
|
else //로딩 중
|
|
{
|
|
m_pGameInterface->Render( m_ppViewportList[0], true );
|
|
}
|
|
}
|
|
}
|
|
|
|
//로드 화면은 항상 위에..
|
|
if( uRenderBitVector & Game_RenderLoad )
|
|
{
|
|
if( m_pLoadGame ) m_pLoadGame->Render( m_ppViewportList[0] );
|
|
}
|
|
}
|
|
|
|
void SGameManager::ProcMsgAtStatic( SGameMessage * pMsg )
|
|
{
|
|
switch( pMsg->nType )
|
|
{
|
|
case TMSG_SYSTEM_OPTION:
|
|
{
|
|
STMSG_SYSTEM_OPTION* pOptionMsg = (STMSG_SYSTEM_OPTION*)pMsg;
|
|
switch( pOptionMsg->m_Type )
|
|
{
|
|
case STMSG_SYSTEM_OPTION::SYSOPTION_BLOOMEFFECT:
|
|
{
|
|
if( NULL != m_ppViewportList[0] )
|
|
((SGameViewPort *)m_ppViewportList[0])->SetBloomEffect( pOptionMsg->m_nOption );
|
|
}
|
|
break;
|
|
|
|
case STMSG_SYSTEM_OPTION::SYSOPTION_TEXQUALITY:
|
|
{
|
|
if( NULL != m_pTextureManager ) {
|
|
m_pTextureManager->SetMipMapBiasLevel( pOptionMsg->m_nOption );
|
|
m_pTextureManager->ReloadRes( false );
|
|
}
|
|
}
|
|
break;
|
|
case STMSG_SYSTEM_OPTION::SYSOPTION_RESOLUTION:
|
|
break;
|
|
|
|
case STMSG_SYSTEM_OPTION::SYSOPTION_BGSOUND:
|
|
{
|
|
m_pMSoundMgr->SetBgmVolume( pOptionMsg->m_nOption );
|
|
}
|
|
break;
|
|
|
|
case STMSG_SYSTEM_OPTION::SYSOPTION_EFFECTSOUND:
|
|
{
|
|
m_pMSoundMgr->SetSfxVolume( pOptionMsg->m_nOption );
|
|
}
|
|
break;
|
|
}
|
|
//pMsg->bUse = true; 게임에서 사용함
|
|
}
|
|
break;
|
|
|
|
case TMSG_REQ_SYSTEM_OPTION:
|
|
{
|
|
STMSG_REQ_SYSTEM_OPTION* pReqOptionMsg = (STMSG_REQ_SYSTEM_OPTION*)pMsg;
|
|
switch( pReqOptionMsg->m_Type )
|
|
{
|
|
case STMSG_SYSTEM_OPTION::SYSOPTION_BLOOMEFFECT:
|
|
{
|
|
if( NULL != m_ppViewportList[0] )
|
|
pReqOptionMsg->m_nGetOption = ((SGameViewPort *)m_ppViewportList[0])->GetBloomEffect();
|
|
}
|
|
break;
|
|
|
|
case STMSG_SYSTEM_OPTION::SYSOPTION_TEXQUALITY:
|
|
{
|
|
if( NULL != m_pTextureManager )
|
|
pReqOptionMsg->m_nGetOption = m_pTextureManager->GetMipMapBiasLevel();
|
|
}
|
|
break;
|
|
case STMSG_SYSTEM_OPTION::SYSOPTION_RESOLUTION:
|
|
{
|
|
// pReqOptionMsg->m_nGetOption = m_nResolutionOption;
|
|
}
|
|
break;
|
|
}
|
|
//pMsg->bUse = true; 게임에서 사용함
|
|
}
|
|
break;
|
|
|
|
case IMSG_HOTKEY_EX:
|
|
{
|
|
//캐쉬샵 떠있을 경우, 핫키 안되게 막음
|
|
if( IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CASH_TITLE ) )
|
|
{
|
|
pMsg->bUse = true; //게임에서 사용함
|
|
return;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
|
|
SGame *pGame = GetActiveGame();
|
|
if( pGame ) pGame->ProcMsgAtStatic( pMsg );
|
|
}
|
|
|
|
//큐에 쌓인 후 다음 Proc에 처리
|
|
void SGameManager::PostMsgAtDynamic( SGameMessage * pMsg )
|
|
{
|
|
pMsg->bPostNew = true;
|
|
m_UIMsgList.push_back( pMsg );
|
|
}
|
|
|
|
bool SGameManager::IsLoadGameActivated()
|
|
{
|
|
SGame * pGame = GetActiveGame();
|
|
if( pGame )
|
|
return pGame->IsActivated();
|
|
|
|
return false;
|
|
}
|
|
|
|
// For Thread_Process
|
|
void SGameManager::Process( unsigned long uProcessBitVector )
|
|
{
|
|
DWORD dwTime = GetSafeTickCount();
|
|
|
|
if( m_bMovieMode ) dwTime = m_dwMovieTime;
|
|
|
|
m_dwTime = dwTime;
|
|
|
|
if( m_dwInterfaceTime == 0) m_dwInterfaceTime = m_dwTime;
|
|
|
|
if( m_dwNetWorkTime == 0) m_dwNetWorkTime = m_dwTime;
|
|
|
|
if( m_pGameVM ) m_pGameVM->Process( dwTime );
|
|
|
|
SGame * pEndGame = NULL;
|
|
SGame * pActGame = GetActiveGame();
|
|
|
|
if( uProcessBitVector & Game_ProcessArclient )
|
|
{
|
|
bool bPendingLeave = false;
|
|
if( pActGame )
|
|
{
|
|
if( pActGame->GetGameRef() == SGame::STAGE_EVENT_SCENE )
|
|
bPendingLeave = true;
|
|
}
|
|
|
|
m_Object.Proc( bPendingLeave );
|
|
}
|
|
|
|
// Forward VM messages to the Game if any exist
|
|
// Process game loading
|
|
if( m_pLoadGame )
|
|
{
|
|
if( uProcessBitVector & Game_ProcessLoadGame )
|
|
{
|
|
if( m_pLoadGame->Process( dwTime, uProcessBitVector ) )
|
|
{
|
|
SGame * pGame = m_pLoadGame->GetLoadGame();
|
|
if (pGame)
|
|
{
|
|
pGame->SetViewPort( (SGameViewPort *)m_ppViewportList[0] );
|
|
pGame->SetNet( &m_Object );
|
|
|
|
m_vGameList.push_back(pGame);
|
|
SetActiveGame( pGame->GetGameType() );
|
|
}
|
|
|
|
m_pLoadGame->SetLoadGame(); // Initialization
|
|
|
|
m_pLoadGame->SetActGameCount( m_vGameList.size() );
|
|
}
|
|
}
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// Main MSG Loop
|
|
// Game Process
|
|
|
|
if( pActGame )
|
|
{
|
|
if( m_pLoadGame && pActGame->GetGameType() == GAME_TYPE_LOGIN )
|
|
{
|
|
SGameRenewalLobby* pLobby( (SGameRenewalLobby*)pActGame );
|
|
bool bOffJTVLogo( m_pLoadGame->IsOffJTVLogo() );
|
|
pLobby->SetPauseJTVLogo( !bOffJTVLogo );
|
|
}
|
|
|
|
|
|
// Process all NUI messages pending
|
|
if( !m_UIMsgList.empty() )
|
|
{
|
|
for( unsigned int i(0); m_UIMsgList.size()>i; i++ )
|
|
{
|
|
pActGame->ProcMsgAtStatic( m_UIMsgList[i] );
|
|
delete m_UIMsgList[i];
|
|
}
|
|
m_UIMsgList.clear();
|
|
}
|
|
|
|
|
|
// Process all Game messages pending
|
|
while( m_pGameVM->IsProcGameMsg() )
|
|
{
|
|
SGameMessage * pMsg = m_pGameVM->GetGameMsg();
|
|
if (!pMsg)
|
|
break;
|
|
if( m_pLoadGame ) m_pLoadGame->ProcMsgAtStatic( pMsg );
|
|
|
|
pActGame->ProcMsgAtStatic( pMsg );
|
|
|
|
// TimeSync handling, Login handling, etc..
|
|
if( pMsg->nType == TMSG_TIMESYNC )
|
|
{
|
|
pMsg->bUse = true;
|
|
STMSG_TIMESYNC* pTimeSyncMsg = static_cast<STMSG_TIMESYNC*>(pMsg);
|
|
ProcTimeSync( pTimeSyncMsg );
|
|
}
|
|
else if( pMsg->nType == MSG_LOGIN )
|
|
{
|
|
pMsg->bUse = true;
|
|
SMSG_LOGIN* pLoginMsg = static_cast<SMSG_LOGIN*>(pMsg);
|
|
|
|
m_bRecvLoginResult = TRUE;
|
|
|
|
m_nTimesyncCount = 0; // Since it is limited to 4 attempts, initialize at login
|
|
|
|
if( pLoginMsg->result == ErrorCode::RESULT_SUCCESS )
|
|
{
|
|
// 2010.05.20 - prodongi
|
|
m_pLoginResult->result = pLoginMsg->result;
|
|
//m_pLoginResult->bIsAccepted = pLoginMsg->bIsAccepted;
|
|
m_pLoginResult->handle = pLoginMsg->handle ;
|
|
m_pLoginResult->x = pLoginMsg->x ;
|
|
m_pLoginResult->y = pLoginMsg->y ;
|
|
m_pLoginResult->z = pLoginMsg->z ;
|
|
m_pLoginResult->layer = pLoginMsg->layer ;
|
|
m_pLoginResult->face_direction = pLoginMsg->face_direction;
|
|
m_pLoginResult->region_size = pLoginMsg->region_size ;
|
|
m_pLoginResult->hp = pLoginMsg->hp ;
|
|
m_pLoginResult->mp = pLoginMsg->mp ;
|
|
m_pLoginResult->max_hp = pLoginMsg->max_hp ;
|
|
m_pLoginResult->max_mp = pLoginMsg->max_mp ;
|
|
|
|
m_pLoginResult->sex = pLoginMsg->sex ;
|
|
m_pLoginResult->race = pLoginMsg->race ;
|
|
m_pLoginResult->cell_size = pLoginMsg->cell_size ;
|
|
m_pLoginResult->guild_id = pLoginMsg->guild_id ;
|
|
m_pLoginResult->back_board = pLoginMsg->back_board ;
|
|
memcpy( m_pLoginResult->szName, pLoginMsg->szName, sizeof(pLoginMsg->szName) );
|
|
}
|
|
else
|
|
{
|
|
assert( 0 && "Login failed.." );
|
|
//"Login failed.."
|
|
}
|
|
|
|
|
|
}
|
|
else if (pMsg->nType == MSG_GAME_OUT)
|
|
{
|
|
// 2009.3.25 by Jung Dong-seop - Fixed the issue where pressing the X button after entering and exiting the game caused an infinite loop
|
|
// Since MSG_GAME_OUT is not handled anywhere and causes an infinite loop, GAME_OUT always modifies bUse. A hacky workaround.
|
|
pMsg->bUse = true;
|
|
}
|
|
|
|
// Keep it
|
|
if( pMsg->bSafeKeeping == true && pMsg->bUse == false )
|
|
{
|
|
m_pGameVM->AddSafeKeeping( pMsg );
|
|
}
|
|
else
|
|
{
|
|
// Delete Msg
|
|
if( pMsg == NULL )
|
|
{
|
|
assert( 0 && "Where did this come from?" );
|
|
}
|
|
else
|
|
{
|
|
if (pMsg->bUse)
|
|
{ // Delete what has been used...
|
|
m_pGameVM->AddDelMsg( pMsg );
|
|
}
|
|
else
|
|
{ // Re-add what has not been used...
|
|
m_pGameVM->AddRecycle( pMsg );
|
|
}
|
|
}
|
|
}
|
|
|
|
m_pGameVM->ProcDel();
|
|
}
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
|
// Switch to the next game stage
|
|
if( pActGame->GetGameRef() == SGame::STAGE_END )
|
|
{
|
|
m_pGameInterface->ReSet(); // Reset so that things like character name can be used again
|
|
|
|
pActGame->SetGameRef( SGame::STAGE_NOTHING );
|
|
pActGame->SetGameTypeEnd();
|
|
|
|
m_pLoadGame->LoadGame( pActGame->GetNextGameType() );
|
|
|
|
pEndGame = pActGame;
|
|
}
|
|
|
|
// Hmm, not ideal…
|
|
if( m_bRecvLoginResult )
|
|
{
|
|
if( pActGame->GetGameType() == GAME_TYPE_WORLD )
|
|
{
|
|
//UpdateLoadingProgress(0.4f);
|
|
UpdateAddLoadingProcess(0.2f);
|
|
|
|
m_nViewportCount = g_pSBotMng->GetViewportCount();
|
|
//InitViewportEx();
|
|
|
|
// Loading cache resources to be used: they are not released until the game ends
|
|
GetPreLoadDB( NULL ).CacheResLoad();
|
|
|
|
// m_pGameInterface->InitWorldGameInterface(); // Create interface for world game
|
|
|
|
_CID( GAMECREATE );
|
|
pActGame->Perform( id_GAMECREATE, KCreateGameMessage( m_pLoginResult->x, m_pLoginResult->y ) );
|
|
pActGame->ProcMsgAtStatic( m_pLoginResult );
|
|
m_bRecvLoginResult = FALSE;
|
|
}
|
|
}
|
|
|
|
//if(GetKeyState(VK_F1))
|
|
if( uProcessBitVector & Game_ProcessActGame )
|
|
{
|
|
pActGame->Process( dwTime, uProcessBitVector );
|
|
}
|
|
}
|
|
|
|
if( uProcessBitVector & Game_ProcessInterface )
|
|
{
|
|
// 24 processes per second
|
|
// if( (m_dwTime - m_dwInterfaceTime) > 41 )
|
|
// 2012.10.19 Metin: 24 FPS was too much :(
|
|
if( (m_dwTime - m_dwInterfaceTime) > 33 )
|
|
{
|
|
m_dwInterfaceTime = m_dwTime;
|
|
|
|
if( pActGame )
|
|
m_pGameInterface->Process( dwTime, pActGame->GetGameRef() );
|
|
else
|
|
m_pGameInterface->Process( dwTime );
|
|
}
|
|
}
|
|
|
|
if( pEndGame )
|
|
{
|
|
if( m_vGameList.empty() ) return;
|
|
|
|
for( unsigned int i(0); m_vGameList.size()>i; i++ )
|
|
{
|
|
if( m_vGameList[i] == pEndGame )
|
|
{
|
|
m_vGameList.erase( m_vGameList.begin()+i );
|
|
delete pEndGame;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
// Network events are handled entirely by the VM
|
|
// Network Event
|
|
if( uProcessBitVector & Game_ProcessNetwork )
|
|
{
|
|
static const DWORD dwNetWorkDelayTick = 20;
|
|
if( (m_dwTime - m_dwNetWorkTime) >= dwNetWorkDelayTick )
|
|
{
|
|
m_dwNetWorkTime = m_dwTime;
|
|
if( m_pGameConn->IsReadable() || (m_pRecvQueue->Size() >= sizeof( TS_MESSAGE )) )
|
|
{
|
|
onReadEvent( m_pGameConn, m_pRecvQueue );
|
|
}
|
|
}
|
|
}
|
|
|
|
if( m_bTryConnect && !m_pGameConn->IsConnected() )
|
|
{ // Connection termination detected on the game server.
|
|
static int nCon = 0;
|
|
if( nCon == 0 )
|
|
{
|
|
nCon = 1;
|
|
PostMsgAtDynamic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_NOCONNECTSERVER, SYS_MSG_SERVER_DISCONNECT ) );
|
|
}
|
|
}
|
|
}
|
|
|
|
void SGameManager::SetShowWater( bool bShow )
|
|
{
|
|
if( g_pSBotMng )
|
|
{
|
|
g_pSBotMng->SetShowWater( bShow );
|
|
}
|
|
}
|
|
|
|
//Alt 별도 처리
|
|
void SGameManager::onHotkey( GameHotKeystrcut & HotKey )
|
|
{
|
|
if( !HotKey.bUp )
|
|
{
|
|
if( HotKey.bAlt && HotKey.bCtrl && HotKey.bShift && HotKey.Virtual_Key == VK_RETURN )
|
|
{
|
|
m_bMovieMode = !m_bMovieMode;
|
|
if( m_bMovieMode )
|
|
m_dwMovieTime = m_dwTime;
|
|
}
|
|
}
|
|
|
|
if( m_bMovieMode && HotKey.Virtual_Key == VK_SPACE )
|
|
m_dwMovieTime += 30; //30/1000 초 씩 증가
|
|
|
|
if( m_pGameVM ) m_pGameVM->onHotkey( HotKey );
|
|
}
|
|
|
|
|
|
bool SGameManager::IsValidConnectedServer()
|
|
{
|
|
return ( m_bTryConnect && m_pGameConn->IsConnected() );
|
|
}
|
|
|
|
void SGameManager::CloseToServer( bool bForce /*= false*/ )
|
|
{
|
|
if( m_pGameConn->IsConnected() )
|
|
{
|
|
m_pGameConn->Close();
|
|
}
|
|
|
|
if( bForce == false )
|
|
m_bTryConnect = FALSE;
|
|
|
|
SAFE_DELETE( m_pGameConn );
|
|
SAFE_DELETE( m_pRecvQueue );
|
|
m_pGameConn = new XSyncStreamConnection( true, true );
|
|
m_pRecvQueue = IQueue::MakeQueue( 4*1024 );
|
|
}
|
|
|
|
//Net Work
|
|
#include <Iphlpapi.h>
|
|
#pragma comment(lib, "iphlpapi.lib")
|
|
|
|
unsigned char * getMACAddress()
|
|
{
|
|
// Fetches the MAC address and prints it
|
|
static IP_ADAPTER_INFO adapterInfo[16];
|
|
|
|
DWORD bufLen = sizeof(adapterInfo);
|
|
DWORD status = GetAdaptersInfo(adapterInfo, &bufLen);
|
|
assert(status == ERROR_SUCCESS);
|
|
|
|
PIP_ADAPTER_INFO pAdapterInfo = adapterInfo;
|
|
|
|
/*
|
|
do {
|
|
PrintMACaddress(adapterInfo->Address);
|
|
pAdapterInfo = pAdapterInfo->Next;
|
|
}
|
|
while (pAdapterInfo);
|
|
*/
|
|
|
|
_oprint("%0.2x-%0.2x-%0.2x-%0.2x-%0.2x-%0.2x\n", pAdapterInfo->Address[0],
|
|
pAdapterInfo->Address[1],
|
|
pAdapterInfo->Address[2],
|
|
pAdapterInfo->Address[3],
|
|
pAdapterInfo->Address[4],
|
|
pAdapterInfo->Address[5]);
|
|
return pAdapterInfo->Address;
|
|
}
|
|
|
|
/*
|
|
인터넷에서 긁어 옴, http://ddiggam.tistory.com/139
|
|
*/
|
|
bool getMacAddressWithMIB(unsigned char* macAddress)
|
|
{
|
|
macAddress[0] = ' ';
|
|
|
|
std::string strEthernet;
|
|
std::string strPppSlip;
|
|
std::string strOthers;
|
|
|
|
DWORD dwError;
|
|
DWORD sizeReq = 0 ;
|
|
PMIB_IFTABLE pInfo = NULL;
|
|
|
|
::GetIfTable(NULL, &sizeReq, FALSE) ;
|
|
|
|
pInfo = (PMIB_IFTABLE) new BYTE [sizeReq] ;
|
|
memset (pInfo, 0, sizeReq) ;
|
|
|
|
DWORD sizeToUse = sizeReq ;
|
|
|
|
dwError = ::GetIfTable( (PMIB_IFTABLE)pInfo,&sizeToUse, FALSE);
|
|
if(dwError != NO_ERROR)
|
|
{
|
|
if(pInfo != NULL)
|
|
delete[] (PMIB_IFTABLE)pInfo;
|
|
return false;
|
|
}
|
|
|
|
for( unsigned int index = 0; index < ((PMIB_IFTABLE)pInfo)->dwNumEntries; index ++ )
|
|
{
|
|
MIB_IFROW& details = ((PMIB_IFTABLE)pInfo)->table[index];
|
|
|
|
if(details.dwPhysAddrLen == 6)
|
|
{
|
|
if(details.dwType == MIB_IF_TYPE_ETHERNET)
|
|
{
|
|
memcpy(macAddress, details.bPhysAddr, 6);
|
|
break;
|
|
}
|
|
else if(details.dwType == MIB_IF_TYPE_PPP || details.dwType == MIB_IF_TYPE_SLIP)
|
|
{
|
|
memcpy(macAddress, details.bPhysAddr, 6);
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
memcpy(macAddress, details.bPhysAddr, 6);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
|
|
if(pInfo != NULL)
|
|
delete[] (PMIB_IFTABLE)pInfo;
|
|
|
|
if (macAddress[0] == ' ')
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
/*
|
|
인터넷에서 긁어 옴, http://ddiggam.tistory.com/139
|
|
*/
|
|
bool getMacAddressWithAdapter(unsigned char* macAddress)
|
|
{
|
|
macAddress[0] = ' ';
|
|
|
|
PIP_ADAPTER_INFO pAdapterInfo;
|
|
PIP_ADAPTER_INFO pAdapter = NULL;
|
|
DWORD dwRetVal = 0;
|
|
|
|
pAdapterInfo =(IP_ADAPTER_INFO *)(new BYTE[sizeof(IP_ADAPTER_INFO)]);
|
|
ULONG ulOutBufLen = sizeof(*pAdapterInfo);
|
|
|
|
if (GetAdaptersInfo( pAdapterInfo, &ulOutBufLen) == ERROR_BUFFER_OVERFLOW)
|
|
{
|
|
if(pAdapterInfo != NULL)
|
|
delete[] pAdapterInfo;
|
|
pAdapterInfo =(IP_ADAPTER_INFO *)(new BYTE[ulOutBufLen]);
|
|
}
|
|
|
|
if ((dwRetVal = GetAdaptersInfo( pAdapterInfo, &ulOutBufLen)) == ERROR_SUCCESS)
|
|
{
|
|
pAdapter = pAdapterInfo;
|
|
while (pAdapter)
|
|
{
|
|
memcpy(macAddress, pAdapter->Address, 6);
|
|
if (macAddress[0] != ' ')
|
|
{
|
|
break;
|
|
}
|
|
|
|
pAdapter = pAdapter->Next;
|
|
}
|
|
}
|
|
if(pAdapterInfo != NULL)
|
|
delete[] pAdapterInfo;
|
|
|
|
if (macAddress[0] == ' ')
|
|
return false;
|
|
|
|
return true;
|
|
}
|
|
|
|
/*
|
|
getMACAddress 가 제대로 값을 못 불러와서 새로 추가 함
|
|
*/
|
|
void getMacAddress(unsigned char* macAddress)
|
|
{
|
|
if (!getMacAddressWithAdapter(macAddress))
|
|
{
|
|
getMacAddressWithMIB(macAddress);
|
|
}
|
|
|
|
_oprint("%0.2x-%0.2x-%0.2x-%0.2x-%0.2x-%0.2x\n", macAddress[0],
|
|
macAddress[1],
|
|
macAddress[2],
|
|
macAddress[3],
|
|
macAddress[4],
|
|
macAddress[5]);
|
|
}
|
|
|
|
//bool SGameManager::ConnectToServer( const char * pIP, const int nPort )
|
|
//{
|
|
// static XAddr addr;
|
|
//
|
|
// assert( nPort > 0 );
|
|
//
|
|
// addr = XAddr( pIP, ENV().GetInt( "port", nPort ) ); //4514
|
|
//
|
|
// //서버 접속
|
|
// if( !m_pGameConn->Connect( addr ) )
|
|
// {
|
|
// //클로즈 베타 같은 코드가 있나...
|
|
// _oprint( "서버 접속 안됨\n" );
|
|
// MessageBox( g_hWnd, "B 서버 접속 안됨", "Rappelz-종료됨", MB_OK|MB_ICONINFORMATION );
|
|
// //exit(-1);
|
|
// GameExit();
|
|
// return false;
|
|
// }
|
|
// m_bTryConnect = TRUE;
|
|
//
|
|
// //버전 정보
|
|
// TS_CS_VERSION ver_msg;
|
|
// strcpy( ver_msg.szVersion, CLIENT_VER );
|
|
// PendMessage( &ver_msg );
|
|
//
|
|
// //사용자 부가 정보
|
|
// const D3DADAPTER_IDENTIFIER9 adapter_identify = m_pGraphics->GetAdapterIdentify();
|
|
//
|
|
// //사용자 OS 등 정보
|
|
// std::string strOS = GetOSInfo(); strOS += "|";
|
|
// //비디오 정보
|
|
// strOS += adapter_identify.Description;
|
|
//
|
|
// int nProduct = HIWORD(adapter_identify.DriverVersion.HighPart);
|
|
// int nVersion = LOWORD(adapter_identify.DriverVersion.HighPart);
|
|
// int nSubVersion = HIWORD(adapter_identify.DriverVersion.LowPart);
|
|
// int nBuild = LOWORD(adapter_identify.DriverVersion.LowPart);
|
|
//
|
|
// //비디오 드라이버 정보
|
|
// strOS += CStringUtil::StringFormat( "Drv Version : %d.%d.%d.%d", nProduct, nVersion, nSubVersion, nBuild ).c_str();
|
|
//
|
|
// TS_CS_REPORT report;
|
|
// report.report_len = static_cast< unsigned >(6+strOS.length()); // Macc address 패킷맨앞에 추가. 2009.10.27. sfreer
|
|
// report.size += static_cast< unsigned >( sizeof(char) * report.report_len );
|
|
// report.set_check_sum();
|
|
//
|
|
// // 메모리 할당
|
|
// char * pBuffer = new char[ report.size ];
|
|
// memset( pBuffer, 0, sizeof(char)*report.size );
|
|
//
|
|
// // 버퍼에 헤더 복사
|
|
// memcpy( pBuffer, &report, sizeof(TS_CS_REPORT) );
|
|
//
|
|
// char * pChatting = (char *)( pBuffer + sizeof(TS_CS_REPORT) );
|
|
// memcpy( pChatting, getMACAddress(), 6 ); // Macc address 패킷맨앞에 추가. 2009.10.27. sfreer
|
|
// memcpy( &(pChatting[6]), strOS.c_str(), sizeof(char)*(report.report_len-6) );// Macc address 패킷맨앞에 추가. 2009.10.27. sfreer
|
|
// PendMessage( reinterpret_cast<TS_CS_REPORT*>(pBuffer) );
|
|
//
|
|
// delete [] pBuffer;
|
|
//
|
|
// return true;
|
|
//}
|
|
|
|
|
|
bool SGameManager::ConnectToServer( const char * pIP, const int nPort, bool bFlag )
|
|
{
|
|
assert( nPort > 0 );
|
|
|
|
//서버 접속
|
|
if( m_pGameConn->IsConnected() == false )
|
|
{
|
|
XAddr addr( pIP, ENV().GetInt( "port", nPort ) ); //4514
|
|
if( !m_pGameConn->Connect( addr ) )
|
|
{
|
|
//클로즈 베타 같은 코드가 있나...
|
|
_oprint( "서버 접속 안됨\n" );
|
|
MessageBox( g_hWnd, "Cannot connect to server", "Rappelz", MB_OK|MB_ICONINFORMATION );
|
|
//exit(-1);
|
|
GameExit();
|
|
return false;
|
|
}
|
|
m_bTryConnect = TRUE;
|
|
}
|
|
|
|
|
|
if( bFlag == false )
|
|
{
|
|
//버전 정보
|
|
TS_CS_VERSION ver_msg;
|
|
strcpy( ver_msg.szVersion, CLIENT_VER );
|
|
PendMessage( &ver_msg );
|
|
}
|
|
else
|
|
{
|
|
//사용자 부가 정보
|
|
const D3DADAPTER_IDENTIFIER9 adapter_identify = m_pGraphics->GetAdapterIdentify();
|
|
|
|
//사용자 OS 등 정보
|
|
std::string strOS = GetOSInfo(); strOS += "|";
|
|
//비디오 정보
|
|
strOS += adapter_identify.Description;
|
|
|
|
int nProduct = HIWORD(adapter_identify.DriverVersion.HighPart);
|
|
int nVersion = LOWORD(adapter_identify.DriverVersion.HighPart);
|
|
int nSubVersion = HIWORD(adapter_identify.DriverVersion.LowPart);
|
|
int nBuild = LOWORD(adapter_identify.DriverVersion.LowPart);
|
|
|
|
//비디오 드라이버 정보
|
|
strOS += CStringUtil::StringFormat( "Drv Version : %d.%d.%d.%d", nProduct, nVersion, nSubVersion, nBuild ).c_str();
|
|
|
|
TS_CS_REPORT report;
|
|
report.report_len = static_cast< unsigned >(6+strOS.length()); // Macc address 패킷맨앞에 추가. 2009.10.27. sfreer
|
|
report.size += static_cast< unsigned >( sizeof(char) * report.report_len );
|
|
report.set_check_sum();
|
|
|
|
// 메모리 할당
|
|
char * pBuffer = new char[ report.size ];
|
|
memset( pBuffer, 0, sizeof(char)*report.size );
|
|
|
|
// 버퍼에 헤더 복사
|
|
memcpy( pBuffer, &report, sizeof(report) );
|
|
|
|
char * pChatting = (char *)( pBuffer + sizeof(TS_CS_REPORT) );
|
|
memcpy( pChatting, getMACAddress(), 6 ); // Macc address 패킷맨앞에 추가. 2009.10.27. sfreer
|
|
memcpy( &(pChatting[6]), strOS.c_str(), sizeof(char)*(report.report_len-6) );// Macc address 패킷맨앞에 추가. 2009.10.27. sfreer
|
|
|
|
PendMessage( reinterpret_cast<TS_CS_REPORT*>(pBuffer) );
|
|
|
|
delete [] pBuffer;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
|
|
void SGameManager::_stepMovieCapture( RECT& rcWnd, int nInc /*= 30*/ )
|
|
{
|
|
m_dwMovieTime += nInc; //30/1000 초 씩 증가
|
|
g_pSBotMng->Process( m_dwMovieTime );
|
|
|
|
DWORD uRenderFlag = Bot_RenderAll;
|
|
uRenderFlag ^= Bot_RenderConsole; //콘솔
|
|
uRenderFlag ^= Game_RenderCommandSys; //캐릭터
|
|
Render( uRenderFlag );
|
|
|
|
g_pSBotMng->Render( uRenderFlag );
|
|
g_pSBotMng->SaveScreenBMP( rcWnd, m_bMovieMode );
|
|
}
|
|
|
|
void SGameManager::ProcConsole( SGameMessage* pGameMsg )
|
|
{
|
|
SGame * pGame = GetActiveGame();
|
|
if( pGame ) pGame->ProcConsole( pGameMsg );
|
|
|
|
// MJ 2005/07/07 인터페이스 ProcConsole 호출해준다. 좀더 고민중..............
|
|
if( m_pGameInterface ) m_pGameInterface->ProcConsole( pGameMsg );
|
|
|
|
SMSG_CONSOLE_BUILDER* pMsg = static_cast<SMSG_CONSOLE_BUILDER*>(pGameMsg);
|
|
|
|
if( pMsg->m_nValueCount < 1 ) return;
|
|
|
|
if( !::_stricmp( pMsg->m_strKey.c_str(), "game_capture") )
|
|
{
|
|
float nTotalFrame = atoi( pMsg->m_vecValueList[0].c_str() );
|
|
|
|
int nInc = 30;
|
|
if( pMsg->m_nValueCount >= 2 )
|
|
{
|
|
nInc = atoi( pMsg->m_vecValueList[1].c_str() );
|
|
}
|
|
|
|
m_dwMovieTime = m_dwTime;
|
|
m_bMovieMode = true;
|
|
|
|
HWND hWnd=g_hWnd;
|
|
RECT rcWnd;
|
|
GetClientRect(hWnd, &rcWnd);
|
|
ClientToScreen(hWnd, ((LPPOINT)&rcWnd));
|
|
ClientToScreen(hWnd, ((LPPOINT)&rcWnd)+1);
|
|
|
|
SGameCloud::SetProcessPause( true );
|
|
|
|
for( int i(0); nTotalFrame>i; ++i )
|
|
{
|
|
_stepMovieCapture( rcWnd, nInc );
|
|
}
|
|
|
|
SGameCloud::SetProcessPause( false );
|
|
|
|
m_bMovieMode = false;
|
|
|
|
return;
|
|
}
|
|
}
|
|
|
|
void SGameManager::ClearDummy()
|
|
{
|
|
m_usRestDummy = 0;
|
|
}
|
|
|
|
void SGameManager::ConnPendMessageIconUpload( struct XSyncStreamConnection *pConn, const TS_MESSAGE * pMessage )
|
|
{
|
|
pConn->Write( pMessage, pMessage->size );
|
|
|
|
|
|
//// _performance_print( "!!!ConnPendMessage : %d\n", pMessage->id );
|
|
//
|
|
// if( (GetKeyState(20) & 0x01) )
|
|
// _oprint( "네트웍 메세지 Send : [%d]\n", pMessage->id );
|
|
//
|
|
// // 덜보낸 더미 메세지가 있다면 보낸다.
|
|
// if( m_usRestDummyIconUpload )
|
|
// {
|
|
//// _oprint( "미결된 더미 %d만큼 더 보냄.\n", m_usRestDummy );
|
|
// pConn->Write( pMessage, m_usRestDummyIconUpload );
|
|
// m_usRestDummyIconUpload = 0;
|
|
// }
|
|
//
|
|
// // 더미 메세지 하나 제작
|
|
// char buf[ sizeof(TS_MESSAGE) * 2 ];
|
|
// TS_MESSAGE *pMsg = reinterpret_cast< TS_MESSAGE * >( buf );
|
|
// pMsg->id = TM_NONE;
|
|
//
|
|
// // 10% 확률로 보내기전 더미 메세지를 보낸다
|
|
// if( rand()%100 < 10 )
|
|
// {
|
|
// pMsg->msg_check_sum = 0;
|
|
// pMsg->size = static_cast< unsigned short >( sizeof(TS_MESSAGE) + rand() % sizeof(TS_MESSAGE) );
|
|
// pMsg->set_check_sum();
|
|
//
|
|
// pConn->Write( buf, pMsg->size );
|
|
//// _oprint( "더미 보냄. %d만큼.\n", pMsg->size );
|
|
// }
|
|
//
|
|
// pConn->Write( pMessage, pMessage->size );
|
|
//// _oprint( "메시지 보냄. id[%d] size[%d].\n", pMessage->id, pMessage->size );
|
|
//
|
|
// // 30% 확률로 뒤에 미결된 더미 메세지를 보낸다
|
|
// if( rand()%100 < 30 )
|
|
// {
|
|
// pMsg->msg_check_sum = 0;
|
|
// pMsg->size = static_cast< unsigned short >( sizeof(TS_MESSAGE) + rand() % sizeof(TS_MESSAGE) + 1 );
|
|
// pMsg->set_check_sum();
|
|
//
|
|
//
|
|
// m_usRestDummyIconUpload = static_cast< unsigned short >( rand() % ( pMsg->size - sizeof(TS_MESSAGE) ) );
|
|
//
|
|
// pConn->Write( pMsg, pMsg->size - m_usRestDummy );
|
|
//// _oprint( "더미 보냄. %d만큼 보냈고, %d만큼 남았음.\n", pMsg->size - m_usRestDummy, m_usRestDummy );
|
|
// }
|
|
}
|
|
|
|
|
|
void SGameManager::ConnPendMessage( struct XSyncStreamConnection *pConn, const TS_MESSAGE * pMessage )
|
|
{
|
|
// _performance_print( "!!!ConnPendMessage : %d\n", pMessage->id );
|
|
|
|
#ifdef _DEV
|
|
if( (GetKeyState(20) & 0x01) )
|
|
{
|
|
/// 2010.10.06 - prodongi
|
|
//_oprint( "네트웍 메세지 Send : [%d]\n", pMessage->id );
|
|
static std::string netStr;
|
|
m_pGameVM->lookUpNetStr(pMessage->id, netStr);
|
|
_oprint( "Network message Send: %s [%d], %u\n", netStr.c_str(), pMessage->id, GetArTime() );
|
|
}
|
|
#endif
|
|
|
|
// 덜보낸 더미 메세지가 있다면 보낸다.
|
|
if( m_usRestDummy )
|
|
{
|
|
// _oprint( "미결된 더미 %d만큼 더 보냄.\n", m_usRestDummy );
|
|
pConn->Write( pMessage, m_usRestDummy );
|
|
m_usRestDummy = 0;
|
|
}
|
|
|
|
// 더미 메세지 하나 제작
|
|
char buf[ sizeof(TS_MESSAGE) * 2 ];
|
|
TS_MESSAGE *pMsg = reinterpret_cast< TS_MESSAGE * >( buf );
|
|
pMsg->id = TM_NONE;
|
|
|
|
// 10% 확률로 보내기전 더미 메세지를 보낸다
|
|
if( rand()%100 < 10 )
|
|
{
|
|
pMsg->msg_check_sum = 0;
|
|
pMsg->size = static_cast< unsigned short >( sizeof(TS_MESSAGE) + rand() % sizeof(TS_MESSAGE) );
|
|
pMsg->set_check_sum();
|
|
|
|
pConn->Write( buf, pMsg->size );
|
|
// _oprint( "더미 보냄. %d만큼.\n", pMsg->size );
|
|
}
|
|
|
|
pConn->Write( pMessage, pMessage->size );
|
|
// _oprint( "메시지 보냄. id[%d] size[%d].\n", pMessage->id, pMessage->size );
|
|
|
|
// Sends an unresolved dummy message afterwards with a 30% probability.
|
|
if( rand()%100 < 30 )
|
|
{
|
|
pMsg->msg_check_sum = 0;
|
|
pMsg->size = static_cast< unsigned short >( sizeof(TS_MESSAGE) + rand() % sizeof(TS_MESSAGE) + 1 );
|
|
pMsg->set_check_sum();
|
|
|
|
|
|
m_usRestDummy = static_cast< unsigned short >( rand() % ( pMsg->size - sizeof(TS_MESSAGE) ) );
|
|
|
|
pConn->Write( pMsg, pMsg->size - m_usRestDummy );
|
|
// _oprint( "더미 보냄. %d만큼 보냈고, %d만큼 남았음.\n", pMsg->size - m_usRestDummy, m_usRestDummy );
|
|
}
|
|
}
|
|
|
|
void SGameManager::PendMessage( const TS_MESSAGE * pMessage )
|
|
{
|
|
ConnPendMessage( m_pGameConn, pMessage );
|
|
}
|
|
|
|
//이동 요청
|
|
void SGameManager::ReqMove( AR_HANDLE handle, const ArPosition & from, const ArPosition & to, AR_TIME gap, const ArPosition * targetposdata, int count, bool bSpeedSync )
|
|
{
|
|
assert( handle && "ReqMove - Handle 이상!!!" );
|
|
|
|
// _oprint( "Root Speed : %d\n", speed );
|
|
if( to.x < 0 || to.y < 0 )
|
|
{
|
|
assert( 0 && "이동 좌표 이상 : BERSERK 불러 주셈~" );
|
|
return;
|
|
}
|
|
|
|
if( targetposdata == NULL ) count = 1;
|
|
|
|
unsigned short msg_size = sizeof( TS_MOVE_REQUEST ) + sizeof( TS_MOVE_REQUEST::MOVE_INFO ) * count;
|
|
char * pBuffer = new char[msg_size];
|
|
TS_MOVE_REQUEST* pMsg = reinterpret_cast< TS_MOVE_REQUEST * >( pBuffer );
|
|
|
|
new (pMsg) TS_MOVE_REQUEST();
|
|
|
|
pMsg->handle = handle; //자기 자신, 다른 인덱스는 소환수 인덱스임.
|
|
pMsg->x = from.x; //현재 위치
|
|
pMsg->y = from.y; //현재 위치
|
|
// msg.tx = to.x; //목적 위치
|
|
// msg.ty = to.y; //목적 위치
|
|
// msg.tlayer = 0;
|
|
// pMsg->gap = gap;
|
|
pMsg->cur_time = gap;//GetArTime();
|
|
pMsg->speed_sync = bSpeedSync;
|
|
pMsg->count = count;
|
|
|
|
pMsg->size = msg_size;
|
|
pMsg->set_check_sum();
|
|
|
|
TS_MOVE_REQUEST::MOVE_INFO* moveinfo = reinterpret_cast< TS_MOVE_REQUEST::MOVE_INFO* >( pMsg + 1 );
|
|
if( targetposdata != NULL )
|
|
{
|
|
for(int x = 0; x < count; x++ )
|
|
{
|
|
moveinfo[x].tx = targetposdata[x].x;
|
|
moveinfo[x].ty = targetposdata[x].y;
|
|
}
|
|
|
|
#ifdef _DEV
|
|
//_oprint( "ArTime : %u - from : [x:%f y:%f]\t to : [x:%f y:%f]\n", pMsg->cur_time, from.x, from.y, moveinfo[count-1].tx, moveinfo[count-1].ty );
|
|
#endif
|
|
}
|
|
else
|
|
{
|
|
moveinfo[0].tx = to.x;
|
|
moveinfo[0].ty = to.y;
|
|
|
|
// _oprint( "ArTime : %u - from : [x:%f y:%f]\t to : [x:%f y:%f]\n", pMsg->cur_time, from.x, from.y, moveinfo[0].tx, moveinfo[0].ty );
|
|
}
|
|
|
|
PendMessage( pMsg );
|
|
|
|
SAFE_DELETE_ARRAY( pBuffer );
|
|
}
|
|
|
|
void SGameManager::ReqRegionUpdate( AR_TIME gap )
|
|
{
|
|
TS_REGION_UPDATE msg;
|
|
msg.id = TM_CS_REGION_UPDATE;
|
|
msg.x = m_Object.GetMyPos().x; //현재 위치
|
|
msg.y = m_Object.GetMyPos().y; //현재 위치
|
|
msg.z = m_Object.GetMyPos().z; //현재 위치
|
|
msg.bIsStopMessage = !m_Object.GetMyPos().IsMoving(); //상태:이동/정지
|
|
msg.update_time = gap;
|
|
PendMessage( &msg );
|
|
|
|
// _oprint( "Pend ReqRegionUpdate %d %d \n", msg.bIsStopMessage, gap );
|
|
}
|
|
|
|
//따로 처리 할 것이 있는가?
|
|
bool SGameManager::onLeave( _Object *pPtr )
|
|
{
|
|
SGame * pGame = GetActiveGame();
|
|
if( pGame )
|
|
return pGame->onLeave( pPtr );
|
|
|
|
return false;
|
|
}
|
|
|
|
int SGameManager::StartSound( const char * pName, int nVolume, bool bLoop )
|
|
{
|
|
return m_pMSoundMgr->StartSound( pName, nVolume, bLoop );
|
|
}
|
|
|
|
int SGameManager::StartSound( const char * pSoundName, K3DVector pos, int nVolume, bool bLoop )
|
|
{
|
|
return m_pMSoundMgr->PlaySound3D( pSoundName, pos.x, pos.y, pos.z, nVolume, bLoop, false, false );
|
|
}
|
|
|
|
void SGameManager::StopSound( const char *szKeyName )
|
|
{
|
|
return m_pMSoundMgr->StopSound( szKeyName );
|
|
}
|
|
|
|
void SGameManager::AllStopSound(int fadeouttime)
|
|
{
|
|
m_pMSoundMgr->StopMusic();
|
|
m_pMSoundMgr->SwapPlayBGM( "", fadeouttime, fadeouttime, 100, false );
|
|
}
|
|
|
|
void SGameManager::InterfaceMsg( SGameMessage * pMsg )
|
|
{
|
|
// _oprint( "SGameManager::InterfaceMsg\n" );
|
|
m_pGameInterface->ProcMsgAtStatic( pMsg );
|
|
}
|
|
|
|
bool SGameManager::IsOpenDynamicWnd()
|
|
{
|
|
return m_pGameInterface->IsOpenDynamicWnd();
|
|
}
|
|
|
|
bool SGameManager::IsUIWindowOpened( int nWindowID )
|
|
{
|
|
return m_pGameInterface->IsUIWindowOpened( nWindowID );
|
|
}
|
|
|
|
bool SGameManager::IsWebPageWndOpened()
|
|
{
|
|
return m_pGameInterface->IsWebPageWndOpened();
|
|
}
|
|
|
|
class KUIWndManager* SGameManager::GetWndManager()
|
|
{
|
|
return m_pGameInterface->GetWndManager();
|
|
}
|
|
|
|
bool SGameManager::IsShowLoadingWnd()
|
|
{
|
|
if( !m_pGameInterface ) return false;
|
|
return m_pGameInterface->IsShowLoadingWnd();
|
|
}
|
|
|
|
bool SGameManager::IsShowProtectSolutionWnd()
|
|
{
|
|
if( !m_pGameInterface ) return false;
|
|
return m_pGameInterface->IsShowProtectSolutionWnd();
|
|
}
|
|
|
|
bool SGameManager::IsShowEndingWnd()
|
|
{
|
|
if( !m_pGameInterface ) return false;
|
|
return m_pGameInterface->IsShowEndingWnd();
|
|
}
|
|
|
|
bool SGameManager::IsShowFadeInOutWnd()
|
|
{
|
|
if( !m_pGameInterface ) return false;
|
|
return m_pGameInterface->IsShowFadeInOutWnd();
|
|
}
|
|
|
|
bool SGameManager::IsEndFadeInOutWnd()
|
|
{
|
|
if( !m_pGameInterface ) return false;
|
|
return m_pGameInterface->IsEndFadeInOutWnd();
|
|
}
|
|
|
|
//SGameManager *SGameManager::m_pPsuedoThis = NULL;
|
|
//SGameVM* SGameManager::m_pGameVM = NULL;
|
|
|
|
LRESULT CALLBACK SGameManager::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
{
|
|
return m_pGameVM->WndProc(hWnd, message, wParam, lParam);
|
|
}
|
|
|
|
//Network Event Pumping~
|
|
bool SGameManager::onReadEvent( struct IStreamSocketConnection * pConn, struct IQueue* pRecvQueue )
|
|
{
|
|
if( m_pGameVM )
|
|
{
|
|
return m_pGameVM->onReadEvent( pConn, pRecvQueue );
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
void SGameManager::ProcTimeSync( STMSG_TIMESYNC * pMsg )
|
|
{
|
|
AR_TIME tm = GetArTime();
|
|
|
|
TS_TIMESYNC msg;
|
|
msg.time = pMsg->time;
|
|
if ( m_nTimesyncCount < 4 ) // 4회로 제한합니다. 로그인 시 다시 0으로 초기화합니다.
|
|
{
|
|
PendMessage( &msg );
|
|
m_nTimesyncCount++;
|
|
}
|
|
int gap;
|
|
if( tm > pMsg->time )
|
|
{
|
|
unsigned tmp = tm - pMsg->time;
|
|
gap = tmp;
|
|
gap = 0 - gap;
|
|
}
|
|
else
|
|
{
|
|
gap = pMsg->time - tm;
|
|
}
|
|
|
|
SetArTimeAdjust( GetArTimeAdjust() + gap );
|
|
}
|
|
|
|
void SGameManager::PostDeviceLost()
|
|
{
|
|
KUITextureManager::GetManager()->DeviceLost();
|
|
|
|
SGameCursorMng::OnDeviceLost();
|
|
|
|
KPrimitiveSpriteMng::GetManager()->DeviceLost();
|
|
|
|
m_pGameInterface->onDeviceLost();
|
|
m_pGameInterface->RefeshAllWndPos();
|
|
}
|
|
|
|
void SGameManager::SetResolution( int nWidth, int nHeight )
|
|
{
|
|
m_nResolutionOption_Width = nWidth; // 해상도 옵션
|
|
m_nResolutionOption_Height = nHeight; // 해상도 옵션
|
|
|
|
KSize sizResolution;
|
|
sizResolution = KSize( m_nResolutionOption_Width, m_nResolutionOption_Height );
|
|
|
|
m_pGraphics->ResetScreenSize( sizResolution.cx, sizResolution.cy );
|
|
m_ppViewportList[0]->SetViewArea( KRect( KPoint( 0, 0 ), sizResolution ) );
|
|
|
|
const KSize & size = KUIWndManager::GetResolution(); //이전 크기
|
|
|
|
KUIWndManager::SetResolution( sizResolution );
|
|
|
|
m_pLoadGame->SetResolution( nWidth, nHeight );
|
|
|
|
PostDeviceLost();
|
|
|
|
InterfaceMsg( &SIMSG_UI_CHANGE_RESOLUTION(size.width, size.height, nWidth, nHeight) );
|
|
}
|
|
|
|
bool SGameManager::IsShow( int nWinID )
|
|
{
|
|
return m_pGameInterface->IsShow(nWinID);
|
|
}
|
|
|
|
void SGameManager::SetShowEffectFocusWnd( bool bFlag )
|
|
{
|
|
m_pGameInterface->SetShowEffectFocusWnd( bFlag );
|
|
}
|
|
|
|
void SGameManager::SetShowProtectSolutionWnd( bool bFlag )
|
|
{
|
|
m_pGameInterface->SetShowProtectSolutionWnd( bFlag );
|
|
}
|
|
|
|
void SGameManager::SetShowLoadingWnd( bool bFlag, unsigned int warpx, unsigned int warpy )
|
|
{
|
|
m_pGameInterface->SetShowLoadingWnd( bFlag, warpx, warpy );
|
|
}
|
|
|
|
void SGameManager::SetShowFadeInOutWnd( bool bFlag )
|
|
{
|
|
m_pGameInterface->SetShowFadeInOutWnd( bFlag );
|
|
}
|
|
|
|
|
|
void SGameManager::UpdateAddLoadingProcess(float fAddPercent)
|
|
{
|
|
m_pGameInterface->UpdateAddLoadingProcess( fAddPercent );
|
|
g_pSBotMng->Render();
|
|
}
|
|
|
|
void SGameManager::InitLoadingBar()
|
|
{
|
|
m_pGameInterface->InitLoadingBar();
|
|
//g_pSBotMng->Render();
|
|
}
|
|
|
|
void SGameManager::ViewWaitOpenURL()
|
|
{
|
|
m_pGameInterface->ViewWaitOpenURL();
|
|
}
|
|
|
|
void SGameManager::ResetDefaultWinPos()
|
|
{
|
|
m_pGameInterface->ResetDefaultWinPos();
|
|
}
|
|
|
|
void SGameManager::GameGuardSendAccount( const char* szAccount )
|
|
{
|
|
if( g_pNpgl != NULL )
|
|
{
|
|
SDEBUGLOG("nPROTECT - SGameManager::GameGuardSendAccount( const char* szAccount ) 가 사용됨.");
|
|
g_pNpgl->Send( szAccount );
|
|
}
|
|
}
|
|
|
|
bool SGameManager::GameGuardReceiveFromServer( TS_MESSAGE * pMessage )
|
|
{
|
|
SDEBUGLOG("nPROTECT - GameGuardReceiveFromServer - ");
|
|
|
|
TS_SC_GAME_GUARD_AUTH_QUERY* pGameGuard = static_cast< TS_SC_GAME_GUARD_AUTH_QUERY* >(pMessage);
|
|
|
|
WORD size = LOWORD( pGameGuard->auth_data_size );
|
|
WORD version = HIWORD( pGameGuard->auth_data_size ); //version: 0 = 2.5 , 1 = 3.0
|
|
|
|
if( version != 0 )
|
|
{
|
|
g_pNpgl->Auth3( reinterpret_cast< PBYTE >( (pGameGuard+1) ), size, 0 );
|
|
}
|
|
else
|
|
{
|
|
// TODO auth 3.0 이 반영되면 삭제하자.
|
|
GG_AUTH_DATA authdata;
|
|
memcpy( &authdata, (pGameGuard+1), sizeof( authdata ) );
|
|
g_pNpgl->Auth2( &authdata );
|
|
}
|
|
|
|
//SetShowProtectSolutionWnd(true);
|
|
|
|
SDEBUGLOG("nPROTECT - GameGuardReceiveFromServer - ok");
|
|
|
|
return true;
|
|
}
|
|
|
|
bool SGameManager::GameGuardSendToServer( const GG_AUTH_DATA* pAuthdata )
|
|
{
|
|
SDEBUGLOG("nPROTECT - GameGuardSendToServer - ");
|
|
|
|
//SetShowProtectSolutionWnd( false );
|
|
|
|
const int buffer_size = sizeof( GG_AUTH_DATA ) + sizeof( TS_CS_GAME_GUARD_AUTH_ANSWER );
|
|
char auth_msg_buffer[buffer_size] = { 0, };
|
|
|
|
TS_CS_GAME_GUARD_AUTH_ANSWER* msg = new (auth_msg_buffer) TS_CS_GAME_GUARD_AUTH_ANSWER;
|
|
|
|
msg->size += sizeof( GG_AUTH_DATA );
|
|
msg->auth_data_size = sizeof( GG_AUTH_DATA );
|
|
|
|
memcpy( (msg+1), pAuthdata, sizeof( *pAuthdata ) );
|
|
msg->set_check_sum();
|
|
PendMessage( msg );
|
|
|
|
SDEBUGLOG("nPROTECT - GameGuardSendToServer - ok");
|
|
|
|
return true;
|
|
}
|
|
|
|
bool SGameManager::GameGuardSendToServer( const PCSAuth3Data pAuthdata )
|
|
{
|
|
SDEBUGLOG("nPROTECT - GameGuardSendToServer - ");
|
|
|
|
const int buffer_size = sizeof( pAuthdata->bPacket ) + sizeof( TS_CS_GAME_GUARD_AUTH_ANSWER );
|
|
char auth_msg_buffer[buffer_size] = { 0, };
|
|
|
|
TS_CS_GAME_GUARD_AUTH_ANSWER* msg = new (auth_msg_buffer) TS_CS_GAME_GUARD_AUTH_ANSWER;
|
|
|
|
msg->size += pAuthdata->dwPacketSize;
|
|
msg->auth_data_size = pAuthdata->dwPacketSize;
|
|
|
|
memcpy( (msg+1), pAuthdata->bPacket, pAuthdata->dwPacketSize );
|
|
msg->set_check_sum();
|
|
PendMessage( msg );
|
|
|
|
SDEBUGLOG("nPROTECT - GameGuardSendToServer - ok");
|
|
|
|
return true;
|
|
}
|
|
|
|
|
|
/* return value
|
|
1: 자기자신 2: 파티원
|
|
3: 던전시즈 중 길드원 4: NPC
|
|
5: 소환크리처 6: 파티원 크리처
|
|
7: 던전시즈 중 길드원 크리처*/
|
|
//Handle에 해당하는 대상이 친구인지 알아보는 함수 -N4-
|
|
//평상시엔 파티워 아바타와 크리처 자신의 크리처, 던전 시즈중에는 길드원과 길드원의 크리처도 동료에 포함
|
|
int SGameManager::IsFriend( AR_HANDLE Handle, unsigned char& rType )
|
|
{
|
|
return m_pGameInterface->IsFriend(Handle, rType);
|
|
}
|
|
|
|
void SGameManager::ProcSecurityMsg( GameSecurityMsg* pSecurityMsg )
|
|
{
|
|
SIMSG_REQ_OPEN_MSGBOX::_MSGBOXID msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_MAX;
|
|
SIMSG_REQ_OPEN_MSGBOX::_MSGBOXTYPE msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_NONE;
|
|
SYS_RESULT_MSG sysmsg = SYS_MSG_SERVER_DISCONNECT;
|
|
|
|
switch( pSecurityMsg->nMsgType )
|
|
{
|
|
case GameSecurityMsg::MSG_HACK_SHIELD_DETECT_ALREADYHOOKED:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_HS_DETECT_ALREADYHOOKED;
|
|
sysmsg = SYS_MSG_DETECT_ALREADYHOOKED;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_HACK_SHIELD_DETECT_AUTOMOUSE:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_HS_DETECT_AUTOMOUSE;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
sysmsg = SYS_MSG_DETECT_AUTOMOUSE;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_HACK_SHIELD_DETECT_HOOKFUNCTION:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_HS_DETECT_HOOKFUNCTION;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
sysmsg = SYS_MSG_DETECT_HOOKFUNCTION;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_HACK_SHIELD_DETECT_DRIVERFAILED:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_HS_DETECT_DRIVERFAILED;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
sysmsg = SYS_MSG_DETECT_DRIVERFAILED;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_HACK_SHIELD_DETECT_SPEEDHACK:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_HS_DETECT_SPEEDHACK;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
sysmsg = SYS_MSG_DETECT_SPEEDHACK;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_HACK_SHIELD_DETECT_SPEEDHACK_APP:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_HS_DETECT_SPEEDHACK_APP;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
sysmsg = SYS_MSG_DETECT_SPEEDHACK_APP;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_HACK_SHIELD_DETECT_MESSAGEHOOK:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_HS_DETECT_MESSAGEHOOK;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
sysmsg = SYS_MSG_DETECT_MESSAGEHOOK;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_HACK_SHIELD_DETECT_KDTRACE:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_HS_DETECT_KDTRACE;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
sysmsg = SYS_MSG_DETECT_KDTRACE;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_HACK_SHIELD_DETECT_KDTRACE_CHANGED:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_HS_DETECT_KDTRACE_CHANGED;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
sysmsg = SYS_MSG_DETECT_KDTRACE_CHANGED;
|
|
}
|
|
break;
|
|
/* case GameSecurityMsg::MSG_HACK_SHIELD_DETECT_SPEEDHACK_RATIO:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_DETECT_SPEEDHACK_RATIO;
|
|
sysmsg = SYS_MSG_DETECT_SPEEDHACK_RATIO;
|
|
}
|
|
break;*/
|
|
case GameSecurityMsg::MSG_HACK_SHIELD_DETECT_GAME_HACK:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_HS_DETECT_GAME_HACK;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
sysmsg = SYS_MSG_DETECT_GAME_HACK;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_HACK_SHIELD_DETECT_GENERAL_HACK:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_HS_DETECT_GENERAL_HACK;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OKCANCEL;
|
|
sysmsg = SYS_MSG_DETECT_GENERAL_HACK;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_HACK_SHIELD_DETECT_MODULE_CHANGE:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_HS_DETECT_MODULE_CHANGE;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
sysmsg = SYS_MSG_DETECT_MODULE_CHANGE;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_HACK_SHIELD_DETECT_AUTOMACRO: // sonador 7.4.1 AHNHS_ACTAPC_DETECT_AUTOMACRO 관련 callback 처리
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_HS_DETECT_AUTOMACRO;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
sysmsg = SYS_MSG_DETECT_AUTOMACRO;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_NPROTECT_COMM_ERROR:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_NP_COMM_ERROR;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
sysmsg = SYS_MSG_PROTECT18;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_NPROTECT_COMM_CLOSE:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_NP_COMM_CLOSE;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
sysmsg = SYS_MSG_PROTECT18;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_NPROTECT_INIT_ERROR:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_NP_INIT_ERROR;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
sysmsg = SYS_MSG_PROTECT19;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_NPROTECT_SPEEDHACK:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_NP_SPEEDHACK;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
sysmsg = SYS_MSG_PROTECT20;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_NPROTECT_GAMEHACK_KILLED:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_NP_GAMEHACK_KILLED;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
sysmsg = SYS_MSG_PROTECT21;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_NPROTECT_GAMEHACK_DETECT:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_NP_GAMEHACK_DETECT;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
sysmsg = SYS_MSG_PROTECT21;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_NPROTECT_GAMEHACK_DOUBT:
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_NP_GAMEHACK_DOUBT;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
sysmsg = SYS_MSG_PROTECT22;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_HACK_SHIELD_DETECT_ENGINEFAILED: // sonador 7.4.4 핵쉴드 270 적용
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_HS_DETECT_ENGINEFAILED;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
//sysmsg = ;
|
|
}
|
|
break;
|
|
case GameSecurityMsg::MSG_HACK_SHIELD_DETECT_CODEMISMATCH: // sonador 7.4.4 핵쉴드 270 적용
|
|
{
|
|
msgboxID = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_HS_DETECT_CODEMISMATCH;
|
|
msgboxType = SIMSG_REQ_OPEN_MSGBOX::MSGBOX_OK;
|
|
//sysmsg = ;
|
|
}
|
|
break;
|
|
default:
|
|
return;
|
|
}
|
|
|
|
// sonador 7.4.3 해킹 툴 감지후 종료 프로세스 구현
|
|
TS_CS_CHECK_ILLEGAL_USER IllegalUserFound;
|
|
IllegalUserFound.log_code = pSecurityMsg->nNativeCode;
|
|
PendMessage( &IllegalUserFound );
|
|
|
|
SIMSG_REQ_OPEN_MSGBOX* pReqOpenMsg = new SIMSG_REQ_OPEN_MSGBOX( msgboxID, -1, true );
|
|
pReqOpenMsg->m_Type = msgboxType;
|
|
pReqOpenMsg->m_nTextID = sysmsg;
|
|
|
|
PostMsgAtDynamic( pReqOpenMsg );
|
|
}
|
|
|
|
|
|
SUIWnd * SGameManager::GetSUI( int nUI )
|
|
{
|
|
return m_pGameInterface->GetUIWindow( nUI );
|
|
} |