コード例 #1
0
/*
 * MenuLanguageChosen:  User picked a language from the list.
 */
void MenuLanguageChosen(int id)
{
   if (language_menu == NULL)
      return;

   // Get the language ID by removing the Windows base ID (used for the menu).
   int lang_id = id - ID_LANGUAGE;

   if (lang_id < MAX_LANGUAGE_ID)
   {
      // Uncheck the currently selected language.
      CheckMenuItem(language_menu, cinfo->config->language + ID_LANGUAGE, MF_UNCHECKED);
      // Remove all spells from the client menu.
      MenuRemoveAllSpells();
      // Write language ID to config
      cinfo->config->language = lang_id;
      // Add the spells back (in the new language).
      MenuAddAllSpells();
      // Check the one we just selected (using the Windows menu ID).
      CheckMenuItem(language_menu, id, MF_CHECKED);
      // Get the room, player and inventory data again. Currently not much
      // of this data is affected by the language settings, but this may change.
      ResetUserData();
   }
}
コード例 #2
0
/*
 * AddCharsStartup:  We got some stuff from the server; see what it is.
 */
void AddCharsStartup(char *message, int len)
{
   int i;
   Bool done = False;

   for (i=0; i < len; i++)
   {
      /* If character doesn't match code, start over */
      if (server_string[pos] != (unsigned char) message[i])
      {
	 pos = 0;
	 continue;
      }
      pos++;

      /* If we reach end of server string, win */
      if (pos == INITSTR_LENGTH)
      {
	 done = True;
	 break;
      }
   }

   if (!done)
      return;

   debug(("Got response from server\n"));

   /* We found server's code string.  Send response and go into correct mode. */
   AbortStartupTimer();
   WriteServer((char *) client_string2, INITSTR_LENGTH);
   
   switch (dest_state)
   {
   case STATE_LOGIN:
      MainSetState(STATE_LOGIN);
      break;

   case STATE_GAME:
      /* We're already in game state, so don't do MainSetState--just get new game data */
      ResetUserData();
      break;
   }
}
コード例 #3
0
ファイル: command.c プロジェクト: AlleyCat1976/Meridian59_103
/*
 * CommandResetData:  "reset" command.
 */
void CommandResetData(char *args)
{
  ResetUserData();
}
コード例 #4
0
ファイル: Sequence.cpp プロジェクト: RYUSAchan/3TimesIcecream
BOOL Sequence::Initialize( HINSTANCE hInst, int nCmdShow )
{
	SetHInstance( hInst );
	Obj = NULL;
	CoInitialize( NULL );
	ResetUserData();

	WNDCLASS wc;
	wc.cbClsExtra = 0;
	wc.cbWndExtra = 0;
	wc.hbrBackground = ( HBRUSH )GetStockObject( WHITE_BRUSH );
	wc.hCursor = LoadCursor( hInst, IDC_ARROW );
	wc.hIcon = NULL;
	wc.hInstance = hInst;
	wc.lpfnWndProc = CallProc;
	wc.lpszClassName = _T( "ManyManyIcecream" );
	wc.lpszMenuName = NULL;
	wc.style = NULL;

	if( RegisterClass( &wc ) == NULL ) {
		return FALSE;
	}

	SetHWnd( CreateWindow(
		wc.lpszClassName,
		_T( "ManyManyIcecream" ),
		WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,
		CW_USEDEFAULT, CW_USEDEFAULT, 640, 480,
		NULL, NULL, hInst, ( LPVOID )this ) );

	pD3D = Direct3DCreate9( D3D_SDK_VERSION );
	if( pD3D == NULL ) {
		CautionMessage( _T( "errorz" ), _T( "DirectXDeviceの初期化に失敗しました" ) ); 
		return FALSE;
	}

	D3DDISPLAYMODE d3ddm;
	if( FAILED( pD3D->GetAdapterDisplayMode( D3DADAPTER_DEFAULT, &d3ddm ) ) )
	{
		CautionMessage( _T( "errorz" ), _T( "DirectX3DDeviceの初期化に失敗しました" ) );
		return FALSE;
	}

	D3DPRESENT_PARAMETERS d3dpp;
	ZeroMemory( &d3dpp, sizeof( d3dpp ) );
	d3dpp.Windowed = TRUE;
	d3dpp.BackBufferWidth = 640;
	d3dpp.BackBufferHeight = 480;
	d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
	d3dpp.BackBufferFormat = D3DFMT_UNKNOWN;
	d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

	if( FAILED( pD3D->CreateDevice(
		D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, GetHWnd(),
		D3DCREATE_SOFTWARE_VERTEXPROCESSING,
		&d3dpp, &pD3Ddevice ) ) )
	{
		CautionMessage( _T( "errorz" ), _T( "3DDeviceObjectの初期化に失敗しました" ) );
		return FALSE;
	}

	pD3Ddevice->SetRenderState( D3DRS_SRCBLEND, D3DBLEND_SRCALPHA );
	pD3Ddevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );
	pD3Ddevice->SetRenderState( D3DRS_ALPHABLENDENABLE, TRUE );

	if( FAILED( D3DXCreateSprite( pD3Ddevice, &pSprite ) ) )
	{
		CautionMessage( _T( "errorz" ), _T( "SpriteObjectの作成に失敗しました。" ) );
		return FALSE;
	}

	Input_device = Input::Instance();
	Input_device->Initalize();
	Sound::CreateDirectSound();

	NextMode = MODE_UNKNOWN;
	objarrive = TRUE;
	Obj = _NEW Load( this );

	ShowWindow( GetHWnd(), nCmdShow );

	return TRUE;
}