Files
itgmania212121/stepmania/src/TransitionStarWipe.cpp
T

118 lines
3.2 KiB
C++
Raw Normal View History

2001-11-03 10:52:42 +00:00
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
File: TransitionStarWipe.cpp
2001-11-03 10:52:42 +00:00
Desc: Shooting start across the screen leave a black trail.
2002-05-19 01:59:48 +00:00
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
-----------------------------------------------------------------------------
*/
2001-11-03 10:52:42 +00:00
#include "RageUtil.h"
#include "TransitionStarWipe.h"
2002-05-01 19:14:55 +00:00
#include "GameConstantsAndTypes.h"
2002-01-16 10:01:32 +00:00
#include "ThemeManager.h"
2001-11-03 10:52:42 +00:00
TransitionStarWipe::TransitionStarWipe()
{
m_fTransitionTime = m_fTransitionTime * 1.5f;
}
TransitionStarWipe::~TransitionStarWipe()
{
}
2002-05-19 01:59:48 +00:00
void TransitionStarWipe::DrawPrimitives()
2001-11-03 10:52:42 +00:00
{
if( m_TransitionState == opened )
return;
else if( m_TransitionState == closed ) {
2002-01-16 10:01:32 +00:00
m_rect.StretchTo( CRect(0,0,SCREEN_WIDTH,SCREEN_HEIGHT) );
m_rect.SetDiffuseColor( D3DCOLOR_RGBA(0,0,0,255) );
m_rect.Draw();
2001-11-03 10:52:42 +00:00
return;
}
2002-05-28 20:01:22 +00:00
float fPercentClosed = 1 - GetPercentageOpen();
2001-11-03 10:52:42 +00:00
int iNumStars = SCREEN_HEIGHT/m_iStarHeight + 1;
for( int row=0; row<iNumStars; row++ ) // foreach row of stars
{
BOOL bIsAnEvenRow = row % 2;
int y = m_iStarHeight*row + m_iStarHeight/2;
int x_tilt;
switch( m_TransitionState )
{
case opening_right:
case opening_left:
x_tilt = y - SCREEN_HEIGHT/2;
break;
case closing_right:
case closing_left:
x_tilt = abs( y - SCREEN_HEIGHT/2 );
if( bIsAnEvenRow ) x_tilt *= -1;
break;
default:
ASSERT( false );
x_tilt = 0;
2001-11-03 10:52:42 +00:00
}
2002-05-28 20:01:22 +00:00
int x_offset = (int)(fPercentClosed*(SCREEN_WIDTH+SCREEN_HEIGHT+m_iStarWidth));
2001-11-03 10:52:42 +00:00
int x = bIsAnEvenRow ?
-SCREEN_HEIGHT/2 + x_offset + x_tilt :
SCREEN_WIDTH+SCREEN_HEIGHT/2 - x_offset + x_tilt;
m_sprStar.SetRotation( bIsAnEvenRow ? D3DX_PI : 0.0f ); // flip the sprite
2002-02-24 01:43:11 +00:00
m_sprStar.SetXY( bIsAnEvenRow?x-1.0f:x+0.0f, bIsAnEvenRow?y-1.0f:y+0.0f ); // fudge. The rotation makes it off center
2001-11-03 10:52:42 +00:00
m_sprStar.Draw();
int x_rect_leading_edge = x + ( bIsAnEvenRow ? - m_iStarWidth/2 : m_iStarWidth/2 );
int x_rect_trailing_edge = ( bIsAnEvenRow ? 0 : SCREEN_WIDTH );
int y_top = y - m_iStarHeight/2;
int y_bot = y + m_iStarHeight/2+1;
2002-01-16 10:01:32 +00:00
m_rect.StretchTo( CRect(x_rect_leading_edge, y_top, x_rect_trailing_edge, y_bot) );
m_rect.SetDiffuseColor( D3DCOLOR_ARGB(255,0,0,0) );
m_rect.Draw();
2001-11-03 10:52:42 +00:00
}
}
2002-05-19 01:59:48 +00:00
void TransitionStarWipe::OpenWipingRight( ScreenMessage send_when_done )
2001-11-03 10:52:42 +00:00
{
Transition::OpenWipingRight( send_when_done );
2002-05-19 01:59:48 +00:00
LoadNewStarSprite( THEME->GetPathTo(GRAPHIC_GAMEPLAY_CLOSING_STAR) );
2001-11-03 10:52:42 +00:00
}
2002-05-19 01:59:48 +00:00
void TransitionStarWipe::OpenWipingLeft( ScreenMessage send_when_done )
2001-11-03 10:52:42 +00:00
{
Transition::OpenWipingLeft( send_when_done );
2002-05-19 01:59:48 +00:00
LoadNewStarSprite( THEME->GetPathTo(GRAPHIC_GAMEPLAY_CLOSING_STAR) );
2001-11-03 10:52:42 +00:00
}
2002-05-19 01:59:48 +00:00
void TransitionStarWipe::CloseWipingRight(ScreenMessage send_when_done )
2001-11-03 10:52:42 +00:00
{
Transition::CloseWipingRight( send_when_done );
2002-05-19 01:59:48 +00:00
LoadNewStarSprite( THEME->GetPathTo(GRAPHIC_GAMEPLAY_OPENING_STAR) );
2001-11-03 10:52:42 +00:00
}
2002-05-19 01:59:48 +00:00
void TransitionStarWipe::CloseWipingLeft( ScreenMessage send_when_done )
2001-11-03 10:52:42 +00:00
{
Transition::CloseWipingLeft( send_when_done );
2002-05-19 01:59:48 +00:00
LoadNewStarSprite( THEME->GetPathTo(GRAPHIC_GAMEPLAY_OPENING_STAR) );
2001-11-03 10:52:42 +00:00
}
void TransitionStarWipe::LoadNewStarSprite( CString sFileName )
{
2002-01-16 10:01:32 +00:00
m_sprStar.Load( sFileName );
2002-02-24 01:43:11 +00:00
m_iStarWidth = (int)m_sprStar.GetZoomedWidth();
m_iStarHeight = (int)m_sprStar.GetZoomedHeight();
2001-11-03 10:52:42 +00:00
}