Exemplo n.º 1
0
bool GatherInfoTask::checkNullBranch(UserCore::Item::BranchInfoI* branchInfo)
{
	if (branchInfo)
		return true;

	if (!getUserCore()->getItemManager()->isKnownBranch(getMcfBranch(), getItemId()))
		throw gcException(ERR_BADITEM, "Branch is invalid or user doesnt have permissions to install branch.");

	if (!m_bFirstTime || HasAnyFlags(m_uiFlags, GI_FLAG_TEST))
		throw gcException(ERR_UNSUPPORTEDPLATFORM, 1, "This branch is not supported on this platform");

	m_bFirstTime = false;
	bool res = false;

	if (!m_bCanceled && m_pGIHH)
		res = m_pGIHH->showPlatformError();

	if (!res)
	{
		completeStage();
	}
	else
	{
		m_uiMcfBranch = MCFBranch::BranchFromInt(0);
		checkRequirements();
	}

	return false;
}
Exemplo n.º 2
0
bool GatherInfoTask::handleInvalidBranch()
{
	MCFBranch branch = getMcfBranch();

	if (m_bCanceled || (m_pGIHH && !m_pGIHH->selectBranch(branch)))
	{
		completeStage();
		return false;
	}

	if (branch == UINT_MAX)
	{
		//means the item was set as a link and needs to be launched
		getItemHandle()->getInternal()->goToStageLaunch();
		return false;
	}
	else
	{
		if (branch.isGlobal())
			branch = getItemInfo()->getInternal()->getBestBranch(branch);

		UserCore::Item::BranchInfoI* branchInfo = getItemInfo()->getBranchById(branch);
		checkNullBranch(branchInfo);
	}

	m_uiMcfBranch = branch;
	return true;
}
Exemplo n.º 3
0
void GatherInfoTask::checkRequirements()
{
	if (!isValidBranch() && !handleInvalidBranch())
		return;

	MCFBranch branch = getMcfBranch();

	UserCore::Item::BranchInfoI* branchInfo = getItemHandle()->getItemInfo()->getBranchById(branch);
	
	if (!checkNullBranch(branchInfo))
		return;

	if (m_bCanceled)
	{
		completeStage();
		return;
	}

	if (branchInfo->isPreOrderAndNotPreload())
	{
		//show the preorder prompt
		getItemHandle()->getInternal()->goToStageLaunch();
		return;
	}

	uint32 res = validate();
	
#ifdef NIX
	UserCore::Item::Helper::TOOL tool = (UserCore::Item::Helper::TOOL)(res>>28);

	//check tool deps
	if ( (tool > 0) && (!m_pGIHH || !m_pGIHH->showToolPrompt(tool)) )
	{
		completeStage();
		return;				
	}
	
	res = (res<<4)>>4;
#endif
	
	if (res == 0)
	{
		getItemHandle()->getItemInfo()->addToAccount();
		getItemHandle()->getInternal()->goToStageDownload(branch, getMcfBuild(), HasAnyFlags(m_uiFlags, GI_FLAG_TEST));
	}
	else
	{
		if (res == UserCore::Item::Helper::V_NONEMPTY)
		{
			if (HasAnyFlags(m_uiFlags, GI_FLAG_UPDATE))
			{
				getItemHandle()->getInternal()->goToStageDownload(branch, getMcfBuild(), false);
			}
			else if (getItemHandle()->getItemInfo()->getStatus() & UserCore::Item::ItemInfoI::STATUS_INSTALLCOMPLEX)
			{
				if (!m_bCanceled && m_pGIHH && m_pGIHH->showComplexPrompt())
					getItemHandle()->getInternal()->goToStageDownload(branch, getMcfBuild(), HasAnyFlags(m_uiFlags, GI_FLAG_TEST));
				else
					resetStage();
			}
			else
			{
				UserCore::Item::Helper::ACTION promptRes = UserCore::Item::Helper::C_NONE;
				
				if (!m_bCanceled && m_pGIHH)
					promptRes = m_pGIHH->showInstallPrompt(getItemHandle()->getItemInfo()->getPath(getMcfBranch()));

				switch (promptRes)
				{
				case UserCore::Item::Helper::C_REMOVE:
						getItemInfo()->addOFlag(UserCore::Item::ItemInfoI::OPTION_REMOVEFILES);

				case UserCore::Item::Helper::C_INSTALL:
						getItemInfo()->addToAccount();
						getItemHandle()->getInternal()->goToStageDownload(branch, getMcfBuild(), HasAnyFlags(m_uiFlags, GI_FLAG_TEST));
						break;

				case UserCore::Item::Helper::C_VERIFY:
						getItemInfo()->addToAccount();
						getItemInfo()->addSFlag(UserCore::Item::ItemInfoI::STATUS_INSTALLED);
						getItemInfo()->setInstalledMcf(branch, getMcfBuild());
						getItemHandle()->getInternal()->goToStageVerify(branch, getMcfBuild(), true, true, true);
						break;

					default:
						resetStage();
						break;
				}
			}
		}
		else
		{
			if (m_bCanceled || !m_pGIHH || m_pGIHH->showError(res))
			{
				resetStage();
			}
			else
			{
				getItemHandle()->getItemInfo()->addToAccount();
				getItemHandle()->getInternal()->goToStageDownload(branch, getMcfBuild(), HasAnyFlags(m_uiFlags, GI_FLAG_TEST));
			}
		}
	}
}
Exemplo n.º 4
0
void EngineStage::update(float elapsed)
{
    switch (stageState)
    {
        case STAGE_STATE_INIT:
        {
            setup();
            setPause(true);
            if (tunnel->getMode() != STAGE_MODE_RECESS || tunnel->getMode() != STAGE_MODE_TEACHING)
                globals.appendMessage("\n\nSet Your Speed", MESSAGE_NORMAL);
            stageState = STAGE_STATE_PAUSE;
            
            hud->update(elapsed);
            hud->setOverlay(0, true);
            hud->setOverlay(1, false);
            hud->setOverlay(2, false);
            hud->setOverlay(3, false);
            hud->notifyGoButton(false);
            
            OgreFramework::getSingletonPtr()->m_pSceneMgrMain->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5));
            break;
        }
        case STAGE_STATE_RUNNING:
        {
            OgreFramework::getSingletonPtr()->m_pSoundMgr->update(elapsed);
            
#if defined(OGRE_IS_IOS)
            // Update the game state
            updateSpin(elapsed);
#endif
            tunnel->update(elapsed);
            
            if (tunnel->needsCleaning())
            {
                completeStage(EVEN);
                stageState = STAGE_STATE_PROMPT;
                setPause(true);
                
                std::string finalScoreMessage = Util::toStringInt(player->getScore());
                globals.appendMessage("\nScore " + finalScoreMessage + "\n\nPlay Again?", MESSAGE_NORMAL);
            }

            hud->update(elapsed);
            hud->setOverlay(0, true);
            hud->setOverlay(1, false);
            hud->notifyGoButton(false);
            
            // Graphical view changes from camera, light, and skybox
            Quaternion camRot = player->getCombinedRotAndRoll();
            OgreFramework::getSingletonPtr()->m_pCameraMain->setPosition(player->getCamPos());
            OgreFramework::getSingletonPtr()->m_pCameraMain->setOrientation(camRot);
            if (OgreFramework::getSingletonPtr()->m_pSceneMgrMain->getSkyPlaneNode())
                OgreFramework::getSingletonPtr()->m_pSceneMgrMain->getSkyPlaneNode()->setOrientation(player->getCombinedRotAndRoll());
            if (lightNode)
                lightNode->setPosition(OgreFramework::getSingletonPtr()->m_pCameraMain->getPosition());
            
            OgreFramework::getSingletonPtr()->m_pSceneMgrMain->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5));
            
            // See by the end of this frame if we have a tutorial popup, if so pause the game, keep the music running
            if (player->getTutorialMgr()->isVisible())
            {
                setPause(true, false);
                globals.appendMessage("\n\nPaused", MESSAGE_NORMAL);
                stageState = STAGE_STATE_PAUSE;
            }
            break;
        }
        case STAGE_STATE_PAUSE:
        {
            // Navigation Debug Keys
            if (player->getKeyUp())
                player->move(Vector3(player->getCamForward() * globals.initCamSpeed * elapsed));
            if (player->getKeyDown())
                player->move(Vector3(player->getCamForward() * -globals.initCamSpeed * elapsed));
            if (player->getKeyLeft())
                player->move(Vector3(player->getCamRight() * -globals.initCamSpeed * elapsed));
            if (player->getKeyRight())
                player->move(Vector3(player->getCamRight() * globals.initCamSpeed * elapsed));
            
            OgreFramework::getSingletonPtr()->m_pCameraMain->setPosition(player->getCamPos());
            OgreFramework::getSingletonPtr()->m_pSceneMgrMain->setAmbientLight(Ogre::ColourValue(0.5, 0.5, 0.5));
            
            if (!player->hasTriggeredStartup())
            {
                int sliderSpeed = hud->getSpeedSlider()->getIndex();
                globals.initCamSpeed = Util::clamp(sliderSpeed, globals.minCamSpeed, globals.maxCamSpeed);
                player->setSpeedParameters(globals.initCamSpeed, globals.minCamSpeed, globals.maxCamSpeed);
            }
            
            hud->update(elapsed);
            hud->setOverlay(0, true);
            hud->setOverlay(1, false);
            hud->notifyGoButton(true);
            break;
        }
        case STAGE_STATE_PROMPT:
        {
            hud->update(elapsed);
            hud->setOverlay(0, true);
            hud->setOverlay(1, true);
            hud->notifyGoButton(false);
            
            OgreFramework::getSingletonPtr()->m_pSceneMgrMain->setAmbientLight(Ogre::ColourValue(0.1, 0.1, 0.1));
            break;
        }
        case STAGE_STATE_DONE:
        {
            // Unpause Settings but without the sound deactivating
            engineStateMgr->requestPopEngine();
            break;
        }
    }
}