301 lines
8.0 KiB
C++
301 lines
8.0 KiB
C++
#pragma once
|
|
|
|
#ifndef _SGAMEMANAGER_H_
|
|
#define _SGAMEMANAGER_H_
|
|
|
|
#include "ArcadiaClient.h"
|
|
//#include <vector>
|
|
#include "K3DTypes.h"
|
|
|
|
class KSequencer;
|
|
class K3DCamera;
|
|
class K3DRenderDeviceDX;
|
|
class KViewportObject;
|
|
class SSoundManager;
|
|
class K3DTexture;
|
|
class KTextureManager;
|
|
class KNX3Manager;
|
|
|
|
class SGameLoad;
|
|
class SGameEffect;
|
|
class SGameViewPort;
|
|
class SGameVM;
|
|
class SGameInterface;
|
|
class KUIGenWnd;
|
|
|
|
class SGameMilesSoundMgr;
|
|
|
|
//Game DB
|
|
struct SBASICSTAT_DATA;
|
|
struct SCREATURE_DATA;
|
|
struct SITEM_DATA;
|
|
struct SJOB_DATA;
|
|
struct SMONSTER_DATA;
|
|
struct SSKILL_DATA;
|
|
struct STENACITY_DATA;
|
|
|
|
struct SGameMessage;
|
|
struct STMSG_TIMESYNC;
|
|
struct SMSG_LOGIN;
|
|
|
|
struct TS_MESSAGE;
|
|
struct TS_MOVE;
|
|
struct TS_MOVE_ACK;
|
|
struct TS_REGION_ACK;
|
|
struct TS_LEAVE;
|
|
struct TS_ENTER;
|
|
struct TS_LOGIN_RESULT;
|
|
struct TS_TIMESYNC;
|
|
|
|
#include <game_guard/NPGameLib.h>
|
|
extern CNPGameLib *g_pNpgl;// = NULL;
|
|
|
|
struct GameHotKeystrcut
|
|
{
|
|
GameHotKeystrcut() : bShift( false ),
|
|
bAlt( false ),
|
|
bCtrl( false ),
|
|
bTab( false ),
|
|
bUp( false ),
|
|
Virtual_Key(0)
|
|
|
|
{}
|
|
|
|
BOOL bShift;
|
|
BOOL bAlt;
|
|
BOOL bCtrl;
|
|
BOOL bTab;
|
|
BOOL bUp;
|
|
int Virtual_Key;
|
|
};
|
|
|
|
struct GameSecurityMsg
|
|
{
|
|
enum MSG_TYPE
|
|
{
|
|
MSG_HACK_SHIELD_DETECT_ALREADYHOOKED = 0,
|
|
MSG_HACK_SHIELD_DETECT_AUTOMOUSE,
|
|
MSG_HACK_SHIELD_DETECT_HOOKFUNCTION,
|
|
MSG_HACK_SHIELD_DETECT_DRIVERFAILED,
|
|
MSG_HACK_SHIELD_DETECT_SPEEDHACK,
|
|
MSG_HACK_SHIELD_DETECT_SPEEDHACK_APP,
|
|
MSG_HACK_SHIELD_DETECT_MESSAGEHOOK,
|
|
MSG_HACK_SHIELD_DETECT_KDTRACE,
|
|
MSG_HACK_SHIELD_DETECT_KDTRACE_CHANGED,
|
|
MSG_HACK_SHIELD_DETECT_SPEEDHACK_RATIO,
|
|
MSG_HACK_SHIELD_DETECT_GAME_HACK,
|
|
MSG_HACK_SHIELD_DETECT_GENERAL_HACK,
|
|
MSG_HACK_SHIELD_DETECT_MODULE_CHANGE,
|
|
MSG_HACK_SHIELD_DETECT_AUTOMACRO, ///< sonador 7.4.1 AHNHS_ACTAPC_DETECT_AUTOMACRO 관련 callback 처리
|
|
MSG_HACK_SHIELD_DETECT_ENGINEFAILED, ///< sonador 7.4.4 핵쉴드 270 적용
|
|
MSG_HACK_SHIELD_DETECT_CODEMISMATCH, //
|
|
|
|
MSG_NPROTECT_COMM_ERROR,
|
|
MSG_NPROTECT_COMM_CLOSE,
|
|
MSG_NPROTECT_INIT_ERROR,
|
|
MSG_NPROTECT_SPEEDHACK,
|
|
MSG_NPROTECT_GAMEHACK_KILLED,
|
|
MSG_NPROTECT_GAMEHACK_DETECT,
|
|
MSG_NPROTECT_GAMEHACK_DOUBT,
|
|
|
|
MSG_MAX,
|
|
};
|
|
|
|
MSG_TYPE nMsgType;
|
|
unsigned long nNativeCode; ///< sonador 7.4.3 해킹 툴 감지후 종료 프로세스 구현
|
|
|
|
GameSecurityMsg() : nMsgType( MSG_MAX ), nNativeCode( 0 )
|
|
{}
|
|
};
|
|
|
|
class SGameManager : public ArcadiaIntf
|
|
{
|
|
public:
|
|
SGameManager(SGameVM* pGameVM, SGameInterface* pGameInterface, K3DRenderDeviceDX *pRenderDevice, SSoundManager * pSoundMng,
|
|
KTextureManager * pTextureMng, KNX3Manager * pNX3Mng, KViewportObject** ppViewportList, int nViewportCount, SGameMilesSoundMgr* pMSoundMgr );
|
|
~SGameManager(void);
|
|
|
|
bool GetMngState() { return m_nMngState; }
|
|
void SetMngState( bool bState ) { m_nMngState = bState; }
|
|
|
|
void Init();
|
|
void GameSet();
|
|
void SetOption();
|
|
|
|
void ApplyOption( int nOptionType );
|
|
|
|
void SetActiveGame( int nGameType );
|
|
/// for Thread_Render
|
|
class SGame* GetActiveGame();
|
|
|
|
bool IsShow( int nWinID );
|
|
|
|
void SetShowEffectFocusWnd( bool bFlag );
|
|
void SetShowLoadingWnd( bool bFlag, unsigned int warpx = 0, unsigned int warpy = 0 );
|
|
void SetShowFadeInOutWnd( bool bFlag );
|
|
void SetShowProtectSolutionWnd( bool bFlag );
|
|
//void UpdateLoadingProgress(float fPercent);
|
|
void UpdateAddLoadingProcess(float fAddPercent);
|
|
void InitLoadingBar();
|
|
|
|
void ViewWaitOpenURL();
|
|
|
|
/// 게임 종료 처리
|
|
void GameExit();
|
|
|
|
virtual void SetRenderFlag( int nFlag );
|
|
|
|
void Render( unsigned long uRenderBitVector );
|
|
|
|
void AfterRender( unsigned long uRenderBitVector );
|
|
|
|
void Process( unsigned long uProcessBitVector );
|
|
// Process immediately
|
|
void ProcMsgAtStatic( SGameMessage * pMsg );
|
|
// After being queued, it is processed in the next Proc (must be created with new before adding)
|
|
void PostMsgAtDynamic( SGameMessage * pMsg );
|
|
|
|
void onHotkey( GameHotKeystrcut & HotKey );
|
|
|
|
KViewportObject* GetViewPort() { return m_ppViewportList[0]; }
|
|
void ProcConsole( struct SGameMessage* pGameMsg );
|
|
|
|
int GetScreenWidth();
|
|
int GetScreenHeight();
|
|
|
|
bool IsLoadGameActivated();
|
|
|
|
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
|
|
|
|
/// 기능
|
|
void SetShowWater( bool bShow );
|
|
|
|
/// Network
|
|
virtual void ReqMove( AR_HANDLE handle, const ArPosition & from, const ArPosition & to, AR_TIME gap, const ArPosition * targetposdata, int count, bool bSpeedSync = false );
|
|
virtual void ReqRegionUpdate( AR_TIME gap );
|
|
virtual bool onLeave( _Object *pPtr );
|
|
|
|
/// Sound===========================================================================
|
|
int StartSound( const char * pName, int nVolume = -1, bool bLoop = false );
|
|
int StartSound( const char * pSoundName, K3DVector pos, int nVolume = -1, bool bLoop = false );
|
|
void StopSound( const char *szKeyName );
|
|
void AllStopSound(int fadeouttime=0);
|
|
|
|
virtual void InterfaceMsg( struct SGameMessage * );
|
|
bool IsUIWindowOpened( int nWindowID );
|
|
bool IsWebPageWndOpened();
|
|
bool IsOpenDynamicWnd();
|
|
bool IsShowLoadingWnd();
|
|
bool IsShowEndingWnd();
|
|
bool IsShowProtectSolutionWnd();
|
|
bool IsShowFadeInOutWnd();
|
|
bool IsEndFadeInOutWnd();
|
|
|
|
class KUIWndManager* GetWndManager();
|
|
|
|
|
|
void CloseToServer( bool bForce = false );
|
|
//bool ConnectToServer( const char * pIP, const int nPort );
|
|
bool ConnectToServer( const char * pIP, const int nPort, bool bFlag = false ); // MAC ADDRESS. bintitle. 2010.05.27.
|
|
bool onReadEvent( struct IStreamSocketConnection * pConn, struct IQueue* pRecvQueue );
|
|
void ProcTimeSync( STMSG_TIMESYNC * pMsg );
|
|
void PendMessage( const TS_MESSAGE * pMessage );
|
|
|
|
void ConnPendMessage( struct XSyncStreamConnection *pConn, const TS_MESSAGE * pMessage );
|
|
|
|
// IconUpload 서버에 패킷전송.
|
|
void ConnPendMessageIconUpload( struct XSyncStreamConnection *pConn, const TS_MESSAGE * pMessage );
|
|
|
|
void ClearDummy();
|
|
|
|
void SetResolution( int nWidth, int nHeight );
|
|
|
|
void PostDeviceLost();
|
|
|
|
bool IsValidConnectedServer();
|
|
|
|
void ResetDefaultWinPos();
|
|
|
|
int IsFriend( AR_HANDLE Handle, unsigned char& rType );
|
|
|
|
//Thread Flag
|
|
bool m_bThProcessExit;
|
|
bool m_bThRenderExit;
|
|
|
|
void ProcSecurityMsg( GameSecurityMsg* pSecurityMsg );
|
|
|
|
void GameGuardSendAccount( const char* szAccount );
|
|
|
|
SGameInterface* GetGameInterface() { return m_pGameInterface; } // servanates 2010.11.29
|
|
|
|
|
|
class SUIWnd * GetSUI( int nUI ); // SGameInterface->GetUIWindow() 의 Warpping 함수.
|
|
|
|
bool GameGuardReceiveFromServer( TS_MESSAGE * pMessage );
|
|
bool GameGuardSendToServer( const GG_AUTH_DATA* pAuthdata );
|
|
bool GameGuardSendToServer( const PCSAuth3Data pAuthdata );
|
|
|
|
void SetCreatureRange ( int nRange ) { m_nCreatureRange = nRange; }
|
|
|
|
// { [sonador]
|
|
#ifdef _KUI_INVALIDATION
|
|
K3DRenderDeviceDX* GetRenderDevice() { return m_pGraphics; }
|
|
#endif
|
|
// }
|
|
protected:
|
|
|
|
void _stepMovieCapture( RECT& rcWnd, int nInc = 30 );
|
|
|
|
SGameVM* m_pGameVM;
|
|
SGameInterface* m_pGameInterface;
|
|
|
|
bool m_nMngState;
|
|
int m_nActiveGame;
|
|
std::vector< SGame* > m_vGameList;
|
|
|
|
SGameLoad* m_pLoadGame;
|
|
|
|
K3DRenderDeviceDX* m_pGraphics; // Related to Graphics Device
|
|
KTextureManager* m_pTextureManager; // Related to Texture Manager
|
|
KNX3Manager* m_pNX3Mgr; // Related to NX3 Manager
|
|
SSoundManager* m_pSoundMng; // Related to Sound Manager
|
|
|
|
SGameMilesSoundMgr* m_pMSoundMgr;
|
|
|
|
KViewportObject** m_ppViewportList;
|
|
int m_nViewportCount;
|
|
|
|
std::vector< SGameMessage * > m_UIMsgList; // UI messages that are not processed immediately. They are handled in the next process
|
|
|
|
int m_nResolutionOption_Width; // Resolution options
|
|
int m_nResolutionOption_Height; // Resolution options
|
|
|
|
//Network
|
|
BOOL m_bTryConnect;
|
|
struct XSyncStreamConnection* m_pGameConn;
|
|
struct IQueue* m_pRecvQueue;
|
|
ArcadiaClient m_Object;
|
|
unsigned short m_usRestDummy;
|
|
|
|
// Icon Upload 서버 더미.
|
|
unsigned short m_usRestDummyIconUpload;
|
|
|
|
//임시 보관..
|
|
SMSG_LOGIN* m_pLoginResult;
|
|
BOOL m_bRecvLoginResult;
|
|
|
|
DWORD m_dwTime;
|
|
DWORD m_dwInterfaceTime;
|
|
|
|
DWORD m_dwNetWorkTime;
|
|
|
|
DWORD m_dwMovieTime;
|
|
bool m_bMovieMode;
|
|
|
|
int m_nCreatureRange;
|
|
|
|
int m_nTimesyncCount;
|
|
};
|
|
|
|
|
|
#endif |