Ejemplo n.º 1
0
void SystemInit()
{
	sysInf.FontSize = mainFontSize;

	InitMaze();
	HDC		hDC;
	BITMAPINFOHEADER	bmpInfoHead;

	CreateAlphaTable();
	ZeroMemory(&bmpInfoHead,sizeof(BITMAPINFOHEADER));
	bmpInfoHead.biSize = sizeof(BITMAPINFOHEADER);
	bmpInfoHead.biWidth = WIN_SIZEX;
	bmpInfoHead.biHeight = -WIN_SIZEY;
	bmpInfoHead.biPlanes = 1;
    bmpInfoHead.biBitCount = 24;
    bmpInfoHead.biCompression = BI_RGB;
	bmpInfoHead.biSizeImage = WIN_SIZEX * WIN_SIZEY *3;
	hDC = GetDC(sysInf.hWnd);
	g_DibInf.memDC = CreateCompatibleDC(hDC);
	g_DibInf.hBmp = CreateDIBSection(hDC,(BITMAPINFO *)&bmpInfoHead,DIB_RGB_COLORS,
					(void **)&g_DibInf.colorBuf.pBuf,NULL,NULL);
	g_DibInf.oldBmp = (HBITMAP)SelectObject(g_DibInf.memDC,g_DibInf.hBmp);
	ReleaseDC(sysInf.hWnd,hDC);
	ZeroMemory(g_DibInf.colorBuf.pBuf, WIN_SIZEX*WIN_SIZEY*3);
	g_DibInf.colorBuf.width = WIN_SIZEX;
	g_DibInf.colorBuf.height = WIN_SIZEY;
	g_DibInf.colorBuf.bpp = 24;
	g_DibInf.colorBuf.wPitch = WIN_SIZEX *3;

	backColorBuf.createColorBuf(WIN_SIZEX+80,WIN_SIZEY+60,24);
	bak_backColorBuf.createColorBuf(WIN_SIZEX+80,WIN_SIZEY+60,24);
	bgInf.colorBuf.loadLGF(pack_eventcg,"s00000",Type_back);
	msgWnd.InitMessageParts();
	InitDirectInput(sysInf.hInstance);
	lpSoundDS = new ClSoundDS(sysInf.hWnd,readFile,FALSE);

	if(sysInf.bAutoRead)CheckMenuItem( sysInf.hMenu, ID_AUTOREAD,   MF_CHECKED );
#ifdef _DEBUG
	sysInf.bInfo = TRUE;
#endif
	InitReadFlag();
	lpMovie = new CMovie;
	lpMovie->OpenMovie("leaflogo.avi",1);

	SYSTEMTIME	sysTime;
	GetLocalTime(&sysTime);
	srand( sysTime.wMilliseconds );
	for(int i=0;i<sysTime.wMilliseconds;i++)rand();
} // SystemInit
Ejemplo n.º 2
0
void SystemInit(LPSTR lpCmdLine)
{
	CreateAlphaTable();
	createInitColorBuf();
	msgWnd.InitMessageParts();
	MessageMenuSet( off, TRUE );
	InitDirectInput(sysInf.hInstance);
	lpSoundDS = new ClSoundDS(
		sysInf.hWnd, readFile,
		pack_bgmfile, pack_sound, pack_voice,
		sysInf.bgmVolume, sysInf.seVolume, sysInf.voiceVolume,
		FALSE);

	if(sysInf.bAutoRead){
		CheckMenuItem( sysInf.hMenu, ID_AUTOREAD,   MF_CHECKED );
		msgWnd.msgBtn[3].SetState(btn_lock);	
	}
	if(sysInf.bInfo){
		sysInf.hDebugWnd = CreateDialog(
			sysInf.hInstance, MAKEINTRESOURCE(IDD_DEBUGWND), sysInf.hWnd, (DLGPROC)DebugDlgProc);
	}
	if(3==sysInf.movieQuality){
		GetCpuID();
		DWORD clock = GetCpuClock();
		if(clock >= 1800){
			sysInf.movieQuality = 2;
		}else if(clock>=1000){
			sysInf.movieQuality = 1;
		}else{
			sysInf.movieQuality = 0;
		}
	}
	if(2==sysInf.movieQuality){
		CheckMenuItem( sysInf.hMenu, ID_MOVIEHI,   MF_CHECKED );
	}else if(1==sysInf.movieQuality){
		CheckMenuItem( sysInf.hMenu, ID_MOVIEMID,  MF_CHECKED );
	}else{
		CheckMenuItem( sysInf.hMenu, ID_MOVIELOW,  MF_CHECKED );
	}
	if(2==sysInf.setFPS){
		CheckMenuItem( sysInf.hMenu, ID_FPS60,  MF_CHECKED );
	}else if(1==sysInf.setFPS){
		CheckMenuItem( sysInf.hMenu, ID_FPS30,  MF_CHECKED );
	}else{
		CheckMenuItem( sysInf.hMenu, ID_FPS20,  MF_CHECKED );
	}
	if(2==sysInf.nouseOverlay){
		char	buf[1024];
		int		i,j,device;
		device = EnumGraphicsDevice(  );
		for(i=0 ; i<device ; i++ ){
			strcpy( buf,GetGraphicsDeviceName(i) );
			for(j=0;j<strlen(buf);j++){
				buf[j] = tolower( buf[j] );
			}
			if( strstr(buf,"matrox") ){
				break;
			}
		}
		if(i<device){
			sysInf.nouseOverlay = 1;
		}else{
			sysInf.nouseOverlay = 0;
		}
	}
	if(sysInf.nouseOverlay==1){
		CheckMenuItem( sysInf.hMenu, ID_NOUSEOVERLAY,  MF_CHECKED );
	}
	toneConvert.ClearTable();
	InitReadFlag();
	rudderWnd = new RudderWnd;
	if(lpCmdLine[0]=='\0'){
		lpMovie = new CMovie(sysInf.nouseOverlay);
		lpMovie->OpenMovie("leaflogo.avi",-1,TRUE);
	}else{
		sysInf.bLookTitle = 1;	
		sysInf.bLookOpening = 1;
		int index = EXEC_ReadLang( lpCmdLine, &LangData );
		AVG_SetScenarioNo(index);
		EXEC_StartLang( &LangData, MAIN_SCRIPT );
		c_cls_all();
		msgWnd.MsgCLS();
		lpSoundDS->FadeOut(bgmHandle);
		changeExecMode( event_exec_mode );
	}
} // SystemInit