Mir2Ex.cpp
上传用户:cydong117
上传日期:2009-11-10
资源大小:638k
文件大小:5k
- #include "StdAfx.h"
- CMirSound g_xSound;
- CWHDXGraphicWindow g_xMainWnd;
- CLoginProcess g_xLoginProc;
- CCharacterProcess g_xChrSelProc;
- CGameProcess g_xGameProc;
- CSprite g_xSpriteInfo;
- CChatEdit g_xChatEditBox;
- CClientSocket g_xClientSocket;
- INT g_nCertifyCode;
- char g_szUserID[20];
- char g_szCharName[20];
- char g_szServerIP[16];
- INT g_nServerPort;
- INT g_nVersion;
- BYTE g_bProcState = _LOGIN_PROC;
- int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
- {
- MSG msg;
- g_xMainWnd.Create(hInstance, "Legend Of Mir 2 Expansion[Evil's Illusion] ", NULL, MAKEINTRESOURCE(IDI_ICON), _DXG_SCREENMODE_WINDOW, _DXG_DEVICEMODE_PRIMARY|_DXG_DEVICEMODE_D3D|_DXG_DEVICEMODE_ZBUFFER);
- ShowWindow(g_xMainWnd.GetSafehWnd(), SW_HIDE);
- g_xSound.InitMirSound(g_xMainWnd.GetSafehWnd());
- g_xSpriteInfo.SetInfo();
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // 俊叼飘冠胶 积己.
- g_xChatEditBox.Create(g_xMainWnd.GetSafehInstance(), g_xMainWnd.GetSafehWnd(), 0, 0, 0, 0);
- ShowWindow(g_xChatEditBox.GetSafehWnd(), SW_HIDE);
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // Random Seed檬扁拳.
- srand((unsigned)time(NULL));
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // Windows Socket DLL阑 檬扁拳茄促.
- WSAData wsd;
- if( WSAStartup( MAKEWORD(2, 2), &wsd ) != 0 )
- return -1;
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- // 矫累窍搁辑 肺弊牢 橇肺矫廉肺 技泼茄促.
- g_xClientSocket.m_pxDefProc = g_xMainWnd.m_pxDefProcess = &g_xLoginProc;
- g_xLoginProc.Load();
- g_bProcState = _LOGIN_PROC;
- // 矫累 窍搁辑 纳腐磐 Selection Procedure肺 技泼
- /* g_nCertifyCode = 100;
- strcpy(g_szUserID,"2222");
- strcpy(g_szServerIP,"192.168.0.200");
- g_nServerPort = 7100;
- g_xMainWnd.m_pxDefProcess = &g_xChrSelProc;
- g_xChrSelProc.Load();
- g_bProcState = _CHAR_SEL_PROC;
- */
- /* WORD wColor1 = g_xMainWnd.ConvertColor24To16(RGB(255, 150, 150));
- WORD wColor2 = g_xMainWnd.ConvertColor24To16(RGB(0, 255, 0));
- WORD wColor3 = g_xMainWnd.ConvertColor24To16(RGB(150, 150, 255));
- WORD wColor4 = g_xMainWnd.ConvertColor24To16(RGB(255, 255, 0));
- WORD wColor5 = g_xMainWnd.ConvertColor24To16(RGB(255, 125, 255));
- */
- /* UpdateWindow(g_xMainWnd.GetSafehWnd());
- ShowWindow(g_xMainWnd.GetSafehWnd(), SW_SHOW);
- g_xMainWnd.m_pxDefProcess = &g_xGameProc;
- g_xGameProc.Load();
- g_bProcState = _GAME_PROC;
- */////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- g_nVersion = 20020403;
- DWORD dwLastTime, dwTime, dwDelay;
- dwLastTime = dwTime = dwDelay = 0;
- /* CAirWave m_xWave;
- m_xWave.InitAirWave();
- CWHWilImageData xImage;
- xImage.NewLoad("a.wil");
- xImage.NewSetIndex(0);
- */
- /*
- g_xMainWnd.DrawWithImageForComp(0, 0,
- 276, 185,
- (WORD*)(xImage.m_pbCurrImage));
- */
- // m_xWave.DropAirWaveMap( 180, 50, 40, -100 );
- while (TRUE)
- {
- if ( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) )
- {
- if ( 0 == GetMessage(&msg, NULL, 0, 0) )
- return (int) msg.wParam;
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- else
- {
- dwTime = timeGetTime();
- dwDelay = dwTime - dwLastTime;
- dwLastTime = dwTime;
- if ( dwDelay!=0 /*&& g_xMainWnd.m_bIsWindowActive && g_xMainWnd.m_bIsWindowReady */)
- {
- switch ( g_bProcState )
- {
- case _LOGIN_PROC:
- g_xLoginProc.RenderScene(dwDelay);
- break;
- case _CHAR_SEL_PROC:
- g_xChrSelProc.RenderScene(dwDelay);
- break;
- case _GAME_PROC:
- g_xGameProc.RenderScene(dwDelay);
- break;
- }
- /* if ( HIBYTE(GetKeyState(VK_RBUTTON)) )
- {
- POINT ptMouse;
- GetCursorPos(&ptMouse);
- ScreenToClient(g_xMainWnd.GetSafehWnd(), &ptMouse);
- m_xWave.DropAirWaveMap( ptMouse.x, ptMouse.y, 40, -100 );
- }
- g_xMainWnd.DrawWithImageForComp(0, 0,
- xImage.m_lpstNewCurrWilImageInfo->shWidth, xImage.m_lpstNewCurrWilImageInfo->shHeight,
- (WORD*)(xImage.m_pbCurrImage));
- m_xWave.UpdateAirWave();
- m_xWave.RenderAirWave();
- */
- if ( FAILED(g_xMainWnd.Present()) )
- {
- g_xMainWnd.RestoreSurfaces();
- }
- }
- }
- }
- return msg.wParam;
- }