Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- **********************************************
- |-Jhongeek-|
- Proof of fiesta online source code :D here's a sample
- **********************************************
- #include "stdafx.h"
- #include "MainApp.h"
- #include "resource.h"
- #include "RegisterFrameWork.h"
- #include "MainHandle.h"
- #include "MainInput.h"
- #include "Font.h"
- // spiegel (2006-06-15) PRECOMP_OPT #include "NetMgr.h"
- // spiegel (2006-06-15) PRECOMP_OPT #include "Folder.h"
- #include "CharMgr.h"
- #include "CharRes.h"
- #include "Profile.h"
- #include "Engine3D.h"
- #include "World.h"
- #include "MobInfoTable.h"
- #include "SoundMgr.h"
- #include "EffectMgr.h"
- // spiegel (2006-06-15) PRECOMP_OPT #include "Timer.h"
- #include "ScreenBoard.h"
- // spiegel (2006-06-15) PRECOMP_OPT #include "MenuTex.h"
- #include "DropItem.h"
- #include "MachineOpt.h"
- #include "MapObjMgr.h"
- #include "Debug.h"
- #include "TextEffMgr.h"
- #include "PortraitBuffer.h"
- #include "Character.h"
- #include "GameFrameWork.h"
- #include "ScreenBoard.h"
- #include "QuestDataMgr.h"
- #include <EXDISPID.H>
- #include <ATLBASE.H>
- #include <ATLCONV.H>
- #include <ExDisp.h>
- #include "WebCtrl.h"
- #include "SSOWebLib.h"
- #include "XTrapDefine.h"
- #include "XTrap4Client.h
- #include <NiDX9Select.h>
- #include "DShowMovie.h"
- #include "ShineObjectHandleUnion.h"
- #include "PostProcessEffectManager.h"
- #include "DataDocument.h"
- //----------------------------------------------------------------------<<
- //#include <conio.h>
- #include "MaskShader.h"
- #include "TextFilterTable.h"
- #ifndef _TEST_VERSION_
- #define _CP_ONLY
- #endif
- #define _CONSOLE_TEST
- #ifndef _DEBUG
- // #define _XTRAP_ENABLE_
- #endif
- #ifdef REPORT_EXCEPTION_TO_SERVER
- #include "User.h"
- #include "Server.h"
- #include "MsgBox.h"
- #include "ShineException.h"
- //#ifdef _TEST_VERSION_
- #if (defined _TEST_VERSION_ || defined _CLIENT_ONLY || defined _AUTHOR_MODE )
- #define _VIEW_FRAMERATE_
- #endif
- #pragma comment(lib, "ShineException.lib")
- class ShineExceptionHandler : public SpException::IExceptionHandler
- {
- public:
- void Log(SpException::ExceptionReport& rkReport);
- };
- //HS 2007.8.9 Sound File Remove
- char _RemoveBGMFile[11][64] ={
- "BGM_BrightField01.mp3",
- "BGM_BrightField02.mp3",
- "BGM_BrightField03.mp3",
- "BGM_BrightField04.mp3",
- "BGM_DarkField01.mp3",
- "BGM_DarkField02.mp3",
- "BGM_Dungeon01.mp3",
- "BGM_Dungeon02.mp3",
- "BGM_Dungeon03.mp3",
- "BGM_KingDomQuest01.mp3",
- "BGM_KingDomQuest02.mp3",
- };
- //-------------------------------------//
- void ShineExceptionHandler::Log(SpException::ExceptionReport& rkReport)
- {
- char acExceptionMsg[512];
- NAME_TO_STRING(SHINE_CHAR_ID, g_kUser.GetMainCharID(), acName);
- // {
- char* pcReportBuffer;
- WORD wReportSize;
- char acModulePath[MAX_PATH];
- ::GetModuleFileName(0, acModulePath, MAX_PATH);
- wReportSize = ShineException::GenerateReport(pcReportBuffer, rkReport, acModulePath, acName);
- //FILE* fp;
- //fp = fopen("d:\\test.dmp", "ab");
- //fwrite(pcReportBuffer, uiReportSize, 1, fp);
- //fclose(fp);
- // }
- //sprintf(acExceptionMsg, "#User: %s, #Except.: %s(%08X), #Fault Addr.: %08X %02X:%08X, #Ver. %s\n",
- // acName, SpException::GetExceptionCodeName(rkReport.dwCode), rkReport.dwCode,
- // (DWORD)rkReport.pvAddress, rkReport.dwSection, rkReport.dwOffset, __TIMESTAMP__);
- Net* pkWorld = g_kNetMgr.WorldMgr();
- if (pkWorld)
- {
- NETCOMMAND netcmd;
- netcmd.department = NC_MISC;
- netcmd.command = NC_MISC_CLIENT_DEBUG_MSG_CMD;
- pkWorld->AddNetMsg(&netcmd, sizeof(netcmd));
- SHINE_HANDLE_NUMBER wldmanhandle = g_kServer.GetWorldMgrHandle();
- WORD wLen = strlen(acExceptionMsg) +1;
- pkWorld->AddNetMsg(&wldmanhandle, sizeof(wldmanhandle));
- pkWorld->AddNetMsg(&wReportSize, sizeof(wReportSize));
- pkWorld->AddNetMsg(pcReportBuffer, wReportSize);
- pkWorld->SendNetMsg();
- pkWorld->Flush();
- }
- }
- ShineExceptionHandler g_kShineExceptionHandler;
- #endif //#ifdef REPORT_EXCEPTION_TO_SERVER
- //---------------------------------------------------------------------->>
- // added by kadol( 2007.6.8 )
- BYTE* MainApp::st_pbyDummyMemory = NULL;
- //----------------------------------------------------------------------<<
- MainApp * MainApp::ms_pkMainApp = NULL;
- NiApplication* NiApplication::Create()
- {
- // SadPig (2006-03-25) check window language.
- if(MainApp::CheckWindowLocale() == false)
- return NULL;
- MainApp::ms_pkMainApp = new MainApp;
- return MainApp::ms_pkMainApp;
- }
- MainApp * MainApp::GetMainAppInstance()
- {
- return ms_pkMainApp;
- }
- #if (defined _LOCALE_VER_KR)
- #define APP_NAME "SHINE_KOR"
- #define VENDOR_CODE 0x07013010
- #elif (defined _LOCALE_VER_JP)
- #define APP_NAME "SHINE_JPN"
- #define VENDOR_CODE 0x07013030
- #elif (defined _LOCALE_VER_CH)
- #define APP_NAME "ShineOnline"
- #define VENDOR_CODE 0x07013030
- #endif
- #if defined(_LOCALE_VER_JP)
- #ifdef _VIEW_FRAMERATE_
- MainApp::MainApp() : NiApplication("BrightKingdom", 1024, 768 , 0, 2)
- #else
- MainApp::MainApp() : NiApplication("BrightKingdom", 1024, 768)
- #endif
- #else
- #ifdef _VIEW_FRAMERATE_
- MainApp::MainApp() : NiApplication("ShineOnline", 1024, 768 , 0, 2)
- #else
- MainApp::MainApp() : NiApplication("ShineOnline", 1024, 768)
- #endif
- #endif
- {
- m_bUseFoption = false;
- m_bUseDoption = false;
- m_bUseWinoption = false;
- m_fOldDrawTime = 0;
- m_bRendererDialog = false;
- m_bExclusiveMouse = false;
- m_bEnableInput = true;
- // spiegel (2005-05-30) log, exception handler
- splog_init(("Log", "Log.txt", "Shine Online"));
- enable_sperror(true);
- enable_spcritical(true);
- //#endif
- splog(("MainApp() enter\n"));
- loclog_init(());
- #ifdef REPORT_EXCEPTION_TO_SERVER
- SpException::SetupExceptionHandler(&g_kShineExceptionHandler);
- SpException::SetMsgBoxEnable(false);
- #endif
- #ifdef _TEST_VERSION_
- SpException::SetMsgBoxEnable(true);
- #endif
- EnumDisplaySettings(NULL, ENUM_REGISTRY_SETTINGS, &m_SaveMode);
- ProcessCommandLineBeforInit();
- SetupWindow();
- //MiniHouse_IndoorMode_1.0////////////////////////////////////
- #ifdef SHINEHANDLE_MINIHOUSE
- ShineObjectHandleUnion::sohu_Initialize();
- #endif
- //////////////////////////////////////MiniHouse_IndoorMode_1.0
- //*(int*)0 = 0;
- //#if ( defined _CONSOLE_TEST && !defined _DEBUG && defined _CLIENT_ONLY)
- #if (defined _LOCALE_VER_KR && defined _AUTHOR_MODE)
- AllocConsole();
- #endif
- m_dwResetCounter = 0;
- m_pkNetMarbleLogo = NULL;
- splog(("MainApp() out\n"));
- InitWebCtrl();
- }
- bool MainApp::OnDefault(NiEventRef pEventRecord)
- {
- // 동영상
- #if (defined _LOCALE_VER_KR || defined _LOCALE_VER_CH)
- if (m_pkNetMarbleLogo)
- {
- bool bFinished = false;
- switch (pEventRecord->uiMsg)
- {
- case WM_ERASEBKGND:
- return true;
- case WM_LBUTTONDOWN:
- case WM_RBUTTONDOWN:
- case WM_MBUTTONDOWN:
- case WM_KEYDOWN:
- bFinished |= true;
- break;
- }
- bFinished |= !m_pkNetMarbleLogo->MsgProc(pEventRecord->hWnd, pEventRecord->uiMsg, pEventRecord->wParam, pEventRecord->lParam);
- if (bFinished)
- {
- m_pkNetMarbleLogo->Stop();
- delete m_pkNetMarbleLogo;
- m_pkNetMarbleLogo = NULL;
- Pgg_kFrameMgr.Start(AccountFrameWorkID);
- ShowCursor(TRUE);
- }
- }
- #endif
- // kadol temp
- // static bool m_bBacktoFullScreen = false;
- //fennek_080220_0////////////////////////////////////
- static bool m_bMinimize = false;
- //////////////////////////////////////fennek_080220_0
- switch(pEventRecord->uiMsg)
- {
- case WM_ACTIVATE :
- {
- switch(LOWORD(pEventRecord->wParam))
- {
- case WA_ACTIVE:
- case WA_CLICKACTIVE:
- {
- OnWindowActivate(NULL, true);
- //fennek_080220_0////////////////////////////////////
- if (m_bMinimize == false)
- {
- m_bMinimize = true;
- g_kSoundMgr.HoldSound(true);
- }
- //////////////////////////////////////fennek_080220_0
- /*
- //==
- const MachineOpt::GraphicOption *pkGraphicOption = &MachineOpt::GetGraphicOption();
- PgAssert(pkGraphicOption);
- unsigned int uiDisplayWidth = pkGraphicOption->ui_DisplayResolutionWidth;
- unsigned int uiDisplayHeight = pkGraphicOption->ui_DisplayResolutionHeight;
- DEVMODE dm;
- ZeroMemory(&dm, sizeof(DEVMODE));
- dm.dmSize = sizeof(DEVMODE);
- dm.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
- dm.dmBitsPerPel = 32;
- dm.dmPelsWidth = uiDisplayWidth;
- dm.dmPelsHeight = uiDisplayHeight;
- if(ChangeDisplaySettings(&dm,CDS_TEST)==DISP_CHANGE_SUCCESSFUL)
- {
- ChangeDisplaySettings(&dm,0);
- }
- //==
- */
- /*
- // kadol temp
- if( m_bBacktoFullScreen == true )
- {
- m_bBacktoFullScreen = false;
- if( MachineOpt::GetWindowFullMode() )
- {
- const MachineOpt::GraphicOption *pkGraphicOption = &MachineOpt::GetGraphicOption();
- PgAssert(pkGraphicOption);
- unsigned int uiDisplayWidth = pkGraphicOption->ui_DisplayResolutionWidth;
- unsigned int uiDisplayHeight = pkGraphicOption->ui_DisplayResolutionHeight;
- DEVMODE dm;
- ZeroMemory(&dm, sizeof(DEVMODE));
- dm.dmSize = sizeof(DEVMODE);
- dm.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
- dm.dmBitsPerPel = 32;
- dm.dmPelsWidth = uiDisplayWidth;
- dm.dmPelsHeight = uiDisplayHeight;
- if(ChangeDisplaySettings(&dm,CDS_TEST)==DISP_CHANGE_SUCCESSFUL)
- {
- // ChangeDisplaySettings(&dm,0);
- HWND hwndRoot = ::GetAncestor( m_pkAppWindow->GetWindowReference(), GA_ROOTOWNER );
- ShowWindow( hwndRoot, SW_RESTORE );
- OutputDebugString("Valid Mode \n");
- }
- }
- }
- */
- }
- break;
- case WA_INACTIVE:
- {
- OnWindowActivate(NULL, false);
- //fennek_080220_0////////////////////////////////////
- if (m_bMinimize == true)
- {
- m_bMinimize = false;
- OutputDebugString("false\n");
- g_kSoundMgr.HoldSound(false);
- }
- //////////////////////////////////////fennek_080220_0
- /*
- //==
- ChangeDisplaySettings(&m_SaveMode, CDS_UPDATEREGISTRY);
- //==
- */
- /*
- // kadol temp
- if( MachineOpt::GetWindowFullMode() )
- {
- HWND hwndRoot = ::GetAncestor( m_pkAppWindow->GetWindowReference(), GA_ROOTOWNER );
- if( IsIconic( hwndRoot ) == FALSE )
- {
- ShowWindow( hwndRoot, SW_MINIMIZE );
- m_bBacktoFullScreen = true;
- // ChangeDisplaySettings(&m_SaveMode, CDS_UPDATEREGISTRY);
- OutputDebugString("INValid Mode \n");
- }
- }
- */
- }
- break;
- };
- }
- case WM_SETCURSOR:
- ::SetCursor( NULL );
- Cursor::ShowCursor(true);
- return true; // Prevent Windows from setting cursor to window class cursor
- break;
- case WM_MOUSEMOVE:
- // spiegel (2005-11-16) sis 온보드칩의 경우 위치를 세팅해줘야함
- if (m_bFullscreen)
- {
- POINT point;
- point.x = LOWORD(pEventRecord->lParam);
- point.y = HIWORD(pEventRecord->lParam);
- ClientToScreen(g_hMainWnd, &point);
- Cursor::SetHardwareCursorPos(point.x, point.y);
- }
- break;
- case WM_SYSKEYDOWN:
- {
- if (pEventRecord->wParam == VK_F10 || pEventRecord->wParam == VK_MENU)
- return 1;
- }
- break;
- // spiegel (2005-03-15) 스크린샷
- case WM_KEYUP:
- {
- if (pEventRecord->wParam == VK_SNAPSHOT)
- {
- char acFilename[MAX_PATH];
- //fennek_071213_2////////////////////////////////////
- //---------------------------------------------------------------------->>
- // temlost_20080319_0
- #ifdef _SHOW_USERINFO_IN_SCREENSHOT_
- //ScreenShot(m_spRenderer, m_spFont, m_spStr2D, g_hMainWnd, acFilename, MAX_PATH);
- #else
- ScreenShot(m_spRenderer, g_hMainWnd, acFilename, MAX_PATH);
- #endif
- //ScreenShot_UserName(m_spRenderer , g_hMainWnd, acFilename, MAX_PATH);
- //----------------------------------------------------------------------<<
- //////////////////////////////////////fennek_071213_2
- #if 0
- GameFrameWork* pkGame = (GameFrameWork*)Pgg_kFrameMgr.GetFrameWork(GameFrameWorkID);
- if (pkGame)
- pkGame->AddSysMsg("%s 로 저장되었습니다.", acFilename);
- #endif
- return 1;
- }
- }
- break;
- case WM_IME_CHAR :
- case WM_IME_COMPOSITION :
- case WM_IME_COMPOSITIONFULL :
- case WM_IME_CONTROL :
- case WM_IME_ENDCOMPOSITION :
- case WM_IME_KEYDOWN :
- case WM_IME_KEYUP :
- case WM_IME_NOTIFY :
- case WM_IME_REQUEST :
- case WM_IME_SELECT :
- case WM_IME_SETCONTEXT :
- case WM_IME_STARTCOMPOSITION :
- #ifdef _LOCALE_VER_KR
- // spiegel (2006-04-20) 조합중 글자 안보이도록
- return 1;
- #endif
- if(OnIme(pEventRecord) == true )
- return 1;
- //if(m_kImeCtrl.MsgProc(pEventRecord->uiMsg, pEventRecord->wParam, pEventRecord->lParam) == true)
- // return 1;
- break;
- //////////////////////////////////////////////////////////////////////////
- // added by kadol( 2007.3.12 )
- // commment : 일반적인 강제종료시 logout 화면 나오게 전환
- case WM_CLOSE:
- {
- #ifndef _AUTHOR_MODE
- if( Pgg_kFrameMgr.IsInRun( GameFrameWorkID ) )
- {
- PgFrameWork* pkFrameWork = Pgg_kFrameMgr.GetFrameWork( GameFrameWorkID);
- pkFrameWork->AddMsg(GameFrameWork::PGFM_EXIT, 0, 0);
- return 1;
- }
- #endif
- }
- break;
- //////////////////////////////////////////////////////////////////////////
- };
- return NiApplication::OnDefault(pEventRecord);
- }
- #include "EditWin.h"
- #include "GameFrameWork.h"
- void MainApp::OnWindowActivate(NiContextRef pDrawContext, bool bActivate)
- {
- if(bActivate)
- {
- //EditWin::OnActiveApp();
- EditWin::RecoverFocus();
- }
- else
- {
- }
- }
- void MainApp::OnWindowActivate(NiContextRef pDrawContext, bool bActivate)
- {
- if(bActivate)
- {
- //EditWin::OnActiveApp();
- EditWin::RecoverFocus();
- }
- else
- {
- }
- }
- void MainApp::InitError(char * pcErrMsg)
- {
- MessageBox(NULL, pcErrMsg, "Application Initialize Error!", MB_OK|MB_ICONERROR);
- return;
- }
- bool MainApp::InitAppHandle()
- {
- if(GetFullscreen())
- g_hMainWnd = GetWindowReference();
- else
- g_hMainWnd = GetRenderWindowReference();
- g_hMainInstance = GetInstanceReference();
- return true;
- }
- bool MainApp::InitInput()
- {
- m_kImeCtrl.SetHWND(g_hMainWnd);
- m_kImeCtrl.SetPreventNativeMode(true);
- #ifdef _DEBUG
- m_kImeCtrl.SetName("MainIme");
- #endif
- g_pkKeyboard = GetInputSystem()->GetKeyboard();
- g_pkMouse = GetInputSystem()->GetMouse();
- Pgg_kWinMgr.SetKeyboard(g_pkKeyboard);
- Pgg_kWinMgr.SetMouse(g_pkMouse);
- ::SetCursor(NULL);
- if(Cursor::Init() == false)
- return false;
- Pgg_kWinMgr.SetCursor(Cursor::GetPgCursor());
- return true;
- }
- void MainApp::TerminateInput()
- {
- Cursor::Terminate();
- }
- bool MainApp::IsSkipDraw(float fCurTime)
- {
- return false;
- }
- bool MainApp::InitGameData()
- {
- //fennek_work_20070726_1////////////////////////////////////
- if (CharClass::Load(Folder::Merge(Folder::System(), "ClassName.shn")) == false) { InitError("ClassName.shn InitError!!");return false;}
- splog(("CharClass::LoadClassName()\n"));
- if (CharRace::Load(Folder::Merge(Folder::System(), "RaceNameInfo.shn")) == false) { InitError("RaceNameInfo.shn InitError!!");return false;}
- splog(("CharRace::LoadRaceName()\n"));
- // if(MobInfoTable::Load() == false) return false;
- if(MobInfoTab::Load(Folder::Merge(Folder::System(), "MobInfo.shn")) == false) { InitError("MobInfo.shn InitError!!");return false;}
- if(MobViewInfoTab::Load(Folder::Merge(Folder::System(), "MobViewInfo.shn")) == false) { InitError("MobViewInfo.shn InitError!!");return false;}
- splog(("MobInfoTable::Load()\n"));
- //////////////////////////////////////////////////////////////////////////
- // added by kadol( 2007.4.10 )
- #ifdef ENABLE_CHARNPC
- if(NPCViewInfoTab::Load(Folder::Merge(Folder::System(), "NPCViewInfo.shn")) == false) { InitError("NPCViewInfo.shn InitError!!");return false;}
- #endif
- //////////////////////////////////////////////////////////////////////////
- if(RidePetTable::Load(Folder::Merge(Folder::System(), "Riding.shn")) == false) { InitError("Riding.shn InitError!!");return false;}
- if(MapInfoTab::Load(Folder::Merge(Folder::System(), "MapInfo.shn")) == false) { InitError("MapInfo.shn InitError!!");return false;}
- if(MapViewInfoTab::Load(Folder::Merge(Folder::System(), "MapViewInfo.shn")) == false) { InitError("MapViewInfo.shn InitError!!");return false;}
- // if(MapInfoTable::Load() == false) return false;
- splog(("MapInfoTable::Load()\n"));
- // if(ItemInfoTable::Load() == false) return false;
- if(ItemInfoTab::Load(Folder::Merge(Folder::System(), "ItemInfo.shn")) == false) { InitError("ItemInfo.shn InitError!!");return false;}
- if(ItemViewInfoTab::Load(Folder::Merge(Folder::System(), "ItemViewInfo.shn")) == false) { InitError("ItemViewInfo.shn InitError!!");return false;}
- splog(("ItemInfoTable::Load()\n"));
- //if(UpGradeInfoTable::Load() == false) return false;
- if(UpGradeInfoTab::Load(Folder::Merge(Folder::System(), "UpgradeInfo.shn")) == false) { InitError("UpgradeInfo.shn InitError!!");return false;}
- splog(("UpGradeInfoTable::Load()\n"));
- if(Skill::Init() == false) return false;
- splog(("Skill::Init()\n"));
- if( ActionViewTable::Load(Folder::Merge(Folder::System(), "ActionViewInfo.shn")) == false) { InitError("ActionViewInfo.shn InitError!!");return false;}
- splog(("ActionViewTable::Load(...)\n"));
- //------------------------------------------------------------------------>>
- // added by hks_080310_0 : splash
- DisplaySplash(m_SplashTexName.c_str(), m_ProgressBarTexName.c_str(), 40);
- //------------------------------------------------------------------------<<
- if(ActionInfoTable::Init() == false) return false;
- splog(("ActionInfoTable::Init()\n"));
- //------------------------------------------------------------------------>>
- // added by hks_080310_0 : splash
- DisplaySplash(m_SplashTexName.c_str(), m_ProgressBarTexName.c_str(), 50);
- //------------------------------------------------------------------------<<
- if( KQDescTable::Load(Folder::Merge(Folder::System(), "KingdomQuestDesc.shn")) == false) { InitError("KingdomQuestDesc.shn InitError!!");return false;}
- splog(("KQDescTable::Load()\n"));
- // if(HairInfoTable::Init() == false) return false;
- if(HairInfoTab::Load(Folder::Merge(Folder::System(), "HairInfo.shn")) == false) { InitError("HairInfo.shn InitError!!");return false;}
- splog(("HairInfoTab::Load()\n"));
- if(HairColorInfoTab::Load(Folder::Merge(Folder::System(), "HairColorInfo.shn")) == false) { InitError("HairColorInfo.shn InitError!!");return false;}
- splog(("HairInfoTable::Init()\n"));
- //---------------------------------------------------------------------->>
- // modified by kadol( 2007.7.4 )
- if(FaceInfoTab::Load(Folder::Merge(Folder::System(), "FaceInfo.shn")) == false) { InitError("FaceInfo.shn InitError!!");return false;}
- splog(("FaceInfoTable::Init()\n"));
- //----------------------------------------------------------------------<<
- //---------------------------------------------------------------------->>
- // kadol(07.10.30)_1
- if( WeaponAttribTab::Load( Folder::Merge( Folder::System(), "WeaponAttrib.shn")) == false ) { InitError("WeaponAttrib.shn InitError!!"); return false;}
- //----------------------------------------------------------------------<<
- if(IconMgr::Init() == false) return false;
- splog(("IconMgr::Init()\n"));
- //if(g_kAbStateMgr.LoadInfo() == false) return false;
- // newsong (2005-06-17)
- // if(AbnormalStateTable::Load() == false) return false;
- if(AbnormalStateInfoTab::Load(Folder::Merge(Folder::System(), "AbState.shn")) == false) { InitError("AbState.shn InitError!!");return false;}
- if(AbnormalStateViewInfoTab::Load(Folder::Merge(Folder::System(), "AbStateView.shn")) == false) { InitError("AbStateView.shn InitError!!");return false;}
- if(SubAbStateInfoTab::Load(Folder::Merge(Folder::System(), "SubAbState.shn")) == false) { InitError("SubAbState.shn InitError!!");return false;}
- splog(("AbnormalStateTable::Load()\n"));
- // if(DmgSndTab::Load() == false) return false;
- if(DmgSndTab::Load(Folder::Merge(Folder::System(), "DamageSoundInfo.shn")) == false) { InitError("DamageSoundInfo.shn InitError!!");return false;}
- splog(("DmgSndTab::Load()\n"));
- if (WeaponTitleTab::Load(Folder::Merge(Folder::System(), "WeaponTitleData.shn")) == false) { InitError("WeaponTitleData.shn InitError!!");return false;}
- if (g_characterTitleData.Read(Folder::Merge(Folder::System(), "CharacterTitleData.shn")) == false) { InitError("CharacterTitleData.shn InitError!!");return false;}
- if (ProduceInfoTable::Load(Folder::Merge(Folder::System(), "Produce.shn")) == false) { InitError("Produce.shn InitError!!");return false;};
- if (ProduceViewInfoTable::Load(Folder::Merge(Folder::System(), "ProduceView.shn")) == false){ InitError("ProduceView.shn InitError!!");return false;}
- if (GatherInfoTable::Load(Folder::Merge(Folder::System(), "Gather.shn")) == false) { InitError("Gather.shn InitError!!");return false;}
- if (NpcDialogDataTable::Load(Folder::Merge(Folder::System(), "NpcDialogData.shn")) == false) { InitError("NpcDialogData.shn InitError!!");return false;}
- if (GradeItemOptionTab::Load(Folder::Merge(Folder::System(), "GradeItemOption.shn")) == false) { InitError("GradeItemOption.shn InitError!!");return false;}
- if(g_kShortCutMgr.Init() == false) return false;
- splog(("g_kShortCutMgr.Init()\n"));
- //fennek_080102_1////////////////////////////////////
- #ifdef _ITEMUPGRADE_MAX_12_GRADE
- if (UpEffectTab::Load(Folder::Merge(Folder::System(), "UpEffect.shn")) == false) { InitError("UpEffect.shn InitError!!");return false;}
- if (ItemDismantleTab::Load(Folder::Merge(Folder::System(), "ItemDismantle.shn")) == false) { InitError("ItemDismantle.shn InitError!!");return false;}
- #endif
- //////////////////////////////////////fennek_080102_1
- // spiegel (2005-06-16) just compile
- // if (MapAmbienceSoundTab::Init()) MapAmbienceSoundTab::Terminate();
- // else return false;
- // splog(("MapAmbienceSoundTab::Init()\n"));
- //------------------------------------------------------------------------>>
- // added by hks_080310_0 : splash
- DisplaySplash(m_SplashTexName.c_str(), m_ProgressBarTexName.c_str(), 60);
- //------------------------------------------------------------------------<<
- if (NpcDlgScriptEncryptor::Init("npcdlgscriptencryptkey") == false) { InitError("NpcDlgScriptEncryptor InitError!!");return false;}
- splog(("NpcDlgScriptEncryptor::Init()\n"));
- #ifdef _DEBUG
- if(ItemInfoTab::CheckData() == false) return false;
- splog(("ItemInfoTable::CheckData()\n"));
- #endif
- if (ColorInfoTable::Load(Folder::Merge(Folder::System(), "ColorInfo.shn")) == false){ InitError("ColorInfo.shn InitError!!");return false;}
- #ifdef _CLIENT_ONLY
- if(Dbg::LoadVirtualAvatarInfo() == false) return false;
- splog(("Dbg::LoadVirtualAvatarInfo()\n"));
- #endif
- #ifdef _DEBUG
- if(ActSkillViewInfoTab::CheckActionTable() == false) return false;
- splog(("ActSkillViewInfoTab::CheckActionTable()\n"));
- #endif
- if (MiniHouseTable::Load(Folder::Merge(Folder::System(), "MiniHouse.shn")) == false){ InitError("MiniHouse.shn InitError!!");return false;}
- // spiegel (2006-06-17)
- if (ItemShopViewTable::Load(Folder::Merge(Folder::System(), "ItemShopView.shn")) == false){ InitError("ItemShopView.shn InitError!!");return false;}
- // spiegel (2006-06-20)
- if (ChargedEffectTable::Load(Folder::Merge(Folder::System(), "ChargedEffect.shn")) == false){ InitError("ChargedEffect.shn InitError!!"); return false; }
- //fennek_locaUSA_20070726_0////////////////////////////////////
- if (TextFilterTable::LoadSlanderFilter() == false)
- {
- InitError("FilterSlander InitError!!");
- return false;
- }
- //////////////////////////////////////fennek_locaUSA_20070726_0
- //MiniHouse_IndoorMode_1.0////////////////////////////////////
- #if defined _MINI_HOUSE_INDOOR_MODE_
- if(MiniHouseFuritureInfoTab::Load(Folder::Merge(Folder::System(), "MiniHouseFurniture.shn")) == false)
- { InitError("MiniHouseFurniture.shn InitError!!");return false;}
- splog(("MiniHouseFuritureInfoTab::Init()\n"));
- if(MiniHouseObjAniInfoTab::Load(Folder::Merge(Folder::System(), "MiniHouseObjAni.shn")) == false)
- { InitError("MiniHouseObjAni.shn InitError!!");return false;}
- splog(("MiniHouseObjAniTab::Init()\n"));
- #endif
- //////////////////////////////////////MiniHouse_IndoorMode_1.0
- //////////////////////////////////////fennek_work_20070726_1
- //HS (07.12.06) WorldMap Format Change
- if(WorldMapAvatarInfoTab::Load(Folder::Merge(Folder::System(), "WorldMapAvatarInfo.shn")) == false)
- { InitError("WorldMapAvatarInfo.shn InitError!!");return false;}
- //------------------------------------------------------------------------------------------------//
- //HS (08.01.28) Guild Grade Up
- if(GuildGradeInfoTab::Load(Folder::Merge(Folder::System(), "GuildGradeData.shn")) == false)
- { InitError("GuildGradeData.shn InitError!!");return false;}
- //------------------------------------------------------------------------------------------//
- //fennek_080311_1////////////////////////////////////
- #ifdef MIHI_HOUSE_OBJ_EFFECT
- if(MHFurnitureObjEffectTab::Load(Folder::Merge(Folder::System(), "MiniHouseFurnitureObjEffect.shn")) == false)
- { InitError("MiniHouseFurnitureObjEffect.shn InitError!!");return false;}
- #endif
- //////////////////////////////////////fennek_080311_1
- //fennek_071213_2////////////////////////////////////
- #ifdef _SHOW_USERINFO_IN_SCREENSHOT_
- m_spFont = NiFont::Create( NiRenderer::GetRenderer(), fs("%s\\CourierNew10.NFF", Folder::Main()) );
- assert (m_spFont);
- if( m_spFont )
- {
- NiColorA kColor(0.0f, 1.0f, 0.0f, 1.0f);
- m_spStr2D = new NiString2D(m_spFont, NiFontString::COLORED, 128, NULL, kColor, 32, 360);
- }
- #endif
- //////////////////////////////////////fennek_071213_2
- // check upgrade max
- // PgAssert(MAX_UPDATA_ARRAY == MAX_UPEFFECT_ARRAY && MAX_UPDATA_ARRAY == MAX_UPTEXTURE_ARRAY);
- return true;
- }
- void LogZBufferState(PgWin* pkWin)
- {
- unsigned int uiPos = 0;
- PgWin * pkChildWin = pkWin->GetNextChildWin(uiPos);
- while(pkChildWin)
- {
- if(NiIsKindOf( PgWinText, pkChildWin))
- {
- PgWinText* pkTestText = (PgWinText*)pkChildWin;
- //
- splog_line;
- /* if (pkTestText->GetText())
- if (strcmp("my", pkTestText->GetText()) == 0)
- {
- NiPoint3 kPos = pkTestText->GetTextGeometry()->GetTranslate();
- NiPoint3 kWorld = pkTestText->GetTextGeometry()->GetWorldTranslate();
- bool bCull = pkTestText->GetAppCulled();
- splog(("char position(%d, %d)-(%d, %d), cull flag :%d\n",
- (int)kPos.x, (int)kPos.y,
- (int)kWorld.x, (int)kWorld.y,
- (int)bCull));
- splog(("alpha:%f", pkTestText->GetAlpha()));
- NiZBufferProperty* pkProp = (NiZBufferProperty*)pkTestText->GetTextGeometry()->GetProperty(NiZBufferProperty::GetType());
- if (pkProp)
- {
- splog(("zbuffer prop exist\n"));
- splog(("test: %b, write: %b\n", pkProp->GetZBufferTest(), pkProp->GetZBufferWrite()));
- }
- NiAlphaProperty* pkAlpha = (NiAlphaProperty*)pkTestText->GetTextGeometry()->GetProperty(NiAlphaProperty::GetType());
- if (pkAlpha)
- {
- splog(("alpha prop exist\n"));
- }
- for (int i = 0; i < pkTestText->GetTextGeometry()->GetChildCount(); i++)
- {
- NiScreenElements* pkEle = (NiScreenElements*)pkTestText->GetTextGeometry()->GetAt(i);
- if (pkEle)
- {
- splog(("poly:%d", pkEle->GetNumPolygons()));
- NiPoint3 kPos = pkEle->GetTranslate();
- NiPoint3 kWorld = pkEle->GetWorldTranslate();
- bool bCull = pkEle->GetAppCulled();
- splog(("my position(%d, %d, %f)-(%d, %d, %f), cull flag :%d\n",
- (int)kPos.x, (int)kPos.y, kPos.z,
- (int)kWorld.x, (int)kWorld.y, kWorld.z,
- (int)bCull));
- // splog(("alpha:%f", pkEle->GetAlpha()));
- NiZBufferProperty* pkProp = (NiZBufferProperty*)pkEle->GetProperty(NiZBufferProperty::GetType());
- if (pkProp)
- {
- splog(("zbuffer prop exist\n"));
- splog(("test: %b, write: %b\n", pkProp->GetZBufferTest(), pkProp->GetZBufferWrite()));
- }
- NiAlphaProperty* pkAlpha = (NiAlphaProperty*)pkEle->GetProperty(NiAlphaProperty::GetType());
- if (pkAlpha)
- {
- splog(("alpha prop exist\n"));
- }
- }
- }
- }*/
- bool bCull = pkTestText->GetAppCulled();
- splog(("PgWinText has text %s, position(%d, %d, %f)-(%d, %d, %f), cull flag :%d\n", pkTestText->GetText(),
- (int)pkTestText->GetTranslate().x, (int)pkTestText->GetTranslate().y,
- pkTestText->GetTranslate().z,
- (int)pkTestText->GetWorldTranslate().x, (int)pkTestText->GetWorldTranslate().y,
- pkTestText->GetWorldTranslate().z,
- (int)bCull));
- NiZBufferProperty* pkProp = (NiZBufferProperty*)pkTestText->GetProperty(NiZBufferProperty::GetType());
- if (pkProp)
- {
- splog(("zbuffer prop exist\n"));
- splog(("test: %b, write: %b\n", pkProp->GetZBufferTest(), pkProp->GetZBufferWrite()));
- }
- NiAlphaProperty* pkAlpha = (NiAlphaProperty*)pkTestText->GetProperty(NiAlphaProperty::GetType());
- if (pkAlpha)
- {
- splog(("alpha prop exist\n"));
- }
- }
- LogZBufferState(pkChildWin);
- pkChildWin = pkWin->GetNextChildWin(uiPos);
- }
- }
- void MainApp::ProcessInput()
- {
- //if(g_pkMouse)
- //{
- // int iX, iY, iZ = 0;
- // if (g_pkMouse->GetPositionDelta(iX, iY, iZ))
- // {
- // if ((iX != 0) || (iY != 0))
- // m_spCursor->Move(0.0f, iX, iY);
- //
- // }
- //}
- POINT kPoint;
- ::GetCursorPos(&kPoint);
- if(m_bFullscreen == false)
- ::ScreenToClient(m_pkAppWindow->GetRenderWindowReference(), &kPoint);
- Cursor::UpdateGraphicCursorPos(kPoint.x, kPoint.y);
- #ifdef _TEST_VERSION_
- if (g_pkKeyboard)
- {
- if (g_pkKeyboard->KeyIsDown(NiInputKeyboard::KEY_LSHIFT))
- {
- if (g_pkKeyboard->KeyWasPressed(NiInputKeyboard::KEY_F11))
- {
- // win state logging
- PgTList<PgWin*>* pkShowWinList = Pgg_kWinMgr.GetShowWinList();
- PgWinCamera* pkCamera = Pgg_kWinMgr.GetCamera();
- splog_line;
- splog(("show win list count: %d\n", pkShowWinList->GetSize()));
- splog(("scene node count: %d\n", pkCamera->GetScene()->GetChildCount()));
- // show state
- splog_line;
- NiTListIterator kIter;
- PgWin* pkWin;
- kIter = pkShowWinList->GetHeadPos();
- while(kIter)
- {
- pkWin = pkShowWinList->GetNext(kIter);
- LogZBufferState(pkWin);
- //splog(("show state of window at[(%d,%d)-(%d,%d)]: %d\n",
- // pkWin->GetXPos(), pkWin->GetYPos(),
- // pkWin->GetWidth(), pkWin->GetHeight(), pkWin->GetShow() ));
- }
- splog_line;
- }
- if (g_pkKeyboard->KeyWasPressed(NiInputKeyboard::KEY_F12))
- {
- PgWinCamera* pkCamera = Pgg_kWinMgr.GetCamera();
- NiNode* pkNode = pkCamera->GetScene();
- NiWireframeProperty* pkProp = (NiWireframeProperty*)pkNode->GetProperty(NiWireframeProperty::GetType());
- if (pkProp == 0)
- {
- pkProp = new NiWireframeProperty;
- pkNode->AttachProperty(pkProp);
- }
- pkProp->SetWireframe(!pkProp->GetWireframe());
- }
- if (g_pkKeyboard->KeyWasPressed(NiInputKeyboard::KEY_F9))
- {
- PgWinCamera* pkCamera = Pgg_kWinMgr.GetCamera();
- NiNode* pkNode = pkCamera->GetScene();
- PgUtil::RemovePropWithChild(pkNode, NiTexturingProperty::GetType());
- PgUtil::RemovePropWithChild(pkNode, NiAlphaProperty::GetType());
- PgUtil::RemovePropWithChild(pkNode, NiVertexColorProperty::GetType());
- PgUtil::RemovePropWithChild(pkNode, NiMaterialProperty::GetType());
- pkNode->UpdateProperties();
- }
- extern float g_fAttackableDist;
- if (g_pkKeyboard->KeyWasPressed(NiInputKeyboard::KEY_PRIOR))
- {
- g_fAttackableDist -= 1.0f;
- if (g_fAttackableDist < 10.0f) g_fAttackableDist = 10.0f;
- splog(("attackable distance: %f\n", g_fAttackableDist));
- }
- if (g_pkKeyboard->KeyWasPressed(NiInputKeyboard::KEY_NEXT))
- {
- g_fAttackableDist += 1.0f;
- splog(("attackable distance: %f\n", g_fAttackableDist));
- }
- }
- }
- #endif
- //m_spCursor->SetPosition(0.0f, kPoint.x, kPoint.y);
- /*
- ::GetMousePos(&kPoint);
- m_spCursor->Move(0.0f, kPoint.x, kPoint.y);
- */
- }
- void LoadSoundOption()
- {
- MachineOpt::SoundOption kOpt = MachineOpt::GetSoundOption();
- if (g_kSoundMgr.GetBgmGroup() == NULL)
- {
- spnever;
- return;
- }
- g_kSoundMgr.SetMasterVolume((float)kOpt.uiMasterVolume /(float)MachineOpt::SoundOption::MAX_VOLUME);
- g_kSoundMgr.SetBgVolume((float)kOpt.uiBgVolume /(float)MachineOpt::SoundOption::MAX_VOLUME);
- g_kSoundMgr.SetEffectVolume((float)kOpt.uiEffectVolume /(float)MachineOpt::SoundOption::MAX_VOLUME);
- g_kSoundMgr.SetEnvEffectVolume((float)kOpt.uiEnvEffectVolume /(float)MachineOpt::SoundOption::MAX_VOLUME);
- //HS 2007.7.30 VoiceVolume
- g_kSoundMgr.SetVoiceVolume((float)kOpt.uiVoiceVolume / (float)MachineOpt::SoundOption::MAX_VOLUME);
- //
- }
- //Header: Declared in Tlhelp32.h.
- //Library: Use Kernel32.lib.
- #include <TlHelp32.h>
- DWORD g_ProcessID = 0;
- bool MainApp::Initialize()
- {
- //#if (defined _DEBUG || defined _AUTHOR_MODE)
- //#else
- // m_pkAppWindow->SetWidth(1024);
- // m_pkAppWindow->SetHeight(768);
- //#endif
- //---------------------------------------------------------------------->>
- // kadol(07.10.17)_1
- //fennek_071022_0////////////////////////////////////
- if(TextData::Load(Folder::Merge(Folder::System(), "TextData.shn")) == false)
- { InitError("Text Data Initialize Fail!"); return false; }
- //////////////////////////////////////fennek_071022_0
- #ifdef _USE_nPROTECT_
- if( g_pNpgl && g_dwNpglError != NPGAMEMON_SUCCESS )
- {
- bool bExit = CheckNProtectErr();
- if( bExit == true )
- return false;
- }
- #endif
- //----------------------------------------------------------------------<<
- #ifdef _LOCALE_VER_KR
- MinimizeProcess(NULL);
- #endif
- //m_bChangeDisRes = false;
- //GetProcessWindowStation()
- //ProcessCommandLineBeforInit();
- //if(NiApplication::Initialize() == false)
- // return false;
- //
- //::SetCursor(NULL);
- //if(Cursor::Init() == false)
- // return false;
- //return true;
- if( g_kServer.m_bCP )
- {
- }
- else
- {
- /*#if (defined _LOCALE_VER_KR && defined _CP_ONLY && !defined _AUTHOR_MODE )
- return false;
- #endif*/
- }
- SetClassLongPtr(GetWindowReference(), GCLP_HICON,
- (LONG_PTR)LoadIcon(GetInstanceReference(),MAKEINTRESOURCE(IDI_GAMEICON)));
- //fennek_071022_0////////////////////////////////////
- // if(TextData::Load(Folder::Merge(Folder::System(), "TextData.shn")) == false)
- // { InitError("Text Data Initialize Fail!"); return false; }
- //////////////////////////////////////fennek_071022_0
- // spiegel (2006-04-27) xtrap check
- #ifdef _XTRAP_ENABLE_
- // if (!IsXTrapValid())
- // return false;
- #endif
- splog(("niapplcation::init()\n"));
- if(NiApplication::Initialize() == false)
- return false;
- //------------------------------------------------------------------------>>
- // added by hks_080204, modified hks_080310_0 : splash
- std::string SplashTexName, ProgressBarTexName;
- SplashTexName = Folder::Merge(Folder::Menu(), "loading\\NowLoading.TGA");
- ProgressBarTexName = Folder::Merge(Folder::Menu(),"loading\\ProgressBar.tga");
- m_SplashTexName = SplashTexName;
- m_ProgressBarTexName = ProgressBarTexName;
- DisplaySplash(m_SplashTexName.c_str(), m_ProgressBarTexName.c_str(), 10);
- //------------------------------------------------------------------------<<
- splog(("niapplcation::init() - succ\n"));
- if(::PgInitInstance() == false) { InitError("PgInstance Initialize Fail!"); return false; }
- if(InitAppHandle() == false) { InitError("AppHandle Initialize Fail!"); return false; }
- if(this->InitInput() == false) { InitError("Input Initialize Fail!"); return false; }
- if(Font::Init() == false) { InitError("Font Initialize Fail!"); return false; }
- if(g_kNetMgr.Init() == false) { InitError("Network Initialize Fail!"); return false; }
- //------------------------------------------------------------------------>>
- // added by hks_080204, modified by hks_080310_0 : splash
- DisplaySplash(m_SplashTexName.c_str(), m_ProgressBarTexName.c_str(), 20);
- //------------------------------------------------------------------------<<
- if(InitGameData() == false) { InitError("Game Data Initialize Fail!"); return false; }
- //------------------------------------------------------------------------>>
- // added by hks_080204, modified by hks_080305_0 : splash
- DisplaySplash(m_SplashTexName.c_str(), m_ProgressBarTexName.c_str(), 70);
- //------------------------------------------------------------------------<<
- splog(("step1\n"));
- if(g_kCharMgr.Init() == false) { InitError("Character Manager Initialize Fail!"); return false; }
- splog(("step2\n"));
- if(g_kCharResMgr.Init() == false) { InitError("Character Resource Manager Initialize Fail!"); return false; }
- //------------------------------------------------------------------------>>
- // added by hks_080204, modified by hks_080305_0 : splash
- DisplaySplash(m_SplashTexName.c_str(), m_ProgressBarTexName.c_str(), 90);
- //------------------------------------------------------------------------<<
- splog(("step3\n"));
- if(g_kMapObjMgr.Init() == false) { InitError("Map Object Manager Initialize Fail!"); return false; }
- splog(("step4\n"));
- if(g_kDropItemMgr.Init() == false) { InitError("DropItem Manager Initialize Fail!"); return false; }
- splog(("step5\n"));
- if(MenuTexMgr::Init() == false) { InitError("Menu Texture Manager Initialize Fail!"); return false; }
- splog(("step6\n"));
- if(g_kWorld.Init( (float)m_pkAppWindow->GetWidth(), (float)m_pkAppWindow->GetHeight() ) == false)
- { InitError("World Initialize Fail!"); return false; }
- splog(("step7\n"));
- if(Engine3D::Init(g_kWorld.GetCamera()) == false) { InitError("Engine3D Initialize Fail!"); return false; }
- //------------------------------------------------------------------------>>
- // added by hks_080204, modified by hks_080305_0 : splash
- DisplaySplash(m_SplashTexName.c_str(), m_ProgressBarTexName.c_str(), 100);
- //------------------------------------------------------------------------<<
- splog(("step8\n"));
- g_kSoundMgr.Init();
- LoadSoundOption();
- splog(("step9\n"));
- if(g_kEffectMgr.Init() == false) { InitError("Effect Initialize Fail!"); return false; }
- if(g_kScrnBDMgr.Init() == false) { InitError("Speech Initialize Fail!"); return false; }
- if(g_kTextEffMgr.Init() == false) { InitError("Text Effect Initialize Fail!"); return false; }
- #ifdef _CLIENT_ONLY
- if( QuestDataMgr::GetQuest() == NULL ) { InitError("QuestData Initialize Fail!"); return false; }
- #endif
- m_dwStyle = GetWindowLong(m_pkAppWindow->GetWindowReference(), GWL_STYLE);
- RECT kRect;
- GetWindowRect(m_pkAppWindow->GetRenderWindowReference(),&kRect);
- m_uiStartHeight = kRect.bottom - kRect.top;
- if(m_bRendererDialog == false && MachineOpt::GetWindowFullMode())
- {
- ReCreateRenderer();
- }
- splog(("step2\n"));
- NiSrand((unsigned int)(GetCurrentTime()*1000.0f));
- m_spRenderer->SetBackgroundColor(NiColor(1.0f, 0, 1.0f));
- NiAlphaAccumulatorPtr spAlphaAccum = new NiAlphaAccumulator;
- m_spRenderer->SetSorter( spAlphaAccum );
- Pgg_kFrameMgr.RegisterAllFrameWork();
- m_kStartFrameWorkID = AccountFrameWorkID;
- ProcessCommandLine();
- splog(("loadconfig()\n"));
- #ifdef _DEBUG
- Dbg::LoadConfig();
- #endif
- g_kWorld.SetCameraZoomRatePerTick(0.001f);
- g_kWorld.SetCameraZoomMin(40.0f);
- // HS Change the Camera Zoom Value 330 -> 360 2007.4.25
- g_kWorld.SetCameraZoomMax(390.0f);
- //----------------------------------------------------//
- //g_kWorld.SetCameraZoomMax(1000.0f);
- g_kWorld.SetCameraZoomDef(100.0f);
- // spiegel (2006-04-25)
- // kadol( 2007-01-31 )..
- /*
- //#ifdef _LOCALE_VER_KR
- #if ( (defined _LOCALE_VER_KR || defined _LOCALE_VER_CH) && !defined _CLIENT_ONLY && !defined _DEBUG && !defined _TEST_VERSION_)
- m_pkNetMarbleLogo = new DShowMovie;
- #if (defined _LOCALE_VER_CH)
- if (m_pkNetMarbleLogo->Load(Folder::Merge(Folder::Menu(), "\\Account\\netmarble_logo.wmv"), g_hMainWnd))
- #else
- if (m_pkNetMarbleLogo->Load(Folder::Merge(Folder::Menu(), "\\Account\\netmarble_logo.mpg"), g_hMainWnd))
- #endif
- {
- m_pkNetMarbleLogo->Play();
- ShowCursor(FALSE);
- }
- else
- {
- delete m_pkNetMarbleLogo;
- m_pkNetMarbleLogo = NULL;
- Pgg_kFrameMgr.Start(AccountFrameWorkID);
- }
- #else
- */
- //---------------------------------------------------------------------->>
- // kadol(07.10.17)_1
- #ifdef _USE_nPROTECT_
- if( g_pNpgl )
- g_pNpgl->SetHwnd( g_hMainWnd );
- #endif
- //----------------------------------------------------------------------<<
- //---------------------------------------------------------------------->>
- // temlost_20080326_0
- // temlost_2008041_0
- _GetPostProcessEffectMgr();//생성을 위해 미리 호출
- CDataDocument::Instance()->Load( Folder::Merge( Folder::Main() , "Default.conf" ) );
- //----------------------------------------------------------------------<<
- Pgg_kFrameMgr.Start(AccountFrameWorkID);
- //#endif
- splog(("init sucesses\n"));
- #ifdef _NETMARBLE_SHOP_
- {
- RECT kRect = {0,0,300,300 };
- const char* WEB_ADDRESS = "http://game3.netmarble.net/game/sso_test/refresh.asp";
- CPData kCpData;
- GetAnalyzeArgument(kCpData);
- if(!InitSSOWebBrowser(g_hMainWnd, kCpData.AuthCookie, kCpData.DataCookie, kCpData.CpCookie))
- {
- return FALSE;
- }
- //m_ShopWeb.Create(WS_VISIBLE|WS_CHILD, kRect, g_hMainWnd, 1332);
- //==
- m_ShopWeb.Create(WS_CHILD, kRect, g_hMainWnd, 1332);
- //ShowWindow((HWND)m_ShopWeb.GetWnd(), SW_HIDE );
- m_ShopWeb.Navigate(WEB_ADDRESS);
- }
- #endif
- //////////////////////////////////////////////////////////////////////////
- // modified by kadol( 2007.4.25 )
- MaskShader::GetShader();
- //////////////////////////////////////////////////////////////////////////
- //HS 2007.8.9 Sound File Remove
- WIN32_FIND_DATA FindData;
- char acFullPath[128];
- for(int i=0; i<11; i++)
- {
- char* pcMp3Name = NULL;
- pcMp3Name = fs("%s",_RemoveBGMFile[i]);
- sprintf(acFullPath, "%s", Folder::Sound());
- strcat(acFullPath,pcMp3Name);
- HANDLE hFind = FindFirstFile(acFullPath,&FindData);
- if(hFind != INVALID_HANDLE_VALUE)
- {
- if(strcmp(FindData.cFileName,_RemoveBGMFile[i])==0)
- {
- SetFileAttributes(acFullPath,FILE_ATTRIBUTE_NORMAL);
- if(!DeleteFile(acFullPath))
- {
- DeleteFile(acFullPath);
- }
- }
- }
- }
- //--------------------------------------------------------------//
- return true;
- }
- bool MainApp::MeasureTime()
- {
- // start performance measurements
- if (m_fLastTime == -1.0f)
- {
- m_fLastTime = NiGetCurrentTimeInSec();
- //m_fLastTime = timeGetTime()/1000.0f;
- m_fAccumTime = 0.0f;
- m_iClicks = 0;
- }
- // measure time
- //m_fCurrentTime = timeGetTime()/1000.0f;
- m_fCurrentTime = NiGetCurrentTimeInSec();
- float fDeltaTime = m_fCurrentTime - m_fLastTime;
- // NVPerfHUD support!
- if (m_bNVPerfHUD && fDeltaTime == 0.0f)
- return true;
- if (fDeltaTime < 0.0f)
- fDeltaTime = 0.0f;
- m_fLastTime = m_fCurrentTime;
- m_fAccumTime += fDeltaTime;
- // frame rate limiter
- if (m_fAccumTime < (m_fLastFrame + m_fMinFramePeriod))
- return false;
- m_fFrameTime = m_fAccumTime - m_fLastFrame;
- m_fLastFrame = m_fAccumTime;
- return true;
- }
- void MainApp::CheckDisplayRealTime()
- {
- unsigned int NewsystemScreenWidht = GetSystemMetrics(SM_CXSCREEN);
- unsigned int NewsystemScreenHeight = GetSystemMetrics(SM_CYSCREEN);
- if(m_uiOldResWidth > NewsystemScreenWidht || m_uiOldResheight > NewsystemScreenHeight)
- m_bChangeDisRes = true;
- }
- void MainApp::OnIdle()
- {
- if (m_pkNetMarbleLogo) return;
- /*if(!GameFrameWork::ms_bWindowSizeChanged)
- CheckDisplayRealTime();
- if(m_bChangeDisRes)
- {
- ReCreateRenderer();
- m_bChangeDisRes = false;
- }*/
- if(GameFrameWork::ms_bWindowSizeChanged)
- {
- GameFrameWork::ms_bWindowSizeChanged = false;
- ReCreateRenderer();
- }
- if (!MeasureTime()) return;
- PgProfile(MainLoop);
- Timer::Update(GetCurrentTime());
- if (m_bEnableInput)
- UpdateInput();
- ProcessInput();
- // cursor update
- Cursor::Update(Timer::GetCurTime());
- if (m_bFrameRateEnabled && m_pkFrameRate)
- {
- m_pkFrameRate->TakeSample();
- m_pkFrameRate->Update();
- }
- //_PP_TEST_START(true, 5);
- g_kNetMgr.Update(Timer::GetCurTime());
- //_PP_TEST_("NetUpdate ");
- Pgg_kFrameMgr.Update(Timer::GetCurTime());
- //_PP_TEST_("FrameUpdate ");
- CQuest* pQuest = QuestDataMgr::GetQuest();
- pQuest->QuestPlayer_TimeProcess();
- // g_kSoundMgr.Update(Timer::GetCurTime());
- if(IsSkipDraw(Timer::GetCurTime()) == false)
- {
- //bool bNeedDevReset = false;
- //NiDX9Renderer * pkRenderer = (NiDX9Renderer *)NiRenderer::GetRenderer();
- //LPDIRECT3DDEVICE9 pkD3DDevice9 = pkRenderer->GetD3DDevice();
- //if(pkD3DDevice9)
- //{
- // HRESULT eD3dRet = pkD3DDevice9->TestCooperativeLevel();
- // if (eD3dRet == D3DERR_DEVICENOTRESET)
- // {
- // bNeedDevReset = true;
- // Font::OnLostDevice();
- // Cursor::OnLostDevice();
- // }
- //}
- NiDX9Renderer* pkRenderer = (NiDX9Renderer *)NiRenderer::GetRenderer();
- DWORD dwRendererResetCount = pkRenderer->GetResetCounter();
- if (dwRendererResetCount != m_dwResetCounter)
- {
- // Font::OnResetDevice();
- Cursor::OnResetDevice();
- PortraitTextureBuffer::Terminate();
- m_dwResetCounter = dwRendererResetCount;
- }
- m_spRenderer->SetBackgroundColor(g_kWorld.GetBackGroundColor());
- m_spRenderer->BeginFrame();
- {
- m_spRenderer->BeginUsingDefaultRenderTargetGroup(NiRenderer::CLEAR_ALL);
- /*m_spCamera->Clear(NiRenderer::CLEAR_ZBUFFER |
- NiRenderer::CLEAR_BACKBUFFER |
- NiRenderer::CLEAR_STENCIL);*/
- //if(bNeedDevReset)
- //{
- // Font::OnResetDevice();
- // Cursor::OnResetDevice();
- //}
- /*
- m_spScrEle->UpdateProperties();
- m_spScrEle->Update(0.0f );
- m_spScrEle->Draw( m_spRenderer );
- */
- Pgg_kFrameMgr.Draw();
- Cursor::Draw();
- ////////////////////////////////////////////////////////////////////////////
- // text drawing for debugging by kadol
- #if 0
- if( Pgg_kFrameMgr.IsInRun( GameFrameWorkID ) )
- g_pkMainChar->DrawDebugInfo();
- #endif
- ////////////////////////////////////////////////////////////////////////////
- m_spRenderer->EndUsingRenderTargetGroup();
- }
- m_spRenderer->EndFrame();
- m_spRenderer->DisplayFrame();
- #ifdef _VIEW_FRAMERATE_
- //#if ( defined _AUTHOR_MODE || defined _CLIENT_ONLY )
- if ( !m_bFullscreen && m_pkAppWindow->GetStatusPanesExist() &&
- m_pkAppWindow->GetNumStatusPanes())
- {
- DrawFrameRate();
- }
- //#endif
- #endif
- m_iClicks++;
- PgProfileIncFrameCounter;
- }
- //_PP_TEST_("Draw ");
- // splog(("%d, %d, %d, %d, %d", dwTime1, dwTime2, dwTime3, dwTime4, dwRenderTime));
- //Sleep(1);
- #ifdef _DEBUG
- Dbg::SetFrameRate((float)m_iClicks/GetAccumTime());
- #endif
- if(Pgg_kFrameMgr.IsQuit())
- {
- //---------------------------------------------------------------------->>
- // kadol(07.10.17)_1
- #ifdef _USE_nPROTECT_
- CheckNProtectErr();
- #endif
- //----------------------------------------------------------------------<<
- QuitApplication();
- }
- #ifdef _XTRAP_ENABLE_
- // if (!IsXTrapValid())
- // QuitApplication();
- #endif
- }
- /* added by kadol( 07.8.21 )
- bool MainApp::IsXTrapValid()
- {
- #ifndef _XTRAP_ENABLE_
- return true;
- #endif
- return true;
- #if 1
- char* pcErrMsg = NULL;
- if(g_bApiMal)
- pcErrMsg = TextData::Get(TextDataType::TI_XTRAP_PROGRAM_INVALID);
- if(g_bMemoryMdl)
- pcErrMsg = TextData::Get(TextDataType::TI_XTRAP_MEMORY_INVALID);
- if(g_bAutoMousMdl)
- pcErrMsg = TextData::Get(TextDataType::TI_XTRAP_AUTOMOUSE_DETECTED);
- else if(g_bAutoKeybMdl)
- pcErrMsg = TextData::Get(TextDataType::TI_XTRAP_AUTOKBD_DETECTED);
- else if(g_bMalMdl)
- pcErrMsg = TextData::Get(TextDataType::TI_XTRAP_BAD_PROGRAM_RUNNING);
- else if(g_bSpeedMdl)
- pcErrMsg = TextData::Get(TextDataType::TI_XTRAP_GAMESPEED_INVALID);
- else if(g_bFileMdl)
- pcErrMsg = TextData::Get(TextDataType::TI_XTRAP_INVALID_FILE);
- else if(g_bApiHookMdl)
- pcErrMsg = TextData::Get(TextDataType::TI_XTRAP_WINDOW_INVALID);
- else if(g_bDebugModMdl)
- pcErrMsg = TextData::Get(TextDataType::TI_XTRAP_RUNNING_IN_DEBUGMODE);
- else if(g_bMemoryCrack)
- pcErrMsg = TextData::Get(TextDataType::TI_XTRAP_INVALID_ACCESS_MC);
- else if(g_bFileCrack)
- pcErrMsg = TextData::Get(TextDataType::TI_XTRAP_INVALID_ACCESS_FC);
- else if(g_bApiHookCrack)
- pcErrMsg = TextData::Get(TextDataType::TI_XTRAP_INVALID_ACCESS_HC);
- else if (g_bOsMdl)
- pcErrMsg = TextData::Get(TextDataType::TI_XTRAP_RELEASE_COMPATIBILITY);
- else if (g_bPatchMdl)
- pcErrMsg = TextData::Get(TextDataType::TI_XTRAP_PROBLEM_TO_CONNECT_PATCHSERVER);
- else if (g_bStartXTrap == FALSE)
- pcErrMsg = TextData::Get(TextDataType::TI_XTRAP_CANT_RUN_SECURITYMODULE);
- if (pcErrMsg == NULL)
- pcErrMsg = "XTrap detected something.";
- MessageBox(NULL, pcErrMsg, TextData::Get(TextDataType::TI_XTRAP_SECURITY_WARNING), NULL);
- return false;
- #else
- if(g_bApiMal)
- { MessageBox(NULL,"프로그램이 정상작동하지 않습니다","보안경고",NULL); return false; }
- if(g_bMemoryMdl)
- { MessageBox(NULL,"메모리 상태이상입니다","보안경고",NULL); return false; }
- if(g_bAutoMousMdl)
- { MessageBox(NULL,"오토마우스가 검출되었습니다","보안경고",NULL); return false; }
- if(g_bAutoKeybMdl)
- { MessageBox(NULL,"오토키보드가 검출되었습니다","보안경고",NULL); return false; }
- if(g_bMalMdl)
- { MessageBox(NULL,"게임에 영향을주는 프로그램이 실행중입니다","보안경고",NULL); return false; }
- if(g_bSpeedMdl)
- { MessageBox(NULL,"게임속도가 비정상적입니다","보안경고",NULL); return false; }
- if(g_bFileMdl)
- { MessageBox(NULL,"비정상적인 파일입니다","보안경고",NULL); return false; }
- if(g_bApiHookMdl)
- { MessageBox(NULL,"윈도우 상태이상입니다","보안경고",NULL); return false; }
- if(g_bDebugModMdl)
- { MessageBox(NULL,"디버그 모드로 실행되었습니다","보안경고",NULL); return false; }
- if(g_bMemoryCrack)
- { MessageBox(NULL,"비정상적인 접근이 탐지되었습니다 [MC]","보안경고",NULL); return false; }
- if(g_bFileCrack)
- { MessageBox(NULL,"비정상적인 접근이 탐지되었습니다 [FC]","보안경고",NULL); return false; }
- if(g_bApiHookCrack)
- { MessageBox(NULL,"비정상적인 접근이 탐지되었습니다 [HC]","보안경고",NULL); return false; }
- if (g_bOsMdl)
- { MessageBox(NULL,"파일 속성에서 호환성 모드가 설정되었습니다. 설정을 해제하십시오.","보안경고",NULL); return false; }
- if (g_bPatchMdl)
- { MessageBox(NULL,"패치 서버 접속에 문제가 있습니다. 네트워크 상황을 확인하십시오.","보안경고",NULL); return false; }
- if (g_bStartXTrap == FALSE)
- { MessageBox(NULL,"게임 보안모듈을 실행할수 없습니다.","보안경고",NULL); return false; }
- return false;
- #endif
- }
- */
- void MainApp::EnableInput(bool bEnable)
- {
- m_bEnableInput = bEnable;
- }
- //////////////////////////////////////////////////////////////////////////
- // kadol(07.10.17)_1
- #ifdef _USE_nPROTECT_
- bool MainApp::CheckNProtectErr()
- {
- if( g_dwNpglError == NPGAMEMON_SUCCESS )
- return false;
- TCHAR msg[256];
- LPCSTR lpszMsg;
- if ( g_dwNpglError == NPGAMEMON_GAMEHACK_KILLED || g_dwNpglError == NPGAMEMON_GAMEHACK_DETECT)
- wsprintf(msg, TEXT("Game Guard Error "));
- else
- wsprintf(msg, TEXT("Game Guard Error : %lu"), g_dwNpglError);
- MessageBox(NULL, lpszMsg, msg, MB_OK);
- g_pNpgl->RunFAQ(g_dwNpglError);
- return true;
- }
- #endif
- //////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////
- // kadol(07.11.6)_1
- #ifdef _SEARCH_PROCESS
- #include "Psapi.h"
- #pragma comment(lib,"Psapi" )
- //////////////////////////////////////////////////////////////////////////
- // added by hks_080204, modified hks_080305_0 : splash window loading image
- void MainApp::DisplaySplash(const char* pcName, const char* pcProgressBarName, int LoadingRate)
- {
- const float fDesiredAspect = 4.0f/3.0f;
- float fAspect = (float)m_pkAppWindow->GetWidth()/(float)m_pkAppWindow->GetHeight();
- if (NiAbs(fAspect - fDesiredAspect) > 0.01f)
- {
- // bad aspect ratio
- NiOutputDebugString("AW: Splash aspect incorrect.\n");
- }
- NiScreenElements* pkSplash = new NiScreenElements(new NiScreenElementsData(false, true, 1));
- NiScreenElements* pkProgressBar = new NiScreenElements(new NiScreenElementsData(false, true, 1));
- pkSplash->Insert(4);
- pkProgressBar->Insert(4);
- pkSplash->SetRectangle(0, 0.0f, 0.0f, 1.0f, 1.0f);
- pkProgressBar->SetRectangle(0, 0.2773475f, 0.7552f, (float)LoadingRate/100 * 0.5f, 0.015f); // screen
- pkSplash->UpdateBound();
- pkProgressBar->UpdateBound();
- pkSplash->SetColors(0, NiColorA::WHITE);
- pkProgressBar->SetColors(0, NiColorA::WHITE);
- #if !defined(_XENON)
- pkSplash->SetTextures(0, 0, 0.0f, 0.0f, 1.0f, 1.0f); // texture
- pkProgressBar->SetTextures(0,0,0.0f,0.0f,(float)LoadingRate/100, 1.0f);
- #else
- pkSplash->SetTextures(0, 0, -0.05f, -0.03f, 1.05f, 0.78f);
- #endif
- // textures
- NiTexturingProperty* pkTex = new NiTexturingProperty(pcName);
- pkTex->SetBaseClampMode(NiTexturingProperty::CLAMP_S_CLAMP_T);
- NiTexturingProperty* pkProgressBarTex = new NiTexturingProperty(pcProgressBarName);
- pkProgressBarTex->SetBaseClampMode(NiTexturingProperty::CLAMP_S_CLAMP_T);
- pkSplash->AttachProperty(pkTex);
- pkProgressBar->AttachProperty(pkProgressBarTex);
- // use vertex colors
- NiVertexColorProperty* pkVertex = new NiVertexColorProperty;
- pkVertex->SetSourceMode(NiVertexColorProperty::SOURCE_EMISSIVE);
- pkVertex->SetLightingMode(NiVertexColorProperty::LIGHTING_E);
- pkSplash->AttachProperty(pkVertex);
- pkProgressBar->AttachProperty(pkVertex);
- // no alpha blending
- NiAlphaProperty* pkAlpha = new NiAlphaProperty;
- pkAlpha->SetAlphaBlending(false);
- pkSplash->AttachProperty(pkAlpha);
- pkProgressBar->AttachProperty(pkAlpha);
- pkSplash->UpdateProperties();
- pkSplash->Update(0.0f);
- pkProgressBar->UpdateProperties();
- pkProgressBar->Update(0.0f);
- m_spRenderer->BeginFrame();
- m_spRenderer->BeginUsingDefaultRenderTargetGroup(NiRenderer::CLEAR_ALL);
- m_spRenderer->SetScreenSpaceCameraData();
- pkSplash->Draw(m_spRenderer);
- pkProgressBar->Draw(m_spRenderer);
- m_spRenderer->EndUsingRenderTargetGroup();
- m_spRenderer->EndFrame();
- m_spRenderer->DisplayFrame();
- delete pkSplash;
- delete pkProgressBar;
- }
- //////////////////////////////////////////////////////////////////////////
- void MainApp::Terminate()
- {
- PgProfileReport;
- //---------------------------------------------------------------------->>
- // temlost_20080326_0
- CPostProcessEffectManager::Destroy();
- //----------------------------------------------------------------------<<
- g_kTextEffMgr.Terminate();
- g_kScrnBDMgr.Terminate();
- g_kEffectMgr.Terminate();
- Engine3D::Terminate();
- g_kWorld.Terminate();
- MenuTexMgr::Terminate();
- g_kDropItemMgr.Terminate();
- g_kMapObjMgr.Terminate();
- g_kCharResMgr.Terminate();
- g_kCharMgr.Terminate();
- g_kNetMgr.Terminate();
- this->TerminateInput();
- ::PgTerminateInstance();
- TerminateGameData();
- MachineOpt::Save();
- //MachineOpt::RestoreOrgGama();
- //////////////////////////////////////////////////////////////////////////
- //modified by kadol( 2007.4.25 )
- MaskShader::Terminate();
- //////////////////////////////////////////////////////////////////////////
- NiApplication::Terminate();
- g_kSoundMgr.Terminate();
- if (m_pkNetMarbleLogo)
- {
- delete m_pkNetMarbleLogo;
- m_pkNetMarbleLogo = NULL;
- }
- //---------------------------------------------------------------------->>
- // added by kadol( 2007.6.8 )
- if( st_pbyDummyMemory )
- {
- delete[] st_pbyDummyMemory;
- st_pbyDummyMemory = NULL;
- }
- //----------------------------------------------------------------------<<
- #ifdef _XTRAP_ENABLE_
- // XTrapStop();
- #endif
- Font::Termiante();
- //---------------------------------------------------------------------->>
- // kadol(07.10.17)_1
- #ifdef _USE_nPROTECT_
- if( g_pNpgl )
- {
- delete g_pNpgl;
- g_pNpgl = NULL;
- }
- #endif
- //----------------------------------------------------------------------<<
- //---------------------------------------------------------------------->>
- // kadol(07.12.3)_1
- #ifdef _ENABLE_CHATBLOCK_
- TextFilterTable::SaveBlockedID();
- #endif
- //----------------------------------------------------------------------<<
- }
- #include <NiDX9SystemDesc.h>
- bool MainApp::CheckDisplayCard(unsigned int uiWidth,unsigned int uiHeight,unsigned int uiMultisample,bool bFullScreen)
- {
- static bool ms_bFullscreen = bFullScreen;
- static const NiDX9SystemDesc* ms_pkInfo = NULL;
- static const NiDX9AdapterDesc* ms_pkAdapter = NULL;
- static const NiDX9DeviceDesc* ms_pkDevice = NULL;
- static const void* ms_pkMode = false;
- static bool ms_b32BitZBuffer = false;
- ms_pkInfo = NiDX9Renderer::GetSystemDesc();
- PgAssert(ms_pkInfo);
- unsigned int uiAdapterCount = ms_pkInfo->GetAdapterCount();
- bool bAdaptersExist = false;
- unsigned int uiAdapter = 0;
- unsigned int i = 0;
- uiAdapter = 0;
- const NiDX9AdapterDesc* pkAdapter = ms_pkInfo->GetAdapter(i);
- PgAssert(pkAdapter);
- const NiDX9DeviceDesc* pkDevice = pkAdapter->GetDevice(D3DDEVTYPE_HAL);
- if (!ms_bFullscreen)
- {
- if (!pkAdapter->CanDeviceRenderWindowed(D3DDEVTYPE_HAL))
- return false;
- }
- bAdaptersExist = true;
- if (bAdaptersExist)
- {
- ms_pkAdapter = (const NiDX9AdapterDesc*)ms_pkInfo->GetAdapter(uiAdapter);
- ms_pkDevice = ms_pkAdapter->GetDevice(D3DDEVTYPE_HAL);
- }
- else
- {
- ms_pkAdapter = NULL;
- ms_pkDevice = NULL;
- return false;
- }
- if (!ms_pkAdapter)
- return false;
- unsigned int uiModeCount = ms_pkAdapter->GetModeCount();
- int i16Default = -1;
- int i32Default = -1;
- bool bResolutionsExist = false;
- unsigned int uiMode;
- bool bDisplayRes = false;
- for (i = 0; i < uiModeCount; i++)
- {
- uiMode = i;
- const NiDX9AdapterDesc::ModeDesc* pkMode = ms_pkAdapter->GetMode(i);
- if(pkMode->m_uiWidth == uiWidth && pkMode->m_uiHeight == uiHeight && pkMode->m_uiBPP == 32)
- {
- bDisplayRes = true;
- break;
- }
- bResolutionsExist = true;
- }
- if (bResolutionsExist)
- {
- ms_pkMode = (const void*)ms_pkAdapter->GetMode(uiMode);
- }
- else
- {
- ms_pkMode = NULL;
- }
- if (!ms_pkDevice)
- return false;
- D3DFORMAT eFormat;
- if (ms_pkMode)
- {
- NiDX9AdapterDesc::ModeDesc* pkModeDesc = (NiDX9AdapterDesc::ModeDesc*)ms_pkMode;
- eFormat = pkModeDesc->m_eD3DFormat;
- }
- else
- {
- }
- const NiDX9DeviceDesc::DisplayFormatInfo* pkDFI = ms_pkDevice->GetFormatInfo(eFormat);
- NiDX9Renderer::DepthStencilFormat eNiDSFormat = pkDFI->FindClosestDepthStencil(ms_b32BitZBuffer ? 32 : 16, 0);
- D3DFORMAT eDSFormat = NiDX9Renderer::GetD3DFormat(eNiDSFormat);
- unsigned int uiQuality = pkDFI->GetNonmaskableMultiSampleQuality(!ms_bFullscreen, eFormat, eDSFormat);
- NiDX9Select::ms_uiMultisample = NiDX9Renderer::FBMODE_DEFAULT;
- bool bNonmaskableMultisample = false;
- for (i = 0; i < uiQuality; i++)
- {
- bNonmaskableMultisample = true;
- //if(uiMultisample == 1) NiDX9Select::ms_uiMultisample = (LPARAM)(NiDX9Renderer::FBMODE_MULTISAMPLES_NONMASKABLE | i);
- break;
- }
- bool bMultisample = false;
- for (i = 2; i < 17; i++)
- {
- D3DMULTISAMPLE_TYPE eType = (D3DMULTISAMPLE_TYPE)i;
- if (pkDFI->IsMultiSampleValid(!ms_bFullscreen, eType,eFormat, eDSFormat))
- {
- bMultisample = true;
- if(uiMultisample == 1) NiDX9Select::ms_uiMultisample = (LPARAM)(NiDX9Renderer::FBMODE_MULTISAMPLES_2 - 2 + i);
- break;
- }
- }
- if(uiMultisample == 0)
- {
- //NiDX9Select::ms_uiMultisample = NiDX9Renderer::FBMODE_DEFAULT;
- }
- else if(uiMultisample == 1)
- {
- if(bMultisample)
- {
- }
- }
- if(NiDX9Select::ms_uiMultisample == NiDX9Renderer::FBMODE_DEFAULT)
- {
- MachineOpt::SetMultisampleMode(0);
- }
- return bDisplayRes;
- }
- void MainApp::SetWinMaxmized()
- {
- const MachineOpt::GraphicOption *pkGraphicOption = &MachineOpt::GetGraphicOption();
- PgAssert(pkGraphicOption);
- unsigned int uiDisplayWidth = pkGraphicOption->ui_DisplayResolutionWidth;
- unsigned int uiDisplayHeight = pkGraphicOption->ui_DisplayResolutionHeight;
- DEVMODE dm;
- ZeroMemory(&dm, sizeof(DEVMODE));
- dm.dmSize = sizeof(DEVMODE);
- dm.dmFields=DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;
- dm.dmBitsPerPel = 32;
- dm.dmPelsWidth = uiDisplayWidth;
- dm.dmPelsHeight = uiDisplayHeight;
- DWORD dwStyle = GetWindowLong(m_pkAppWindow->GetWindowReference(), GWL_STYLE);
- dwStyle &= ~WS_SYSMENU;
- dwStyle &= ~WS_CAPTION;
- dwStyle |= WS_EX_TOOLWINDOW;
- SetWindowLong(m_pkAppWindow->GetWindowReference(), GWL_STYLE, dwStyle);
- if(ChangeDisplaySettings(&dm,CDS_TEST)==DISP_CHANGE_SUCCESSFUL)
- {
- ChangeDisplaySettings(&dm,0);
- ShowWindow(m_pkAppWindow->GetWindowReference(),SW_SHOWMAXIMIZED);
- unsigned int statusWinHeight = 0;
- HWND hStatusWnd = m_pkAppWindow->GetStatusWindowReference();
- if(::IsWindow(hStatusWnd))
- {
- RECT statusRect;
- GetWindowRect(hStatusWnd,&statusRect);
- statusWinHeight = statusRect.bottom - statusRect.top;
- ShowWindow(hStatusWnd,SW_HIDE);
- }
- SetWindowPos(m_pkAppWindow->GetWindowReference(),NULL,0,0,uiDisplayWidth,uiDisplayHeight+statusWinHeight,NULL);
- }
- }
- #include "stdafx.h"
- #include "MainApp.h"
- // SadPig (2006-03-25) check window language.
- bool MainApp::CheckWindowLocale()
- {
- #if ((defined _LOCALE_VER_JP) && (!defined _AUTHOR_MODE))
- //LANGID kLanID = GetSystemDefaultLangID();
- LANGID kLanID = GetSystemDefaultUILanguage();
- if(PRIMARYLANGID( kLanID ) != LANG_JAPANESE)
- {
- InitError("Error : Not Japanese Window!");
- return false;
- }
- #endif
- return true;
- }
- static void SetImeNativeModeFalse(HWND hWnd)
- {
- HIMC hIMCDef;
- hIMCDef = ImmGetContext( hWnd );
- //DWORD dwConvMode, dwSentMode;
- //if(ImmGetConversionStatus(hIMCDef, &dwConvMode, &dwSentMode) == 0)
- //return ;
- //dwConvMode &= ~IME_CMODE_NATIVE;
- //dwSentMode = IME_SMODE_NONE;
- //ImmSetConversionStatus(hIMCDef, dwConvMode, dwSentMode);
- //ImmSetOpenStatus(hIMCDef, false);
- ImmNotifyIME( hIMCDef, NI_COMPOSITIONSTR, CPS_CANCEL, 0 );
- ImmNotifyIME( hIMCDef, NI_CLOSECANDIDATE, 0, 0 );
- ImmReleaseContext( hWnd, hIMCDef );
- }
- bool MainApp::OnIme(NiEventRef pEventRecord)
- {
- #if (defined _LOCALE_VER_KR)
- return false;
- #else
- bool bRet = false;
- switch(pEventRecord->uiMsg)
- {
- case WM_IME_STARTCOMPOSITION:
- {
- SetImeNativeModeFalse(pEventRecord->hWnd);
- bRet = true;
- }
- break;
- case WM_IME_NOTIFY:
- if(pEventRecord->wParam == IMN_SETCONVERSIONMODE ||
- pEventRecord->wParam == IMN_SETOPENSTATUS)
- {
- SetImeNativeModeFalse(pEventRecord->hWnd);
- bRet = true;
- }
- break;
- };
- return bRet;
- #endif
- }
- void MainApp::SetWinNormal()
- {
- const MachineOpt::GraphicOption *pkGraphicOption = &MachineOpt::GetGraphicOption();
- PgAssert(pkGraphicOption);
- unsigned int uiDisplayWidth = pkGraphicOption->ui_DisplayResolutionWidth;
- unsigned int uiDisplayHeight = pkGraphicOption->ui_DisplayResolutionHeight;
- if(ChangeDisplaySettings(&m_SaveMode,CDS_TEST)==DISP_CHANGE_SUCCESSFUL)
- {
- ChangeDisplaySettings(&m_SaveMode,0);
- unsigned int systemScreenWidht = GetSystemMetrics(SM_CXSCREEN);
- unsigned int systemScreenHeight = GetSystemMetrics(SM_CYSCREEN);
- // m_uiOldResWidth = systemScreenWidht;
- // m_uiOldResheight = systemScreenHeight;
- unsigned int uiDefaultWidth = 1024;
- unsigned int uiDefaultHeight = 768;
- uiDefaultHeight = uiDisplayHeight;
- uiDefaultWidth = uiDisplayWidth;
- if(systemScreenWidht < uiDisplayWidth || systemScreenHeight < uiDisplayHeight)
- {
- uiDefaultHeight = systemScreenHeight;
- uiDefaultWidth = systemScreenWidht;
- uiDisplayWidth = systemScreenWidht;
- uiDisplayHeight = systemScreenHeight;
- }
- GameFrameWork::ms_uiDisResWidth = uiDisplayWidth;
- GameFrameWork::ms_uiDisResHeight = uiDisplayHeight;
- SetWindowLong(m_pkAppWindow->GetWindowReference(), GWL_STYLE, m_dwStyle);
- ShowWindow(m_pkAppWindow->GetWindowReference(),SW_RESTORE);
- unsigned int statusWinHeight = 0;
- HWND hStatusWnd = m_pkAppWindow->GetStatusWindowReference();
- if(::IsWindow(hStatusWnd))
- {
- ShowWindow(hStatusWnd,SW_SHOW);
- RECT statusRect;
- GetWindowRect(hStatusWnd,&statusRect);
- statusWinHeight = statusRect.bottom - statusRect.top;
- }
- unsigned int uiDiffWidth = (GetSystemMetrics(SM_CXBORDER)+GetSystemMetrics(SM_CXEDGE))*2;
- unsigned int uiDiffHeight = GetSystemMetrics(SM_CYCAPTION) +(GetSystemMetrics(SM_CYBORDER)+GetSystemMetrics(SM_CYEDGE))*2 +statusWinHeight;
- SetWindowPos(m_pkAppWindow->GetWindowReference(),NULL,0,0,uiDisplayWidth + uiDiffWidth,uiDisplayHeight + uiDiffHeight,NULL);
- MachineOpt::SetDisplayResolution( uiDisplayWidth,uiDisplayHeight);
- }
- else
- {
- PgAssert(0);
- }
- }
- void MainApp::ReCreateRenderer()
- {
- const MachineOpt::GraphicOption *pkGraphicOption = &MachineOpt::GetGraphicOption();
- PgAssert(pkGraphicOption);
- unsigned int uiDisplayMultisample = pkGraphicOption->ui_DisplayMultisample;
- unsigned int uiDisplayWidth = pkGraphicOption->ui_DisplayResolutionWidth;
- unsigned int uiDisplayHeight = pkGraphicOption->ui_DisplayResolutionHeight;
- GameFrameWork::ms_uiDisResWidth = uiDisplayWidth;
- GameFrameWork::ms_uiDisResHeight = uiDisplayHeight;
- unsigned int systemScreenWidht = GetSystemMetrics(SM_CXSCREEN);
- unsigned int systemScreenHeight = GetSystemMetrics(SM_CYSCREEN);
- if(!MachineOpt::GetWindowFullMode())
- {
- unsigned int uiDefaultWidth = 1024;
- unsigned int uiDefaultHeight = 768;
- uiDefaultHeight = uiDisplayHeight;
- uiDefaultWidth = uiDisplayWidth;
- if(uiDisplayWidth > systemScreenWidht || uiDisplayHeight > systemScreenHeight)
- {
- //return;
- uiDefaultHeight = uiDisplayHeight;
- uiDefaultWidth = uiDisplayWidth;
- m_pkAppWindow->SetWidth(uiDefaultWidth);
- m_pkAppWindow->SetHeight(uiDefaultHeight);
- MachineOpt::SetDisplayResolution( uiDefaultWidth,uiDefaultHeight);
- uiDisplayWidth = pkGraphicOption->ui_DisplayResolutionWidth;
- uiDisplayHeight = pkGraphicOption->ui_DisplayResolutionHeight;
- GameFrameWork::ms_uiDisResWidth = uiDisplayWidth;
- GameFrameWork::ms_uiDisResHeight = uiDisplayHeight;
- }
- if(!CheckDisplayCard(uiDisplayWidth,uiDisplayHeight,uiDisplayMultisample,m_bFullscreen))
- {
- }
- SetWinNormal();
- }
- else
- {
- if(!CheckDisplayCard(uiDisplayWidth,uiDisplayHeight,uiDisplayMultisample,m_bFullscreen))
- {
- //PgAssert(0);
- unsigned int uiDefaultWidth = systemScreenWidht;
- unsigned int uiDefaultHeight = systemScreenHeight;
- m_pkAppWindow->SetWidth(uiDefaultWidth);
- m_pkAppWindow->SetHeight(uiDefaultHeight);
- MachineOpt::SetDisplayResolution( uiDefaultWidth,uiDefaultHeight);
- uiDisplayWidth = pkGraphicOption->ui_DisplayResolutionWidth;
- uiDisplayHeight = pkGraphicOption->ui_DisplayResolutionHeight;
- GameFrameWork::ms_uiDisResWidth = uiDisplayWidth;
- GameFrameWork::ms_uiDisResHeight = uiDisplayHeight;
- }
- SetWinMaxmized();
- }
- // kadol temp
- ::SetForegroundWindow( m_pkAppWindow->GetWindowReference() );
- ::SetFocus( m_pkAppWindow->GetWindowReference() );
- #if defined(_DX9)
- NiDX9Renderer* pkDX9Renderer = NiSmartPointerCast(NiDX9Renderer,m_spRenderer);
- assert(pkDX9Renderer);
- if(uiDisplayMultisample == 0)
- {
- //pkDX9Renderer->Recreate(uiDisplayWidth, uiDisplayHeight, (NiDX9Renderer::FlagType)
- NiDX9Renderer::RecreateStatus status = pkDX9Renderer->Recreate(0, 0, (NiDX9Renderer::FlagType)
- (NiDX9Renderer::USE_MULTITHREADED | NiDX9Renderer::USE_STENCIL),m_pkAppWindow->GetRenderWindowReference());
- }
- else
- {
- if(!m_bStartUseAntiOption)
- {
- NiDX9Renderer::RecreateStatus status = pkDX9Renderer->Recreate(0, 0, (NiDX9Renderer::FlagType)
- (NiDX9Renderer::USE_MULTITHREADED | NiDX9Renderer::USE_STENCIL),m_pkAppWindow->GetRenderWindowReference());
- }
- else
- {
- NiDX9Renderer::RecreateStatus status = pkDX9Renderer->Recreate(0, 0, (NiDX9Renderer::FlagType)
- (NiDX9Renderer::USE_MULTITHREADED | NiDX9Renderer::USE_STENCIL),m_pkAppWindow->GetRenderWindowReference(),
- NiDX9Renderer::FBFMT_UNKNOWN,
- NiDX9Renderer::DSFMT_UNKNOWN,
- NiDX9Renderer::PRESENT_INTERVAL_ONE,
- NiDX9Renderer::SWAPEFFECT_DEFAULT,
- NiDX9Select::ms_uiMultisample);
- }
- }
- if(m_bStartUseAntiOption != (uiDisplayMultisample != 0))
- {
- if(!m_bStartUseAntiOption)
- {
- MsgBox * pkMsgBox;
- pkMsgBox = MsgBox::Modal(MsgBox::MSGBOX_OK,
- TextData::Get(TextDataType::TI_MA_APPLY_AFTER_GAME_RESTART));
- }
- }
- #else
- assert(false);
- #endif
- PgWin::ms_uiScreenWidth = pkGraphicOption->ui_DisplayResolutionWidth;
- PgWin::ms_uiScreenHeight = pkGraphicOption->ui_DisplayResolutionHeight;
- PgWin::ms_iScreenTopPos = 0;
- PgWin::ms_iScreenLeftPos = 0;
- PgWin::ms_iScreenRightPos = PgWin::ms_uiScreenWidth - 1;
- PgWin::ms_iScreenBottomPos = PgWin::ms_uiScreenHeight - 1;
- //==마우스 재설정.
- NiRect<int> kRect;
- kRect.m_top = 0;
- kRect.m_left = 0;
- unsigned int uiAppWinWidth = m_pkAppWindow->GetWidth();
- unsigned int uiAppWinHeight = m_pkAppWindow->GetHeight();
- kRect.m_right = uiAppWinWidth;
- kRect.m_bottom = uiAppWinHeight;
- PgWin::ms_uiScreenWidth = uiAppWinWidth;
- PgWin::ms_uiScreenHeight = uiAppWinHeight;
- /*
- kRect.m_right = PgWin::ms_uiScreenWidth;
- kRect.m_bottom = PgWin::ms_uiScreenHeight;
- */
- if(Pgg_kWinMgr.GetCursor())
- Pgg_kWinMgr.GetCursor()->SetRect(kRect);
- float fWidth = (float)PgWin::ms_uiScreenWidth;
- float fHeight = (float)PgWin::ms_uiScreenHeight;
- float offsetY = 0.5f;
- offsetY += (fHeight-(float)m_uiStartHeight);
- NiFrustum m_kViewFrustum;
- m_kViewFrustum.m_fLeft = 0.5f;
- m_kViewFrustum.m_fRight = fWidth + 0.5f;
- m_kViewFrustum.m_fTop = fHeight - offsetY;
- m_kViewFrustum.m_fBottom = -offsetY;
- m_kViewFrustum.m_fNear = 1.0f;
- m_kViewFrustum.m_fFar = 10000.0f;
- m_kViewFrustum.m_bOrtho = true;
- Pgg_kWinMgr.GetCamera()->SetViewFrustum(m_kViewFrustum);
- g_kScrnBDMgr.GetCamera()->SetViewFrustum(m_kViewFrustum);
- g_kTextEffMgr.GetCamera()->SetViewFrustum(m_kViewFrustum);
- g_kWorld.SetCameraFrustum((float)PgWin::ms_uiScreenWidth,(float)PgWin::ms_uiScreenHeight);
- GameFrameWork::ms_bRendererRecreated = true;
- }
- void MainApp::SetWinMinimized()
- {
- HWND hWnd = GetWindowReference();
- ::ShowWindow(hWnd, SW_MINIMIZE); //SW_SHOWMINIMIZED
- }
- void MainApp::TerminateGameData()
- {
- g_kShortCutMgr.Terminate();
- g_kInventory.Clear();
- g_kInventory.ClearMiniHouse();
- //MiniHouse_IndoorMode_1.0////////////////////////////////////
- g_kInventory.ClearMiniHouseAllItemInv();
- //////////////////////////////////////MiniHouse_IndoorMode_1.0
- // HairInfoTable::Terminate();
- IconMgr::Terminate();
- ActionInfoTable::Terminate();
- Skill::Terminate();
- }
- bool MainApp::OnWindowDestroy(NiWindowRef pWnd, bool bOption)
- {
- bool r = NiApplication::OnWindowDestroy(pWnd, bOption);
- return r;
- }
- //////////////////////////////////////////////////////////////////////////
- MainApp::~MainApp()
- {
- //ChangeDisplaySettings(NULL, 0);
- ChangeDisplaySettings(&m_SaveMode, CDS_UPDATEREGISTRY);
- UninitWebCtrl();
- #ifdef _NETMARBLE_SHOP_
- m_ShopWeb.Destroy();
- //UnInitSSOWebBrowser();
- #endif
- //#if ( defined _CONSOLE_TEST && !defined _DEBUG && defined _CLIENT_ONLY)
- #if (defined _LOCALE_VER_KR && defined _AUTHOR_MODE)
- FreeConsole();
- #endif
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement