Example #1
0
int Window::InitWindowClassEx( HINSTANCE hInstance )
{
	wd.wcx.style = CS_HREDRAW | CS_VREDRAW;
	//wcx->lpfnWndProc   = ::WindowProc; //ウィンドウプロシージャ
	SetWindowProc( DefWindowProc );
	wd.wcx.cbClsExtra = 0;
	wd.wcx.cbWndExtra = 0;
	wd.wcx.hInstance = wd.hInstance = hInstance;
	wd.wcx.hIcon = LoadIcon( NULL, IDI_APPLICATION ); //アイコン
	//  wc->hIcon         = LoadIcon(hInstance,TEXT("ICON_16"));
	wd.wcx.hCursor = LoadCursor( NULL, IDC_ARROW ); //カーソル
	//  wc->hCursor       = LoadCursor(hInstance,TEXT("MYCURSOR"));//
	wd.wcx.hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
	wd.wcx.lpszMenuName = NULL;
	wd.wcx.hIconSm = LoadIcon( NULL, IDI_APPLICATION ); //アイコン
	return 0;
}
Example #2
0
void __fastcall run_game_loop(int uMsg)
{
	//int v3; // eax
	bool v5; // zf
	//int v6; // eax
	signed int v7; // [esp+8h] [ebp-24h]
	LRESULT (__stdcall *saveProc)(HWND, UINT, WPARAM, LPARAM); // [esp+Ch] [ebp-20h]
	struct tagMSG msg; // [esp+10h] [ebp-1Ch]

	nthread_ignore_mutex(1);
	start_game(uMsg);
	saveProc = SetWindowProc(GM_Game);
	control_update_life_mana();
	msg_process_net_packets();
	gbRunGame = 1;
	gbProcessPlayers = 1;
	gbRunGameResult = 1;
	drawpanflag = 255;
	DrawAndBlit();
	PaletteFadeIn(8);
	drawpanflag = 255;
	gbGameLoopStartup = 1;
	nthread_ignore_mutex(0);
	while ( gbRunGame )
	{
		diablo_color_cyc_logic();
		if ( PeekMessageA(&msg, NULL, 0, 0, PM_NOREMOVE) )
		{
			SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL);
			while ( PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE) )
			{
				if ( msg.message == WM_QUIT )
				{
					gbRunGameResult = 0;
					gbRunGame = 0;
					break;
				}
				TranslateMessage(&msg);
				DispatchMessageA(&msg);
			}
			if ( !gbRunGame || (v7 = 1, !nthread_has_500ms_passed()) )
				v7 = 0;
			SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL);
			v5 = v7 == 0;
		}
		else
		{
			//_LOBYTE(v6) = nthread_has_500ms_passed();
			v5 = nthread_has_500ms_passed() == 0;
		}
		if ( !v5 )
		{
			multi_process_network_packets();
			game_loop(gbGameLoopStartup);
			msgcmd_send_chat();
			gbGameLoopStartup = 0;
			DrawAndBlit();
		}
#ifdef SLEEP
		Sleep(1);
#endif
	}
	if ( (unsigned char)gbMaxPlayers > 1u )
		pfile_write_hero();
	pfile_flush_W();
	PaletteFadeOut(8);
	SetCursor(0);
	ClearScreenBuffer();
	drawpanflag = 255;
	scrollrt_draw_game_screen(1);
	SetWindowProc(saveProc);
	free_game();
	if ( cineflag )
	{
		cineflag = 0;
		DoEnding();
	}
}