Exemplo n.º 1
0
void CInventory::toggleStatusScreen()
{
	mp_StatusScreen->m_showstatus = !mp_StatusScreen->m_showstatus;

    SDL_Rect gameres = gVideoDriver.getGameResolution().SDLRect();
    const int scaleFac = gameres.h/200;

	if(mp_StatusScreen->m_showstatus)
	{
		int scroll_pos = 0;

		mp_StatusScreen->GenerateStatus();
        mp_StatusScreen->scaleToResolution();
		gVideoDriver.collectSurfaces();

        mp_StatusBgrnd = gVideoDriver.convertThroughBlitSfc(gVideoDriver.mpVideoEngine->getBlitSurface());

        CScrollEffect* ScrollEffect = dynamic_cast<CScrollEffect*>(gEffectController.Effect());

		if( ScrollEffect )
			scroll_pos = ScrollEffect->getScrollPosition();

        gEffectController.setupEffect(
                    new CScrollEffect(mp_StatusScreen->getStatusSfc(), scroll_pos, scaleFac*scaleFac, CENTER, DOWN));
	}
	else
	{		
        int scroll_pos = 160*scaleFac;

        CScrollEffect* ScrollEffect = dynamic_cast<CScrollEffect*>(gEffectController.Effect());

        // Check if it's already scrolling and get the position
		if( ScrollEffect )
			scroll_pos = ScrollEffect->getScrollPosition();

        gEffectController.setupEffect(
                    new CScrollEffect(mp_StatusScreen->getStatusSfc(), scroll_pos, -scaleFac*scaleFac, CENTER, DOWN));

		if(mp_StatusBgrnd)
			SDL_FreeSurface(mp_StatusBgrnd);
		mp_StatusBgrnd = NULL;
	}

	gInput.flushAll();
}
Exemplo n.º 2
0
void CInventory::toggleStatusScreen()
{
	mp_StatusScreen->m_showstatus = !mp_StatusScreen->m_showstatus;

    SDL_Rect gameres = gVideoDriver.getGameResolution().SDLRect();
    const int scaleFac = gameres.h/200;

	if(mp_StatusScreen->m_showstatus)
	{
		int scroll_pos = 0;


        const auto Ep = gBehaviorEngine.getEpisode();

        if(Ep == 6)
        {
            mp_StatusScreen->GenerateStatusEp6();
        }
        else if(Ep == 5)
        {
            mp_StatusScreen->GenerateStatusEp5();
        }
        else
        {
            mp_StatusScreen->GenerateStatusEp4();
        }

        mp_StatusScreen->scaleToResolution();
		gVideoDriver.collectSurfaces();


        CScrollEffect* ScrollEffect = dynamic_cast<CScrollEffect*>(gEffectController.Effect());

		if( ScrollEffect )
        {
			scroll_pos = ScrollEffect->getScrollPosition();
        }

        gEffectController.setupEffect(
                    new CScrollEffect(mp_StatusScreen->mStatusSfcTransformed,
                                      scroll_pos,
                                      scaleFac*scaleFac,
                                      CENTER, DOWN));
	}
	else
	{		
        int scroll_pos = 160*scaleFac;

        CScrollEffect* ScrollEffect = dynamic_cast<CScrollEffect*>(gEffectController.Effect());

        // Check if it's already scrolling and get the position
		if( ScrollEffect )
        {
			scroll_pos = ScrollEffect->getScrollPosition();
        }

        gEffectController.setupEffect(
                    new CScrollEffect(mp_StatusScreen->mStatusSfcTransformed,
                                      scroll_pos, -scaleFac*scaleFac,
                                      CENTER, DOWN));

	}

	gInput.flushAll();
}