no message

This commit is contained in:
Ben Nordstrom
2001-11-29 11:05:04 +00:00
parent a867e118cc
commit bdc55a8f99
6 changed files with 184 additions and 41 deletions
+44
View File
@@ -0,0 +1,44 @@
// GhostArrow.cpp: implementation of the GhostArrow class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "GhostArrow.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
GhostArrow::GhostArrow()
{
Arrow::Arrow();
m_sprOutline.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
m_sprMidSection.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
m_sprCenter.SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
}
void GhostArrow::Step()
{
m_sprOutline.SetZoom( 1 );
m_sprOutline.SetDiffuseColor( D3DXCOLOR(1,1,0.5f,1) );
m_sprOutline.BeginTweening( 0.3f );
m_sprOutline.SetTweenZoom( 1.5 );
m_sprOutline.SetTweenDiffuseColor( D3DXCOLOR(1,1,0.5f,0) );
m_sprMidSection.SetZoom( 1 );
m_sprMidSection.SetDiffuseColor( D3DXCOLOR(1,1,0.5f,1) );
m_sprMidSection.BeginTweening( 0.3f );
m_sprMidSection.SetTweenZoom( 1.5 );
m_sprMidSection.SetTweenDiffuseColor( D3DXCOLOR(1,1,0.5f,0) );
m_sprCenter.SetZoom( 1 );
m_sprCenter.SetDiffuseColor( D3DXCOLOR(1,1,0.5f,1) );
m_sprCenter.BeginTweening( 0.3f );
m_sprCenter.SetTweenZoom( 1.5 );
m_sprCenter.SetTweenDiffuseColor( D3DXCOLOR(1,1,0.5f,0) );
}
+26
View File
@@ -0,0 +1,26 @@
/*
-----------------------------------------------------------------------------
File: GhostArrow.h
Desc: Class used to represent a ghost arrow on the screen.
Copyright (c) 2001 Ben Norstrom. All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _GHOST_ARROW_H_
#define _GHOST_ARROW_H_
#include "Arrow.h"
class GhostArrow : public Arrow
{
public:
GhostArrow();
virtual void Step();
};
#endif
+39
View File
@@ -0,0 +1,39 @@
// GrayArrow.cpp: implementation of the GrayArrow class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "GrayArrow.h"
const float GRAY_ARROW_POP_UP_TIME = 0.30f;
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
GrayArrow::GrayArrow()
{
Arrow::Arrow();
m_sprOutline.SetDiffuseColor( D3DXCOLOR(0.6f,0.6f,0.6f,1) );
m_sprMidSection.SetDiffuseColor( D3DXCOLOR(0.3f,0.3f,0.3f,1) );
m_sprCenter.SetDiffuseColor( D3DXCOLOR(0.4f,0.4f,0.4f,1) );
}
void GrayArrow::Step()
{
m_sprOutline.SetZoom( 0.50 );
m_sprOutline.BeginTweening( GRAY_ARROW_POP_UP_TIME );
m_sprOutline.SetTweenZoom( 1.0f );
m_sprMidSection.SetZoom( 0.50 );
m_sprMidSection.BeginTweening( GRAY_ARROW_POP_UP_TIME );
m_sprMidSection.SetTweenZoom( 1.0f );
m_sprCenter.SetZoom( 0.50 );
m_sprCenter.BeginTweening( GRAY_ARROW_POP_UP_TIME );
m_sprCenter.SetTweenZoom( 1.0f );
}
+28
View File
@@ -0,0 +1,28 @@
/*
-----------------------------------------------------------------------------
File: GrayArrow.h
Desc: Class used to represent a gray arrow on the screen.
Copyright (c) 2001 Ben Norstrom. All rights reserved.
-----------------------------------------------------------------------------
*/
#ifndef _GRAYARROW_H_
#define _GRAYARROW_H_
#include "Arrow.h"
class GrayArrow : public Arrow
{
public:
GrayArrow();
// animates a step on the arrow
virtual void Step();
};
#endif
+34 -38
View File
@@ -35,13 +35,9 @@ const float ARROW_X_OFFSET[6] = {
};
const float GRAY_ARROW_Y = ARROW_SIZE * 1.5;
const float GRAY_ARROW_POP_UP_TIME = 0.30f;
const float ARROW_GAP = 70;
const int NUM_FRAMES_IN_COLOR_ARROW_SPRITE = 12;
const CString SPRITE_COLOR_ARROW = "Sprites\\Color Arrow.sprite";
const CString SPRITE_GRAY_ARROW = "Sprites\\Gray Arrow.sprite";
const float JUDGEMENT_DISPLAY_TIME = 0.6f;
const CString JUDGEMENT_SPRITE = "Sprites\\Judgement.sprite";
@@ -173,19 +169,12 @@ Player::Player()
for( int c=0; c < MAX_NUM_COLUMNS; c++ ) {
// gray arrows
m_sprGrayArrow[c].LoadFromSpriteFile( SPRITE_GRAY_ARROW );
m_sprGrayArrow[c].SetRotation( m_ColumnToRotation[c] );
m_GrayArrow[c].SetRotation( m_ColumnToRotation[c] );
m_sprGrayArrowGhost[c].LoadFromSpriteFile( SPRITE_GRAY_ARROW );
m_sprGrayArrowGhost[c].SetRotation( m_ColumnToRotation[c] );
m_sprGrayArrowGhost[c].StopAnimating();
m_sprGrayArrowGhost[c].SetState( 1 );
m_sprGrayArrowGhost[c].SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
m_GhostArrow[c].SetRotation( m_ColumnToRotation[c] );
// color arrows
m_sprColorArrow[c].LoadFromSpriteFile( SPRITE_COLOR_ARROW );
m_sprColorArrow[c].StopAnimating();
m_sprColorArrow[c].SetRotation( m_ColumnToRotation[c] );
m_ColorArrow[c].SetRotation( m_ColumnToRotation[c] );
}
// judgement
@@ -217,6 +206,7 @@ void Player::SetX( float fX )
m_fArrowsCenterX = fX;
SetGrayArrowsX(fX);
SetGhostArrowsX(fX);
SetColorArrowsX(fX);
SetJudgementX(fX);
SetComboX(fX);
@@ -430,52 +420,62 @@ float Player::GetArrowColumnX( int iColNum )
void Player::UpdateGrayArrows( const float &fDeltaTime )
{
for( int i=0; i < m_iNumColumns; i++ ) {
m_sprGrayArrow[i].Update( fDeltaTime );
m_sprGrayArrowGhost[i].Update( fDeltaTime );
m_GrayArrow[i].Update( fDeltaTime );
m_GhostArrow[i].Update( fDeltaTime );
}
}
void Player::DrawGrayArrows()
{
for( int i=0; i<m_iNumColumns; i++ )
m_sprGrayArrow[i].Draw();
//m_sprGrayArrow[i].Draw();
m_GrayArrow[i].Draw();
}
void Player::SetGrayArrowsX( int iNewX )
{
for( int i=0; i<m_iNumColumns; i++ )
m_sprGrayArrow[i].SetXY( GetArrowColumnX(i), GRAY_ARROW_Y );
//m_sprGrayArrow[i].SetXY( GetArrowColumnX(i), GRAY_ARROW_Y );
m_GrayArrow[i].SetXY( GetArrowColumnX(i), GRAY_ARROW_Y );
}
void Player::SetGhostArrowsX( int iNewX )
{
for( int i=0; i<m_iNumColumns; i++ )
m_GhostArrow[i].SetXY( GetArrowColumnX(i), GRAY_ARROW_Y );
}
void Player::SetColorArrowsX( int iNewX )
{
for( int i=0; i<m_iNumColumns; i++ )
m_sprColorArrow[i].SetX( GetArrowColumnX(i) );
m_ColorArrow[i].SetX( GetArrowColumnX(i) );
}
void Player::GrayArrowStep( int index )
{
m_sprGrayArrow[index].SetZoom( 0.50 );
m_sprGrayArrow[index].BeginTweening( GRAY_ARROW_POP_UP_TIME );
m_sprGrayArrow[index].SetTweenZoom( 1.0f );
m_GrayArrow[index].Step();
}
void Player::GrayArrowGhostStep( int index )
{
m_sprGrayArrowGhost[index].SetXY( GetArrowColumnX(index), GRAY_ARROW_Y );
m_sprGrayArrowGhost[index].SetZoom( 1 );
m_sprGrayArrowGhost[index].SetDiffuseColor( D3DXCOLOR(1,1,0.5f,1) );
m_sprGrayArrowGhost[index].BeginTweening( 0.3f );
m_sprGrayArrowGhost[index].SetTweenZoom( 1.5 );
m_sprGrayArrowGhost[index].SetTweenDiffuseColor( D3DXCOLOR(1,1,0.5f,0) );
m_GhostArrow[index].Step();
}
void Player::UpdateColorArrows( const float &fDeltaTime )
{
int iIndexFirstArrowToDraw = BeatToStepIndex( m_fSongBeat - 2.0f ); // 2 beats earlier
if( iIndexFirstArrowToDraw < 0 ) iIndexFirstArrowToDraw = 0;
int iIndexLastArrowToDraw = BeatToStepIndex( m_fSongBeat + 7.0f ); // 7 beats later
for( int c=0; c < m_iNumColumns; c++ )
m_ColorArrow[c].Update( fDeltaTime );
}
//
// modified to add color shifting to the arrow texture
//
void Player::DrawColorArrows()
{
//RageLog( "ColorArrows::Draw(%f)", fSongBeat );
@@ -494,17 +494,15 @@ void Player::DrawColorArrows()
{
float fYPos = GetColorArrowYPos( i, m_fSongBeat );
// calculate which frame to display
int iFrameNo = iBaseFrameNo + m_iColorArrowFrameOffset[i];
iFrameNo = iFrameNo % NUM_FRAMES_IN_COLOR_ARROW_SPRITE;
float fPercentToTop = (float)(fYPos - (float)GRAY_ARROW_Y) / (SCREEN_HEIGHT - GRAY_ARROW_Y);
//RageLog( "iYPos: %d, iFrameNo: %d, m_OriginalStep[i]: %d", iYPos, iFrameNo, m_OriginalStep[i] );
for( int c=0; c < m_iNumColumns; c++ ) { // for each arrow column
if( m_OriginalStep[i] & m_ColumnNumberToStep[c] ) { // this column is still unstepped on?
m_sprColorArrow[c].SetY( fYPos );
m_sprColorArrow[c].SetState( iFrameNo );
m_sprColorArrow[c].Draw();
m_ColorArrow[c].SetY( fYPos );
m_ColorArrow[c].CalculateColor( fPercentToTop );
m_ColorArrow[c].Draw();
}
}
@@ -513,14 +511,12 @@ void Player::DrawColorArrows()
} // end foreach arrow to draw
for( i=0; i<m_iNumColumns; i++ ) {
m_sprGrayArrowGhost[i].Draw();
m_GhostArrow[i].Draw();
}
}
float Player::GetColorArrowYPos( int iStepIndex, float fSongBeat )
{
float fBeatsUntilStep = StepIndexToBeat( iStepIndex ) - fSongBeat;
+13 -3
View File
@@ -17,6 +17,11 @@
#include "Sprite.h"
#include "SpriteSequence.h"
#include "ColorArrow.h"
#include "GrayArrow.h"
#include "GhostArrow.h"
const int MAX_NUM_COLUMNS = 8;
@@ -67,18 +72,23 @@ protected:
void UpdateColorArrows( const float& fDeltaTime );
float GetColorArrowYPos( int iStepIndex, float fSongBeat );
void DrawColorArrows();
Sprite m_sprColorArrow[MAX_NUM_COLUMNS];
// Sprite m_sprColorArrow[MAX_NUM_COLUMNS];
int m_iColorArrowFrameOffset[MAX_STEP_ELEMENTS];
ColorArrow m_ColorArrow[MAX_NUM_COLUMNS];
// gray arrows
void SetGrayArrowsX( int iX );
void SetGhostArrowsX( int iX );
void UpdateGrayArrows( const float& fDeltaTime );
void DrawGrayArrows();
void GrayArrowStep( int index );
void GrayArrowGhostStep( int index );
Sprite m_sprGrayArrow[MAX_NUM_COLUMNS];
Sprite m_sprGrayArrowGhost[MAX_NUM_COLUMNS];
// Sprite m_sprGrayArrow[MAX_NUM_COLUMNS];
// Sprite m_sprGrayArrowGhost[MAX_NUM_COLUMNS];
GrayArrow m_GrayArrow[MAX_NUM_COLUMNS];
GhostArrow m_GhostArrow[MAX_NUM_COLUMNS];
// judgement
void SetJudgementX( int iX );