401 lines
13 KiB
C++
401 lines
13 KiB
C++
|
||
#pragma once
|
||
|
||
#include <toolkit/XBossWorker.h>
|
||
#include "KTypes.h"
|
||
|
||
#include "SGameAniType.h"
|
||
|
||
extern const char* c_szNoticeURL ;
|
||
extern const char* c_szOldNoticeURL;
|
||
extern const DWORD c_dwNoticeMaxSize;
|
||
|
||
extern const char *pLOGIN_STATE[];
|
||
|
||
extern const KColor c_colorLobbyFog;
|
||
extern const float c_fLobbyFogNear;
|
||
extern const float c_fLobbyFogFar;
|
||
|
||
extern const float c_fAvatarRotateValue;
|
||
extern const float c_fAvatarRotateDeltaPerFrame;
|
||
|
||
|
||
extern const char* c_szDefaultAniName ;
|
||
extern const char* c_szBGCommonAniName ;
|
||
extern const char* c_szBGAsuraAniName ;
|
||
extern const char* c_szBGDevaAniName ;
|
||
extern const char* c_szSelectStartAniName ;
|
||
extern const char* c_szSelectLoopAniName ;
|
||
extern const char* c_szSelectEndAniName ;
|
||
extern const char* c_szUnselectStartAniName ;
|
||
extern const char* c_szUnselectLoopAniName ;
|
||
extern const char* c_szUnselectEndAniName ;
|
||
extern const char* c_szAvatarEffectStartAniName;
|
||
extern const char* c_szAvatarEffectLoopAniName ;
|
||
extern const char* c_szAvatarEffectLoop2AniName;
|
||
extern const char* c_szAvatarEffectEndAniName ;
|
||
extern const char* c_szClanCardStartAniName ;
|
||
extern const char* c_szClanCardLoopAniName ;
|
||
extern const char* c_szClanCardEndAniName ;
|
||
|
||
extern struct USER_INFO g_UserInfo;
|
||
|
||
enum _LOGIN_STATE
|
||
{
|
||
GAMELOGIN_UNINITIALIZED = 0, ///< 최초 시작
|
||
//GAMELOGIN_PREPARE_LOGIN, //로그인 준비
|
||
GAMELOGIN_INTRO, ///< 인트로
|
||
|
||
GAMELOGIN_LOGIN, ///< 로그인 가능
|
||
GAMELOGIN_LOGIN_OFF, ///< 로그인 시도 및 결과 대기
|
||
|
||
GAMELOGIN_PREPARE_SERVERSELECT, ///< 책 넘기기
|
||
|
||
GAMELOGIN_SERVERSELECT, ///< 서버 선택 대기
|
||
GAMELOGIN_SERVERSELECT_ON, ///< 서버 선택 가능
|
||
GAMELOGIN_GAMESERVER_LOGIN, ///< 게임 서버에 로긴하기
|
||
|
||
GAMELOGIN_PREPARE_CHARSELECT, ///< 캐릭터 선택 준비
|
||
GAMELOGIN_CHARSELECT_WAIT_TIME, ///< 캐릭터 선택 화면이 나오긴 했으나 잠시 엔터메세지를 받지 않는 쉬는 시간의 화면
|
||
GAMELOGIN_BACK_CHARSELECT_TO_GAME, ///< 게임상에서 캐릭선택 로비로 가는 씬으로 서버로 부터 캐릭터 리스르를 받는 대기 화면
|
||
GAMELOGIN_CHARSELECT, ///< 캐릭터 선택 가능
|
||
// GAMELOGIN_WAITING_CHAREFFECT_FINISH, //
|
||
GAMELOGIN_CREATECHAR_RACE_SELECT, // Character Race Selection Screen for Creation
|
||
GAMELOGIN_CREATECHAR_RACE_SELECT_BACK, ///< 생성할 캐릭터 종족 선택화면에서 로비로 돌아가기
|
||
GAMELOGIN_CREATECHAR_RACE_MOVIE, // Race-specific video on the character creation race selection screen
|
||
GAMELOGIN_CREATECHAR_CUSTOMIZING, // Character Customization
|
||
GAMELOGIN_CREATECHAR_SUCCESS, // Character creation successful
|
||
GAMELOGIN_CREDITS, ///< 크레딧 화면 // sonador 10.5.1 크레딧 화면 구현
|
||
GAMELOGIN_CREDITS2, ///< 크레딧 화면 // sonador 10.5.1 크레딧 화면 구현
|
||
GAMELOGIN_CREDITS3, /// 2011.12.14 - prodongi
|
||
GAMELOGIN_CREDITS4, //gmpbigsun
|
||
|
||
GAMELOGIN_CREDITSEPIC6PROLOGUE,
|
||
GAMELOGIN_BACKTO_CHARSELECT, ///< 캐릭터 선택으로 돌아가기
|
||
GAMELOGIN_BACKTO_LOGOUT, ///< 로그아웃 처리.
|
||
|
||
// GAMELOGIN_PREPARE_CREATECHAR, //캐릭터 만들기 준비
|
||
// GAMELOGIN_CREATECHAR, //캐릭터 만들기
|
||
|
||
// GAMELOGIN_CREATECHAR_SECOND, //캐릭터 만들기 2단계
|
||
|
||
// GAMELOGIN_DBLCLICK_LOGIN, //더블클릭 로그인
|
||
|
||
GAMELOGIN_DEVELOPERS_LOGIN, ///< 개발자 로그인
|
||
|
||
GAMELOGIN_INIT_VALUE, ///< 초기화 값
|
||
};
|
||
|
||
int GetValidNum( int nNum, int nMaxNum );
|
||
|
||
class SAvatarSelector;
|
||
class KSeqModel;
|
||
class KSeqAvatarEx;
|
||
|
||
class SAvatarSelector
|
||
{
|
||
public:
|
||
SAvatarSelector();
|
||
virtual ~SAvatarSelector();
|
||
|
||
K3DMatrix& GetTransform();
|
||
void SetTransform( const K3DMatrix& rPos );
|
||
|
||
static void BeginAvatarLoadingThread();
|
||
static void EndAvatarLoadingThread();
|
||
|
||
bool IsPlaying();
|
||
void PendLoading();
|
||
bool IsPendLoading() { return m_bIsThreadPending; }
|
||
|
||
bool Init();
|
||
|
||
int GetLevel() const { return m_nLevel; }
|
||
int GetJobLevel() const { return m_nJobLevel; }
|
||
int GetJobID() const { return m_nJobID; }
|
||
const char* GetName() const { return m_strName.c_str(); }
|
||
|
||
int GetRace() const { return m_nRace; }
|
||
int GetSex() const { return m_nSex; }
|
||
int GetHairIndex() const { return m_nHairIndex; }
|
||
int GetFaceIndex() const { return m_nFaceIndex; }
|
||
int GetBodyIndex() const { return m_nBodyIndex; }
|
||
int GetHandIndex() const { return m_nHandIndex; }
|
||
int GetFootIndex() const { return m_nFootIndex; }
|
||
int GetDecoIndex() const { return m_nDecoIndex; }
|
||
|
||
int GetNudeCode( int nIndex ) { assert( nIndex >=0 && nIndex < 5 ); return m_NudeCode[nIndex]; }
|
||
void SetNudeCode( int nIndex, ItemBase::ItemCode code ) { assert( nIndex >=0 && nIndex < 5 ); m_NudeCode[nIndex] = code; }
|
||
|
||
int GetWearCode( int nIndex ) { assert( nIndex >=0 && nIndex < ItemBase::MAX_ITEM_WEAR ); return m_WearCode[nIndex]; }
|
||
int GetWearLevel( int nIndex ) { assert( nIndex >=0 && nIndex < ItemBase::MAX_ITEM_WEAR ); return m_nItemLevel[nIndex]; }
|
||
|
||
void SetWearIndex( int nIndex, ItemBase::ItemCode code, int nItemLevel, ItemBase::ItemCode appearanceCode = 0)
|
||
{
|
||
assert( nIndex >=0 && nIndex < ItemBase::MAX_ITEM_WEAR );
|
||
m_WearCode[nIndex] = (appearanceCode)? appearanceCode : code; // 2012.7.26 – Use the transformation code as the item code if a marine transformation code is present
|
||
m_nItemLevel[nIndex] = nItemLevel;
|
||
}
|
||
|
||
void SetName( const char* szName ) { m_strName = szName; }
|
||
void SetDisplayInfo( int nLevel, int nJobLevel, int nJobID )
|
||
{
|
||
m_nLevel = nLevel;
|
||
m_nJobLevel = nJobLevel;
|
||
m_nJobID = nJobID;
|
||
}
|
||
void SetRace( int nRace )
|
||
{
|
||
m_nRace = nRace;
|
||
}
|
||
void SetScale( float Scale ) { m_fScale = Scale; }
|
||
void SetSex( int nSex )
|
||
{
|
||
assert( 0 != nSex );
|
||
m_nSex = nSex;
|
||
}
|
||
|
||
// Set hairstyles index
|
||
void SetHairIndex( int nHairIndex );
|
||
|
||
// Set face model index
|
||
void SetFaceIndex( int nFaceIndex );
|
||
void SetBodyIndex( int nBodyIndex );
|
||
void SetHandIndex( int nHandIndex );
|
||
void SetFootIndex( int nFootIndex );
|
||
|
||
// Set face deco index (tatoos)
|
||
void SetDecoIndex( int m_nDecoIndex );
|
||
|
||
int GetHairColorIndex() { return m_nHairColorIndex; }
|
||
void SetHairColorIndex(int nIndex);
|
||
|
||
int GetHairColorRGB() { return m_dwHairColor; }
|
||
void SetHairColorRGB(DWORD NewColor) { _oprint("[SetHairColorRGB execution; color is: %u\n", NewColor); m_dwHairColor = NewColor; };
|
||
|
||
void RefreshAvatar( bool bAniRefresh = true );
|
||
|
||
void Ani_Default();
|
||
void Ani_Attack(int nPlayType = 1);/*KSeqForm::SEQTYPE_LOOP*/
|
||
void Ani_Walk();
|
||
void Ani_Idle();
|
||
bool IsDefaultAni();
|
||
|
||
void SetMoveInfo( const K3DVector &tpos );
|
||
|
||
void Render( KViewportObject* viewport, DWORD flag=0 );
|
||
bool Process( DWORD dwTime );
|
||
|
||
bool IsCollision( const K3DVertex& rVertex1, const K3DVertex& rVertex2 ) const;
|
||
|
||
void ReSet();
|
||
const bool IsPosBack() { return m_bIsPosBack; }
|
||
void SetPosBack( bool bPosBack ) { m_bIsPosBack = bPosBack; }
|
||
|
||
void SetRotate( bool bRotate, const K3DVector &dpos, const K3DVector &tpos, bool bTime = false, bool bFlag = false );
|
||
|
||
// fValue - initialization rotation point;
|
||
void AvatarRotate( float fValue, bool bAdd, bool bInit=false );
|
||
|
||
const bool IsFront() { return m_bIsFront; }
|
||
void ReSetFront() { m_bIsFront = false; };
|
||
void SetSelectAvatar() { m_bSelectAvatar = true; };
|
||
|
||
void* AvatarPerform( int nAniIndex, int nMeshIndex, KID id, KArg& msg );
|
||
|
||
void SetSkinColorized( const DWORD& color, const int& nMode, const DWORD& hairColor );
|
||
void RefreshSkinColorized();
|
||
|
||
unsigned long GetSkinColorized();
|
||
|
||
private:
|
||
|
||
static unsigned int __stdcall avatar_loader( void* pArg );
|
||
static volatile bool s_bStopThread;
|
||
volatile bool m_bIsThreadLoading;
|
||
volatile bool m_bIsThreadPending;
|
||
void StartThreadLoading() { m_bIsThreadLoading = true; }
|
||
void EndThreadLoading() { m_bIsThreadLoading = false; }
|
||
|
||
|
||
|
||
void addToLoadingList();
|
||
void removeFromLoadingList();
|
||
|
||
void doLoading();
|
||
|
||
void PlayAnimation( const char* pAniKey, int nPlayType = SEQTYPE_LOOP );
|
||
|
||
enum
|
||
{
|
||
PROC_00, // IDLE
|
||
PROC_01, // MOVE
|
||
PROC_02, // COMPLETE
|
||
};
|
||
|
||
class KSeqAvatarEx* m_pAvatar;
|
||
|
||
bool m_bRefresh;
|
||
|
||
std::string m_AniKey_Def;
|
||
std::string m_AniKey_Act;
|
||
std::string m_AniKey_Walk;
|
||
std::string m_AniKey_Idle;
|
||
|
||
int m_nLevel;
|
||
int m_nJobLevel;
|
||
int m_nJobID;
|
||
std::string m_strName;
|
||
int m_nRace;
|
||
int m_nSex;
|
||
int m_nHairIndex;
|
||
int m_nFaceIndex;
|
||
int m_nBodyIndex;
|
||
int m_nHandIndex;
|
||
int m_nFootIndex;
|
||
int m_nDecoIndex;
|
||
|
||
DWORD m_dwSkinColor;
|
||
|
||
DWORD m_dwHairColor; // RGB hair color
|
||
int m_nHairColorIndex; // Hair color index (from based hairs)
|
||
|
||
bool m_bSelectAvatar;
|
||
|
||
ItemBase::ItemCode m_NudeCode[5];
|
||
ItemBase::ItemCode m_WearCode[ItemBase::MAX_ITEM_WEAR];
|
||
int m_nItemLevel[ItemBase::MAX_ITEM_WEAR];
|
||
|
||
DWORD m_dwTime;
|
||
float m_fTargetRoll;
|
||
float m_fPresentRoll;
|
||
DWORD m_dwPrevTime;
|
||
bool m_bUseRot;
|
||
bool m_bUseProc;
|
||
K3DVector m_vTarPos;
|
||
K3DVector m_vCurPos;
|
||
float m_fScale;
|
||
|
||
bool m_bIsPosBack;
|
||
|
||
bool m_bRotate; // Final rotation
|
||
float m_fSecondRoll;
|
||
|
||
bool m_bIsFront;
|
||
|
||
short m_nStep;
|
||
|
||
public:
|
||
unsigned int getHideEquipInfo() const { return m_hideEquipInfo; }
|
||
void setHideEquipInfo(unsigned int flag) { m_hideEquipInfo = flag; }
|
||
bool isHideEquipInfo(unsigned int flag) { return (m_hideEquipInfo & flag) == 0 ? false : true; }
|
||
private:
|
||
unsigned int m_hideEquipInfo;
|
||
};
|
||
|
||
struct LOBBY_AVATAR
|
||
{
|
||
enum LOBBYAVATAR_EFFECTSTATE
|
||
{
|
||
EFFECTSTATE_NONE,
|
||
EFFECTSTATE_UNSELECT_START,
|
||
EFFECTSTATE_UNSELECT_LOOP,
|
||
EFFECTSTATE_UNSELECT_END,
|
||
EFFECTSTATE_SELECT_START,
|
||
EFFECTSTATE_SELECT_LOOP,
|
||
EFFECTSTATE_SELECT_END,
|
||
};
|
||
|
||
SAvatarSelector* pAvatar;
|
||
KSeqModel* pEffect;
|
||
KSeqModel* pEffect2;
|
||
LOBBYAVATAR_EFFECTSTATE EffectState;
|
||
LOBBYAVATAR_EFFECTSTATE EffectState2;
|
||
|
||
LOBBY_AVATAR();
|
||
virtual ~LOBBY_AVATAR();
|
||
|
||
void PlayEffect( int nIndex, DWORD dwTime, LOBBYAVATAR_EFFECTSTATE state );
|
||
};
|
||
|
||
class CLobbyNoticeReceiver : public XBossWorker::XWorker
|
||
{
|
||
public:
|
||
CLobbyNoticeReceiver( const char* szURL, DWORD dwBufSize )
|
||
: m_bFinished( false ), m_strURL( szURL ), m_dwBufSize( dwBufSize ), m_pBuffer( new char[dwBufSize + 1] ) { }
|
||
|
||
virtual ~CLobbyNoticeReceiver() { delete [] m_pBuffer; }
|
||
|
||
bool IsFinished() const { return m_bFinished; }
|
||
const std::string& GetNotice() const { return m_strNotice; }
|
||
|
||
bool onProcess( int nThreadNum );
|
||
|
||
void onEnd( bool bIsCancel ) { }
|
||
|
||
private:
|
||
volatile bool m_bFinished;
|
||
|
||
std::string m_strURL;
|
||
std::string m_strNotice;
|
||
|
||
DWORD m_dwBufSize;
|
||
char* m_pBuffer;
|
||
};
|
||
|
||
//공용 함수
|
||
class SGame;
|
||
|
||
void CreateNewAvatar( SGame * pGame, const char* szName, SAvatarSelector* pNewAvatar );
|
||
void LoginAccount( SGame * pGame, const char* szAccount, __int64 & one_time_key );
|
||
void DeleteAvatar( SGame * pGame, const char* szName, const char* szSecurityNo );
|
||
void CharacterLogin( SGame * pGame, const char* szName, int nRace );
|
||
|
||
/// 보안 프로그램용
|
||
struct USER_INFO
|
||
{
|
||
private:
|
||
std::string m_strAccount; ///< 계정 이름
|
||
std::string m_strSelServerName; ///< 선택된 서버 이름
|
||
std::string m_strClassName; ///< 클래스 이름
|
||
long m_nLevel; ///< 레벨
|
||
bool m_bIsAdultServer;
|
||
bool m_isMonkeyTail; /// 2010.11.10 @계정인지 아닌지, @계정만 카메라 유저모드를 할 수 있게 하기 위해서 - prodongi
|
||
int m_user_no; // 유럽 db 통합 account id 중복 버그 방지위해 크루샵에서 사용할 고유값
|
||
public:
|
||
/// 2010.11.10 - prodongi
|
||
//void SetAccountName( const char* strAccountName ) { m_strAccount = strAccountName; }
|
||
void SetAccountName( const char* strAccountName )
|
||
{
|
||
m_strAccount = strAccountName;
|
||
/// 개발자 모드에서는 @계정이 아니더라도 권한을 줘야 된다.
|
||
#ifdef _DEV
|
||
m_isMonkeyTail = true;
|
||
#else
|
||
m_isMonkeyTail = (strAccountName[0] == '@') ? true : false;
|
||
#endif
|
||
}
|
||
void SetSelServerName( const char* strSelServerName ) { m_strSelServerName = strSelServerName; }
|
||
void SetClassName( const char* strClassName ) { m_strClassName = strClassName; }
|
||
void SetLevel( long nLevel ) { m_nLevel = nLevel; }
|
||
void SetAdultServer( bool bIsAdult ) { m_bIsAdultServer = bIsAdult; }
|
||
void SetUserNo(const int user_no)
|
||
{
|
||
m_user_no = user_no;
|
||
}
|
||
public:
|
||
const char* GetAccountName() { return m_strAccount.c_str(); }
|
||
const char* GetSelServerName() { return m_strSelServerName.c_str(); }
|
||
const char* GetClassName() { return m_strClassName.c_str(); }
|
||
long GetLevel() { return m_nLevel; }
|
||
bool IsAdultServer() { return m_bIsAdultServer; }
|
||
bool isMonkeyTail() const { return m_isMonkeyTail; } /// 2010.11.10 - prodongiF
|
||
const int GetUserNo() const
|
||
{
|
||
return m_user_no;
|
||
}
|
||
public:
|
||
USER_INFO() : m_strAccount(""), m_strSelServerName(""), m_strClassName(""), m_nLevel(0), m_bIsAdultServer( false ), m_isMonkeyTail(false), m_user_no(0) /// 2010.11.10 - prodongi
|
||
{}
|
||
~USER_INFO() {}
|
||
}; |