BOOL CScanner::Load( LPCTSTR lpszFileName, BOOL bMultiByte ) { CResFile file; CString fileName = lpszFileName; fileName.MakeLower(); if( !file.Open(lpszFileName, "rb" ) ) return 0; m_strFileName = lpszFileName; return Read( &file, bMultiByte ); }
HRESULT LoadTextureFromRes( LPDIRECT3DDEVICE9 pDevice, LPCTSTR pFileName, UINT Width, UINT Height, UINT MipLevels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, DWORD Filter, DWORD MipFilter, D3DCOLOR ColorKey, D3DXIMAGE_INFO *pSrcInfo, PALETTEENTRY *pPalette, LPDIRECT3DTEXTURE9 *ppTexture ) { HRESULT hr = E_FAIL; CResFile file; if( file.Open( pFileName, "rb" ) == FALSE ) { LPCTSTR szErr = Error( "::LoadTextureFromRes : %s not found", pFileName ); ADDERRORMSG( szErr ); return E_FAIL; } int nSrcDataSize = file.GetLength(); LPBYTE pSrcData = new BYTE[ nSrcDataSize ]; if( file.Read( pSrcData, nSrcDataSize ) >= 1 ) { hr = D3DXCreateTextureFromFileInMemoryEx( pDevice, pSrcData, nSrcDataSize, Width, Height, MipLevels, Usage, Format, Pool, Filter, MipFilter, ColorKey, pSrcInfo, pPalette, ppTexture ); if( FAILED( hr ) ) { LPCTSTR szErr = Error( "D3DXCreateTextureFromFileInMemoryEx %s %s", pFileName, DXGetErrorString9( hr ) ); ADDERRORMSG( szErr ); } } SAFE_DELETE_ARRAY( pSrcData ); return hr; }
int COption::Defalt( LPCTSTR szFileName ) { CResFile file; _tcscpy( m_szFileName, szFileName); CScannerEx scan; if(file.Open( szFileName, "rb" ) == FALSE ) Error( "%s failed to load", szFileName ); return 0; if(scan.Load_FileIO( szFileName ) == FALSE ) return 0; do { scan.GetToken(); if( scan.Token == _T( "view" ) ) { m_nViewArea = scan.GetNumber(); } else if( scan.Token == _T( "distant" ) ) { m_nObjectDistant = scan.GetNumber(); } else if( scan.Token == _T( "detail" ) ) m_nObjectDetail = scan.GetNumber(); else if( scan.Token == _T( "shadow" ) ) { m_nShadow = scan.GetNumber(); } else #ifdef __SFX_OPT if(scan.Token == _T( "SFXLEVEL" )) { m_nSfxLevel = scan.GetNumber(); } #endif if( scan.Token == _T( "SFXRenderOff" ) ) { m_bSFXRenderOff = scan.GetNumber(); } else if(scan.Token == _T( "ZOOMLIMIT" )) { m_bZoomLimit = scan.GetNumber(); } if( scan.Token == _T( "DamageRender" ) ) { m_bDamageRender = scan.GetNumber(); } else if( scan.Token == _T( "PRenderName" ) ) { m_nPlayerName = scan.GetNumber(); } else if( scan.Token == _T( "OPRenderName" ) ) { m_nOtherPlayerName = scan.GetNumber(); } else if(scan.Token == _T( "WEATHEREFFECT" )) { m_nWeatherEffect = scan.GetNumber(); } else if(scan.Token == _T( "VIEWMASK" )) { m_bViewMask = scan.GetNumber(); } if( scan.Token == _T( "CameraLock" ) ) { m_bCameraLock = scan.GetNumber(); } else if( scan.Token == _T( "Trade") ) { m_bTrade = scan.GetNumber(); } else if( scan.Token == _T( "Say") ) { m_bSay = scan.GetNumber(); } else if( scan.Token == _T( "Messenger") ) { m_bMessenger = scan.GetNumber(); } else if( scan.Token == _T( "Party") ) { m_bParty = scan.GetNumber(); } else if( scan.Token == _T( "AutoAttack" ) ) { m_bAutoAttack = scan.GetNumber(); } else if( scan.Token == _T( "MessengerJoin" ) ) { m_bMessengerJoin = scan.GetNumber(); } else if( scan.Token == _T( "InstantHelp" ) ) { m_nInstantHelp = scan.GetNumber(); } else if( scan.Token == _T( "Guide" ) ) { m_nGuide1 = scan.GetNumber(); } else #ifdef __GAME_GRADE_SYSTEM if( scan.Token == _T( "GameGrade") ) { m_bGameGradeRendering = scan.GetNumber(); } else #endif // __GAME_GRADE_SYSTEM if( scan.Token == _T( "WindowAlpha" ) ) { m_nWindowAlpha = scan.GetNumber(); } else if( scan.Token == _T( "Sound" ) ) { m_bVoice = scan.GetNumber(); m_fEffectVolume = scan.GetFloat(); m_fBGMVolume = scan.GetFloat(); } else if( scan.Token == _T( "BattleBGM") ) { m_bBattleBGM = scan.GetNumber(); } } while( scan.tok != FINISHED ); CheckResolution(); m_nChatCommand = 0; m_nSlangWord = 0; m_nInterface = 1; m_bRollEffect = FALSE; m_MouseSpeed = 1; m_bVisibleBuffTimeRender = TRUE; m_bShout = TRUE; m_bMessengerJoin = TRUE; return 1; }
void CWndCredit::OnInitialUpdate() { CWndNeuz::OnInitialUpdate(); // 모래시계로 커서 변경 SetMouseCursor( CUR_DELAY ); // 여기에 코딩하세요 { CResFile file; CString strfile; #ifdef __FOR_PROLOGUE_UPDATE if( ::GetLanguage() != LANG_KOR ) strfile = MakePath( "Theme\\", ::GetLanguage(), _T( "Openning.inc" ) ); #else //__FOR_PROLOGUE_UPDATE if( ::GetLanguage() == LANG_JAP ) strfile = "Theme\\Japanese\\Openning.inc"; #endif //__FOR_PROLOGUE_UPDATE else strfile = "credit.txt"; if( file.Open( strfile.GetBuffer(0), "rb" ) ) { int nLength = file.GetLength(); TCHAR* pChar = new TCHAR[ nLength + 1]; file.Read( pChar, nLength ); pChar[ nLength ] = 0; TCHAR* prog = pChar; m_strArray.RemoveAll(); // while( ( *prog > 0 && *prog <= 0x20 ) && *prog ) // prog++; while( *prog != '\0' ) { TCHAR szString[ 256 ]; TCHAR* temp = szString; while( *prog && ( *prog > 0 && *prog <= 0x20 ) && *prog != '\r' && *prog != '\0' ) prog++; while( *prog!='\r' && *prog!='\0' ) *temp++ = *prog++; if( *prog == '\r') prog++; // skim comma // white space를 스킵 if( temp != szString ) { temp--; while( ( *temp > 0 && *temp <= 0x20 ) && *temp ) temp--; temp++; } *temp = '\0'; m_strArray.Add( szString ); } safe_delete( pChar ); } } m_timerScreenShot.Set( SEC( 10 ) ); if( ::GetLanguage() == LANG_JAP ) { int i; for( i = 0; i < MAX_SCREENSHOT_JAP; i++ ) { CString string; string.Format( "shotCredit%02d.dds", i ); //string = "shotCredit20.dds"; m_aTexScreenShot[ i ].LoadTexture( m_pApp->m_pd3dDevice, MakePath( "Theme\\Japanese\\", string ), 0xffff00ff ); m_aTexScreenShot[ i ].m_size = CSize( 598 + 76, 337 ); } } else { int i; for( i = 0; i < MAX_SCREENSHOT; i++ ) { CString string; string.Format( "shotCredit%02d.dds", i ); //string = "shotCredit20.dds"; m_aTexScreenShot[ i ].LoadTexture( m_pApp->m_pd3dDevice, MakePath( "Theme\\", string ), 0xffff00ff ); m_aTexScreenShot[ i ].m_size = CSize( 598 + 76, 337 ); } } //LoadScreenShot(); //m_pFont->RestoreDeviceObjects();//>InvalidateDeviceObjects(); //m_mapFont.SetAt( _T( "Arial Black9"), pFont ); // 윈도를 중앙으로 옮기는 부분. CRect rectRoot = m_pWndRoot->GetLayoutRect(); CRect rectWindow = GetWindowRect(); CPoint point( rectRoot.right - rectWindow.Width(), 110 ); Move( point ); MoveParentCenter(); if( ::GetLanguage() == LANG_JAP ) { CString filename = MakePath( DIR_SOUND, "VocThePrologue.WAV" ); g_SoundMng.Play( filename.GetBuffer(0), NULL, NULL, FALSE ); m_pSound = g_SoundMng.GetSound( filename.GetBuffer(0) ); m_fOldMusicVolume = GetVolume(); if(m_fOldMusicVolume && m_fOldMusicVolume >= 0.04f) SetVolume(0.04f); m_Starttimer.Set( SEC( 9 ) ); m_bPlayVoice = FALSE; } }
CModel* CModelMng::LoadModel( LPDIRECT3DDEVICE9 pd3dDevice, TCHAR* lpszFileName, LPMODELELEM lpModelElem, int nType, BOOL bParts ) { HRESULT hr; CModel* pModel = NULL; CModel* pModelBill = NULL; int nModelType = lpModelElem->m_dwModelType; TCHAR szFileName[MAX_PATH]; MapStrToPtrItor mapItor; switch( nModelType ) { case MODELTYPE_SFX: #ifndef __WORLDSERVER // 새버전에선 월드에서 sfx를 new하지 않는다. pModel = new CSfxModel; pModel->SetModelType( nModelType ); ((CSfxModel*)pModel)->SetSfx( lpszFileName ); pModel->m_pModelElem = lpModelElem; pModel->m_pModelElem->m_bUsed = TRUE; #endif // not World break; case MODELTYPE_MESH: mapItor = m_mapFileToMesh.find( lpszFileName ); if( mapItor != m_mapFileToMesh.end() ) { ((CModel*)(*mapItor).second)->m_pModelElem->m_bUsed = TRUE; #ifdef __CSC_EXTEXTURE pModel = (CModel*) (*mapItor).second; pModel->SetModelType( nModelType ); pModel->m_pModelElem = lpModelElem; return pModel; #else //__CSC_EXTEXTURE return (CModel*) (*mapItor).second; #endif //__CSC_EXTEXTURE } pModel = new CModelObject; pModel->SetModelType( nModelType ); pModel->m_pModelElem = lpModelElem; hr = pModel->InitDeviceObjects( pd3dDevice ); hr = pModel->LoadModel( lpszFileName ); if( hr == SUCCESS ) { hr = pModel->RestoreDeviceObjects(); #ifdef _DEBUG if( ((CModelObject*)pModel)->GetObject3D()->m_nHavePhysique ) Error( "CModelMng::LoadModel : %s가 동적오브젝트인데 정적오브젝트로 설정되어 있다.", lpszFileName ); #endif m_mapFileToMesh.insert( MapStrToPtrType( lpszFileName, pModel ) ); pModel->m_pModelElem->m_bUsed = TRUE; } else SAFE_DELETE( pModel ) break; case MODELTYPE_ANIMATED_MESH: pModel = new CModelObject; pModel->SetModelType( nModelType ); pModel->InitDeviceObjects( pd3dDevice ); pModel->m_pModelElem = lpModelElem; pModel->m_pModelElem->m_bUsed = TRUE; #if __VER >= 14 // __WING_ITEM memset( szFileName, 0, sizeof(szFileName) ); _tcsncpy( szFileName, lpszFileName, _tcslen( lpszFileName ) - 4 ); // .o3d를 떼고 파일명부분만 카피 _tcscat( szFileName, _T(".chr") ); switch( nType ) { case OT_ITEM: // 아이템일 경우, 외장본(.chr)이 있다면 로딩한다 (예: 날개) { CResFile resFp; BOOL bResult = resFp.Open( MakePath( DIR_MODEL, szFileName ), "rb" ); if( bResult == TRUE ) ((CModelObject*)pModel)->LoadBone( szFileName ); break; } case OT_MOVER: // 무버일 경우 외장본(.chr)을 로딩한다 { ((CModelObject*)pModel)->LoadBone( szFileName ); break; } } #else // __WING_ITEM if( nType == OT_MOVER ) // 무버는 외장본(.chr)을 먼저로딩해야한다. 여기다 넣어도 되는건지 몰겠군 -_-; { memset( szFileName, 0, sizeof(szFileName) ); _tcsncpy( szFileName, lpszFileName, _tcslen( lpszFileName ) - 4 ); // .o3d를 떼고 파일명부분만 카피 _tcscat( szFileName, _T(".chr") ); ((CModelObject*)pModel)->LoadBone( szFileName ); } #endif // __WING_ITEM if( bParts == FALSE ) { if( ((CModelObject*)pModel)->LoadModel( lpszFileName ) == SUCCESS ) // skin 읽음 { ((CModelObject*)pModel)->RestoreDeviceObjects(); } } break; } return pModel; }