Files
Leviathan/Client/Game/engine/Build/SBotManager.h
T
2026-06-01 12:46:52 +02:00

223 lines
5.8 KiB
Objective-C

#pragma once
/// @brief 기본 Bot은 수동이다 - 일반 사용자
#include <Windows.h>
//#include <vector>
#include "KObject.h"
#include "SBuild.h"
#include <toolkit/XBossWorker.h>
#include "SRenderFlag.h"
class SGameManager;
class SGameVM;
class SGameConsole;
class SGameInterface;
class K3DRenderDeviceDX;
class KTextureManager;
class KNX3Manager;
class SSoundManager;
class KViewportObject;
class SGameMilesSoundMgr;
#include <game_guard/NPGameLib.h>
//////////////////////////////////////////////////////////////////////////
/**
@class SBot
@brief 목표 : 봇은 월드를 점령 한다.(모든 기능 가능)
룰 : 봇은 지정된 몇초의 지연시간을 갖고 움직인다.
예를 들어, 지연시간이 1초로 설정 되어 있으면, 1초에 한번씩 명령을 수행 한다.
*/
class SBot : public KObject, public SBuild
{
public:
enum
{
BOT_SELECT = 0,
BOT_WORLD,
};
SBot( const char * pName, K3DRenderDeviceDX *pRenderDevice, SSoundManager * pSoundMng,
KTextureManager * pTextureMng, KNX3Manager * pNX3Mng, KViewportObject** ppViewportList, int nViewportCount,
SGameMilesSoundMgr* pMSoundMgr );
~SBot();
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
virtual void *Perform( KID id, KArg& msg );
class SGameManager* GetGameMgr() { return m_pGameMng; }
class SGame * GetActiveGame();
const char * GetName() const { return szName; }
/// 콘솔의 문자열 처리
void ProcConsole( struct SGameMessage* pGameMsg );
bool IsLoadGameActivated();
void onDeviceLost();
void SetActiveRender( BOOL bValue ) { m_bActiveRender=bValue; }
//////////////////////////////////////////////////////////////////////////
//Build System
/// 테스트 시작
virtual void DoTest();
/// 보고서 작성
virtual void DoReport();
//////////////////////////////////////////////////////////////////////////
void onHotkey( struct GameHotKeystrcut & HotKey );
void Process( unsigned long uProcessBitVector );
void Render( unsigned long uRenderBitVector );
void AfterRender( unsigned long uRenderBitVector );
void ProcSecurityMsg( struct GameSecurityMsg* pSecurityMsg );
void InitializeScriptForGameUI();
bool GameGuardSendToServer( const GG_AUTH_DATA* pAuthdata );
bool GameGuardSendToServer( const PCSAuth3Data pAuthdata );
protected:
SGameManager* m_pGameMng;
SGameVM* m_pGameVM;
SGameInterface* m_pGameInterface;
BOOL m_bActiveSkip; // If enabled, always Render
BOOL m_bActiveRender; // Render only when Active
char szName[32];
int m_nStep;
};
//////////////////////////////////////////////////////////////////////////
/// SBotManager
class SBotManager : public KObject
{
public:
SBotManager( HWND hWnd, HINSTANCE hInstance );
~SBotManager();
/// Bot 추가
void Bot_Add( const char * pName );
/// Bot 삭제
void Bot_Del( const char * pName );
void Bot_Del_all();
/// Bot List 얻기
void Bot_List();
/// Bot 선택하기
void Bot_Select( const char * pName );
void LogSave();
bool IsLoadGameActivated();
// static SGameConsole* m_pConsole;
static SBotManager* m_pBotThis;
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
virtual void *Perform( KID id, KArg& msg );
void SaveScreenBMP( const RECT& c_rcWnd, bool bMovieMode );
void onHotkey( struct GameHotKeystrcut & HotKey );
void Process( DWORD dwSetTime = 0 );
void Render( unsigned long uRenderBitVector=Bot_RenderAll );
//콘솔의 문자열 처리
void ProcConsole( struct SGameMessage* pGameMsg );
bool ProcGameConsole( struct SGameMessage* pGameMsg );
bool ProcOptionConsole( struct SGameMessage* pGameMsg );
bool ProcDebugConsole( struct SGameMessage* pGameMsg );
bool ProcLuaConsole( struct SGameMessage* pGameMsg );
SBot* GetCurBot();
int InitViewportEx();
void SetShowWater( bool bShowWater );
int GetViewportCount() { return m_nViewportCount; }
void SetWindStrength(float fWindStrength);
bool DoesUseHqWater();
void SetShadowEnable(bool bEnable);
// 콘솔에 텍스트 출력하기 위해
// extern SBotManager* g_pSBotMng;
// g_pSBotMng->getConsoleWindow()->AddChatText("<br>");
class SUITopConsoleWnd* getConsoleWindow() { return m_pConsoleWnd; }
void ProcSecurityMsg( struct GameSecurityMsg* pSecurityMsg );
bool GameGuardSendToServer( const GG_AUTH_DATA* pAuthdata );
bool GameGuardSendToServer( const PCSAuth3Data pAuthdata );
protected:
void Init( HWND hWnd, HINSTANCE hInstance );
void Destroy();
void SetupWindMatrices(float fTimeInSecs);
void BotTest();
void GetTimeStr( std::string & strName, const char * pFileName );
class SGameCursorMng * m_pCursorMng; ///< Cursor
class KUIGenWnd* CreateConsoleWnd();
class KUIWndManager* m_pUIWndManager; // Window Manager for console~
class SUITopConsoleWnd* m_pConsoleWnd;
class SUITopSystemInfoWnd* m_pSystemInfoWnd;
bool m_bActConsole;
bool m_bActSystemInfo;
int m_nSelectBot; ///< Select Bot
DWORD m_dwCheckTime;
std::vector< SBot* > m_BotList; ///< Bot 리스트
//Bot 생성시 필요 개체
K3DRenderDeviceDX* m_pGraphics; ///< Graphics Device 관련
KTextureManager* m_pTextureManager; ///< Texture Manager 관련
KNX3Manager* m_pNX3Mgr; ///< NX3 Manager 관련
SSoundManager* m_pSoundMng; ///< Sound Manager 관련
SGameMilesSoundMgr* m_pMSoundMgr;
KViewportObject* m_pViewportList[10]; ///< View Port
int m_nViewportCount;
unsigned long m_ulProcessBitVector; ///< Process 제어
unsigned long m_ulRenderBitVector; ///< Render 제어
bool m_bUseHqWater;
BOOL m_bActiveRender; ///< Active시만 Render
private:
DWORD m_nScreenCount;
//int m_nExit; //종료 메세지 왔음.
//Wind
double m_fTime;
float m_fAccumTime;
double m_fElapsedTime; ///< Time elapsed since last frame
double m_fLastElapsedTime;
float m_fOldStrength;
float m_fWindStrength;
bool m_bCheckRender;
};