Added Oni Game Over graphic and animation
This commit is contained in:
@@ -116,7 +116,7 @@ void Actor::Draw() // set the world matrix and calculate actor properties, the
|
||||
case bobbing:
|
||||
{
|
||||
float fPercentThroughBounce = m_fTimeIntoBounce / m_fBouncePeriod;
|
||||
float fPercentOffset = sinf( fPercentThroughBounce*D3DX_PI );
|
||||
float fPercentOffset = sinf( fPercentThroughBounce*D3DX_PI*2 );
|
||||
m_temp_pos += m_vectBounce * fPercentOffset;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -148,6 +148,14 @@ void GameState::ResetStageStatistics()
|
||||
{
|
||||
m_iSongsIntoCourse = 0;
|
||||
|
||||
switch( m_PlayMode )
|
||||
{
|
||||
case PLAY_MODE_ONI:
|
||||
case PLAY_MODE_ENDLESS:
|
||||
m_apSongsPlayed.RemoveAll();
|
||||
break;
|
||||
}
|
||||
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
int s;
|
||||
|
||||
@@ -20,6 +20,12 @@ NoteDataWithScoring::NoteDataWithScoring()
|
||||
}
|
||||
|
||||
void NoteDataWithScoring::Init()
|
||||
{
|
||||
NoteData::Init();
|
||||
InitScoringData();
|
||||
}
|
||||
|
||||
void NoteDataWithScoring::InitScoringData()
|
||||
{
|
||||
for( int t=0; t<MAX_NOTE_TRACKS; t++ )
|
||||
for( int i=0; i<MAX_TAP_NOTE_ROWS; i++ )
|
||||
@@ -32,7 +38,6 @@ void NoteDataWithScoring::Init()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int NoteDataWithScoring::GetNumSuccessfulTapNotes( const float fStartBeat, const float fEndBeat )
|
||||
{
|
||||
int iNumSuccessfulTapNotes = 0;
|
||||
|
||||
@@ -17,6 +17,7 @@ struct NoteDataWithScoring : public NoteData
|
||||
{
|
||||
NoteDataWithScoring();
|
||||
void Init();
|
||||
void InitScoringData();
|
||||
|
||||
// maintain this extra data in addition to the NoteData
|
||||
TapNoteScore m_TapNoteScores[MAX_NOTE_TRACKS][MAX_TAP_NOTE_ROWS];
|
||||
|
||||
@@ -38,7 +38,7 @@ NoteField::NoteField()
|
||||
|
||||
m_fBeginMarker = m_fEndMarker = -1;
|
||||
|
||||
m_fOverrideAdd = -1;
|
||||
m_fPercentFadeToFail = -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,8 @@ void NoteField::Load( NoteData* pNoteData, PlayerNumber pn, int iPixelsToDrawBeh
|
||||
m_iPixelsToDrawBehind = iPixelsToDrawBehind;
|
||||
m_iPixelsToDrawAhead = iPixelsToDrawAhead;
|
||||
|
||||
m_fPercentFadeToFail = -1;
|
||||
|
||||
NoteDataWithScoring::Init();
|
||||
|
||||
for( int i=0; i<MAX_HOLD_NOTES; i++ )
|
||||
@@ -77,6 +79,9 @@ void NoteField::Load( NoteData* pNoteData, PlayerNumber pn, int iPixelsToDrawBeh
|
||||
void NoteField::Update( float fDeltaTime )
|
||||
{
|
||||
m_rectMarkerBar.Update( fDeltaTime );
|
||||
|
||||
if( m_fPercentFadeToFail >= 0 )
|
||||
m_fPercentFadeToFail = min( m_fPercentFadeToFail + fDeltaTime/3, 1 ); // take 3 seconds to totally fade
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +93,10 @@ void NoteField::CreateTapNoteInstance( ColorNoteInstance &cni, const int iCol, c
|
||||
const float fYPos = ArrowGetYPos( m_PlayerNumber, fYOffset );
|
||||
const float fRotation = ArrowGetRotation( m_PlayerNumber, iCol, fYOffset );
|
||||
const float fXPos = ArrowGetXPos( m_PlayerNumber, iCol, fYOffset );
|
||||
const float fAlpha = ArrowGetAlpha( m_PlayerNumber, fYPos );
|
||||
float fAlpha = ArrowGetAlpha( m_PlayerNumber, fYPos );
|
||||
|
||||
if( m_fPercentFadeToFail != -1 )
|
||||
fAlpha = 1-m_fPercentFadeToFail;
|
||||
|
||||
D3DXCOLOR colorLeading, colorTrailing; // of the color part. Alpha here be overwritten with fAlpha!
|
||||
if( color.a == -1 ) // indicated "NULL"
|
||||
@@ -97,8 +105,6 @@ void NoteField::CreateTapNoteInstance( ColorNoteInstance &cni, const int iCol, c
|
||||
colorLeading = colorTrailing = color;
|
||||
|
||||
float fAddAlpha = m_ColorNote[iCol].GetAddAlphaFromDiffuseAlpha( fAlpha );
|
||||
if( m_fOverrideAdd != -1 )
|
||||
fAddAlpha = m_fOverrideAdd;
|
||||
int iGrayPartFrameNo = m_ColorNote[iCol].GetGrayPartFrameNoFromIndexAndBeat( roundf(fIndex), GAMESTATE->m_fSongBeat );
|
||||
|
||||
|
||||
@@ -114,7 +120,10 @@ void NoteField::CreateHoldNoteInstance( ColorNoteInstance &cni, const bool bActi
|
||||
const float fYPos = ArrowGetYPos( m_PlayerNumber, fYOffset );
|
||||
const float fRotation = ArrowGetRotation( m_PlayerNumber, iCol, fYOffset );
|
||||
const float fXPos = ArrowGetXPos( m_PlayerNumber, iCol, fYOffset );
|
||||
const float fAlpha = ArrowGetAlpha( m_PlayerNumber, fYPos );
|
||||
float fAlpha = ArrowGetAlpha( m_PlayerNumber, fYPos );
|
||||
|
||||
if( m_fPercentFadeToFail != -1 )
|
||||
fAlpha = 1-m_fPercentFadeToFail;
|
||||
|
||||
int iGrayPartFrameNo;
|
||||
if( bActive )
|
||||
@@ -129,8 +138,6 @@ void NoteField::CreateHoldNoteInstance( ColorNoteInstance &cni, const bool bActi
|
||||
D3DXCOLOR colorTrailing = colorLeading;
|
||||
|
||||
float fAddAlpha = m_ColorNote[iCol].GetAddAlphaFromDiffuseAlpha( fAlpha );
|
||||
if( m_fOverrideAdd != -1 )
|
||||
fAddAlpha = m_fOverrideAdd;
|
||||
|
||||
ColorNoteInstance instance = { fXPos, fYPos, fRotation, fAlpha, colorLeading, colorTrailing, fAddAlpha, iGrayPartFrameNo };
|
||||
cni = instance;
|
||||
@@ -373,3 +380,8 @@ void NoteField::RemoveTapNoteRow( int iIndex )
|
||||
m_TapNotes[c][iIndex] = '0';
|
||||
}
|
||||
|
||||
void NoteField::FadeToFail()
|
||||
{
|
||||
m_fPercentFadeToFail = max( 0.0f, m_fPercentFadeToFail ); // this will slowly increase every Update()
|
||||
// don't fade all over again if this is called twice
|
||||
}
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
|
||||
float m_fBeginMarker, m_fEndMarker; // only used with MODE_EDIT
|
||||
|
||||
float m_fOverrideAdd; // -1 of not overriding
|
||||
void FadeToFail();
|
||||
|
||||
protected:
|
||||
inline void CreateTapNoteInstance( ColorNoteInstance &cni, const int iCol, const float fIndex, const D3DXCOLOR color = D3DXCOLOR(-1,-1,-1,-1) );
|
||||
@@ -48,6 +48,8 @@ protected:
|
||||
inline void DrawBPMText( const int iIndex, const float fBPM );
|
||||
inline void DrawFreezeText( const int iIndex, const float fBPM );
|
||||
|
||||
float m_fPercentFadeToFail; // -1 of not fading to fail
|
||||
|
||||
PlayerNumber m_PlayerNumber;
|
||||
int m_iPixelsToDrawBehind;
|
||||
int m_iPixelsToDrawAhead;
|
||||
|
||||
@@ -69,16 +69,19 @@ void Player::Load( PlayerNumber pn, NoteData* pNoteData, LifeMeter* pLM, ScoreDi
|
||||
|
||||
StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
|
||||
|
||||
// init scoring
|
||||
NoteDataWithScoring::Init();
|
||||
|
||||
// copy note data
|
||||
this->CopyAll( pNoteData );
|
||||
if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && GAMESTATE->m_fSecondsBeforeFail[m_PlayerNumber] != -1 ) // Oni dead
|
||||
this->ClearAll();
|
||||
|
||||
|
||||
m_iNumTapNotes = pNoteData->GetNumTapNotes();
|
||||
m_iTapNotesHit = 0;
|
||||
m_iMeter = GAMESTATE->m_pCurNotes[m_PlayerNumber]->m_iMeter;
|
||||
|
||||
// init scoring
|
||||
NoteDataWithScoring::Init();
|
||||
|
||||
|
||||
if( m_pScore )
|
||||
@@ -131,6 +134,7 @@ void Player::Update( float fDeltaTime )
|
||||
{
|
||||
//LOG->Trace( "Player::Update(%f)", fDeltaTime );
|
||||
|
||||
|
||||
const float fSongBeat = GAMESTATE->m_fSongBeat;
|
||||
|
||||
//
|
||||
@@ -274,6 +278,9 @@ void Player::DrawPrimitives()
|
||||
|
||||
void Player::Step( int col )
|
||||
{
|
||||
if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && GAMESTATE->m_fSecondsBeforeFail[m_PlayerNumber] != -1 ) // Oni dead
|
||||
return; // do nothing
|
||||
|
||||
//LOG->Trace( "Player::HandlePlayerStep()" );
|
||||
|
||||
ASSERT( col >= 0 && col <= m_iNumTracks );
|
||||
|
||||
@@ -47,9 +47,8 @@ public:
|
||||
void Step( int col );
|
||||
|
||||
|
||||
void SetOverrideAdd( float fAdd ) { m_NoteField.m_fOverrideAdd = fAdd; };
|
||||
float GetOverrideAdd() { return m_NoteField.m_fOverrideAdd; };
|
||||
|
||||
void FadeToFail() { m_NoteField.FadeToFail(); };
|
||||
|
||||
protected:
|
||||
int UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat );
|
||||
void OnRowDestroyed( int col, int iStepIndex );
|
||||
|
||||
@@ -437,6 +437,7 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
|
||||
m_textOniPercent[p].SetEffectGlowing( 1.0f );
|
||||
|
||||
float fPercentDancePoints = iActualDancePoints[p] / (float)iPossibleDancePoints[p] + 0.0001f; // correct for rounding errors
|
||||
fPercentDancePoints = max( 0, fPercentDancePoints );
|
||||
m_textOniPercent[p].SetText( ssprintf("%.1f%%", fPercentDancePoints*100) );
|
||||
this->AddSubActor( &m_textOniPercent[p] );
|
||||
|
||||
|
||||
@@ -144,20 +144,27 @@ ScreenGameplay::ScreenGameplay()
|
||||
this->AddSubActor( &m_Background );
|
||||
|
||||
|
||||
m_OniFade.SetOpened();
|
||||
this->AddSubActor( &m_OniFade );
|
||||
|
||||
|
||||
for( p=0; p<NUM_PLAYERS; p++ )
|
||||
{
|
||||
if( !GAMESTATE->IsPlayerEnabled(PlayerNumber(p)) )
|
||||
continue;
|
||||
|
||||
m_Player[p].SetX( (float) GAMESTATE->GetCurrentStyleDef()->m_iCenterX[p] );
|
||||
float fPlayerX = (float) GAMESTATE->GetCurrentStyleDef()->m_iCenterX[p];
|
||||
m_Player[p].SetX( fPlayerX );
|
||||
this->AddSubActor( &m_Player[p] );
|
||||
|
||||
m_sprOniGameOver[p].Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_ONI_GAMEOVER) );
|
||||
m_sprOniGameOver[p].SetX( fPlayerX );
|
||||
m_sprOniGameOver[p].SetY( SCREEN_TOP - m_sprOniGameOver[p].GetZoomedHeight()/2 );
|
||||
m_sprOniGameOver[p].SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // 0 alpha so we don't waste time drawing while not visible
|
||||
this->AddSubActor( &m_sprOniGameOver[p] );
|
||||
}
|
||||
|
||||
|
||||
m_OniFade.SetOpened();
|
||||
this->AddSubActor( &m_OniFade );
|
||||
|
||||
|
||||
//////////////////////////////////
|
||||
// Add all Actors to m_frameTop
|
||||
//////////////////////////////////
|
||||
@@ -397,6 +404,7 @@ ScreenGameplay::ScreenGameplay()
|
||||
|
||||
|
||||
m_soundFail.Load( THEME->GetPathTo(SOUND_GAMEPLAY_FAILED) );
|
||||
m_soundOniDie.Load( THEME->GetPathTo(SOUND_GAMEPLAY_ONI_DIE) );
|
||||
m_announcerReady.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_READY) );
|
||||
if( GAMESTATE->IsExtraStage() || GAMESTATE->IsExtraStage2() )
|
||||
m_announcerHereWeGo.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_HERE_WE_GO_EXTRA) );
|
||||
@@ -420,8 +428,6 @@ ScreenGameplay::ScreenGameplay()
|
||||
m_announcer1000Combo.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_1000_COMBO) );
|
||||
m_announcerComboStopped.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_COMBO_STOPPED) );
|
||||
|
||||
m_announcerCleared.Load( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_CLEARED) );
|
||||
m_announcerFailComment.Load(ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_FAILED) );
|
||||
|
||||
m_soundAssistTick.Load( THEME->GetPathTo(SOUND_GAMEPLAY_ASSIST_TICK) );
|
||||
|
||||
@@ -523,6 +529,14 @@ void ScreenGameplay::LoadNextSong( bool bFirstLoad )
|
||||
if( !GAMESTATE->IsPlayerEnabled(p) )
|
||||
continue;
|
||||
|
||||
// reset oni game over graphic
|
||||
m_sprOniGameOver[p].SetY( SCREEN_TOP - m_sprOniGameOver[p].GetZoomedHeight()/2 );
|
||||
m_sprOniGameOver[p].SetDiffuseColor( D3DXCOLOR(1,1,1,0) ); // 0 alpha so we don't waste time drawing while not visible
|
||||
|
||||
if( GAMESTATE->m_SongOptions.m_LifeType == SongOptions::LIFE_BATTERY && GAMESTATE->m_fSecondsBeforeFail[p] != -1 ) // already failed
|
||||
ShowOniGameOver((PlayerNumber)p);
|
||||
|
||||
|
||||
m_DifficultyBanner[p].SetFromNotes( PlayerNumber(p), GAMESTATE->m_pCurNotes[p] );
|
||||
|
||||
|
||||
@@ -636,13 +650,32 @@ void ScreenGameplay::Update( float fDeltaTime )
|
||||
switch( GAMESTATE->m_SongOptions.m_FailType )
|
||||
{
|
||||
case SongOptions::FAIL_ARCADE:
|
||||
if( AllAreFailing() )
|
||||
SCREENMAN->SendMessageToTopScreen( SM_BeginFailed, 0 );
|
||||
switch( GAMESTATE->m_SongOptions.m_LifeType )
|
||||
{
|
||||
case SongOptions::LIFE_BAR:
|
||||
if( AllAreFailing() ) SCREENMAN->SendMessageToTopScreen( SM_BeginFailed, 0 );
|
||||
if( AllAreInDanger() ) m_Background.TurnDangerOn();
|
||||
else m_Background.TurnDangerOff();
|
||||
break;
|
||||
case SongOptions::LIFE_BATTERY:
|
||||
if( AllFailedEarlier() )SCREENMAN->SendMessageToTopScreen( SM_BeginFailed, 0 );
|
||||
if( AllAreInDanger() ) m_Background.TurnDangerOn();
|
||||
else m_Background.TurnDangerOff();
|
||||
|
||||
if( AllAreInDanger() )
|
||||
m_Background.TurnDangerOn();
|
||||
else
|
||||
m_Background.TurnDangerOff();
|
||||
// check for individual fail
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
if( GAMESTATE->IsPlayerEnabled(p) )
|
||||
if( m_pLifeMeter[p]->IsFailing() && GAMESTATE->m_fSecondsBeforeFail[p] == -1 ) // not yet failed
|
||||
{
|
||||
// kill them!
|
||||
GAMESTATE->m_fSecondsBeforeFail[p] = GAMESTATE->GetElapsedSeconds();
|
||||
m_soundOniDie.PlayRandom();
|
||||
ShowOniGameOver((PlayerNumber)p);
|
||||
m_Player[p].Init(); // remove all notes and scoring
|
||||
m_Player[p].FadeToFail(); // tell the NoteField to fade to white
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SongOptions::FAIL_END_OF_SONG:
|
||||
case SongOptions::FAIL_OFF:
|
||||
@@ -1017,7 +1050,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
|
||||
else
|
||||
{
|
||||
m_StarWipe.CloseWipingRight( SM_ShowCleared );
|
||||
m_announcerCleared.PlayRandom(); // crowd cheer
|
||||
SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_CLEARED) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1154,6 +1187,9 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
|
||||
m_DancingState = STATE_OUTRO;
|
||||
m_soundMusic.Pause();
|
||||
m_StarWipe.CloseWipingRight( SM_None );
|
||||
for( int p=0; p<NUM_PLAYERS; p++ )
|
||||
if( GAMESTATE->IsPlayerEnabled(p) )
|
||||
m_Player[p].FadeToFail();
|
||||
|
||||
this->SendScreenMessage( SM_ShowFailed, 0.2f );
|
||||
break;
|
||||
@@ -1193,7 +1229,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
|
||||
SCREENMAN->SendMessageToTopScreen( SM_HideFailed, 3.0f );
|
||||
break;
|
||||
case SM_PlayFailComment:
|
||||
m_announcerFailComment.PlayRandom();
|
||||
SOUND->PlayOnceStreamedFromDir( ANNOUNCER->GetPathTo(ANNOUNCER_GAMEPLAY_FAILED) );
|
||||
break;
|
||||
case SM_HideFailed:
|
||||
m_sprFailed.StopTweening();
|
||||
@@ -1236,3 +1272,10 @@ void ScreenGameplay::TweenOffScreen()
|
||||
|
||||
}
|
||||
|
||||
void ScreenGameplay::ShowOniGameOver( PlayerNumber p )
|
||||
{
|
||||
m_sprOniGameOver[p].SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
|
||||
m_sprOniGameOver[p].BeginTweening( 0.5f, Actor::TWEEN_BOUNCE_END );
|
||||
m_sprOniGameOver[p].SetTweenY( CENTER_Y );
|
||||
m_sprOniGameOver[p].SetEffectBobbing( D3DXVECTOR3(0,6,0), 4 );
|
||||
}
|
||||
|
||||
@@ -110,7 +110,11 @@ private:
|
||||
|
||||
DifficultyBanner m_DifficultyBanner[NUM_PLAYERS];
|
||||
|
||||
Sprite m_sprOniGameOver[NUM_PLAYERS];
|
||||
void ShowOniGameOver( PlayerNumber p );
|
||||
|
||||
RandomSample m_soundFail;
|
||||
RandomSample m_soundOniDie;
|
||||
RandomSample m_announcerReady;
|
||||
RandomSample m_announcerHereWeGo;
|
||||
RandomSample m_announcerDanger;
|
||||
@@ -127,9 +131,6 @@ private:
|
||||
RandomSample m_announcer900Combo;
|
||||
RandomSample m_announcer1000Combo;
|
||||
RandomSample m_announcerComboStopped;
|
||||
RandomStream m_announcerCleared;
|
||||
RandomStream m_announcerFailComment;
|
||||
RandomStream m_announcerGameOver;
|
||||
|
||||
RandomSample m_soundAssistTick;
|
||||
|
||||
|
||||
@@ -130,10 +130,10 @@ void ScreenSelectCourse::TweenOnScreen()
|
||||
|
||||
void ScreenSelectCourse::TweenOffScreen()
|
||||
{
|
||||
m_CourseInfoFrame.BeginTweening( TWEEN_TIME, Actor::TWEEN_BOUNCE_END );
|
||||
m_CourseInfoFrame.BeginTweeningQueued( TWEEN_TIME*1.5f, Actor::TWEEN_BOUNCE_BEGIN );
|
||||
m_CourseInfoFrame.SetTweenXY( COURSE_INFO_FRAME_X - 400, COURSE_INFO_FRAME_Y );
|
||||
|
||||
m_CourseContentsFrame.BeginTweeningQueued( TWEEN_TIME, Actor::TWEEN_BOUNCE_END );
|
||||
m_CourseContentsFrame.BeginTweeningQueued( TWEEN_TIME, Actor::TWEEN_BOUNCE_BEGIN );
|
||||
m_CourseContentsFrame.SetTweenXY( COURSE_CONTENTS_FRAME_X - 400, COURSE_CONTENTS_FRAME_Y );
|
||||
|
||||
m_MusicWheel.TweenOffScreen();
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include "RageLog.h"
|
||||
|
||||
const float NUMBER_X = 16;
|
||||
const float NUMBER_Y = 24;
|
||||
const float NUMBER_Y = 10;
|
||||
|
||||
const float ST_X = NUMBER_X+4;
|
||||
const float ST_Y = NUMBER_Y;
|
||||
|
||||
Reference in New Issue
Block a user