Пример #1
0
void CreateSplash(DWORD time,char* prog,char* vers,ROMEString* author,int numAuthor)
{
    programName = prog;
    version = vers;
    authorNames = author;
    numberOfAuthors = numAuthor;
    MSG msg;
    if (MyRegisterClass(hInst) != 0)
        bClassRegistered = TRUE;
    if(time > 0) {
        bSplash = TRUE;
        DelayVal = time * 1000;
    }
    else return;
    // Create the splash screen
    if (bSplash)
        CreateSplashScreen(NULL);

    // Main message loop:
    while (GetMessage(&msg, NULL, 0, 0)) {
        PreTranslateMessage(&msg);
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }
    HideSplashScreen();
}
	void UpdateGameState()
	{
		switch (m_CurrentState)
		{
		case EGS_STARTUP:
			// Created a few dummy RBCs on initial startup to set the scene until a new game is started
			if (!m_pSplashScreen && m_GameObjects[EGO_RBC].size() == 0)
			{
				for (int j=0; j<8; ++j)
				{
					DoSpawnGameObject( GameObjectSpawnParams( EGO_RBC ) );
				}
			}

			break;
		case EGS_NEWGAME:
			if (!m_pSplashScreen)
			{
				CreateInitialGameObjects();

				SetGameState(EGS_PLAYING);
			}

			break;
		case EGS_PLAYING:
			if (m_GameObjects[EGO_WBC].size() == 0)
			{
				SetGameState(EGS_INFECTIONWON);
				CreateSplashScreen( "//GUI/infectionwin.tga", 1.0f, 0.5f, 0.0f, false );
			}
			else if (m_GameObjects[EGO_VIRUS].size() == 0 && m_GameObjects[EGO_INFECTED].size() == 0)
			{
				SetGameState(EGS_IMMUNEWON);
				CreateSplashScreen( "//GUI/immunewin.tga", 1.0f, 0.5f, 0.0f, false );
			}

			break;
		case EGS_IMMUNEWON:
		case EGS_INFECTIONWON:
			if (!m_pSplashScreen)
			{
				ResetGame();
			}

			break;
		}
	}
	virtual void Init( bool isFirstInit )
	{
		if (isFirstInit)
		{
			PreloadModels();

			CreateSplashScreen( "//GUI/title.tga", 1.0f, 0.0f, 0.5f, false );
		}
		
		m_pEntity->SetUpdateable( this );
	}