GrayArrow => ReceptorArrow

move ReceptorArrow metrics into NoteSkin
ReceptorArrow metrics, code cleanup
This commit is contained in:
Chris Danford
2003-12-22 10:30:10 +00:00
parent 9453b0b3b3
commit 4ac936cfbf
20 changed files with 308 additions and 243 deletions
+3 -8
View File
@@ -872,7 +872,6 @@ BannerOffCommand=hidden,1
[ScreenGameplay]
ShowEvaluationOnFail=0
PressBlockY=10
StaticBGY=240
StaticBGX=320
PrevScreenArcade=ScreenSelectMusic
@@ -2918,8 +2917,8 @@ PulseZoom=1.2
TweenSeconds=0.05
[Player]
GrayArrowsYStandard=96
GrayArrowsYReverse=384
ReceptorArrowsYStandard=96
ReceptorArrowsYReverse=384
JudgmentXOffsetOneSideP1=0
JudgmentXOffsetOneSideP2=0
JudgmentXOffsetBothSides=0
@@ -2965,10 +2964,6 @@ LabelX=0
LabelY=0
LabelOnCommand=horizalign,left
[GrayArrow]
StepZoom=0.75
StepSeconds=0.10
[CodeDetector]
Easier1=Up,Up
Easier2=MenuUp,MenuUp
@@ -3620,7 +3615,7 @@ CharsZoomLarge=1.5
CharsSpacingY=40
ScrollingCharsColor=0.6,0.8,0.8,1
SelectedCharsColor=0.8,1,1,1
GrayArrowsY=100
ReceptorArrowsY=100
NumCharsToDrawBehind=2
NumCharsToDrawTotal=10
FakeBeatsPerSec=2.5
+1
View File
@@ -295,6 +295,7 @@ public:
static float GetCommandLength( CString command );
virtual void SetState( int iNewState ) {};
virtual void SetSecondsIntoAnimation( float fSeconds ) {};
virtual int GetNumStates() { return 1; };
protected:
+10 -5
View File
@@ -37,9 +37,17 @@ static Actor* LoadActor( CString sPath )
CString sFileName;
ini.GetValue( "Actor", "File", sFileName );
CString sNewPath = Dirname( sPath ) + sFileName;
CString sDir = Dirname( sPath );
sNewPath = DerefRedir( sNewPath );
CStringArray asFiles;
GetDirListing( sDir + sFileName + "*", asFiles );
if( asFiles.empty() )
RageException::Throw( "The actor file '%s' references a file '%s' which doesn't exist.", sPath.c_str(), sFileName.c_str() );
else if( asFiles.size() > 1 )
RageException::Throw( "The actor file '%s' references a file '%s' which has multiple matches.", sPath.c_str(), sFileName.c_str() );
CString sNewPath = DerefRedir( sDir + asFiles[0] );
/* XXX: How to handle translations? Maybe we should have one metrics section,
* "Text", eg:
@@ -71,9 +79,6 @@ static Actor* LoadActor( CString sPath )
}
else
{
if( !DoesFileExist(sNewPath) )
RageException::Throw( "The actor file '%s' references a file '%s' which doesn't exist.", sPath.c_str(), sNewPath.c_str() );
pActor = MakeActor( sNewPath );
}
-110
View File
@@ -1,110 +0,0 @@
#include "global.h"
/*
-----------------------------------------------------------------------------
Class: GrayArrow
Desc: A gray arrow that "receives" ColorNotes.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Ben Nordstrom
Chris Danford
-----------------------------------------------------------------------------
*/
#include "GrayArrow.h"
#include "PrefsManager.h"
#include "GameState.h"
#include <math.h>
#include "ThemeManager.h"
#include "NoteFieldPositioning.h"
#include "NoteSkinManager.h"
#include "RageLog.h"
CachedThemeMetricF GR_STEP_SECONDS ("GrayArrow","StepSeconds");
CachedThemeMetricF GR_STEP_ZOOM ("GrayArrow","StepZoom");
GrayArrow::GrayArrow()
{
GR_STEP_SECONDS.Refresh();
GR_STEP_ZOOM.Refresh();
m_bIsPressed = false;
StopAnimating();
}
bool GrayArrow::Load( CString NoteSkin, PlayerNumber pn, int iColNo )
{
CString Button = g_NoteFieldMode[pn].GrayButtonNames[iColNo];
if( Button == "" )
Button = NoteSkinManager::ColToButtonName( iColNo );
CString sPath = NOTESKIN->GetPathTo( NoteSkin, Button, "receptor" );
bool ret = Sprite::Load( sPath );
// XXX
if( GetNumStates() != 2 &&
GetNumStates() != 3 )
RageException::Throw( "'%s' must have 2 or 3 frames", sPath.c_str() );
sPath = NOTESKIN->GetPathTo( NoteSkin, Button, "KeypressBlock" );
bool ret2 = m_sprPressBlock.Load( sPath );
m_sprPressBlock.SetXY(0, THEME->GetMetricF("ScreenGameplay","PressBlockY"));
return ret && ret2; // return both loaded or fail
}
void GrayArrow::Update( float fDeltaTime )
{
ASSERT( Sprite::GetNumStates() > 0 ); // you forgot to call Load()
Sprite::Update( fDeltaTime );
/* XXX: get rid of this once we update the note skins */
int IdleState = (GetNumStates() == 3)? 0: 1;
int OnState = (GetNumStates() == 3)? 1: 0;
int OffState = (GetNumStates() == 3)? 2: 1;
if( !GAMESTATE->m_bPastHereWeGo )
{
SetState( IdleState );
return;
}
/* These could be metrics or configurable. I'd prefer the flash to
* start on the beat, I think ... -glenn */
/* Start flashing 10% of a beat before the beat starts. */
const float flash_offset = -0.1f;
/* Flash for 20% of a beat. */
const float flash_length = 0.2f;
float cur_beat = GAMESTATE->m_fSongBeat;
/* Beats can start in very negative territory (many BMR songs, Drop Out
* -Remix-). */
cur_beat += 100.0f;
cur_beat -= flash_offset;
float fPercentIntoBeat = fmodf(cur_beat, 1);
SetState( (fPercentIntoBeat<flash_length)? OnState : OffState );
m_sprPressBlock.Update(fDeltaTime);
}
void GrayArrow::Draw()
{
Sprite::Draw();
if(m_bIsPressed)
{
m_sprPressBlock.Draw();
m_bIsPressed = false;
}
}
void GrayArrow::Step()
{
SetZoom( GR_STEP_ZOOM );
StopTweening();
BeginTweening( GR_STEP_SECONDS );
SetZoom( 1 );
}
+9 -3
View File
@@ -2,7 +2,7 @@
#define GRAY_ARROW_H
/*
-----------------------------------------------------------------------------
Class: GrayArrow
Class: ReceptorArrow
Desc: A gray arrow that "receives" ColorNotes.
@@ -16,10 +16,10 @@
#include "Sprite.h"
#include "PlayerNumber.h"
class GrayArrow : public Sprite
class ReceptorArrow : public ActorFrame
{
public:
GrayArrow();
ReceptorArrow();
bool Load( CString NoteSkin, PlayerNumber pn, int iColNo );
virtual void Draw();
@@ -27,6 +27,12 @@ public:
void Step();
void UpdateBars() { m_bIsPressed = true; };
private:
Sprite m_sprReceptorWaiting;
Sprite m_sprReceptorGo;
CString m_sReceptorStepCommand;
Sprite m_sprPressBlock;
bool m_bIsPressed;
};
+2 -2
View File
@@ -163,8 +163,8 @@ ActorsInGameplay = \
ArrowBackdrop.cpp ArrowBackdrop.h ArrowEffects.cpp ArrowEffects.h Background.cpp Background.h \
BeginnerHelper.cpp BeginnerHelper.h \
CombinedLifeMeterTug.h CombinedLifeMeterTug.cpp Combo.cpp Combo.h DancingCharacters.cpp DancingCharacters.h \
GhostArrow.cpp GhostArrow.h GhostArrowRow.cpp GhostArrowRow.h GrayArrow.cpp GrayArrow.h \
GrayArrowRow.cpp GrayArrowRow.h HoldGhostArrow.cpp HoldGhostArrow.h HoldJudgment.cpp HoldJudgment.h \
GhostArrow.cpp GhostArrow.h GhostArrowRow.cpp GhostArrowRow.h ReceptorArrow.cpp ReceptorArrow.h \
ReceptorArrowRow.cpp ReceptorArrowRow.h HoldGhostArrow.cpp HoldGhostArrow.h HoldJudgment.cpp HoldJudgment.h \
Judgment.cpp Judgment.h LifeMeter.h LifeMeterBar.cpp LifeMeterBar.h LifeMeterBattery.cpp LifeMeterBattery.h \
LyricDisplay.cpp LyricDisplay.h NoteDisplay.cpp NoteDisplay.h NoteField.cpp NoteField.h \
NoteFieldPlus.h NoteFieldPlus.cpp Player.cpp Player.h ProTimingDisplay.cpp ProTimingDisplay.h \
+6 -6
View File
@@ -67,7 +67,7 @@ void NoteField::CacheNoteSkin( CString skin )
NoteDisplayCols *nd = new NoteDisplayCols;
for( int c=0; c<GetNumTracks(); c++ )
nd->display[c].Load( c, m_PlayerNumber, skin, m_fYReverseOffsetPixels );
nd->m_GrayArrowRow.Load( m_PlayerNumber, skin, m_fYReverseOffsetPixels );
nd->m_ReceptorArrowRow.Load( m_PlayerNumber, skin, m_fYReverseOffsetPixels );
nd->m_GhostArrowRow.Load( m_PlayerNumber, skin, m_fYReverseOffsetPixels );
m_NoteDisplays[ skin ] = nd;
@@ -156,13 +156,13 @@ void NoteField::Update( float fDeltaTime )
if( LastDisplay )
{
cur->m_GhostArrowRow.CopyTweening( LastDisplay->m_GhostArrowRow );
cur->m_GrayArrowRow.CopyTweening( LastDisplay->m_GrayArrowRow );
cur->m_ReceptorArrowRow.CopyTweening( LastDisplay->m_ReceptorArrowRow );
}
LastDisplay = cur;
}
cur->m_GrayArrowRow.Update( fDeltaTime );
cur->m_ReceptorArrowRow.Update( fDeltaTime );
cur->m_GhostArrowRow.Update( fDeltaTime );
if( m_fPercentFadeToFail >= 0 )
@@ -392,7 +392,7 @@ void NoteField::DrawPrimitives()
ASSERT( !m_BeatToNoteDisplays.empty() );
NoteDisplayCols *cur = SearchForSongBeat();
cur->m_GrayArrowRow.Draw();
cur->m_ReceptorArrowRow.Draw();
//
// Adjust draw range depending on some effects
@@ -625,8 +625,8 @@ void NoteField::FadeToFail()
// don't fade all over again if this is called twice
}
void NoteField::Step( int iCol ) { SearchForSongBeat()->m_GrayArrowRow.Step( iCol ); }
void NoteField::UpdateBars( int iCol ) { SearchForSongBeat()->m_GrayArrowRow.UpdateBars( iCol ); }
void NoteField::Step( int iCol ) { SearchForSongBeat()->m_ReceptorArrowRow.Step( iCol ); }
void NoteField::SetPressed( int iCol ) { SearchForSongBeat()->m_ReceptorArrowRow.SetPressed( iCol ); }
void NoteField::DidTapNote( int iCol, TapNoteScore score, bool bBright ) { SearchForSongBeat()->m_GhostArrowRow.DidTapNote( iCol, score, bBright ); }
void NoteField::DidHoldNote( int iCol ) { SearchForSongBeat()->m_GhostArrowRow.DidHoldNote( iCol ); }
void NoteField::DidTapMine( int iCol, TapNoteScore score ) { SearchForSongBeat()->m_GhostArrowRow.DidTapMine( iCol, score ); }
+3 -3
View File
@@ -22,7 +22,7 @@
#include "NoteDataWithScoring.h"
#include "NoteDisplay.h"
#include "ArrowBackdrop.h"
#include "GrayArrowRow.h"
#include "ReceptorArrowRow.h"
#include "GhostArrowRow.h"
class Song;
@@ -48,7 +48,7 @@ public:
void CacheNoteSkin( CString skin );
void Step( int iCol );
void UpdateBars( int iCol );
void SetPressed( int iCol );
void DidTapNote( int iCol, TapNoteScore score, bool bBright );
void DidHoldNote( int iCol );
void DidTapMine( int iCol, TapNoteScore score );
@@ -76,7 +76,7 @@ protected:
struct NoteDisplayCols
{
NoteDisplay display[MAX_NOTE_TRACKS];
GrayArrowRow m_GrayArrowRow;
ReceptorArrowRow m_ReceptorArrowRow;
GhostArrowRow m_GhostArrowRow;
};
+9 -6
View File
@@ -35,8 +35,8 @@
#include "ScreenGameplay.h" /* for SM_ComboStopped */
#include "ScreenManager.h"
CachedThemeMetricF GRAY_ARROWS_Y_STANDARD ("Player","GrayArrowsYStandard");
CachedThemeMetricF GRAY_ARROWS_Y_REVERSE ("Player","GrayArrowsYReverse");
CachedThemeMetricF GRAY_ARROWS_Y_STANDARD ("Player","ReceptorArrowsYStandard");
CachedThemeMetricF GRAY_ARROWS_Y_REVERSE ("Player","ReceptorArrowsYReverse");
#define JUDGMENT_X( p, both_sides ) THEME->GetMetricF("Player",both_sides ? "JudgmentXOffsetBothSides" : ssprintf("JudgmentXOffsetOneSideP%d",p+1))
#define JUDGMENT_Y THEME->GetMetricF("Player","JudgmentY")
#define JUDGMENT_Y_REVERSE THEME->GetMetricF("Player","JudgmentYReverse")
@@ -265,6 +265,9 @@ void PlayerMinus::Update( float fDeltaTime )
//
UpdateTapNotesMissedOlderThan( GetMaxStepDistanceSeconds() );
//
// update pressed flag
//
int iNumCols = GAMESTATE->GetCurrentStyleDef()->m_iColsPerPlayer;
for( int bar=0; bar < iNumCols; bar++ )
{
@@ -272,7 +275,7 @@ void PlayerMinus::Update( float fDeltaTime )
const GameInput GameI = GAMESTATE->GetCurrentStyleDef()->StyleInputToGameInput( StyleI );
bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI );
if(bIsHoldingButton && !GAMESTATE->m_bDemonstrationOrJukebox)
m_pNoteField->UpdateBars(bar);
m_pNoteField->SetPressed(bar);
}
//
@@ -567,7 +570,7 @@ void PlayerMinus::Step( int col, RageTimer tm )
//LOG->Trace( "iIndexStartLookingAt = %d, iNumElementsToExamine = %d", iIndexStartLookingAt, iNumElementsToExamine );
bool bGrayArrowStep = true;
bool bReceptorArrowStep = true;
if( iIndexOverlappingNote != -1 )
{
@@ -816,7 +819,7 @@ void PlayerMinus::Step( int col, RageTimer tm )
if( score==TNS_MARVELOUS && !GAMESTATE->ShowMarvelous())
score = TNS_PERFECT;
bGrayArrowStep = score < TNS_GOOD;
bReceptorArrowStep = score < TNS_GOOD;
// LOG->Trace("Note offset: %f (fSecondsFromPerfect = %f), Score: %i", fNoteOffset, fSecondsFromPerfect, score);
@@ -856,7 +859,7 @@ void PlayerMinus::Step( int col, RageTimer tm )
if( bGrayArrowStep )
if( bReceptorArrowStep )
m_pNoteField->Step( col );
}
+8
View File
@@ -65,6 +65,14 @@ inline void wrap( int &x, int n)
x %= n;
}
inline void wrap( float &x, float n)
{
if (x<0)
x += ((-x/n)+1)*n;
x = fmodf(x,n);
}
//-----------------------------------------------------------------------------
+84
View File
@@ -0,0 +1,84 @@
#include "global.h"
/*
-----------------------------------------------------------------------------
Class: ReceptorArrow
Desc: See header.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Ben Nordstrom
Chris Danford
-----------------------------------------------------------------------------
*/
#include "ReceptorArrow.h"
#include "PrefsManager.h"
#include "GameState.h"
#include <math.h>
#include "ThemeManager.h"
#include "NoteFieldPositioning.h"
#include "NoteSkinManager.h"
#include "RageLog.h"
#include "RageUtil.h"
ReceptorArrow::ReceptorArrow()
{
m_bIsPressed = false;
StopAnimating();
}
bool ReceptorArrow::Load( CString NoteSkin, PlayerNumber pn, int iColNo )
{
m_PlayerNumber = pn;
m_iColNo = iColNo;
CString sButton = g_NoteFieldMode[pn].GrayButtonNames[iColNo];
if( sButton == "" )
sButton = NoteSkinManager::ColToButtonName( iColNo );
CString sPath;
m_pReceptorWaiting.Load( NOTESKIN->GetPathTo(NoteSkin,sButton,"receptor waiting") );
m_pReceptorGo.Load( NOTESKIN->GetPathTo(NoteSkin,sButton,"receptor go") );
m_sStepCommand = NOTESKIN->GetMetric(GAMESTATE->m_PlayerOptions[pn].m_sNoteSkin,"ReceptorArrow","StepCommand");
m_pPressBlock.Load( NOTESKIN->GetPathTo(NoteSkin,sButton,"KeypressBlock") );
this->AddChild( m_pReceptorWaiting );
this->AddChild( m_pReceptorGo );
this->AddChild( m_pPressBlock );
return true;
}
void ReceptorArrow::Update( float fDeltaTime )
{
ActorFrame::Update( fDeltaTime );
float fPercentIntoBeat = GAMESTATE->m_fSongBeat;
wrap(fPercentIntoBeat, 1); /* Beats can start in very negative territory */
// TODO: Generalize this to allow any actor to animate based on the beat.
m_pReceptorWaiting->SetSecondsIntoAnimation( fPercentIntoBeat );
m_pReceptorGo->SetSecondsIntoAnimation( fPercentIntoBeat );
m_pPressBlock->SetSecondsIntoAnimation( fPercentIntoBeat );
// update pressblock alignment based on scroll direction
bool bReverse = GAMESTATE->m_PlayerOptions[m_PlayerNumber].GetReversePercentForColumn(m_iColNo) > 0.5;
m_pPressBlock->SetVertAlign( bReverse ? Actor::align_bottom : Actor::align_top );
}
void ReceptorArrow::Draw()
{
m_pReceptorGo->SetHidden( !GAMESTATE->m_bPastHereWeGo );
m_pReceptorWaiting->SetHidden( GAMESTATE->m_bPastHereWeGo );
m_pPressBlock->SetHidden( !m_bIsPressed );
ActorFrame::Draw();
}
void ReceptorArrow::Step()
{
m_pReceptorGo->Command( m_sStepCommand );
m_pReceptorWaiting->Command( m_sStepCommand );
}
+43
View File
@@ -0,0 +1,43 @@
#ifndef ReceptorArrow_H
#define ReceptorArrow_H
/*
-----------------------------------------------------------------------------
Class: ReceptorArrow
Desc: A gray arrow that "receives" the colorful note arrows.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Ben Nordstrom
Chris Danford
-----------------------------------------------------------------------------
*/
#include "ActorFrame.h"
#include "ActorUtil.h"
#include "PlayerNumber.h"
class ReceptorArrow : public ActorFrame
{
public:
ReceptorArrow();
bool Load( CString NoteSkin, PlayerNumber pn, int iColNo );
virtual void Draw();
virtual void Update( float fDeltaTime );
void Step();
void SetPressed() { m_bIsPressed = true; };
private:
PlayerNumber m_PlayerNumber;
int m_iColNo;
AutoActor m_pReceptorWaiting;
AutoActor m_pReceptorGo;
CString m_sStepCommand;
AutoActor m_pPressBlock;
bool m_bIsPressed;
};
#endif
@@ -1,7 +1,7 @@
#include "global.h"
/*
-----------------------------------------------------------------------------
Class: GrayArrowRow
Class: ReceptorArrowRow
Desc: See header.
@@ -10,7 +10,7 @@
-----------------------------------------------------------------------------
*/
#include "GrayArrowRow.h"
#include "ReceptorArrowRow.h"
#include "RageUtil.h"
#include "GameConstantsAndTypes.h"
#include "PrefsManager.h"
@@ -20,12 +20,12 @@
#include "NoteFieldPositioning.h"
GrayArrowRow::GrayArrowRow()
ReceptorArrowRow::ReceptorArrowRow()
{
m_iNumCols = 0;
}
void GrayArrowRow::Load( PlayerNumber pn, CString NoteSkin, float fYReverseOffset )
void ReceptorArrowRow::Load( PlayerNumber pn, CString NoteSkin, float fYReverseOffset )
{
m_PlayerNumber = pn;
m_fYReverseOffsetPixels = fYReverseOffset;
@@ -35,51 +35,51 @@ void GrayArrowRow::Load( PlayerNumber pn, CString NoteSkin, float fYReverseOffse
m_iNumCols = pStyleDef->m_iColsPerPlayer;
for( int c=0; c<m_iNumCols; c++ )
m_GrayArrow[c].Load( NoteSkin, m_PlayerNumber, c );
m_ReceptorArrow[c].Load( NoteSkin, m_PlayerNumber, c );
}
void GrayArrowRow::Update( float fDeltaTime )
void ReceptorArrowRow::Update( float fDeltaTime )
{
for( int c=0; c<m_iNumCols; c++ )
{
m_GrayArrow[c].Update( fDeltaTime );
m_GrayArrow[c].SetDiffuse( RageColor(1,1,1,1 - GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].m_fDark) );
m_ReceptorArrow[c].Update( fDeltaTime );
m_ReceptorArrow[c].SetDiffuse( RageColor(1,1,1,1 - GAMESTATE->m_CurrentPlayerOptions[m_PlayerNumber].m_fDark) );
// set arrow XYZ
const float fX = ArrowGetXPos( m_PlayerNumber, c, 0 );
const float fY = ArrowGetYPos( m_PlayerNumber, c, 0, m_fYReverseOffsetPixels );
const float fZ = ArrowGetZPos( m_PlayerNumber, c, 0 );
m_GrayArrow[c].SetX( fX );
m_GrayArrow[c].SetY( fY );
m_GrayArrow[c].SetZ( fZ );
m_ReceptorArrow[c].SetX( fX );
m_ReceptorArrow[c].SetY( fY );
m_ReceptorArrow[c].SetZ( fZ );
}
}
void GrayArrowRow::DrawPrimitives()
void ReceptorArrowRow::DrawPrimitives()
{
for( int c=0; c<m_iNumCols; c++ )
{
g_NoteFieldMode[m_PlayerNumber].BeginDrawTrack(c);
m_GrayArrow[c].Draw();
m_ReceptorArrow[c].Draw();
g_NoteFieldMode[m_PlayerNumber].EndDrawTrack(c);
}
}
void GrayArrowRow::Step( int iCol )
void ReceptorArrowRow::Step( int iCol )
{
ASSERT( iCol >= 0 && iCol < m_iNumCols );
m_GrayArrow[iCol].Step();
m_ReceptorArrow[iCol].Step();
}
void GrayArrowRow::UpdateBars( int iCol )
void ReceptorArrowRow::SetPressed( int iCol )
{
ASSERT( iCol >= 0 && iCol < m_iNumCols );
m_GrayArrow[iCol].UpdateBars();
m_ReceptorArrow[iCol].SetPressed();
}
void GrayArrowRow::CopyTweening( const GrayArrowRow &from )
void ReceptorArrowRow::CopyTweening( const ReceptorArrowRow &from )
{
for( int c=0; c<m_iNumCols; c++ )
m_GrayArrow[c].CopyTweening( from.m_GrayArrow[c] );
m_ReceptorArrow[c].CopyTweening( from.m_ReceptorArrow[c] );
ActorFrame::CopyTweening( from );
}
@@ -1,42 +1,42 @@
#ifndef GRAYARROWROW_H
#define GRAYARROWROW_H
#ifndef ReceptorArrowROW_H
#define ReceptorArrowROW_H
/*
-----------------------------------------------------------------------------
Class: GrayArrowRow
Class: ReceptorArrowRow
Desc: A row of GrayArrow objects
Desc: A row of ReceptorArrow objects
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#include "GrayArrow.h"
#include "ReceptorArrow.h"
#include "ActorFrame.h"
#include "StyleDef.h"
#include "GameConstantsAndTypes.h"
class GrayArrowRow : public ActorFrame
class ReceptorArrowRow : public ActorFrame
{
public:
GrayArrowRow();
ReceptorArrowRow();
void Load( PlayerNumber pn, CString NoteSkin, float fYReverseOffset );
virtual void Update( float fDeltaTime );
virtual void DrawPrimitives();
virtual void CopyTweening( const GrayArrowRow &from );
virtual void CopyTweening( const ReceptorArrowRow &from );
void Step( int iCol );
void UpdateBars( int iCol );
void SetPressed( int iCol );
protected:
int m_iNumCols;
PlayerNumber m_PlayerNumber;
float m_fYReverseOffsetPixels;
GrayArrow m_GrayArrow[MAX_NOTE_TRACKS];
ReceptorArrow m_ReceptorArrow[MAX_NOTE_TRACKS];
};
#endif
+8 -8
View File
@@ -41,7 +41,7 @@
#define CHARS_SPACING_Y THEME->GetMetricF("ScreenNameEntry","CharsSpacingY")
#define SCROLLING_CHARS_COLOR THEME->GetMetricC("ScreenNameEntry","ScrollingCharsColor")
#define SELECTED_CHARS_COLOR THEME->GetMetricC("ScreenNameEntry","SelectedCharsColor")
#define GRAY_ARROWS_Y THEME->GetMetricF("ScreenNameEntry","GrayArrowsY")
#define GRAY_ARROWS_Y THEME->GetMetricF("ScreenNameEntry","ReceptorArrowsY")
#define NUM_CHARS_TO_DRAW_BEHIND THEME->GetMetricI("ScreenNameEntry","NumCharsToDrawBehind")
#define NUM_CHARS_TO_DRAW_TOTAL THEME->GetMetricI("ScreenNameEntry","NumCharsToDrawTotal")
#define FAKE_BEATS_PER_SEC THEME->GetMetricF("ScreenNameEntry","FakeBeatsPerSec")
@@ -55,7 +55,7 @@ float g_fCharsZoomLarge;
float g_fCharsSpacingY;
RageColor g_ScrollingCharsColor;
RageColor g_SelectedCharsColor;
float g_fGrayArrowsY;
float g_fReceptorArrowsY;
int g_iNumCharsToDrawBehind;
int g_iNumCharsToDrawTotal;
float g_fFakeBeatsPerSec;
@@ -104,7 +104,7 @@ ScreenNameEntry::ScreenNameEntry( CString sClassName ) : Screen( sClassName )
g_fCharsSpacingY = CHARS_SPACING_Y;
g_ScrollingCharsColor = SCROLLING_CHARS_COLOR;
g_SelectedCharsColor = SELECTED_CHARS_COLOR;
g_fGrayArrowsY = GRAY_ARROWS_Y;
g_fReceptorArrowsY = GRAY_ARROWS_Y;
g_iNumCharsToDrawBehind = NUM_CHARS_TO_DRAW_BEHIND;
g_iNumCharsToDrawTotal = NUM_CHARS_TO_DRAW_TOTAL;
g_fFakeBeatsPerSec = FAKE_BEATS_PER_SEC;
@@ -191,10 +191,10 @@ ScreenNameEntry::ScreenNameEntry( CString sClassName ) : Screen( sClassName )
/* Ensure that this is up-to-date. */
GAMESTATE->m_pPosition->Load( (PlayerNumber)p );
m_GrayArrowRow[p].Load( (PlayerNumber)p, GAMESTATE->m_PlayerOptions[p].m_sNoteSkin, 0 );
m_GrayArrowRow[p].SetX( (float)GAMESTATE->GetCurrentStyleDef()->m_iCenterX[p] );
m_GrayArrowRow[p].SetY( SCREEN_TOP + 100 );
this->AddChild( &m_GrayArrowRow[p] );
m_ReceptorArrowRow[p].Load( (PlayerNumber)p, GAMESTATE->m_PlayerOptions[p].m_sNoteSkin, 0 );
m_ReceptorArrowRow[p].SetX( (float)GAMESTATE->GetCurrentStyleDef()->m_iCenterX[p] );
m_ReceptorArrowRow[p].SetY( SCREEN_TOP + 100 );
this->AddChild( &m_ReceptorArrowRow[p] );
const StyleDef* pStyleDef = GAMESTATE->GetCurrentStyleDef();
@@ -368,7 +368,7 @@ void ScreenNameEntry::Input( const DeviceInput& DeviceI, const InputEventType ty
int StringIndex = m_ColToStringIndex[StyleI.player][StyleI.col];
if(StringIndex != -1)
{
m_GrayArrowRow[StyleI.player].Step( StyleI.col );
m_ReceptorArrowRow[StyleI.player].Step( StyleI.col );
m_soundStep.Play();
char c = NAME_CHARS[GetClosestCharIndex(m_fFakeBeat)];
m_textSelectedChars[StyleI.player][StyleI.col].SetText( ssprintf("%c",c) );
+2 -2
View File
@@ -13,7 +13,7 @@
#include "BitmapText.h"
#include "Transition.h"
#include "RandomSample.h"
#include "GrayArrowRow.h"
#include "ReceptorArrowRow.h"
#include "BGAnimation.h"
#include "MenuTimer.h"
@@ -37,7 +37,7 @@ private:
BGAnimation m_Background;
GrayArrowRow m_GrayArrowRow[NUM_PLAYERS];
ReceptorArrowRow m_ReceptorArrowRow[NUM_PLAYERS];
BitmapText m_textSelectedChars[NUM_PLAYERS][ABS_MAX_RANKING_NAME_LENGTH];
BitmapText m_textScrollingChars[NUM_PLAYERS][ABS_MAX_RANKING_NAME_LENGTH];
BitmapText m_textCategory[NUM_PLAYERS];
+39 -11
View File
@@ -24,6 +24,7 @@
#include "GameConstantsAndTypes.h"
#include "SDL_utils.h"
#include "ActorUtil.h"
#include "arch/ArchHooks/ArchHooks.h"
Sprite::Sprite()
{
@@ -81,6 +82,8 @@ bool Sprite::LoadFromSpriteFile( RageTextureID ID )
{
LOG->Trace( ssprintf("Sprite::LoadFromSpriteFile(%s)", ID.filename.c_str()) );
retry:
//Init();
m_sSpritePath = ID.filename;
@@ -102,7 +105,20 @@ bool Sprite::LoadFromSpriteFile( RageTextureID ID )
vector<CString> asElementPaths;
GetDirListing( ID.filename + "*", asElementPaths, false, true );
if(asElementPaths.size() == 0)
RageException::Throw( "The sprite file '%s' points to a texture '%s' which doesn't exist.", m_sSpritePath.c_str(), ID.filename.c_str() );
{
CString sMessage = ssprintf( "The sprite file '%s' points to a texture '%s' which doesn't exist.", m_sSpritePath.c_str(), ID.filename.c_str() );
switch( HOOKS->MessageBoxAbortRetryIgnore(sMessage) )
{
case ArchHooks::abort:
RageException::Throw( "Error reading value 'Texture' from %s.", m_sSpritePath.c_str() );
case ArchHooks::retry:
goto retry;
case ArchHooks::ignore:
return false;
default:
ASSERT(0);
}
}
if(asElementPaths.size() > 1)
{
CString message = ssprintf(
@@ -206,6 +222,20 @@ bool Sprite::LoadFromTexture( RageTextureID ID )
}
void Sprite::UpdateAnimationState()
{
// Don't bother with state switching logic if there's only one state.
// We already know what's going to show.
if( m_States.size() > 1 )
{
while( m_fSecsIntoState > m_States[m_iCurState].fDelay ) // it's time to switch frames
{
// increment frame and reset the counter
m_fSecsIntoState -= m_States[m_iCurState].fDelay; // leave the left over time for the next frame
m_iCurState = (m_iCurState+1) % m_States.size();
}
}
}
void Sprite::Update( float fDelta )
{
@@ -217,17 +247,8 @@ void Sprite::Update( float fDelta )
if( !m_pTexture ) // no texture, nothing to animate
return;
//
// update animation frame
//
m_fSecsIntoState += fDelta;
while( m_fSecsIntoState > m_States[m_iCurState].fDelay ) // it's time to switch frames
{
// increment frame and reset the counter
m_fSecsIntoState -= m_States[m_iCurState].fDelay; // leave the left over time for the next frame
m_iCurState = (m_iCurState+1) % m_States.size();
}
UpdateAnimationState();
//
// update scrolling
@@ -566,6 +587,13 @@ void Sprite::SetState( int iNewState )
m_fSecsIntoState = 0.0;
}
void Sprite::SetSecondsIntoAnimation( float fSeconds )
{
SetState( 0 ); // rewind to the first state
m_fSecsIntoState = fSeconds;
UpdateAnimationState();
}
CString Sprite::GetTexturePath() const
{
if( m_pTexture==NULL )
+2
View File
@@ -26,6 +26,7 @@ public:
virtual void DrawPrimitives();
virtual void Update( float fDeltaTime );
void UpdateAnimationState(); // take m_fSecondsIntoState, and move to a new state
/* Just a convenience function; load an image that'll be used in the
* background. */
@@ -37,6 +38,7 @@ public:
virtual void EnableAnimation( bool bEnable );
virtual void SetState( int iNewState );
virtual void SetSecondsIntoAnimation( float fSeconds );
virtual int GetNumStates() { return m_States.size(); };
CString GetTexturePath() const;
+46 -46
View File
@@ -58,14 +58,14 @@ BSC32=bscmake.exe
LINK32=link.exe
# ADD BASE LINK32 $(intdir)\verstub.obj kernel32.lib shell32.lib user32.lib gdi32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /pdb:"../debug6/StepMania-debug.pdb" /map /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /out:"../StepMania-debug.exe"
# SUBTRACT BASE LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
# ADD LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /out:"../Program/StepMania-debug.exe"
# ADD LINK32 $(intdir)\verstub.obj kernel32.lib gdi32.lib shell32.lib user32.lib advapi32.lib winmm.lib /nologo /subsystem:windows /map /debug /machine:I386 /nodefaultlib:"libcmtd.lib" /out:"../../itg/Program/StepMania-debug.exe"
# SUBTRACT LINK32 /verbose /profile /pdb:none /incremental:no /nodefaultlib
# Begin Special Build Tool
IntDir=.\../Debug6
TargetDir=\stepmania\stepmania\Program
TargetDir=\stepmania\itg\Program
TargetName=StepMania-debug
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool
@@ -102,8 +102,8 @@ IntDir=.\Debug
TargetDir=\stepmania\stepmania
TargetName=default
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
/Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
/Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool
@@ -143,7 +143,7 @@ IntDir=.\../Release6
TargetDir=\stepmania\stepmania\Program
TargetName=StepMania
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool
@@ -184,8 +184,8 @@ IntDir=.\StepMania___Xbox_Release
TargetDir=\stepmania\stepmania
TargetName=default
SOURCE="$(InputPath)"
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
/Fo$(IntDir)\
PreLink_Cmds=disasm\verinc cl /Zl /nologo /c verstub.cpp \
/Fo$(IntDir)\
PostBuild_Cmds=disasm\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi ia32.vdi
# End Special Build Tool
@@ -3277,44 +3277,6 @@ SOURCE=.\GhostArrowRow.h
# End Source File
# Begin Source File
SOURCE=.\GrayArrow.cpp
!IF "$(CFG)" == "StepMania - Win32 Debug"
!ELSEIF "$(CFG)" == "StepMania - Xbox Debug"
!ELSEIF "$(CFG)" == "StepMania - Win32 Release"
!ELSEIF "$(CFG)" == "StepMania - Xbox Release"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\GrayArrow.h
# End Source File
# Begin Source File
SOURCE=.\GrayArrowRow.cpp
!IF "$(CFG)" == "StepMania - Win32 Debug"
!ELSEIF "$(CFG)" == "StepMania - Xbox Debug"
!ELSEIF "$(CFG)" == "StepMania - Win32 Release"
!ELSEIF "$(CFG)" == "StepMania - Xbox Release"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\GrayArrowRow.h
# End Source File
# Begin Source File
SOURCE=.\HoldGhostArrow.cpp
!IF "$(CFG)" == "StepMania - Win32 Debug"
@@ -3547,6 +3509,44 @@ SOURCE=.\ProTimingDisplay.h
# End Source File
# Begin Source File
SOURCE=.\ReceptorArrow.cpp
!IF "$(CFG)" == "StepMania - Win32 Debug"
!ELSEIF "$(CFG)" == "StepMania - Xbox Debug"
!ELSEIF "$(CFG)" == "StepMania - Win32 Release"
!ELSEIF "$(CFG)" == "StepMania - Xbox Release"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\ReceptorArrow.h
# End Source File
# Begin Source File
SOURCE=.\ReceptorArrowRow.cpp
!IF "$(CFG)" == "StepMania - Win32 Debug"
!ELSEIF "$(CFG)" == "StepMania - Xbox Debug"
!ELSEIF "$(CFG)" == "StepMania - Win32 Release"
!ELSEIF "$(CFG)" == "StepMania - Xbox Release"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\ReceptorArrowRow.h
# End Source File
# Begin Source File
SOURCE=.\ScoreDisplay.cpp
!IF "$(CFG)" == "StepMania - Win32 Debug"
+4 -4
View File
@@ -1416,16 +1416,16 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
RelativePath="GhostArrowRow.h">
</File>
<File
RelativePath=".\GrayArrow.cpp">
RelativePath=".\ReceptorArrow.cpp">
</File>
<File
RelativePath=".\GrayArrow.h">
RelativePath=".\ReceptorArrow.h">
</File>
<File
RelativePath="GrayArrowRow.cpp">
RelativePath="ReceptorArrowRow.cpp">
</File>
<File
RelativePath="GrayArrowRow.h">
RelativePath="ReceptorArrowRow.h">
</File>
<File
RelativePath=".\HoldGhostArrow.cpp">