#include "stdafx.h" #include ".\sgameworld.h" #include "KDeviceManager.h" #include "KRenderObject.h" #include "KRenderObjectBone.h" #include "KRenderObjectMesh.h" #include "KRenderDeviceDX.h" #include "KUIWndManager.h" #include "K3DCamera.h" #include "KNX3Loader.h" #include "KPrimitive.h" #include "KRenderObjectEtc.h" #include "SGameSound.h" #include "SGameCamera.h" //#include "KUIControl.h" #include "KUITextureManager.h" #include #include #include "KResourceManager.h" #include "SGameCursor.h" #include "SGameViewPort.h" #include "SShadowViewPort.h" #include "SWaterViewPort.h" #include #include #include "KResourceManager.h" #include "KSeqModel.h" #include "KSeqAvatar.h" #include "K3DBound.h" #include "SCobManager.h" #include "SNetMessage.h" #include "SGameAvatarEx.h" #include "SGameLocalCreature.h" #include "SGameMob.h" #include "SGameOtherPlayer.h" #include "SGameNpc.h" #include "SGameItem.h" #include "SGameLocalPet.h" #include "sgameplayer.h" #include "SGameEffect.h" //#include "Util.h" #include "TerrainTextureInfo.h" #include "TerrainPropInfo.h" #include "TerrainPrimitive.h" #include "TerrainMapEngine.h" #include "TerrainLowQualityWaterInfo.h" #include #include "ErrorCode/ErrorCode.h" #include "SGameMessage.h" //#include "SGameMessageUI.h" #include "SGameWork.h" #include "SCommandSystem.h" #include "SGameSystem.h" #include "SActionMgr.h" #include "SGameManager.h" #include "SGameInput.h" #include "SGameUIMgr.h" #include "SPetMgr.h" //DB #include "SItemDB.h" #include "SSkillDB.h" #include "SStringDB.h" #include "SWorldLocationDB.h" #include "SSoundResourceDB.h" #include "SGameOption.h" #include "SEnvPrimitive.h" #include "SGameSky.h" #include "SGameWater.h" #include "SGameLens.h" #include "SGameEnvironmentService.h" // [sonador][2007.05.15] #include "SGameWeatherService.h" // [sonador][2007.03.21] #include "SGameWeatherAttr.h" // [sonador][2007.04.02] #include "SGameScript.h" // [sonador][2007.04.02] #include "SGameCameraAnimator.h" // [sonador][COLLIDABLE_CAMERA] #include "SWayPoint.h" #include "SGameLowQualityWater.h" #include "SGameEnhanceFx.h" #include "SUITopConsoleWnd.h" #include "SUIMinimapWnd.h" #include "SBasicStat.h" #include "SCreatureDB.h" #include "SCreatureFarmDB.h" //2011.02.28 servantes #include "SJobDB.h" #include "SMonsterDB.h" #include "SQuestDB.h" #include "SSkillDB.h" #include "STenacityDB.h" #include "SExpDB.h" #include "SWorldLocationDB.h" #include "SLowQualityWaterDB.h" //#include "SEnhanceFXDB.h" #include "SNpcResourceDB.h" #include "SMotionDB.h" #include "SFieldPropResourceDB.h" #include "SModelEffectResourceDB.h" #include "SDungeonResourceDB.h" #include "SGroundMaterialResDB.h" #include "SQuestLinkDB.h" /// 2011.09.21 - prodongi #include "SMonsterCreatureDB.h" #include "SEnhanceEffectDB.h" #include #include #include #include "SGameAniType.h" #include "TerrainSeamlessWorldInfoForClient.h" #include "SRenderFlag.h" #include "KSeqPathEffect.h" #include "LuaVM.h" #include "KSeqSpeedTree.h" #include "SBotManager.h" #include "KSeqSpeedGrass.h" #include "SGameSelectTargetFx.h" #include "SChatType.h" #include "SGameLobbyDefine.h" #include "SGameEnvironmentMap.h" #include "SGameWeatherFx.h" #include "SDebug_Util.h" #include "SAvatarStateMachine.h" #include "SUIDisplayInfo.h" #include "KUIControlEdit.h" #include "KUIGenWnd.h" #include "PVSObject.h" #include #include "SGameMilesSoundMgr.h" #include "SGameCameraWork.h" #include "SSkillStageType.h" // sonador 1.8.9 은신 케릭터 자동 따라가기 버그 수정 #include "SGameWorldKeymapping.h" #include "SGameFieldQuestProp.h" /// 2011.01.21 - prodongi /// 2011.06.30 - prodongi #include #include #include "SUISysMsgDefine.h" #include #include "SGameInterface.h" ///2012. 2. 21 - marine #include "WorldLocation.h" #include "SMonsterDB.h" #include "SQuestMgr.h" #include "SGameAvatarEx.h" #ifdef _EDIT_ENVIRONMENT_ #include "EditParameterDialog.h" #endif #ifdef _USE_XTRAP_MODULE #include #endif using namespace SGAME_OPT_DATA; #ifndef WM_MOUSEWHEEL #define WM_MOUSEWHEEL 0x020A #define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam)) #define WM_LMOUSE_CLICK S_USER+100 #define WM_RMOUSE_CLICK S_USER+101 #endif const int EFFECT_LIGHT_LIVE_TIME = 500; const int MUSIC_CHECK_TIME = 10000; //10초 const DWORD SEND_DUMMY_MSG_TIME = 10000;//10초 static DWORD g_dwStartSendTime = 0; const K3DVector CAMERA_COLLISION_SPHERE_RADIUS = K3DVector( 1.5f, 1.5f, 1.58f ); #ifdef NDEBUG const int FADE_MAX_TIME = 1; #else const int FADE_MAX_TIME = 1; #endif extern bool g_bRenderUI; //2011.07.20 - servantes : ProcHotKeyEx 함수안에 있던것 밖으로 extern DWORD g_dwFPS; extern bool g_bUserCamMode; extern std::string g_strModulePath; extern SGameSystem* g_pCurrentGameSystem; extern bool ChangeDisplay(); extern bool RestoreDisplay(); extern void SetWindowStyle( bool bFullScreen ); extern void SetOtherNavigateClose( int nWinID ); extern int GetTerrainArrayCount( int nIndex ); extern struct USER_INFO g_UserInfo; #ifdef _DEV static bool g_bReverbEnable = false; static bool g_bLowPassFilterEnable = false; #endif K3DTexture* _getTexture(const char *texname, DWORD skin_color = 0) // load texture from manager { NX3LoadPack loadpack; loadpack.Init(); if( KTextureManager::GetManager()->IsExistTexture( texname, &loadpack ) ) { return KTextureManager::GetManager() ->GetTexture( texname, &loadpack, 0, skin_color, 0, 0, KTextureManager::GetManager()->GetMipMapBiasLevel(), 0 ); } return NULL; } //#define _WEB_DISP_MODE namespace { // const float c_TerrainVisibleDistOptions[] = { 5500.f, 4125.f, 2750.f, }; const float c_TerrainVisibleDistOptions[] = { 9000.f, 6000.f, 3000.f, 2500.f, 2000.f, 1000.f }; //MAX Nombre de segments visibles -0, -0, 125, 92, 65, -0 const int c_nVisibleDistOptionCount = _countof(c_TerrainVisibleDistOptions); //const int water_info[WATER_CNT][5] = //{ // { 3129, 33072, 46679, 63950, 20 }, // { 81017, 24613, 90767, 32019, 380 }, // { 99211, 100535, 108100, 107808, 1362 }, // { 116538, 45097, 124644, 47748, 985 }, // { 108654, 32511, 128329, 42102, 283 }, //}; //static int s_nSelectWater = 0; const int c_nTARGET_MAX_LEN = 360; //Tab Target Length //부가 힛트 연출 const int c_nLeftRightSmall = 1; //좌우진동 (약) 1 const int c_nBottomTopSmall = 2; //상하진동 (약) 2 const int c_nLeftRightMiddle = 3; //좌우진동 (중) 3 const int c_nBottomTopMiddle = 4; //상하진동 (중) 4 const int c_nLeftRightLarge = 5; //좌우진동 (강) 5 const int c_nBottomTopLarge = 6; //상하진동 (강) 6 }; SGameWorld::EnvironmentConfigArgument::EnvironmentConfigArgument() : mConfigMode( false ) , mFixEnvProperty( false ) , mCapacity( 1.0f ) { ::memset( &mConfigModeTime, 0, sizeof( mConfigModeTime ) ); } void SGameWorld::EnvironmentConfigArgument::ActivateConfigMode( bool activity ) { mConfigMode = activity; if( mConfigMode == false ) mFixEnvProperty = false; } void SGameWorld::EnvironmentConfigArgument::FixEnvProperty() { if( mConfigMode == true ) mFixEnvProperty = true; } struct SWeatherQualityConverter { float operator()( const int& quality ) const { float fCapacity; switch( quality ) { case 0: fCapacity = 0; break; case 1: fCapacity = 0.33f; break; case 2: fCapacity = 0.66f; break; case 3: fCapacity = 1.0f; break; default: fCapacity = 0; break; } return fCapacity; } }; SGameWorld::SGameWorld(SGameManager* pGameMng, int nGameType, K3DRenderDeviceDX *pRenderDevice, SSoundManager * pSoundMng, KTextureManager * pTextureMng, KNX3Manager * pNX3Mng, SGameMilesSoundMgr* pMSoundMgr ) : SGame( pGameMng, nGameType, pRenderDevice, pSoundMng, pTextureMng, pNX3Mng, pMSoundMgr ) , m_pWarpMsg( NULL ) , m_pCameraAnimator( 0 ) // [sonador][COLLIDABLE_CAMERA] , m_bVisualDropItem(true) { m_nGameType = GAME_TYPE_WORLD; //게임 타입 m_nNextGameType = GAME_TYPE_SELECT; //다음 예약 게임 타입 m_dwGameSystemTime = 0; // m_pLoaingTextOutWnd = NULL; Init(); Load(); m_nLoadFirst = 0; m_bSendDummyMsg = false; g_dwStartSendTime = 0; m_bIsAttackLocation = false; m_dwPrevProcessTime = 0; m_dwCameraVibrateVar = 0; m_dwCameraVibrateTimeDueTime = 0; m_pCamera->SetMinDistance( 10.f ); m_pGameCamera = new SGameCamera( m_pCamera, this ); // { [sonador][COLLIDABLE_CAMERA] m_pCameraAnimator = // 새로운 카메라 충돌(지형과 수면의 높이에 따른 충돌 반응과 프랍과의 충돌 반응 가능) new SGameCameraTerrainAndPropCollisionAnimator( *m_pTerrainMapEngine, *m_pLowQualityWater, CAMERA_COLLISION_SPHERE_RADIUS ); // { [sonador][7.1.7]충돌 처리 개선(Swept Shpere Collision Detection) //// 기존 카메라 충돌(지형과 수면의 높이에 따른 충돌 반응만 가능) //new SGameCameraTerrainHeightAnimator( *m_pTerrainMapEngine, *m_pLowQualityWater ); m_pGameCamera->AddAnimator( *m_pCameraAnimator ); // } m_nWarpX = 0; m_nWarpY = 0; //m_nDetourStep = 0; m_bCreatureMove = false; //m_bRefreshDetour = false; m_bCameraCollision = true; //m_bCameraCollision = false; //m_bIsChasing = false; //m_bHeightFog = false; m_dwFogMode = K3DRenderDevice::FOGM_LINEAR; m_bTargetModel = false; m_fCamMaxDistRatio = 1.8f; m_dwMusicCheckTime = 0; SetPlayerCurrentLocation( PLAYER_IN_WORLD ); m_Curlocation_type = -1; m_nZoomMapType = -1; m_bEnableLightmap = false; m_nLimitDisitance = 0; m_bIsResetTargetList = true; m_dwRenderCheckTime = 0; CTerrainProp::SetSkipVisibility( false ); SGameAvatarEx::BeginAvatarLoadingThread(); SUIMinimapWnd::BeginMinimapLoadingThread(); GetGameKeymapping(); // Aurora. m_AuroraIndex = 0; // 현재 지역에 설정된 Aurora Index. m_AuroraPrevIndex = 0; /// 2011.03.10 - prodongi m_isFixedTerrainDistance = false; m_fixedTerrainDistanceRatio = 1.0f; m_fixedTerrainDistance = 0; m_pickObject = 0; #ifdef _EDIT_ENVIRONMENT_ m_bApplyEnvironmentCost = false; m_bCopyEnvironmentParam = false; #endif #ifdef _FOG_RANGE_ CreateFogModel(); m_bShowFogRange = false; m_bShowEndFogModel = false; m_bShowStartFogModel = false; #endif m_dwFindTargetTime = 0; } SGameWorld::~SGameWorld(void) { SUIMinimapWnd::EndMinimapLoadingThread(); SGameAvatarEx::EndAvatarLoadingThread(); m_pickObject = 0; Destroy(); } const CTerrainSeamlessWorldInfo* SGameWorld::GetSeamlessWorldInfo() const { if( m_pTerrainMapEngine == NULL ) return NULL; return m_pTerrainMapEngine->GetSeamlessWorldInfo(); } void SGameWorld::LoadCharacter_Light() { } void SGameWorld::applyOptionEnviroment() { //해상도 { int nW = GetGameOption().GetResolution_Width(); int nH = GetGameOption().GetResolution_Height(); const KSize & size = KUIWndManager::GetResolution(); if( size.width != nW || size.height != nH ) { if( m_pGameMng ) { m_pGameMng->SetResolution( nW, nH ); } } { //_CID( SET_RENDER_SIZE ); //KMsgSET_RENDER_SIZE msg( KUIWndManager::GetResolution() ); //if( m_pModel_Load ) m_pModel_Load->Perform( id_SET_RENDER_SIZE, msg ); // int nHalfW = KUIWndManager::GetResolution().cx / 2; // int nHalfH = KUIWndManager::GetResolution().cy * 3/4; // if( m_pLoaingTextOutWnd ) m_pLoaingTextOutWnd->MovePos( nHalfW - m_pLoaingTextOutWnd->GetRect().GetWidth()/2, nHalfH ); } } if( !ENV().IsExist( "win" ) ) //강제 윈모드가 없을 때만, 옵션 적용. { //윈도우/전체 모드 if( GetGameOption().GetWinMode() == 0 || GetGameOption().GetWinMode() == 1 ) { #ifdef _WEB_DISP_MODE if( GetGameOption().GetWinMode() == 0 ) { if( ChangeDisplay() ) { SetWindowStyle( true ); if( m_pGameMng ) m_pGameMng->PostDeviceLost(); } } else if( GetGameOption().GetWinMode() == 1 ) { if( RestoreDisplay() ) { SetWindowStyle( false ); if( m_pGameMng ) m_pGameMng->PostDeviceLost(); } } #else if( ((K3DRenderDeviceDX*) KDeviceManagerDX::GetDeviceManager()->GetRenderDevice())->ToggleFullscreen( (bool) !GetGameOption().GetWinMode() ) ) { if( m_pGameMng ) m_pGameMng->PostDeviceLost(); } #endif } } GameGraphicOptionForEvScene( false, true ); _OPT_DATA opt_data = GetGameOption().GetOptData(); //프리셋 모드 if( opt_data.nPresetOption > 0 ) { GetGameOption().GetPresetOptData( opt_data.nPresetOption, opt_data ); } //그림자 표시 if( opt_data.nShadow == 0 ) { if( m_pCommandSystem ) m_pCommandSystem->SetCircleShadowEnable(false); SBotManager::m_pBotThis->SetShadowEnable(false); } //저사양 그림자 사용 { if( opt_data.nShadow == 1 && opt_data.nLowShadow >= 0 && opt_data.nLowShadow < 2 ) { bool bValue = (opt_data.nLowShadow == 0) ? false : true; if( m_pCommandSystem ) { if( bValue != m_pCommandSystem->GetCircleShadowEnable() ) { m_pCommandSystem->SetCircleShadowEnable(bValue); SBotManager::m_pBotThis->SetShadowEnable(!bValue); } else if( !bValue ) { m_pCommandSystem->SetCircleShadowEnable(bValue); SBotManager::m_pBotThis->SetShadowEnable(!bValue); } } } } // Lightmap On/Off { if( opt_data.nLightMap == 0 || opt_data.nLightMap == 1 ) { m_bEnableLightmap = (opt_data.nLightMap == 1) ? true : false; } //Texture 스테이지가 동시에 사용 할 수 있는 갯수는 5이상 이여야 한다. const D3DCAPS9 & rCaps = m_pRenderDevice->GetCaps(); if( rCaps.MaxSimultaneousTextures <= 4 ) { m_bEnableLightmap = false; } m_pTerrainMapEngine->RefreshLightMapEnable(m_bEnableLightmap); } { bool bResChange = false; bool bMipBiasChange = false; // 저사양 리소스 // 텍스쳐 품질 0 저품질, 1 기본 // 스피드 트리 저질 텍스쳐 문제로 수정 // 2009-12-23 : hunee if( opt_data.nResourceQual == 0 || opt_data.nResourceQual == 1 ) { // 저사양 리소스면 텍스쳐는 더이상 줄이지 않음 if (opt_data.nMipBias == 0) { if( NX3LoadPack::SetTextureLevel( 0 ) ) { //리소스 새로 로드 bResChange = true; } } else { if( NX3LoadPack::SetTextureLevel( !opt_data.nResourceQual ) ) { //리소스 새로 로드 bResChange = true; } } } // 저사양 리소스면 텍스쳐는 더이상 줄이지 않음 //if ( opt_data.nResourceQual == 0 ) // opt_data.nMipBias = 2; //가장 좋은 것임. int nMipBias = 0; //텍스쳐 품질 if( opt_data.nMipBias >= 0 && opt_data.nMipBias < 3 ) { switch( opt_data.nMipBias ) { case 0 : nMipBias = 2; break; case 1 : nMipBias = 1; break; case 2 : nMipBias = 0; break; } bMipBiasChange = KTextureManager::GetManager()->GetMipMapBiasLevel() != nMipBias; } if ( bResChange || bMipBiasChange ) { KTextureManager::GetManager()->SetMipMapBiasLevel( nMipBias-1 ); KTextureManager::GetManager()->ReloadRes( bResChange, TEXFLAG_SPEEDTREE, 0 ); KTextureManager::GetManager()->SetMipMapBiasLevel( nMipBias ); KTextureManager::GetManager()->ReloadRes( bResChange, 0, TEXFLAG_SPEEDTREE ); } } ////셀프 쉐도우 품질 : Bump 지원 안되는 관계로 지원 안됨. //{ // if( opt_data.nSelfShadowQual >= 0 && opt_data.nSelfShadowQual < 4 ) // { // int nQuality = 0; // switch( opt_data.nSelfShadowQual ) // { // case 0 : nQuality = 0; break; // case 1 : nQuality = 1; break; // case 2 : nQuality = 2; break; // case 3 : nQuality = 3; break; // } // if( m_pViewPort && m_pViewPort->GetShadowViewPort() ) // m_pViewPort->GetShadowViewPort()->SetShadowBufferQuality( nQuality ); // } //} { //글로우 이펙트 if( opt_data.nGlowQual >= 0 && opt_data.nGlowQual < 2 ) { // switch( opt_data.nGlowQual ) // { // case 0 : if( m_pViewPort ) m_pViewPort->SetHDRType( SGameViewPort::HDR_TYPE_NONE ); break; // case 1 : if( m_pViewPort ) m_pViewPort->SetHDRType( SGameViewPort::HDR_TYPE_NONE ); m_pViewPort->SetHDRType( SGameViewPort::HDR_TYPE_BLUR ); break; // case 2 : if( m_pViewPort ) m_pViewPort->SetHDRType( SGameViewPort::HDR_TYPE_NONE ); m_pViewPort->SetHDRType( SGameViewPort::HDR_TYPE_CROSS ); break; // case 3 : if( m_pViewPort ) m_pViewPort->SetHDRType( SGameViewPort::HDR_TYPE_BLUR ); m_pViewPort->SetHDRType( SGameViewPort::HDR_TYPE_CROSS ); break; // } m_pViewPort->SetHdrQuality( opt_data.nGlowQual > 0 ? 1 : 0 ); } } { if( opt_data.nWaterQual == 0 || opt_data.nWaterQual == 1 ) { //물 반사 효과 if( m_pViewPort ) { if( m_pViewPort->GetWaterViewPort() ) { m_pViewPort->SetUseWater( opt_data.nWaterQual == 1 ? true : false ); } else { //적용 안되는 것은 강제 false m_pViewPort->SetUseWater( false ); } applyOptionWater(); //물정보 재 생성 } } } { if( opt_data.nWinBright ) { KDeviceManager::GetDeviceManager()->GetRenderDevice()->SetDefaultGammaRange(); } else if( opt_data.nBright >= 0 && opt_data.nBright < 5 ) { //화면 밝기 float fValue = 0; switch( opt_data.nBright ) { case 0 : fValue = 0.6f; break; case 1 : fValue = 0.8f; break; case 2 : fValue = 1.0f; break; case 3 : fValue = 1.2f; break; case 4 : fValue = 1.4f; break; } KDeviceManagerDX::GetDeviceManager()->GetRenderDevice()->SetBright( fValue ); } } //지속효과 이펙트 관련 if( !opt_data.nStateEffect ) { DelStateEffect( SUIDisplayInfo::enemy | SUIDisplayInfo::LocalPlayer | SUIDisplayInfo::Party | SUIDisplayInfo::Guild | SUIDisplayInfo::NPC | SUIDisplayInfo::Creature | SUIDisplayInfo::PartyCreature | SUIDisplayInfo::GuildCreature ); } else { if( !opt_data.nStateEffectPlayer ) DelStateEffect( SUIDisplayInfo::LocalPlayer | SUIDisplayInfo::Creature ); if( !opt_data.nStateEffectParty ) DelStateEffect( SUIDisplayInfo::Party | SUIDisplayInfo::PartyCreature ); if( !opt_data.nStateEffectEnemy ) DelStateEffect( SUIDisplayInfo::enemy | SUIDisplayInfo::Guild | SUIDisplayInfo::NPC | SUIDisplayInfo::GuildCreature ); } //나무 투명화 관련 if( opt_data.nTreeAlpha != ( KSeqSpeedTree::IsTranparentMode() == true ? 1 : 0 ) ) { KSeqSpeedTree::SetTranparentMode( (opt_data.nTreeAlpha == 1 ? true : false) ); } if( opt_data.nTreeAlpha != ( m_pViewPort->IsSpeedTreeTransparent() == true ? 1 : 0 ) ) { m_pViewPort->SetSpeedTreeTransparent( (opt_data.nTreeAlpha == 1 ? true : false) ); } m_pMSoundMgr->SetSfxVolume( (GetGameOption().GetSFX_Volume()+1)*10 ); m_pMSoundMgr->SetBgmVolume( (GetGameOption().GetBGM_Volume()+1)*10 ); m_pMSoundMgr->SetEnvVolume( (GetGameOption().GetENVS_Volume()+1)*10 ); m_pMSoundMgr->SetMasterVolume( (GetGameOption().GetMASTER_Volume()+1)*10 ); if( GetGameOption().GetAll_Mute() == 0 || GetGameOption().GetAll_Mute() == 1 ) { m_pMSoundMgr->SetSoundMute( GetGameOption().GetAll_Mute() ); if( !GetGameOption().GetAll_Mute() ) { m_pMSoundMgr->SetSfxMute( GetGameOption().GetSFX_Mute() ); m_pMSoundMgr->SetBgmMute( GetGameOption().GetBGM_Mute() ); m_pMSoundMgr->SetEnvMute( GetGameOption().GetENVS_Mute() ); } } } //플레이 관련 옵션에 대한 변화내용들이 지금은 각각 처리하는 곳에 되어있다. //왠만하면 여기서 하는 방식으로 수정하자. void SGameWorld::applyOptionPlay() { const _OPT_DATA& opt_data = GetGameOption().GetOptData(); if( GetGameOption().NotifyTitle( opt_data.nTitleShow ) ) // 2012. 5. 29 - marine 호칭 옵션 변경알림 m_pGameMng->PostMsgAtDynamic( new SIMSG_UI_TITLE_OPTION_CHANGE() ); SPlayerStateMachine::SetAutoForceChipAttack(opt_data.nChipAttack); SGameAvatarEx* pTarget = m_pGameSystem->GetTarget(); if( pTarget ) { m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_TARGETPORTRAIT, opt_data.nMobFace ) ); } int nOldBoothType = SGameOtherPlayer::GetBoothRenderType(); int nBoothType = GetGameOption().GetBoothType(); if( nBoothType == BOOTH_TYPE::RENDER_NONE_BOOTH ) SGameOtherPlayer::SetRenderNoneBooth(); else if( nBoothType == BOOTH_TYPE::RENDER_SIMPLE_BOOTH ) SGameOtherPlayer::SetRenderSimpleBooth(); else if( nBoothType == BOOTH_TYPE::RENDER_DETAIL_BOOTH ) SGameOtherPlayer::SetRenderDetailBooth(); else if( nBoothType == BOOTH_TYPE::RENDER_AVATAR_BOOTH ) SGameOtherPlayer::SetRenderAvatarBooth(); else { nBoothType = BOOTH_TYPE::RENDER_NONE_BOOTH; GetGameOption().SetBoothRendType(nBoothType); SGameOtherPlayer::SetRenderNoneBooth(); } if( nBoothType != nOldBoothType ) { if( m_pCommandSystem ) m_pCommandSystem->DeleteRenderBooth(); } m_pGameMng->PostMsgAtDynamic( new SIMSG_UI_CHANGE_WIN_ALPHA( SGAME_OPT_DATA::AlphaLevel[ opt_data.nWinAlpha ] ) ); KUIGenWnd::AbleMoveWin( !opt_data.nWinLock ); //void* SGameInterface::Perform( KID id, KArg& msg ) //void SGameInterface::OnToggleUIWindow( int nWindowID ) //void SGameInterface::ProcMsgAtStatic( SGameMessage* pMsg ) --case IMSG_TOGGLE_UIWINDOW: KUIWnd::SetEnterChatMode( (opt_data.nEnterChat == 1) ? true : false ); KUIWndManager::SetEnterChatMode( (opt_data.nEnterChat == 1) ? true : false ); // { [sonador] 2007.05.30 환경옵션 if( opt_data.nWeatherQuality > 0 ) { m_pWeatherService->SetActivity( true ); float fWeatherQualityFactor = SWeatherQualityConverter()( opt_data.nWeatherQuality ); m_pWeatherService->ChangeQuality( fWeatherQualityFactor ); } else { m_pWeatherService->SetActivity( false ); } // } // 카메라 충돌 여부 if( opt_data.nCameraCollision ) { if( m_pCameraAnimator ) m_pGameCamera->RemoveAnimator( *m_pCameraAnimator ); SAFE_DELETE( m_pCameraAnimator ); m_pCameraAnimator = new SGameCameraTerrainAndPropCollisionAnimator( *m_pTerrainMapEngine, *m_pLowQualityWater, CAMERA_COLLISION_SPHERE_RADIUS ); m_pGameCamera->AddAnimator( *m_pCameraAnimator ); } else { if( m_pCameraAnimator ) m_pGameCamera->RemoveAnimator( *m_pCameraAnimator ); SAFE_DELETE( m_pCameraAnimator ); m_pCameraAnimator = new SGameCameraTerrainHeightAnimator( *m_pTerrainMapEngine, *m_pLowQualityWater ); m_pGameCamera->AddAnimator( *m_pCameraAnimator ); } m_pViewPort->createPostEffectData(opt_data.isShowSelectOutLine); } void SGameWorld::ApplyOption( int nOptionType ) { bool bIsMixedSystem = false; switch( KNX3Manager::GetManager()->GetSystemRequirements() ) { case KNX3Manager::MINIMUM_SYSTEM: { GetGameOption().SettingForMinimumSystem(); } break; case KNX3Manager::MAXIMUM_SYSTEM: { GetGameOption().SettingForMaximumSystem(); } break; case KNX3Manager::MIXED_SYSTEM: { } break; } if( nOptionType == MODE_ENVIRONMENT ) { applyOptionEnviroment(); } else if( nOptionType == MODE_PLAY ) { applyOptionPlay(); } const _OPT_DATA& opt_data = GetGameOption().GetOptData(); // 2010.05.20 - prodongi //static int s_nOldhelm = opt_data.nHelm; static int s_nOldmantle = opt_data.nMantle; //static int s_nOldavatardeco = opt_data.nAvatarDeco; // 2010.10.11. 게임플레이옵션에서 "꾸미기보이기" 제거. SGameAvatarEx* pLocalPlayer = m_pGameSystem->GetLocalPlayer(); if( pLocalPlayer ) { // 2010.05.20 - prodongi //if( s_nOldmantle != opt_data.nMantle || s_nOldavatardeco != opt_data.nAvatarDeco ) // 2010.10.11. 게임플레이옵션에서 "꾸미기보이기" 제거. if( s_nOldmantle != opt_data.nMantle ) // if( s_nOldhelm != opt_data.nHelm || s_nOldmantle != opt_data.nMantle || s_nOldavatardeco != opt_data.nAvatarDeco ) { pLocalPlayer->RefreshItemWear(); // 2010.05.20 - prodongi //s_nOldhelm = opt_data.nHelm; s_nOldmantle = opt_data.nMantle; //s_nOldavatardeco = opt_data.nAvatarDeco; // 2010.10.11. 게임플레이옵션에서 "꾸미기보이기" 제거. } } static int s_nResourceQual = opt_data.nResourceQual; if( s_nResourceQual != opt_data.nResourceQual ) { m_pCommandSystem->refreshWinkAllPlayerObj(); s_nResourceQual = opt_data.nResourceQual; } static int s_nPresetOption = opt_data.nPresetOption; if( s_nPresetOption != opt_data.nPresetOption ) { s_nPresetOption = opt_data.nPresetOption; if( KNX3Manager::GetManager()->GetSystemRequirements() == KNX3Manager::MIXED_SYSTEM ) { if( s_nPresetOption == 1 ) { m_pGameMng->PostMsgAtDynamic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_RESTART_GAME, 6528, true ) ); } } else if( KNX3Manager::GetManager()->GetSystemRequirements() == KNX3Manager::MINIMUM_SYSTEM_BY_USER_SELECT ) { if( s_nPresetOption != 1 ) { m_pGameMng->PostMsgAtDynamic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_RESTART_GAME, 6528, true ) ); } } } if( GetPlayerCurrentLocation() == PLAYER_IN_TOWN ) m_pCommandSystem->ActivatePendLoadingList( opt_data.nRenderOtherPlayer ); else m_pCommandSystem->ActivatePendLoadingList( 1 ); } void SGameWorld::ToggleHelpWindow() { if( !m_pGameMng->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_TITLE ) ) { m_pGameMng->PostMsgAtDynamic( new SMSG_SEND_DATA( "open_help_web" ) ); } else { m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_TITLE, false) ); m_pGameMng->PostMsgAtDynamic( new SMSG_SEND_DATA( "close_help_web" ) ); } } void SGameWorld::Init() { //게임 컨텐츠 로드 GetNpcResourceDB(); GetTenacityDB(); GetSkillDB(); GetMonsterDB(); GetJobDB(); GetQuestDB(); GetQuestLinkDB(); /// 2011.09.21 - prodongi GetCreatureDB(); GetCreatureFarmDB(); //2011.02.28 servantes GetBasicStatDB(); GetExpDB(); GetSummonExpDB(); GetSkillTreeDB(); GetSkillStageDB(); GetMotionSetDB(); GetMonsterMotionSetDB(); GetCharacterMotionEventDB(); GetMotionEventHanderDB(); GetMotionFxSetDB(); GetWorldLocationDB(); GetLowQualityWaterDB(); GetFieldPropResourceDB(); GetModelEffectResourceDB(); GetDungeonResDB(); GetGroundMaterialResDB(); GetResourceDB(); GetFaceWinkDB(); GetMonsterCreatureDB(); //GetEnhanceEffectDB(); m_bIsLogined = false; //시스템 m_pGameCamera = NULL; m_pGameSystem = new SGameSystem( this ); m_pCommandSystem = new SCommandSystem( m_pRenderDevice, this ) ; m_pEffectLight = new K3DLight( K3DColor(345/255.f,335/255.f,265/255.f), K3DColor(500/255.f,500/255.f,500/255.f), K3DColor(345/255.f,335/255.f,265/255.f), K3DVertex(0.f,0.f,0.f), 200, 500.f, 500.f, 500.f ); m_pEffectLight->direction = K3DVector(0.33f,0.66f,-0.66f); m_dwEEffectLight_Live = 0; m_nEffectLight_MaxLive = EFFECT_LIGHT_LIVE_TIME; m_pTerrainLight = new K3DLight( K3DColor(0.8f,0.8f,0.8f), K3DColor(1.f,1.f,1.f), K3DColor(0.4f,0.4f,0.4f), K3DVector(-0.33f,-0.66f,-0.66f) ); m_pTerrainLight->position.x = 500000000*0.33f; m_pTerrainLight->position.y = 500000000*0.66f; m_pTerrainLight->position.z = 500000000*0.66f; m_pTerrainLight->attenuation1 = 0; m_pTerrainLight->range = 500000001.F; //Warp 시 Loading 표시 // m_pModel_Load = NULL; initLoadModel(); const KPoint c_ptInfoWnd = KPoint( 0, 512 ); //위치 const KSize c_sizInfoWnd = KSize ( 1024, 100 ); //크기 int nHalfW = KUIWndManager::GetResolution().cx / 2; int nHalfH = KUIWndManager::GetResolution().cy * 3/4; //m_pLoaingTextOutWnd = new SUILoaingTextOutWnd(); //m_pLoaingTextOutWnd->Create( KUIWND_CREATE_ARG( "genwnd", "loaing_info", "loaing....", KRect( c_ptInfoWnd, c_sizInfoWnd ), KSTYLE_NOSTATUSBAR | KSTYLE_NOMINIMIZE | KSTYLE_NOCLOSE, KFLAG_GET_PASS_MESSAGE, m_pLoaingTextOutWnd, "frame", c_szDEF_SPR_NAME, m_pGameMng->GetWndManager() ) ); //m_pLoaingTextOutWnd->CreateControls( m_pGameMng->GetWndManager() ); //m_pLoaingTextOutWnd->MovePos( nHalfW - m_pLoaingTextOutWnd->GetRect().GetWidth()/2, nHalfH ); //m_pLoaingTextOutWnd->SetShow( true ); m_pTerrainMapEngine = NULL; m_nTerrainVisibleDistOption = 1; m_pTargetModel = NULL; //for( int i(0); TEST_WATER>i; i++ ) // m_pWater[i] = NULL; //m_pWaterBumpTex = NULL; //m_pWaterIB = NULL; m_pLensFlare = NULL; // { [sonador][2007.03.21] // sonador 1.1.18 환경 효과 오류 수정 m_fGameLightAmbientFactor = 1.0f; m_fGameLightDiffuseFactor = 1.0f; m_fGameLightSpecularFactor = 1.0f; m_fGameFogDistanceFactor = 1.6f; m_pWeatherService = NULL; m_pEnvironmentService = NULL; // } m_pWayPoint = NULL; m_ptOldPoint.x = -1; m_ptOldPoint.y = -1; m_bTerrainProc = false; m_bTerrainRender = false; m_bSpecular = true; m_bHDR = true; // m_pCharacterLight = NULL; m_nDeltaX = 512; m_nDeltaY = 512; m_fDeltaX = 1.f; m_fDeltaY = 1.f; m_bLocalRender = TRUE; m_FillColor = KColor(204, 222, 248, 255); m_FogColor = KColor(204, 222, 248, 255); LoadCharacter_Light(); m_bIsRender = FALSE; m_dwFadeTime = 0; m_fFade_Visibility = 1.f; m_dwFPSTime = 0; m_dwLoadDelay = 0; //몹만 가능. m_nAttackLimit = LIMIT_MOB;//|LIMIT_PLAYER|LIMIT_SUMMON; m_nCell_Size = 6; m_dwSkyPosSetTime = 0; m_dwLensFlareTime = 0; m_fHeightFog_Start = 5000; m_fHeightFog_End = -1000; m_fLinearFog_Start = 0; m_fLinearFog_End = 6000; m_bIsCustomFog = false; //Sky Color m_Sky_Color_Start = K3DColor( .3f, .5f, 1.0f, 1.0f ); m_Sky_Color_Mid = K3DColor( .4f, .6f, .8f, 1.0f ); m_Sky_Color_End = K3DColor( .7f, .7f, .7f, 1.0f ); m_fSkyColorMinHeight = 300; m_fSkyColorMaxHeight = 2000; m_fSkyMidHeightPercent = 0.5f; //water01=1000,1000,2000,2000,100 // ; 1000,1000 ~ 2000,2000의 심리스 좌표에 100의 높이로 물을 뿌려줌. // ; 좌표에는 -가 들어갈 수도 있다. // water02=10000,12000,20000,40000,150 // water03=12500,14000,30000,32000,1000 //for( int i(0); WATER_CNT>i; i++ ) //{ // m_bCube[i] = new K3DBoundRotCube; // K3DVertex rotc[8]; // K3DVector cube_min = K3DVector( water_info[i][0], water_info[i][1], water_info[i][4]-1000 ); // K3DVector cube_max = K3DVector( water_info[i][2], water_info[i][3], water_info[i][4]+1000 ); // cube_min += K3DVector(-1, -1, -1); // cube_max += K3DVector( 1, 1, 1); // rotc[0] = KPCCP::get_cube_vertex(0, cube_min.x, cube_max.x, cube_min.y, cube_max.y, cube_min.z, cube_max.z); // rotc[1] = KPCCP::get_cube_vertex(1, cube_min.x, cube_max.x, cube_min.y, cube_max.y, cube_min.z, cube_max.z); // rotc[2] = KPCCP::get_cube_vertex(2, cube_min.x, cube_max.x, cube_min.y, cube_max.y, cube_min.z, cube_max.z); // rotc[3] = KPCCP::get_cube_vertex(3, cube_min.x, cube_max.x, cube_min.y, cube_max.y, cube_min.z, cube_max.z); // rotc[4] = KPCCP::get_cube_vertex(4, cube_min.x, cube_max.x, cube_min.y, cube_max.y, cube_min.z, cube_max.z); // rotc[5] = KPCCP::get_cube_vertex(5, cube_min.x, cube_max.x, cube_min.y, cube_max.y, cube_min.z, cube_max.z); // rotc[6] = KPCCP::get_cube_vertex(6, cube_min.x, cube_max.x, cube_min.y, cube_max.y, cube_min.z, cube_max.z); // rotc[7] = KPCCP::get_cube_vertex(7, cube_min.x, cube_max.x, cube_min.y, cube_max.y, cube_min.z, cube_max.z); // m_bCube[i]->SetCube( rotc ); //} m_pWireLen = new KWireUtilPrimitive; // SGameAvatarEx::BindProperty(); m_bTimeProcess = false; m_dwStartEnvLerpTime = 0; m_nSLocationID = 0; m_nPrevSLocationID = 0; m_nCLocationID = 0; m_dwRequestTimeLc = 0; m_bAutoMove = false; m_vAutoMoveDir = K3DVector( 0.f, 0.f, 0.f ); m_bAutoFollowMode = false; m_hFollowTarget = 0; m_nGameTime = 0; m_nArGameTime = 0; m_nCurrTime = -1; m_nWeatherID = 0; //날씨 디폴트 맑음 m_bChangeLocation = false; m_nRefGameTime = 1; //치트용 m_nIncGameTime = 1; //치트용 m_fTerrainSpecular = 1.f; m_fCharSkinAmbiantFactor = 1.f; m_fCharSkinDiffuseFactor = 1.f; m_fDryVolume = 0.0f; m_fWetVolume = 0.0f; m_bMoveTargetPos = false; //TODO : 테스트 코드 /* m_pGameEnvMap = NULL;*/ // m_pGameWeatherFx = NULL; m_dwEnvFxSoundTime = 0; m_dwEnvFxSoundDelayTime = 20000; //20초 m_nPrevEnvFxSoundIndex = -1; m_nCurEnvFxSoundID = 0; m_nMusicFadeInTime = 10000; m_nMusicFadeOutTime = 10000; m_nBgmFadeInTime = 2000; m_nBgmFadeOutTime = 2000; m_nBmgVolume = 70; m_pMSoundMgr->SetGameWorld( this ); m_pMSoundMgr->SetRoomType( ENVIRONMENT_GENERIC ); m_fCamera_Z_Offset = CAMERA_Z_OFFSET; m_fCameraDisRate = 18.0f; m_bCameraAutoRot = false; m_nCameraAutoRotValue = 0; m_bEnableGCOpForEvScene = false; loadCustomCameraValue(); /// 2011.06.30 - prodongi } void SGameWorld::initCamera( const char * pFileName ) { KStream * pRes = KFileManager::Instance().CreateStreamFromResource( pFileName ); if( !pRes ) return; size_t nLen = pRes->GetLength(); char * pstrTemp = new char[nLen+1]; pstrTemp[nLen] = '\0'; for( size_t i(0); nLen>i; i++ ) { pRes->Read( &pstrTemp[i], 1 ); } m_pGameCamera->FileTextIn(pstrTemp, g_bUserCamMode); delete [] pstrTemp; KFileManager::Instance().DeleteStream( pRes ); } void SGameWorld::initLoadModel() { // SAFE_DELETE( m_pModel_Load ); //m_pModel_Load = new KSeqModel; //std::string strTmp; //int nRand = rand()%3; //XStringUtil::Format( strTmp, "loading0%d", nRand+1 ); //if( nRand == 2 ) //{ // m_pModel_Load->AddSpriteAnimation( "loading3.spr" ); //} //else if( nRand == 1 ) //{ // m_pModel_Load->AddSpriteAnimation( "loading2.spr" ); //} //else if( nRand == 0 ) //{ // m_pModel_Load->AddSpriteAnimation( "loading1.spr" ); //} // //m_pModel_Load->PlayAnimation( GetSafeTickCount(), strTmp.c_str(), KSeqForm::SEQTYPE_LOOP ); //KSeqObject *pSeq = m_pModel_Load->GetCurrentAnimation(); //if( pSeq ) //{ // _CID( SET_RENDER_SIZE ); // KMsgSET_RENDER_SIZE msg( KUIWndManager::GetResolution() ); // pSeq->Perform( id_SET_RENDER_SIZE, msg ); //} } void SGameWorld::Destroy() { GameUIMgrInstance.SetGame( NULL ); GameUIMgrInstance.ResetInfoMgr(); if( !m_strCurEnvFxSoundName.empty() ) m_pMSoundMgr->SwapPlayMusic( "", m_nMusicFadeInTime, m_nMusicFadeOutTime ); if( !m_strCurrentMusic.empty() ) m_pMSoundMgr->SwapPlayBGM( "", m_nBgmFadeInTime, m_nBgmFadeOutTime ); //꼭 해줘야함 m_pMSoundMgr->SetGameWorld( NULL ); if( m_pGameSystem && m_pGameSystem->GetLocalPlayer() ) { const char * pName = m_pGameSystem->GetLocalPlayer()->GetName(); SetFileAttributes( CStringUtil::StringFormat( "%s\\%s_cam.txt", g_strModulePath.c_str(), pName ).c_str(), FILE_ATTRIBUTE_NORMAL ); FILE* pF = fopen( CStringUtil::StringFormat( "%s\\%s_cam.txt", g_strModulePath.c_str(), pName ).c_str(), "wt" ); if( pF ) { m_pGameCamera->FileTextOut(pF, g_bUserCamMode); fclose( pF ); SetFileAttributes( CStringUtil::StringFormat( "%s\\%s_cam.txt", g_strModulePath.c_str(), pName ).c_str(), FILE_ATTRIBUTE_HIDDEN ); } } // SAFE_DELETE( m_pLoaingTextOutWnd ); //커서 디폴트로 변경 SGameCursorMng::SetCursor( SGameCursorMng::CURSOR_DEFAULT ); //TODO : Thread Safe 하지 않는 듯. // KNX3Manager::GetManager()->ClearUnreferencedResource(); SAFE_DELETE( m_pWireLen ); // { [sonador][2007.03.21] SAFE_DELETE( m_pWeatherService ); SAFE_DELETE( m_pEnvironmentService ); // [2007.05.15] // } //for( int i(0); WATER_CNT>i; i++ ) //{ // SAFE_DELETE( m_bCube[i] ); //} SAFE_DELETE( m_pTerrainMapEngine ); // SAFE_DELETE( m_pModel_Load ); SAFE_DELETE( m_pTargetModel ); SAFE_DELETE( m_pSelectTargetFx ); SAFE_DELETE( m_pSelectTargetOnFx ); SAFE_DELETE( m_regionSkillTargetFx); /// 2010.10.12 - prodongi SAFE_DELETE( m_pRegionSkillScaleFx ); //for( int i(0); TEST_WATER>i; i++ ) // SAFE_DELETE( m_pWater[i] ); //SAFE_DELETE( m_pWrap ); SAFE_DELETE( m_pSky ); SAFE_DELETE( m_pLensFlare ); SAFE_DELETE( m_pWayPoint ); SAFE_DELETE( m_pLowQualityWater ); SAFE_DELETE( m_pCommandSystem ); SAFE_DELETE( m_pGameSystem ); SAFE_DELETE( m_pEffectLight ); SAFE_DELETE( m_pTerrainLight ); // SAFE_DELETE( m_pCharacterLight ); SAFE_DELETE( m_pGameCamera ); SAFE_DELETE( m_pCameraAnimator ); // [soandor][COLLIDABLE_CAMERA] SAFE_DELETE( m_pWarpMsg ); m_pArObject->ClerAll(); //TODO : 테스트 코드 /* SAFE_DELETE( m_pGameEnvMap );*/ // SAFE_DELETE( m_pGameWeatherFx ); #ifdef _FOG_RANGE_ DestroyFogModel(); #endif if( !m_vKeepingList.empty() ) { _oprint( "Unprocessed message: %d\n", (int)m_vKeepingList.size() ); assert( false && "m_vKeepingList" ); while( !m_vKeepingList.empty() ) { m_vKeepingList.pop(); } } saveCustomCameraValue(); /// 2011.06.30 - prodongi } //기본 Load void SGameWorld::Load() { // 맵 파일 { m_pTerrainMapEngine = new CTerrainMapEngine(); if( !m_pTerrainMapEngine->Initialize ( m_pRenderDevice , m_pCamera //, FILTERING_NONE //, FILTERING_3TEXTURE //, FILTERING_3TEXSHADOW , TERRAIN_RENDERMODE_DEFAULT , 500 //지우기 검사 주기 0.5초 , 15000 //세그먼트 유효 기간 30초 , 1 ) ) //Thread Count { assert( false && "Terrain initialize failed." ); } // Picking 가능한 최대 거리 (0은 보이는 지형 끝까지 picking 가능) m_pTerrainMapEngine->SetPickingDistance( 0 ); m_pTerrainMapEngine->SetTerrainVisibleDistance( c_TerrainVisibleDistOptions[m_nTerrainVisibleDistOption] ); //m_pTerrainMapEngine->SetPropLodDistance( 1024.f ); //텍스쳐 스테이지 4개보다 작으면, 필터링 안함. const D3DCAPS9 & rCaps = m_pRenderDevice->GetCaps(); if( rCaps.MaxSimultaneousTextures < 4 ) { //m_pTerrainMapEngine->SetFilteringType( FILTERING_NONE ); m_pTerrainMapEngine->SetRenderMode(TERRAIN_RENDERMODE_MULTIPASS); } KSeqPathEffectChain::SetTerrainEngine(m_pTerrainMapEngine); } NX3LoadPack loadpack; loadpack.Init(); m_pTargetModel = new KSeqModel; m_pTargetModel->Initialize(); m_pTargetModel->AddAnimation( "default", "cursor_target.nx3", KNX3Manager::SEQTYPE_ALL, &loadpack ); m_pTargetModel->PlayAnimation( GetSafeTickCount(), "default", KSeqModel::SEQTYPE_LOOP ); m_pTargetModel->SetPosition( -1.0f, -1.0f, -1.0f ); m_pSelectTargetFx = new SGameSelectTargetFx; m_pSelectTargetFx->Initialize( this, "rcfx_select_on02.dds" ); m_pSelectTargetFx->SetHeight( 0.3f ); m_pSelectTargetOnFx = new SGameSelectTargetFx; m_pSelectTargetOnFx->Initialize( this, "rcfx_select_on01.dds" ); m_pSelectTargetOnFx->SetHeight( 0.5f ); m_bSelectTarget = false; /// 2010.10.12 - prodongi m_regionSkillTargetFx = new cGameRegionSelectTargetFx; m_regionSkillTargetFx->Initialize(this, "rcfx_select_on01.dds"); m_regionSkillTargetFx->SetHeight(5.0f); m_regionSkillTargetFx->SetRadius(100.0f); m_renderRegionSkillTargetFx = false; m_pRegionSkillScaleFx = new SGameSelectTargetFx; m_pRegionSkillScaleFx->Initialize( this, "rcfx_skillregion_on.dds" ); m_pRegionSkillScaleFx->SetHeight( 3.5f ); m_bRenderUseRegionSkill = false; m_pSky = new SGameSky; m_pSky->Init( m_pRenderDevice ); m_pSky->SetCamera( m_pCamera ); m_pLensFlare = new SGameLensFlare; m_pLensFlare->Init( m_pRenderDevice ); m_pLensFlare->SetCamera( m_pCamera ); m_pLensFlare->SetLight( m_pTerrainLight ); m_pLowQualityWater = new SGameLowQualityWater; m_pLowQualityWater->Init(); m_pLowQualityWater->SetGame( this ); m_pLowQualityWater->SetCamera( m_pCamera ); m_vPositionForWater = K3DVector( 0.0f, 0.0f, 0.0f ); // { [sonador][2007.03.21] m_pWeatherService = new SGameWeatherService( this, m_pCommandSystem, m_pSky, m_pMSoundMgr, 1.0f/*ENV().GetFloat( "weather_factor" )*/ ); m_pWeatherService->Init( m_pRenderDevice ); m_pEnvironmentService = new env_fx::SEnvironmentService( m_pSky, m_pLensFlare, m_pWeatherService, m_pMSoundMgr ); // } m_pWayPoint = new SWayPoint; m_pWayPoint->Init(m_pTerrainMapEngine->GetSeamlessWorldInfo()); // m_pGameWeatherFx = new SGameSnowFx; // m_pGameWeatherFx->Initialize( this ); } void SGameWorld::SetViewPort( SGameViewPort* pViewPort ) { m_pViewPort = pViewPort; m_pViewPort->SetClipRange(10, 6000.f); // AziaMafia LoadMap SetClipRange(10, 6000.f); if( m_pTerrainMapEngine ) { //지형 그림자 드리워질 거리 m_pTerrainMapEngine->SetCustomTextureDistance( 256.f ); } if( m_pLensFlare ) { m_pLensFlare->SetExtent( m_pViewPort->GetViewportWidth(), m_pViewPort->GetViewportHeight() ); m_pLensFlare->SetProjMatrix( m_pViewPort->GetProjMatrix() ); } } void SGameWorld::SetNet( ArcadiaClient * pObject ) { m_pArObject = pObject; m_pArObject->setTerrainMapEngine(m_pTerrainMapEngine); //m_kmoveControler.setArObject(pObject); m_kmoveControler.initialize(m_pCommandSystem,m_pGameSystem,m_pGameCamera,this,pObject); if( m_pCommandSystem ) m_pCommandSystem->SetArObject( m_pArObject ); m_dwResEventTime = GetSafeTickCount(); } void SGameWorld::CorrectivePosition( K3DVector & pos, K3DVector & newpos ) { int nAttrCellLen = GetAttrCellLength(); newpos = pos; // 임시 by Testors return; //셀 보정~ newpos.x += nAttrCellLen/2; newpos.y += nAttrCellLen/2; newpos.x = (int)newpos.x/nAttrCellLen; newpos.y = (int)newpos.y/nAttrCellLen; newpos.x *= nAttrCellLen; newpos.y *= nAttrCellLen; // _oprint( "셀좌표 : %f, %f\n", newpos.x, newpos.y ); } int SGameWorld::GetAttrCellLength() { //서버와 같은 값을 사용 해야 한다. - return m_nCell_Size; } void SGameWorld::SetRenderFlag( int nFlag ) { //Render Flag Set } void SGameWorld::CheckEffect() { std::vector< SGameEffectEx* >::iterator itNewFx = m_vNewEffectList.begin(); while( itNewFx != m_vNewEffectList.end() ) { if( (*itNewFx)->IsEnd() ) { delete (*itNewFx); itNewFx = m_vNewEffectList.erase( itNewFx ); } else itNewFx++; } //Effect 끝난것 삭제~ std::vector< SGameEffect* >::iterator itFx = m_vEffectList.begin(); while( itFx != m_vEffectList.end() ) { (*itFx)->IsPlaying(); //호출 한번 해줌. if( (*itFx)->IsEnd() ) { delete (*itFx); itFx = m_vEffectList.erase( itFx ); } else itFx++; } } void SGameWorld::AfterRender( unsigned long uRenderBitVector ) { if( m_pTerrainMapEngine ) m_pTerrainMapEngine->AfterRender( uRenderBitVector ); } //============================================================================================================ bool SGameWorld::Render( unsigned long uRenderBitVector, KViewportObject** ppViewportList, int nViewportCount ) { int nGameRef = GetGameRef(); if( nGameRef == STAGE_END ) return false; if( m_bIsLogined == false || !m_bIsRender ) { return true; } if( nGameRef == STAGE_LOADING || nGameRef == STAGE_FADE_IN || nGameRef == STAGE_FADE_OUT ) { return true; } if( nGameRef == SGame::STAGE_MAP_LOAD_BUFFER ) { return true; } if( nGameRef == STAGE_MAP_PRELOAD ) { return true; } //Warp Loading if( nGameRef == STAGE_MAP_LOADING || nGameRef == STAGE_MAP_LOADING_AFTER ) { return true; } if( nGameRef == STAGE_WARP_COMPLETE ) { AfterWarpComplete(); return true; } { m_pGameCamera->Render(uRenderBitVector, ppViewportList, nViewportCount); } const TERRAINMAP_PROPERTIES::COLORING& rMapColoring = m_pTerrainMapEngine->GetMapColoring(); float fRatio = m_pTerrainMapEngine->GetTerrainVisibleDistanceRatio(); int vit; for(vit = 0; vit < nViewportCount; ++vit) { ppViewportList[vit]->SetSkyColorHeight( m_fSkyColorMinHeight * fRatio, m_fSkyColorMaxHeight * fRatio, m_fSkyMidHeightPercent ); ppViewportList[vit]->SetSkyColor( m_Sky_Color_Start, m_Sky_Color_Mid, m_Sky_Color_End ); // TODO : DB에서 가져온 데이터로 테스트중 임시 주석처리.... /* m_FogColor = rMapColoring.colorFog; if( m_bIsCustomFog == false ) { m_fLinearFog_Start = rMapColoring.fFogNear; m_fLinearFog_End = rMapColoring.fFogFar; m_fHeightFog_Start; //TODO:추가 해야 함 m_fHeightFog_End; }*/ float fog1 = 1000000.0f; float fog2 = 1000000.0f; float fog3 = 1000000.0f; float fog4 = 1000000.0f; if(m_dwFogMode & K3DRenderDevice::FOGM_LINEAR) { fog1 = m_fLinearFog_Start * fRatio; fog2 = m_fLinearFog_End * max( fRatio, 0.8f ); // minfogdist - by Tyburn } if(m_dwFogMode & K3DRenderDevice::FOGM_HEIGHT) { float fStart = m_fHeightFog_Start; float fend = m_fHeightFog_End; SGameAvatarEx* pLocalPlayer = m_pGameSystem->GetLocalPlayer(); if( pLocalPlayer ) { K3DVector vPos = *pLocalPlayer->GetPosition(); WORD dwTile = 0; K3DVector lpos; m_pCamera->GetTargetPos( lpos.x, lpos.y, lpos.z ); GetHeight( lpos.x, lpos.y, lpos.z, dwTile ); fStart = lpos.z + m_fHeightFog_Start; fend = lpos.z + m_fHeightFog_End; } //높이는 거리에 따른 비율이 적용 되지 않는다. fog3 = fStart; fog4 = fend; } ppViewportList[vit]->SetFogMode( m_dwFogMode, m_FogColor, fog1, fog2, fog3, fog4 ); ppViewportList[vit]->AddLight( m_pTerrainLight ); //기본 Light 지형 m_pTerrainLight if( m_dwEEffectLight_Live ) //타격 이펙트 발생시에만 켜짐 ppViewportList[vit]->AddLight( m_pEffectLight ); //캐릭터 Effect Light //시연 용 물 /* if( vit == 0 && nViewportCount == 3 ) { bool bIsNotWater = true; for( int i(0); WATER_CNT>i; i++ ) { bIsNotWater = !KPCCP::nonuniformcube_collide_nonuniformcube(ppViewportList[vit]->GetFrustum(), m_bCube[i]->GetVertices()); if( !bIsNotWater ) { s_nSelectWater = i; ((SWaterViewPort*)ppViewportList[2])->SetWaterHeight( water_info[i][4] ); ppViewportList[0]->SetUseWater( true ); ppViewportList[2]->SetUseViewPort( true ); break; } } if( bIsNotWater ) { ppViewportList[0]->SetUseWater( false ); ppViewportList[2]->SetUseViewPort( false ); } }*/ } // //Speed Tree 파라미터 설정 // /* static float afDirection[3], campos[3]; afDirection[0] = ppViewportList[0]->GetBlendMatrix()->m[0][2]; // get camera direction from modelview matrix afDirection[1] = ppViewportList[0]->GetBlendMatrix()->m[1][2]; afDirection[2] = ppViewportList[0]->GetBlendMatrix()->m[2][2]; campos[0] = m_pCamera->GetCamPos().x; campos[1] = m_pCamera->GetCamPos().y; campos[2] = m_pCamera->GetCamPos().z; CSpeedTreeRT::SetCamera(campos, afDirection); */ K3DVector vt(ppViewportList[0]->GetBlendMatrix()->m[0][2] // ModelView매트릭스에서 카메라 방향 가져옴 , ppViewportList[0]->GetBlendMatrix()->m[1][2] , ppViewportList[0]->GetBlendMatrix()->m[2][2]); KSeqSpeedTree::SetCamera(m_pCamera->GetCamPos(), vt); // SpeedTree용 카메라 위치/방향 세팅 KSeqSpeedTree::SetCameraTargetPosition(m_pCamera->GetTargetPos()); // SpeedTree용 카메라 target 위치 세팅 (카메라 가리는 나무 반투명 처리용) // // 하늘/땅 // if( uRenderBitVector & Game_RenderSky ) { m_pSky->Render( ppViewportList[0] ); if(ppViewportList[2]) m_pSky->Render( ppViewportList[2] ); } //캐릭터 if( uRenderBitVector & Game_RenderCommandSys ) { SetNamePanelViewMatrix(); m_pCommandSystem->Render( uRenderBitVector, ppViewportList, nViewportCount ); //Local Player, Other Player, NPC, Item } if (m_pickObject) { SGameAvatarEx* pickObject = dynamicCast(m_pCommandSystem->GetObject(m_pickObject)); if (pickObject) { SGameViewPort* gameViewPort = dynamicCast(ppViewportList[0]); if (gameViewPort) gameViewPort->setSelectColor(m_pickColor); pickObject->renderSelect(uRenderBitVector, ppViewportList, nViewportCount); } } if( uRenderBitVector & Game_RenderTarget ) { if( m_bLocalRender && m_bTargetModel ) { m_pTargetModel->Render(ppViewportList[0]); } } //지형 if( uRenderBitVector & Game_RenderTerrain ) { m_pTerrainMapEngine->Render( uRenderBitVector, m_pCamera, ppViewportList, nViewportCount, m_nLimitDisitance ); } if( uRenderBitVector & Game_RenderTarget ) { if( m_bSelectTarget ) { if( m_pSelectTargetOnFx ) { if( m_pSelectTargetOnFx->GetArHandle() != m_pSelectTargetFx->GetArHandle() ) m_pSelectTargetFx->Render( ppViewportList[0] ); } } SGameAvatarEx* pTarget = m_pGameSystem->GetTarget(); if( pTarget ) m_pSelectTargetOnFx->Render( ppViewportList[0] ); else m_pSelectTargetOnFx->SetArHandle( NULL ); } /// 2010.10.12 - prodongi renderRegionSkillTargetFx(ppViewportList[0]); if ( m_renderRegionSkillTargetFx ) { m_pRegionSkillScaleFx->Render( ppViewportList[0] ); } //Effect if( uRenderBitVector & Game_RenderEffect ) { CheckEffect(); size_t nEffectSize = m_vNewEffectList.size(); for( size_t i(0); nEffectSize>i; i++ ) { m_vNewEffectList[i]->Render( uRenderBitVector, ppViewportList, nViewportCount); } nEffectSize = m_vEffectList.size(); for( size_t i(0); nEffectSize>i; i++ ) { m_vEffectList[i]->Render( uRenderBitVector, ppViewportList, nViewportCount); } } if( uRenderBitVector & Game_RenderEffect ) { //파티클 std::vector< SGameEnhanceFx* >::iterator iterEnhance = m_vEnhanceFxList.begin(); for( ; iterEnhance != m_vEnhanceFxList.end(); ) { if( (*iterEnhance)->IsEnd() ) { SAFE_DELETE( (*iterEnhance) ); iterEnhance = m_vEnhanceFxList.erase(iterEnhance); } else { (*iterEnhance)->Render( uRenderBitVector, ppViewportList, nViewportCount ); ++iterEnhance; } } } //for( int i(0); TEST_WATER>i; i++ ) // m_pWater[i]->Render( viewport ); //m_pWrap->Render( viewport ); if( uRenderBitVector & Game_RenderLensFlare ) { m_pLensFlare->Render( ppViewportList[0] ); } // { [sonador] render weather if( uRenderBitVector & Game_RenderWeather ) { m_pWeatherService->Render( ppViewportList[ 0 ] ); } // } if( uRenderBitVector & Game_Water ) { m_pLowQualityWater->Render(ppViewportList[0]); } if( uRenderBitVector & Game_RenderWire ) { /* m_pWireLen->Clear(); K3DVector vPos = K3DVector(m_pArObject->GetMyPos().GetX(), m_pArObject->GetMyPos().GetY(), m_pArObject->GetMyPos().GetZ()); K3DVector v1, v2, v3; GetTerrainTriangle( vPos.x, vPos.y, v1, v2, v3 ); v1.z += 0.5f; v2.z += 0.5f; v3.z += 0.5f; m_pWireLen->AddLine( v1, v2, KColor( 255, 0, 0, 255 ) ); m_pWireLen->AddLine( v2, v3, KColor( 0, 255, 0, 255 ) ); m_pWireLen->AddLine( v1, v3, KColor( 0, 0, 255, 255 ) ); v1=v2-v1; v2=v3-v2; v3=CrossProduct(v2, v1); Normalize(v3); GetHeight( vPos.x, vPos.y, vPos.z ); vPos.z += 10.0f; m_pWireLen->AddLine( vPos, vPos+(v3*7.0f), KColor( 255, 255, 255, 255 ) ); SGameAvatarEx * pLocal = m_pGameSystem->GetLocalPlayer(); if( pLocal ) { K3DVector vView = pLocal->GetViewVector(); m_pWireLen->AddLine( vPos, vPos+(vView*7.0f), KColor( 128, 128, 128, 255 ) ); }*/ if( m_pWireLen->GetWireVertexCnt() ) { ppViewportList[0]->RegisterWire( m_pWireLen ); } } #ifdef _FOG_RANGE_ if( m_bShowFogRange ) { if( m_pModelFogEnd && m_bShowEndFogModel ) m_pModelFogEnd->Render( ppViewportList[0] ); if( m_pModelFogStart && m_bShowStartFogModel ) m_pModelFogStart->Render( ppViewportList[0] ); } #endif //TODO : 테스트 코드 /* if( m_pGameEnvMap == NULL ) { SGameAvatarEx * pLocal = m_pGameSystem->GetLocalPlayer(); if( pLocal ) m_pGameEnvMap = new SGameEnvironmentMap( pLocal ); } else m_pGameEnvMap->Render( ppViewportList[0] );*/ // m_pGameWeatherFx->RenderWeatherFx( ppViewportList[0] ); if( ( nGameRef == STAGE_ING || nGameRef == STAGE_EVENT_SCENE ) && ( m_nLoadFirst > 0 || m_bSendDummyMsg ) ) { --m_nLoadFirst; if( m_nLoadFirst <= 0 ) { m_pGameMng->SetShowLoadingWnd( false ); m_nLoadFirst = 0; } if( m_bSendDummyMsg && m_nLoadFirst == 0 ) { if( g_dwStartSendTime == 0 ) g_dwStartSendTime = m_dwTime; if( (m_dwTime - g_dwStartSendTime) >= SEND_DUMMY_MSG_TIME ) { /// 2012.01.09 클라이언트에서 이렇게 서버에 더미 패킷을 보내게 되면 선공 몹 인식처리에 문제가 있어서 주석 처리함, /// 왜 보내는지는 알 수가 없고, 안보내도 상관 없는 것 같음, /// 보내는 부분만 삭제하고 나머지 부분은 다른 곳에서 쓰일 경우가 생길거 같아서 남겨놓음 /// 지역명 출력 같은 경우에 쓰일 수 있을 것 같음, 다른 곳에서 하고 있는데 제대로 안되고 있는것 같다 - prodongi /* SGameAvatarEx * pLocalPlayer = m_pGameSystem->GetLocalPlayer(); if( pLocalPlayer ) { ArPosition arPos; arPos.x = pLocalPlayer->GetPosition()->x; arPos.y = pLocalPlayer->GetPosition()->y; ReqMove( pLocalPlayer->GetArID(), arPos, &arPos, 1, false ); } */ g_dwStartSendTime = 0; m_bSendDummyMsg = false; } } } return true; } void SGameWorld::processEffectLight() { K3DColor OutColor(1.f,1.f,1.f); K3DColor Diff( 0.f, 0.f, 0.f ); K3DColorLerp( OutColor, m_EffectLightDiff, Diff, (float)(m_dwTime-m_dwEEffectLight_Live)/m_nEffectLight_MaxLive ); m_pEffectLight->diffuse = OutColor; } bool SGameWorld::Process( DWORD time, unsigned long uProcessBitVector ) { if( GetGameRef() == STAGE_NOTHING ) return true; DWORD dwTimeGap = time - m_dwPrevProcessTime; m_dwTime = time; if( m_dwGameSystemTime == 0 ) m_dwGameSystemTime = m_dwTime; if( m_dwSkyPosSetTime == 0 ) m_dwSkyPosSetTime = m_dwTime; if( m_dwLensFlareTime == 0 ) m_dwLensFlareTime = m_dwTime; //텍스쳐 관리 이벤트 //1초에 한번정도, 실시간으로 줄 필요는 없다. if( (m_dwTime-m_dwResEventTime) > RES_EVENT_TIME ) { KNX3Manager::GetManager()->EventTime( m_dwTime ); KTextureManager::GetManager()->EventTime( m_dwTime ); m_dwResEventTime = m_dwTime; } if( m_dwEEffectLight_Live ) { if( (m_dwTime-m_dwEEffectLight_Live > m_nEffectLight_MaxLive) ) { m_dwEEffectLight_Live = 0; } else { processEffectLight(); } } m_fAccumTime += m_fElapsedTime; int nGameRef = GetGameRef(); if( m_bIsLogined == false || !m_bIsRender || nGameRef == STAGE_FADE_IN || nGameRef == STAGE_LOADING || nGameRef == STAGE_FADE_IN || nGameRef == STAGE_FADE_OUT || nGameRef == STAGE_MAP_LOAD_BUFFER || nGameRef == STAGE_MAP_PRELOAD || nGameRef == STAGE_MAP_LOADING || nGameRef == STAGE_MAP_LOADING_AFTER || nGameRef == STAGE_WARP_COMPLETE ) { // m_pModel_Load->Process( time ); } ////////////////////////////////////////////////////////////////////////// //Fade In 처리 if( GetGameRef() == STAGE_FADE_IN ) { if( m_dwFadeTime == 0 ) m_dwFadeTime = time; m_fFade_Visibility = 1-(float(time-m_dwFadeTime)/FADE_MAX_TIME); // _oprint( " STAGE_FADE_IN : %f\n", m_fFade_Visibility ); if( m_fFade_Visibility <= 0.f ) { m_nLoadFirst = 5; //5번 랜더 후 m_bSendDummyMsg = true; g_dwStartSendTime = 0; m_dwFadeTime = 0; m_fFade_Visibility = 0.f; //게임 카메라 모드일 경우 if( m_pGameCamera->GetCameraMode() == SGameCamera::CAMERA_GAME_MODE ) { SetGameRef( STAGE_ING ); ShowInterface( true ); } else //이벤트 { SetGameRef( STAGE_EVENT_SCENE ); ShowInterface( false ); } } return true; } if( GetGameRef() == STAGE_EVENT_SCENE ) { switch( m_pGameCamera->GetCameraMode() ) { case SGameCamera::CAMERA_STANDING_MODE: { if( !m_pGameMng->IsShowLoadingWnd() ) //로딩화면 체크 { GameGraphicOptionForEvScene( true ); m_pGameCamera->SetCameraMode( SGameCamera::CAMERA_EVSCENE_MODE ); m_pGameMng->SetShowEffectFocusWnd( true ); m_pGameMng->SetShowFadeInOutWnd( true ); m_pGameMng->InterfaceMsg( &SIMSG_UI_FADE_IN_EFFECT() ); m_pSky->SetCloudRender( false ); } else { m_pGameMng->SetShowEffectFocusWnd( false ); m_pGameMng->SetShowFadeInOutWnd( true ); } } break; case SGameCamera::CAMERA_EVSCENE_MODE: { static unsigned int s_PrevRegionX = 0; static unsigned int s_PrevRegionY = 0; if( m_pGameCamera->IsStopCameraWork() ) //카메라 재생이 끝났다면 FadeOut시작 { m_pGameCamera->SetCameraMode( SGameCamera::CAMERA_ENDING_MODE ); m_pGameMng->InterfaceMsg( &SIMSG_UI_FADE_OUT_EFFECT() ); s_PrevRegionX = 0; s_PrevRegionY = 0; } else { K3DVector vTarget; m_pCamera->GetTargetPos( vTarget.x, vTarget.y, vTarget.z ); // m_pCamera->GetCamPos( vTarget.x, vTarget.y, vTarget.z ); unsigned int regionx = GetRegionX( vTarget.x ); unsigned int regiony = GetRegionX( vTarget.y ); if( regionx != s_PrevRegionX || regiony != s_PrevRegionY ) { TS_CS_GET_REGION_INFO region_info; region_info.x = vTarget.x; region_info.y = vTarget.y; SendMsg( ®ion_info ); s_PrevRegionX = regionx; s_PrevRegionY = regiony; _oprint( "region x: %d y: %d %f %f\n", regionx, regiony, vTarget.x, vTarget.y ); } } } break; case SGameCamera::CAMERA_ENDING_MODE: { if( m_pGameMng->IsEndFadeInOutWnd() ) //FadeOut이 끝났다면 GameMode로 { m_pGameCamera->SetCameraMode( SGameCamera::CAMERA_GAME_MODE ); } } break; case SGameCamera::CAMERA_GAME_MODE: { m_pGameMng->SetShowEffectFocusWnd( false ); m_pGameMng->SetShowFadeInOutWnd( false ); m_pSky->SetCloudRender( true ); //Open URL 처리 m_pGameMng->ViewWaitOpenURL(); SetGameRef( STAGE_ING ); ShowInterface( true ); GameGraphicOptionForEvScene( false ); while ( m_vKeepingList.size() ) { SGameMessage * pMsg = m_vKeepingList.front(); ProcMsgAtStatic( pMsg ); pMsg->bUse = true; m_vKeepingList.pop(); } } break; } } ////////////////////////////////////////////////////////////////////////// //Fade Out 처리 if( GetGameRef() == STAGE_FADE_OUT ) { if( m_dwFadeTime == 0 ) m_dwFadeTime = time; m_fFade_Visibility = (float(time-m_dwFadeTime)/FADE_MAX_TIME); // _oprint( " STAGE_FADE_OUT : %f\n", m_fFade_Visibility ); if( m_fFade_Visibility >= 1.f ) { m_dwFadeTime = 0; m_fFade_Visibility = 1.f; SetGameRef( STAGE_MAP_LOADING ); if (m_pGameMng) //m_pGameMng->UpdateLoadingProgress(0.4f); m_pGameMng->UpdateAddLoadingProcess(0.2f); } return true; } if( GetGameRef() == STAGE_MAP_LOAD_BUFFER ) { SetGameRef( STAGE_MAP_PRELOAD ); m_fFade_Visibility = 1.f; m_dwFadeTime = 0; if (m_pGameMng) //m_pGameMng->UpdateLoadingProgress(0.25f); m_pGameMng->UpdateAddLoadingProcess(0.25f); return true; } if( GetGameRef() == STAGE_MAP_PRELOAD ) { SetGameRef( STAGE_FADE_OUT ); m_fFade_Visibility = 0.f; m_dwFadeTime = 0; /// 2011.11.09 preloadingDistance 적용 - prodongi int preloadingDistance = getPreloadingDistance(m_nWarpX, m_nWarpY); m_pTerrainMapEngine->PreloadingSegments( m_nWarpX, m_nWarpY, false, NULL, preloadingDistance ); if (m_pGameMng) //m_pGameMng->UpdateLoadingProgress(0.3f); m_pGameMng->UpdateAddLoadingProcess(0.1f); return true; } if( GetGameRef() == STAGE_LOADING ) { if( m_pCommandSystem->IsActivated() ) { // SGameAvatarEx::SetThreadLoad(true); SetGameRef( STAGE_FADE_IN ); //Warp 완료 됐다. if (m_pGameMng) m_pGameMng->UpdateAddLoadingProcess(0.2f); //m_pGameMng->UpdateLoadingProgress(1.0f); m_dwFadeTime = 0; m_fFade_Visibility = 1.f; SGameObject::Activate(); m_pGameSystem->SetLocalInven(); } } ////////////////////////////////////////////////////////////////////////// //Warp Loading if( GetGameRef() == STAGE_MAP_LOADING ) { m_pTerrainMapEngine->Process( time, m_pCamera ); //보이는 곳이 모두 로딩이 끝났다. if( m_pTerrainMapEngine->IsCompletelyLoadedVisibleSegment() ) { //지울때 시간이 소요 되므로, Loading 화면이 덮어진 후 실행. //안 쓰는 리소스 삭제( ref cnt : 0 이며, except list 에 없는 것들 ) // assert( _CrtCheckMemory() && "Memory Error!!!" ); KNX3Manager::GetManager()->ClearUnreferencedResource(); // assert( _CrtCheckMemory() && "Memory Error!!!" ); if (m_pGameMng) //m_pGameMng->UpdateLoadingProgress(0.5f); m_pGameMng->UpdateAddLoadingProcess(0.2f); SetGameRef( STAGE_MAP_LOADING_AFTER ); SGameObject::Activate(); } return true; } ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// //Warp Loading if( GetGameRef() == STAGE_MAP_LOADING_AFTER ) { m_pCommandSystem->Process( time ); while ( m_vKeepingList.size() ) { SGameMessage * pMsg = m_vKeepingList.front(); ProcMsgAtStatic( pMsg ); pMsg->bUse = true; m_vKeepingList.pop(); if (m_pGameMng) //m_pGameMng->UpdateLoadingProgress(0.75f); m_pGameMng->UpdateAddLoadingProcess(0.2f); } return true; } ////////////////////////////////////////////////////////////////////////// // {//Music Check if( m_dwMusicCheckTime == 0 ) m_dwMusicCheckTime = m_dwTime; else { if( (m_dwTime - m_dwMusicCheckTime) > MUSIC_CHECK_TIME ) { m_dwMusicCheckTime = 0; if( !m_pMSoundMgr->IsPlayBGM() ) ChangeMusic(); } } // } // TODO : 시간 테스트용 SetTime(); //자동이동 if( m_bAutoMove ) AutoMove(); if( m_bAutoFollowMode ) AutoFollowMode(); { // Camera Effect처리 m_pGameCamera->Process( time ); m_pEffectLight->attenuation0 = 0.f; m_pEffectLight->attenuation1 = 1.f;//0.08f; m_pEffectLight->attenuation2 = 0.f; m_pEffectLight->range = 50; } m_pRenderDevice->SetCamPos( m_pCamera->GetCamPos() ); if( uProcessBitVector & World_ProcessTerrain ) { if( !m_bTerrainProc ) { m_pTerrainMapEngine->Process( time, m_pCamera ); LocalProcess(); SGameAvatarEx * pLocal = m_pGameSystem->GetLocalPlayer(); if( pLocal ) { float fGrassCullRadius = KSeqSpeedGrass::GetFadeDist() + KSeqSpeedGrass::GetFadeLength(); if( GetGameOption().GetGrassViewDistance() != 0 ) { // m_pTerrainMapEngine->CreateGrassColonyInfoForMap( *pLocal->GetPosition(), fGrassCullRadius ); } if( !pLocal->IsChasing() ) { K3DVertex vtNextPos; pLocal->MoveDetour(vtNextPos); } } if(m_pLowQualityWater) { LQWaterProcess(); m_pLowQualityWater->Process(time, m_pTerrainMapEngine->GetTerrainVisibleDistance() ); } } } ////하늘 애니메이션을 변경한다. const TERRAINMAP_PROPERTIES::COLORING& color = m_pTerrainMapEngine->GetMapColoring(); if( m_pSky->SetSkyType( color.dwSkyType ) ) { if( color.dwSkyType == 0 ) //일반 하늘 { Game_Cloud_vis(.8f); } else if( color.dwSkyType == 1 ) //데바 마을 하늘 { Game_Cloud_vis(1.f); } else if( color.dwSkyType == 2 ) //아수라 마을 하늘 { Game_Cloud_vis(.1f); } m_pCommandSystem->SetSkyType( color.dwSkyType ); //시간 변화에 따라 on off 시킨다 /* if( color.dwSkyType == 2 ) m_pLensFlare->SetRenderFlag( false ); else m_pLensFlare->SetRenderFlag( true );*/ } if( uProcessBitVector & World_ProcessSky ) { m_pSky->Process( time ); } if( uProcessBitVector & World_ProcessTargetModel ) { SGameAvatarEx* pPlayer = m_pCommandSystem->GetLocalPlayer(); if( pPlayer && m_bTargetModel /*m_pTargetModel->GetVisibility() > 0.f*/ ) { K3DVector vCharPos = *pPlayer->GetPosition(); if( pPlayer->IsStateRide() ) { SGameAvatarEx* pCreature = pPlayer->GetRiderCreatureObject(); if( pCreature ) vCharPos = *pCreature->GetPosition(); CheckTargetModelDistance( vCharPos ); } else { CheckTargetModelDistance( vCharPos ); if( !pPlayer->IsMoving() && m_bTargetModel ) { SGameAvatarEx* pCreature = pPlayer->GetRiderCreatureObject(); if( pCreature ) { vCharPos = *pCreature->GetPosition(); CheckTargetModelDistance( vCharPos ); } } } } m_pTargetModel->Process( time ); } if( uProcessBitVector & World_ProcessGameSys ) { if( (time - m_dwGameSystemTime) > 41 ) { m_dwGameSystemTime = time; m_pGameSystem->Process( time ); } } m_kmoveControler.process(GetGameRef()); if( uProcessBitVector & World_ProcessCommandSys ) { m_pCommandSystem->Process( time ); } if( uProcessBitVector & World_ProcessSelectTarget ) { if( m_pSelectTargetFx && m_bSelectTarget ) { if( m_pSelectTargetOnFx ) { if( m_pSelectTargetOnFx->GetArHandle() == m_pSelectTargetFx->GetArHandle() ) { m_bSelectTarget = false; m_pSelectTargetFx->SetArHandle( NULL ); } } if( m_bSelectTarget ) { m_pSelectTargetFx->SetRotation( time ); m_pSelectTargetFx->Process( time ); } } if( m_pSelectTargetOnFx ) { SGameAvatarEx* pTarget = m_pGameSystem->GetTarget(); if( pTarget ) { m_pSelectTargetOnFx->SetRotation( time ); m_pSelectTargetOnFx->SetArHandle( pTarget->GetArID() ); m_pSelectTargetOnFx->Process( time ); } else m_pSelectTargetOnFx->SetArHandle( NULL ); } } /// 2010.10.12 - prodongi procRegionSkillTargetFx(); if( m_renderRegionSkillTargetFx && m_pRegionSkillScaleFx ) { SGameAvatarEx* pTarget = m_pGameSystem->GetLocalPlayer(); if( pTarget ) { //m_pReginSkillScaleFx->SetRotation( time ); m_pRegionSkillScaleFx->SetArLocalHandle( pTarget->GetArID() ); m_pRegionSkillScaleFx->Process( time ); } else m_pRegionSkillScaleFx->SetArHandle( NULL ); } ////자신 처리~ static K3DVector s_PrevCameraSyncPos; if( m_pGameCamera->GetCameraMode() != SGameCamera::CAMERA_GAME_MODE ) { K3DVector cpos, lpos; m_pCamera->GetCamPos( cpos.x, cpos.y, cpos.z ); m_pCamera->GetTargetPos( lpos.x, lpos.y, lpos.z ); K3DVector vCenter = (lpos - cpos) / 2.0f; vCenter = lpos + vCenter; float fHeight = lpos.z; if( lpos.z < cpos.z ) { fHeight = ( cpos.z - lpos.z )/ 2.0f; fHeight = lpos.z + fHeight; } //m_pSky->SetPosition(vCenter.x, vCenter.y, lpos.z + fHeight ); //m_pSky->SetPosition(lpos.x, lpos.y, lpos.z ); m_pSky->SetPosition(cpos.x, cpos.y, cpos.z ); //2009.04.14 인트로시 하늘이 짤리는걸 수정 함 sfreer. m_pSky->Process( time ); //렌즈 플레이어 까지 m_pLensFlare->SetPosition( cpos, *m_pSky->GetSunPos() ); // { [sonador] weather setting m_pWeatherService->SetPosition( cpos, lpos ); if( this->m_pCamera ) m_pWeatherService->SetViewMatrix( *this->m_pCamera->GetViewMatrix() ); // } SetSoundPosition( lpos.x, lpos.y, lpos.z, cpos.x, cpos.y, cpos.z ); //마일즈용 m_pTerrainMapEngine->SetCameraState( cpos, lpos ); } else { if( uProcessBitVector & World_ProcessLocal ) { SGameObject * pCreature = NULL; SGameAvatarEx * pLocal = m_pGameSystem->GetLocalPlayer(); if (pLocal) pCreature = GetGameObject(pLocal->GetCreatureMountHandle()); // 탑승 상태 일경우 카메라 위치를 탑승 크리쳐 위치로 변경한다. // 기존의 경우 로컬 플레이어 위치만을 참조하여 탑승 상태일 경우 카메라가 // 플레이어(크리쳐 위치가 맞는듯) 위치랑 달라 졌다. K3DVector pos; if (pCreature) pos = K3DVector(pCreature->GetPosition()->x, pCreature->GetPosition()->y, pCreature->GetPosition()->z); else pos = K3DVector(m_pArObject->GetMyPos().GetX(), m_pArObject->GetMyPos().GetY(), m_pArObject->GetMyPos().GetZ()); WORD wTile = 0; if( !g_bUserCamMode && m_pCommandSystem->GetLocalPlayer() ) { GetHeight( pos.x, pos.y, pos.z, wTile ); if( s_PrevCameraSyncPos != pos ) { s_PrevCameraSyncPos = pos; m_pGameCamera->SetTargetPosition(pos); // m_pCamera->SetPan( pos.x, pos.y, pos.z+CAMERA_Z_OFFSET ); //카메라 이동.. } else { if( m_pArObject->GetMyPos().IsMoving() ) { GetHeight( pos.x, pos.y, pos.z, wTile ); m_pGameCamera->SetTargetPosition(pos); // 카메라 타겟 위치 세팅 //m_pCamera->SetTargetPos( pos.x, pos.y, pos.z+m_fCamera_Z_Offset ); //카메라에 직접 세팅 : 타겟 등 카메라에서 직접 읽는 루틴용으로 남겨둠 } } static K3DVertex s_PrevCamOrgPos; static K3DVertex s_PrevCamTarPos; static K3DVertex s_PrevCamPos; if(m_bCameraCollision) { // if( s_PrevCamOrgPos != m_pCamera->GetCamOrgPos() || s_PrevCamTarPos != m_pCamera->GetTargetPos() || s_PrevCamPos != m_pCamera->GetCamPos() ) // 위치 변했을때만 계산 { // 무조건 매턴 계산 bool bVib = m_pGameCamera->IsVibrating(); if( !bVib ) CheckCameraMove( s_PrevCamOrgPos ); s_PrevCamOrgPos = m_pCamera->GetCamOrgPos(); s_PrevCamTarPos = m_pCamera->GetTargetPos(); s_PrevCamPos = m_pCamera->GetCamPos(); } } K3DVector cpos, lpos; m_pCamera->GetCamPos( cpos.x, cpos.y, cpos.z ); m_pCamera->GetTargetPos( lpos.x, lpos.y, lpos.z ); ////하늘 위치 설정 // if( (time-m_dwSkyPosSetTime) > 41 ) { //초당 24 프레임 // m_dwSkyPosSetTime = time; m_pSky->SetPosition(lpos.x, lpos.y, lpos.z ); //렌즈 플레이어 까지 m_pLensFlare->SetPosition( lpos, *m_pSky->GetSunPos() ); // { [sonador] weather setting m_pWeatherService->SetPosition( cpos, lpos ); if( this->m_pCamera ) m_pWeatherService->SetViewMatrix( *this->m_pCamera->GetViewMatrix() ); // } } SetSoundPosition( lpos.x, lpos.y, lpos.z, pos.x, pos.y, pos.z ); //마일즈용 m_pTerrainMapEngine->SetCameraState( cpos, lpos ); } } } if( uProcessBitVector & World_ProcessEffect ) { ////Effect size_t nEffectSize = m_vNewEffectList.size(); for( size_t i(0); nEffectSize>i; i++ ) { m_vNewEffectList[i]->Process(time); } nEffectSize = m_vEffectList.size(); for( size_t i(0); nEffectSize>i; i++ ) { m_vEffectList[i]->Process(time); } } if( uProcessBitVector & World_ProcessEnhanEffect ) { size_t nEffectSize = m_vEnhanceFxList.size(); for( size_t i(0); nEffectSize>i; i++ ) { m_vEnhanceFxList[i]->Process( m_dwTime ); } } if( uProcessBitVector & World_ProcessLensFlare ) { if( (m_dwTime - m_dwLensFlareTime) > 41 ) { m_dwLensFlareTime = m_dwTime; m_pLensFlare->Process( time ); } } // { [sonador] process weather if( uProcessBitVector & World_ProcessWeather ) { m_pWeatherService->Process( time ); } // } // m_pGameWeatherFx->Process( time, pos ); // m_pWrap->Process( time ); // for( int i(0); TEST_WATER>i; i++ ) // m_pWater[i]->Process( time ); if( m_pMSoundMgr ) m_pMSoundMgr->Process( m_dwTime ); m_dwPrevProcessTime = time; /// 2011.01.21 - prodongi processActiveProp(dwTimeGap); #ifdef _FOG_RANGE_ if( m_bShowFogRange ) { ProcessFogModel(time); SetPositionFogModel(); } #endif return true; } /// 2011.01.26 - prodongi void SGameWorld::processActiveProp(DWORD elapsedtime) { if (0 == m_activatePropInfo.m_prop) return ; m_activatePropInfo.m_curTime += elapsedtime; int curAniTime = (int)((float)m_activatePropInfo.m_curTime * m_activatePropInfo.m_playRate); if (m_activatePropInfo.m_totalAniTime < curAniTime) { ResetAutoMoveMode(); ResetAutoFollowMode(); SGameAvatarEx* local = m_pGameSystem->GetLocalPlayer(); SGameAvatarEx* target = dynamic_cast(m_pCommandSystem->GetObject(m_activatePropInfo.m_prop)); if (local && target) m_pGameSystem->ActivateQuestProp( local, target); if (target) { SGameFieldQuestProp* prop = dynamic_cast(target); prop->PlayAnimation(SGameFieldQuestProp::defaultKeyName, SEQTYPE_LOOP); } m_activatePropInfo.m_prop = 0; } } void SGameWorld::CheckTargetModelDistance( const K3DVector & vPosition ) { float fVisibility = 1.f; K3DVector vTargetPos = m_pTargetModel->GetPosition(); K3DVector vCharPos = K3DVector( (int)vPosition.x, (int)vPosition.y, (int)vPosition.z ); vTargetPos = K3DVector( (int)vTargetPos.x, (int)vTargetPos.y, (int)vTargetPos.z ); fVisibility = GetDistance( vCharPos, vTargetPos ); fVisibility = min( 1.f, fVisibility ); m_pTargetModel->SetVisibility( fVisibility ); if( fVisibility <= 0.f ) m_bTargetModel = false; } void SGameWorld::AllDelEffect() { //Effect 끝난것 삭제~ std::vector< SGameEffect* >::iterator it = m_vEffectList.begin(); while( it != m_vEffectList.end() ) { delete (*it); it++; } m_vEffectList.clear(); } void *SGameWorld::Perform( KID id, KArg& msg ) { _CID( GAMECREATE ); _CID( LIGHTMAP_USE); if ( id == id_GAMECREATE ) { //옵션 적용 ApplyOption( MODE_ENVIRONMENT ); ApplyOption( MODE_PLAY ); _oprint( "id_GAMECREATE\n" ); KCreateGameMessage* pCreateMsg = reinterpret_cast(&msg); m_pTerrainMapEngine->PreloadingSegments( pCreateMsg->x, pCreateMsg->y ); float fHeight = 0.f; WORD wTile = 0; GetHeight( pCreateMsg->x, pCreateMsg->y, fHeight, wTile ); m_pSky->SetPosition( K3DVector(pCreateMsg->x, pCreateMsg->y,fHeight) ); //자신에게 Target, 카메라 위치 변경 m_pCamera->SetTargetPos( pCreateMsg->x, pCreateMsg->y, fHeight+m_fCamera_Z_Offset ); m_pCamera->SetCamPos( pCreateMsg->x+88, pCreateMsg->y, fHeight+72 ); m_pGameCamera->SetTargetPosition( K3DVector( pCreateMsg->x, pCreateMsg->y, fHeight) ); SetSoundPosition( pCreateMsg->x, pCreateMsg->y, fHeight+m_fCamera_Z_Offset, pCreateMsg->x+88, pCreateMsg->y, fHeight+72 ); m_pLensFlare->SetPosition( K3DVector(pCreateMsg->x,pCreateMsg->y,fHeight), *m_pSky->GetSunPos() ); // if( m_pViewPort) m_pViewPort->SetFillColor( KColor( 62, 48, 61, 255 ) ); if( m_pViewPort) m_pViewPort->SetFillColor( m_FillColor ); // Game_Mip_Range (0); // Game_Mip_Bias (0); SetMinimapInfo( K3DVector( pCreateMsg->x, pCreateMsg->y, 0.f ) ); LoadWayPoint( K3DVector( pCreateMsg->x, pCreateMsg->y, 0.f ) ); //해당 지역의 웨이포인트 로드 m_bIsRender = TRUE; /*if (m_pGameMng) //m_pGameMng->UpdateLoadingProgress(0.0f); m_pGameMng->InitLoadingBar();*/ } return (void*)0; } void SGameWorld::LeaveSummon( AR_HANDLE hLeaveHandle ) { return m_pGameSystem->LeaveSummon( hLeaveHandle ); } void SGameWorld::AddSummon( class SGameAvatarEx * pSummon, SMSG_ENTER* pEnterMsg ) { return m_pGameSystem->AddSummon( pSummon, pEnterMsg ); } void SGameWorld::DelSummon( AR_HANDLE hCreature ) { return m_pGameSystem->DelSummoon(hCreature); } void SGameWorld::EvolutionSummon( struct SMSG_SUMMON_EVOLUTION* pMsg ) { return m_pGameSystem->EvolutionSummon( pMsg ); } // { sonador 10.2.1 팻 시스템 구현 DATA_PET* SGameWorld::IsLocalPet( AR_HANDLE handle ) { return m_pGameSystem->IsLocalPet( handle ); } SGameAvatarEx* SGameWorld::IsSummonPet( AR_HANDLE handle ) { return m_pGameSystem->IsSummonPet( handle ); } DATA_PET* SGameWorld::IsLocalPetCage( AR_HANDLE handle ) { return m_pGameSystem->IsLocalPetCage( handle ); } void SGameWorld::AddPet( class SGameAvatarEx* pet, struct SMSG_ENTER* enterMsg ) { return m_pGameSystem->AddPet( pet, enterMsg ); } void SGameWorld::RemovePet( AR_HANDLE handle ) { return m_pGameSystem->RemovePet( handle ); } // } void SGameWorld::AddSkillProp( SGameAvatarEx * pSkillProp ) { m_pGameSystem->AddSkillProp( pSkillProp ); } void SGameWorld::AddAction( struct SGameMessage* pMsg ) { m_pCommandSystem->AddAction( pMsg ); } void SGameWorld::AddChaosEffect( int nChaosCnt ) { // TODO : 테스트용 서버에서 구현완료 되면 삭제한다 SGameAvatarEx* pTarget = m_pGameSystem->GetTarget(); SGameAvatarEx* pPlayer = m_pGameSystem->GetLocalPlayer(); if( pTarget && pPlayer ) { SMSG_GET_CHAOS* pChaosFx = new SMSG_GET_CHAOS; pChaosFx->hPlayer = pPlayer->GetArID(); pChaosFx->hCorpse = pTarget->GetArID(); pChaosFx->nChaos = nChaosCnt; m_pCommandSystem->OnMsgAddOtherEffect( pChaosFx ); SAFE_DELETE( pChaosFx ); } } int SGameWorld::AddOtherEffect( int nFxID, struct OtherFxData* fxdata ) { if( m_pCommandSystem ) return m_pCommandSystem->OnAddOtherEffect( nFxID, fxdata ); return 0; } void SGameWorld::EndOtherEffect( int nFxID ) { if( m_pCommandSystem ) m_pCommandSystem->EndOtherEffect( nFxID ); } unsigned char SGameWorld::GetGameObjectType( AR_HANDLE objHandle ) { SGameAvatarEx* pAvatar = (SGameAvatarEx*)m_pCommandSystem->GetObject( objHandle ); if( pAvatar ) return pAvatar->GetObjType(); return 0; } SGameObject* SGameWorld::GetGameObject( AR_HANDLE objHandle ) { return m_pCommandSystem->GetObject( objHandle ); } SGameObject* SGameWorld::GetGameTransportCreatureObject( AR_HANDLE objHandle ) { return m_pCommandSystem->GetTransportCreatureObject( objHandle ); } SGameObject* SGameWorld::GetItemObject( K3DVector & pos, float & fDist, int nItemType, float fLimitDistance ) // sonador #2.1.2.4.3 팻 조작 UI 연동 { return m_pCommandSystem->GetObject( TS_ENTER::GAME_ITEM, pos, fDist, nItemType, fLimitDistance ); } void SGameWorld::GetItemObjects_For_PetAutoGather( const K3DVector& center, float fLimitRange, std::vector& vecResult, const K3DVector& dist_pos, std::vector& vecDist, int nMaxCount ) { m_pCommandSystem->GetItemObjects_For_PetAutoGather(center, fLimitRange, vecResult, dist_pos, vecDist, nMaxCount ); } SGameObject* SGameWorld::GetMobObject( K3DVector & pos ) { //float fDist; //return m_pCommandSystem->GetObject( TS_ENTER::GAME_MOB, pos, fDist ); return NULL; } void SGameWorld::SetNamePanelViewMatrix() { K3DVector vCamPos = m_pCamera->GetCamPos(); K3DVector vTarPos = m_pCamera->GetTargetPos(); vTarPos = vTarPos - vCamPos; vCamPos = K3DVector( 0.f, 0.f, 0.f ); if( m_pCamera->IsCameraPerspectiveMode() ) { if( m_pCamera->IsCoordinateRightHand() ) K3DMatrixLookAtRH(m_vNamePanelViewMatrix, vCamPos, vTarPos,m_pCamera->GetUpVector()); else K3DMatrixLookAtLH(m_vNamePanelViewMatrix, vCamPos, vTarPos,m_pCamera->GetUpVector()); } else { if( m_pCamera->IsCoordinateRightHand() ) K3DMatrixLookAtRH(m_vNamePanelViewMatrix, vCamPos, vTarPos, m_pCamera->GetUpVector()); else K3DMatrixLookAtLH(m_vNamePanelViewMatrix, vCamPos, vTarPos, m_pCamera->GetUpVector()); } } void SGameWorld::Get2DPos( K3DVector & pos, K3DVector & _2Dpos ) { K3DMatrix wlmat; K3DMatrixIdentity( wlmat ); SGameViewPort *vp = m_pViewPort; K3DVector playerpos = pos - m_pCamera->GetCamPos(); K3DVectorProject( _2Dpos, playerpos, *vp->GetViewportStruct(), *vp->GetProjMatrix(), m_vNamePanelViewMatrix, wlmat ); } void SGameWorld::ProcMsgAtStatic( SGameMessage * pGameMsg ) { //_oprint("void SGameWorld::ProcMsgAtStatic( SGameMessage * pGameMsg )\n"); int nGameRef = GetGameRef(); if( nGameRef == STAGE_END ) return; SGame::ProcMsgAtStatic( pGameMsg ); if( pGameMsg->bUse ) return; //이미 사용한 메세지는 리턴 //맵을 로딩하고 있어서, 메세지는 보류한다. if( nGameRef == STAGE_FADE_OUT || nGameRef == STAGE_EVENT_SCENE ) { // _oprint( "Keep Push : 0x%08X %d\n", pGameMsg, pGameMsg->nType ); // 2010.06.14 - prodongi if (IMSG_SET_KEYMAPPING == pGameMsg->nType) { pGameMsg->bUse = true; if( IsStopProcess() ) return; //로비 돌아 가기 요청 후에는 인터페이스로 안감 m_pGameMng->InterfaceMsg( pGameMsg ); return ; } bool bKeepingMessage = true; if( nGameRef == STAGE_EVENT_SCENE ) { if( pGameMsg->nType == IMSG_HOTKEY_EX) { SIMSG_HOTKEY_EX* pHotKeyMsg = static_cast(pGameMsg); if( !pHotKeyMsg->bUp ) //Key Down 만 처리 { if( ( LOWORD(pHotKeyMsg->wParam ) == VK_ESCAPE ) ) { m_pGameCamera->StopCameraWork(); } } pGameMsg->bUse = true; return; } if( pGameMsg->nType >= IMSG_NONE && pGameMsg->nType < TMSG_MAX ) { pGameMsg->bUse = true; return; } bKeepingMessage = false; } if( bKeepingMessage ) { //인터페이스 메세지 같은 것들은 무시한다. if( pGameMsg->nType >= IMSG_NONE && pGameMsg->nType < TMSG_MAX ) { pGameMsg->bUse = true; return; } //UI 요청 메시지 if( pGameMsg->bPostNew ) { pGameMsg->bUse = true; return; } pGameMsg->bSafeKeeping = true; //메세지를 보관하고, 맵 로딩이 완료 되면 그때 로딩 하자. m_vKeepingList.push( pGameMsg ); return; } } //메세지 전 처리~, Action 요청시 사용 가능한지 미리 필터링~ if( m_pGameSystem->ProcMsgAtStatic( pGameMsg ) ) //처리 한건 밑으로 보내지 않는다~ return; //메세지 처리 m_pCommandSystem->ProcMsgAtStatic( pGameMsg ); //메세지 후 처리~ switch( pGameMsg->nType ) { case MSG_SEND_DATA : { SMSG_SEND_DATA* _msg = dynamicCast(pGameMsg); if (_msg->strMessage == "music_finished") { ChangeMusic(); break; } else if (_msg->strMessage == "toggle_help") { ToggleHelpWindow(); break; } else if (_msg->strMessage == "cancel_casting") { cancelCasting(); } break; }; #ifdef _DEV case MSG_CHATTING : { After_Chatting( static_cast(pGameMsg) ); break; } #endif case MSG_LOGIN : { After_Login( static_cast(pGameMsg) ); break; } case CMSG_WARP : { After_Warp( static_cast(pGameMsg) ); break; } case MSG_RESULT : { m_kmoveControler.procMsgResult(pGameMsg); After_Result( static_cast(pGameMsg) ); break; } case IMSG_HOTKEY_EX : { GetGameKeymapping().PreHotkey( static_cast(pGameMsg) ); ProcHotKeyEx ( static_cast(pGameMsg) ); pGameMsg->bUse = true; break; } case IMSG_KEYUP : { pGameMsg->bUse = true; break; } case IMSG_KEYDOWN : { ProcKeyDown ( static_cast(pGameMsg) ); pGameMsg->bUse = true; break; } case IMSG_MOUSEMOVE : { bool bCameraChanged = ProcMouseMove( static_cast(pGameMsg) ); pGameMsg->bUse = true; if( bCameraChanged ) { m_bIsResetTargetList = bCameraChanged; ////////////////////////////////////////////////////////////////////////// //뷰 방향 알림 K3DVector camPos, camTarPos; m_pCamera->GetCamPos( camPos.x, camPos.y, camPos.z ); m_pCamera->GetTargetPos( camTarPos.x, camTarPos.y, camTarPos.z ); SIMSG_UI_MY_DEGREE msg; msg.fRadian = GetViewRadian( camTarPos, camPos ); ProcMsgAtStatic( &msg ); ////////////////////////////////////////////////////////////////////////// //사운드 방향 설정.. SetSoundPosition( camTarPos.x, camTarPos.y, camTarPos.z, camPos.x, camPos.y, camPos.z, false ); } break; } case IMSG_MOUSEWHEEL : { if( !m_pGameMng->IsWebPageWndOpened() ) { if( 0 != HIBYTE(GetAsyncKeyState(VK_CONTROL)) ) { //파티원 선택 } else { // _oprint( "마우스 휠 발생 : IMSG_MOUSEWHEEL\n" ); ProcMouseWheel ( static_cast(pGameMsg) ); m_bIsResetTargetList = true; } } pGameMsg->bUse = true; break; } case IMSG_LBUTTONUP : { ProcLbuttonUp ( static_cast(pGameMsg) ); pGameMsg->bUse = true; break; } case IMSG_LBUTTONDOWN : { m_kmoveControler.set_automove(false); ProcLbuttonDown ( static_cast(pGameMsg) ); pGameMsg->bUse = true; break; } case IMSG_LBUTTONDBLCLK : { ProcLbuttonDblclk( static_cast(pGameMsg) ); pGameMsg->bUse = true; break; } case IMSG_MBUTTONUP : { ProcMbuttonUp ( static_cast(pGameMsg) ); pGameMsg->bUse = true; break; } case IMSG_MBUTTONDOWN : { m_kmoveControler.procMouseMsg(pGameMsg); ProcMbuttonDown ( static_cast(pGameMsg) ); pGameMsg->bUse = true; break; } case IMSG_MBUTTONDBLCLK : { ProcMbuttonDblclk( static_cast(pGameMsg) ); pGameMsg->bUse = true; break; } case IMSG_RBUTTONUP : { ProcRbuttonUp ( static_cast(pGameMsg) ); pGameMsg->bUse = true; break; } case IMSG_RBUTTONDOWN : { ProcRbuttonDown ( static_cast(pGameMsg) ); pGameMsg->bUse = true; break; } case IMSG_RBUTTONDBLCLK : { ProcRbuttonDblclk( static_cast(pGameMsg) ); pGameMsg->bUse = true; break; } case TMSG_SYSTEM_OPTION: { STMSG_SYSTEM_OPTION* pOptionMsg = (STMSG_SYSTEM_OPTION*)pGameMsg; if( STMSG_SYSTEM_OPTION::SYSOPTION_BACKGROUND == pOptionMsg->m_Type ) { m_nTerrainVisibleDistOption = pOptionMsg->m_nOption; if( m_nTerrainVisibleDistOption < 0 ) m_nTerrainVisibleDistOption = 0; if( m_nTerrainVisibleDistOption >= c_nVisibleDistOptionCount ) m_nTerrainVisibleDistOption = c_nVisibleDistOptionCount; m_pTerrainMapEngine->SetTerrainVisibleDistance( c_TerrainVisibleDistOptions[m_nTerrainVisibleDistOption] ); } pGameMsg->bUse = true; } break; case TMSG_REQ_SYSTEM_OPTION: { STMSG_REQ_SYSTEM_OPTION* pReqOptionMsg = (STMSG_REQ_SYSTEM_OPTION*)pGameMsg; if( STMSG_SYSTEM_OPTION::SYSOPTION_BACKGROUND == pReqOptionMsg->m_Type ) pReqOptionMsg->m_nGetOption = m_nTerrainVisibleDistOption; pGameMsg->bUse = true; } break; case MSG_MOVE: { m_kmoveControler.procMoveMsg(pGameMsg); } break; case MSG_CHANGE_LOCATION: { SMSG_CHANGE_LOCATION* pChangeLocation = (SMSG_CHANGE_LOCATION*)pGameMsg; SetChangeLocation( pChangeLocation ); pGameMsg->bUse = true; } break; case MSG_GAME_TIME: { SMSG_GAME_TIME* pGametime = (SMSG_GAME_TIME*)pGameMsg; SetGameTime( pGametime ); pGameMsg->bUse = true; } break; case MSG_WEATHER_INFO: { SMSG_WEATHER_INFO* pWeatherInfo = (SMSG_WEATHER_INFO*)pGameMsg; if( !_IsEnvironmentConfigMode() ) { if( pWeatherInfo->region_id == m_nSLocationID ) { if(m_nCurrentLocation == PLAYER_IN_INSTANCE_DUNGEON_AUTO) // 2011.07.21 - servantes : 날씨 아이디 변경 : 렌즈플레어 안나오게 하기 위해서 m_nWeatherID = 1; else m_nWeatherID = pWeatherInfo->weather_id; } } pWeatherInfo->bUse = true; } break; // sonador 1.8.5 자동 따라가기 구현 case MSG_AUTO_FOLLOW: { SMSG_AUTO_FOLLOW* pAutoFollow = (SMSG_AUTO_FOLLOW*)pGameMsg; SGameAvatarEx* pTarget = m_pGameSystem->GetTarget(); if( pTarget ) { // sonador 1.8.9 은신 케릭터 자동 따라가기 버그 수정 // sonador 1.8.11 자동 따라가기 은신 플레그 확인 오류 수정 bool isHiding = pTarget->GetStateFlag() & SGameAvatarEx::FLAG_STATE_HIDING; if( ( pTarget->GetObjType() == TS_ENTER::GAME_PLAYER || pTarget->GetObjType() == TS_ENTER::GAME_SUMMON ) && !( isHiding && !this->IsPartyRaidMemeber( pTarget->GetArID() ) ) ) { m_bAutoFollowMode = true; m_hFollowTarget = pTarget->GetArID(); } } pAutoFollow->bUse = true; } break; // sonador 1.8.9 은신 케릭터 자동 따라가기 버그 수정 case MSG_STATE: { SMSG_STATE* pMsgState = (SMSG_STATE*)pGameMsg; switch( pMsgState->state_code ) { case STATE_CODE::HIDING: case STATE_CODE::TRACE_OF_FUGITIVE: { if( pMsgState->state_level ) { if( m_bAutoFollowMode && m_hFollowTarget == pMsgState->handle && !this->IsPartyRaidMemeber( pMsgState->handle ) ) { this->ResetAutoFollowMode(); } } } break; } } break; } //Interface 로 메세지 날림~ pGameMsg->bUse = true; if( IsStopProcess() ) return; //로비 돌아 가기 요청 후에는 인터페이스로 안감 m_pGameMng->InterfaceMsg( pGameMsg ); } void SGameWorld::StopProcess() { SGame::StopProcess(); //로비로 이동하면, 꺼진다. // SGameAvatarEx::SetThreadLoad( false ); m_pArObject->ClerAll(); //달리고 있을때, 로비이동 하면, 위치가 이상해짐. //모든 윈도우 숨기기, 초기화 m_pGameMng->InterfaceMsg( &SIMSG_UI_NAME_TEXT(false) ); // 게임 시스템 데이타 초기화 ShowInterface( false ); m_pGameSystem->InitInterfaceData(); m_pGameMng->InterfaceMsg( &SIMSG_UI_RELOAD(true) ); if( KNX3Manager::GetManager()->GetSystemRequirements() == KNX3Manager::MIXED_SYSTEM ) { if( GetGameOption().GetPresetOption() == 1 ) //1 == 최저사양 모드 KNX3Manager::GetManager()->SetSystemRequirements( KNX3Manager::MINIMUM_SYSTEM_BY_USER_SELECT ); } else if( KNX3Manager::GetManager()->GetSystemRequirements() == KNX3Manager::MINIMUM_SYSTEM_BY_USER_SELECT ) { if( GetGameOption().GetPresetOption() != 1 ) KNX3Manager::GetManager()->SetSystemRequirements( KNX3Manager::MIXED_SYSTEM ); } m_bIsRender = TRUE; } void SGameWorld::After_Result( struct SMSG_RESULT* pMsg ) { switch( pMsg->request_msg_id ) { case TM_CS_RETURN_LOBBY : { if( pMsg->result == RESULT_SUCCESS ) { if (m_pGameMng) //m_pGameMng->UpdateLoadingProgress(0.0f); m_pGameMng->InitLoadingBar(); SetOtherNavigateClose( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_TITLE ); SetOtherNavigateClose( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_TITLE ); SetOtherNavigateClose( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_POPURL_TITLE ); // assert( _CrtCheckMemory() && "Memory Error!!!" ); //로비로 이동 함/ m_pViewPort->ClearRegisteredList(); // assert( _CrtCheckMemory() && "Memory Error!!!" ); SetGameRef( STAGE_END ); //유저 해상도 변경 KSize sizResolution; int nWidth = GetGameOption().GetResolution_Width();//SIZE_1024; int nHeight = GetGameOption().GetResolution_Height();//SIZE_768; sizResolution = KSize(nWidth, nHeight); const KSize & size = KUIWndManager::GetResolution(); //if( size.width != SIZE_1024 || size.height != SIZE_768 ) { // if( m_pGameMng ) m_pGameMng->SetResolution( nWidth, nHeight ); } m_pGameMng->SetShowLoadingWnd( true ); m_pGameMng->InterfaceMsg( &SIMSG_UI_REQ_RETURN_LOBBY() ); // assert( _CrtCheckMemory() && "Memory Error!!!" ); Destroy(); // assert( _CrtCheckMemory() && "Memory Error!!!" ); if( m_pArObject ) m_pArObject->ReSet(); //재사용 // assert( _CrtCheckMemory() && "Memory Error!!!" ); //if( m_pGameMng ) //{ //물 끄기 // m_pGameMng->SetShowWater( false ); //} } else { //로비로 이동 할 수 없음. _oprint( "로비로 이동 할 수 없음.\n" ); assert(0); } } break; case TM_CS_MOVE_REQUEST : { //갈 수 없는 지역이므로... 숨긴다. _oprint( "갈 수 없는 지역이므로... 숨긴다.\n" ); SetMoveTargetPos( 0,0,0 ); } break; } } void SGameWorld::AssistTarget( AR_HANDLE handle ) { SGameAvatarEx * pTarget = (SGameAvatarEx *)GetGameObject( handle ); if( pTarget ) { m_pGameSystem->SetTarget( pTarget ); } } void SGameWorld::After_Chatting( SMSG_CHATTING* pMsg ) { if( (pMsg->nChatType == CHAT_COMMUNITY && (_stricmp(pMsg->szSender.c_str(), "@SCRIPT" ) == 0 ) ) || (pMsg->nChatType == CHAT_NOTICE && (_stricmp(pMsg->szSender.c_str(), "@SCRIPT" ) == 0 ) ) || (pMsg->nChatType == CHAT_NOTICE && (_stricmp(pMsg->szSender.c_str(), "@NOTICE" ) == 0 ) ) || (pMsg->nChatType == CHAT_DEBUG && (_stricmp(pMsg->szSender.c_str(), "@SCRIPT" ) == 0 ) ) || (pMsg->nChatType == CHAT_PARTY_SYSTEM && (_stricmp(pMsg->szSender.c_str(), "@SCRIPT" ) == 0 ) ) || (pMsg->nChatType == CHAT_GUILD_SYSTEM && (_stricmp(pMsg->szSender.c_str(), "@SCRIPT" ) == 0 ) ) || (pMsg->nChatType == CHAT_SYSTEM && (_stricmp(pMsg->szSender.c_str(), "@SCRIPT" ) == 0 ) ) || (pMsg->nChatType == CHAT_RAID_SYSTEM && (_stricmp(pMsg->szSender.c_str(), "@SCRIPT" ) == 0 ) ) ) { std::vector< std::string > vString; XStringUtil::Split( pMsg->strText.c_str(), vString, " " ); // parseToken( pMsg->strText.c_str(), vString, " " ); //Tab or Space std::string str; //각종 서버의 메세지를 검사 해서 클라 제어 if( strnicmp( pMsg->strText.c_str(), "/requestparty", strlen("/requestparty") ) == 0 && vString.size() > 2 ) { str = SR(296, "#@user_name@#", vString[1].c_str(), "#@level@#", vString[2].c_str(),"#@job_name@#",vString[3].c_str()); SMSG_CHATTING msg; msg.handle = 0; msg.nChatType = CHAT_NOTICE; msg.szSender = "@NOTICE"; msg.strText = str; if( m_pGameMng ) m_pGameMng->ProcMsgAtStatic( &msg ); } if( strlen(pMsg->strText.c_str()) > 2 && strncmp( pMsg->strText.c_str(), "~~", 2 ) == 0 ) { if( strnicmp( pMsg->strText.c_str(), "~~event_item", strlen("~~event_item") ) == 0 && vString.size() > 2 ) { const ItemBaseEx_info * pItemBase = GetItemDB().GetItemData( atoi( vString[2].c_str() ) ); str = SR(296, "#@user_name@#", vString[1].c_str(), "#@item_name@#", GetStringDB().GetString( pItemBase->nNameId ) ); SMSG_CHATTING msg; msg.handle = 0; msg.nChatType = CHAT_NOTICE; msg.szSender = "@NOTICE"; msg.strText = str; if( m_pGameMng ) m_pGameMng->ProcMsgAtStatic( &msg ); } /// 2010.11.15 안쓰여서 주석처리 함- prodongi /* if( strnicmp( pMsg->strText.c_str(), "~~kick", strlen("~~kick") ) == 0 ) { if( m_pGameMng ) m_pGameMng->CloseToServer( true ); } */ if( strnicmp( pMsg->strText.c_str(), "~~pknotall", strlen("~~pknotall") ) == 0 ) { m_nAttackLimit = 0; } if( strnicmp( pMsg->strText.c_str(), "~~pkall", strlen("~~pkall") ) == 0 ) { m_nAttackLimit = LIMIT_MOB|LIMIT_PLAYER|LIMIT_SUMMON; } if( strnicmp( pMsg->strText.c_str(), "~~pkplayer", strlen("~~pkplayer") ) == 0 ) { m_nAttackLimit = LIMIT_MOB|LIMIT_PLAYER; } if( strnicmp( pMsg->strText.c_str(), "~~pkmob", strlen("~~pkmob") ) == 0 ) { m_nAttackLimit = LIMIT_MOB; } if( strnicmp( pMsg->strText.c_str(), "~~pksummon", strlen("~~pksummon") ) == 0 ) { m_nAttackLimit = LIMIT_MOB|LIMIT_SUMMON; } if( ( strnicmp( pMsg->strText.c_str(), "~~bgm", strlen("~~bgm") ) == 0 ) && vString.size() >= 2 ) { bool bLoop = false; if( vString.size() >= 3 ) { if( strnicmp( vString[2].c_str(), "loop", strlen("loop") ) == 0 ) bLoop = true; } #ifdef NDEBUG if( m_pMSoundMgr ) m_pMSoundMgr->PlayMusic( KFileManager::Instance().GetFullPathNameFromResource( vString[1].c_str() ).c_str(), 100, bLoop ); #endif } if( pMsg->strText == "~~ANI_ANGRY" ) m_pCommandSystem->PlayerEmotion( 0, ANI_ANGRY ); if( pMsg->strText == "~~ANI_APOLOGIZE" ) m_pCommandSystem->PlayerEmotion( 0, ANI_APOLOGIZE ); if( pMsg->strText == "~~ANI_BORING" ) m_pCommandSystem->PlayerEmotion( 0, ANI_BORING ); if( pMsg->strText == "~~ANI_BOW" ) m_pCommandSystem->PlayerEmotion( 0, ANI_BOW ); if( pMsg->strText == "~~ANI_CHEER" ) m_pCommandSystem->PlayerEmotion( 0, ANI_CHEER ); if( pMsg->strText == "~~ANI_CLAP" ) m_pCommandSystem->PlayerEmotion( 0, ANI_CLAP ); if( pMsg->strText == "~~ANI_DANCE" ) m_pCommandSystem->PlayerEmotion( 0, ANI_DANCE ); if( pMsg->strText == "~~ANI_HAPPY" ) m_pCommandSystem->PlayerEmotion( 0, ANI_HAPPY ); if( pMsg->strText == "~~ANI_HI" ) m_pCommandSystem->PlayerEmotion( 0, ANI_HI ); if( pMsg->strText == "~~ANI_NO" ) m_pCommandSystem->PlayerEmotion( 0, ANI_NO ) ; if( pMsg->strText == "~~ANI_POUT" ) m_pCommandSystem->PlayerEmotion( 0, ANI_POUT ); if( pMsg->strText == "~~ANI_PROVOKE" ) m_pCommandSystem->PlayerEmotion( 0, ANI_PROVOKE ); if( pMsg->strText == "~~ANI_SORROW" ) m_pCommandSystem->PlayerEmotion( 0, ANI_SORROW ); if( pMsg->strText == "~~ANI_YES" ) m_pCommandSystem->PlayerEmotion( 0, ANI_YES ); if( pMsg->strText == "~~ANI_PRAY" ) m_pCommandSystem->PlayerEmotion( 0, ANI_PRAY ); } vString.clear(); } } void SGameWorld::After_Login( SMSG_LOGIN* pMsg ) { if( m_bIsLogined ) return; m_bIsLogined = true; m_nCell_Size = pMsg->cell_size; SGameAvatarEx * pAvatar = m_pCommandSystem->GetLocalPlayer(); m_pGameSystem->SetLocalPlayer( pAvatar ); if (!pAvatar) return ; // MJ 2004/12/22 옵션 메니저에 이름 보낸다 GetGameOption().Load( pAvatar->GetName() ); bool bPlayEventScene = false; std::string strCameraWorkName; //캐릭터 생성 위치 조정 //2009-04-13:hunee //지정된 카메라 설정 //if( pMsg->x == 165053 && pMsg->y == 52715 ) //데바 유시스 164905 52795 if( pMsg->x == 164474 && pMsg->y == 52932 ) //데바 유시스 164905 52795 { if(pAvatar->GetArClient()) pAvatar->GetArClient()->GetMyPos().SetDirection( ArPosition(164476, 52931) ); //카메라를 보고 서있게 수정함 2009.04.28 sfreer initCamera( "start_deva_cam.txt" ); strCameraWorkName = "deva_start.nfk"; bPlayEventScene = true; } //else if( pMsg->x == 168299 && pMsg->y == 54621 ) //아수라 아로셀 168293 54836 else if( pMsg->x == 168356 && pMsg->y == 55399 ) //아수라 아로셀 168293 54836 { if(pAvatar->GetArClient()) pAvatar->GetArClient()->GetMyPos().SetDirection( ArPosition(168362, 55349) ); //카메라를 보고 서있게 수정함 2009.04.28 sfreer 2 initCamera( "start_asura_cam.txt" ); strCameraWorkName = "asura_start.nfk"; bPlayEventScene = true; } //else if( pMsg->x == 165699 && pMsg->y == 49757 ) //가이아 카노프스 166523 48097 else if( pMsg->x == 164335 && pMsg->y == 49510 ) //가이아 카노프스 166523 48097 { if(pAvatar->GetArClient()) pAvatar->GetArClient()->GetMyPos().SetDirection( ArPosition(164352, 49511) ); //카메라를 보고 서있게 수정함 2009.04.28 sfreer initCamera( "start_gaia_cam.txt" ); strCameraWorkName = "gaia_start.nfk"; bPlayEventScene = true; } else { //캐릭터의 마지막 시점으로 카메라 설정 // sonador 0.2.4 (중국)고정 카메라 클라이언트 제작 #if !defined( _FIXED_CAMERA_MODE ) // static bool isFixedCaemraMode = ENV().IsExist( "fixed_camera" ); if( pAvatar /*&& ! isFixedCaemraMode*/ ) { const char * pName = pAvatar->GetName(); SetGameCameraforFile( CStringUtil::StringFormat( "%s\\%s_cam.txt", g_strModulePath.c_str(), pName ).c_str() ); } #endif } //bPlayEventScene = false; if( bPlayEventScene ) { const CTerrainSeamlessWorldInfo* pSeamlessInfo = m_pTerrainMapEngine->GetSeamlessWorldInfo(); if( pSeamlessInfo ) { float fMapLen = float( pSeamlessInfo->GetTileCountPerSegment() ) * float(pSeamlessInfo->GetSegmentCountPerMap() ) * pSeamlessInfo->GetTileLength(); int nPosX = pMsg->x / fMapLen; int nPosY = pMsg->y / fMapLen; SGameCameraWork* pCameraWork = new SGameCameraWork( this, m_pGameCamera ); pCameraWork->LoadCameraWork( strCameraWorkName.c_str(), nPosX, nPosY, fMapLen ); K3DVector cpos; m_pGameCamera->GetCamera()->GetCamPos( cpos.x, cpos.y, cpos.z ); m_pSky->SetPosition(cpos.x, cpos.y, cpos.z ); /* K3DVector cpos, lpos; m_pCamera->GetCamPos( cpos.x, cpos.y, cpos.z ); m_pCamera->GetTargetPos( lpos.x, lpos.y, lpos.z ); K3DVector vCenter = (lpos - cpos) / 2.0f; vCenter = lpos + vCenter; float fHeight = lpos.z; if( lpos.z < cpos.z ) { fHeight = ( cpos.z - lpos.z )/ 2.0f; fHeight = lpos.z + fHeight; } //m_pSky->SetPosition(vCenter.x, vCenter.y, lpos.z + fHeight ); //m_pSky->SetPosition(lpos.x, lpos.y, lpos.z ); m_pSky->SetPosition(cpos.x, cpos.y, cpos.z ); */ if( GetGameRef() == STAGE_ING ) { SetGameRef( STAGE_EVENT_SCENE ); ShowInterface( false ); } } } m_fCamera_Z_Offset = CAMERA_Z_OFFSET; switch( pMsg->race ) { case GAME_DEFINE::GCLAN_GAIA: { if( pMsg->sex == SEX_FEMALE ) m_fCamera_Z_Offset = CAMERA_Z_OFFSET_GAIA_F; else if( pMsg->sex == SEX_MALE ) m_fCamera_Z_Offset = CAMERA_Z_OFFSET_GAIA_M; } break; case GAME_DEFINE::GCLAN_DEVA: { if( pMsg->sex == SEX_FEMALE ) m_fCamera_Z_Offset = CAMERA_Z_OFFSET_DEVA_F; else if( pMsg->sex == SEX_MALE ) m_fCamera_Z_Offset = CAMERA_Z_OFFSET_DEVA_M; } break; case GAME_DEFINE::GCLAN_ASURA: { if( pMsg->sex == SEX_FEMALE ) m_fCamera_Z_Offset = CAMERA_Z_OFFSET_ASURA_F; else if( pMsg->sex == SEX_MALE ) m_fCamera_Z_Offset = CAMERA_Z_OFFSET_ASURA_M; } break; } m_pGameCamera->SetTargetZOffSet( m_fCamera_Z_Offset ); if( m_pTerrainMapEngine ) m_pTerrainMapEngine->CreateAttributePolygonInfoForMap( pMsg->x, pMsg->y ); #ifdef _USE_XTRAP_MODULE XTrap_C_SetUserInfoEx((char*)g_UserInfo.GetAccountName(), (char*)g_UserInfo.GetSelServerName(), pMsg->szName, (char*)g_UserInfo.GetClassName(), g_UserInfo.GetLevel(), 0); #endif } void SGameWorld::SetGameCameraforFile( const char* pFileName ) { FILE* pF = fopen( pFileName, "rt" ); if( pF ) { // 데이터 파일 크기 세팅 fseek( pF, 0, SEEK_END ); size_t fsize = ftell( pF ); fseek( pF, 0, SEEK_SET ); char *pBuf = new char[fsize]; fread( pBuf, sizeof(char)*fsize, 1, pF ); m_pGameCamera->FileTextIn(pBuf, g_bUserCamMode); delete [] pBuf; fclose( pF ); } } //꺼졌다 켜졌다 기능과, 처음 상태 유지 기능이 필요... void SGameWorld::ShowInterface( bool bShow ) { // 모든 윈도우에 워프 상태 알려준다 m_pGameMng->InterfaceMsg( &SIMSG_UI_OPEN_UPDATE( bShow ) ); } const float _3D_SOUND_LIMIT = 10 * GameRule::DEFAULT_UNIT_SIZE; //Sound int SGameWorld::StartSound( const char * pSoundName ) { if( strlen( pSoundName ) <= 4 || !KFileManager::Instance().IsValidResource( pSoundName ) ) return -1; return m_pMSoundMgr->StartSound( pSoundName, 100 ); } int SGameWorld::StartSound( SGameAvatarEx* pCaster, const char * pSoundName, K3DVector pos, bool bUse3D, int nVolume, bool bLoop, bool bSoundOption[SOUND_OP_MAX] ) { std::string str = pSoundName; if( pCaster ) { if( pCaster->IsLocalPlayer() || pCaster->IsLocalCreature() ) { bSoundOption[SOUND_OP_LOWPASS] = false; if( bSoundOption[SOUND_OP_STEREO] ) str += "_stereo.wav"; } else { if( bSoundOption[SOUND_OP_STEREO] ) str += ".wav"; } } if( strlen( str.c_str() ) <= 4 || !KFileManager::Instance().IsValidResource( str.c_str() ) ) return -1; #ifdef _DEV if( g_bReverbEnable ) bSoundOption[SOUND_OP_REVERB] = true; if( g_bLowPassFilterEnable ) bSoundOption[SOUND_OP_LOWPASS] = true; #endif int vol = m_pMSoundMgr->GetSfxVolume(); if (nVolume>0) nVolume = vol * nVolume /100; return m_pMSoundMgr->PlaySound3D( str.c_str(), pos.x, pos.y, pos.z, nVolume, bLoop, bSoundOption[SOUND_OP_REVERB], bSoundOption[SOUND_OP_LOWPASS] ); } int SGameWorld::StartSound( const char * pSoundName, K3DVector pos ) { if( strlen( pSoundName ) <= 4 || !KFileManager::Instance().IsValidResource( pSoundName ) ) return -1; return m_pMSoundMgr->PlaySound3D( pSoundName, pos.x, pos.y, pos.z, 100, false, false, false ); } void SGameWorld::StopSound( const char * pSoundName, int nPlayIdx ) { m_pMSoundMgr->StopSound( pSoundName ); } //Cheat void SGameWorld::After_Warp ( SCMSG_WARP* pMsg ) { // 2011. 11. 29 - marine 거래요청 메세지 박스가 떠 있는 상태에서 워프하게 되면 메세지 박스를 닫는다. m_pGameMng->GetGameInterface()->CloseMessgeBoxWithID(SIMSG_REQ_OPEN_MSGBOX::MSGBOX_TRADEJOINCHECK); m_pGameMng->SetShowLoadingWnd( true, pMsg->x, pMsg->y ); // AziaMafia Delete Loading m_pGameMng->StartSound( "ui_click_teleport01.wav" ); //텔레포트 이동음 SGameLocalCreature::SetIdleProcess( false ); _oprint( "[Warp started] After_Warp: %f, %f\n", pMsg->x, pMsg->y ); SGameObject::Deactivate(); // assert( _CrtCheckMemory() && "Memory Error!!!" ); //머리 이름 감추기 m_pGameMng->ProcMsgAtStatic( &SIMSG_UI_NAME_TEXT(false) ); // assert( _CrtCheckMemory() && "Memory Error!!!" ); AllDelEffect(); // Delete all effects // AziaMafia Delete Loading // assert( _CrtCheckMemory() && "Memory Error!!!" ); //워터, 쉐도우 뷰포트 클리어 if( m_pViewPort ) m_pViewPort->AllViewPortClear(); // assert( _CrtCheckMemory() && "Memory Error!!!" ); //지형 클리어 if( m_pTerrainMapEngine ) m_pTerrainMapEngine->WarpClear( pMsg->x, pMsg->y ); // assert( _CrtCheckMemory() && "Memory Error!!!" ); //게임 상태 변경. SetGameRef( STAGE_MAP_LOAD_BUFFER ); // AziaMafia Delete Loading m_fFade_Visibility = 1.f; // AziaMafia Delete Loading m_dwFadeTime = 0; // AziaMafia Delete Loading //기존 Effect 모두 삭제 _AllDelEffect(); // AziaMafia Delete Loading // assert( _CrtCheckMemory() && "Memory Error!!!" ); // SGameAvatarEx::SetThreadLoad( false ); // assert( _CrtCheckMemory() && "Memory Error!!!" ); int nRand = /*rand()%9+*/1; //01~09 중 랜덤 std::string strTmp; XStringUtil::Format( strTmp, "loading0%d", nRand ); // sprintf( strTmp, "loading0%d", nRand ); initLoadModel(); // assert( _CrtCheckMemory() && "Memory Error!!!" ); m_nWarpX = pMsg->x; m_nWarpY = pMsg->y; m_pCommandSystem->SetSkyType( 1/*그림자 감추기*/ ); if( !g_bUserCamMode ) m_pCamera->SetTargetPos( pMsg->x, pMsg->y, 0.f ); //순서 문제 있음. m_pArObject->onWarp( pMsg->x, pMsg->y, pMsg->z ); m_pArObject->SetLayer( pMsg->layer ); // assert( _CrtCheckMemory() && "Memory Error!!!" ); m_pCommandSystem->OnWarp(); SGameAvatarEx* pPlayer = m_pGameSystem->GetLocalPlayer(); if( pPlayer ) { pPlayer->GetArObject().layer = pMsg->layer; pPlayer->ClearPendingNextState(); } // assert( _CrtCheckMemory() && "Memory Error!!!" ); //warp되면서 타겟창등의 윈도우를 꺼주는데도 타겟은 살아있어서 TargetStateWnd가 혼자 덜렁 랜더링 걸려서 타겟을 취소시킨다 -N4- m_pGameSystem->SetTarget(NULL); ShowInterface( false ); // AziaMafia Delete Loading // assert( _CrtCheckMemory() && "Memory Error!!!" ); SetMinimapInfo( K3DVector( pMsg->x, pMsg->y, pMsg->z ) ); // assert( _CrtCheckMemory() && "Memory Error!!!" ); LoadWayPoint( K3DVector( pMsg->x, pMsg->y, pMsg->z ) ); //Routes waypoint dans votre région // assert( _CrtCheckMemory() && "Memory Error!!!" ); if( m_pTerrainMapEngine ) m_pTerrainMapEngine->ResetLocationInfo(); // assert( _CrtCheckMemory() && "Memory Error!!!" ); m_vPositionForWater = K3DVector( 0.0f, 0.0f, 0.0f ); // if( m_pMSoundMgr ) // { // m_pMSoundMgr->StopBgm(); // m_pMSoundMgr->StopMusic(); // } } //2012. 2. 20 - marine 거래, 노점, 상점, 경매장 이 열려있는 경우에 사용되면 안되는 단축키 가 있는데 // 이 창들이 열려있는지 확인 bool SGameWorld::IsBlockedHotKey() { return m_pGameMng->GetGameInterface()->IsAgainstUiOpen(); } void SGameWorld::ProcHotKeyEx ( SIMSG_HOTKEY_EX* pMsg ) { /// 2010.11.10 - prodongi //#ifdef _DEV // extern bool g_bDebugMode; //#endif // extern bool g_bRenderUI; //2011.07.20 - servantes : 함수 밖으로 뺀다 if( GetGameRef() == STAGE_LOADING || GetGameRef() == STAGE_MAP_LOADING ) return; if ( m_bVisualDropItem ) // 드랍아이템을 보여줍니다. { SIMSG_UI_DROP_ALL_ITEM_NAME msg; msg.bShow = false; m_pGameMng->InterfaceMsg( &msg ); m_bVisualDropItem = FALSE; } // _oprint( "새로운 핫키~\n" ); if( !pMsg->bUp ) //Key Down 만 처리 { if ( pMsg->bAlt ) // 드랍아이템을 보여줍니다. { SIMSG_UI_DROP_ALL_ITEM_NAME msg; msg.bShow = true; m_pGameMng->InterfaceMsg( &msg ); m_bVisualDropItem = TRUE; } /// 2010.11.10 - prodongi //#ifdef _DEV if (g_UserInfo.isMonkeyTail()) { extern bool g_bDebugMode; if( g_bDebugMode && ( GetKeyState( VK_SCROLL ) & 0x01 ) ) { if( pMsg->bAlt && pMsg->bCtrl && ( LOWORD(pMsg->wParam ) == '1' ) ) { SetCheatMode( CHEAT_NONE ); AddDebugMessage( "Damage Effect Normal" ); return; } if( pMsg->bAlt && pMsg->bCtrl && ( LOWORD(pMsg->wParam ) == '2' ) ) { SetCheatMode( CHEAT_MODE01 ); AddDebugMessage( "Damage Effect Critical" ); return; } if( pMsg->bAlt && pMsg->bCtrl && ( LOWORD(pMsg->wParam ) == '3' ) ) { SetCheatMode( CHEAT_MODE02 ); AddDebugMessage( "Damage Effect PlusAlpha" ); return; } if( pMsg->bAlt && pMsg->bCtrl && ( LOWORD(pMsg->wParam ) == 'T' ) ) { m_bTerrainRender = !m_bTerrainRender; AddDebugMessage( "Terrain Render : %s", (m_bTerrainRender ? "비활성" : "활성") ); return; } if( pMsg->bAlt && pMsg->bCtrl && ( LOWORD(pMsg->wParam ) == VK_SPACE ) ) { m_bTerrainProc = !m_bTerrainProc; m_bTerrainRender = m_bTerrainProc; AddDebugMessage( "Terrain All Process : %s", (m_bTerrainProc ? "비활성" : "활성") ); return; } unsigned short pp = LOWORD(pMsg->wParam); if( pMsg->bCtrl && ( pp=='N')) { memset(g_pTextureMode,0,sizeof(g_pTextureMode)); #ifdef _DEV _TextureModeReload(); _TextureModeBuild(); _EnhanceColorReload(); #endif for (int i=0;i<7;i++) { KTextureManager::GetManager()->RemoveTexture(_spSpecular[i]); } NX3LoadPack loadpack; loadpack.Init(); _spSpecular[0]= KTextureManager::GetManager()->GetTexture( "spec_01.dds",&loadpack,TRUE,0); _spSpecular[1]= KTextureManager::GetManager()->GetTexture( "spec_02.dds",&loadpack,TRUE,0); _spSpecular[2]= KTextureManager::GetManager()->GetTexture( "spec_03.dds",&loadpack,TRUE,0); _spSpecular[3]= KTextureManager::GetManager()->GetTexture( "spec_04.dds",&loadpack,TRUE,0); _spSpecular[4]= KTextureManager::GetManager()->GetTexture( "spec_30.dds",&loadpack,TRUE,0); _spSpecular[5]= KTextureManager::GetManager()->GetTexture( "spec_40.dds",&loadpack,TRUE,0); _spSpecular[6]= KTextureManager::GetManager()->GetTexture( "spec_50.dds",&loadpack,TRUE,0); } if( pMsg->bCtrl && ( pp=='Z' || pp == 'X' || pp== 'C' || pp == 'V' || pp == 'B' ) ) { int spec =0; if ( pp == 'Z' ) {m_pViewPort->m_nSpecularFactor = m_pViewPort->m_nSpecularFactor++;} if ( pp == 'X' ) {m_pViewPort->m_nSpecularColor = m_pViewPort->m_nSpecularColor++;} if ( pp == 'C' ) spec = 1; // 디폴트 if ( pp == 'V' ) spec = 2; // 테스트 if ( pp == 'B' ) spec = 3; // m_pViewPort->SetUseSpecular( 3); if (spec) m_pViewPort->SetUseSpecular(spec); m_pViewPort->m_nSpecularFactor = (m_pViewPort->m_nSpecularFactor)%6; m_pViewPort->m_nSpecularColor = (m_pViewPort->m_nSpecularColor)%5; spec = m_pViewPort->GetUseSpecular(); if ( spec==1) AddDebugMessage( "DEFAULT: (Factor:1 Color:1)"); if ( spec==2) AddDebugMessage( "TEST: (Factor:%d Color:%d)",m_pViewPort->m_nSpecularFactor,m_pViewPort->m_nSpecularColor ); if ( spec==3) AddDebugMessage( "MIXED: (Factor:%d Color:%d)",m_pViewPort->m_nSpecularFactor,m_pViewPort->m_nSpecularColor ); return; } if( pMsg->bAlt && pMsg->bCtrl && ( LOWORD( pMsg->wParam ) == 'E' ) && _IsEnvironmentConfigMode() ) { LoadEnvironmentScript(); return; } if(pMsg->bCtrl && ( LOWORD(pMsg->wParam ) == 'Q' ) ) { static int draw_attribute = 0; draw_attribute = !draw_attribute; m_pTerrainMapEngine->SetDrawAttributePolygon(draw_attribute); } //if( pMsg->bAlt && pMsg->bCtrl && ( LOWORD(pMsg->wParam ) == 'H' ) ) //{ // m_bHDR = !m_bHDR; // m_pViewPort->SetUseHDR( m_bHDR ); // AddDebugMessage( "HDR-Cross Filter : %s", (m_bHDR ? "활성" : "비활성") ); // return; //} if( ( pMsg->bAlt && pMsg->bCtrl && LOWORD(pMsg->wParam ) == VK_PRIOR ) ) { //Debug Out 윈도우 토글 if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DEVOUTPUT ) ); } if( ( pMsg->bAlt && pMsg->bCtrl && LOWORD(pMsg->wParam ) == VK_INSERT ) ) { //동영상 제작 지원용으로 사용 중... g_bRenderUI = !g_bRenderUI; ShowInterface( g_bRenderUI ); //Debug Out 윈도우는 켠다. //if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DEVOUTPUT ) ); } if( ( LOWORD(pMsg->wParam ) == VK_NUMPAD5 ) ) { m_dwCameraVibrateTimeDueTime = GetSafeTickCount() + 300; // 300ms 간 카메라 진동 if( g_bUserCamMode ) { m_nDeltaSpeed++; if( m_nDeltaSpeed > 11 ) m_nDeltaSpeed = 1; AddDebugMessage( "DeltaSpeed - %d", m_nDeltaSpeed ); } } if( ( LOWORD(pMsg->wParam ) == VK_NUMPAD1 ) ) { m_fDeltaX -= 0.1f; if( m_fDeltaX <= 0.f ) m_fDeltaX = 0.1f; AddDebugMessage( "fDeltaX - %f", m_fDeltaX ); } if( ( LOWORD(pMsg->wParam ) == VK_NUMPAD3 ) ) { m_fDeltaY -= 0.1f; if( m_fDeltaY <= 0.f ) m_fDeltaY = 0.1f; AddDebugMessage( "fDeltaY - %f", m_fDeltaY ); } if( ( LOWORD(pMsg->wParam ) == VK_NUMPAD7 ) ) { m_fDeltaX += 0.1f; if( m_fDeltaX >= 1.f ) m_fDeltaX = 1.f; AddDebugMessage( "fDeltaX - %f", m_fDeltaX ); } if( ( LOWORD(pMsg->wParam ) == VK_NUMPAD9 ) ) { m_fDeltaY += 0.1f; if( m_fDeltaY >= 1.f ) m_fDeltaY = 1.f; AddDebugMessage( "fDeltaY - %f", m_fDeltaY ); } if( ( LOWORD(pMsg->wParam ) == VK_NUMPAD8 ) ) { m_nDeltaY+=100; if( m_nDeltaY > 4096 ) m_nDeltaY = 4096; AddDebugMessage( "DeltaY - %d", m_nDeltaY ); } if( ( LOWORD(pMsg->wParam ) == VK_NUMPAD2 ) ) { m_nDeltaY-=100; if( m_nDeltaY <= 0 ) m_nDeltaY = 1; AddDebugMessage( "DeltaY - %d", m_nDeltaY ); } if( ( LOWORD(pMsg->wParam ) == VK_NUMPAD4 ) ) { m_nDeltaX-=100; if( m_nDeltaX <= 0 ) m_nDeltaX = 1; AddDebugMessage( "DeltaX - %d", m_nDeltaX ); } if( ( LOWORD(pMsg->wParam ) == VK_NUMPAD6 ) ) { m_nDeltaX+=100; if( m_nDeltaX > 4096 ) m_nDeltaX = 4096; AddDebugMessage( "DeltaX - %d", m_nDeltaX ); } if( ( LOWORD(pMsg->wParam ) == VK_DELETE ) ) { m_fDeltaX = 1.f; m_fDeltaY = 1.f; m_nDeltaX = 512; m_nDeltaY = 512; AddDebugMessage( "DeltaX - %d, DeltaY - %d", m_nDeltaX, m_nDeltaY ); } if( ( LOWORD(pMsg->wParam ) == VK_NUMPAD1 ) ) { if( !g_bUserCamMode ) m_pCamera->Turn( (float)(-(float)(-2.f) * 3.14/m_nDeltaX) ); } if( ( LOWORD(pMsg->wParam ) == VK_NUMPAD3 ) ) { if( !g_bUserCamMode ) m_pCamera->Turn( (float)(-(float)( 2.f) * 3.14/m_nDeltaX) ); } } else { /* bool bEnterChat = GetGameOption().IsEnterChat(); bool bNoneFocusEdit = KUIControlEdit::IsNobodyHasFocus(); if( m_pGameMng->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CASH_TITLE ) || m_pGameMng->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_TITLE ) || m_pGameMng->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_POPURL_TITLE ) ) { //Web 윈도우가 오픈되어 있을 경우, 윈도우 오픈하는 핫키 스킵 된다. bEnterChat = false; } if( pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'G' ) ) { if( m_pGameMng->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_TITLE ) ) { m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_TITLE, false) ); m_pGameMng->PostMsgAtDynamic( new SMSG_SEND_DATA( "close_guild_web" ) ); } else { if( m_pCommandSystem && m_pCommandSystem->GetLocalPlayer() ) { RqChatting( CHAT_NORMAL, m_pCommandSystem->GetLocalPlayer()->GetName(), "/gopen" ); } } return; } //ALT + '~' if( pMsg->bAlt && ( LOWORD(pMsg->wParam ) == VK_OEM_3 ) ) { if( m_pGameMng ) { //인벤토리 m_pGameMng->InterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY , true) ); if( ENV().IsExist( "commercial_shop" ) == true ) { //캐쉬창고 m_pGameMng->PostMsgAtDynamic( new SMSG_CHAT_COMMAND(SMSG_CHAT_COMMAND::CHAT_CASHSTORAGE_OPEN) ); //쿠르샵 오픈 if( !m_pGameMng->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CASH_TITLE ) && !m_pGameMng->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_TITLE ) && !m_pGameMng->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_TITLE ) && !m_pGameMng->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_POPURL_TITLE ) ) { m_pGameMng->PostMsgAtDynamic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_CASHSHOP_OPEN, S(944), true ) ); } //한번에 열기 // m_pGameMng->PostMsgAtDynamic( new SMSG_CHAT_COMMAND( SMSG_CHAT_COMMAND::CHAT_CASHSHOP_OPEN ) ); } } } if( pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'I' ) || pMsg->bAlt && ( LOWORD(pMsg->wParam ) == VK_SPACE ) || // if( !bEnterChat && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'I' ) || // !bEnterChat && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == VK_SPACE ) || // !bEnterChat && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == VK_OEM_3 ) || bEnterChat && bNoneFocusEdit && ( LOWORD(pMsg->wParam ) == 'I' ) ) // bEnterChat && bNoneFocusEdit && ( LOWORD(pMsg->wParam ) == 'I' ) || // bEnterChat && bNoneFocusEdit && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'I' ) || // bEnterChat && bNoneFocusEdit && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == VK_SPACE ) || // bEnterChat && bNoneFocusEdit && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == VK_OEM_3 ) ) { //인벤토리 if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY ) ); } // else if( !bEnterChat && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'C' ) || // !bEnterChat && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'A' ) || else if( pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'C' ) || pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'A' ) || // bEnterChat && bNoneFocusEdit && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'C' ) || // bEnterChat && bNoneFocusEdit && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'A' ) || bEnterChat && bNoneFocusEdit && ( LOWORD(pMsg->wParam ) == 'C' ) || bEnterChat && bNoneFocusEdit && ( LOWORD(pMsg->wParam ) == 'C' ) ) { //캐릭터 창 if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CHARINFO ) ); } else if( pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'F' ) || // else if( !bEnterChat && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'F' ) || // bEnterChat && bNoneFocusEdit && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'F' ) || bEnterChat && bNoneFocusEdit && ( LOWORD(pMsg->wParam ) == 'F' ) ) { //메신저 창, 아직 윈도우 없음 if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_COMMUNITY ) ); } // 월드맵 else if( pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'M' ) || // else if( !bEnterChat && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'M' ) || // bEnterChat && bNoneFocusEdit && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'M' ) || bEnterChat && bNoneFocusEdit && ( LOWORD(pMsg->wParam ) == 'M' ) ) { if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_WORLDMAP ) ); } // 월드맵 확대 else if( pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'N' ) || // else if( !bEnterChat && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'N' ) || // bEnterChat && bNoneFocusEdit && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'N' ) || bEnterChat && bNoneFocusEdit && ( LOWORD(pMsg->wParam ) == 'N' ) ) { // if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_WORLDMAP ) ); } else if( pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'R' ) || // else if( !bEnterChat && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'R' ) || // bEnterChat && bNoneFocusEdit && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'R' ) || bEnterChat && bNoneFocusEdit && ( LOWORD(pMsg->wParam ) == 'R' ) ) { //크리쳐 if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE ) ); } else if( pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'Q' ) || // else if( !bEnterChat && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'Q' ) || // bEnterChat && bNoneFocusEdit && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'Q' ) || bEnterChat && bNoneFocusEdit && ( LOWORD(pMsg->wParam ) == 'Q' ) ) { //퀘스트 창 if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_LIST ) ); } // else if( pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'S' ) || // else if( !bEnterChat && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'S' ) || // bEnterChat && bNoneFocusEdit && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'S' ) || // bEnterChat && bNoneFocusEdit && ( LOWORD(pMsg->wParam ) == 'S' ) ) else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::SKILL) > 0 ) { //스킬 if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SKILL ) ); } else if( pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'O' ) || // else if( !bEnterChat && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'O' ) || // bEnterChat && bNoneFocusEdit && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'O' ) || bEnterChat && bNoneFocusEdit && ( LOWORD(pMsg->wParam ) == 'O' ) ) { //옵션 if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SYSTEM ) ); } else if( pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'Y' ) || bEnterChat && bNoneFocusEdit && ( LOWORD(pMsg->wParam ) == 'Y' ) ) { //크리쳐 편성 창 if( m_pGameMng->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM ) ) { m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM, false) ); } else { if( m_pGameMng ) m_pGameMng->ProcMsgAtStatic( &SMSG_SEND_DATA( "req_summon_formation" ) ); } } else if( pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'E' ) || bEnterChat && bNoneFocusEdit && ( LOWORD(pMsg->wParam ) == 'E' ) ) { if( !m_pGameMng->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL ) ) { m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE, true ) ); m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_PAGE, false ) ); m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, true ) ); } else { // sonador // 크리처 스킬창이 닫힐때 크리처 정보창은 닫히지 않도록 수정 //m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE, false ) ); m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_PAGE, false ) ); m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, false ) ); } } else if( pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'Z' ) || // else if( !bEnterChat && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'Z' ) || // bEnterChat && bNoneFocusEdit && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'Z' ) || bEnterChat && bNoneFocusEdit && ( LOWORD(pMsg->wParam ) == 'Z' ) ) { //시스템 if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SYSTEM_MAIN ) ); } else if( pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'T' ) || // else if( !bEnterChat && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'T' ) || // bEnterChat && bNoneFocusEdit && pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'T' ) || bEnterChat && bNoneFocusEdit && ( LOWORD(pMsg->wParam ) == 'T' ) ) { //조작 if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MOTION ) ); } else if( pMsg->bCtrl && ( LOWORD(pMsg->wParam ) == 'F' ) ) { //페이스컷 if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_TARGETPORTRAIT ) ); } else if( pMsg->bAlt && ( LOWORD(pMsg->wParam ) == 'P' ) || bEnterChat && bNoneFocusEdit && ( LOWORD(pMsg->wParam ) == 'P' ) ) { //파티창 if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY ) ); } // 크리쳐 퀵슬롯 #ifndef NDEBUG #define _COMMUNITY #ifdef _COMMUNITY else if( pMsg->bCtrl && ( LOWORD(pMsg->wParam ) == '2' ) ) { //친구창 if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_FRIEND ) ); } else if( pMsg->bCtrl && ( LOWORD(pMsg->wParam ) == '3' ) ) { //차단 리스트 if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CUT ) ); } #endif #endif else if( pMsg->bAlt && ( LOWORD(pMsg->wParam) == '1' ) ) { } else if( pMsg->bAlt && ( LOWORD(pMsg->wParam) == '2' ) ) { } else if( pMsg->bAlt && ( LOWORD(pMsg->wParam) == '3' ) ) { } else if( pMsg->bAlt && ( LOWORD(pMsg->wParam) == '4' ) ) { } else if( pMsg->bAlt && ( LOWORD(pMsg->wParam) == '5' ) ) { } else if( pMsg->bAlt && ( LOWORD(pMsg->wParam) == '6' ) ) { } else if( pMsg->bAlt && ( LOWORD(pMsg->wParam) == '7' ) ) { } else if( pMsg->bAlt && ( LOWORD(pMsg->wParam) == '8' ) ) { } else if( pMsg->bAlt && ( LOWORD(pMsg->wParam) == '9' ) ) { } else if( pMsg->bAlt && ( LOWORD(pMsg->wParam) == '0' ) ) { // if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_UI_CHAT_OPTION( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CHATTING, 6 ) ); } else if( pMsg->bTab ) //비공식 가까운 타겟 선택 // else if( GetGameOption().GetTapKeyType() == 0 && pMsg->bTab ) //비공식 가까운 타겟 선택(이제 tab키에 관한 타입이 없기 때문에 주석) { SGameAvatarEx * pTarget = m_pCommandSystem->GetNextTarget( c_nTARGET_MAX_LEN, m_bIsResetTargetList ); m_bIsResetTargetList = false; if( pTarget ) m_pGameSystem->SetTarget( pTarget ); } else if( pMsg->bAlt && ( LOWORD(pMsg->wParam) == 'H' ) ) { //Help Web ToggleHelpWindow(); } if( ( pMsg->bCtrl && LOWORD(pMsg->wParam ) == 'H' ) ) { //공식지원 메인 UI & 캐릭터 이름 숨기기 g_bRenderUI = !g_bRenderUI; if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_UI_NAME_TEXT(g_bRenderUI) ); ShowInterface( g_bRenderUI ); if( g_bRenderUI ) { SGameAvatarEx* pTarget = m_pGameSystem->GetTarget(); if( pTarget ) m_pGameSystem->SetTarget( pTarget ); } } if( ( pMsg->bCtrl && pMsg->bShift && LOWORD(pMsg->wParam ) == 'P' ) ) { if( m_pCommandSystem->GetLocalPlayer() ) { if( m_pCommandSystem->GetLocalPlayer()->GetStatus() & TS_ENTER::PlayerInfo::FLAG_PK_ON ) { TS_CS_TURN_OFF_PK_MODE msg; SendMsg( &msg ); } else { TS_CS_TURN_ON_PK_MODE msg; SendMsg( &msg ); } } return; } if( ( !pMsg->bShift && !pMsg->bAlt && !pMsg->bCtrl && LOWORD(pMsg->wParam ) == VK_RETURN ) ) { if( g_bRenderUI == true ) return; g_bRenderUI = true; if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_UI_NAME_TEXT(g_bRenderUI) ); ShowInterface( g_bRenderUI ); } else if( ( LOWORD(pMsg->wParam ) == VK_ESCAPE ) ) { _oprint( "VK_ESCAPE down\n" ); ResetAutoFollowMode(); //뭔가 취소가 일어 난다. if( m_pGameSystem ) { SGameAvatarEx* pTarget = m_pGameSystem->GetTarget(); if( pTarget && pTarget->GetObjType() == TS_ENTER::GAME_NPC ) { if( m_pGameMng ) { m_pGameMng->ProcMsgAtStatic( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_NPCDIALOG, false ) ); m_pGameMng->ProcMsgAtStatic( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_REWARD, false ) ); } } SIMSG_UI_ACT_USECOMMAND msg; msg.nType = IMSG_UI_ACT_USECOMMAND; msg.nCmdID = MOTION_CAST_CANCEL; m_pGameSystem->ProcMsgAtStatic( &msg ); m_pGameSystem->UseEscCommand(); //// //// 열려있는 stat창을 모두 닫는다 //// 위에서 ESC키가 처리 되었는지 알 방법이 있으면 좋을텐데... 없으므로 일단 강제로 닫는다 //// // //if( m_pGameMng ) { // // 닫을 창 목록 // const SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE windows[]={ // SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY // 인벤토리 // , SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CHARINFO //캐릭터 창 // , SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD //메신저 창, 아직 윈도우 없음 // , SIMSG_TOGGLE_UIWINDOW::UIWINDOW_WORLDMAP // 월드맵 // //, SIMSG_TOGGLE_UIWINDOW::UIWINDOW_WORLDMAP // 월드맵 확대 // , SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE //크리쳐 // , SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_LIST //퀘스트 창 // , SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SKILL //스킬 // , SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SYSTEM //옵션 // , SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SYSTEM_MAIN //시스템 // , SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MOTION //조작 // , SIMSG_TOGGLE_UIWINDOW::UIWINDOW_TARGETPORTRAIT //페이스컷 // , SIMSG_TOGGLE_UIWINDOW::UIWINDOW_LAST // }; // const SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE *p=windows; // while (*p!=SIMSG_TOGGLE_UIWINDOW::UIWINDOW_LAST) { // m_pGameMng->InterfaceMsg( &SIMSG_SHOW_UIWINDOW( *p, false ) ); // p++; // } //} } } // { [sonador][2007.07.26][SPACEBAR_TO_PICKUP_ITEM] 스페이스바로 아이템 줍기 else if( bEnterChat && bNoneFocusEdit && !pMsg->bShift && !pMsg->bAlt && !pMsg->bCtrl && LOWORD(pMsg->wParam ) == VK_SPACE ) { float fDist = 0.f; SGameAvatarEx* pLocalPlayer = this->m_pGameSystem->GetLocalPlayer(); if( pLocalPlayer ) { SGameObject * pItem = this->GetItemObject( *pLocalPlayer->GetPosition(), fDist, -1, ITEM_TAKE_RANGE ); // sonador #2.1.2.4.3 팻 조작 UI 연동 if( pItem ) { SInputTakeItem inputTakeItem( pItem->GetArID(), fDist ); pLocalPlayer->OnInput( &inputTakeItem ); } } } // } //종료 메세지 보낸다. // if( pMsg->bAlt && pMsg->bCtrl && ( LOWORD(pMsg->wParam ) == VK_F4 ) ) // { // ProcMsgAtStatic( &STMSG_REQ_CLOSE(false) ); // }*/ } } //#endif } //sfreer 키맵핑 기능 추가 2009.03.16 /* B. 스킬,월드맵,옵션,파티,퀘스트, 크리쳐정보,크루샵,메신져,조작,시스템, 캐릭터정보,도움말,크리쳐킬,인벤토리창,길드창,크리쳐편성창, 인터페이스 숨기기, 타겟창 C. 기획문서에만 빠져있는 것 (스페이스바로 아이템줍기, PK모드) D. 새로 구현할 것(퀵슬롯단올리기/단내리기, 퀵슬롯변경) */ bool bEnterChat = GetGameOption().IsEnterChat(); bool bNoneFocusEdit = KUIControlEdit::IsNobodyHasFocus(); bool bAbleNewWindow = true; if( m_pGameMng->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CASH_TITLE ) || m_pGameMng->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_TITLE ) || m_pGameMng->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_POPURL_TITLE ) ) { //Web 윈도우가 오픈되어 있을 경우, 윈도우 오픈하는 핫키 스킵 된다. bAbleNewWindow = false; } /////////////////////////// /////메뉴키 설정 /////////////////////////// if( m_pGameMng ) { if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::SLOTCHANGE) == KEYSTATE::DOWN ) // 무기스왑. sendSwapEquipPendMessage(); /// 2011.07.21 redmine #17805 - prodongi else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::CROWSHOP) == KEYSTATE::DOWN ) //크루샵 { //인벤토리 m_pGameMng->InterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY , true) ); if( ENV().IsExist( "commercial_shop" ) == true ) { //캐쉬창고 m_pGameMng->PostMsgAtDynamic( new SMSG_CHAT_COMMAND(SMSG_CHAT_COMMAND::CHAT_CASHSTORAGE_OPEN) ); //쿠르샵 오픈 if( !m_pGameMng->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CASH_TITLE ) && !m_pGameMng->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_TITLE ) && !m_pGameMng->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_HELP_TITLE ) && !m_pGameMng->IsShow( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_POPURL_TITLE ) ) { m_pGameMng->PostMsgAtDynamic( new SIMSG_REQ_OPEN_MSGBOX( SIMSG_REQ_OPEN_MSGBOX::MSGBOX_CASHSHOP_OPEN, S(944), true ) ); } } } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::INVENTORY) == KEYSTATE::DOWN ) //인벤토리 { //servantes 2010.11.02 SUIWnd* pWnd = m_pGameMng->GetSUI( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY ); if(pWnd == NULL) return ; if(pWnd->IsShow() == false) { bool bOpenEquipWndFlag = GetGameOption().GetOpenEquipWnd(); if(bOpenEquipWndFlag) { m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT, true ) ); // 장비창. } m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY, true ) ); // 인벤토리. } else { bool bOpenEquipWndFlag = GetGameOption().GetOpenEquipWnd(); if(bOpenEquipWndFlag) { m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT, false ) ); // 장비창. } m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY, false ) ); // 인벤토리. m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR, false ) ); //servantes 2010.11.18 m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE, false ) ); m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCOMBINE, false ) ); } // m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT ) ); // 장비창. // m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INVENTORY ) );// 인벤토리. } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::SKILL) == KEYSTATE::DOWN ) //스킬 m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SKILL ) ); else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::CHARACTER) == KEYSTATE::DOWN ) //캐릭터정보 m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CHARINFO ) ); else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::CREATUREFORMATION) == KEYSTATE::DOWN ) //크리쳐 편성 창 { if( m_pGameMng->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM ) ) m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATUREFORM, false) ); else m_pGameMng->ProcMsgAtStatic( &SMSG_SEND_DATA( "req_summon_formation" ) ); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::CREATURESKILL) == KEYSTATE::DOWN ) //크리쳐스킬 { if( !m_pGameMng->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL ) ) { m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE, true ) ); m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_PAGE, false ) ); m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, true ) ); } else { m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_PAGE, false ) ); m_pGameMng->PostMsgAtDynamic( new SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE_SKILL, false ) ); } } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::CREATUREINFO) == KEYSTATE::DOWN ) //크리쳐정보 m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_CREATURE ) ); // TEST. //else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::MESSENGER) == KEYSTATE::DOWN ) // 공식리스트. // m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_FORMULA ) ); else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::MESSENGER) == KEYSTATE::DOWN ) // 커뮤니티. { m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_COMMUNITY ) ); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::GUILD) == KEYSTATE::DOWN ) //길드 // 길드UI. 수정. bintitle. 2010.04.27 m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_GUILD_MAINWND ) ); else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::PARTY_FOLD) == KEYSTATE::DOWN ) //파티 { //m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY ) ); //m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY_STATE) ); m_pGameMng->InterfaceMsg(&SIMSG_UI_SEND_DATA(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "toggle_all_extend")); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::QUEST) == KEYSTATE::DOWN ) //퀘스트 m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_LIST ) ); else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::WOLRDMAP) == KEYSTATE::DOWN ) //월드맵 m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_WORLDMAP ) ); else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::CONTROL) == KEYSTATE::DOWN ) //조작 m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MOTION ) ); else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::HELP) == KEYSTATE::DOWN ) //도움말 ToggleHelpWindow(); else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::SYSTEM) == KEYSTATE::DOWN ) //시스템 m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SYSTEM_MAIN ) ); else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::OPTION) == KEYSTATE::DOWN ) //옵션 m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SYSTEM ) ); else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::INSTANCEGAME) == KEYSTATE::DOWN ) //인스턴스게임 m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_INSTANCE_ENTRANCE ) ); else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::DURABILITY) == KEYSTATE::DOWN ) // 내구도출력. { m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DURABILITY ) ); m_pGameMng->PostMsgAtDynamic( new SIMSG_DURABILITY_TOGGLE( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_MINIMAP ) ); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::DESTRUCTION) == KEYSTATE::DOWN ) //파괴창. { if (IsBlockedHotKey() == false ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_DESTRUCTION ) ); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::TITLE) == KEYSTATE::DOWN ) //호칭창 { m_pGameMng->PostMsgAtDynamic( new SIMSG_UI_TITLE_WND_OPEN() ); } //servantes 2010.11.02 else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::EQUIP_WND) == KEYSTATE::DOWN ) // 장비창. { m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_EQUIPMENT ) ); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::UPGRADE_WND) == KEYSTATE::DOWN ) //강화창 { if (IsBlockedHotKey() == false ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_UPGRADE ) ); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::PARTYMATCHING_WND) == KEYSTATE::DOWN ) //파티매칭 { // m_pGameMng->InterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTYMATCHING_REGISTER, false )); // m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTYMATCHING ) ); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::ITEMCOMBINE_WND) == KEYSTATE::DOWN ) //조합창 { if (IsBlockedHotKey() == false ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCOMBINE ) ); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::REPAIR_WND) == KEYSTATE::DOWN ) // 수리/복원/충전 { if (IsBlockedHotKey() == false ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_REPAIR ) ); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::PARTY_1) == KEYSTATE::DOWN ) { m_pGameMng->InterfaceMsg(&SIMSG_UI_SEND_DATA(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "select_party", (unsigned int)0)); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::PARTY_2) == KEYSTATE::DOWN ) { m_pGameMng->InterfaceMsg(&SIMSG_UI_SEND_DATA(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "select_party", (unsigned int)1)); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::PARTY_3) == KEYSTATE::DOWN ) { m_pGameMng->InterfaceMsg(&SIMSG_UI_SEND_DATA(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "select_party", (unsigned int)2)); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::PARTY_4) == KEYSTATE::DOWN ) { m_pGameMng->InterfaceMsg(&SIMSG_UI_SEND_DATA(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "select_party", (unsigned int)3)); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::PARTY_5) == KEYSTATE::DOWN ) { m_pGameMng->InterfaceMsg(&SIMSG_UI_SEND_DATA(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "select_party", (unsigned int)4)); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::PARTY_6) == KEYSTATE::DOWN ) { m_pGameMng->InterfaceMsg(&SIMSG_UI_SEND_DATA(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "select_party", (unsigned int)5)); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::PARTY_7) == KEYSTATE::DOWN ) { m_pGameMng->InterfaceMsg(&SIMSG_UI_SEND_DATA(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "select_party", (unsigned int)6)); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::PARTY_8) == KEYSTATE::DOWN ) { m_pGameMng->InterfaceMsg(&SIMSG_UI_SEND_DATA(SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PARTY, "select_party", (unsigned int)7)); } } /* 퀵슬롯윈도우 제어 관련 기능 추가해야함. -퀵슬롯 올리기/내리기 HOTKEYCODE::SLOTUPDOWN -슬롯변경 HOTKEYCODE::SLOTCHANGE */ /////////////////////////// /////마우스 메뉴 /////////////////////////// /*if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::MOVECLICK) == KEYSTATE::DOWN ) //이동클릭 { SIMSG_LBUTTONDOWN LbuttonDown; LbuttonDown.nMsg = WM_LBUTTONDOWN; if(pMsg->bAlt) LbuttonDown.wParam = LbuttonDown.wParam | MK_ALT; else if(pMsg->bShift) LbuttonDown.wParam = LbuttonDown.wParam | MK_SHIFT; else if(pMsg->bCtrl) LbuttonDown.wParam = LbuttonDown.wParam | MK_CONTROL; LbuttonDown.lParam = MAKELONG(m_ptOldPoint.x,m_ptOldPoint.y); ProcLbuttonDown(&LbuttonDown); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::CAMERAMOVE) == KEYSTATE::DOWN ) //카메라움직이기 { //ProcMouseMove에 추가함. }*/ /////////////////////////// /////팁 메뉴 /////////////////////////// //미니맵 확대축소는 minimap ui 파일에서 직접구현되어있음. sfreer if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::EXIT) == KEYSTATE::DOWN ) //게임종료 { ProcMsgAtStatic( &STMSG_REQ_CLOSE(false) ); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::TARGETWINDOW) == KEYSTATE::DOWN ) //타겟창 { if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_TARGETPORTRAIT ) ); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::INTERFACEHIDE) == KEYSTATE::DOWN ) //인터페이스 숨기기 { g_bRenderUI = !g_bRenderUI; if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_UI_NAME_TEXT(g_bRenderUI) ); ShowInterface( g_bRenderUI ); if( g_bRenderUI ) { SGameAvatarEx* pTarget = m_pGameSystem->GetTarget(); if( pTarget ) m_pGameSystem->SetTarget( pTarget ); } } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::PKMODE) == KEYSTATE::DOWN ) //PKmode on/off { if( m_pCommandSystem->GetLocalPlayer() ) { if( m_pCommandSystem->GetLocalPlayer()->GetStatus() & TS_ENTER::PlayerInfo::FLAG_PK_ON ) { TS_CS_TURN_OFF_PK_MODE msg; SendMsg( &msg ); } else { TS_CS_TURN_ON_PK_MODE msg; SendMsg( &msg ); } } return; } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::AUTOTARGETING) == KEYSTATE::DOWN )//자동타게팅 { SGameAvatarEx * pTarget = m_pCommandSystem->GetNextTarget( c_nTARGET_MAX_LEN, m_bIsResetTargetList ); m_bIsResetTargetList = false; if( pTarget ) m_pGameSystem->SetTarget( pTarget ); } else if( GetGameKeymapping().GetHotKeyState(HOTKEYCODE::PICKUPITEM) == KEYSTATE::DOWN ) //아이템줍기 { float fDist = 0.f; SGameAvatarEx* pLocalPlayer = this->m_pGameSystem->GetLocalPlayer(); if( pLocalPlayer ) { SGameObject * pItem = this->GetItemObject( *pLocalPlayer->GetPosition(), fDist, -1, ITEM_TAKE_RANGE ); // sonador #2.1.2.4.3 팻 조작 UI 연동 if( pItem ) { SInputTakeItem inputTakeItem( pItem->GetArID(), fDist ); pLocalPlayer->OnInput( &inputTakeItem ); } } } //원래 있던것들 그대로 옮겨옴. if( ( !pMsg->bShift && !pMsg->bAlt && !pMsg->bCtrl && LOWORD(pMsg->wParam ) == VK_RETURN ) ) { if( g_bRenderUI == true ) return; g_bRenderUI = true; if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_UI_NAME_TEXT(g_bRenderUI) ); ShowInterface( g_bRenderUI ); } else if( ( LOWORD(pMsg->wParam ) == VK_ESCAPE ) ) { _oprint( "VK_ESCAPE down\n" ); cancelCasting(); } } void SGameWorld::ProcKeyDown ( SIMSG_KEYDOWN* pMsg ) { } void SGameWorld::CheckCameraMove( K3DVertex vtxPrevCamOrgPos ) { #ifdef _NO_WAY_ // // 옛 카메라 루틴 : #ifdef로 막았음 // K3DVector cpos = m_pCamera->GetCamOrgPos(); K3DVector tpos = m_pCamera->GetTargetPos(); K3DVector res; float fSmallestRatio = 1.0f; float fRatio = 1.0f; // 임시로 제거 by blackfish -> //fRatio = m_pTerrainMapEngine->GetLineCrossedPointTwoSides( m_pCamera, tpos, cpos, res ); //if(fSmallestRatio > fRatio) fSmallestRatio = fRatio; //m_pCamera->SetCurCamPos(fSmallestRatio); //cpos = m_pCamera->GetCamPos(); // <- 임시로 제거 by blackfish float fTerrainHeight; float fWaterHeight = -3.0000000e+038f; if( m_pViewPort->DoesExistWaterHeight() ) { fWaterHeight = m_pViewPort->GetWaterHeight() + 5.0f; } float fHeight = 0.0f; bool bOnProp = false; m_pTerrainMapEngine->GetTerrainHeight( cpos.x, cpos.y, fTerrainHeight, &bOnProp ); if ( fTerrainHeight < fWaterHeight ) { bOnProp = true; fHeight = fWaterHeight; } else { bOnProp = false; fHeight = fTerrainHeight; } float f = 1.0f; if ( !bOnProp ) { float ctx = tpos.x - cpos.x, cty = tpos.y - cpos.y; float ctlen = sqrt( ctx*ctx + cty*cty ); ctx /= ctlen, cty /= ctlen; float d1, d2, d3; m_pTerrainMapEngine->GetTerrainHeight( cpos.x + ctx, cpos.y + cty, d1 ); m_pTerrainMapEngine->GetTerrainHeight( cpos.x + cty, cpos.y - ctx, d2 ); m_pTerrainMapEngine->GetTerrainHeight( cpos.x - cty, cpos.y + ctx, d3 ); if ( d2 > d1 ) d1 = d2; if ( d3 > d1 ) d1 = d3; d1 -= fHeight; f = sqrt( 1.0f + d1*d1*4.0f ); if ( f > 10.0f ) f = 10.0f; } fHeight += 5.0f * f; if(cpos.z < fHeight) { cpos.z = fHeight; m_pCamera->SetCurCamPos(cpos.x, cpos.y, cpos.z); } float fCamAvatarDist = Magnitude(tpos - cpos); static float s_fVisLimit = 8.0f; if( fCamAvatarDist < s_fVisLimit ) { m_pCamera->SetCamPos( vtxPrevCamOrgPos.x, vtxPrevCamOrgPos.y, vtxPrevCamOrgPos.z ); cpos = vtxPrevCamOrgPos; m_pTerrainMapEngine->GetTerrainHeight(cpos.x, cpos.y, fTerrainHeight ); fHeight = fTerrainHeight >= fWaterHeight ? fTerrainHeight : fWaterHeight; fHeight += 5.0f; if(cpos.z < fHeight) { cpos.z = fHeight; m_pCamera->SetCurCamPos(cpos.x, cpos.y, cpos.z); } fCamAvatarDist = Magnitude( tpos - cpos ); } static float s_fVisRange = 12.0f; static float s_fVis = 0.7f; if(fCamAvatarDist < s_fVisRange) { m_pCommandSystem->GetLocalPlayer()->SetVisibility(s_fVis); if(m_pCommandSystem->GetLocalPlayer()->IsMountMode()) { SGameAvatarEx* pCreature = (SGameAvatarEx*) m_pCommandSystem->GetObject( m_pCommandSystem->GetLocalPlayer()->GetCreatureMountHandle() ); if(pCreature) pCreature->SetVisibility(s_fVis); } } else { m_pCommandSystem->GetLocalPlayer()->SetVisibility(1.0f); if(m_pCommandSystem->GetLocalPlayer()->IsMountMode()) { SGameAvatarEx* pCreature = (SGameAvatarEx*) m_pCommandSystem->GetObject( m_pCommandSystem->GetLocalPlayer()->GetCreatureMountHandle() ); if(pCreature) pCreature->SetVisibility(1.0f); } } #endif // __NO_WAY__ // // 새 카메라 루틴 // if( m_pGameCamera->GetCameraMode() != SGameCamera::CAMERA_GAME_MODE ) return; if( m_nCameraAutoRotValue != 0 ) m_pGameCamera->Turn( m_nCameraAutoRotValue ); // // K3DVector cpos, tpos; // camera pos, target pos // // // Z값 없이 XY만 계산 // m_pGameCamera->CalculateCamera(); // 지형 높이 없이 XY만 계산 // cpos=m_pGameCamera->GetCameraPosition(); // // // // 땅/물 높이 가져오기 // float fTerrainHeight; // float fWaterHeight = -3.0000000e+038f; // // //아래 부분을 없애면, 물 속으로 카메라 들어 가짐. // if( m_pLowQualityWater->GetWaterHeight( cpos, fWaterHeight) ) // fWaterHeight += 5.0f; // ///* if( m_pViewPort->DoesExistWaterHeight() ) // { // fWaterHeight = m_pViewPort->GetWaterHeight() + 5.0f; // }*/ // // float fHeight = 0.0f; // bool bOnProp = false; // WORD wTile = 0; // m_pTerrainMapEngine->GetTerrainHeight( cpos.x, cpos.y, fTerrainHeight, wTile, &bOnProp ); // if ( fTerrainHeight < fWaterHeight ) { // bOnProp = true; // fHeight = fWaterHeight; // } else { // bOnProp = false; // fHeight = fTerrainHeight; // } // if ( !bOnProp ) m_pTerrainMapEngine->GetTerrainHeight(cpos.x, cpos.y, fHeight, wTile ); // else fHeight=fWaterHeight; // // // 카메라 좌표의 지형높이를 기준으로 다시 한번 계산 // m_pGameCamera->CalculateCamera(fHeight, true); // // m_pGameCamera->ApplyCameraPositions(); // m_pCamera에 카메라와 타겟 위치 적용 // { [sonador][COLLIDABLE_CAMERA] m_pGameCamera->CalculateCamera(); m_pGameCamera->ApplyCameraPositions(); // } K3DVector cpos, tpos; // // 카메라-플레이어간 거리에 따라 PC오브젝트 투명도 조절 // cpos = m_pGameCamera->GetCameraPosition(); tpos = m_pGameCamera->GetCameraTargetPosition(); const static K3DVector vUpVector( 0.0f, 0.0f, 1.0f ); K3DVector vDir = tpos - cpos; vDir.Normalize(); float fDot = -DotProduct( vUpVector, vDir ); char nLocation = 1; if( fDot > 0.0f ) nLocation = 1; //0 ~ 90도 else if( fDot <= 0.0f && fDot >= -0.333f ) nLocation = 2; // 0 ~ -60도 else if( fDot <= -0.333f && fDot >= -1.0f ) nLocation = 3; // -60도 이상 // _oprint( "Dot: %f Lc: %d\n", fDot, nLocation ); float fVisRange = 1.0f; float fVisRate = 1.0f; float fCameraZOffSet = m_fCamera_Z_Offset*10.0f; //원본 백업 static float fBackUpNear = m_pViewPort->GetNearClip(); //카메라 동작 개선.doc 참조 static float sfInverseVis = 1.0f; float fCamAvatarLength = 1.0f; switch( nLocation ) { case 1: { float fCamAvatarDist = (tpos - cpos).Magnitude(); fVisRate = sfInverseVis - ( (fCameraZOffSet / m_fCameraDisRate) - fCamAvatarDist ) / (fCameraZOffSet / m_fCameraDisRate) * 2.0f; fCamAvatarLength = fCamAvatarDist; if( fCamAvatarDist < 20.0f ) m_pGameCamera->SetDollyConstant( -0.03f ); else m_pGameCamera->DefaultDollyConstant(); } break; case 2: case 3: { fCamAvatarLength = (tpos - cpos).Magnitude(); if( fCamAvatarLength < 20.0f ) m_pGameCamera->SetDollyConstant( -0.03f ); else m_pGameCamera->DefaultDollyConstant(); cpos.z = tpos.z = 0.0f; float fCamAvatarDist = (tpos - cpos).Magnitude(); fVisRate = sfInverseVis - ( (fCameraZOffSet / m_fCameraDisRate) - fCamAvatarDist ) / (fCameraZOffSet / m_fCameraDisRate) * 2.0f; } break; /* case 3: { fCameraZOffSet *= 2.0f; float fCamAvatarDist = (tpos - cpos).Magnitude(); fVisRate = sfInverseVis - ( (fCameraZOffSet / m_fCameraDisRate) - fCamAvatarDist ) / (fCameraZOffSet / m_fCameraDisRate) * 2.0f; cpos.z = tpos.z = 0.0f; fCamAvatarLength = (tpos - cpos).Magnitude(); } break;*/ } SGameAvatarEx* pLocalPlayer = m_pCommandSystem->GetLocalPlayer(); if( pLocalPlayer == NULL ) return; if(fVisRate < fVisRange) { if( fCamAvatarLength < 1.5f || fVisRate < 0.0f ) fVisRate = 0.0f; static float fNear = 1.0f; m_pViewPort->SetClipRange( fNear, m_pViewPort->GetFarClip() ); pLocalPlayer->SetVisibility(fVisRate); if(pLocalPlayer->IsMountMode()) { SGameAvatarEx* pCreature = pLocalPlayer->GetRiderCreatureObject(); if(pCreature) pCreature->SetVisibility(fVisRate); } } else { m_pViewPort->SetClipRange( fBackUpNear, m_pViewPort->GetFarClip() ); pLocalPlayer->SetVisibility(1.0f); if(pLocalPlayer->IsMountMode()) { SGameAvatarEx* pCreature = pLocalPlayer->GetRiderCreatureObject(); if(pCreature) pCreature->SetVisibility(1.0f); } } /* float fCamAvatarDist = (tpos - cpos).Magnitude(); static float s_fVisRange = 12.0f; static float s_fVis = 0.7f; if(fCamAvatarDist < s_fVisRange) { m_pCommandSystem->GetLocalPlayer()->SetVisibility(s_fVis); if(m_pCommandSystem->GetLocalPlayer()->IsMountMode()) { SGameAvatarEx* pCreature = (SGameAvatarEx*) m_pCommandSystem->GetObject( m_pCommandSystem->GetLocalPlayer()->GetCreatureMountHandle() ); if(pCreature) pCreature->SetVisibility(s_fVis); } } else { m_pCommandSystem->GetLocalPlayer()->SetVisibility(1.0f); if(m_pCommandSystem->GetLocalPlayer()->IsMountMode()) { SGameAvatarEx* pCreature = (SGameAvatarEx*) m_pCommandSystem->GetObject( m_pCommandSystem->GetLocalPlayer()->GetCreatureMountHandle() ); if(pCreature) pCreature->SetVisibility(1.0f); } }*/ } void SGameWorld::ItemMouseOverCheck() { if( m_pCommandSystem->GetMouseOverItem() ) { SGameCursorMng::SetCursor( SGameCursorMng::CURSOR_DEFAULT ); SIMSG_UI_DROP_ITEM_NAME msg; msg.hItem = m_pCommandSystem->GetMouseOverItem(); msg.bShow = false; m_pGameMng->InterfaceMsg( &msg ); m_pCommandSystem->SetMouseOverItem( 0 ); } } //Mouse bool SGameWorld::ProcMouseMove ( SIMSG_MOUSEMOVE* pMsg ) { /// 2010.11.10 - prodongi //#ifdef _DEV // extern bool g_bDebugMode; //#endif bool bCameraChanged = false; m_nCameraAutoRotValue = 0; int n2DX = GET_X_LPARAM(pMsg->lParam); int n2DY = GET_Y_LPARAM(pMsg->lParam); //시간 카메라로 바꾸자~ int dx = n2DX - m_ptOldPoint.x; int dy = n2DY - m_ptOldPoint.y; // _oprint( "Mouse Move : x-%d y-%d\n", dx, dy ); m_ptOldPoint.x = n2DX; m_ptOldPoint.y = n2DY; // _oprint( "Mouse Move Old: x-%d y-%d\n", m_ptOldPoint.x, m_ptOldPoint.y ); K3DVector vNear, vFar, res; m_pViewPort->GetCameraSegmentView(n2DX, n2DY, vNear, vFar ); SGameAvatarEx * pPickObject = NULL; //다른 플레이어, NPC, Mob, 아이템 pPickObject = m_pCommandSystem->GetPickObject(vNear, vFar); bool isAttack = false; if( pPickObject ) { isAttack = IsAttack(pPickObject); if (isAttack) { //플레이어 및 크리처 일경우 if( pPickObject->GetObjType() == TS_ENTER::GAME_PLAYER || pPickObject->GetObjType() == TS_ENTER::GAME_SUMMON ) { if( m_bIsAttackLocation ) //현재 지역이 공격 가능한 지역 SGameCursorMng::SetCursor( SGameCursorMng::CURSOR_ATTACK ); } else SGameCursorMng::SetCursor( SGameCursorMng::CURSOR_ATTACK ); ItemMouseOverCheck(); } else { if( pPickObject->GetObjType() == TS_ENTER::GAME_ITEM || pPickObject->GetObjType() == TS_ENTER::GAME_FIELD_PROP ) { if( m_pCommandSystem->GetMouseOverItem() != pPickObject->GetArID() ) { ItemMouseOverCheck(); SGameCursorMng::SetCursor( SGameCursorMng::CURSOR_PICKUP ); m_pCommandSystem->SetMouseOverItem( pPickObject->GetArID() ); SIMSG_UI_DROP_ITEM_NAME msg; msg.hItem = pPickObject->GetArID(); msg.bShow = true; m_pGameMng->InterfaceMsg( &msg ); } } else ItemMouseOverCheck(); } if( pPickObject->GetObjType() == TS_ENTER::GAME_PLAYER || pPickObject->GetObjType() == TS_ENTER::GAME_SUMMON || pPickObject->GetObjType() == TS_ENTER::GAME_NPC || pPickObject->GetObjType() == TS_ENTER::GAME_MOB || pPickObject->GetObjType() == TS_ENTER::GAME_PET || // sonador 10.2.1 팻 시스템 구현 pPickObject->GetObjType() == TS_ENTER::GAME_FIELD_PROP ) { bool bDifferent = false; if( m_pSelectTargetOnFx ) { if( m_pSelectTargetOnFx->GetArHandle() == pPickObject->GetArID() ) bDifferent = true; } if( !bDifferent ) { m_bSelectTarget = true; m_pSelectTargetFx->SetArHandle( pPickObject->GetArID() ); } } } else { ItemMouseOverCheck(); SGameCursorMng::SetCursor( SGameCursorMng::CURSOR_DEFAULT ); m_bSelectTarget = false; m_pSelectTargetFx->SetArHandle( NULL ); } setPickObject(pPickObject, isAttack); //오브젝트 피킹, 어택 지정한 오브젝트가 있는가? SGameAvatarEx * pTarget = m_pGameSystem->GetTarget(); if( pTarget ) { if( pPickObject && pTarget->GetArID() == pPickObject->GetArID() && pPickObject->IsLive() ) { SetUI_TargetActiveInfo( pTarget->GetArID(), SIMSG_UI_TARGET_ACTIVE_INFO::TARGET_ACTIVE_ON ); } else { SetUI_TargetActiveInfo( pTarget->GetArID(), SIMSG_UI_TARGET_ACTIVE_INFO::TARGET_ACTIVE_OFF ); } } //카메라 제어 //if( ( (pMsg->wParam & MK_LBUTTON) || (pMsg->wParam & MK_RBUTTON || GetGameKeymapping().IsHotKeyPushed(HOTKEYCODE::CAMERAMOVE) ) ) ) if( ( (pMsg->wParam & MK_LBUTTON) || (pMsg->wParam & MK_RBUTTON) ) ) { bCameraChanged = true; /* if( g_bDebugMode && ( GetKeyState( VK_SCROLL ) & 0x01 ) ) { if( (pMsg->wParam & MK_LBUTTON) && (pMsg->wParam & MK_RBUTTON) ) { // m_pGameCamera->Zoom(dy); // K3DVector cpos; m_pCamera->Zoom( (int)(dy * 2.0f / 8.f) ); //m_pCamera->GetCamPos( cpos.x, cpos.y, cpos.z ); //float fHeight = GetHeight( cpos.x, cpos.y ); //cpos.z = fHeight+15.f; //m_pCamera->SetCamPos( cpos.x, cpos.y, cpos.z ); return bCameraChanged; } } */ //if( (pMsg->wParam & MK_RBUTTON || GetGameKeymapping().IsHotKeyPushed(HOTKEYCODE::CAMERAMOVE) ) ) if( (pMsg->wParam & MK_RBUTTON) ) { if( !g_bUserCamMode ) { // 카메라 제어 m_pGameCamera->Turn( dx ); //soandor 0.2.4 (중국)고정 카메라 클라이언트 제작 #if !defined( _FIXED_CAMERA_MODE ) //static bool isFixedCameraMode = ENV().IsExist( "fixed_camera" ); //if( !isFixedCameraMode ) m_pGameCamera->Updown( dy ); #endif // _oprint( "Camera %d %d\n", dx, dy ); } else { m_pCamera->Turn( (float)(-(float)dx * 3.14/m_nDeltaX) ); m_pCamera->Elevation( (float)((float)-dy * 3.14/m_nDeltaY) ); } //if(m_bCameraCollision) CheckCameraMove(); //float fHeight = GetHeight( cpos.x, cpos.y ); return bCameraChanged; } // K3DVector cpos; // m_pCamera->GetCamPos( cpos.x, cpos.y, cpos.z ); // float fHeight = GetHeight( cpos.x, cpos.y ); // // float fLen = m_pCamera->GetDistance(); // if( fLen < 20 ) //가까우면, 하늘 보기 가능.. // { // //카메라 직접 제어 // m_pCamera->Turn( (float)(-(float)dx * 3.14/m_nDeltaX) ); // m_pCamera->Elevation( (float)((float)-dy * 3.14/m_nDeltaY) ); // } // else // { // if( cpos.z <= (fHeight+20.f) ) // { // if( dy > 0 ) // { //위로는 가능.. // m_pCamera->Elevation( (float)((float)-dy * 3.14/m_nDeltaY) ); // } // //return; // } // m_pCamera->Turn( (float)(-(float)dx * 3.14/m_nDeltaX) ); // m_pCamera->GetCamPos( cpos.x, cpos.y, cpos.z ); // // float fHeight = GetHeight( cpos.x, cpos.y ); // // //TODO : 이것은 나중에 꼭 고쳐야 한다. // if( m_pViewPort->GetUseWater() ) // { // fHeight = std::max( fHeight, (float)water_info[s_nSelectWater][4]+6 ); // } // // //땅에 닿으면.. // if( cpos.z <= fHeight ) // { // if( dy > 0 ) // { //위로는 가능.. // m_pCamera->Elevation( (float)((float)-dy * 3.14/m_nDeltaY) ); // } // else //앞으로 이동 // { // float fLen = m_pCamera->GetDistance(); // if( fLen > 20 ) // { //// m_pCamera->Zoom( -1 ); // m_pCamera->GetCamPos( cpos.x, cpos.y, cpos.z ); // float fHeight = GetHeight( cpos.x, cpos.y ); // if( m_pViewPort->GetUseWater() ) // { // fHeight = max( fHeight, (float)water_info[s_nSelectWater][4]+6 ); // } // cpos.z = fHeight+15.f; // m_pCamera->SetCamPos( cpos.x, cpos.y, cpos.z ); // } // } // return bCameraChanged; // } // else // { // m_pCamera->Elevation( (float)((float)-dy * 3.14/m_nDeltaY) ); // m_pCamera->GetCamPos( cpos.x, cpos.y, cpos.z ); // // float fHeight = GetHeight( cpos.x, cpos.y ); // // //TODO : 이것은 나중에 꼭 고쳐야 한다. // if( m_pViewPort->GetUseWater() ) // { // fHeight = max( fHeight, (float)water_info[s_nSelectWater][4]+6 ); // } // // //땅에 닿으면.. // if( cpos.z <= (fHeight+10.f) ) // { // cpos.z = fHeight+15.f; // m_pCamera->SetCamPos( cpos.x, cpos.y, cpos.z ); // // if( dy > 0 ) // { //위로는 가능.. // m_pCamera->Elevation( (float)((float)-dy * 3.14/m_nDeltaY) ); // } // else //앞으로 이동 // { // float fLen = m_pCamera->GetDistance(); // if( fLen > 20 ) // { // m_pCamera->Zoom( -1 ); // m_pCamera->GetCamPos( cpos.x, cpos.y, cpos.z ); // if( m_pViewPort->GetUseWater() ) // { // fHeight = max( fHeight, (float)water_info[s_nSelectWater][4]+6 ); // } // cpos.z = fHeight+15.f; // m_pCamera->SetCamPos( cpos.x, cpos.y, cpos.z ); // } // } // return bCameraChanged; // } // } // } // } } else { if( m_bCameraAutoRot ) { static int nBorder = 30; int nScrWidth = m_pViewPort->GetViewportWidth(); if( n2DX < nBorder ) m_nCameraAutoRotValue = -(nBorder - n2DX); else if( nScrWidth - n2DX < nBorder ) m_nCameraAutoRotValue = nBorder - (nScrWidth - n2DX); } } /// 2010.11.10 - prodongi //#ifdef _DEV if (g_UserInfo.isMonkeyTail()) { extern bool g_bDebugMode; if( g_bUserCamMode && g_bDebugMode && ( GetKeyState( VK_SCROLL ) & 0x01 ) ) { if( (pMsg->wParam & MK_MBUTTON) ) { K3DVector vtView = m_pCamera->GetViewVector(); K3DVector vtUp = m_pCamera->GetUpVector(); K3DVector vtRes = CrossProduct(vtView, vtUp); Normalize(vtRes); vtUp = CrossProduct(vtRes, vtView); Normalize(vtUp); float x, y, z; x = (-dx*m_fDeltaX*vtRes.x + dy*m_fDeltaY*vtUp.x) * .1f; y = (-dx*m_fDeltaX*vtRes.y + dy*m_fDeltaY*vtUp.y) * .1f; z = (-dx*m_fDeltaX*vtRes.z + dy*m_fDeltaY*vtUp.z) * .1f; m_pCamera->Pan(x,y,z); } } } //#endif return bCameraChanged; } void SGameWorld::ProcMouseWheel ( SIMSG_MOUSEWHEEL* pMsg ) { short zDelta; zDelta = GET_WHEEL_DELTA_WPARAM(pMsg->wParam); if( !g_bUserCamMode ) { m_pGameCamera->Dolly(zDelta); // Zoom by SGameCamera } else { //동영상 촬영지원 카메라 float fLen = m_pCamera->GetDistance(); //float m_fCamMaxDistRatio = 2.0f; float fFinalDelta = ( float ) zDelta * expf( logf ( fLen / ( 50.0f * m_fCamMaxDistRatio ) ) * 2.0f ) / -8.0f; if( fLen + fFinalDelta > 120.0f * m_fCamMaxDistRatio ) fFinalDelta = 120.0f * m_fCamMaxDistRatio - fLen; else if( fLen + fFinalDelta < 22.0f ) fFinalDelta = 22.0f - fLen; // _oprint( "Mouse Wheel : %d\n", zDelta ); // if( !g_bUserCamMode ) { if( fLen < 22.0f ) //캐릭과 카메라가 근접거리에서 카메라가 아래에서 위를 보고 있을 경우, Zoom,In/Out 안됨 { K3DVector zVector(0,0,1); K3DVector cpos = m_pCamera->GetCamPos(); K3DVector tpos, dir, dirNormal; m_pCamera->GetTargetPos( tpos.x, tpos.y, tpos.z ); dir = cpos - tpos; //방향 K3DVectorNormalize(dirNormal, dir); //다른 방향일때.. if( DotProduct(zVector, dir) > 0 ) { if( zDelta < 0 ) { // m_pGameCamera->Zoom(-zDelta); //m_pCamera->Zoom(-zDelta / 8); m_pCamera->Zoom( fFinalDelta ); K3DVector cpos; m_pCamera->GetCamPos( cpos.x, cpos.y, cpos.z ); float fHeight = 0.f; WORD wTile=0; GetHeight( cpos.x, cpos.y, fHeight,wTile ); //들어 올 일이 없을껄... if( fHeight > cpos.z ) { cpos.z = fHeight+15.f; m_pCamera->SetCamPos( cpos.x, cpos.y, cpos.z ); } } } } else if( fLen > 120.0f * m_fCamMaxDistRatio ) { if( zDelta > 0 ) { // m_pGameCamera->Zoom(-zDelta); //m_pCamera->Zoom(-zDelta / 8); m_pCamera->Zoom( fFinalDelta ); K3DVector cpos; m_pCamera->GetCamPos( cpos.x, cpos.y, cpos.z ); float fHeight = 0.f; WORD wTile=0; GetHeight( cpos.x, cpos.y, fHeight,wTile ); if( fHeight > cpos.z ) { cpos.z = fHeight+15.f; m_pCamera->SetCamPos( cpos.x, cpos.y, cpos.z ); } } } else { //m_pCamera->Zoom(-zDelta / 8); m_pCamera->Zoom( fFinalDelta ); K3DVector cpos; m_pCamera->GetCamPos( cpos.x, cpos.y, cpos.z ); float fHeight = 0.f; WORD wTile=0; GetHeight( cpos.x, cpos.y, fHeight,wTile ); if( fHeight > cpos.z ) { cpos.z = fHeight+15.f; m_pCamera->SetCamPos( cpos.x, cpos.y, cpos.z ); } } } } } bool SGameWorld::IsAttack(SGameAvatarEx* pPickObject, int nSkillID) //TODO: add nSkillID for checking { assert( pPickObject && "누가 없는걸 검사 하는가!!!" ); /* #ifndef NDEBUG return true; #endif */ if( pPickObject->IsLocalPlayer() ) return false; //자신은 못 때림. if( pPickObject->IsLocalCreature() ) return false; //자신 크리쳐도 못 때림. if( pPickObject->IsLocalPet() ) return false; // sonador 10.2.1 팻 시스템 구현 unsigned char nGameObjType = pPickObject->GetObjType(); if( GetPlayerCurrentLocation() == PLAYER_IN_DUNGEON_SIEGE ) { SGameAvatarEx* pPlayer = m_pGameSystem->GetLocalPlayer(); if( !pPlayer ) return false; if( pPlayer->GetArObject().layer != pPickObject->GetArObject().layer ) return false; bool bPlayerGuard = ( pPlayer->GetStatus() & TS_ENTER::PlayerInfo::FLAG_DUNGEON_ORIGINAL_OWNER ); bool bTargetGuard = ( pPickObject->GetStatus() & TS_ENTER::PlayerInfo::FLAG_DUNGEON_ORIGINAL_OWNER ); if( nGameObjType == TS_ENTER::GAME_PLAYER ) { if( bPlayerGuard != bTargetGuard ) return true; } else if( nGameObjType == TS_ENTER::GAME_MOB ) { // 전투타입 == 1 환경 NPC if( GetMonsterDB().GetFightType( pPickObject->GetContentID() ) == 1 ) return false; if( 0 != (m_nAttackLimit & LIMIT_MOB) && bPlayerGuard != bTargetGuard ) return true; } else if( nGameObjType == TS_ENTER::GAME_SUMMON ) { SGameAvatarEx* pMaster = (SGameAvatarEx*)GetGameObject( pPickObject->GetMaster() ); if( pMaster ) { bTargetGuard = ( pMaster->GetStatus() & TS_ENTER::PlayerInfo::FLAG_DUNGEON_ORIGINAL_OWNER ); if( bPlayerGuard != bTargetGuard ) return true; } } return false; } /// 2012.06.13 - prodongi else if (PLAYER_IN_ARENA == GetPlayerCurrentLocation()) { SGameAvatarEx* localPlayer = m_pGameSystem->GetLocalPlayer(); if (!localPlayer) return false; bool localIsTeam0 = (bool)(localPlayer->GetStatus() & TS_ENTER::PlayerInfo::FLAG_BATTLE_ARENA_TEAM_0); if (TS_ENTER::GAME_PLAYER == nGameObjType) { bool pickIsTeam0 = (bool)(pPickObject->GetStatus() & TS_ENTER::PlayerInfo::FLAG_BATTLE_ARENA_TEAM_0); bool isAttack = localIsTeam0 != pickIsTeam0; return isAttack; } else if( nGameObjType == TS_ENTER::GAME_SUMMON ) { SGameAvatarEx* pMaster = (SGameAvatarEx*)GetGameObject( pPickObject->GetMaster() ); if( pMaster ) { bool materIsTeam0 = (bool)(pMaster->GetStatus() & TS_ENTER::PlayerInfo::FLAG_BATTLE_ARENA_TEAM_0); bool isAttack = localIsTeam0 != materIsTeam0; return isAttack; } } } if( pPickObject->GetStatus() & TS_ENTER::PlayerInfo::FLAG_COMPETING ) g_pCurrentGameSystem->SetShowPVPIcon( true ); else g_pCurrentGameSystem->SetShowPVPIcon( false ); // //1:1 대련 //2009-02-10 : hunee if( ( pPickObject->GetStatus() & TS_ENTER::PlayerInfo::FLAG_COMPETING ) && g_pCurrentGameSystem->GetPVPStart() ) { if( GetPlayerCurrentLocation() == PLAYER_IN_MATCH || GetPlayerCurrentLocation() == PLAYER_IN_WORLD ) { SGameAvatarEx* pPlayer = m_pGameSystem->GetLocalPlayer(); if( !pPlayer ) return false; if( nGameObjType == TS_ENTER::GAME_MOB || nGameObjType == TS_ENTER::GAME_PLAYER ) return true; if( nGameObjType == TS_ENTER::GAME_SUMMON ) { SGameAvatarEx* pMaster = (SGameAvatarEx*)GetGameObject( pPickObject->GetMaster() ); if( pMaster )/* return pMaster->IsActivateBattleInArena();*/ { return true; } // } } } //데스매치 존인가? 2009.11.23. sfreer if( nGameObjType == TS_ENTER::GAME_PLAYER || nGameObjType == TS_ENTER::GAME_SUMMON ) { SGameAvatarEx* pPlayer = m_pGameSystem->GetLocalPlayer(); /*int x = pPlayer->GetPosition()->x; int y = pPlayer->GetPosition()->y; if( ( x >= 193536 && x <= 201600 && y >= 104832 && y <= 112896) || ( x >= 201600 && x <= 209664 && y >= 104832 && y <= 112896) || ( x >= 193536 && x <= 201600 && y >= 96768 && y <= 104832) || ( x >= 201600 && x <= 209664 && y >= 96768 && y <= 104832) || ( x >= 193536 && x <= 201600 && y >= 88704 && y <= 96768) || ( x >= 201600 && x <= 209664 && y >= 88704 && y <= 96768) || ( x >= 193536 && x <= 201600 && y >= 80640 && y <= 88704) || ( x >= 201600 && x <= 209664 && y >= 80640 && y <= 88704) ) // 데스매치 */ if(pPlayer->IsInDeathMatch()) { #ifndef _EQUATION if(nGameObjType == TS_ENTER::GAME_SUMMON) { SGameAvatarEx* pMaster = (SGameAvatarEx*)GetGameObject( pPickObject->GetMaster() ); if( pMaster ) { if(!pMaster->IsDead()) return true; } } else { return true; } #else if(nGameObjType == TS_ENTER::GAME_SUMMON) { SGameAvatarEx* pMaster = (SGameAvatarEx*)GetGameObject( pPickObject->GetMaster() ); if (pMaster && m_pGameSystem->IsPartyMember( pMaster->GetArID() )) return false; return true; } else { if (m_pGameSystem->IsPartyMember( pPickObject->GetArID() ) ) return false; return true; } #endif } } if( nGameObjType == TS_ENTER::GAME_PLAYER ) { //내가 PK ON상태면 PK 가능 if( (m_nAttackLimit & LIMIT_PLAYER) != 0 ) { // sonador 7.0.22 Mantis 0002774: [타겟] tab키를 이용한 타겟설정 시 문제점 AR_HANDLE targetHandle = pPickObject->GetArID(); if( m_pGameSystem->IsPartyMember( targetHandle ) || m_pGameSystem->IsGuildMember( targetHandle ) ) return false; return true; } //상대방이 PK ON 상태 이거나 데모니악 및 블러디 플레이어 일 경우 PK 가능 else if( ( pPickObject->GetStatus() & TS_ENTER::PlayerInfo::FLAG_PK_ON ) || ( pPickObject->GetStatus() & TS_ENTER::PlayerInfo::FLAG_DEMONIAC ) || ( pPickObject->GetStatus() & TS_ENTER::PlayerInfo::FLAG_BLOODY )) { // sonador 7.0.22 Mantis 0002774: [타겟] tab키를 이용한 타겟설정 시 문제점 AR_HANDLE targetHandle = pPickObject->GetArID(); if( m_pGameSystem->IsPartyMember( targetHandle ) || m_pGameSystem->IsGuildMember( targetHandle ) ) return false; return true; } } else if( nGameObjType == TS_ENTER::GAME_MOB ) { // 전투타입 == 1 환경 NPC if( GetMonsterDB().GetFightType( pPickObject->GetContentID() ) == 1 ) return false; return ( 0 != (m_nAttackLimit & LIMIT_MOB) ); } else if( nGameObjType == TS_ENTER::GAME_SUMMON ) { //선택된 크리처의 주인이 존재한지 검사 SGameAvatarEx* pMaster = (SGameAvatarEx*)GetGameObject( pPickObject->GetMaster() ); if( pMaster ) { // 대련 중 일때 상대방 크리처 공격 가능, kappamind. if( ( pMaster->GetStatus() & TS_ENTER::PlayerInfo::FLAG_COMPETING ) && g_pCurrentGameSystem->GetPVPStart() ) { return true; } //내가 PK ON상태면 PK 가능 else if( (m_nAttackLimit & LIMIT_SUMMON ) != 0 ) { // sonador 7.0.22 Mantis 0002774: [타겟] tab키를 이용한 타겟설정 시 문제점 // AR_HANDLE targetHandle = pPickObject->GetArID(); AR_HANDLE targetHandle = pMaster->GetArID(); if( m_pGameSystem->IsPartyMember( targetHandle ) || m_pGameSystem->IsGuildMember( targetHandle ) ) return false; return true; } //상대방이 PK ON 상태 이거나 데모니악 및 블러디 플레이어 일경우 상대방의 크리처도 공격 가능 else if( ( pMaster->GetStatus() & TS_ENTER::PlayerInfo::FLAG_PK_ON ) || ( pMaster->GetStatus() & TS_ENTER::PlayerInfo::FLAG_DEMONIAC ) || ( pMaster->GetStatus() & TS_ENTER::PlayerInfo::FLAG_BLOODY ) ) { // sonador 7.0.22 Mantis 0002774: [타겟] tab키를 이용한 타겟설정 시 문제점 AR_HANDLE targetHandle = pMaster->GetArID(); if( m_pGameSystem->IsPartyMember( targetHandle ) || m_pGameSystem->IsGuildMember( targetHandle ) ) return false; return true; } } } return false; } void SGameWorld::SetTargetAttack( class SGameAvatarEx * pPickObject ) { // if( !m_pGameSystem->WeightConfirmationTheBeforeAttacking() ) return; assert( pPickObject && "이러면 안되지..." ); //공격 //타겟 자동 공격. 몹 만 공격 가능. if( IsAttack( pPickObject) ) { SInputAttack inputAttack( pPickObject->GetArID() ); AddGameInput( &inputAttack ); // _oprint( "SIMSG_UI_TARGET_ACTIVE_INFO::TARGET_ACTIVE_ING\n" ); //if( m_pGameSystem->GetLocalPlayer() ) // m_pGameSystem->GetLocalPlayer()->SetAttackObject( pPickObject ); SetUI_TargetActiveInfo( pPickObject->GetArID(), SIMSG_UI_TARGET_ACTIVE_INFO::TARGET_ACTIVE_ING ); } else { PlayerMoveTargetPosition( pPickObject ); } } void SGameWorld::PlayerMoveTargetPosition( class SGameAvatarEx * pPickObject ) { //if( m_pGameMng->IsOpenDynamicWnd() ) //{ // return; //} //특정 Windows가 Open 일 경우, 이동 불가 if( CheckUIWindowOpened() ) return; //타겟 쪽으로 이동시킨다 SGameAvatarEx* pLocalPlayer = m_pGameSystem->GetLocalPlayer(); if( !pLocalPlayer ) return; float size = pPickObject->GetSize()/2.f; float scale = pPickObject->GetScale(); float fTargetSize = size * scale * GameRule::DEFAULT_UNIT_SIZE; size = pLocalPlayer->GetSize()/2.f; scale = pLocalPlayer->GetScale(); float fMySize = size * scale * GameRule::DEFAULT_UNIT_SIZE; K3DVector vTargetPos = *pPickObject->GetPosition(); vTargetPos.z = 0.0f; K3DVector vPlayerPos = *pLocalPlayer->GetPosition(); vPlayerPos.z = 0.0f; float fDistance = GetDistance( vTargetPos, vPlayerPos ); //전체 거리 fDistance = fDistance - (fMySize + fTargetSize ); if( (int)fDistance <= 1.0f ) return; vPlayerPos = vPlayerPos - vTargetPos; K3DVectorNormalize( vPlayerPos, vPlayerPos ); vPlayerPos *= fTargetSize+fMySize; vTargetPos += vPlayerPos; m_bMoveTargetPos = true; pLocalPlayer->FindDetour(vTargetPos, true, false); SInputMove input_move( vTargetPos ); AddGameInput( &input_move ); } void SGameWorld::ProcLbuttonDown ( SIMSG_LBUTTONDOWN* pMsg ) { int nGameRef = GetGameRef(); if( nGameRef == STAGE_FADE_OUT || nGameRef == STAGE_FADE_IN || nGameRef == STAGE_EVENT_SCENE ) { return; } else { m_bSendDummyMsg = false; } DWORD dwStartTime = GetSafeTickCount(); //이동 K3DVector vNear, vFar, res; //m_pCamera->GetLineFromScreen( m_pViewPort, GET_X_LPARAM(pMsg->lParam), GET_Y_LPARAM(pMsg->lParam), &vNear, &vFar ); m_pViewPort->GetCameraSegmentView(GET_X_LPARAM(pMsg->lParam), GET_Y_LPARAM(pMsg->lParam), vNear, vFar ); SGameAvatarEx * pLocal = m_pGameSystem->GetLocalPlayer(); //죽으면, 모든게 안된다. if( !pLocal || !pLocal->IsLive() ) { ResetAutoMoveMode(); ResetAutoFollowMode(); return; } /// 2010.10.13 - prodongi if (m_renderRegionSkillTargetFx) { sendRegionSkillTargetFxMsg(); return ; } SGameAvatarEx * pPickObject = NULL; ////////////////////////////////////////////////////////////////////////// //이미 타겟이 있으면서 같은넘을 클릭하면, 공격 SGameAvatarEx * pTarget = m_pGameSystem->GetTarget(); if( pTarget ) { // Other players, NPCs, Mobs, Items pPickObject = m_pCommandSystem->GetPickObject(vNear, vFar); if( pPickObject && pPickObject->GetArID() == pTarget->GetArID() ) { // Single click on fieldprop if( pPickObject->GetObjType() == TS_ENTER::GAME_FIELD_PROP ) { if (m_activatePropInfo.m_prop != pPickObject->GetArID() && g_bRenderUI) // Should not operate if the interface is hidden using Ctrl + H { SGameFieldQuestProp* prop = dynamic_cast(pPickObject); if (prop->PlayAnimation(SGameFieldQuestProp::activeKeyName, SEQTYPE_NORMAL)) { m_activatePropInfo.set(prop->GetPropIntervalLength(), 4.8f, pPickObject->GetArID()); } else { ResetAutoMoveMode(); ResetAutoFollowMode(); m_pGameSystem->ActivateQuestProp( pLocal, pPickObject ); } } return; } else if( pPickObject->IsLive() ) { ResetAutoMoveMode(); ResetAutoFollowMode(); if( pPickObject->GetObjType() == TS_ENTER::GAME_NPC ) //NPC 이면 Contact 요청 { StartSound( "iconClick_iconmove_target.wav" ); //거리는 100보다 작아야 한다. if( GetDistance( *pLocal->GetPosition(), *pPickObject->GetPosition() ) < NPC_CLICK_LEN ) { //소환창이 나와 있을 경우 서버 트리거 변경을 막기 위해 NPC Contact 불가 if( !m_pGameMng->IsOpenDynamicWnd() ) { //NPC Contact 요청 //m_pGameSystem->AddClickNpc( pPickObject->GetArID() ); m_pGameSystem->Rq_NPC_Contact( pPickObject->GetArID() ); pPickObject->SetNpcTargetHandle( pLocal->GetArID() ); //NPC가 플레이어를 바라본다 m_pGameSystem->SetTarget( NULL ); } } else { PlayerMoveTargetPosition( pPickObject ); } return; } else if( pPickObject->GetObjType() == TS_ENTER::GAME_ITEM ) { m_pGameSystem->Rq_TakeItem( pPickObject->GetArID() ); return; } else { _oprint( "SetTargetAttack 01 : \n" ); //FindDetour(*pLocal->GetPosition(), *pTarget->GetPosition(), true); if( (pMsg->wParam & MK_CONTROL) == MK_CONTROL ) //컨트롤 다운 { m_pGameSystem->SetTarget( pPickObject ); //합동 공격 //타겟 자동 공격. 몹 만 공격 가능. if( IsAttack( pPickObject) ) { SetTargetAttack( pPickObject ); m_pGameSystem->SetCreatureAttack( pPickObject ); } return; } if( GetKeyState(VK_MENU) < 0 ) //알트 다운 { m_pGameSystem->SetTarget( pPickObject ); //선택된 크리쳐만 공격 //크리쳐 공격 //타겟 자동 공격. 몹 만 공격 가능. if( IsAttack( pPickObject) ) { //현재 선택된 크리쳐 인덱스 얻어오기... 만들자 m_pGameSystem->SetCreatureAttack( pPickObject ); } return; } SetTargetAttack( pPickObject ); return; } } } /* else { SInputAttack inputAttack( 0 ); AddGameInput( &inputAttack ); pLocal->SetAttackObject( NULL ); }*/ } ////////////////////////////////////////////////////////////////////////// //예외 처리, 시체, 자신, 크리쳐 //Shift Down시 LocalPlayer or LocalCreature Select 처리, if( (pMsg->wParam & MK_SHIFT) == MK_SHIFT ) { pPickObject = m_pCommandSystem->GetPickObject( vNear, vFar, TRUE ); } else { // Other players, NPCs, mobs, items pPickObject = m_pCommandSystem->GetPickObject(vNear, vFar); } ResetAutoMoveMode(); ResetAutoFollowMode(); if( pPickObject ) { if( pPickObject->GetObjType() != TS_ENTER::GAME_ITEM ) { if( (pMsg->wParam & MK_CONTROL) == MK_CONTROL ) // Ctrl button down { m_pGameSystem->SetTarget( pPickObject ); // Automatically attack the target. Can attack only mobs. if( IsAttack( pPickObject) ) { SetTargetAttack( pPickObject ); m_pGameSystem->SetCreatureAttack( pPickObject ); } return; } if( GetKeyState(VK_MENU) < 0 ) // Alt button down { m_pGameSystem->SetTarget( pPickObject ); // Attack only the selected creature // Creature attack // Automatically attack the target. Can attack only mobs. if( IsAttack( pPickObject) ) { // Get the index of the currently selected creature… let’s implement it. m_pGameSystem->SetCreatureAttack( pPickObject ); } return; } } switch( pPickObject->GetObjType() ) { //Item 이면 줍는다. case TS_ENTER::GAME_ITEM : { m_pGameSystem->Rq_TakeItem( pPickObject->GetArID() ); return; } case TS_ENTER::GAME_NPC: { if( (pMsg->wParam & MK_SHIFT) == MK_SHIFT ) return; //쉬프트 클릭으로 NPC 선택이 안돼야 된다. //타겟 설정 m_pGameSystem->SetTarget( pPickObject ); return; } case TS_ENTER::GAME_FIELD_PROP: { m_pGameSystem->SetTarget( pPickObject ); return; } case TS_ENTER::GAME_SKILL_PROP: { m_pGameSystem->SetTarget( NULL ); return; } break; default: { //타겟 설정 m_pGameSystem->SetTarget( pPickObject ); //_oprint( "TARGET : %u %f, %f\n", pPickObject->GetArID(), pPickObject->GetCurPos().x, pPickObject->GetCurPos().y ); if( pLocal && pPickObject->GetObjType() == TS_ENTER::GAME_MOB ) { StartSound( "iconClick_iconmove_target.wav" ); } return; } } } // If a specific window is open, movement is not allowed if( CheckUIWindowOpened() ) return; // Recalculating movement m_pViewPort->GetCameraSegmentView(GET_X_LPARAM(pMsg->lParam), GET_Y_LPARAM(pMsg->lParam), vNear, vFar ); TERRAIN_PICK_RESULT nPickResult = m_pTerrainMapEngine->GetLineCrossedPoint( m_pCamera, vNear, vFar, res ); if( nPickResult == TERRAIN_PICK_FAILED ) { // If it’s not a terrain click, automatically move in the clicked direction res = *pLocal->GetPosition(); m_vAutoMoveDir = vFar - res; K3DVectorNormalize( m_vAutoMoveDir, m_vAutoMoveDir ); res += m_vAutoMoveDir * (float)GameRule::DEFAULT_UNIT_SIZE * 50.f; // Send it 50 meters forward m_vTargetPos = res; m_bAutoMove = true; } else if( nPickResult == TERRAIN_PICK_DISTANCE_FAILED ) { return; } //SGameAvatarEx * pLocal = m_pGameSystem->GetLocalPlayer(); // Cancel the ongoing attack if( pLocal ) { K3DVector curpos = *pLocal->GetPosition(); if( (int)curpos.x == (int)res.x && (int)curpos.y == (int)res.y ) return; //if (pPickObject->GetObjType() == TS_ENTER::GAME_FIELD_PROP) //{ // K3DVector* objectPosition = pPickObject->GetPosition(); // const float* fSelection = pPickObject->GetSelectCube(); //} pLocal->SetTerrainPickPos( &res ); pLocal->FindDetour( res, true, false ); K3DVector vNextPos; if( pLocal->MoveDetour( vNextPos ) ) { if( (pMsg->wParam & MK_SHIFT) == MK_SHIFT ) { const std::vector< SGameAvatarEx* > & vSummonList = m_pGameSystem->GetSummonList(); if( vSummonList.empty() ) { SGameAvatarEx* pTarget = m_pGameSystem->GetTarget(); if( pTarget && pTarget->IsDummyCreature() ) m_pCommandSystem->MoveDummyCreature( pTarget, res ); } else { std::vector< SGameAvatarEx* >::const_iterator iter = vSummonList.begin(); for( ; iter != vSummonList.end(); ++iter ) { SGameAvatarEx* pSummon = (*iter); pSummon->FindDetour( res, true, false ); pSummon->MoveDetour( vNextPos ); } SInputMove input_move( res, false ); //크리처 자신의 속도로 이동한 AddGameCreatureInput( &input_move ); } } else { // If in mount mode, delete the automatic movement path if( pLocal->IsMountMode() ) pLocal->ClearWayPointList(); SInputMove input_move( res ); AddGameInput( &input_move ); } } else { m_pCommandSystem->MoveImpossibleMsg(); } SGameAvatarEx * pTarget = m_pGameSystem->GetTarget(); if( pTarget ) { // _oprint( "SIMSG_UI_TARGET_ACTIVE_INFO::TARGET_ACTIVE_OFF\n" ); SetUI_TargetActiveInfo( pTarget->GetArID(), SIMSG_UI_TARGET_ACTIVE_INFO::TARGET_ACTIVE_FORCE_OFF ); } } int admin_move = g_pCurrentGameSystem->GetLocalPlayerPermission(); #ifdef _DEV admin_move = 1; #endif if (admin_move && ((pMsg->wParam & MK_CONTROL)==MK_CONTROL)) { int x = res.x; int y = res.y; g_pCurrentGameSystem->Rq_Chatting( CHAT_NORMAL, NULL, CStringUtil::StringFormat( "/warp2 %d %d", x,y ).c_str() ); return; } } /// 2010.10.31 - prodongi void SGameWorld::ProcRbuttonDown(SIMSG_RBUTTONDOWN* pMsg) { inactiveRegionSkillTargetFx(); } // Left mouse button double click message function void SGameWorld::ProcLbuttonDblclk( SIMSG_LBUTTONDBLCLK* pMsg ) { // Monster attack K3DVector vNear, vFar; m_pViewPort->GetCameraSegmentView(GET_X_LPARAM(pMsg->lParam), GET_Y_LPARAM(pMsg->lParam), vNear, vFar ); SGameAvatarEx * pPickObject = m_pCommandSystem->GetPickObject(vNear, vFar); // Local Player SGameAvatarEx * pLocal = m_pGameSystem->GetLocalPlayer(); if( pLocal ) { if( !pPickObject ) return; if( pPickObject->IsLive() ) { #ifdef _DEBUG _oprint( "SetTargetAttack 02 : \n" ); #endif //FindDetour(*pLocal->GetPosition(), *pPickObject->GetPosition(), true); if( (pMsg->wParam & MK_SHIFT) == MK_SHIFT ) { if(pPickObject->GetObjType() == TS_ENTER::GAME_NPC) return; //쉬프트 클릭으로 NPC 선택이 안돼야 된다. } if(pPickObject->GetObjType() == TS_ENTER::GAME_NPC) { SGameAvatarEx * pLocal = m_pCommandSystem->GetLocalPlayer(); if( pLocal ) { StartSound( "iconClick_iconmove_target.wav" ); //거리는 100보다 작아야 한다. //탈것 이용시 z축 값에 문제가 있어서 일단 임시 수정 2009.08.06 sfreer K3DVector local = *pLocal->GetPosition(); K3DVector pick = *pPickObject->GetPosition(); local.z = 0; pick.z = 0; if( GetDistance( local, pick ) < NPC_CLICK_LEN ) { if( !m_pGameMng->IsOpenDynamicWnd() ) { //NPC Contact 요청 // m_pGameSystem->AddClickNpc( pPickObject->GetArID() ); m_pGameSystem->Rq_NPC_Contact( pPickObject->GetArID() ); pPickObject->SetNpcTargetHandle( pLocal->GetArID() ); //NPC가 플레이어를 바라본다 m_pGameSystem->SetTarget( NULL ); } } else { m_pGameSystem->SetTarget( pPickObject ); PlayerMoveTargetPosition( pPickObject ); } } } else { m_pGameSystem->SetTarget( pPickObject ); SetTargetAttack( pPickObject ); } } // Double click on fieldprop if( pPickObject->GetObjType() == TS_ENTER::GAME_FIELD_PROP ) { if (m_activatePropInfo.m_prop != pPickObject->GetArID() && g_bRenderUI) // Should not operate if the interface is hidden using Ctrl + H { m_pGameSystem->SetTarget( pPickObject ); SGameFieldQuestProp* prop = dynamic_cast(pPickObject); if (prop->PlayAnimation(SGameFieldQuestProp::activeKeyName, SEQTYPE_NORMAL)) { m_activatePropInfo.set(prop->GetPropIntervalLength(), 4.8f, pPickObject->GetArID()); } else { m_pGameSystem->ActivateQuestProp( pLocal, pPickObject ); } } } } } //#ifndef NDEBUG //디버깅 용 void SGameWorld::AddGameCreatureInput( class SGameInput * pInput )//크리쳐에게 직접 내림. { m_pGameSystem->AddGameCreatureInput( pInput ); } //#endif void SGameWorld::AddGameInput( SGameInput * pInput ) { m_pGameSystem->AddGameInput( pInput ); } // Calculates a valid target point between the current point and the destination point K3DVector SGameWorld::GetCalculatePos( K3DVector & cur_pos, K3DVector & tar_pos ) { int nAttrCellLen = GetAttrCellLength(); K3DVector origin_curpos = cur_pos; tar_pos.z = cur_pos.z = 0; K3DVector dir; //방향 K3DVector tpos(0,0,0); //증가 위치 K3DVectorNormalize( dir, tar_pos - cur_pos ); tpos = cur_pos; K3DVector f = (dir * float(nAttrCellLen*4)); int nLoopCnt = 0; { while(true) { cur_pos = tpos; tpos += f; if( IsBlockedAttribute( tpos.x, tpos.y ) ) { break; } if( K3DVectorLength( tpos-origin_curpos ) >= K3DVectorLength( tar_pos-origin_curpos ) ) { cur_pos = tar_pos; break; //기존 타겟보다 크면 끝 } nLoopCnt++; } } return cur_pos; } ////내가 아는 경우, 이동시~ bool SGameWorld::onLeave( _Object *pPtr ) { //지우기 전에 먼저 처리~ ( m_pGameSystem->onLeave에서 처리됨 ) // m_pGameSystem->CheckTarget( pPtr->handle ); SMSG_LEAVE msg; msg.handle = pPtr->handle; m_pGameMng->InterfaceMsg( &msg ); SGameAvatarEx* pLocalCreature = m_pGameSystem->IsSummonCreature( pPtr->handle ); //현재 소환된 크리처인가? if( pLocalCreature ) { pLocalCreature->Deactivate(); return false; } else { //운송용 크리처일경우 SGameAvatarEx* pTransportCreature = (SGameAvatarEx*)GetGameTransportCreatureObject( pPtr->handle ); if( pTransportCreature ) { /* if( pTransportCreature->IsLocalCreature() ) { return false; } else*/ { m_pCommandSystem->LeaveTransportCreature( pPtr->handle, false ); return true; } } } // // 현재 소환된 팻일 경우: // leave 처리 하지 않고 잠시 deactive 해준다. // SGameAvatarEx* pLocalPet = m_pGameSystem->IsSummonPet( pPtr->handle ); if( pLocalPet ) { pLocalPet->Deactivate(); return false; } //( m_pGameSystem->onLeave에서 처리됨 ) // m_pGameSystem->LeaveSkillProp( pPtr->handle ); m_pGameSystem->onLeave( &msg ); m_pCommandSystem->onLeave( pPtr->handle ); return true; } void SGameWorld::DropItem( AR_HANDLE handle ) { m_pCommandSystem->DropItem( handle ); } void SGameWorld::OnCameraEffect( struct SGameMessage* pDamage ) { if( GetGameOption().GetCriticalCamera() <= 0 ) return; // Fraun performance tweak if( pDamage->nType == MSG_DAMAGE ) { SMSG_DAMAGE* pDmgMsg = static_cast(pDamage); if(pDmgMsg->nDamage <= 0 ) return; if( m_pGameSystem->GetLocalPlayer() && ( pDmgMsg->target_handle == m_pGameSystem->GetLocalPlayer()->GetArID() || pDmgMsg->attacker_handle == m_pGameSystem->GetLocalPlayer()->GetArID() ) ) { //공격 이펙트 라이트 설정 if( ( !(pDmgMsg->flag & TS_ATTACK_EVENT::FLAG_MISS) && (pDmgMsg->attack_action == TS_ATTACK_EVENT::ATTACK_ATTACK) ) || (pDmgMsg->skillresult.GetType() == SkillResult::DAMAGE || pDmgMsg->skillresult.GetType() == SkillResult::CHAIN_DAMAGE) ) { m_dwEEffectLight_Live = m_dwTime; //기본 칼라 설정 m_EffectLightDiff = K3DColor(3.f,3.f,3.f); //기본 위치 설정 m_pCamera->GetTargetPos( m_pEffectLight->position.x, m_pEffectLight->position.y, m_pEffectLight->position.z ); m_pEffectLight->position.z += 10.f; m_EffectLightPos = m_pEffectLight->position; } bool bCritical = false; if( (pDmgMsg->attack_action == TS_ATTACK_EVENT::ATTACK_ATTACK) && (pDmgMsg->flag & TS_ATTACK_EVENT::FLAG_CRITICAL) ) bCritical = true; if(bCritical) { SMSG_CAMERA_EFFECT msg; msg.nEffect = 1; msg.fDeltaX = 0.02f; msg.fDeltaY = 0.02f; msg.dwKeepTime = 100; m_pGameCamera->SendGameMsg( &msg ); } else { if( pDmgMsg->nHittingAdd_FxID == c_nLeftRightSmall ) //좌우진동 (약) 1 { SMSG_CAMERA_EFFECT msg; msg.nEffect = 1; msg.fDeltaX = 0.03f; msg.fDeltaY = 0.03f; msg.dwKeepTime = 300; m_pGameCamera->SendGameMsg( &msg ); } else if( pDmgMsg->nHittingAdd_FxID == c_nBottomTopSmall ) //상하진동 (약) 2 { SMSG_CAMERA_EFFECT msg; msg.nEffect = 2; msg.fDeltaX = 0.03f; msg.fDeltaY = 0.03f; msg.dwKeepTime = 300; m_pGameCamera->SendGameMsg( &msg ); } else if( pDmgMsg->nHittingAdd_FxID == c_nLeftRightMiddle ) //좌우진동 (중) 3 { SMSG_CAMERA_EFFECT msg; msg.nEffect = 1; msg.fDeltaX = 0.1f; msg.fDeltaY = 0.1f; msg.dwKeepTime = 300; m_pGameCamera->SendGameMsg( &msg ); } else if( pDmgMsg->nHittingAdd_FxID == c_nBottomTopMiddle ) //상하진동 (중) 4 { SMSG_CAMERA_EFFECT msg; msg.nEffect = 2; msg.fDeltaX = 0.1f; msg.fDeltaY = 0.1f; msg.dwKeepTime = 300; m_pGameCamera->SendGameMsg( &msg ); } else if( pDmgMsg->nHittingAdd_FxID == c_nLeftRightLarge ) //좌우진동 (강) 5 { SMSG_CAMERA_EFFECT msg; msg.nEffect = 1; msg.fDeltaX = 0.4f; msg.fDeltaY = 0.4f; msg.dwKeepTime = 300; m_pGameCamera->SendGameMsg( &msg ); } else if( pDmgMsg->nHittingAdd_FxID == c_nBottomTopLarge ) //상하진동 (강) 6 { SMSG_CAMERA_EFFECT msg; msg.nEffect = 2; msg.fDeltaX = 0.4f; msg.fDeltaY = 0.4f; msg.dwKeepTime = 300; m_pGameCamera->SendGameMsg( &msg ); } } } } } void SGameWorld::OnSkillDamage( AR_HANDLE caster, AR_HANDLE target, struct SGameMessage* pDamage ) { _oprint( "ONSKILLDAMAGE %u\n ", target); // OnCameraEffect( pDamage ); //Status Effect m_pGameSystem->AddStatusFireAction( pDamage ); //UI_Sync m_pGameSystem->OnUISync( caster, target, SIMSG_UI_TARGET_STAT::USE_DEF ); SMSG_DAMAGE* pDmgMsg = static_cast(pDamage); //데미지 타입 설정 pDmgMsg->nDamage_Type = SMSG_DAMAGE::SKILL_DAMAGE; if( pDamage->nType == MSG_DAMAGE ) { bool bSendMsg = false; SGameAvatarEx* pCaster = (SGameAvatarEx*)GetGameObject( caster ); SGameAvatarEx* pTarget = (SGameAvatarEx*)GetGameObject( target ); if( pCaster ) { if( pCaster->IsLocalPlayer() || pCaster->IsLocalCreature() ) bSendMsg = true; } if( pTarget ) { if( pTarget->IsLocalPlayer() || pTarget->IsLocalCreature() ) bSendMsg = true; } if (pDmgMsg->chainCaster) { SGameAvatarEx* chainCaster = (SGameAvatarEx*)GetGameObject(pDmgMsg->chainCaster); if (chainCaster) { if (chainCaster->IsLocalPlayer() || chainCaster->IsLocalCreature()) bSendMsg = true; } } if( bSendMsg ) { //인터페이스에 알림 m_pGameMng->InterfaceMsg( pDamage ); } else { /// 2011.03.25 - prodongi if( pDmgMsg->skillresult.GetType() == SkillResult::ADD_HP || pDmgMsg->skillresult.GetType() == SkillResult::ADD_MP || pDmgMsg->skillresult.GetType() == SkillResult::ADD_HP_MP_SP || pDmgMsg->skillresult.GetType() == SkillResult::CHAIN_HEAL ) { if( m_pGameSystem->IsPartyMember( caster ) || m_pGameSystem->IsPartyMember( target ) ) { m_pGameMng->InterfaceMsg( pDamage ); } /// 2011.03.25 - prodongi else if (pDmgMsg->chainCaster && m_pGameSystem->IsPartyMember( pDmgMsg->chainCaster )) { m_pGameMng->InterfaceMsg( pDamage ); } } } } } void SGameWorld::OnDamage( AR_HANDLE caster, AR_HANDLE target, struct SGameMessage* pDamage ) { OnCameraEffect( pDamage ); //Status Effect m_pGameSystem->AddStatusFireAction( pDamage ); // TODO : 몬스터나 플레이어가 안죽는 문제가 발생할수도 있으니 주석처리 //m_pGameSystem->OnUISync( caster ); //UI_Sync m_pGameSystem->OnUISync( caster, target, SIMSG_UI_TARGET_STAT::USE_DEF ); //인터페이스에 알림 m_pGameMng->InterfaceMsg( pDamage ); } void SGameWorld::OnDotDamage( struct SMSG_DAMAGE* pDamage, bool bFinalDmg ) { //데미지 타입 설정 pDamage->nDamage_Type = SMSG_DAMAGE::DOT_DAMAGE; m_pGameSystem->OnUISync( pDamage->attacker_handle, pDamage->target_handle, SIMSG_UI_TARGET_STAT::USE_STATE_DMG ); if( bFinalDmg ) m_pGameMng->InterfaceMsg( pDamage ); } void SGameWorld::OnDisplayDamage( struct SMSG_DAMAGE* pDamage ) { m_pGameMng->InterfaceMsg( pDamage ); } void SGameWorld::OnUISync( AR_HANDLE caster, AR_HANDLE target ) { m_pGameSystem->OnUISync( caster, target, SIMSG_UI_TARGET_STAT::USE_DEF ); } void SGameWorld::OnDead() { //타겟 무효... m_pGameSystem->SetTarget(NULL); } void SGameWorld::GetNearVertices( float x, float y, K3DVertex* pGetVertices ) const { m_pTerrainMapEngine->GetNearVertices( x, y, 3, 3, pGetVertices ); } void SGameWorld::GetNearVertices( float x, float y, int cx, int cy, K3DVertex* pGetVertices ) const { m_pTerrainMapEngine->GetNearVertices( x, y, cx, cy, pGetVertices ); } void SGameWorld::GetTerrainTriangle( float x, float y, K3DVector& v1, K3DVector& v2, K3DVector& v3 ) const { if( m_pTerrainMapEngine ) m_pTerrainMapEngine->GetTerrainTriangle( x, y, v1, v2, v3 ); } bool SGameWorld::GetHeight( const float x, const float y, float& out, WORD& wTile ) { //return 0.f; return m_pTerrainMapEngine->GetTerrainHeight( x, y, out, wTile ); } bool SGameWorld::GetOnlyTerrainHeight( const float x, const float y, float& out ) { return m_pTerrainMapEngine->GetOnlyTerrainHeight( x, y, out ); } void SGameWorld::PlayerInsideWaterExistence( K3DVector & vPlayerPosition, bool & bInWater ) { if( m_pLowQualityWater ) bInWater = m_pLowQualityWater->PlayerInsideWaterExistence( vPlayerPosition ); else bInWater = false; } CTerrainProp* SGameWorld::GetTerrainProp( const float x, const float y, float& out ) { return m_pTerrainMapEngine->GetTerrainProp( x, y, out ); } void SGameWorld::SetMoveTargetPos( const float x, const float y, const float z, bool bChase ) { K3DVector pos = m_pTargetModel->GetPosition(); if( pos.x == x && pos.y == y && pos.z == z ) { if( m_bMoveTargetPos ) m_bMoveTargetPos = false; return; //같으면 Return } // _oprint( "Target Pos : %f %f %f\n", x, y, z ); if( bChase ) m_bTargetModel = false; //m_pTargetModel->SetVisibility( 0.f ); //추적 할때는 안 보여 준다. else if( m_bAutoMove || m_bAutoFollowMode ) m_bTargetModel = false; //m_pTargetModel->SetVisibility( 0.f ); //자동 이동일때는 숨기기 else m_bTargetModel = true; //m_pTargetModel->SetVisibility( 1.f ); if( m_bMoveTargetPos ) { m_bMoveTargetPos = false; m_bTargetModel = false; } m_pTargetModel->SetPosition( x, y, z ); } bool SGameWorld::IsBlockedAttribute( const float x, const float y ) { return m_pTerrainMapEngine->IsBlockedAttribute( x, y ); } void SGameWorld::SetSoundPosition( float lis_x, float lis_y, float lis_z, float x, float y, float z, bool bNeedPosUpdate ) const { if( bNeedPosUpdate ) { SGameAvatarEx* pLocalPlayer = m_pGameSystem->GetLocalPlayer(); if( pLocalPlayer ) { K3DVector vView = pLocalPlayer->GetViewVector(); m_pMSoundMgr->SetOrientation( vView.x, vView.y, vView.z, 0.0f, 0.0f, 1.0f ); } m_pMSoundMgr->SetListenerPosition( x, y, z ); } //K3DVector vtView = m_pCamera->GetViewVector(); //K3DVector vtUp = m_pCamera->GetUpVector(); //K3DVector vtRes = CrossProduct(vtView, vtUp); //Normalize(vtRes); //vtUp = CrossProduct(vtRes, vtView); //Normalize(vtUp); //m_pSoundMng->SetOrientation( -m_pCamera->GetViewVector().x,-m_pCamera->GetViewVector().y,-m_pCamera->GetViewVector().z, // vtUp.x, vtUp.y, 0 -vtUp.z ); } void SGameWorld::SetUI_TargetActiveInfo( AR_HANDLE handle, int nType ) { SIMSG_UI_TARGET_ACTIVE_INFO msg; msg.handle = handle; msg.nActiveInfo = nType; ProcMsgAtStatic( &msg ); } void SGameWorld::Rq_TakeItem( AR_HANDLE objHandle ) { m_pGameSystem->Rq_TakeItem( objHandle ); } void SGameWorld::Rq_PutOnOffItem( AR_HANDLE hTarget, AR_HANDLE hItem, int nPosition ) { m_pGameSystem->Rq_PutOnOffItem( hTarget, hItem, nPosition ); } bool SGameWorld::Rq_ChagePKMode( bool bOnOff ) { if( bOnOff ) { if( m_bIsAttackLocation ) { TS_CS_TURN_ON_PK_MODE msg; SendMsg( &msg ); } else { return false; } } else { TS_CS_TURN_OFF_PK_MODE msg; SendMsg( &msg ); } return true; } // 공지 채팅만 출력, kappamind. void SGameWorld::AddNoticeMessageOnly( const char * pStr ) { SMSG_CHATTING msg; msg.handle = 0; msg.nChatType = CHAT_NOTICE; msg.szSender = "@NOTICE";//"notice"; msg.strText = pStr; msg.nNoticeOnly = 1; m_pGameMng->InterfaceMsg( &msg ); } void SGameWorld::AddChatMessage( const char * pStr ) { SMSG_CHATTING msg; msg.handle = 0; msg.nChatType = CHAT_SYSTEM; msg.szSender = "";//"system"; msg.strText = pStr; msg.nNoticeOnly = 0; m_pGameMng->InterfaceMsg( &msg ); } void SGameWorld::AddDebugMessage( const char * pStr, ... ) { char szBuf[2048]; va_list va; va_start( va, pStr ); _vsnprintf( szBuf, sizeof(szBuf), pStr, va ); va_end( va ); AddChatMessage( szBuf ); } void SGameWorld::RqChatting( int nChatType, const char * pName, const char * pStr ) { //_oprint("void SGameWorld::RqChatting( int nChatType, const char * pName, const char * pStr )\n"); SMSG_CHATTING_REQUEST msgChatReq; memset( msgChatReq.szTarget, 0, sizeof(msgChatReq.szTarget) ); msgChatReq.type = nChatType; if( strlen(pName) && strlen(pName) < _countof(msgChatReq.szTarget) ) { strcpy( msgChatReq.szTarget, pName ); msgChatReq.strText = pStr; m_pGameSystem->ProcMsgAtStatic( &msgChatReq ); } } void SGameWorld::SetPlayerAttack( class SGameAvatarEx * pTarget ) { SetUI_TargetActiveInfo( pTarget->GetArID(), SIMSG_UI_TARGET_ACTIVE_INFO::TARGET_ACTIVE_ING ); } struct DATA_CREATURE * SGameWorld::IsLocalCreature( AR_HANDLE handle ) { return m_pGameSystem->IsLocalCreature( handle ); } SGameAvatarEx* SGameWorld::IsSummonCreature( AR_HANDLE handle ) { return m_pGameSystem->IsSummonCreature( handle ); } void SGameWorld::SetPKMode( bool bMode ) { /* m_nAttackLimit = 0; //pknotall m_nAttackLimit = LIMIT_MOB|LIMIT_PLAYER|LIMIT_SUMMON; //pkall m_nAttackLimit = LIMIT_MOB|LIMIT_PLAYER; //pkmob m_nAttackLimit = LIMIT_MOB|LIMIT_SUMMON; //pksummon*/ if( bMode ) { AddChatMessage( "PK ON" ); m_nAttackLimit = LIMIT_MOB|LIMIT_PLAYER|LIMIT_SUMMON; } else { AddChatMessage( "PK OFF" ); m_nAttackLimit = LIMIT_MOB; } } bool SGameWorld::UseSkill( AR_HANDLE caster, int nSkillId, int nSkill_Lv, AR_TIME cast_time ) { //인터페이스 시전 표시 시간 SIMSG_UI_GAUGE_TIME_INFO timemsg; timemsg.time = cast_time*10; //1/100 -> 1/1000 변경 timemsg.caster = caster; timemsg.nSkillID = nSkillId; timemsg.nSkillLv = nSkill_Lv; ProcMsgAtStatic( &timemsg ); return true; } void SGameWorld::auto_graphic( int nSwitch ) { //float fValue[5]; //if( nSwitch == 0 ) //최고 //{ // fValue[0] = 1.f; // fValue[1] = 3.f; // fValue[2] = 0.f; // fValue[3] = 3000.f; // fValue[4] = 1.f; //} //else if( nSwitch == 1 ) //권장 //{ // fValue[0] = 0.6f; // fValue[1] = 3.f; // fValue[2] = 0.f; // fValue[3] = 3000.f; // fValue[4] = 1.3f; //} //else if( nSwitch == 2 ) //쾌적 //{ // fValue[0] = 0.4f; // fValue[1] = 3.f; // fValue[2] = 1.f; // fValue[3] = 3000.f; // fValue[4] = 0.5f; //} //else if( nSwitch == 3 ) //저품질 //{ // fValue[0] = 0.2f; // fValue[1] = 0.f; // fValue[2] = 1.f; // fValue[3] = 300.f; // fValue[4] = 0.f; //} //SShadowViewPort* pShadowViewport = m_pViewPort->GetShadowViewPort(); //m_pTerrainMapEngine->SetTerrainVisibleDistanceRatio( fValue[0] ); //if(pShadowViewport) pShadowViewport->SetShadowMapQuality(fValue[1]); //KTextureManager::GetManager()->SetMipMapBiasLevel( fValue[2] ); //m_pCommandSystem->SetAvatarVisRange( fValue[3] ); //CTerrainProp::SetLODMax( fValue[4] ); } void SGameWorld::OnSysCommand( const char *pChat, std::vector< std::string > & vToken ) { SGame::OnSysCommand( pChat, vToken ); //std::string strCheat; //std::string strCommand = vToken[0].c_str()+2; //char szShortTmp[32]; memset( szShortTmp, 0, sizeof(szShortTmp) ); //if( strCommand == "set_g" ) //그래픽 품질 전반 설정 //{ // int nSwitch = atoi(vToken[1].c_str()); // GetGameOption().SetAutoGraphic( nSwitch ); // auto_graphic( nSwitch ); // return; //} } // 콘솔에 메시지 출력하기 위한 함수 #include "SUITopConsoleWnd.h" extern SBotManager* g_pSBotMng; #define CPRINT(a) (g_pSBotMng->getConsoleWindow()->AddChatText(a)) // 검광 관련 디버깅용 #include "SGameFxSwordSlash.h" // char *WeaponTrailProcessConsoleCommand(std::string &key, int argc, std::vector &argv) // 무기 파워업 디버깅용 //#include "SGameFxWeaponPowerup.h" // char *WeaponPowerupProcessConsoleCommand(std::string &key, int argc, std::vector &argv) struct _PW_PARAM_ { int numFrames; int loopWindowSize; int animationDelay; int markFrame; DWORD startColor0; DWORD startColor1; DWORD markColor0; DWORD markColor1; DWORD endColor0; DWORD endColor1; float startSizeOffset; float markSizeOffset; float endSizeOffset; char szTexName[256]; }; const char *defaultFileName="pwParams.txt"; void saveToFile( const char* pFName, KMsgGET_MORPHMESH* pMsg ) { _PW_PARAM_ param; param.numFrames = pMsg->numFrames ; param.loopWindowSize = pMsg->loopWindowSize ; param.animationDelay = pMsg->animationDelay ; param.markFrame = pMsg->markFrame ; param.startColor0 = pMsg->startColor0 ; param.startColor1 = pMsg->startColor1 ; param.markColor0 = pMsg->markColor0 ; param.markColor1 = pMsg->markColor1 ; param.endColor0 = pMsg->endColor0 ; param.endColor1 = pMsg->endColor1 ; param.startSizeOffset = pMsg->startSizeOffset; param.markSizeOffset = pMsg->markSizeOffset ; param.endSizeOffset = pMsg->endSizeOffset ; param.szTexName[_countof(param.szTexName)-1] = '\0'; strcpy( param.szTexName, pMsg->strTexture.c_str() ); FILE* pF = fopen( pFName, "wt" ); if( pF ) { fprintf( pF, "pwTotalFrames\t %d\n" , param.numFrames ); fprintf( pF, "pwLoopGap\t %d\n" , param.loopWindowSize ); fprintf( pF, "pwAnimationDelay\t %d\n", param.animationDelay ); fprintf( pF, "pwMarkFrame\t %d\n" , param.markFrame ); fprintf( pF, "pwStartColor0\t %x\n" , param.startColor0 ); fprintf( pF, "pwStartColor1\t %x\n" , param.startColor1 ); fprintf( pF, "pwMarkColor0\t %x\n" , param.markColor0 ); fprintf( pF, "pwMarkColor1\t %x\n" , param.markColor1 ); fprintf( pF, "pwEndColor0\t %x\n" , param.endColor0 ); fprintf( pF, "pwEndColor1\t %x\n" , param.endColor1 ); fprintf( pF, "pwStartSize\t %f\n" , param.startSizeOffset ); fprintf( pF, "pwMarkSize\t %f\n" , param.markSizeOffset ); fprintf( pF, "pwEndSize\t %f\n" , param.endSizeOffset ); fprintf( pF, "pwTexture\t %s\n" , param.szTexName ); fclose( pF ); } //KFileStream fstream( pFName, KFileStream::wronly ); //if( fstream.IsValid() ) //{ // fstream.Write( ¶m, sizeof(param)); //} } void loadFromFile( const char* pFName, KMsgSET_MORPHMESH* pMsg ) { KFileStream lf( pFName ); if( lf.IsValid() ) { // 데이터 파일 크기 세팅 size_t nLen = lf.GetLength(); char * pstrTemp = new char[nLen+1]; pstrTemp[nLen] = '\0'; for( size_t i(0); nLen>i; i++ ) { lf.Read( &pstrTemp[i], 1 ); } std::vector< std::string > vString; XStringUtil::Split( pstrTemp, vString, "\t\r\n" ); int nLoop = (int)vString.size()/2; if( nLoop == 14 ) { pMsg->numFrames = atoi( vString[1].c_str() ); pMsg->loopWindowSize = atoi( vString[3].c_str() ); pMsg->animationDelay = atoi( vString[5].c_str() ); pMsg->markFrame = atoi( vString[7].c_str() ); char *HEX_P; pMsg->startColor0 = strtoul(vString[9].c_str(), &HEX_P, 16); pMsg->startColor1 = strtoul(vString[11].c_str(), &HEX_P, 16); pMsg->markColor0 = strtoul(vString[13].c_str(), &HEX_P, 16); pMsg->markColor1 = strtoul(vString[15].c_str(), &HEX_P, 16); pMsg->endColor0 = strtoul(vString[17].c_str(), &HEX_P, 16); pMsg->endColor1 = strtoul(vString[19].c_str(), &HEX_P, 16); pMsg->startSizeOffset= atof( vString[21].c_str() ); pMsg->markSizeOffset = atof( vString[23].c_str() ); pMsg->endSizeOffset = atof( vString[25].c_str() ); pMsg->strTexture = vString[27]; pMsg->bShow = true; pMsg->nSetFlag |= KMsgSET_MORPHMESH::FLAG_FRAME; pMsg->nSetFlag |= KMsgSET_MORPHMESH::FLAG_LOOP; pMsg->nSetFlag |= KMsgSET_MORPHMESH::FLAG_DELAY; pMsg->nSetFlag |= KMsgSET_MORPHMESH::FLAG_MARK; pMsg->nSetFlag |= KMsgSET_MORPHMESH::FLAG_SC0; pMsg->nSetFlag |= KMsgSET_MORPHMESH::FLAG_SC1; pMsg->nSetFlag |= KMsgSET_MORPHMESH::FLAG_MC0; pMsg->nSetFlag |= KMsgSET_MORPHMESH::FLAG_MC1; pMsg->nSetFlag |= KMsgSET_MORPHMESH::FLAG_EC0; pMsg->nSetFlag |= KMsgSET_MORPHMESH::FLAG_EC1; pMsg->nSetFlag |= KMsgSET_MORPHMESH::FLAG_SSIZE; pMsg->nSetFlag |= KMsgSET_MORPHMESH::FLAG_MSIZE; pMsg->nSetFlag |= KMsgSET_MORPHMESH::FLAG_ESIZE; pMsg->nSetFlag |= KMsgSET_MORPHMESH::FLAG_TEXTURE; } vString.clear(); } } //콘솔 치트 void SGameWorld::ProcConsole( SGameMessage* pGameMsg ) { if( pGameMsg->nType != MSG_CONSOLE_BUILDER ) return; SGame::ProcConsole( pGameMsg ); SMSG_CONSOLE_BUILDER* pMsg = static_cast(pGameMsg); //============================================= // 검광 디버깅용 //============================================= // 'wt'로 시작하는 모든 함수를 검광용으로 사용 (wt stands for 'Weapon Trail') if ((pMsg->m_strKey.c_str()[0]=='w' || pMsg->m_strKey.c_str()[0]=='W') && (pMsg->m_strKey.c_str()[1]=='t' || pMsg->m_strKey.c_str()[1]=='T')) { char *ret=WeaponTrailProcessConsoleCommand(pMsg->m_strKey, pMsg->m_nValueCount, pMsg->m_vecValueList); if (ret!=NULL) CPRINT(ret); return; } // 'pw'로 시작하는 모든 함수를 검광용으로 사용 (wt stands for 'Weapon Trail') if ((pMsg->m_strKey.c_str()[0]=='p' || pMsg->m_strKey.c_str()[0]=='P') && (pMsg->m_strKey.c_str()[1]=='w' || pMsg->m_strKey.c_str()[1]=='W')) { static std::string strFileName = defaultFileName; SGameAvatarEx* pLocal = m_pGameSystem->GetLocalPlayer(); if( pLocal ) { if( pMsg->m_nValueCount > 0 ) { KMsgSET_MORPHMESH msg; msg.bShow = true; int nValue = atoi( pMsg->m_vecValueList[0].c_str()); int fValue = atof( pMsg->m_vecValueList[0].c_str()); char *HEX_P; DWORD dwValue = strtoul(pMsg->m_vecValueList[0].c_str(), &HEX_P, 16); if( !::_stricmp( pMsg->m_strKey.c_str(), "pwShow") ) { msg.bShow = (nValue > 0) ? true : false; } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwTotalFrames") ) { msg.numFrames = nValue; msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_FRAME; } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwLoopGap") ) { msg.loopWindowSize = nValue; msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_LOOP; } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwAnimationDelay") ) { msg.animationDelay = nValue; msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_DELAY; } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwMarkFrame") ) { msg.markFrame = nValue; msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_MARK; } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwStartColor0") ) { msg.startColor0 = dwValue; msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_SC0; } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwStartColor1") ) { msg.startColor1 = dwValue; msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_SC1; } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwMarkColor0") ) { msg.markColor0 = dwValue; msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_MC0; } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwMarkColor1") ) { msg.markColor1 = dwValue; msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_MC1; } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwEndColor0") ) { msg.endColor0 = dwValue; msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_EC0; } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwEndColor1") ) { msg.endColor1 = dwValue; msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_EC1; } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwStartSize") ) { msg.startSizeOffset = fValue; msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_SSIZE; } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwMarkSize") ) { msg.markSizeOffset = fValue; msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_MSIZE; } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwEndSize") ) { msg.endSizeOffset = fValue; msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_ESIZE; } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwTexture") ) { msg.strTexture = pMsg->m_vecValueList[0].c_str(); msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_TEXTURE; } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwStartColor" ) ) { msg.startColor0 = dwValue; msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_SC0; msg.startColor1 = dwValue; msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_SC1; } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwMarkColor" ) ) { msg.markColor0 = dwValue; msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_MC0; msg.markColor1 = dwValue; msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_MC1; } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwEndColor" ) ) { msg.endColor0 = dwValue; msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_EC0; msg.endColor1 = dwValue; msg.nSetFlag |= KMsgSET_MORPHMESH::FLAG_EC1; } pLocal->AddMorphMesh( &msg ); } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwSave") || !::_stricmp( pMsg->m_strKey.c_str(), "pws" ) ) { _CID( GET_MORPHMESH ); KMsgGET_MORPHMESH msg; pLocal->Perform( ANIPART_WEAPON_RIGHT, id_GET_MORPHMESH, msg ); const char* pFAame = defaultFileName; if( pMsg->m_nValueCount > 0 ) { pFAame=pMsg->m_vecValueList[0].c_str(); strFileName = pMsg->m_vecValueList[0].c_str(); } saveToFile( pFAame, &msg ); } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwLoad") || !::_stricmp( pMsg->m_strKey.c_str(), "pwl" ) ) { KMsgSET_MORPHMESH msg; const char* pFAame = defaultFileName; if( pMsg->m_nValueCount > 0 ) { pFAame=pMsg->m_vecValueList[0].c_str(); strFileName = pMsg->m_vecValueList[0].c_str(); } loadFromFile( pFAame, &msg ); pLocal->AddMorphMesh( &msg ); } if( !::_stricmp( pMsg->m_strKey.c_str(), "pwReload") || !::_stricmp( pMsg->m_strKey.c_str(), "pwr" ) ) { KMsgSET_MORPHMESH msg; const char* pFAame = strFileName.c_str(); loadFromFile( pFAame, &msg ); pLocal->AddMorphMesh( &msg ); } } //char *ret=WeaponPowerupProcessConsoleCommand(pMsg->m_strKey, pMsg->m_nValueCount, pMsg->m_vecValueList); //if (ret!=NULL) CPRINT(ret); return; } #ifdef CLOUD_LUA_RELOAD if( !::_stricmp(pMsg->m_strKey.c_str(), "game_reload_cloud_lua" ) ) { Game_ReloadCloudLua(); return; } #endif #ifdef _EDIT_ENVIRONMENT_ if( !::_stricmp(pMsg->m_strKey.c_str(), "game_environment_edit" ) ) { GetEditParameterDialog().Show(); return; } #endif #ifdef _FOG_RANGE_ if( !::_stricmp(pMsg->m_strKey.c_str(), "game_check_fog_range" ) ) { ShowFogModel( !m_bShowFogRange ); return; } #endif #ifdef _EDIT_MAP_FILE_ if( !::_stricmp(pMsg->m_strKey.c_str(), "game_get_map_name" ) ) // 맵파일 리로드 { float fx = 0.0f, fy = 0.0f; SGameAvatarEx* pLocal = g_pCurrentGameSystem->GetLocalPlayer(); if( pLocal ) { fx = pLocal->GetTransform()->_41; fy = pLocal->GetTransform()->_42; } const CTerrainSeamlessWorldInfo* pSeamlessWorldInfo = m_pTerrainMapEngine->GetSeamlessWorldInfo(); float fMapLen = float( pSeamlessWorldInfo->GetTileCountPerSegment() ) * float(pSeamlessWorldInfo->GetSegmentCountPerMap() ) * pSeamlessWorldInfo->GetTileLength(); int nMapX = (int)(fx / fMapLen); int nMapY = (int)(fy / fMapLen); std::string strFileName = pSeamlessWorldInfo->GetMapFileName( nMapX, nMapY ); AddChatMessage( strFileName.c_str() ); } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_reload_map" ) ) // 맵파일 리로드 { m_pTerrainMapEngine->ReloadVisibleSegment(); SGameAvatarEx* pLocal = m_pGameSystem->GetLocalPlayer(); if( pLocal ) { K3DMatrix* pTM = pLocal->GetTransform(); m_pGameSystem->Rq_Chatting( CHAT_NORMAL, NULL, CStringUtil::StringFormat( "//warp %d %d", (int)pTM->_41, (int)pTM->_42 ).c_str() ); } return; } #endif if( !::_stricmp( pMsg->m_strKey.c_str(), "game_ui_output") ) { KUITextureManager::GetManager()->OutputTexture(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_avatar_bone") ) { KBoneSeqObject::ToggleRenderBone(); KBoneSeqObject::ToggleRenderAxis(); } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_avatar_mesh") ) { KSeqAvatar::SetToggleMeshRender(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_effect_pos") ) { KSeqAvatar::SetToggleEffectPos(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_ep") ) { KEventPointSeq::SetToggleEffectPos(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_rf_height" ) ) { CTerrainProp::SetTogglePropHeightRender(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_rf_cacol" ) ) { CTerrainProp::SetTogglePropCaColRender(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_rf_cacol_vis" ) ){ CTerrainProp::SetPropCaColVisibility( static_cast< float >( atof( pMsg->m_vecValueList[0].c_str() ) ) ); } //[sonador][7.1.5]테스트용 클라이언트 제작 및 충돌 프랍 투명화 적용 if( !::_stricmp( pMsg->m_strKey.c_str(), "game_rf_mob" ) ) { SGameMob::SetForceRender( !SGameMob::GetForceRender() ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_rf_npc" ) ) { SGameNpc::SetForceRender( !SGameNpc::GetForceRender() ); return; } // if( !::_stricmp( pMsg->m_strKey.c_str(), "game_rf_store" ) ) { SGameOtherPlayer::ToggleStoreModel(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_rf_store_none" ) ) { SGameOtherPlayer::SetRenderNoneBooth(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_rf_store_simple" ) ) { SGameOtherPlayer::SetRenderSimpleBooth(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_rf_store_detail" ) ) { SGameOtherPlayer::SetRenderDetailBooth(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_rf_store_avatar" ) ) { SGameOtherPlayer::SetRenderAvatarBooth(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_rf_mesh_cube") ) { KMeshSeqObject::SetToggleVisbleCube(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_rf_billboard_cube") ) { KFXBillboardSeq::SetToggleVisbleCube(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_rf_terrain_cube") ) { CTerrainSegment::ToogleCubeRender(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_avatar_movesound") ) { SGameAvatarEx::ToggleMoveSound(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_rf_speedtree") ) { KSeqSpeedTree::ToggleSpeedTreeRender(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_pvs_act") ) { PVSObjectManager::SetTogglePVS(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_skin_window") ) { m_pGameMng->PostMsgAtDynamic( new SIMSG_TOGGLE_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SKIN_COLOR ) ); return; } /// 2012.04.26 window toggle - prodongi if( !::_stricmp( pMsg->m_strKey.c_str(), "game_toggle_window") ) { if (0 < pMsg->m_nValueCount) { int id = atoi(pMsg->m_vecValueList[0].c_str()); m_pGameMng->PostMsgAtDynamic( new SIMSG_TOGGLE_UIWINDOW((SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE)id)); } return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_texture_null" ) ) { K3DRenderDeviceDX::ToggleForceTextureNull(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_rf_ui_rect") ) { KUIControl::ToggleDrawRectGrid(); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_set_fixtexture")) { SGameAvatarEx* pLocal = m_pGameSystem->GetLocalPlayer(); if( pLocal ) { KMsgSET_FIXTEXTURE msgFixTexture; if( pMsg->m_nValueCount >= 1 ) { std::string strTexture = pMsg->m_vecValueList[0].c_str(); //Fix Texture Name msgFixTexture.bUseFix = (strTexture.length() > 4) ? true : false; if( msgFixTexture.bUseFix ) { msgFixTexture.pTexture = _getTexture( strTexture.c_str() ); } } pLocal->SetFixTexture( &msgFixTexture ); } return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_camera_out") ) { if( pMsg->m_nValueCount == 1 ) { FILE* pF = fopen( pMsg->m_vecValueList[0].c_str(), "wt" ); if( pF ) { m_pGameCamera->FileTextOut(pF, g_bUserCamMode); fclose( pF ); } } } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_camera_in") ) { if( pMsg->m_nValueCount == 1 ) { SetGameCameraforFile( pMsg->m_vecValueList[0].c_str() ); } } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_camera_effect" ) ) { SMSG_CAMERA_EFFECT msg; msg.dwKeepTime = 300; if( pMsg->m_nValueCount == 1 ) { msg.fDeltaX = atof( pMsg->m_vecValueList[0].c_str() ); msg.fDeltaY = atof( pMsg->m_vecValueList[0].c_str() ); msg.nEffect = 1; } else if( pMsg->m_nValueCount == 2 ) { msg.fDeltaX = atof( pMsg->m_vecValueList[0].c_str() ); msg.fDeltaY = atof( pMsg->m_vecValueList[0].c_str() ); msg.nEffect = atoi( pMsg->m_vecValueList[1].c_str() ); } else { msg.fDeltaX = 0.03f; msg.fDeltaY = 0.03f; msg.nEffect = 1; } m_pGameCamera->SendGameMsg( &msg ); return; } { SGameAvatarEx * pTarget = m_pGameSystem->GetTarget(); if( pTarget && pTarget->IsDummyCreature() ) { if( !::_stricmp( pMsg->m_strKey.c_str(), "game_leave_dummy_creature" ) ) { m_pCommandSystem->LeaveDummyCreature( pTarget ); m_pGameSystem->SetTarget( NULL ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_dummy_creature_default_mode" ) ) { m_pCommandSystem->SetDummyCreatureMode( pTarget, 0 ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_dummy_creature_walk_mode" ) ) { m_pCommandSystem->SetDummyCreatureMode( pTarget, 1 ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_dummy_creature_run_mode" ) ) { m_pCommandSystem->SetDummyCreatureMode( pTarget, 2 ); return; } } } { SGameAvatarEx* pLocalPlayer = m_pCommandSystem->GetLocalPlayer(); if( !::_stricmp( pMsg->m_strKey.c_str(), "game_skill_whirlwind" ) ) { m_pCommandSystem->CheatWhirlWindSkill(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_skill_lightning" ) ) { m_pCommandSystem->CheatLightningSkill(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_skill_healingWave" ) ) { m_pCommandSystem->CheatHealingWaveSkill(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_skill_add_force_sphere" ) ) { if( pLocalPlayer ) pLocalPlayer->AddForceSphere(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_skill_use_force_sphere" ) ) { if( pLocalPlayer ) pLocalPlayer->UseForceSphere(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_skill_BlessingHammer" ) ) { m_pCommandSystem->CheatBlessingHammerSkill(); return; } } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_target_info" ) ) { SGameAvatarEx* pTarget = m_pGameSystem->GetTarget(); if( pTarget ) { //'Lv'을 String DB 9501로 참조하도록 한다 2009.09.25. sfreer std::string str; XStringUtil::Format( str, "Name: %s\n%s: %d\nHP: %d\nMAX_HP: %d\nMP: %d\nMAX_MP: %d", pTarget->GetName() , GetStringDB().GetString(9501) , pTarget->GetLevel() , pTarget->GetHP() , pTarget->GetMaxHP() , pTarget->GetMP() , pTarget->GetMaxMP() ); AddChatMessage( str.c_str() ); } return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_player_position_info" ) ) { SGameAvatarEx* pLocalPlayer = m_pGameSystem->GetLocalPlayer(); if( pLocalPlayer ) { K3DVector vPos = *pLocalPlayer->GetPosition(); WORD dwTile = 0; GetHeight( vPos.x, vPos.y, vPos.z, dwTile ); float fStart = vPos.z + m_fHeightFog_Start; float fend = vPos.z + m_fHeightFog_End; std::string str; XStringUtil::Format( str, "pos_x: %f\npos_y: %f\npos_z: %f\n", vPos.x , vPos.y , vPos.z ); AddChatMessage( str.c_str() ); } return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_linear_fog_info" ) ) { std::string str; XStringUtil::Format( str, "lfog_start: %f\nlfog_end: %f\n", m_fLinearFog_Start , m_fLinearFog_End ); AddChatMessage( str.c_str() ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_height_fog_info" ) ) { SGameAvatarEx* pLocalPlayer = m_pGameSystem->GetLocalPlayer(); if( pLocalPlayer ) { K3DVector vPos = *pLocalPlayer->GetPosition(); WORD dwTile = 0; GetHeight( vPos.x, vPos.y, vPos.z, dwTile ); float fStart = vPos.z + m_fHeightFog_Start; float fend = vPos.z + m_fHeightFog_End; std::string str; XStringUtil::Format( str, "hfog_start: %f\nhfog_end: %f\n", fStart , fend ); AddChatMessage( str.c_str() ); } return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_target_follow" ) ) { SGameAvatarEx* pTarget = m_pGameSystem->GetTarget(); if( pTarget ) { if( pTarget->GetObjType() == TS_ENTER::GAME_PLAYER || pTarget->GetObjType() == TS_ENTER::GAME_SUMMON ) { m_bAutoFollowMode = true; m_hFollowTarget = pTarget->GetArID(); } } return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_target_undisguise" ) ) { SGameAvatarEx* pTarget = m_pGameSystem->GetTarget(); if( pTarget ) { pTarget->UnDisguise(); } return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_auto_rotcam") ) { m_bCameraAutoRot = !m_bCameraAutoRot; return; } // { [sonador] 스크립트 파일로 부터 환경값 설정 if( !::_stricmp( pMsg->m_strKey.c_str(), "game_env_load" ) ) { if( _IsEnvironmentConfigMode() ) { LoadEnvironmentScript(); } return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_env_config" ) ) { SetEnvironmentConfigMode( !m_EnvConfigArgument.mConfigMode ); return; } // sonador 1.1.18 환경 효과 오류 수정 if( !::_stricmp( pMsg->m_strKey.c_str(), "game_fog_factor" ) ) { m_fGameFogDistanceFactor = ::atof( pMsg->m_vecValueList[ 0 ].c_str() ); } // } // { [sonador][3.1.2]경매장 구현 if( !::_stricmp( pMsg->m_strKey.c_str(), "game_auction" ) ) { if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_AUCTION, true ) ); return; } // } // sonador #2.1.2.4.3 팻 조작 UI 연동 if( !::_stricmp( pMsg->m_strKey.c_str(), "game_pet_cmd" ) ) { if( m_pGameMng ) m_pGameMng->InterfaceMsg( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_PET_COMMAND, true ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_kill_client") ) { SGameWorld* pGameWorld = NULL; pGameWorld->Process( 0 ); return; } if( pMsg->m_nValueCount < 1 ) return; if( !::_stricmp( pMsg->m_strKey.c_str(), "game_toggle_ui" ) ) { SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE uiId = (SIMSG_TOGGLE_UIWINDOW::_UIWINDOW_TYPE)::atoi( pMsg->m_vecValueList[ 0 ].c_str() ); m_pGameMng->InterfaceMsg( &SIMSG_TOGGLE_UIWINDOW( uiId ) ); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_skin_colorize")) { char *HEX_P; DWORD color1 = strtoul(pMsg->m_vecValueList[0].c_str(), &HEX_P, 10); color1 |= 0xFF000000; if( m_pCommandSystem->GetLocalPlayer() ) { m_pCommandSystem->GetLocalPlayer()->SetSkinColorized( color1, 0, color1 ); m_pGameSystem->SetLocalInven(); } return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_enhance_test")) { bool bValue = ( atoi( pMsg->m_vecValueList[0].c_str() ) > 0 ? true : false ); SGameAvatarEx::SetEnhanceTest( bValue ); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_left_weapon_attach")) { SGameAvatarEx* pLocalPlayer = m_pGameSystem->GetLocalPlayer(); if( !pLocalPlayer ) return; pLocalPlayer->AddAttachItemPart( ANIPART_WEAPON_LEFT, ATTACH_HAND_LEFT_WEAPON01, pMsg->m_vecValueList[0].c_str() ); pLocalPlayer->RefreshDeform(); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_right_weapon_attach")) { SGameAvatarEx* pLocalPlayer = m_pGameSystem->GetLocalPlayer(); if( !pLocalPlayer ) return; pLocalPlayer->AddAttachItemPart( ANIPART_WEAPON_RIGHT, ATTACH_HAND_RIGHT_WEAPON01, pMsg->m_vecValueList[0].c_str() ); pLocalPlayer->RefreshDeform(); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_set_terrain_limit")) { m_nLimitDisitance = atoi( pMsg->m_vecValueList[0].c_str()); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_set_circle_shadow")) { bool bEnable = atoi( pMsg->m_vecValueList[0].c_str()) != 0; m_pCommandSystem->SetCircleShadowEnable((bEnable)); SBotManager::m_pBotThis->SetShadowEnable(!bEnable); } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_set_lightmap_enable")) { bool bEnable = atoi( pMsg->m_vecValueList[0].c_str()) != 0; m_bEnableLightmap = bEnable; m_pTerrainMapEngine->RefreshLightMapEnable(m_bEnableLightmap); } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_sky_mid") ) { float fValue = atof( pMsg->m_vecValueList[0].c_str() ); if( fValue > 1.f ) fValue = 1.f; else if( fValue < 0.f ) fValue = 0.01f; Game_Sky_Color_MidHeightPercent( fValue ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_sky_max_height") ) { float fValue = atof( pMsg->m_vecValueList[0].c_str() ); Game_Sky_Color_MaxHeight( fValue ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_sky_min_height") ) { float fValue = atof( pMsg->m_vecValueList[0].c_str() ); Game_Sky_Color_MinHeight( fValue ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_terrain_prob_lod_dist") ) { float fValue = atof( pMsg->m_vecValueList[0].c_str() ); m_pTerrainMapEngine->SetPropLodDistance( fValue ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_avatar_cube") ) { int nFlag = atoi( pMsg->m_vecValueList[0].c_str() ); SGameAvatarEx::SetRenderCube( nFlag == 1 ? true : false ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_local_sign" ) ) { SIMSG_UI_DISPLAY_LOCAL_NAME sMsg; sMsg.strLocalName = pMsg->m_vecValueList[0].c_str(); sMsg.bShow = true; m_pGameMng->InterfaceMsg( &sMsg ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_prop_maxlod" ) ) { CTerrainProp::SetLodMax( atof( pMsg->m_vecValueList[0].c_str() ) ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_prop_loddist" ) ) { CTerrainProp::SetLodDist( atof( pMsg->m_vecValueList[0].c_str() ) ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_mip_bias" ) ) { KTextureManager::GetManager()->SetMipMapBiasLevel(atoi(pMsg->m_vecValueList[0].c_str()) ); KTextureManager::GetManager()->ReloadRes( false ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_contrast" ) ) { KDeviceManagerDX::GetDeviceManager()->GetRenderDevice()->SetContrast(atoi(pMsg->m_vecValueList[0].c_str())); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_bright" ) ) { KDeviceManagerDX::GetDeviceManager()->GetRenderDevice()->SetBright(atof(pMsg->m_vecValueList[0].c_str())); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_toggle_fullscreen" ) ) { ((K3DRenderDeviceDX*) KDeviceManagerDX::GetDeviceManager()->GetRenderDevice())->ToggleFullscreen((bool) atoi(pMsg->m_vecValueList[0].c_str())); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_set_refreshrate" ) ) { ((K3DRenderDeviceDX*) KDeviceManagerDX::GetDeviceManager()->GetRenderDevice())->SetRefreshRate(atoi(pMsg->m_vecValueList[0].c_str())); return; } //if( !::_stricmp( pMsg->m_strKey.c_str(), "game_toggle_shadowbuffer" ) ) //{ // m_pViewPort->GetShadowViewPort()->SetUseShadowBuffer((bool) atoi(pMsg->m_vecValueList[0].c_str())); // return; //} if( !::_stricmp( pMsg->m_strKey.c_str(), "game_set_shadowbufferquality" ) ) { m_pViewPort->GetShadowViewPort()->SetShadowBufferQuality(atoi(pMsg->m_vecValueList[0].c_str())); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_set_shadowmapquality" ) ) { m_pViewPort->GetShadowViewPort()->SetShadowMapQuality(atoi(pMsg->m_vecValueList[0].c_str())); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_set_jittermapquality" ) ) { m_pViewPort->GetShadowViewPort()->SetJitterMapQuality(atoi(pMsg->m_vecValueList[0].c_str())); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_set_waterquality" ) ) { m_pViewPort->GetWaterViewPort()->SetWaterQuality(atoi(pMsg->m_vecValueList[0].c_str())); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_set_bumpmap" ) ) { m_pViewPort->SetRenderBumpMapMode( ( bool ) atoi(pMsg->m_vecValueList[0].c_str() ) ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_set_terrainvisdistance" ) ) { int nIndex = atoi(pMsg->m_vecValueList[0].c_str()); if( nIndex >=0 && nIndex < 6 ) m_pTerrainMapEngine->SetTerrainVisibleDistance( c_TerrainVisibleDistOptions[nIndex] ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_set_terrainvisratio" ) ) { m_pTerrainMapEngine->SetTerrainVisibleDistanceRatio(atof(pMsg->m_vecValueList[0].c_str())); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_set_avatarvisrange" ) ) { m_pCommandSystem->SetAvatarVisRange(atof(pMsg->m_vecValueList[0].c_str())); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_set_grassvisrange" ) ) { CTerrainProp::SetGrassVisRange(atof(pMsg->m_vecValueList[0].c_str())); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_set_speedtreevisrange" ) ) { CTerrainProp::SetSpeedTreeVisRange(atof(pMsg->m_vecValueList[0].c_str())); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_set_propsmallvisrange" ) ) { CTerrainProp::SetPropSmallVisRange(atof(pMsg->m_vecValueList[0].c_str())); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_set_proplargevisrange" ) ) { CTerrainProp::SetPropLargeVisRange(atof(pMsg->m_vecValueList[0].c_str())); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_set_buildingsmallvisrange" ) ) { CTerrainProp::SetBuildingSmallVisRange(atof(pMsg->m_vecValueList[0].c_str())); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_set_buildinglargevisrange" ) ) { CTerrainProp::SetBuildingLargeVisRange(atof(pMsg->m_vecValueList[0].c_str())); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_set_windfactor" ) ) { //KSeqSpeedTree::SetWindFactor(atof(pMsg->m_vecValueList[0].c_str())); SBotManager::m_pBotThis->SetWindStrength(atof(pMsg->m_vecValueList[0].c_str())); CTerrainMapEngine::TERRAINSEGMENTMAP segmentmap = m_pTerrainMapEngine->GetSegmentMap(); for(CTerrainMapEngine::TERRAINSEGMENTMAP::iterator itSegment = segmentmap.begin(); itSegment != segmentmap.end(); itSegment++) { itSegment->second->SetWindStrength(atof(pMsg->m_vecValueList[0].c_str())); } return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_set_cameracollision" ) ) { m_bCameraCollision = (bool) atoi(pMsg->m_vecValueList[0].c_str()); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_set_drawattributepolygon" ) ) { m_pTerrainMapEngine->SetDrawAttributePolygon((bool) atoi(pMsg->m_vecValueList[0].c_str())); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_set_dfog")) { if(atoi(pMsg->m_vecValueList[0].c_str())) { m_dwFogMode |= K3DRenderDevice::FOGM_LINEAR; } else { m_dwFogMode &= (0xFFFFFFFF ^ K3DRenderDevice::FOGM_LINEAR); } return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_set_hfog")) { if(atoi(pMsg->m_vecValueList[0].c_str())) { m_dwFogMode |= K3DRenderDevice::FOGM_HEIGHT; } else { m_dwFogMode &= (0xFFFFFFFF ^ K3DRenderDevice::FOGM_HEIGHT); } return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_fx_set" ) ) { if( m_pGameSystem->GetLocalPlayer() ) { AR_HANDLE handle = m_pGameSystem->GetLocalPlayer()->GetArID(); FX_DATA fx_data; fx_data.owner = handle; fx_data.attack = handle; fx_data.target = handle; fx_data.nFX_ID = atoi( pMsg->m_vecValueList[0].c_str() ); fx_data.nEffPos = pMsg->m_nValueCount > 1 ? atoi( pMsg->m_vecValueList[1].c_str() ) : EFFECT_POS_DAMAGE; AddEffect( &fx_data ); } return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_Ani_test" ) ) { if( m_pGameSystem->GetLocalPlayer() ) { float fRate = 4.8f; if( pMsg->m_nValueCount > 1 ) fRate = atof(pMsg->m_vecValueList[1].c_str()); m_pGameSystem->GetLocalPlayer()->NPlayAnimation( atoi(pMsg->m_vecValueList[0].c_str()), SEQTYPE_NORMAL, fRate ); } } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_fx_test" ) ) { if( m_pGameSystem->GetLocalPlayer() ) { AR_HANDLE handle = m_pGameSystem->GetLocalPlayer()->GetArID(); AddEffectTest( pMsg->m_vecValueList[0].c_str(), handle ); } return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_set_grass_fadedist")) { KSeqSpeedGrass::SetFadeDist( atof( pMsg->m_vecValueList[ 0 ].c_str() ) ); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_set_grass_fadelength")) { KSeqSpeedGrass::SetFadeLength( atof( pMsg->m_vecValueList[ 0 ].c_str() ) ); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_set_selfshadow_ambientfactor")) { m_pViewPort->SetSelfShadowAmbientFactor( atof( pMsg->m_vecValueList[ 0 ].c_str() ) ); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_set_terrain_specularfactor")) { m_pViewPort->SetTerrainSpecularFactor( atof( pMsg->m_vecValueList[ 0 ].c_str() ) ); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_set_skin_ambientfactor")) { m_pViewPort->SetSkinAmbientFactor( atof( pMsg->m_vecValueList[ 0 ].c_str() ) ); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_set_skin_diffusefactor")) { m_pViewPort->SetSkinDiffuseFactor( atof( pMsg->m_vecValueList[ 0 ].c_str() ) ); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_set_skin_specularfactor")) { m_pViewPort->SetSkinSpecularFactor( atof( pMsg->m_vecValueList[ 0 ].c_str() ) ); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_set_wb_speed")) { m_pViewPort->SetWaterBumpSpeed( atof( pMsg->m_vecValueList[ 0 ].c_str() ) ); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_set_wb_size")) { m_pViewPort->SetWaterBumpSize( atof( pMsg->m_vecValueList[ 0 ].c_str() ) ); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_set_zoomratio")) { m_fCamMaxDistRatio = atof( pMsg->m_vecValueList[ 0 ].c_str() ); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "r_blurradius")) { m_pViewPort->SetBlurRadius( atof( pMsg->m_vecValueList[ 0 ].c_str() ) ); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "r_hdrquality")) { m_pViewPort->SetHdrQuality( atoi( pMsg->m_vecValueList[ 0 ].c_str() ) ); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "r_blurratio")) { m_pViewPort->SetHdrBlurMixRatio( atof( pMsg->m_vecValueList[ 0 ].c_str() ) ); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "r_hdrexposure")) { m_pViewPort->SetHdrExposure( atof( pMsg->m_vecValueList[ 0 ].c_str() ) ); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "r_hdrgamma")) { m_pViewPort->SetHdrGamma( atof( pMsg->m_vecValueList[ 0 ].c_str() ) ); return; } if ( !::_stricmp(pMsg->m_strKey.c_str(), "game_usepreset")) { GetGameOption().SetPresetOption( atoi( pMsg->m_vecValueList[0].c_str() ) ); applyOptionEnviroment(); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_aurora_vis") ) { Game_Aurora_Vis( atoi( pMsg->m_vecValueList[0].c_str() ), atof( pMsg->m_vecValueList[1].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_aurora_angle") ) { Game_Aurora_Angle( atoi( pMsg->m_vecValueList[0].c_str() ), atof( pMsg->m_vecValueList[1].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_aurora_scale") ) { Game_Aurora_Scale( atoi( pMsg->m_vecValueList[0].c_str() ), atof( pMsg->m_vecValueList[1].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_aurora_height") ) { Game_Aurora_Height( atoi( pMsg->m_vecValueList[0].c_str() ), atof( pMsg->m_vecValueList[1].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_toggle_lensflare") ){ Game_LensFlare ( atoi( pMsg->m_vecValueList[0].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_toggle_cloud") ) { Game_Cloud ( atoi( pMsg->m_vecValueList[0].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_toggle_prop") ) { Game_Prop ( atoi( pMsg->m_vecValueList[0].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_toggle_effect") ) { Game_Effect ( atoi( pMsg->m_vecValueList[0].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_toggle_sound") ) { Game_Sound ( atoi( pMsg->m_vecValueList[0].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_toggle_music") ) { Game_Music ( atoi( pMsg->m_vecValueList[0].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_resolution") ) { Game_Resolution ( atoi( pMsg->m_vecValueList[0].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_fsaa_size") ) { Game_FSAA ( atoi( pMsg->m_vecValueList[0].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_cloud_vis") ) { Game_Cloud_vis ( atof( pMsg->m_vecValueList[0].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_cloud_speed") ) { Game_Cloud_speed( atof( pMsg->m_vecValueList[0].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_camera_fov") ) { Game_Camera_fov ( atof( pMsg->m_vecValueList[0].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_mip_range") ) { Game_Mip_Range ( atof( pMsg->m_vecValueList[0].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_mip_bias") ) { Game_Mip_Bias ( atof( pMsg->m_vecValueList[0].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_fog_linear_start" ) || !::_stricmp(pMsg->m_strKey.c_str(), "game_fog_lstart") ) { Game_Fog_Linear_Start( atof( pMsg->m_vecValueList[0].c_str()) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_fog_linear_end" ) || !::_stricmp(pMsg->m_strKey.c_str(), "game_fog_lend" ) ) { Game_Fog_Linear_End ( atof( pMsg->m_vecValueList[0].c_str()) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_fog_height_start" ) || !::_stricmp(pMsg->m_strKey.c_str(), "game_fog_hstart" ) ) { Game_Fog_Height_Start( atof( pMsg->m_vecValueList[0].c_str()) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_fog_height_end" ) || !::_stricmp(pMsg->m_strKey.c_str(), "game_fog_hend" ) ) { Game_Fog_Height_End ( atof( pMsg->m_vecValueList[0].c_str()) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_effect_light_range" ) || !::_stricmp(pMsg->m_strKey.c_str(), "game_effect_lt_r" ) ) { if( m_pEffectLight ) m_pEffectLight->range = atof( pMsg->m_vecValueList[0].c_str() ); } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_effect_light_attenuation" ) || !::_stricmp(pMsg->m_strKey.c_str(), "game_effect_lt_att" ) ) { if( m_pEffectLight ) m_pEffectLight->attenuation1 = atof( pMsg->m_vecValueList[0].c_str() ); } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_effect_light_livetime" ) || !::_stricmp(pMsg->m_strKey.c_str(), "game_effect_lt_live" ) ) { m_nEffectLight_MaxLive = atoi( pMsg->m_vecValueList[0].c_str() ); } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_time") ) { if( !::_stricmp(pMsg->m_vecValueList[0].c_str(), "on")) ActivateTimeProcess( true ); else if( !::_stricmp(pMsg->m_vecValueList[0].c_str(), "off")) ActivateTimeProcess( false ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_weather") ) { SetWeather( atoi( pMsg->m_vecValueList[0].c_str()) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_world_id") ) { SetWorldID( atoi( pMsg->m_vecValueList[0].c_str()) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_local_id") ) { SetWorldID( atoi( pMsg->m_vecValueList[0].c_str()) ); return; } //파티클 관련 치트 if( !::_stricmp(pMsg->m_strKey.c_str(), "game_par_quality") ) { int nQuality = atoi( pMsg->m_vecValueList[0].c_str()); ParticleQuality( nQuality ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_enhancefx_type") ) { int nType = atoi( pMsg->m_vecValueList[0].c_str()); EnhanceFxType( nType ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_par_lifetime") ) { DWORD dwLifeTime = (DWORD)atoi( pMsg->m_vecValueList[0].c_str()); ParticleLifeTime( dwLifeTime ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_par_movespeed") ) { float fSpeed = atof( pMsg->m_vecValueList[0].c_str()); ParticleMoveSpeed( fSpeed ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_par_interval") ) { float fInterval = atof( pMsg->m_vecValueList[0].c_str()); ParticleCreateInterval( fInterval ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_lw_tt") ) { if( m_pLowQualityWater ) { m_pLowQualityWater->SetLowQualityWaterChangeTextureTime( atoi( pMsg->m_vecValueList[0].c_str()) ); } return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_ef_speed") ) { m_pCommandSystem->SetEffectSpeed( atof( pMsg->m_vecValueList[0].c_str()) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_wp_en_lv") ) { SGameAvatarEx* pLocalPlayer = m_pCommandSystem->GetLocalPlayer(); if( pLocalPlayer ) { pLocalPlayer->SetEnhanceCheatLevel( atoi( pMsg->m_vecValueList[0].c_str()) ); } return; } { if( !::_stricmp( pMsg->m_strKey.c_str(), "game_add_dummy_npc" ) ) { m_pCommandSystem->AddDummyNpc( atoi(pMsg->m_vecValueList[0].c_str()) ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_add_dummy_summon" ) ) { m_pCommandSystem->AddDummySummon( atoi(pMsg->m_vecValueList[0].c_str()) ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_add_dummy_mob" ) ) { m_pCommandSystem->AddDummyMob( atoi(pMsg->m_vecValueList[0].c_str()) ); return; } SGameAvatarEx* pDummyCreature = m_pGameSystem->GetTarget(); if( pDummyCreature && pDummyCreature->IsDummyCreature() ) { if( !::_stricmp( pMsg->m_strKey.c_str(), "game_dummy_creature_movespeed" ) ) { m_pCommandSystem->SetDummyCreatureSpeed( pDummyCreature, atof(pMsg->m_vecValueList[0].c_str()) ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_dummy_creature_movespeed_with_playrate" ) ) { m_pCommandSystem->SetDummyCreatureSpeedWithPlayRate( pDummyCreature, atof(pMsg->m_vecValueList[0].c_str()) ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_dummy_creature_playrate" ) ) { m_pCommandSystem->SetDummyCreaturePlayRate( pDummyCreature, atof(pMsg->m_vecValueList[0].c_str()) ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_dummy_creature_scale" ) ) { pDummyCreature->SetScale( atof(pMsg->m_vecValueList[0].c_str()) ); return; } } } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_select_target_fx" ) ) { m_pSelectTargetFx->SetRadius( atof(pMsg->m_vecValueList[0].c_str()) ); m_pSelectTargetOnFx->SetRadius( atof(pMsg->m_vecValueList[0].c_str()) ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_skill_chaos" ) ) { AddChaosEffect( atoi(pMsg->m_vecValueList[0].c_str()) ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_target_disguise" ) ) { SGameAvatarEx* pTarget = m_pGameSystem->GetTarget(); if( pTarget ) { pTarget->Disguise( 0, bits_scramble< int, 3 >( atoi(pMsg->m_vecValueList[0].c_str()) ) ); // 2.1.16 변신 효과 중첩시 아바타 사라지는 오류 수정 } return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_envsound_delaytime" ) ) { m_dwEnvFxSoundDelayTime = atoi(pMsg->m_vecValueList[0].c_str()); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_play_music" ) ) { if( m_pMSoundMgr ) m_pMSoundMgr->PlayMusic( pMsg->m_vecValueList[0].c_str() ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_sound_performance" ) ) { SoundPerformanceTest( pMsg->m_vecValueList[0].c_str() ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_bmg_volume" ) ) { m_nBmgVolume = atoi( pMsg->m_vecValueList[0].c_str() ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_camera_disrate" ) ) { m_fCameraDisRate = atof( pMsg->m_vecValueList[0].c_str() ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_miles_sound_roomtype" ) ) { if( !m_pMSoundMgr ) return; int nRoomType = atoi( pMsg->m_vecValueList[0].c_str() ); switch( nRoomType ) { case ENVIRONMENT_PADDEDCELL: case ENVIRONMENT_ROOM: case ENVIRONMENT_BATHROOM: case ENVIRONMENT_LIVINGROOM: case ENVIRONMENT_STONEROOM: case ENVIRONMENT_AUDITORIUM: case ENVIRONMENT_CONCERTHALL: case ENVIRONMENT_CAVE: case ENVIRONMENT_ARENA: case ENVIRONMENT_HANGAR: case ENVIRONMENT_CARPETEDHALLWAY: case ENVIRONMENT_HALLWAY: case ENVIRONMENT_STONECORRIDOR: case ENVIRONMENT_ALLEY: case ENVIRONMENT_FOREST: case ENVIRONMENT_CITY: case ENVIRONMENT_MOUNTAINS: case ENVIRONMENT_QUARRY: case ENVIRONMENT_PLAIN: case ENVIRONMENT_PARKINGLOT: case ENVIRONMENT_SEWERPIPE: case ENVIRONMENT_UNDERWATER: case ENVIRONMENT_DRUGGED: case ENVIRONMENT_DIZZY: case ENVIRONMENT_PSYCHOTIC: m_pMSoundMgr->SetRoomType( nRoomType ); break; default: m_pMSoundMgr->SetRoomType( ENVIRONMENT_GENERIC ); break; } return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_miles_sound_cutoff" ) ) { if( !m_pMSoundMgr ) return; m_pMSoundMgr->SetLowPassCutOff( atof( pMsg->m_vecValueList[0].c_str() ) ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_miles_sound_reverb" ) ) { if( !m_pMSoundMgr ) return; #ifdef _DEV if( atoi( pMsg->m_vecValueList[0].c_str() ) == 0 ) g_bReverbEnable = false; else g_bReverbEnable = true; #endif return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_miles_sound_lowpassfilter" ) ) { if( !m_pMSoundMgr ) return; #ifdef _DEV if( atoi( pMsg->m_vecValueList[0].c_str() ) == 0 ) g_bLowPassFilterEnable = false; else g_bLowPassFilterEnable = true; #endif return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_miles_sound_dryvol" ) ) { if( !m_pMSoundMgr ) return; SetGameDryVolume( atof( pMsg->m_vecValueList[0].c_str() ) ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_miles_sound_wetvol" ) ) { if( !m_pMSoundMgr ) return; SetGameWetVolume( atof( pMsg->m_vecValueList[0].c_str() ) ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_play_camera_work" ) ) { const CTerrainSeamlessWorldInfo* pSeamlessInfo = m_pTerrainMapEngine->GetSeamlessWorldInfo(); if( pSeamlessInfo == NULL ) return; float fMapLen = float( pSeamlessInfo->GetTileCountPerSegment() ) * float(pSeamlessInfo->GetSegmentCountPerMap() ) * pSeamlessInfo->GetTileLength(); int nPosX = m_pCamera->GetCamPos().x / fMapLen; int nPosY = m_pCamera->GetCamPos().y / fMapLen; SGameCameraWork* pCameraWork = new SGameCameraWork( this, m_pGameCamera ); pCameraWork->LoadCameraWork( pMsg->m_vecValueList[0].c_str(), nPosX, nPosY, fMapLen ); SetGameRef( STAGE_EVENT_SCENE ); ShowInterface( false ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_reload_texture" ) ) { int nMipBias = atoi( pMsg->m_vecValueList[0].c_str() ); KTextureManager::GetManager()->SetMipMapBiasLevel( nMipBias-1 ); KTextureManager::GetManager()->ReloadRes( true, TEXFLAG_SPEEDTREE, 0 ); KTextureManager::GetManager()->SetMipMapBiasLevel( nMipBias ); KTextureManager::GetManager()->ReloadRes( true, 0, TEXFLAG_SPEEDTREE ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_render_other_playerobj" ) ) { m_pCommandSystem->ActivatePendLoadingList( atoi( pMsg->m_vecValueList[0].c_str() ) ); return; } // { [sonador] 날씨 관련 콘솔 치트 if( !::_stricmp( pMsg->m_strKey.c_str(), "game_thunder_enable" ) ) { bool bEnableThunder = ( atoi( pMsg->m_vecValueList[ 0 ].c_str() ) == 0 ) ? false : true; if( m_pSky ) m_pSky->SetThunderEnable( bEnableThunder ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_env_db" ) ) { if( _IsEnvironmentConfigMode() ) { m_EnvConfigArgument.mConfigModeTime.tm_hour = ::atoi( pMsg->m_vecValueList[ 0 ].c_str() ); m_nWeatherID = ::atoi( pMsg->m_vecValueList[ 1 ].c_str() ); } return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_light_factor" ) ) // sonador 1.1.18 환경 효과 오류 수정 { m_fGameLightAmbientFactor = ::atof( pMsg->m_vecValueList[ 0 ].c_str() ); m_fGameLightDiffuseFactor = ::atof( pMsg->m_vecValueList[ 1 ].c_str() ); m_fGameLightSpecularFactor = ::atof( pMsg->m_vecValueList[ 2 ].c_str() ); return; } // } [sonador] 날씨 관련 콘솔 치트 // sonador 7.4.3 해킹 툴 감지후 종료 프로세스 구현 if( !::_stricmp( pMsg->m_strKey.c_str(), "game_security_msg" ) ) { GameSecurityMsg* pSecurityMsg = new GameSecurityMsg; pSecurityMsg->nMsgType = (GameSecurityMsg::MSG_TYPE)::atoi( pMsg->m_vecValueList[ 0 ].c_str() ); m_pGameMng->ProcSecurityMsg( pSecurityMsg ); return; } // sonador #2.1.2.4.3 팻 조작 UI 연동 if( !::_stricmp( pMsg->m_strKey.c_str(), "game_pet_pickitemdist" ) ) { SPetMgr* petMgr = static_cast< SPetMgr* >( GameUIMgrInstance.GetUIMgr( SGameUIInstance::PET_MGR ) ); const DATA_PET& summonPet = petMgr->GetSummonPetData(); if( summonPet.pet_handle && summonPet.pet_avatar ) ((SGameLocalPet*)summonPet.pet_avatar)->SetAutoPickItemDistanceByMeter( ::atof( pMsg->m_vecValueList[ 0 ].c_str() ) ); return; } if( pMsg->m_nValueCount < 2 ) return; //gmpbisun( 2012_1128 ) : MTE if( !::_stricmp( pMsg->m_strKey.c_str(), "game_mte_target" ) ) { SGameAvatarEx* pTarget = m_pGameSystem->GetTarget(); if( pTarget ) { bool bEnableMTE = ( atoi( pMsg->m_vecValueList[ 0 ].c_str() ) == 0 ) ? false : true; std::string strArg2 = pMsg->m_vecValueList[1]; if( strArg2 == "0" ) bEnableMTE ? strArg2.clear() : strArg2 = "@#$%.##$"; if( TS_ENTER::GAME_MOB == pTarget->GetObjType() || TS_ENTER::GAME_SUMMON == pTarget->GetObjType() ) { // mte on/off pTarget->EnableMTE( bEnableMTE, strArg2.c_str() ); } else AddChatMessage( "The target is wrong" ); } else { AddChatMessage( "The target is empty" ); } return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_mte_all" ) ) { //시야에 있는 모든 몹의 mte on/off bool bEnableMTE = ( atoi( pMsg->m_vecValueList[ 0 ].c_str() ) == 0 ) ? false : true; SGameWorld* pGameWorld = dynamicCast(g_pCurrentGameSystem->GetGame()); if( NULL == pGameWorld ) return; std::string strArg2 = pMsg->m_vecValueList[1]; if( strArg2 == "0" ) bEnableMTE ? strArg2.clear() : strArg2 = "@#$%.##$"; std::vector objList; pGameWorld->GetCommandSystem()->getOtherObjectList(objList); std::vector::iterator it_obj = objList.begin(); for (; it_obj != objList.end(); ++it_obj) { SGameAvatarEx* obj = *it_obj; int objType = obj->GetObjType(); const char* szTemp = obj->GetCobFileName(); if( TS_ENTER::GAME_MOB == objType || TS_ENTER::GAME_SUMMON == objType ) obj->EnableMTE( bEnableMTE, strArg2.c_str() ); } return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_set_resolution" ) ) { m_pGameMng->SetResolution(atoi(pMsg->m_vecValueList[0].c_str()), atoi(pMsg->m_vecValueList[1].c_str()) ); return; } //파티클 관련 치트 if( !::_stricmp(pMsg->m_strKey.c_str(), "game_par_size") ) { float fStart = atof( pMsg->m_vecValueList[0].c_str()); float fEnd = atof( pMsg->m_vecValueList[1].c_str()); ParticleSize( fStart, fEnd ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_par_emitrate") ) { float fMin = atof( pMsg->m_vecValueList[0].c_str()); float fMax = atof( pMsg->m_vecValueList[1].c_str()); ParticleEmitRate( fMin, fMax ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_time_process") ) { m_nRefGameTime = atoi( pMsg->m_vecValueList[0].c_str() ); m_nIncGameTime = atoi( pMsg->m_vecValueList[1].c_str() ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_wire_len" ) ) { //0 거리, 1 높이 if( m_pWireLen ) { m_pWireLen->Clear(); K3DVector pos1 = *m_pGameSystem->GetLocalPlayer()->GetPosition(); K3DVector pos2[4]; for( int i(0); 4>i; i++ ) { pos2[i] = pos1; pos2[i] += ((i+1) * atof( pMsg->m_vecValueList[0].c_str() )) * m_pGameSystem->GetLocalPlayer()->GetViewVector(); pos2[i].z = pos1.z; m_pWireLen->AddLine( pos2[i], K3DVector(pos2[i].x, pos2[i].y, pos2[i].z + atof( pMsg->m_vecValueList[1].c_str() ) ), KColor(255,0,0,255) ); } } } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_avatar_change_weapon_mesh" ) ) { SGameAvatarEx* pLocalPlayer = m_pGameSystem->GetLocalPlayer(); if( !pLocalPlayer ) return; //기존 매쉬 날리기 pLocalPlayer->AddMeshPart( ANIPART_WEAPON_RIGHT, MPART_R_WEAPON, "" ); pLocalPlayer->AddMeshPart( ANIPART_WEAPON_LEFT, MPART_L_WEAPON, "" ); if( atoi( pMsg->m_vecValueList[0].c_str() ) == 1 ) pLocalPlayer->AddMeshPart( ANIPART_WEAPON_LEFT, MPART_L_WEAPON, pMsg->m_vecValueList[1].c_str() ); else pLocalPlayer->AddMeshPart( ANIPART_WEAPON_RIGHT, MPART_R_WEAPON, pMsg->m_vecValueList[1].c_str() ); pLocalPlayer->RefreshDeform(); return; } if( pMsg->m_nValueCount < 3 ) return; // { [sonador] 날씨 관련 콘솔 치트 if( !::_stricmp( pMsg->m_strKey.c_str(), "game_ws" ) || !::_stricmp( pMsg->m_strKey.c_str(), "game_weather_state" ) ) { if( _IsEnvironmentConfigMode() ) { m_nWeatherID = atoi( pMsg->m_vecValueList[0].c_str() ); float fCapacityFactor = atof( pMsg->m_vecValueList[1].c_str() ); bool bFader = !!atoi( pMsg->m_vecValueList[2].c_str() ); // reload script //if( m_pWeatherService ) // m_pWeatherService->ChangeState( nTheme, fCapacityFactor, 1.0f, bFader ); } return; } // } [sonador] 날씨 관련 콘솔 치트 // { sonador 7.1.9 성능 개선 if( !::_stricmp( pMsg->m_strKey.c_str(), "game_rf_cacol_radius" ) ) { if( m_pCameraAnimator && m_pCameraAnimator->GetType() == IGameCameraAnimator::TERRAIN_AND_PROP_COLLISION_RESPONSE ) { K3DVector vRadius( ::atof( pMsg->m_vecValueList[ 0 ].c_str() ) , ::atof( pMsg->m_vecValueList[ 1 ].c_str() ) , ::atof( pMsg->m_vecValueList[ 2 ].c_str() ) ); SGameCameraTerrainAndPropCollisionAnimator* pAnimator = static_cast< SGameCameraTerrainAndPropCollisionAnimator* >( m_pCameraAnimator ); pAnimator->SetRadius( vRadius ); } return; } // } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_skin_colorize_rgb")) { int red = atoi( pMsg->m_vecValueList[0].c_str() ); int green = atoi( pMsg->m_vecValueList[1].c_str() ); int blue = atoi( pMsg->m_vecValueList[2].c_str() ); KColor skin_color( red, green, blue, 255 ); if( m_pCommandSystem->GetLocalPlayer() ) { m_pCommandSystem->GetLocalPlayer()->SetSkinColorized( skin_color.color, 0, skin_color.color ); m_pGameSystem->SetLocalInven(); } return; } //파티클 관련 치트 if( !::_stricmp(pMsg->m_strKey.c_str(), "game_par_emitradius") ) { float fX = atof( pMsg->m_vecValueList[0].c_str()); float fY = atof( pMsg->m_vecValueList[1].c_str()); float fZ = atof( pMsg->m_vecValueList[2].c_str()); ParticleEmitRadius( K3DVector(fX, fY, fZ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_par_min_dir") ) { float fX = atof( pMsg->m_vecValueList[0].c_str()); float fY = atof( pMsg->m_vecValueList[1].c_str()); float fZ = atof( pMsg->m_vecValueList[2].c_str()); ParticleMinDirection( K3DVector(fX, fY, fZ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_par_max_dir") ) { float fX = atof( pMsg->m_vecValueList[0].c_str()); float fY = atof( pMsg->m_vecValueList[1].c_str()); float fZ = atof( pMsg->m_vecValueList[2].c_str()); ParticleMaxDirection( K3DVector(fX, fY, fZ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_effect_light_diff" ) || !::_stricmp(pMsg->m_strKey.c_str(), "game_effect_lt_d" ) ) { K3DColor diff = K3DColor( atoi( pMsg->m_vecValueList[0].c_str())/255.f , atoi( pMsg->m_vecValueList[1].c_str())/255.f, atoi( pMsg->m_vecValueList[2].c_str())/255.f ); Game_Effect_Light( 0, diff ); } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_effect_light_spec" ) || !::_stricmp(pMsg->m_strKey.c_str(), "game_effect_lt_s" ) ) { K3DColor spec= K3DColor( atoi( pMsg->m_vecValueList[0].c_str())/255.f , atoi( pMsg->m_vecValueList[1].c_str())/255.f, atoi( pMsg->m_vecValueList[2].c_str())/255.f ); Game_Effect_Light( 1, spec ); } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_effect_light_ambient" ) || !::_stricmp(pMsg->m_strKey.c_str(), "game_effect_lt_a" ) ) { K3DColor ambient = K3DColor( atoi( pMsg->m_vecValueList[0].c_str())/255.f , atoi( pMsg->m_vecValueList[1].c_str())/255.f, atoi( pMsg->m_vecValueList[2].c_str())/255.f ); Game_Effect_Light( 2, ambient ); } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_tc_pos" ) ) { Game_Target_CamPos( atoi( pMsg->m_vecValueList[0].c_str()) , atoi( pMsg->m_vecValueList[1].c_str() ), atoi( pMsg->m_vecValueList[2].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_inv_pos" ) ) { int nX = atoi( pMsg->m_vecValueList[0].c_str() ); int nY = atoi( pMsg->m_vecValueList[1].c_str() ); int nZ = atoi( pMsg->m_vecValueList[2].c_str() ); SIMSG_UI_MAINPLAYER_CAM_POS msg; msg.pos = K3DVertex( nX, nY, nZ ); m_pGameMng->InterfaceMsg( &msg ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_inv_tc_pos" ) ) { int nX = atoi( pMsg->m_vecValueList[0].c_str() ); int nY = atoi( pMsg->m_vecValueList[1].c_str() ); int nZ = atoi( pMsg->m_vecValueList[2].c_str() ); SIMSG_UI_MAINPLAYER_CAM_TARGET_POS msg; msg.pos = K3DVertex( nX, nY, nZ ); m_pGameMng->InterfaceMsg( &msg ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_inv_lt_dir" ) ) { float nX = atof( pMsg->m_vecValueList[0].c_str() ); float nY = atof( pMsg->m_vecValueList[1].c_str() ); float nZ = atof( pMsg->m_vecValueList[2].c_str() ); SIMSG_UI_MAINPLAYER_LIGHT_DIR msg; msg.pos = K3DVertex( nX, nY, nZ ); m_pGameMng->InterfaceMsg( &msg ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_inv_lt_diff" ) ) { K3DColor color = K3DColor( atoi( pMsg->m_vecValueList[0].c_str())/255.f , atoi( pMsg->m_vecValueList[1].c_str())/255.f, atoi( pMsg->m_vecValueList[2].c_str())/255.f ); SIMSG_UI_MAINPLAYER_LIGHT msg( SIMSG_UI_MAINPLAYER_LIGHT::COLOR_DIFFUSE ); msg.color = color; m_pGameMng->InterfaceMsg( &msg ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_inv_lt_spec" ) ) { K3DColor color = K3DColor( atoi( pMsg->m_vecValueList[0].c_str())/255.f , atoi( pMsg->m_vecValueList[1].c_str())/255.f, atoi( pMsg->m_vecValueList[2].c_str())/255.f ); SIMSG_UI_MAINPLAYER_LIGHT msg( SIMSG_UI_MAINPLAYER_LIGHT::COLOR_SPECULAR ); msg.color = color; m_pGameMng->InterfaceMsg( &msg ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_inv_lt_ambient" ) ) { K3DColor color = K3DColor( atoi( pMsg->m_vecValueList[0].c_str())/255.f , atoi( pMsg->m_vecValueList[1].c_str())/255.f, atoi( pMsg->m_vecValueList[2].c_str())/255.f ); SIMSG_UI_MAINPLAYER_LIGHT msg( SIMSG_UI_MAINPLAYER_LIGHT::COLOR_AMBIENT ); msg.color = color; m_pGameMng->InterfaceMsg( &msg ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_light_pos" ) || !::_stricmp(pMsg->m_strKey.c_str(), "game_lt_pos" ) ) { Game_Light_Pos( atoi( pMsg->m_vecValueList[0].c_str()) , atoi( pMsg->m_vecValueList[1].c_str() ), atoi( pMsg->m_vecValueList[2].c_str() ) ); } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_light_dir" ) || !::_stricmp(pMsg->m_strKey.c_str(), "game_lt_dir" ) ) { Game_Light_Dir( atof( pMsg->m_vecValueList[0].c_str()) , atof( pMsg->m_vecValueList[1].c_str() ), atof( pMsg->m_vecValueList[2].c_str() ) ); } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_light_diff" ) || !::_stricmp(pMsg->m_strKey.c_str(), "game_lt_d" ) ) { K3DColor diff = K3DColor( atoi( pMsg->m_vecValueList[0].c_str())/255.f , atoi( pMsg->m_vecValueList[1].c_str())/255.f, atoi( pMsg->m_vecValueList[2].c_str())/255.f ); Game_Light( 0, diff ); } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_light_spec" ) || !::_stricmp(pMsg->m_strKey.c_str(), "game_lt_s" ) ) { K3DColor spec = K3DColor( atoi( pMsg->m_vecValueList[0].c_str())/255.f , atoi( pMsg->m_vecValueList[1].c_str())/255.f, atoi( pMsg->m_vecValueList[2].c_str())/255.f ); Game_Light( 1, spec ); } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_light_ambient" ) || !::_stricmp(pMsg->m_strKey.c_str(), "game_lt_a" ) ) { K3DColor ambient = K3DColor( atoi( pMsg->m_vecValueList[0].c_str())/255.f , atoi( pMsg->m_vecValueList[1].c_str())/255.f, atoi( pMsg->m_vecValueList[2].c_str())/255.f ); Game_Light( 2, ambient ); } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_sky_color_start") || !::_stricmp(pMsg->m_strKey.c_str(), "game_sky_cstart") ) { ActivateTimeProcess(false); Game_Sky_Color_Start( atoi( pMsg->m_vecValueList[0].c_str()) , atoi( pMsg->m_vecValueList[1].c_str() ), atoi( pMsg->m_vecValueList[2].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_sky_color_mid") || !::_stricmp(pMsg->m_strKey.c_str(), "game_sky_cmid") ) { ActivateTimeProcess(false); Game_Sky_Color_Mid( atoi( pMsg->m_vecValueList[0].c_str()) , atoi( pMsg->m_vecValueList[1].c_str() ), atoi( pMsg->m_vecValueList[2].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_sky_color_end") || !::_stricmp(pMsg->m_strKey.c_str(), "game_sky_cend") ) { ActivateTimeProcess(false); Game_Sky_Color_End( atoi( pMsg->m_vecValueList[0].c_str()) , atoi( pMsg->m_vecValueList[1].c_str() ), atoi( pMsg->m_vecValueList[2].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "sound_cutofffreq")) { /* if( m_pSoundMng ) { m_pSoundMng->SetCutOffFreqRate( atof( pMsg->m_vecValueList[ 0 ].c_str() ), atof( pMsg->m_vecValueList[ 1 ].c_str() ), atof( pMsg->m_vecValueList[ 2 ].c_str() ) ); }*/ return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_add_dummy_mob_circle_pos" ) ) { m_pCommandSystem->AddDummyMobCirclePos( atoi(pMsg->m_vecValueList[0].c_str()), atoi(pMsg->m_vecValueList[1].c_str()), atof(pMsg->m_vecValueList[2].c_str()) ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_add_dummy_mob_random_pos" ) ) { m_pCommandSystem->AddDummyMobRandomPos( atoi(pMsg->m_vecValueList[0].c_str()), atoi(pMsg->m_vecValueList[1].c_str()), atof(pMsg->m_vecValueList[2].c_str()) ); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_avatar_add_mesh" ) ) { SGameAvatarEx* pLocalPlayer = m_pGameSystem->GetLocalPlayer(); if( !pLocalPlayer ) return; ANIPART nAniPart = (ANIPART)atoi( pMsg->m_vecValueList[0].c_str() ); MPART nMeshPart = (MPART)atoi( pMsg->m_vecValueList[1].c_str() ); pLocalPlayer->AddMeshPart( nAniPart, nMeshPart, pMsg->m_vecValueList[2].c_str() ); pLocalPlayer->RefreshDeform(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_avatar_add_decomesh" ) ) { SGameAvatarEx* pLocalPlayer = m_pGameSystem->GetLocalPlayer(); if( !pLocalPlayer ) return; ANIPART nAniPart = (ANIPART)atoi( pMsg->m_vecValueList[0].c_str() ); MDECOPART nDecoMeshPart = (MDECOPART)atoi( pMsg->m_vecValueList[1].c_str() ); pLocalPlayer->AddDecoMeshPart( nAniPart, nDecoMeshPart, pMsg->m_vecValueList[2].c_str() ); pLocalPlayer->RefreshDeform(); return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_avatar_attach_item" ) ) { SGameAvatarEx* pLocalPlayer = m_pGameSystem->GetLocalPlayer(); if( !pLocalPlayer ) return; ANIPART nAniPart = (ANIPART)atoi( pMsg->m_vecValueList[0].c_str() ); ATTACH nAttachPart = (ATTACH)atoi( pMsg->m_vecValueList[1].c_str() ); pLocalPlayer->AddAttachItemPart( nAniPart, nAttachPart, pMsg->m_vecValueList[2].c_str() ); pLocalPlayer->RefreshDeform(); return; } if( pMsg->m_nValueCount < 4 ) return; if( !::_stricmp(pMsg->m_strKey.c_str(), "game_sky_color") ) { ActivateTimeProcess(false); Game_Sky_Color( atoi( pMsg->m_vecValueList[0].c_str()) , atoi( pMsg->m_vecValueList[1].c_str() ), atoi( pMsg->m_vecValueList[2].c_str() ), atoi( pMsg->m_vecValueList[3].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_fog_color") ) { ActivateTimeProcess(false); Game_Fog_Color( atoi( pMsg->m_vecValueList[0].c_str()) , atoi( pMsg->m_vecValueList[1].c_str() ), atoi( pMsg->m_vecValueList[2].c_str() ), atoi( pMsg->m_vecValueList[3].c_str() ) ); return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_lw_color") ) { if( m_pLowQualityWater ) { KColor Color = KColor( atoi( pMsg->m_vecValueList[0].c_str()) , atoi( pMsg->m_vecValueList[1].c_str() ), atoi( pMsg->m_vecValueList[2].c_str() ), atoi( pMsg->m_vecValueList[3].c_str() ) ); m_pLowQualityWater->SetLowQualityWaterColor( Color, true ); } return; } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_cloud_color") ) { KColor Color = KColor( atoi( pMsg->m_vecValueList[0].c_str()) , atoi( pMsg->m_vecValueList[1].c_str() ), atoi( pMsg->m_vecValueList[2].c_str() ), atoi( pMsg->m_vecValueList[3].c_str() ) ); if( m_pSky ) m_pSky->SetCloudColor( Color ); return; } if(!::_stricmp(pMsg->m_strKey.c_str(), "game_set_hqwatercolor")) { SWater* pHqWater = m_pLowQualityWater->GetHightQualityWater(); if( pHqWater ) { pHqWater->SetHqWaterColor( ( BYTE ) atoi( pMsg->m_vecValueList[ 0 ].c_str() ), ( BYTE ) atoi( pMsg->m_vecValueList[ 1 ].c_str() ), ( BYTE ) atoi( pMsg->m_vecValueList[ 2 ].c_str() ), ( BYTE ) atoi( pMsg->m_vecValueList[ 3 ].c_str() ) ); } return; } if( !::_stricmp( pMsg->m_strKey.c_str(), "game_target_skin_diffuse" ) ) { SGameAvatarEx* pTarget = m_pGameSystem->GetTarget(); if( pTarget ) { KColor diffuse; diffuse.r = atoi( pMsg->m_vecValueList[0].c_str() ); diffuse.g = atoi( pMsg->m_vecValueList[1].c_str() ); diffuse.b = atoi( pMsg->m_vecValueList[2].c_str() ); diffuse.a = atoi( pMsg->m_vecValueList[3].c_str() ); pTarget->SetSkinDiffuse( diffuse ); } } if( !::_stricmp(pMsg->m_strKey.c_str(), "game_swap_music" ) ) { if( m_pMSoundMgr ) { int nFadeInTime = atoi( pMsg->m_vecValueList[1].c_str() ); int nFadeOutTime = atoi( pMsg->m_vecValueList[2].c_str() ); int nVolume = atoi( pMsg->m_vecValueList[3].c_str() ); int nLoopCnt = atoi( pMsg->m_vecValueList[4].c_str() ); m_pMSoundMgr->SwapPlayMusic( pMsg->m_vecValueList[0].c_str(), nFadeInTime, nFadeOutTime, nVolume, nLoopCnt ); } return; } } void SGameWorld::SendGameMsg( struct SGameMessage * game_msg ) { if( game_msg->nType == MSG_CHATTING_REQUEST ) { m_pGameSystem->ProcMsgAtStatic( game_msg ); } //_oprint("void SGameWorld::SendGameMsg( struct SGameMessage * game_msg )\n"); m_pGameMng->InterfaceMsg( game_msg ); } void SGameWorld::AfterWarpComplete() { if( m_pWarpMsg == NULL ) { assert( false ); return; } float fHeight = 0.f; WORD wTile=0; GetHeight( m_pWarpMsg->x, m_pWarpMsg->y, fHeight,wTile ); _oprint( "WarpComplete : %f, %f\n", m_pWarpMsg->x, m_pWarpMsg->y ); m_pSky->SetPosition( K3DVector(m_pWarpMsg->x,m_pWarpMsg->y,fHeight) ); //자신에게 Target, 카메라 위치 변경 m_pCamera->SetTargetPos( m_pWarpMsg->x, m_pWarpMsg->y, fHeight+m_fCamera_Z_Offset ); m_pCamera->SetCamPos( m_pWarpMsg->x+88, m_pWarpMsg->y, fHeight+72 ); SetSoundPosition( m_pWarpMsg->x, m_pWarpMsg->y, fHeight+m_fCamera_Z_Offset, m_pWarpMsg->x, m_pWarpMsg->y, fHeight ); m_pLensFlare->SetPosition( K3DVector(m_pWarpMsg->x,m_pWarpMsg->y,fHeight), *m_pSky->GetSunPos() ); //모든 Object들의 높이를 재설정 한다. m_pCommandSystem->SetHeight(); m_pCommandSystem->SetArrangeObject(); SMSG_CHATTING_REQUEST msgChatReq; memset( msgChatReq.szTarget, 0, sizeof(msgChatReq.szTarget) ); msgChatReq.type = CHAT_PARTY_SYSTEM; msgChatReq.strText = "/plist"; m_pGameSystem->ProcMsgAtStatic( &msgChatReq ); //머리 이름 보이기 m_pGameMng->ProcMsgAtStatic( &SIMSG_UI_NAME_TEXT(true) ); //미니맵 리프레쉬 m_pGameMng->ProcMsgAtStatic( &SIMSG_UI_WARP_COMPLETE(m_pWarpMsg->x, m_pWarpMsg->y) ); SetGameRef( STAGE_FADE_IN ); //Warp 완료 됐다. if (m_pGameMng) //m_pGameMng->UpdateLoadingProgress(1.0f); m_pGameMng->UpdateAddLoadingProcess(1.0f); m_dwFadeTime = 0; m_fFade_Visibility = 1.f; //소환된 크리처도 같은 위치로 워프시킨후 적절한 위치로 다시 이동시킨다 m_pGameSystem->SetCreatureBackDown( 0 ); //상태이상 이펙트 작동시키자 m_pCommandSystem->ActivateStateEffect(); } void SGameWorld::WarpComplete( struct SGameMessage * pMsg ) { // SGameAvatarEx::SetThreadLoad(true); SCMSG_WARP* pWarpMsg = reinterpret_cast(pMsg); SAFE_DELETE( m_pWarpMsg ); m_pWarpMsg = new SCMSG_WARP; *m_pWarpMsg = *pWarpMsg; SetGameRef( STAGE_WARP_COMPLETE ); if (m_pGameMng) //m_pGameMng->UpdateLoadingProgress(1.0f); m_pGameMng->UpdateAddLoadingProcess(1.0f); SGameAvatarEx* pLocal = g_pCurrentGameSystem->GetLocalPlayer(); if( pLocal ) { pLocal->PendLoading(); } } //게임 환경, 옵션 설정 관련~ void SGameWorld::Game_LensFlare ( BOOL bFlag ) { SGameLensFlare::SetForceRenderFlag( bFlag ); } void SGameWorld::Game_Aurora_Vis( int nAurora, float fVisibility ) { if( m_pSky ) m_pSky->SetVisibilityAurora( nAurora, true, fVisibility, 0 ); } void SGameWorld::Game_Aurora_Angle( int nAurora, float fAngle) { if( m_pSky ) m_pSky->SetAngleAurora( nAurora, fAngle); } void SGameWorld::Game_Aurora_Scale( int nAurora, float fScale ) { if( m_pSky ) m_pSky->SetScaleAurora( nAurora, fScale ); } void SGameWorld::Game_Aurora_Height( int nAurora, float fHeight ) { if( m_pSky ) m_pSky->SetHeightAurora( nAurora, fHeight ); } #ifdef _DEV_AURORA // 정의된 Aurora 전부를 OFF. void SGameWorld::Game_Aurora_OFF() { if( m_pSky ) m_pSky->SetAuroraRender( false ); } // 하나의 무작위 Aurora를 선택 ON. void SGameWorld::Game_Aurora_ON( float fVisibility, float fAngle, float fScale, float fHeight, DWORD dwOldTime ) { if( m_pSky ) { m_AuroraPrevIndex = m_AuroraIndex; // 이전 index. m_AuroraIndex = m_pSky->RandomizeOnAurora( fVisibility, fAngle, fScale, fHeight, dwOldTime ); // 선택된 Aurora Index 보관. } } #endif void SGameWorld::Game_Cloud ( BOOL bFlag ) { if( m_pSky ) m_pSky->SetCloudRender( bFlag ); } void SGameWorld::Game_Prop ( BOOL bFlag ) { } // { [sonador] void SGameWorld::Game_Thunder ( BOOL bFlag ) { if( m_pSky ) m_pSky->SetThunderProcess( bFlag ); } void SGameWorld::Game_Lightning ( BOOL bFlag ) { if( m_pSky ) m_pSky->SetLightningProcess( bFlag ); } void SGameWorld::Game_Weather ( BOOL bFlag ) { if( m_pWeatherService ) m_pWeatherService->SetActivity( bFlag ); } // } [sonador] void SGameWorld::Game_Effect ( BOOL bFlag ) { } void SGameWorld::Game_Sound ( BOOL bFlag ) { } void SGameWorld::Game_Music ( BOOL bFlag ) { } void SGameWorld::Game_Resolution( int nResolution ) { } void SGameWorld::Game_FSAA( int nSize ) { if ( m_pViewPort ) m_pViewPort->SetFSAA( nSize ); } void SGameWorld::Game_Cloud_vis ( float fVisibility ) { if( m_pSky ) m_pSky->SetVisibility( fVisibility ); } void SGameWorld::Game_Cloud_speed( float fSpeed ) { if( m_pSky ) m_pSky->SetCloudSpeed( fSpeed ); } void SGameWorld::Game_Camera_fov( float fFov ) { if( m_pCamera ) m_pCamera->SetFOV( fFov ); } void SGameWorld::Game_Mip_Range( float fRange ) { if ( m_pViewPort ) m_pViewPort->SetMipRange( fRange ); } void SGameWorld::Game_Mip_Bias( float fMipBias ) { if ( m_pViewPort ) m_pViewPort->SetMipBias( fMipBias ); } void SGameWorld::Game_Target_CamPos( int nX, int nY, int nZ ) { SIMSG_UI_TARGET_CAM_POS msg; msg.pos = K3DVertex( nX, nY, nZ ); m_pGameMng->InterfaceMsg( &msg ); } void SGameWorld::Game_Sky_Color ( int nR, int nG, int nB, int nA ) { m_FillColor = KColor( nR, nG, nB, nA ); if( m_pViewPort ) m_pViewPort->SetFillColor( m_FillColor ); } void SGameWorld::Game_Fog_Color ( int nR, int nG, int nB, int nA ) { m_FogColor = KColor( nR, nG, nB, nA ); m_bIsCustomFog = true; } void SGameWorld::Game_Light ( int type, K3DColor col ) { if( m_pTerrainLight ) { switch( type ) { case 0 : m_pTerrainLight->diffuse = col; break; case 1 : m_pTerrainLight->specular = col; break; case 2 : m_pTerrainLight->ambient = col; break; } } } void SGameWorld::Game_Effect_Light( int type, K3DColor col ) { if( m_pEffectLight ) { switch( type ) { case 0 : m_pEffectLight->diffuse = col; break; case 1 : m_pEffectLight->specular = col; break; case 2 : m_pEffectLight->ambient = col; break; } } } void SGameWorld::Game_Light_Pos ( int nX, int nY, int nZ ) { if( m_pTerrainLight ) { m_pTerrainLight->position.x = nX; m_pTerrainLight->position.y = nY; m_pTerrainLight->position.z = nZ; // m_pTerrainLight->direction = m_pTerrainLight->position; // Normalize(m_pTerrainLight->direction); } } void SGameWorld::Game_Light_Dir( float fX, float fY, float fZ ) { m_pTerrainLight->direction = K3DVector( fX, fY, fZ ); } void SGameWorld::Game_Fog_Linear_Start( float fUnit ) { m_bIsCustomFog = true; m_fLinearFog_Start = fUnit; } void SGameWorld::Game_Fog_Linear_End ( float fUnit ) { m_bIsCustomFog = true; m_fLinearFog_End = fUnit; } void SGameWorld::Game_Fog_Height_Start( float fUnit ) { m_bIsCustomFog = true; m_fHeightFog_Start = fUnit; } void SGameWorld::Game_Fog_Height_End ( float fUnit ) { m_bIsCustomFog = true; m_fHeightFog_End = fUnit; } void SGameWorld::Game_Sky_Color_Start( int nR, int nG, int nB ) { //Sky Color m_Sky_Color_Start = K3DColor( nR/255.f, nG/255.f, nB/255.f ); } void SGameWorld::Game_Sky_Color_Mid ( int nR, int nG, int nB ) { m_Sky_Color_Mid = K3DColor( nR/255.f, nG/255.f, nB/255.f ); } void SGameWorld::Game_Sky_Color_End ( int nR, int nG, int nB ) { m_Sky_Color_End = K3DColor( nR/255.f, nG/255.f, nB/255.f ); } void SGameWorld::Game_Sky_Color_MaxHeight( float fMaxHeight ) { m_fSkyColorMaxHeight = fMaxHeight; } void SGameWorld::Game_Sky_Color_MidHeightPercent( float fMidHeightPercent ) { m_fSkyMidHeightPercent = fMidHeightPercent; } void SGameWorld::Game_Sky_Color_MinHeight( float fMinHeight ) { m_fSkyColorMinHeight = fMinHeight; } void SGameWorld::Game_Cloud_Color( int nR, int nG, int nB, int nA ) { if( m_pSky ) m_pSky->SetCloudColor( KColor( nR, nG, nB, nA ) ); } void SGameWorld::Game_Terrain_Specular( float fSpecular ) { if( m_pViewPort ) { m_pViewPort->SetTerrainSpecularFactor( fSpecular ); m_fTerrainSpecular = fSpecular; } } void SGameWorld::Game_CharSkin_Color( float fAmbiant, float fDiffuse ) { m_pViewPort->SetSkinAmbientFactor( fAmbiant ); m_pViewPort->SetSkinDiffuseFactor( fDiffuse ); m_fCharSkinAmbiantFactor = fAmbiant; m_fCharSkinDiffuseFactor = fDiffuse; } void SGameWorld::Game_DryWet_Volume( float fDryVol, float fWetVol ) { SetGameDryVolume( fDryVol ); SetGameWetVolume( fWetVol ); } void SGameWorld::SetMinimapInfo( K3DVector vecPos ) { // 심리스 정보 const CTerrainSeamlessWorldInfo* pSeamlessInfo = m_pTerrainMapEngine ->GetSeamlessWorldInfo(); if( pSeamlessInfo == NULL ) return; // 맵 길이 float fMapLen = float( pSeamlessInfo->GetTileCountPerSegment() ) * float(pSeamlessInfo->GetSegmentCountPerMap() ) * pSeamlessInfo->GetTileLength(); // 맵좌표( 0, 1, .... ) int nPosX = vecPos.x / fMapLen; int nPosY = vecPos.y / fMapLen; SIMSG_UI_MINIMAP_INFO msg; // 맵 파일명, 미니맵 파일명 msg.nMapPosX = nPosX; msg.nMapPosY = nPosY; msg.strMiniMapFile = pSeamlessInfo->GetMinimapImageFileName( nPosX, nPosY ); msg.fMapSize = fMapLen; msg.nMapCountX = pSeamlessInfo->GetMapCount().cx; msg.nMapCountY = pSeamlessInfo->GetMapCount().cy; //ProcMsgAtStatic( &msg ); msg.bUse = true; m_pGameMng->InterfaceMsg( &msg ); } void SGameWorld::LoadWayPoint( K3DVector vPos ) { const CTerrainSeamlessWorldInfo* pSeamlessInfo = m_pTerrainMapEngine->GetSeamlessWorldInfo(); if( pSeamlessInfo == NULL ) return; float fMapLen = float( pSeamlessInfo->GetTileCountPerSegment() ) * float(pSeamlessInfo->GetSegmentCountPerMap() ) * pSeamlessInfo->GetTileLength(); int nPosX = vPos.x / fMapLen; int nPosY = vPos.y / fMapLen; std::string str = pSeamlessInfo->GetMapFileName( nPosX, nPosY ); m_pWayPoint->LoadWayPoint( str, nPosX, nPosY, fMapLen ); } K3DVector* SGameWorld::GetWayPoint( int& nWayPointID ) { return m_pWayPoint->GetWayPoint( nWayPointID ); } void SGameWorld::SendCreatureCmdScript( STRUCT_CREATURE_CMD_SCRIPT &sCCmdScr ) { SGameAvatarEx* pCreature = (SGameAvatarEx*)GetGameObject( sCCmdScr.cHandle ); if( pCreature == NULL ) return; if( !pCreature->IsLive() ) return; switch( sCCmdScr.nCmdScipt ) { case STRUCT_CREATURE_CMD_SCRIPT::CMD_STANDBY : pCreature->CmdStandBy(); break; case STRUCT_CREATURE_CMD_SCRIPT::CMD_IDLE : pCreature->CmdIdle(); break; case STRUCT_CREATURE_CMD_SCRIPT::CMD_MOVE : pCreature->CmdMove(); break; case STRUCT_CREATURE_CMD_SCRIPT::CMD_ATTACK : pCreature->CmdAttack(); break; case STRUCT_CREATURE_CMD_SCRIPT::CMD_SKILL : { if( m_pGameSystem ) m_pGameSystem->CmdUseSkil( sCCmdScr ); } break; } } int SGameWorld::GetSelectedState( AR_HANDLE handle, GET_PLAYER_INFO nInfo ) { SGameAvatarEx* pSelected = (SGameAvatarEx*)GetGameObject( handle ); if( pSelected ) { switch( nInfo ) { case GET_HP : return pSelected->GetHP(); case GET_MP : return pSelected->GetMP(); case GET_MAXHP : return pSelected->GetMaxHP(); case GET_MAXMP : return pSelected->GetMaxMP(); // TODO : HPHPHP // case GET_PERCENTHP : return pSelected->GetPercentHP(); // case GET_PERCENTMP : return pSelected->GetPercentMP(); } } return 0; } int SGameWorld::GetWeatherTheme() const { if( m_pWeatherService ) return m_pWeatherService->GetState(); return 0; } void SGameWorld::SetWeatherTheme( env_fx::SWeatherInfo* pInfo ) { if( m_pWeatherService ) m_pWeatherService->SetTheme( pInfo ); else SAFE_DELETE( pInfo ); } void SGameWorld::SetThunderAttribute( env_fx::SThunderAttr* pAttr ) { if( m_pSky ) m_pSky->SetThunderAttribute( pAttr ); } void SGameWorld::SetLightningAttribute( env_fx::SLightningAttr* pAttr ) { if( m_pSky ) m_pSky->SetLightningAttribute( pAttr ); } void SGameWorld::SetEnvironmentConfigMode( bool mode ) { m_EnvConfigArgument.ActivateConfigMode( mode ); } void SGameWorld::LoadEnvironmentScript() { std::string script_name = KFileManager::Instance().CreateTemporaryFileFromResource( "environment_script.lua" ); if( script_name.length() > 0 ) { LUA()->LoadScript( script_name.c_str() ); KFileManager::Instance().DeleteTemporaryFile( "environment_script.lua" ); } LUA()->RunString( "get_environment_info()" ); m_EnvConfigArgument.FixEnvProperty(); } #ifdef DISTANCE_VIEW env_fx::SSkyBoxAttr* SGameWorld::GetSkyThemeInfo() const { if( m_pSky == NULL ) return NULL; return m_pSky->GetSkyThemeInfo(); } void SGameWorld::SetSkyThemeInfo( env_fx::SSkyBoxAttr* pAttr ) { if( m_pSky ) m_pSky->SetSkyThemeInfo( pAttr ); else SAFE_DELETE( pAttr ); } env_fx::SDistanceViewAttr* SGameWorld::GetDistanceViewInfo() const { if( m_pSky == NULL ) return NULL; return m_pSky->GetDistanceViewInfo(); } void SGameWorld::SetDistanceViewInfo( env_fx::SDistanceViewAttr* pAttr ) { if( m_pSky ) m_pSky->SetDistanceViewInfo( pAttr ); else SAFE_DELETE( pAttr ); } bool SGameWorld::ChangeDistanceView( int local_id ) { if( m_pSky ) return m_pSky->ChangeDistanceView( local_id ); return false; } #endif //bool SGameWorld::IsMovingDetour() //{ // const CTerrainMapEngine::PATH& vDetourPath = m_pTerrainMapEngine->GetDetour(); // size_t numDetourPoints = vDetourPath.size(); // // if(numDetourPoints < 2) return false; // if(numDetourPoints > m_nDetourStep + 1) return true; // // SGameAvatarEx * pLocal = m_pGameSystem->GetLocalPlayer(); // if( pLocal ) // { // K3DVertex curpos = *pLocal->GetPosition(); // // if( (int) curpos.x == vDetourPath[numDetourPoints - 1].x && (int) curpos.y == vDetourPath[numDetourPoints - 1].y ) // { // return false; // } // else // { // return true; // } // } // else // { // return false; // } //} // //bool SGameWorld::IsChasing() //{ // return m_bIsChasing; //} // //bool SGameWorld::MoveDetour(K3DVertex& vtMovePos) //{ // const CTerrainMapEngine::PATH& vDetourPath = m_pTerrainMapEngine->GetDetour(); // size_t numDetourPoints = vDetourPath.size(); // if(numDetourPoints < m_nDetourStep + 2) return false; // //if(numDetourPoints < m_nDetourStep + 1) return false; // // bool bRefreshDetour = m_bRefreshDetour; // m_bRefreshDetour = false; // // //if(bRefreshDetour && m_nDetourStep != 0) // //{ // // assert(0); // //} // // //K3DVertex curpos, goalpos; // K3DVertex curpos; // // SGameAvatarEx * pLocal = m_pGameSystem->GetLocalPlayer(); // if( pLocal ) // { // curpos = *pLocal->GetPosition(); // // //static int nOffset = 0; // 임시 코드 by blackfish // //if( m_bRefreshDetour || ( (int) (curpos.x + 0.5f) == vDetourPath[m_nDetourStep].x && (int) (curpos.y + 0.5f) == vDetourPath[m_nDetourStep].y ) ) // //if( m_bRefreshDetour || // // ( abs((int) (curpos.x + 0.5f) - vDetourPath[m_nDetourStep].x) <= nOffset && abs((int) (curpos.y + 0.5f) - vDetourPath[m_nDetourStep].y) <= nOffset ) ) // if( bRefreshDetour || ( (int) curpos.x == vDetourPath[m_nDetourStep].x && (int) curpos.y == vDetourPath[m_nDetourStep].y ) ) // { // if(numDetourPoints > m_nDetourStep + 1) // { // // goalpos.x = vDetourPath[m_nDetourStep + 1].x; // //goalpos.y = vDetourPath[m_nDetourStep + 1].y; // ////goalpos.z = GetHeight( curpos.x, curpos.y ); // //goalpos.z = 0.0f; // // //if(m_bCretureMove) // //{ // // SInputMove input_move( goalpos, false ); //크리처 자신의 속도로 이동한 // // AddGameCreatureInput( &input_move ); // //} // //else // //{ // // //마운트 모드면 자동 이동경로 삭제 // // if( pLocal->IsMountMode() ) pLocal->ClearWayPointList(); // // // SInputMove input_move( goalpos ); // // AddGameInput( &input_move ); // //} // // vtMovePos.x = vDetourPath[m_nDetourStep + 1].x; // vtMovePos.y = vDetourPath[m_nDetourStep + 1].y; // //vtMovePos.z = GetHeight( curpos.x, curpos.y ); // vtMovePos.z = 0.0f; // // ++m_nDetourStep; // // return true; // } // } // } // // return false; //} // ////bool SGameWorld::ChaseDetour(const K3DVertex& vTarget, K3DVertex& vMovePos) ////{ //// const CTerrainMapEngine::PATH& vDetourPath = m_pTerrainMapEngine->GetDetour(); //// size_t numDetourPoints = vDetourPath.size(); //// if(numDetourPoints > 2) --numDetourPoints; //// if(numDetourPoints < m_nDetourStep + 1) return false; //// //// K3DVertex curpos, goalpos; //// //// SGameAvatarEx * pLocal = m_pGameSystem->GetLocalPlayer(); //// if( pLocal ) //// { //// curpos = *pLocal->GetPosition(); //// //// if( m_bRefreshDetour || ( (int) curpos.x == vDetourPath[m_nDetourStep].x && (int) curpos.y == vDetourPath[m_nDetourStep].y ) ) //// { //// if(numDetourPoints > m_nDetourStep + 1) //// { //// goalpos.x = vDetourPath[m_nDetourStep + 1].x; //// goalpos.y = vDetourPath[m_nDetourStep + 1].y; //// //goalpos.z = GetHeight( curpos.x, curpos.y ); //// goalpos.z = 0.0f; //// //// //if(m_bCretureMove) //// //{ //// // SInputMove input_move( goalpos, false ); //크리처 자신의 속도로 이동한 //// // AddGameCreatureInput( &input_move ); //// //} //// //else //// //{ //// // //마운트 모드면 자동 이동경로 삭제 //// // if( pLocal->IsMountMode() ) pLocal->ClearWayPointList(); //// //// // SInputMove input_move( goalpos ); //// // AddGameInput( &input_move ); //// //} //// //// ++m_nDetourStep; //// } //// //else //// //{ //// // FindDetour(curpos, vTarget, true); //// // return ChaseDetour(vTarget, vMovePos); //// //} //// } //// else //// { //// //K3DPoint p1((float) vDetourPath[numDetourPoints - 2].x, (float) vDetourPath[numDetourPoints - 2].y); //// //K3DPoint p2((float) vDetourPath[numDetourPoints - 1].x, (float) vDetourPath[numDetourPoints - 1].y); //// //K3DPoint p3(vTarget.x, vTarget.y); //// //K3DPoint vec1 = p2 - p1; //// //K3DPoint vec2 = p3 - p1; //// // //// //float mag; //// //mag = vec1.x * vec1.x + vec1.y * vec1.y; //// //vec1 /= mag; //// //mag = vec2.x * vec2.x + vec2.y * vec2.y; //// //vec2 /= mag; //// //// // if(vec1.x * vec2.x + vec1.y * vec2.y > 0.5f) //// //{ //// // FindDetour(curpos, vTarget, true); //// // return ChaseDetour(vTarget, vMovePos); //// //} //// //// goalpos.x = vDetourPath[m_nDetourStep + 1].x; //// goalpos.y = vDetourPath[m_nDetourStep + 1].y; //// goalpos.z = 0.0f; //// } //// } //// else //// { //// m_bRefreshDetour = false; //// return false; //// } //// //// vMovePos = goalpos; //// m_bRefreshDetour = false; //// //// return true; ////} // ////bool SGameWorld::GetNexMovePos(K3DVertex& vtMovePos) ////{ ////} bool SGameWorld::CollisionToLine( const K3DVector& vStart, const K3DVector& vEnd ) { return m_pTerrainMapEngine->CollisionToLine( vStart, vEnd ); } void SGameWorld::FindDetour( const K3DVertex& vStart, const K3DVertex& vEnd, PATH& vPath, bool bRestraint, bool bChase, bool bIsPlayer ) { m_pTerrainMapEngine->FindDetour( vStart, vEnd, vPath, bRestraint ); if( !bChase && !vPath.empty() ) { float x = vPath[vPath.size() - 1].x; float y = vPath[vPath.size() - 1].y; float z = 0.f; WORD wTile=0; GetHeight(x, y, z,wTile); if( bIsPlayer ) SetMoveTargetPos(x, y, z); } else { if( bIsPlayer ) SetMoveTargetPos(0.0f, 0.0f, 0.0f, true); // 이동 커서를 숨긴다 } /* if( vPath.empty() ) { m_pCommandSystem->MoveImpossibleMsg(); }*/ } //size_t SGameWorld::GetDetourSize() //{ // const CTerrainMapEngine::PATH& vDetourPath = m_pTerrainMapEngine->GetDetour(); // return vDetourPath.size(); //} // //bool SGameWorld::GetDetourPoint(size_t index, int& x, int& y) //{ // const CTerrainMapEngine::PATH& vDetourPath = m_pTerrainMapEngine->GetDetour(); // size_t numDetourPoints = vDetourPath.size(); // if(numDetourPoints <= index) return false; // // x = vDetourPath[index].x; // y = vDetourPath[index].y; // // return true; //} // //int SGameWorld::GetDetourStep() //{ // return m_nDetourStep; //} void SGameWorld::AutoMove() { SGameAvatarEx* pPlayer = m_pGameSystem->GetLocalPlayer(); if( pPlayer == NULL ) { ResetAutoMoveMode(); return; } K3DVector vPosition = *pPlayer->GetPosition(); m_vTargetPos.z = 0.f; vPosition.z = 0.f; float fDistance = K3DVectorLength( m_vTargetPos - vPosition ); //5M 근접했다면 if( fDistance <= (float)GameRule::DEFAULT_UNIT_SIZE * 5.f ) { m_vTargetPos = vPosition; m_vTargetPos += m_vAutoMoveDir * (float)GameRule::DEFAULT_UNIT_SIZE * 50.f; pPlayer->FindDetour(m_vTargetPos, true, false); SInputMove input_move( m_vTargetPos ); AddGameInput( &input_move ); SGameAvatarEx * pTarget = m_pGameSystem->GetTarget(); if( pTarget ) { SetUI_TargetActiveInfo( pTarget->GetArID(), SIMSG_UI_TARGET_ACTIVE_INFO::TARGET_ACTIVE_OFF ); } } } void SGameWorld::ResetAutoMoveMode() { m_bAutoMove = false; } void SGameWorld::AutoFollowMode() { if( !m_bAutoFollowMode ) return; SGameAvatarEx* pFollowTarget = (SGameAvatarEx*)GetGameObject( m_hFollowTarget ); SGameAvatarEx* pLocalPlayer = m_pGameSystem->GetLocalPlayer(); // sonador 1.8.9 은신 케릭터 자동 따라가기 버그 수정 // sonador 1.8.11 자동 따라가기 은신 플레그 확인 오류 수정 if( !pFollowTarget || !pLocalPlayer || ( ( pFollowTarget->GetStateFlag() & SGameAvatarEx::FLAG_STATE_HIDING ) && !this->IsPartyRaidMemeber( m_hFollowTarget ) ) ) { ResetAutoFollowMode(); return; } if( !pLocalPlayer ) return; K3DVector vTargetPos = *pFollowTarget->GetPosition(); vTargetPos.z = 0.0f; K3DVector vPlayerPos = *pLocalPlayer->GetPosition(); vPlayerPos.z = 0.0f; vPlayerPos = vPlayerPos - vTargetPos; if( K3DVectorLength( vPlayerPos ) <= (float)GameRule::DEFAULT_UNIT_SIZE*2.0f ) return; K3DVectorNormalize( vPlayerPos, vPlayerPos ); vPlayerPos *= (float)GameRule::DEFAULT_UNIT_SIZE; K3DVector vDest; K3DMatrix matRot; float fZ = 0.0f; float fRotDetail = K3D_PI/10.0f; //회전 정밀도 do { K3DMatrixRotationZ( matRot, fZ ); K3DVectorTransform( vDest, vPlayerPos, matRot ); vDest = vTargetPos + vDest; pLocalPlayer->FindDetour(vDest, true, false); fZ += fRotDetail; if( fZ >= K3D_PI ) { fRotDetail = -fRotDetail; fZ = fRotDetail; } else if( fZ <= -K3D_PI) { if( pLocalPlayer->GetAllDetourPointSize() == 0 ) { ResetAutoFollowMode(); m_pCommandSystem->MoveImpossibleMsg(); return; } else break; } } while( pLocalPlayer->GetAllDetourPointSize() == 0 ); SInputMove input_move( vDest ); AddGameInput( &input_move ); } void SGameWorld::ResetAutoFollowMode() { m_bAutoFollowMode = false; m_hFollowTarget = 0; } void SGameWorld::LocalProcess() { //_oprint("void SGameWorld::LocalProcess()\n"); if( m_bTimeProcess == false ) return; // Find region CTerrainMapEngine::PLAYER_LOCAL_POSITION nLocalState = m_pTerrainMapEngine->FindLocationInfoForMap( &m_pCamera->GetTargetPos() ); std::string strLocalScript; if( nLocalState == CTerrainMapEngine::PLAYER_LOCAL_POSITION::_IN_ ) { strLocalScript = m_pTerrainMapEngine->GetLocalScript(); } else if( nLocalState == CTerrainMapEngine::PLAYER_LOCAL_POSITION::_OUT_ ) { strLocalScript = "call_lc_Out()"; m_nCLocationID = m_pTerrainMapEngine->GetWorldID(); } if(!strLocalScript.empty()) { LUA()->RunString( strLocalScript.c_str() ); } else if( m_nCLocationID != m_nSLocationID ) { // If the client region ID and the server ID are different, keep sending requests to the server if( (m_dwTime - m_dwRequestTimeLc) >= 5000 ) // Request only once per 5 seconds (5 * 1000) { m_dwRequestTimeLc = m_dwTime; XStringUtil::Format( strLocalScript, "call_lc_In( %d )", m_nCLocationID ); LUA()->RunString( strLocalScript.c_str() ); } } std::vector vecID; std::vector vecPolyNum; m_pTerrainMapEngine->GetPlayerPositionEventAreaID( m_pCamera->GetTargetPos(), vecID, vecPolyNum); for (size_t i = 0; i < vecID.size(); i++) { if (std::find(m_vecEventAreaID.begin(), m_vecEventAreaID.end(), vecID[i]) == m_vecEventAreaID.end()) { _oprint( "SMSG_ENTER_EVENTAREA : event area : %d / poly num : %d", vecID[i], vecPolyNum[i] ); // 2011.09.26 : servantes : 확인용 SMSG_ENTER_EVENTAREA msg(vecID[i], vecPolyNum[i]); m_pGameSystem->ProcMsgAtStatic(&msg); m_vecEventAreaID.push_back(vecID[i]); } } for (size_t i = 0; i < m_vecEventAreaID.size(); i++) { if (std::find(vecID.begin(), vecID.end(), m_vecEventAreaID[i]) == vecID.end()) { int nEventArea=m_vecEventAreaID[i]; int nPolyNum=0; int nVectorPolySize = vecPolyNum.size(); if(nVectorPolySize < m_vecEventAreaID.size()) nPolyNum = 0; else nPolyNum = vecPolyNum[i]; _oprint( "SMSG_LEAVE_EVENTAREA : event area : %d / poly num : %d", nEventArea, nPolyNum ); // 2011.09.26 : servantes : 확인용 SMSG_LEAVE_EVENTAREA msg(nEventArea, nPolyNum); // 2011.07.06 - servantes / vecPolyNum 추가 m_pGameSystem->ProcMsgAtStatic(&msg); m_vecEventAreaID.erase(m_vecEventAreaID.begin() + i); break; // Only one per frame } } vecID.clear(); vecPolyNum.clear(); } void SGameWorld::SetTempEnv() { m_Environment_Info.SetFogColor( m_FogColor ); m_Environment_Info.SetSkyColor( K3DColor( m_Sky_Color_Start.r, m_Sky_Color_Start.g, m_Sky_Color_Start.b ), K3DColor( m_Sky_Color_Mid.r, m_Sky_Color_Mid.g, m_Sky_Color_Mid.b ), K3DColor( m_Sky_Color_End.r, m_Sky_Color_End.g, m_Sky_Color_End.b ) ); m_Environment_Info.SetHeightFogStartEnd( m_fHeightFog_Start, m_fHeightFog_End ); m_Environment_Info.SetLinearFogStartEnd( m_fLinearFog_Start, m_fLinearFog_End ); m_Environment_Info.SetTerrainSpecular( m_fTerrainSpecular ); if(m_pTerrainLight) { m_Environment_Info.SetLight( K3DColor( m_pTerrainLight->specular.r, m_pTerrainLight->specular.g, m_pTerrainLight->specular.b), K3DColor( m_pTerrainLight->ambient.r, m_pTerrainLight->ambient.g, m_pTerrainLight->ambient.b), K3DColor( m_pTerrainLight->diffuse.r, m_pTerrainLight->diffuse.g, m_pTerrainLight->diffuse.b) ); } if( m_pSky ) { m_Environment_Info.SetCloudColor( m_pSky->GetCloudColor() ); // Aurora. m_Environment_Info.SetAurora( m_pSky->GetVisibilityAurora( m_AuroraIndex ), m_pSky->GetScaleAurora( m_AuroraIndex ), m_pSky->GetAngleAurora( m_AuroraIndex ), m_pSky->GetHeightAurora( m_AuroraIndex ) ); } m_Environment_Info.SetDryWetVolume( m_fDryVolume, m_fWetVolume ); m_Environment_Info.SetCharSkinColor( m_fCharSkinAmbiantFactor, m_fCharSkinDiffuseFactor ); m_dwStartEnvLerpTime = m_dwTime; m_bChangeLocation = true; // *m_pSavedEnvProp = *m_pEnvProp; } void SGameWorld::SetGameTime( SMSG_GAME_TIME* pMsg ) { m_nGameTime = pMsg->game_time; m_nArGameTime = pMsg->t; m_bTimeProcess = true; } void SGameWorld::sendMapChange( const WorldLocationBase* pData ) { if( pData == NULL ) return; SIMSG_UI_CHANGE_MAP_PROCESS msg(m_nZoomMapType) ; if( m_nZoomMapType == 1 ) { assert( pData->size_x ); assert( pData->size_y ); msg.m_display_positoin_x = pData->display_positoin_x; //표시 위치 X 인덱스 msg.m_display_positoin_y = pData->display_positoin_y; //표시 위치 Y 인덱스 msg.m_zoom_x = pData->zoom_x; //확대 배율 msg.m_offset_x = pData->offset_x; msg.m_offset_y = pData->offset_y; msg.m_size_x = pData->size_x; //맵의 가로 크기 msg.m_size_y = pData->size_y; //맵의 세로 크기 msg.m_strBlank_resource = GetResourceDB().GetTextureResourceName( pData->blank_resource_ID ); //여백처리 msg.m_blank_a = pData->blank_a; //여백 칼라 msg.m_blank_r = pData->blank_r; //여백 칼라 msg.m_blank_g = pData->blank_g; //여백 칼라 msg.m_blank_b = pData->blank_b; //여백 칼라 } msg.zoom_minimap = pData->zoom_minimap; //알림 m_pGameMng->InterfaceMsg( &msg ); } void SGameWorld::SetTime() { if( m_bTimeProcess == false ) return; AR_TIME artime = GetArTime(); artime = artime - m_nArGameTime; //1초 if( artime > (unsigned)(m_nRefGameTime*100) ) { m_nGameTime += m_nIncGameTime;//artime / 100; m_nArGameTime = GetArTime(); } struct tm NowTime; if( !_IsEnvironmentConfigMode() ) { NowTime = (*localtime( &m_nGameTime )); } else { ::memcpy( &NowTime, &m_EnvConfigArgument.mConfigModeTime, sizeof( NowTime ) ); } int nHour = NowTime.tm_hour; if( nHour >= 12 ) { nHour = nHour % 12; } time_t nCalctime = 0; nCalctime += NowTime.tm_sec; nCalctime += NowTime.tm_min * 60; nCalctime += nHour * 3600; nCalctime *= 2; memset( &NowTime, 0, sizeof(NowTime) ); NowTime.tm_hour = nCalctime / 3600; NowTime.tm_min = ( nCalctime % 3600 ) / 60; NowTime.tm_sec = nCalctime % 60; /* #ifndef NDEBUG std::string str; XStringUtil::Format( str, "현재 시간 : %d:%d:%d\n", NowTime.tm_hour, NowTime.tm_min, NowTime.tm_sec ); AddChatMessage(str.c_str()); #endif */ // setup lerp argument env_fx::SLerpArgument lerpArg; lerpArg.configMode = _IsEnvironmentConfigMode(); lerpArg.time = m_dwTime; lerpArg.tmTime = NowTime; lerpArg.weatherID = m_nWeatherID; lerpArg.weatherOptionFactor = SWeatherQualityConverter()( GetGameOption().GetWeatherQuality() ); lerpArg.isIndoor = ( GetPlayerCurrentLocation() != PLAYER_IN_DUNGEON && GetPlayerCurrentLocation() != PLAYER_IN_DUNGEON_SIEGE ) ? false : true; lerpArg.localID = _getValidLocationID(); m_pEnvironmentService->Perform( lerpArg ); if( lerpArg.weatherChanged ) SetTempEnv(); m_nCurrTime = lerpArg.timeState; float fLerpTime = lerpArg.lerpTime; const WorldLocationBase* pData = lerpArg.locData; const WorldLocationBase* pDataLerp = lerpArg.locLerpData; // sonador 1.1.20 환경값 보간 오류 수정 SWorldLocationDB& worldDB = GetWorldLocationDB(); // is argument is valid? if( !lerpArg.isValid() ) { if( m_pSky ) m_pSky->SetTime( NowTime.tm_hour, NowTime.tm_min, NowTime.tm_sec ); return; } // 미니맵, 월드맵 중앙처리 인가? if( m_nCurrentLocationID != pData->id ) { m_nZoomMapType = pData->zoom_map_type; sendMapChange( pData ); } else { if( m_nZoomMapType != pData->zoom_map_type ) { m_nZoomMapType = pData->zoom_map_type; sendMapChange( pData ); } } m_nCurrentLocationID = pData->id; // 마을과 PK 불가 지역 if( pData->location_type == WorldLocationBase::LOCTYPE_TOWN || pData->location_type == WorldLocationBase::LOCTYPE_SHOP_TOWN || pData->location_type == WorldLocationBase::LOCTYPE_FIELD_NONPVP || pData->location_type == WorldLocationBase::LOCTYPE_RAMADAN ) m_bIsAttackLocation = false; else m_bIsAttackLocation = true; /// 2011.03.10 - prodongi setFixedTerrainDistance(pData->fixedTerrainDistance); // 현재 지형과의 비례로 float fCurTerrainLen = m_pTerrainMapEngine->GetTerrainVisibleDistance(); if( GetGameRef() == STAGE_EVENT_SCENE ) { fCurTerrainLen = 3000.0f; } else { //마을, 던전 인 경우, 제한 거리 설정됨. if( pData->location_type == WorldLocationBase::LOCTYPE_TOWN || pData->location_type == WorldLocationBase::LOCTYPE_SHOP_TOWN || pData->location_type == WorldLocationBase::LOCTYPE_RAMADAN || pData->location_type == WorldLocationBase::LOCTYPE_DUNGEON ) { m_nLimitDisitance = 1000; // Azia Mafia LoadMap 1000 } else m_nLimitDisitance = 0; if( GetGameOption().GetTownLimit() == 1 ) { //// 지역속성 ID // 기타 0 // 마을 1 // 필드 2 // PK불가필드 3 // 던전 4 if( pData->location_type == WorldLocationBase::LOCTYPE_TOWN || pData->location_type == WorldLocationBase::LOCTYPE_SHOP_TOWN ) { //강제로 프랍거리가 줄어 든다. //이것으로 인해 마을 안 에서는 프랍거리 설정이 안됨. m_Curlocation_type = pData->location_type; float fValue = 0.3f; CTerrainProp::SetPropSmallVisRange ( fValue ); CTerrainProp::SetPropLargeVisRange ( fValue ); CTerrainProp::SetBuildingSmallVisRange( fValue ); CTerrainProp::SetBuildingLargeVisRange( fValue ); } else { //기존것 살림 if( m_Curlocation_type != pData->location_type ) { m_Curlocation_type = pData->location_type; float fValue = 1.0f; switch( GetGameOption().GetPropViewDistance() ) { case 0 : fValue = 0.3f; break; case 1 : fValue = 0.4f; break; case 2 : fValue = 0.5f; break; case 3 : fValue = 0.7f; break; case 4 : fValue = 1.0f; break; } /// 2011.03.11 - prodongi checkFixedTerrainDistanceRatio(fValue); CTerrainProp::SetPropSmallVisRange ( fValue ); CTerrainProp::SetPropLargeVisRange ( fValue ); CTerrainProp::SetBuildingSmallVisRange( fValue ); CTerrainProp::SetBuildingLargeVisRange( fValue ); } } } } static K3DColor sOut; static K3DColor sLight_s, sLight_a, sLight_d, sFog, sSkyStart, sSkyMid, sSkyEnd, sCloudColor; static K3DVector vHeight, vLinear; static float fTerrainSpecular; static float fCharSkinAmbiantFactor; static float fCharSkinDiffuseFactor; static float fDryVolume, fWetVolume; //현재 환경값을 유지한다 worldDB.GetSkyColor( sSkyStart, sSkyMid, sSkyEnd, pData ); worldDB.GetFogColor( sFog, pData ); worldDB.GetHeightLinear( vHeight, vLinear, pData ); worldDB.GetLightColor( sLight_s, sLight_a, sLight_d, pData ); fTerrainSpecular = pData->land_specular; fCharSkinAmbiantFactor = pData->character_ambient; if (fCharSkinAmbiantFactor>1.0f) fCharSkinAmbiantFactor = 1.0f; fCharSkinDiffuseFactor = pData->character_diffuse; worldDB.GetCloudColor( sCloudColor, pData ); fDryVolume = (float)pData->environmental_sound_volume; fWetVolume = (float)pData->environmental_sound_reverb; vLinear.x = fCurTerrainLen * vLinear.x; vLinear.y = fCurTerrainLen * vLinear.y; vHeight.x = fCurTerrainLen * vHeight.x; vHeight.y = fCurTerrainLen * vHeight.y; // sonador 1.1.18 환경 효과 오류 수정 vLinear.x *= m_fGameFogDistanceFactor; vLinear.y *= m_fGameFogDistanceFactor; vHeight.x *= m_fGameFogDistanceFactor; vHeight.y *= m_fGameFogDistanceFactor; //이전 환경값과 다음 환경값을 보간한다 if( lerpArg.lerpAction != env_fx::SLerpArgument::LERP_NONE || lerpArg.weatherChanged == true ) { static K3DColor sPLight_s, sPLight_a, sPLight_d, sPFog, sPSkyStart, sPSkyMid, sPSkyEnd, sPColudColor; static K3DVector vPHeight, vPLinear; //Sky Start End 보간 worldDB.GetSkyColor( sPSkyStart, sPSkyMid, sPSkyEnd, pDataLerp ); K3DColorLerp( sSkyStart, sSkyStart, sPSkyStart, fLerpTime ); K3DColorLerp( sSkyMid, sSkyMid, sPSkyMid, fLerpTime ); K3DColorLerp( sSkyEnd, sSkyEnd, sPSkyEnd, fLerpTime ); //포그 보간 worldDB.GetFogColor( sPFog, pDataLerp ); K3DColorLerp( sFog, sFog, sPFog, fLerpTime ); //포그 높이 및 거리 보간 worldDB.GetHeightLinear( vPHeight, vPLinear, pDataLerp ); vPLinear.x = fCurTerrainLen * vPLinear.x; // sonador 1.1.18 환경 효과 오류 수정 vPLinear.y = fCurTerrainLen * vPLinear.y; // vPHeight.x = fCurTerrainLen * vPHeight.x; // vPHeight.y = fCurTerrainLen * vPHeight.y; // // sonador 1.1.18 환경 효과 오류 수정 vPLinear.x *= m_fGameFogDistanceFactor; vPLinear.y *= m_fGameFogDistanceFactor; vPHeight.x *= m_fGameFogDistanceFactor; vPHeight.y *= m_fGameFogDistanceFactor; K3DVectorLerp( vHeight, vHeight, vPHeight, fLerpTime ); K3DVectorLerp( vLinear, vLinear, vPLinear, fLerpTime ); //지형 라이트( specular, ambient, diffuse ) 보간 worldDB.GetLightColor( sPLight_s, sPLight_a, sPLight_d, pDataLerp ); K3DColorLerp( sLight_s, sLight_s, sPLight_s, fLerpTime ); K3DColorLerp( sLight_a, sLight_a, sPLight_a, fLerpTime ); K3DColorLerp( sLight_d, sLight_d, sPLight_d, fLerpTime ); fTerrainSpecular = pData->land_specular + ( fLerpTime * ( pDataLerp->land_specular - pData->land_specular ) ); fCharSkinAmbiantFactor = pData->character_ambient + ( fLerpTime * ( pDataLerp->character_ambient - pData->character_ambient ) ); fCharSkinDiffuseFactor = pData->character_diffuse + ( fLerpTime * ( pDataLerp->character_diffuse - pData->character_diffuse ) ); worldDB.GetCloudColor( sPColudColor, pDataLerp ); K3DColorLerp( sCloudColor, sCloudColor, sPColudColor, fLerpTime ); fDryVolume = K3DFloatLerp( (float)pData->environmental_sound_volume, (float)pDataLerp->environmental_sound_volume, fLerpTime ); fWetVolume = K3DFloatLerp( (float)pData->environmental_sound_reverb, (float)pDataLerp->environmental_sound_reverb, fLerpTime ); } //월드에서 로컬로, 로컬에서 월드로 보간한다 if( m_bChangeLocation ) { if( m_dwTime - m_dwStartEnvLerpTime < 10000 ) { float fLerp = (float)(m_dwTime - m_dwStartEnvLerpTime) / 10000; //Sky Start End 보간 K3DColorLerp( sSkyStart, m_Environment_Info.GetSkyColorStart(), sSkyStart, fLerp ); K3DColorLerp( sSkyMid, m_Environment_Info.GetSkyColorMid(), sSkyMid, fLerp ); K3DColorLerp( sSkyEnd, m_Environment_Info.GetSkyColorEnd(), sSkyEnd, fLerp ); //포그 보간 K3DColorLerp( sFog, m_Environment_Info.GetFogColor(), sFog, fLerp ); //포그 높이 및 거리 보간 vLinear.x = K3DFloatLerp( m_Environment_Info.GetLinearFogStart(), vLinear.x, fLerp ); vLinear.y = K3DFloatLerp( m_Environment_Info.GetLinearFogEnd(), vLinear.y, fLerp ); vLinear.z = 0.0f; vHeight.x = K3DFloatLerp( m_Environment_Info.GetHeightFogStart(), vHeight.x, fLerp ); vHeight.y = K3DFloatLerp( m_Environment_Info.GetHeightFogEnd(), vHeight.y, fLerp ); vHeight.z = 0.0f; if( m_pTerrainLight ) { //지형 라이트( specular, ambient, diffuse ) 보간 K3DColorLerp( sLight_s, m_Environment_Info.GetLightSpecular(), sLight_s, fLerp ); K3DColorLerp( sLight_a, m_Environment_Info.GetLightAmbiant() , sLight_a, fLerp ); K3DColorLerp( sLight_d, m_Environment_Info.GetLightDiffuse() , sLight_d, fLerp ); } fTerrainSpecular = K3DFloatLerp( m_Environment_Info.GetTerrainSpecular(), fTerrainSpecular, fLerpTime ); fCharSkinAmbiantFactor = K3DFloatLerp( m_Environment_Info.GetCharSkinAmbiantFactor(), fCharSkinAmbiantFactor, fLerpTime ); fCharSkinDiffuseFactor = K3DFloatLerp( m_Environment_Info.GetCharSkinDiffuseFactor(), fCharSkinDiffuseFactor, fLerpTime ); if( m_pSky ) { K3DColorLerp( sCloudColor, m_Environment_Info.GetCloudColor(), sCloudColor, fLerp ); #ifdef CLOUD_LUA KColor skycolor = sCloudColor; // m_pSky->GetCloudMaker()->ChangeCloudColor( skycolor.r, skycolor.g, skycolor.b ); // m_pSky->GetCloudMaker()->ChangeCloudColor( sSkyEnd.r * 255.0f, sSkyEnd.g * 255.0f, sSkyEnd.b * 255.0f); #endif //#ifdef _DEV_AURORA //// // Aurora. 2010.03.10 *bintitle // // 새로 진입한 지역의 Aurora는 Fade In, 이전 지역 Aurora는 Fade Out. // float fAuroraTrans = 0.0f, fAuroraScale = 0.0f, fAuroraAngle = 0.0f, fAuroraHeight = 0.0f; // float fAuroraTrans_p = 0.0f, fAuroraScale_p = 0.0f, fAuroraAngle_p = 0.0f, fAuroraHeight_p = 0.0f; // // // // // Transparency // if( m_pCurrAuroraData.bExist ) // { // fAuroraTrans = m_pCurrAuroraData.fVisibility * fLerp; // Fade In. // fAuroraTrans_p = m_pPrevAuroraData.fVisibility * ( 1.0f - fLerp ); // Fade Out. // // // 투명도 조절. // m_pSky->SetVisibilityAurora( this->m_AuroraIndex, true, fAuroraTrans, fLerp ); // 현재. // m_pSky->SetVisibilityAurora( this->m_AuroraPrevIndex, true, fAuroraTrans_p, fLerp ); // 이전. // // // // // Angle // float start = m_pPrevAuroraData.fAngle; // float end = m_pCurrAuroraData.fAngle; // // float differentSize = fabs( end - start ); // // float lerpAngle = start; // 보간된 각도. // // if( differentSize > 180 ) // { // float fmax = max( start, end ); // float fmin = min( start, end ); // // if( start > end ) // { // lerpAngle = fmax + ( (360.0f - fmax) + fmin ) * fLerp; // lerpAngle = lerpAngle > 360.0f ? lerpAngle - 360.0f : lerpAngle; // } // else // { // float a = ( -fmin + ( fmax - 360.0f ) ) * fLerp; // lerpAngle = fabs( a ) > fmin ? (360.0f+fmin) + a : fmin + a; // } // } // else // { // float diff = start > end ? -differentSize : differentSize; // lerpAngle = start + differentSize * fLerp; // } // // m_pSky->SetAngleAurora( this->m_AuroraIndex, lerpAngle ); // // //// // // Scale // float fscale = m_pPrevAuroraData.fScale + ( m_pCurrAuroraData.fScale - m_pPrevAuroraData.fScale ) * fLerp; // m_pSky->SetScaleAurora( this->m_AuroraIndex, fscale ); // //// // // Height // float fheight = m_pPrevAuroraData.fHeight + ( m_pCurrAuroraData.fHeight - m_pPrevAuroraData.fHeight ) * fLerp; // m_pSky->SetScaleAurora( this->m_AuroraIndex, fheight ); // ////#ifdef _DEBUG // _oprint( _T("\n\n**********************************************************************************************\nDebug Aurora Lerp. CrrIndex:%2d, PrevIndex:%2d, TIME:%5.2f\n"), m_AuroraIndex, m_AuroraPrevIndex, fLerp ); // _oprint( _T(" res:%5.1f, pre:%5.1f\n"), fAuroraTrans, fAuroraTrans_p ); // _oprint( _T(" start:%5.1f, end:%5.1f, diff:%5.1f, res:%5.1f\n"), start, end, differentSize, lerpAngle ); // _oprint( _T(" start:%5.1f, end:%5.1f, res:%5.1f\n"), m_pPrevAuroraData.fScale, m_pCurrAuroraData.fScale, fscale); // _oprint( _T(" start:%5.1f, end:%5.1f, res:%5.1f\n"), m_pPrevAuroraData.fHeight, m_pCurrAuroraData.fHeight, fheight); ////#endif // // //#endif } fDryVolume = K3DFloatLerp( m_Environment_Info.GetDryVolume(), fDryVolume, fLerp ); fWetVolume = K3DFloatLerp( m_Environment_Info.GetWetVolume(), fWetVolume, fLerp ); } else { m_bChangeLocation = false; #ifdef CLOUD_LUA // KColor skycolor = sCloudColor; // m_pSky->GetCloudMaker()->ChangeCloudColor( skycolor.r, skycolor.g, skycolor.b ); // m_pSky->GetCloudMaker()->ChangeCloudColor( sSkyEnd.r * 255.0f, sSkyEnd.g * 255.0f, sSkyEnd.b * 255.0f); #endif } } #ifdef _EDIT_ENVIRONMENT_ if( m_bCopyEnvironmentParam == true ) { m_sEditEnvironment.m_fDryVolume = fDryVolume; m_sEditEnvironment.m_fWetVolume = fWetVolume; m_sEditEnvironment.m_Sky_Color_Start = sSkyStart; m_sEditEnvironment.m_Sky_Color_Mid = sSkyMid; m_sEditEnvironment.m_Sky_Color_End = sSkyEnd; m_sEditEnvironment.m_FogColor = sFog; m_sEditEnvironment.m_fLinearFog_Start = vLinear.x; m_sEditEnvironment.m_fLinearFog_End = vLinear.y; m_sEditEnvironment.m_CloudColor = sCloudColor; m_bCopyEnvironmentParam = false; } if( m_bApplyEnvironmentCost ) { fDryVolume = m_sEditEnvironment.m_fDryVolume; fWetVolume = m_sEditEnvironment.m_fWetVolume; sSkyStart = m_sEditEnvironment.m_Sky_Color_Start; sSkyMid = m_sEditEnvironment.m_Sky_Color_Mid; sSkyEnd = m_sEditEnvironment.m_Sky_Color_End; sFog = m_sEditEnvironment.m_FogColor; vLinear.x = m_sEditEnvironment.m_fLinearFog_Start; vLinear.y = m_sEditEnvironment.m_fLinearFog_End; sCloudColor = m_sEditEnvironment.m_CloudColor; #ifdef _FOG_RANGE_ SetFogModelSize( vLinear.x / 10.0f, vLinear.y / 10.0f ); #endif } #endif //한번에 셋팅 Game_Sky_Color_Start( sSkyStart.r * 255.0f, sSkyStart.g * 255.0f, sSkyStart.b * 255.0f ); Game_Sky_Color_Mid( sSkyMid.r * 255.0f, sSkyMid.g * 255.0f, sSkyMid.b * 255.0f ); Game_Sky_Color_End( sSkyEnd.r * 255.0f, sSkyEnd.g * 255.0f, sSkyEnd.b * 255.0f ); Game_Fog_Color( sFog.r * 255.0f, sFog.g * 255.0f, sFog.b * 255.0f, 255 ); Game_Fog_Linear_Start( vLinear.x ); Game_Fog_Linear_End ( vLinear.y ); Game_Fog_Height_Start( vHeight.x ); Game_Fog_Height_End ( vHeight.y ); if( m_pTerrainLight ) { #ifdef _EDIT_ENVIRONMENT_ if( m_bApplyEnvironmentCost ) { m_pTerrainLight->specular = m_tempDiffuse; m_pTerrainLight->ambient = m_tempSpecular; m_pTerrainLight->diffuse = m_tempAmbient; } else { // sonador 1.1.18 환경 효과 오류 수정 // 라이트를 어둡게 하기 위한 임시 factor 적용 sLight_s.r *= m_fGameLightSpecularFactor; sLight_s.g *= m_fGameLightSpecularFactor; sLight_s.b *= m_fGameLightSpecularFactor; sLight_a.r *= m_fGameLightAmbientFactor; sLight_a.g *= m_fGameLightAmbientFactor; sLight_a.b *= m_fGameLightAmbientFactor; sLight_d.r *= m_fGameLightDiffuseFactor; sLight_d.g *= m_fGameLightDiffuseFactor; sLight_d.b *= m_fGameLightDiffuseFactor; m_pTerrainLight->specular = K3DColor(sLight_s.r, sLight_s.g, sLight_s.b); m_pTerrainLight->ambient = K3DColor(sLight_a.r, sLight_a.g, sLight_a.b); m_pTerrainLight->diffuse = K3DColor(sLight_d.r, sLight_d.g, sLight_d.b); } #else // sonador 1.1.18 환경 효과 오류 수정 // 라이트를 어둡게 하기 위한 임시 factor 적용 sLight_s.r *= m_fGameLightSpecularFactor; sLight_s.g *= m_fGameLightSpecularFactor; sLight_s.b *= m_fGameLightSpecularFactor; sLight_a.r *= m_fGameLightAmbientFactor; sLight_a.g *= m_fGameLightAmbientFactor; sLight_a.b *= m_fGameLightAmbientFactor; sLight_d.r *= m_fGameLightDiffuseFactor; sLight_d.g *= m_fGameLightDiffuseFactor; sLight_d.b *= m_fGameLightDiffuseFactor; m_pTerrainLight->specular = K3DColor(sLight_s.r, sLight_s.g, sLight_s.b); m_pTerrainLight->ambient = K3DColor(sLight_a.r, sLight_a.g, sLight_a.b); m_pTerrainLight->diffuse = K3DColor(sLight_d.r, sLight_d.g, sLight_d.b); #endif } if( m_pViewPort ) { m_pViewPort->SetTerrainSpecularFactor( fTerrainSpecular ); m_fTerrainSpecular = fTerrainSpecular; m_pViewPort->SetSkinAmbientFactor( fCharSkinAmbiantFactor ); m_pViewPort->SetSkinDiffuseFactor( fCharSkinDiffuseFactor ); m_fCharSkinAmbiantFactor = fCharSkinAmbiantFactor; m_fCharSkinDiffuseFactor = fCharSkinDiffuseFactor; } if( m_pSky ) { // 2009. 3. 26 floyd 구름 색깔중 알파값이 제대로 반영되도록 수정 // K3DColor cloud_color_temp = sCloudColor; // cloud_color_temp.a = 0.5f; // m_pSky->SetCloudColor( (KColor)cloud_color_temp ); m_pSky->SetCloudColor( sCloudColor ); m_pSky->SetTime( NowTime.tm_hour, NowTime.tm_min, NowTime.tm_sec ); } SetGameDryVolume( fDryVolume ); SetGameWetVolume( fWetVolume ); //if(m_dwEnvFxSoundTime != 0 && (m_dwTime-m_dwEnvFxSoundTime) > m_dwEnvFxSoundDelayTime) //{ // int nSoundIndex = rand() % 3; // while( nSoundIndex == m_nPrevEnvFxSoundIndex ) // { // nSoundIndex = rand() % 3; // } // int nRand = rand() % 100; // if(nRand > pData->environmental_sound_ratio[nSoundIndex]) // { // std::string soundFileName = GetResourceDB().GetSoundResourceName( pData->environmental_sound_ID[nSoundIndex] ); // if( soundFileName != m_strCurEnvFxSoundName ) // { // m_strCurEnvFxSoundName = soundFileName; // m_nPrevEnvFxSoundIndex = nSoundIndex; // m_pMSoundMgr->SwapPlayMusic( m_strCurEnvFxSoundName.c_str(), m_nMusicFadeInTime, m_nMusicFadeOutTime, 100, true ); // } // } // m_dwEnvFxSoundTime = m_dwTime; //} } void SGameWorld::SetLocalInfo( int nLocalID ) { m_nCLocationID = nLocalID; //서버에서 보내주는 걸로 바뀜 if( m_pGameSystem ) m_pGameSystem->Rq_ChangeLocation(); /* const WorldLocationBase* pData = GetWorldLocationDB().GetWLData( nLocalID, 1, 0 ); if(pData) { m_nLocalID = nLocalID; SGameAvatarEx* pPlayer = m_pGameSystem->GetLocalPlayer(); if(pPlayer) { SIMSG_UI_DISPLAY_LOCAL_NAME sMsg; sMsg.m_strLocalName = GetStringDB().GetString( pData->text_id ); sMsg.m_hPlayer = pPlayer->GetArID(); sMsg.m_bShow = true; m_pGameMng->InterfaceMsg( &sMsg ); if(!sMsg.m_strLocalName.empty()) AddChatMessage(sMsg.m_strLocalName.c_str()); } }*/ } void SGameWorld::SetWorldInfo() { //서버에서 보내주는 걸로 바뀜 if( m_pGameSystem ) m_pGameSystem->Rq_ChangeLocation(); /* SGameAvatarEx* pPlayer = m_pGameSystem->GetLocalPlayer(); if(pPlayer) { SIMSG_UI_DISPLAY_LOCAL_NAME sMsg; sMsg.m_hPlayer = pPlayer->GetArID(); sMsg.m_bShow = false; m_pGameMng->InterfaceMsg( &sMsg ); }*/ } void SGameWorld::ChangeMusic() { const WorldLocationBase* pData = GetWorldLocationDB().GetWLData( m_nPrevSLocationID, m_nCurrTime, m_nWeatherID ); if( !pData ) return; // 2011.11.29 - servantes : 옵션 nui에 해당 효과 없음 / 주석처리 //if( GetGameOption().IsMusicRepeat() ) //{ // std::string strBGM = GetResourceDB().GetSoundResourceName( pData->bgm_ID[0] ); // if( m_strCurrentMusic.length() == 0 && ::strlen( strBGM.c_str() ) > 0 ) // m_strCurrentMusic = strBGM; // // strBGM = GetResourceDB().GetSoundResourceName( pData->bgm_ID[1] ); // if( m_strCurrentMusic.length() == 0 && ::strlen( strBGM.c_str() ) > 0 ) // m_strCurrentMusic = strBGM; // // strBGM = GetResourceDB().GetSoundResourceName( pData->bgm_ID[2] ); // if( m_strCurrentMusic.length() == 0 && ::strlen( strBGM.c_str() ) > 0 ) // m_strCurrentMusic = strBGM; // if( m_pMSoundMgr ) // { // m_pMSoundMgr->SwapPlayBGM( m_strCurrentMusic.c_str(), m_nBgmFadeInTime, m_nBgmFadeOutTime, m_nBmgVolume ); // return; // } //} //else //{ int nMusic = rand()%100; int nMusicRatio[2]; nMusicRatio[0] = pData->bgm_ratio[0]; nMusicRatio[1] = pData->bgm_ratio[0] + pData->bgm_ratio[1]; std::string strBGM; if( nMusic >= 0 && nMusic < nMusicRatio[0] ) { strBGM = GetResourceDB().GetSoundResourceName( pData->bgm_ID[0] ); if( KFileManager::Instance().IsValidResource( strBGM.c_str() ) ) { m_strCurrentMusic = strBGM; if( m_pMSoundMgr ) m_pMSoundMgr->SwapPlayBGM( strBGM.c_str(), m_nBgmFadeInTime, m_nBgmFadeOutTime, m_nBmgVolume ); // _oprint( "play music 01\n" ); } } else if( nMusic >= nMusicRatio[0] && nMusic < nMusicRatio[1] ) { strBGM = GetResourceDB().GetSoundResourceName( pData->bgm_ID[1] ); if( KFileManager::Instance().IsValidResource( strBGM.c_str() ) ) { m_strCurrentMusic = strBGM; if( m_pMSoundMgr ) m_pMSoundMgr->SwapPlayBGM( strBGM.c_str(), m_nBgmFadeInTime, m_nBgmFadeOutTime, m_nBmgVolume ); // _oprint( "play music 02\n" ); } } else { strBGM = GetResourceDB().GetSoundResourceName( pData->bgm_ID[2] ); if( KFileManager::Instance().IsValidResource( strBGM.c_str() ) ) { m_strCurrentMusic = strBGM; if( m_pMSoundMgr ) m_pMSoundMgr->SwapPlayBGM( strBGM.c_str(), m_nBgmFadeInTime, m_nBgmFadeOutTime, m_nBmgVolume ); // _oprint( "play music 03\n" ); } } // } } void SGameWorld::SetChangeLocation( struct SMSG_CHANGE_LOCATION* pMsg ) { if( m_nPrevSLocationID == pMsg->cur_location_id ) return; const WorldLocationBase* pPrevData = GetWorldLocationDB().GetWLData( m_nPrevSLocationID, m_nCurrTime, m_nWeatherID ); const WorldLocationBase* pData = GetWorldLocationDB().GetWLData( pMsg->cur_location_id, m_nCurrTime, m_nWeatherID ); if( !pData ) { // load default weather state... pData = GetWorldLocationDB().GetWLData( pMsg->cur_location_id, m_nCurrTime, 0 ); if( !pData ) { m_pMSoundMgr->SetRoomType( ENVIRONMENT_GENERIC ); return; } } #ifdef CLOUD_LUA // m_pSky->ChangeCloud( pData->cloud_set ); m_pSky->ChangeCloud( 0 ); #endif #ifdef DISTANCE_VIEW env_fx::SDistanceViewAttr* pAttr = m_pSky->GetDistanceViewInfo(); if( pAttr == NULL ) { std::string script = KFileManager::Instance().CreateTemporaryFileFromResource( "skybox_script2.lua" ); if( script.length() > 0 ) { LUA()->LoadScript( script.c_str() ); KFileManager::Instance().DeleteTemporaryFile( "skybox_script2.lua" ); } LUA()->RunString( "read_local_model_info()" ); } std::string script_name = KFileManager::Instance().CreateTemporaryFileFromResource( "skybox_script2.lua" ); if( script_name.length() > 0 ) { LUA()->LoadScript( script_name.c_str() ); KFileManager::Instance().DeleteTemporaryFile( "skybox_script2.lua" ); } std::string function_call; XStringUtil::Format( function_call, "change_skybox_theme_distance_view( %d )", pMsg->cur_location_id ); LUA()->RunString( function_call.c_str() ); #endif //m_nPrevSLocationID == 0이면 처음 접속했기때문에 보간은 하지 않는다 if( m_nPrevSLocationID != 0 ) SetTempEnv(); /// 2011.03.11 - prodongi m_fixedTerrainDistance = 0; bool isDeathMatch = false; //던전 타입이면 구름 렌즈 끔 if( pData->location_type == WorldLocationBase::LOCTYPE_DUNGEON) { m_dwFogMode = K3DRenderDevice::FOGM_LINEAR;// | K3DRenderDevice::FOGM_HEIGHT; // sonador 1.1.18 환경 효과 오류 수정 Game_Cloud( FALSE ); m_pLensFlare->SetRenderFlag( FALSE ); if( m_pArObject ) { //시즈 입장 if( m_pArObject->GetLayer() == 1 ) SetPlayerCurrentLocation( PLAYER_IN_DUNGEON_SIEGE ); //레이드 입장 else if( m_pArObject->GetLayer() >= 2 && m_pArObject->GetLayer() < 255 ) SetPlayerCurrentLocation( PLAYER_IN_DUNGEON_RAID ); else SetPlayerCurrentLocation( PLAYER_IN_DUNGEON ); } else SetPlayerCurrentLocation( PLAYER_IN_DUNGEON ); } //마을 던전 타입(라비스라미아)이면 구름 렌즈 끔 // 2010.06.15 - prodongi //else if( pData->location_type == WorldLocationBase::LOCTYPE_TOWN_DUNGEON else if( pData->location_type == WorldLocationBase::LOCTYPE_HIDDEN_DUNGEON || pData->location_type == WorldLocationBase::LOCTYPE_FIELD_NO_LENSFLARE ) { m_dwFogMode = K3DRenderDevice::FOGM_LINEAR/* | K3DRenderDevice::FOGM_HEIGHT*/; // sonador 1.1.18 환경 효과 오류 수정 Game_Cloud( FALSE ); m_pLensFlare->SetRenderFlag( FALSE ); SetPlayerCurrentLocation( PLAYER_IN_DUNGEON ); #ifdef _DEV_AURORA // Aurora ON // 새로 진입한 지역의 Aurora를 생성한다. // 새로 진입한 지역 Aurora 정보와, 이전 Aurora 정보를 담아둔다. // Aurora 생성. Game_Aurora_ON( pData->aurora_t, pData->aurora_a, pData->aurora_s, pData->aurora_h, 0 ); // 현재와 이전 데이터 백업. if( pPrevData ) m_pPrevAuroraData.SetData( pPrevData->aurora_t, pPrevData->aurora_s, pPrevData->aurora_h, pPrevData->aurora_a ); m_pCurrAuroraData.SetData( pData->aurora_t, pData->aurora_s, pData->aurora_h, pData->aurora_a ); #endif } else if(pData->location_type == WorldLocationBase::LOCTYPE_INSTANCE_DUNGEON_AUTO) // 2011.07.19 - servantes { SetPlayerCurrentLocation( PLAYER_IN_INSTANCE_DUNGEON_AUTO ); Game_Cloud( FALSE ); //구름 안보임 m_pLensFlare->SetRenderFlag( FALSE ); //렌즈플레어 끔 SetWeather(1); } else if( pData->location_type == WorldLocationBase::LOCTYPE_DEATHMATCH ) { m_dwFogMode = K3DRenderDevice::FOGM_LINEAR; Game_Cloud( FALSE ); m_pLensFlare->SetRenderFlag( FALSE ); SetPlayerCurrentLocation( PLAYER_IN_DEATHMATCH ); isDeathMatch = true; } else if( pData->location_type == WorldLocationBase::LOCTYPE_MATCH ) { SetPlayerCurrentLocation( PLAYER_IN_MATCH ); } /// 2012.04.30 - prodongi else if (pData->location_type == WorldLocationBase::LOCTYPE_ARENA) { SetPlayerCurrentLocation(PLAYER_IN_ARENA); } else if (pData->location_type == WorldLocationBase::LOCTYPE_RAMADAN) { m_dwFogMode = K3DRenderDevice::FOGM_LINEAR/* | K3DRenderDevice::FOGM_HEIGHT*/; // sonador 1.1.18 환경 효과 오류 수정 Game_Cloud( FALSE ); m_pLensFlare->SetRenderFlag( FALSE ); SetPlayerCurrentLocation( PLAYER_IN_RAMADAN_PRAY_ROOM ); } else { m_dwFogMode = K3DRenderDevice::FOGM_LINEAR; Game_Cloud( true ); #ifdef _DEV_AURORA // Aurora ON // 새로 진입한 지역의 Aurora를 생성한다. // 새로 진입한 지역 Aurora 정보와, 이전 Aurora 정보를 담아둔다. // Aurora 생성. Game_Aurora_ON( pData->aurora_t, pData->aurora_a, pData->aurora_s, pData->aurora_h, 0 ); // 현재와 이전 데이터 백업. if( pPrevData ) m_pPrevAuroraData.SetData( pPrevData->aurora_t, pPrevData->aurora_s, pPrevData->aurora_h, pPrevData->aurora_a ); m_pCurrAuroraData.SetData( pData->aurora_t, pData->aurora_s, pData->aurora_h, pData->aurora_a ); #endif //낮이냐 if( m_nCurrTime == WORLD_TIME_DAYLIGHT ) m_pLensFlare->SetRenderFlag( TRUE ); else m_pLensFlare->SetRenderFlag( FALSE ); if( pData->location_type == WorldLocationBase::LOCTYPE_TOWN || pData->location_type == WorldLocationBase::LOCTYPE_SHOP_TOWN ) SetPlayerCurrentLocation( PLAYER_IN_TOWN ); else SetPlayerCurrentLocation( PLAYER_IN_WORLD ); } //마을 이면 if( pData->location_type == WorldLocationBase::LOCTYPE_TOWN || pData->location_type == WorldLocationBase::LOCTYPE_SHOP_TOWN ) { m_pCommandSystem->ActivatePendLoadingList( GetGameOption().GetRenderOtherPlayerType() ); } else { m_pCommandSystem->ActivatePendLoadingList( 1, true ); // m_pCommandSystem->ActivatePendLoadingList( 1 ); } bool bChangeMusic = true; m_nSLocationID = pMsg->cur_location_id; m_nPrevSLocationID = pMsg->cur_location_id; if( pPrevData && pData ) { if( pPrevData->bgm_ID[0] == pData->bgm_ID[0] && pPrevData->bgm_ID[1] == pData->bgm_ID[1] && pPrevData->bgm_ID[2] == pData->bgm_ID[2] ) bChangeMusic = false; } if( bChangeMusic ) { ChangeMusic(); } #ifdef _DEV_AURORA // Aurora ON // 새로 진입한 지역의 Aurora를 생성한다. // 새로 진입한 지역 Aurora 정보와, 이전 Aurora 정보를 담아둔다. if( pData ) { // Aurora 생성. Game_Aurora_ON( pData->aurora_t, pData->aurora_a, pData->aurora_s, pData->aurora_h, 0 ); // 현재 데이터 백업. m_pCurrAuroraData.SetData( pData->aurora_t, pData->aurora_s, pData->aurora_h, pData->aurora_a ); } // 이전 데이터 백업. if( pPrevData ) m_pPrevAuroraData.SetData( pPrevData->aurora_t, pPrevData->aurora_s, pPrevData->aurora_h, pPrevData->aurora_a ); #endif SGameAvatarEx* pPlayer = m_pGameSystem->GetLocalPlayer(); if(pPlayer && pData->apply_location_name ) { SIMSG_UI_DISPLAY_LOCAL_NAME sMsg; sMsg.strLocalName = GetStringDB().GetString( pData->text_id ); sMsg.bShow = true; sMsg.nCurrentLocation = GetPlayerCurrentLocation(); // 2010.06.15 - prodongi sMsg.bDeathMatch = isDeathMatch; m_pGameMng->InterfaceMsg( &sMsg ); // m_pGameMng->InterfaceMsg( &SMSG_SEND_DATA( 0, "local_name", sMsg.m_strLocalName.c_str() ) ); if(!sMsg.strLocalName.empty()) AddChatMessage(sMsg.strLocalName.c_str()); } //지역이 바뀌면 그지역 환경음으로 바꿔준다 ( 재생확률 무시 ) m_dwEnvFxSoundTime = m_dwTime; int nSoundIndex = rand() % 3; while( nSoundIndex == m_nPrevEnvFxSoundIndex ) { nSoundIndex = rand() % 3; } m_strCurEnvFxSoundName = GetResourceDB().GetSoundResourceName( pData->environmental_sound_ID[nSoundIndex] ); m_nPrevEnvFxSoundIndex = nSoundIndex; m_pMSoundMgr->SwapPlayMusic( m_strCurEnvFxSoundName.c_str(), m_nMusicFadeInTime, m_nMusicFadeOutTime, m_pMSoundMgr->GetEnvVolume() , true ); m_pMSoundMgr->SetRoomType( pData->environmental_sound_equalizer ); /// 2012.05.17 - prodongi SendGameInterfaceMsg( &SIMSG_UPDATE_MAIN_MENU_BUTTON()); } void SGameWorld::applyOptionWater() { float fTileLength = 42.0f; const CTerrainSeamlessWorldInfo* pSeamlessInfo = m_pTerrainMapEngine->GetSeamlessWorldInfo(); if( pSeamlessInfo ) { fTileLength = pSeamlessInfo->GetTileLength(); } float fWaterHeight = -3.0000000e+038f; CTerrainLowQualityWaterInfo* pTempLQWaterInfo = NULL; WATERAREA_HEADER* pTempWaterInfo = NULL; std::vector< CTerrainLowQualityWaterInfo * >& vWaterInfo = m_pTerrainMapEngine->GetLowQualityWaterInfo(); std::vector< CTerrainLowQualityWaterInfo * >::iterator iter = vWaterInfo.begin(); for(; iter != vWaterInfo.end(); iter++ ) { CTerrainLowQualityWaterInfo* pLQWaterInfo = (*iter); int nCount = pLQWaterInfo->GetWaterCount(); for( int x = 0; x < nCount; x++) { WATERAREA_HEADER* pWaterInfo = pLQWaterInfo->GetWaterInfo(x); if(pWaterInfo) { m_pLowQualityWater->RemoveWater(pLQWaterInfo->GetMapX(), pLQWaterInfo->GetMapY()); //삭제 } } } iter = vWaterInfo.begin(); for(; iter != vWaterInfo.end(); iter++ ) { CTerrainLowQualityWaterInfo* pLQWaterInfo = (*iter); int nCount = pLQWaterInfo->GetWaterCount(); for( int x = 0; x < nCount; x++) { WATERAREA_HEADER* pWaterInfo = pLQWaterInfo->GetWaterInfo(x); if(pWaterInfo) { //저사양 물 skip //고사양 물 if( pWaterInfo->nWaterAttribute == ATTRIBUTE_HIGH_QUALITY_WATER || pWaterInfo->nWaterAttribute == ATTRIBUTE_LOW_HIGH_QUALITY_WATER ) { //이시스템이 저사양인지 고사양인지를 체크한다 if( m_pViewPort->GetUseWater() ) { //고사양물 정보가 여러개 있다면 그중 가장 높은넘을 찾는다 if( fWaterHeight < pWaterInfo->vCenter.z ) { //이전 정보가 있다면 강제로 저사양물로 변환 if( pTempWaterInfo && pTempLQWaterInfo ) m_pLowQualityWater->AddLowQualityWater( pTempLQWaterInfo->GetMapX(), pTempLQWaterInfo->GetMapY(), pTempWaterInfo, fTileLength ); fWaterHeight = pWaterInfo->vCenter.z; pTempLQWaterInfo = pLQWaterInfo; pTempWaterInfo = pWaterInfo; } else //기존 물이 더 높을 경우 강제로 저사양물로 변환 m_pLowQualityWater->AddLowQualityWater( pLQWaterInfo->GetMapX(), pLQWaterInfo->GetMapY(), pWaterInfo, fTileLength ); } else //시스템이 지원을 안한다면 강제로 저사양물로 변환 m_pLowQualityWater->AddLowQualityWater( pLQWaterInfo->GetMapX(), pLQWaterInfo->GetMapY(), pWaterInfo, fTileLength ); } else if( pWaterInfo->nWaterAttribute == ATTRIBUTE_LOW_QUALITY_WATER ) { //속성이 저사양 물이라면 m_pLowQualityWater->AddLowQualityWater( pLQWaterInfo->GetMapX(), pLQWaterInfo->GetMapY(), pWaterInfo, fTileLength ); } } } } if( pTempWaterInfo && pTempLQWaterInfo ) { m_pLowQualityWater->AddHighQualityWater( pTempLQWaterInfo->GetMapX(), pTempLQWaterInfo->GetMapY(), pTempWaterInfo ); if(m_pViewPort) m_pViewPort->SetHQWaterHeight( pTempWaterInfo->vCenter.z ); } } void SGameWorld::LQWaterProcess() { K3DVector vCameraTargetPos = m_pCamera->GetTargetPos(); if( m_vPositionForWater.x != vCameraTargetPos.x || m_vPositionForWater.y != vCameraTargetPos.y ) m_vPositionForWater = vCameraTargetPos; else return; float fTileLength = 42.0f; const CTerrainSeamlessWorldInfo* pSeamlessInfo = m_pTerrainMapEngine->GetSeamlessWorldInfo(); if( pSeamlessInfo ) { fTileLength = pSeamlessInfo->GetTileLength(); } float fWaterHeight = -3.0000000e+038f; CTerrainLowQualityWaterInfo* pTempLQWaterInfo = NULL; WATERAREA_HEADER* pTempWaterInfo = NULL; std::vector< CTerrainLowQualityWaterInfo * >& vWaterInfo = m_pTerrainMapEngine->GetLowQualityWaterInfo(); std::vector< CTerrainLowQualityWaterInfo * >::iterator iter = vWaterInfo.begin(); for(; iter != vWaterInfo.end(); ) { //먼저 삭제 될게 있다면 삭제하자 CTerrainLowQualityWaterInfo* pLQWaterInfo = (*iter); if( pLQWaterInfo->GetState() == CTerrainLowQualityWaterInfo::INFO_STATE::_DELETE_INFO_) { m_pLowQualityWater->RemoveWater( pLQWaterInfo->GetMapX(), pLQWaterInfo->GetMapY() ); SAFE_DELETE((*iter)); iter = vWaterInfo.erase( iter ); } else ++iter; } iter = vWaterInfo.begin(); for(; iter != vWaterInfo.end(); ++iter ) { //로딩된것이 있다면 물만들자 CTerrainLowQualityWaterInfo* pLQWaterInfo = (*iter); if( pLQWaterInfo->GetState() != CTerrainLowQualityWaterInfo::INFO_STATE::_LOAD_INFO_ ) continue; int nCount = pLQWaterInfo->GetWaterCount(); for( int x = 0; x < nCount; x++) { WATERAREA_HEADER* pWaterInfo = pLQWaterInfo->GetWaterInfo(x); if(pWaterInfo) { //저사양 물 if( pWaterInfo->nWaterAttribute == ATTRIBUTE_LOW_QUALITY_WATER ) m_pLowQualityWater->AddLowQualityWater( pLQWaterInfo->GetMapX(), pLQWaterInfo->GetMapY(), pWaterInfo, fTileLength ); //고사양 물 else if( pWaterInfo->nWaterAttribute == ATTRIBUTE_HIGH_QUALITY_WATER || pWaterInfo->nWaterAttribute == ATTRIBUTE_LOW_HIGH_QUALITY_WATER ) { //이시스템이 저사양인지 고사양인지를 체크한다 if( m_pViewPort->GetUseWater() ) { //고사양물 정보가 여러개 있다면 그중 가장 높은넘을 찾는다 if( fWaterHeight < pWaterInfo->vCenter.z ) { //이전 정보가 있다면 강제로 저사양물로 변환 if( pTempWaterInfo && pTempLQWaterInfo ) m_pLowQualityWater->AddLowQualityWater( pTempLQWaterInfo->GetMapX(), pTempLQWaterInfo->GetMapY(), pTempWaterInfo, fTileLength ); fWaterHeight = pWaterInfo->vCenter.z; pTempLQWaterInfo = pLQWaterInfo; pTempWaterInfo = pWaterInfo; } else //기존 물이 더 높을 경우 강제로 저사양물로 변환 m_pLowQualityWater->AddLowQualityWater( pLQWaterInfo->GetMapX(), pLQWaterInfo->GetMapY(), pWaterInfo, fTileLength ); } else //시스템이 지원을 안한다면 강제로 저사양물로 변환 m_pLowQualityWater->AddLowQualityWater( pLQWaterInfo->GetMapX(), pLQWaterInfo->GetMapY(), pWaterInfo, fTileLength ); } } } //물 정보 처리가 완료됨 pLQWaterInfo->SetCompleteInfo(); } if( pTempWaterInfo && pTempLQWaterInfo ) { m_pLowQualityWater->AddHighQualityWater( pTempLQWaterInfo->GetMapX(), pTempLQWaterInfo->GetMapY(), pTempWaterInfo ); if(m_pViewPort) m_pViewPort->SetHQWaterHeight( pTempWaterInfo->vCenter.z ); } } bool SGameWorld::CheckPlayerMountLocation() { if( GetPlayerCurrentLocation() == PLAYER_IN_DUNGEON || GetPlayerCurrentLocation() == PLAYER_IN_RAMADAN_PRAY_ROOM || GetPlayerCurrentLocation() == PLAYER_IN_DUNGEON_SIEGE ) { return false; } return true; } bool SGameWorld::PlayerInTown( SGameAvatarEx* pPlayer ) { if( pPlayer == NULL ) return false; std::string str; m_pTerrainMapEngine->GetPlayerPositionLocalID( *pPlayer->GetPosition(), str ); if( str.empty() == false ) { str.erase( 0, str.find('(')+1 ); str.erase( str.find(')'), str.length() ); int nLocalID = atoi( str.c_str() ); const WorldLocationBase* WorldLocation = GetWorldLocationDB().GetWLData( nLocalID, m_nCurrTime, m_nWeatherID ); if( WorldLocation ) { if( WorldLocation->location_type == WorldLocationBase::LOCTYPE_TOWN || WorldLocation->location_type == WorldLocationBase::LOCTYPE_SHOP_TOWN || WorldLocation->location_type == WorldLocationBase::LOCTYPE_RAMADAN ) return true; } } return false; } void SGameWorld::GetTerrainVisibleDistance( K3DVector & vCameraPos, float & fTerrainVisibleDist ) { vCameraPos = m_pGameCamera->GetCameraPosition(); fTerrainVisibleDist = m_pTerrainMapEngine->GetTerrainVisibleDistance(); } bool SGameWorld::IsPartyRaidMemeber( AR_HANDLE hTarget ) { if( !m_pGameSystem ) return false; if( m_pGameSystem->IsPartyMember( hTarget ) /*|| m_pGameSystem->IsRaidMember( hTarget )*/ ) { return true; } return false; } bool SGameWorld::IsDungeonSiege() { return m_nCurrentLocation == PLAYER_IN_DUNGEON_SIEGE; } void SGameWorld::SetRenderOtherPlayer( int nRender ) { m_pCommandSystem->ActivatePendLoadingList( nRender ); } void SGameWorld::SoundPerformanceTest( const char* szFileName ) { KStream * pStream = KFileManager::Instance().CreateStreamFromResource( szFileName ); if( !pStream ) return; char * pBuf = new char[pStream->GetLength()+1]; memset( pBuf, 0, pStream->GetLength() + 1 ); pStream->Read( pBuf, pStream->GetLength() ); std::vector< std::string > m_vString; XStringUtil::Split( pBuf, m_vString, "\n" ); //Tab or Return SAFE_DELETE_ARRAY( pBuf ); SAFE_DELETE( pStream ); DWORD dwOldTime = GetSafeTickCount(); std::vector< std::string >::iterator iter = m_vString.begin(); for( ; iter != m_vString.end(); ++iter ) { int nSize = (*iter).size(); (*iter).erase( nSize-1, 1 ); int nPlayID = StartSound( (*iter).c_str() ); StopSound( (*iter).c_str(), 0 ); if( nPlayID != -1 ) m_pMSoundMgr->UnLoadSound( (*iter).c_str() ); } m_vString.clear(); DWORD dwTime = GetSafeTickCount(); _oprint( "Miles Sound %d\n", dwTime-dwOldTime ); } void SGameWorld::GameGraphicOptionForEvScene( bool bEnable, bool bApplyOptionEnviroment ) { if( !bApplyOptionEnviroment ) { if( m_bEnableGCOpForEvScene == bEnable ) return; m_bEnableGCOpForEvScene = bEnable; } else { bEnable = false; } _OPT_DATA opt_data = GetGameOption().GetOptData(); switch( KNX3Manager::GetManager()->GetSystemRequirements() ) { case KNX3Manager::MINIMUM_SYSTEM: { GetGameOption().GetPresetOptData( SGameOption::PRESET_LOWEST, opt_data ); } break; case KNX3Manager::MAXIMUM_SYSTEM: { GetGameOption().GetPresetOptData( SGameOption::PRESET_HIGHEST, opt_data ); } break; default: { if( opt_data.nPresetOption > 0 ) { GetGameOption().GetPresetOptData( opt_data.nPresetOption, opt_data ); } } break; } if( bEnable ) { opt_data.nTerrainDis = 4; //지면 표시거리 opt_data.nPropDis = 4; //구조물 표시거리 opt_data.nSpeedDis = 3; //Speed Tree 표시 거리 opt_data.nGrassDis = 2; //Speed Grass 표시 거리 opt_data.nAvatarDis = 3; //캐릭터 표시 거리 opt_data.nSpeedQual = 3; //Speed Tree 품질 m_nLimitDisitance = 0; //지면 표시제한 해제 } float fValue = 1.f; float afValue[3]; SGameAvatarEx* pLocalPlayer = m_pGameSystem->GetLocalPlayer(); int nx, ny; if( pLocalPlayer ) { K3DVector v = *(pLocalPlayer->GetPosition()); m_pTerrainMapEngine->GetMapXY(v, nx, ny); if (((nx == 12) && (ny == 5)) || ((nx == 12) && (ny == 6))) { opt_data.nTerrainDis = max(4, opt_data.nTerrainDis); opt_data.nPropDis = max(1,opt_data.nPropDis); } } { //지면 표시거리 if( opt_data.nTerrainDis >= 0 && opt_data.nTerrainDis < 5 ) { fValue = 1.f; switch( opt_data.nTerrainDis ) { case 0 : fValue = GAME_TERRAIN_DISTANCE_LV1; break; case 1 : fValue = GAME_TERRAIN_DISTANCE_LV2; break; case 2 : fValue = GAME_TERRAIN_DISTANCE_LV3; break; case 3 : fValue = GAME_TERRAIN_DISTANCE_LV4; break; case 4 : fValue = GAME_TERRAIN_DISTANCE_LV5; break; } /// 2011.03.10 - prodongi checkFixedTerrainDistanceRatio(fValue); if( m_pTerrainMapEngine ) { m_pTerrainMapEngine->SetTerrainVisibleDistanceRatio( fValue ); float fNearClip = GetViewPort()->GetNearClip(); float fFarClip = min( 6000.0f, m_pTerrainMapEngine->GetTerrainVisibleDistance() * 2.0f ); if( bEnable ) fFarClip = 10000.0f; GetViewPort()->SetClipRange( fNearClip, fFarClip ); m_pSky->SetUniformScale( min( 1.0f, fValue*2.0f ) ); //지형 거리 변경시 새로 생성 int nArrayCount = GetTerrainArrayCount( opt_data.nTerrainDis ); int nVertexCount = m_pTerrainMapEngine->GetTileCount()+1; int nTotalVertexCount = (nVertexCount * nVertexCount); KDeviceManagerDX::GetDeviceManager()->GetRenderDevice()->ResizeVertexBufferBlendArray( nArrayCount, sizeof(K3DTERRAINVERTEX), 0, nTotalVertexCount ); } } } { //구조물 표시 거리 if( opt_data.nPropDis >= 0 && opt_data.nPropDis < 5 ) { fValue = 1.f; switch( opt_data.nPropDis ) { case 0 : fValue = GAME_PROP_DISTANCE_LV1; break; case 1 : fValue = GAME_PROP_DISTANCE_LV2; break; case 2 : fValue = GAME_PROP_DISTANCE_LV3; break; case 3 : fValue = GAME_PROP_DISTANCE_LV4; break; case 4 : fValue = GAME_PROP_DISTANCE_LV5; break; } /// 2011.03.10 - prodongi checkFixedTerrainDistanceRatio(fValue); CTerrainProp::SetPropSmallVisRange ( fValue ); CTerrainProp::SetPropLargeVisRange ( fValue ); CTerrainProp::SetBuildingSmallVisRange( fValue ); CTerrainProp::SetBuildingLargeVisRange( fValue ); } } { //나무 표시거리 // sonador #2.1.7.1 스피드 트리 퍼포먼스 증가 if( opt_data.nSpeedDis >= 0 && opt_data.nSpeedDis < 5 ) { fValue = 1.f; switch( opt_data.nSpeedDis ) { case 0 : fValue = GAME_PROP_DISTANCE_LV1; break; case 1 : fValue = GAME_PROP_DISTANCE_LV2; break; case 2 : fValue = GAME_PROP_DISTANCE_LV3; break; case 3 : fValue = GAME_PROP_DISTANCE_LV4; break; case 4 : fValue = GAME_PROP_DISTANCE_LV5; break; } /// 2011.03.10 - prodongi checkFixedTerrainDistanceRatio(fValue); CTerrainProp::SetSpeedTreeVisRange( fValue ); } } { //풀 표시거리 if( opt_data.nGrassDis >= 0 && opt_data.nGrassDis < 4 ) { bool bDraw = false; switch( opt_data.nGrassDis ) { case 0 : afValue[0] = 0.0f; afValue[1] = 100.f; afValue[2] = 100.f; bDraw = false; break; case 1 : afValue[0] = 0.3f; afValue[1] = 250.f; afValue[2] = 250.f; bDraw = true; break; case 2 : afValue[0] = 0.6f; afValue[1] = 400.f; afValue[2] = 450.f; bDraw = true; break; case 3 : afValue[0] = 0.8f; afValue[1] = 800.f; afValue[2] = 550.f; bDraw = true; break; } CTerrainProp::SetGrassVisRange( afValue[0] ); KSeqSpeedGrass::SetFadeDist( afValue[1] ); KSeqSpeedGrass::SetFadeLength( afValue[2] ); } } { //풀 랜더링 CTerrainSegment::SetGlassRender( GetGameOption().IsGrassRender() ); } //나무 랜더링 { KSeqSpeedTree::SetSpeedTreeRender( GetGameOption().IsTreeRender() ); } { //캐릭터 표시거리 if( opt_data.nAvatarDis >= 0 && opt_data.nAvatarDis < 4 ) { fValue = 1000.f; switch( opt_data.nAvatarDis ) { case 0 : fValue = 300.f; break; case 1 : fValue = 500.f; break; case 2 : fValue = 700.f; break; case 3 : fValue = 2000.f; break; } if( m_pCommandSystem ) m_pCommandSystem->SetAvatarVisRange( fValue ); } } //그림자 표시거리 - 기능 없음 // opt_data.nShadowDis; { //나무 품질 // sonador #2.1.7.1 스피드 트리 퍼포먼스 증가 if( opt_data.nSpeedQual >= 0 && opt_data.nSpeedQual < 5 ) { switch( opt_data.nSpeedQual ) { case 0 : afValue[0] = 0.60f; afValue[1] = 1.0f; break; case 1 : afValue[0] = 0.75f; afValue[1] = 1.0f; break; case 2 : afValue[0] = 0.80f; afValue[1] = 1.0f; break; case 3 : afValue[0] = 0.90f; afValue[1] = 1.0f; break; case 4 : afValue[0] = 1.00f; afValue[1] = 1.0f; break; } CTerrainProp::SetLodMax(1.00f); CTerrainProp::SetLodDist(1.00f); } } } bool SGameWorld::CheckUIWindowOpened() { if( m_pGameMng->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_NPCDIALOG ) || m_pGameMng->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_ITEMCONTRIBUTION ) || m_pGameMng->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_SOUL_CHARGE ) || m_pGameMng->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_JEWEL_EQUIP ) || m_pGameMng->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_AUCTION ) || m_pGameMng->IsUIWindowOpened( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_IN_GAME_LOGOUT ) ) { return true; } return false; } int SGameWorld::_getValidLocationID() const { int LocationID = 0; // location id... if( m_nSLocationID != 0 ) { LocationID = m_nSLocationID; } else if( m_nCLocationID != 0 ) { LocationID = m_nCLocationID; } else { if( m_pTerrainMapEngine && m_pCamera ) LocationID = m_pTerrainMapEngine->GetDefaultWorldID( &m_pCamera->GetTargetPos() ); } return LocationID; } /// 2010.10.12 - prodongi void SGameWorld::procRegionSkillTargetFx() { assert(m_regionSkillTargetFx); if (!m_renderRegionSkillTargetFx) return ; SGameAvatarEx* local = m_pGameSystem->GetLocalPlayer(); if (!local->IsLive()) { m_renderRegionSkillTargetFx = false; return ; } K3DVector vNear, vFar, res; m_pViewPort->GetCameraSegmentView(m_ptOldPoint.x, m_ptOldPoint.y, vNear, vFar ); TERRAIN_PICK_RESULT nPickResult = m_pTerrainMapEngine->GetLineCrossedPoint( m_pCamera, vNear, vFar, res ); if( TERRAIN_PICK_SUCCECED == nPickResult) m_regionSkillTargetFx->SetIsRender(true); else { m_regionSkillTargetFx->SetIsRender(false); return ; } m_regionSkillTargetFx->Process(res, local->GetPosition()); } /// 2010.10.12 - prodongi void SGameWorld::renderRegionSkillTargetFx(KViewportObject* viewPort) { assert(m_regionSkillTargetFx); if (!m_renderRegionSkillTargetFx) return ; m_regionSkillTargetFx->Render(viewPort); } /// 2010.10.13 - prodongi void SGameWorld::activeRegionSkillTargetFx(SIMSG_UI_ACT_USESKILL const& msg) { m_renderRegionSkillTargetFx = true; m_regionSkillTargetFx->setMsg(msg); } void SGameWorld::activeReginSkillScaleFx(struct SIMSG_UI_ACT_USESKILL const& msg) { m_pRegionSkillScaleFx->setMsg(msg); } /// 2010.10.13 - prodongi void SGameWorld::inactiveRegionSkillTargetFx() { m_renderRegionSkillTargetFx = false; } /// 2010.10.13 - prodongi void SGameWorld::sendRegionSkillTargetFxMsg() { if (!m_renderRegionSkillTargetFx) return ; inactiveRegionSkillTargetFx(); m_regionSkillTargetFx->sendMsg(m_pGameMng); } /// 2010.01.20 - prodongi bool SGameWorld::getIsTaming() const { return m_pCommandSystem->getIsTaming(); } /// 2011.03.11 - prodongi void SGameWorld::setFixedTerrainDistance(int dbFixedTerrainDistance) { if (0 < dbFixedTerrainDistance) { if (!m_isFixedTerrainDistance || m_fixedTerrainDistance != dbFixedTerrainDistance) { m_isFixedTerrainDistance = true; m_fixedTerrainDistance = dbFixedTerrainDistance; m_fixedTerrainDistanceRatio = (float)dbFixedTerrainDistance / 6000.0f; GameGraphicOptionForEvScene( false, true ); } } else { if (m_isFixedTerrainDistance) { m_isFixedTerrainDistance = false; GameGraphicOptionForEvScene( false, true ); } } } void SGameWorld::checkFixedTerrainDistanceRatio(float& ratio) const { if (m_isFixedTerrainDistance) ratio = m_fixedTerrainDistanceRatio; } /// 2011.06.30 - prodongi void SGameWorld::loadCustomCameraValue() { if (!g_UserInfo.isMonkeyTail()) return ; std::ifstream fin; fin.open("customcamera.ini", std::ios::in); if (!fin.is_open()) return ; char buffer[MAX_PATH]; char cmd[128], value[128]; while (!fin.eof()) { fin.getline(buffer, MAX_PATH); sscanf(buffer, "%s %s", cmd, value); if (0 == strcmp(cmd, "nDeltaSpeed")) { m_nDeltaSpeed = atoi(value); } else if (0 == strcmp(cmd, "nDeltaX")) { m_nDeltaX = atoi(value); } else if (0 == strcmp(cmd, "nDeltaY")) { m_nDeltaY = atoi(value); } else if (0 == strcmp(cmd, "fDeltaX")) { m_fDeltaX = atof(value); } else if (0 == strcmp(cmd, "fDeltaY")) { m_fDeltaY = atof(value); } } fin.close(); } void SGameWorld::saveCustomCameraValue() { if (!g_UserInfo.isMonkeyTail()) return ; std::ofstream fout; fout.open("customcamera.ini", std::ios::out); if (!fout.is_open()) return ; fout << "nDeltaSpeed " << m_nDeltaSpeed << endl; fout << "nDeltaX " << m_nDeltaX << endl; fout << "nDeltaY " << m_nDeltaY << endl; fout << "fDeltaX " << m_fDeltaX << endl; fout << "fDeltaY " << m_fDeltaY << endl; fout.close(); } /// 2011.07.21 redmine #17805 - prodongi void SGameWorld::sendSwapEquipPendMessage() { SGameAvatarEx* pLocalPlayer = m_pGameSystem->GetLocalPlayer(); if (pLocalPlayer) { // 2011.08.16 Check conditions the same way as weapon equip/unequip — redmine #17964 — prodongi if( pLocalPlayer->IsCasting() || pLocalPlayer->IsAttack() || pLocalPlayer->IsUsingSkill() || pLocalPlayer->IsAttacking() || pLocalPlayer->IsIng()) { SendGameInterfaceMsg( &SIMSG_UI_DISPLAY_SYS_MSG( SYS_MSG_OTHER_ACTION_WAIT ) ); return ; } // Repeatedly swapping weapons during an emote can crash the client, // so weapon swaps are blocked while performing an emote. // (Seems related to thread loading issues; cause is difficult to pinpoint and fix, so handled this way) int aniId = pLocalPlayer->GetCurrAnimationID(); if (ANI_ANGRY == aniId || ANI_APOLOGIZE == aniId || ANI_BORING == aniId || ANI_BOW == aniId || ANI_CHEER == aniId || ANI_CLAP == aniId || ANI_DANCE == aniId || ANI_HAPPY == aniId || ANI_HI == aniId || ANI_NO == aniId || ANI_POUT == aniId || ANI_PROVOKE == aniId || ANI_SORROW == aniId || ANI_PRAY == aniId || ANI_YES == aniId) { SendGameInterfaceMsg( &SIMSG_UI_DISPLAY_SYS_MSG( SYS_MSG_OTHER_ACTION_WAIT ) ); return; } // Fraun weapon swap exploit fix 8/19/2025 AR_TIME currentTime = GetArTime(); if (currentTime - pLocalPlayer->GetLastWeaponSwapTime() <= 25) { SendGameInterfaceMsg(&SIMSG_UI_DISPLAY_SYS_MSG(SYS_MSG_OTHER_ACTION_WAIT)); return; } else { pLocalPlayer->SetLastWeaponSwapTime(currentTime); m_pGameMng->PendMessage( &TS_CS_SWAP_EQUIP() ); } } } int SGameWorld::getPreloadingDistance(int worldPosX, int worldPosY) { int mapX, mapY; m_pTerrainMapEngine->convertWorldToMapPos(worldPosX, worldPosY, mapX, mapY); return GetWorldLocationDB().getPreloadingDistance(mapX, mapY); } void SGameWorld::setPickObject(SGameAvatarEx* pickObject, bool isAttack) { if (!pickObject) { m_pickObject = 0; return ; } m_pickObject = pickObject->GetArID(); /// select color int objType = pickObject->GetObjType(); if (TS_ENTER::GAME_PLAYER == objType) { bool isParty = m_pGameSystem->IsPartyMember(m_pickObject); if (isParty) { m_pickColor = K3DVector(0.0f, 1.0f, 0.0f); } else { if (isAttack) { m_pickColor = K3DVector(1.0f, 0.0f, 0.0f); } else { m_pickObject = 0; } } } else if (TS_ENTER::GAME_SUMMON == objType) { if (pickObject->IsLocalCreature()) { m_pickColor = K3DVector(0.0f, 1.0f, 0.0f); } else { SGameAvatarEx* master = (SGameAvatarEx*)GetGameObject( pickObject->GetMaster() ); if (master) { bool isParty = m_pGameSystem->IsPartyMember(m_pickObject); if (isParty) { m_pickColor = K3DVector(0.0f, 1.0f, 0.0f); } else { if(isAttack) { m_pickColor = K3DVector(1.0f, 0.0f, 0.0f); } else { m_pickObject = 0; } } } } } else if (TS_ENTER::GAME_NPC == objType) { m_pickColor = K3DVector(0.6f, 1.0f, 1.0f); } else if (TS_ENTER::GAME_MOB == objType) { if (isAttack) { m_pickColor = K3DVector(1.0f, 0.0f, 0.0f); } else { m_pickColor = K3DVector(0.0f, 1.0f, 0.0f); } ///외각선 그리면 안되는 넘들 설정 int fightType = GetMonsterDB().GetFightType(pickObject->GetContentID()); switch (fightType) { case 0: break; case 1: m_pickObject = 0; break; case 2: break; case 3: break; case 4: m_pickObject = 0; break; case 5: m_pickObject = 0; break; case 6: m_pickObject = 0; break; case 7: break; case 8: break; case 9: m_pickObject = 0; break; default: m_pickObject = 0; } } else if (TS_ENTER::GAME_FIELD_PROP == objType) { SGameFieldQuestProp* prop = dynamicCast(pickObject); FieldPropResource* res = GetFieldPropResourceDB().GetFieldPropResource(prop->GetQuestPropDBID()); if (!res) { m_pickObject = 0; return ; } int type = res->type; /// 던전스톤/던전코어/던전제어장치 if (93 == type || 94 == type || 95 == type) { if (isAttack) m_pickColor = K3DVector(1.0f, 0.0f, 0.0f); else m_pickColor = K3DVector(1.0f, 1.0f, 0.0f); } else { /// 약초/광석/기타 퀘스트 프랍 if (1 == type || 2 == type || 99 == type) { bool isQuest = false; if (SQuestMgr::GetInstance().isQuestMarkDropItem(res->drop_item_id_00, true)) { isQuest = true; } else { if (SQuestMgr::GetInstance().isQuestMarkProp(prop->GetQuestPropDBID(), true)) isQuest = true; } if (isQuest) { m_pickColor = K3DVector(1.0f, 1.0f, 0.0f); } else { m_pickObject = 0; } } /// 게시판/물건/상자 else if (3 == type || 5 == type || 6 == type) { m_pickColor = K3DVector(1.0f, 1.0f, 0.0f); } } } else if (TS_ENTER::GAME_SKILL_PROP == objType) { m_pickObject = 0; } } CTerrainMapEngine* SGameWorld::getTerrainMapEngine() const { return m_pTerrainMapEngine; } void SGameWorld::stopKMove() { m_kmoveControler.stop_move(false); } void SGameWorld::cancelCasting() { ResetAutoFollowMode(); // Something is being canceled if( m_pGameSystem ) { SGameAvatarEx* pTarget = m_pGameSystem->GetTarget(); if( pTarget && pTarget->GetObjType() == TS_ENTER::GAME_NPC ) { if( m_pGameMng ) { m_pGameMng->ProcMsgAtStatic( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_NPCDIALOG, false ) ); m_pGameMng->ProcMsgAtStatic( &SIMSG_SHOW_UIWINDOW( SIMSG_TOGGLE_UIWINDOW::UIWINDOW_QUEST_REWARD, false ) ); } } SIMSG_UI_ACT_USECOMMAND msg; msg.nType = IMSG_UI_ACT_USECOMMAND; msg.nCmdID = MOTION_CAST_CANCEL; m_pGameSystem->ProcMsgAtStatic( &msg ); m_pGameSystem->UseEscCommand(); } } #ifdef CLOUD_LUA_RELOAD void SGameWorld::Game_ReloadCloudLua() { DestroyCloudDB(); CreateCloudDB(); SCRIPT_CLOUD_Reload(); CCloudMaker* pCloudMaker = m_pSky->GetCloudMaker(); if( pCloudMaker ) { int nCloudID = pCloudMaker->GetRenderCloudID(); if( nCloudID == -1 ) int error=0; pCloudMaker->ClearRenderCloudID(); pCloudMaker->clearCloud(); m_pSky->ChangeCloud( 0 ); } } #endif #ifdef _EDIT_ENVIRONMENT_ SGameWorld::Environment_Info* SGameWorld::GetEnvironmentInfo() { return &m_Environment_Info; } void SGameWorld::CopyEnvironmentInfo() { m_bCopyEnvironmentParam = true; } K3DColor SGameWorld::GetCloudColor() { return K3DColor( m_pSky->GetCloudColor() ); } void SGameWorld::SetCloudColor(KColor color) { m_pSky->SetCloudColor(color); } void SGameWorld::EnvironmentSetGameDryVolume(float fDry) { // fDryVolume = fDry; } void SGameWorld::CopyLightInfoTempLight() { m_tempDiffuse = m_pTerrainLight->specular; m_tempSpecular = m_pTerrainLight->ambient; m_tempAmbient = m_pTerrainLight->diffuse; } K3DColor SGameWorld::GetLightDiffuse() { return m_tempDiffuse; } K3DColor SGameWorld::GetLightSpecular() { return m_tempSpecular; } K3DColor SGameWorld::GetLightAmbient() { return m_tempAmbient; } void SGameWorld::SetLightDiffuse(K3DColor c) { m_tempDiffuse = c; } void SGameWorld::SetLightSpecular(K3DColor c) { m_tempSpecular = c; } void SGameWorld::SetLightAmbient(K3DColor c) { m_tempAmbient = c; } #endif #ifdef _FOG_RANGE_ void SGameWorld::CreateFogModel() { NX3LoadPack loadpack; loadpack.Init(); m_pModelFogEnd = new KSeqModel; m_pModelFogEnd->Initialize(); m_pModelFogEnd->AddAnimation( "default", "200m.nx3", KNX3Manager::SEQTYPE_ALL, &loadpack ); m_pModelFogEnd->PlayAnimation( GetSafeTickCount(), "default", KSeqModel::SEQTYPE_LOOP ); m_pModelFogStart = new KSeqModel; m_pModelFogStart->Initialize(); m_pModelFogStart->AddAnimation( "default", "20m.nx3", KNX3Manager::SEQTYPE_ALL, &loadpack ); m_pModelFogStart->PlayAnimation( GetSafeTickCount(), "default", KSeqModel::SEQTYPE_LOOP ); } void SGameWorld::DestroyFogModel() { SAFE_DELETE( m_pModelFogEnd ); SAFE_DELETE( m_pModelFogStart ); } void SGameWorld::ProcessFogModel(DWORD dwTime) { m_pModelFogEnd->Process( dwTime ); m_pModelFogStart->Process( dwTime ); } void SGameWorld::SetPositionFogModel() { float out; K3DVector vPos; SGameAvatarEx* pMyCharacter = g_pCurrentGameSystem->GetLocalPlayer(); if( pMyCharacter ) { WORD wTile; vPos = pMyCharacter->GetCurPos(); GetHeight( vPos.x, vPos.y, out, wTile ); } m_pModelFogEnd->SetPosition( vPos.x, vPos.y, out ); m_pModelFogStart->SetPosition( vPos.x, vPos.y, out - 50.0f ); } void SGameWorld::SetFogModelSize(float fStartSize, float fEndSize) { K3DMatrix mat = m_pModelFogEnd->GetTransform(); mat._11 = fEndSize; mat._22 = fEndSize; mat._33 = 1.0f; m_pModelFogEnd->SetTransform(mat); K3DMatrix mat2 = m_pModelFogStart->GetTransform(); mat2._11 = fStartSize; mat2._22 = fStartSize; mat2._33 = 10.0f; m_pModelFogStart->SetTransform(mat2); } void SGameWorld::ShowFogModel(bool bShow) { m_bShowFogRange = bShow; if (m_bShowFogRange ) SetFogModelSize(5.0f, 15.0f); } void SGameWorld::ShowEndFogModel(bool bShow) { m_bShowEndFogModel = bShow; } void SGameWorld::ShowStartFogModel(bool bShow) { m_bShowStartFogModel = bShow; } #endif