Commit 7e66c101 authored by Gerstrong's avatar Gerstrong

Improved Status slide animation and fixes a Lindsey Bug

parent 58e8babd
......@@ -43,16 +43,35 @@ void CInventory::toggleStatusScreen()
{
mp_StatusScreen->m_showstatus = !mp_StatusScreen->m_showstatus;
int scroll_pos;
if(mp_StatusScreen->m_showstatus)
{
int scroll_pos = 0;
mp_StatusScreen->GenerateStatus();
g_pVideoDriver->collectSurfaces();
mp_StatusBgrnd = SDL_DisplayFormat(g_pVideoDriver->mp_VideoEngine->getBlitSurface());
g_pGfxEngine->pushEffectPtr(new CScrollEffect(mp_StatusScreen->getStatusSfc(), mp_StatusBgrnd, 8));
CScrollEffect* ScrollEffect = dynamic_cast<CScrollEffect*>(g_pGfxEngine->Effect());
if( ScrollEffect )
scroll_pos = ScrollEffect->getScrollPosition();
g_pGfxEngine->pushEffectPtr(new CScrollEffect(mp_StatusScreen->getStatusSfc(), mp_StatusBgrnd, scroll_pos, 8));
}
else
{
g_pGfxEngine->pushEffectPtr(new CScrollEffect(mp_StatusScreen->getStatusSfc(), mp_StatusBgrnd, -8));
// Check if it's already scrolling and get the position
scroll_pos = 160;
CScrollEffect* ScrollEffect = dynamic_cast<CScrollEffect*>(g_pGfxEngine->Effect());
if( ScrollEffect )
scroll_pos = ScrollEffect->getScrollPosition();
g_pGfxEngine->pushEffectPtr(new CScrollEffect(mp_StatusScreen->getStatusSfc(), mp_StatusBgrnd, scroll_pos, -8));
if(mp_StatusBgrnd)
SDL_FreeSurface(mp_StatusBgrnd);
mp_StatusBgrnd = NULL;
......
......@@ -50,7 +50,6 @@ void CLindsey::getTouchedBy(CObject &theObject)
CEventContainer& EventContainer = g_pBehaviorEngine->m_EventList;
g_pSound->playSound(SOUND_GET_WETSUIT, PLAY_PAUSEALL);
EventContainer.add( new EventPlayTrack(5) );
std::string lindsey_text[3];
......
......@@ -8,16 +8,14 @@
#include "CScrollEffect.h"
#include "sdl/CVideoDriver.h"
CScrollEffect::CScrollEffect(SDL_Surface *pScrollSurface, SDL_Surface *pBackground, Sint8 speed) :
CScrollEffect::CScrollEffect(SDL_Surface *pScrollSurface, SDL_Surface *pBackground,
const Sint16 initialPos, Sint8 speed) :
m_Speed(speed),
m_ScrollPos(0),
m_ScrollPos(initialPos),
mp_OldSurface(NULL),
mp_ScrollSurface(pScrollSurface)
{
mp_OldSurface = SDL_DisplayFormat(pBackground);
if(m_Speed < 0)
m_ScrollPos = mp_ScrollSurface->h;
}
void CScrollEffect::process()
......@@ -29,7 +27,6 @@ void CScrollEffect::process()
src.y = mp_ScrollSurface->h-m_ScrollPos;
dest.h = m_ScrollPos;
//SDL_BlitSurface( mp_OldSurface, &gameres, g_pVideoDriver->getBlitSurface(), &gameres);
SDL_BlitSurface( mp_ScrollSurface, &src, g_pVideoDriver->getBlitSurface(), &dest);
......@@ -49,6 +46,11 @@ void CScrollEffect::process()
}
}
Sint16 CScrollEffect::getScrollPosition()
{
return m_ScrollPos;
}
CScrollEffect::~CScrollEffect() {
SDL_Rect gameres = g_pVideoDriver->getGameResolution();
......
......@@ -14,10 +14,13 @@
class CScrollEffect : public CEffects {
public:
CScrollEffect(SDL_Surface *pScrollSurface, SDL_Surface *pBackground, Sint8 speed);
CScrollEffect(SDL_Surface *pScrollSurface, SDL_Surface *pBackground,
const Sint16 initialPos, Sint8 speed);
void process();
Sint16 getScrollPosition();
virtual ~CScrollEffect();
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment