no message

This commit is contained in:
Chris Danford
2002-06-27 17:49:10 +00:00
parent eaa6be3a71
commit cf9b808ea3
37 changed files with 551 additions and 285 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ float ArrowGetAlpha( const PlayerOptions& po, float fYPos )
fAlpha = (fYPos-100)/200;
break;
case PlayerOptions::APPEARANCE_SUDDEN:
fAlpha = ((SCREEN_HEIGHT-fYPos)-280)/200;
fAlpha = ((SCREEN_HEIGHT-fYPos)-260)/200;
break;
case PlayerOptions::APPEARANCE_STEALTH:
fAlpha = 0;
+30 -15
View File
@@ -17,7 +17,8 @@
#include "RageBitmapTexture.h"
const CString VIS_DIR = "Visualizations\\";
const CString MOVIE_VIS_DIR = "Visualizations\\";
const CString BG_ANIMS_DIR = "BGAnimations\\";
Background::Background()
@@ -34,16 +35,28 @@ Background::Background()
m_sprDangerBackground.Load( THEME->GetPathTo(GRAPHIC_GAMEPLAY_DANGER_BACKGROUND) );
m_sprDangerBackground.StretchTo( CRect((int)SCREEN_LEFT, (int)SCREEN_TOP, (int)SCREEN_RIGHT, (int)SCREEN_BOTTOM) );
// Load background animations
m_BackgroundAnimations.Add( new BackgroundAnimation(NULL) );
m_pCurBackgroundAnimation = NULL;
}
bool Background::LoadFromSong( Song* pSong, bool bDisableVisualizations )
{
// load song background
//
// Load background animations
//
CStringArray asBGAnimNames;
GetDirListing( BG_ANIMS_DIR+"*.*", asBGAnimNames, true );
SortCStringArray( asBGAnimNames );
for( int i=0; i<asBGAnimNames.GetSize(); i++ )
{
if( stricmp(asBGAnimNames[i], "CVS") == 0 ) // if this directory is named CVS, skip it
continue; // skip
m_BackgroundAnimations.Add( new BackgroundAnimation(BG_ANIMS_DIR+asBGAnimNames[i], pSong) );
}
//
// load song background
//
CString sBackgroundMoviePath;
if( pSong->HasBackgroundMovie() )
{
@@ -67,14 +80,14 @@ bool Background::LoadFromSong( Song* pSong, bool bDisableVisualizations )
{
// load a random visualization
CStringArray sVisualizationNames;
GetDirListing( VIS_DIR + "*.avi", sVisualizationNames );
GetDirListing( VIS_DIR + "*.mpg", sVisualizationNames );
GetDirListing( VIS_DIR + "*.mpeg", sVisualizationNames );
GetDirListing( MOVIE_VIS_DIR + "*.avi", sVisualizationNames );
GetDirListing( MOVIE_VIS_DIR + "*.mpg", sVisualizationNames );
GetDirListing( MOVIE_VIS_DIR + "*.mpeg", sVisualizationNames );
if( sVisualizationNames.GetSize() > 0 ) // there is at least one visualization
{
int iIndexRandom = rand() % sVisualizationNames.GetSize();
m_sprVisualizationOverlay.Load( VIS_DIR + sVisualizationNames[iIndexRandom] );
m_sprVisualizationOverlay.Load( MOVIE_VIS_DIR + sVisualizationNames[iIndexRandom] );
m_sprVisualizationOverlay.StretchTo( CRect( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) );
m_sprVisualizationOverlay.SetZoomY( m_sprVisualizationOverlay.GetZoomY()*-1 );
m_sprVisualizationOverlay.SetBlendModeAdd();
@@ -94,8 +107,11 @@ void Background::Update( float fDeltaTime )
m_pCurBackgroundAnimation = NULL;
else
{
int iIndexToSwitchTo = int(m_fSongBeat/BEATS_PER_MEASURE/2) % m_BackgroundAnimations.GetSize();
m_pCurBackgroundAnimation = m_BackgroundAnimations[ iIndexToSwitchTo ];
if( m_BackgroundAnimations.GetSize() > 0 )
{
int iIndexToSwitchTo = int(m_fSongBeat/BEATS_PER_MEASURE/4) % m_BackgroundAnimations.GetSize();
m_pCurBackgroundAnimation = m_BackgroundAnimations[ iIndexToSwitchTo ];
}
}
@@ -145,21 +161,20 @@ void Background::DrawPrimitives()
{
case VIS_MODE_ANIMATION:
if( m_pCurBackgroundAnimation )
m_pCurBackgroundAnimation->DrawPrimitives();
m_pCurBackgroundAnimation->Draw();
else
m_sprSongBackground.Draw();
break;
case VIS_MODE_MOVIE:
m_sprSongBackground.Draw();
m_sprVisualizationOverlay.Draw();
// fall through and draw background
break;
case VIS_MODE_NONE:
m_sprSongBackground.Draw();
break;
}
m_sprSongBackground.Draw();
m_sprVisualizationOverlay.Draw();
}
}
+7 -15
View File
@@ -33,29 +33,21 @@ public:
if( pNotes != NULL )
{
SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
SetFromDescription( pNotes->m_sDescription );
switch( pNotes->m_DifficultyClass )
{
case CLASS_EASY: SetState( 0 ); break;
case CLASS_MEDIUM: SetState( 1 ); break;
case CLASS_HARD: SetState( 2 ); break;
}
}
else
{
SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
SetFromDescription( "" );
SetState( 0 );
}
};
private:
void SetFromDescription( const CString &sDescription )
{
CString sTemp = sDescription;
sTemp.MakeLower();
if( sTemp.Find( "basic" ) != -1 ) SetState( 0 );
else if( sTemp.Find( "trick" ) != -1 ) SetState( 1 );
else if( sTemp.Find( "another" ) != -1 ) SetState( 1 );
else if( sTemp.Find( "maniac" ) != -1 ) SetState( 2 );
else if( sTemp.Find( "ssr" ) != -1 ) SetState( 2 );
else if( sTemp.Find( "battle" ) != -1 ) SetState( 0 );
else if( sTemp.Find( "couple" ) != -1 ) SetState( 0 );
else SetState( 0 );
};
};
+6 -15
View File
@@ -21,7 +21,7 @@ FootMeter::FootMeter()
{
Load( THEME->GetPathTo(FONT_METER) );
SetNumFeet( 0, "" );
SetFromNotes( NULL );
}
void FootMeter::SetFromNotes( Notes* pNotes )
@@ -29,12 +29,13 @@ void FootMeter::SetFromNotes( Notes* pNotes )
if( pNotes != NULL )
{
SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
SetNumFeet( pNotes->m_iMeter, pNotes->m_sDescription );
SetNumFeet( pNotes->m_iMeter );
if( pNotes->m_iMeter >= 10 )
this->SetEffectGlowing();
else
this->SetEffectNone();
SetDiffuseColor( pNotes->GetColor() );
this->StopTweening();
this->SetZoom( 1.1f );
this->BeginTweening( 0.3f, TWEEN_BOUNCE_BEGIN );
@@ -43,12 +44,12 @@ void FootMeter::SetFromNotes( Notes* pNotes )
else
{
this->SetEffectNone();
SetDiffuseColor( D3DXCOLOR(1,1,1,0) );
SetNumFeet( 0, "" );
SetDiffuseColor( D3DXCOLOR(0.8f,0.8f,0.8f,1) );
SetNumFeet( 0 );
}
}
void FootMeter::SetNumFeet( int iNumFeet, const CString &sDescription )
void FootMeter::SetNumFeet( int iNumFeet )
{
CString sNewText;
for( int f=0; f<=8; f++ )
@@ -59,14 +60,4 @@ void FootMeter::SetNumFeet( int iNumFeet, const CString &sDescription )
SetText( sNewText );
CString sTemp = sDescription;
sTemp.MakeLower();
if( sTemp.Find( "basic" ) != -1 ) SetDiffuseColor( D3DXCOLOR(1,1,0,1) );
else if( sTemp.Find( "trick" ) != -1 ) SetDiffuseColor( D3DXCOLOR(1,0,0,1) );
else if( sTemp.Find( "another" ) != -1 )SetDiffuseColor( D3DXCOLOR(1,0,0,1) );
else if( sTemp.Find( "maniac" ) != -1 ) SetDiffuseColor( D3DXCOLOR(0,1,0,1) );
else if( sTemp.Find( "ssr" ) != -1 ) SetDiffuseColor( D3DXCOLOR(0,1,0,1) );
else if( sTemp.Find( "battle" ) != -1 ) SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
else if( sTemp.Find( "couple" ) != -1 ) SetDiffuseColor( D3DXCOLOR(1,1,1,1) );
else SetDiffuseColor( D3DXCOLOR(0.8f,0.8f,0.8f,1) );
}
+1 -1
View File
@@ -24,5 +24,5 @@ public:
void SetFromNotes( Notes* pNotes );
private:
void SetNumFeet( int iNumFeet, const CString &sDescription );
void SetNumFeet( int iNumFeet );
};
+2 -1
View File
@@ -131,7 +131,8 @@ enum DifficultyClass
CLASS_EASY, // corresponds to Basic
CLASS_MEDIUM, // corresponds to Trick, Another, Standard
CLASS_HARD, // corresponds to Maniac, SSR, Heavy
NUM_DIFFICULTY_CLASSES
NUM_DIFFICULTY_CLASSES,
CLASS_INVALID
};
inline D3DXCOLOR DifficultyClassToColor( DifficultyClass dc )
+3 -3
View File
@@ -41,11 +41,11 @@ void LifeMeterBar::ChangeLife( TapNoteScore score )
case TNS_PERFECT: fDeltaLife = +0.015f; break;
case TNS_GREAT: fDeltaLife = +0.008f; break;
case TNS_GOOD: fDeltaLife = +0.000f; break;
case TNS_BOO: fDeltaLife = -0.050f; break;
case TNS_MISS: fDeltaLife = -0.100f; break;
case TNS_BOO: fDeltaLife = -0.040f; break;
case TNS_MISS: fDeltaLife = -0.080f; break;
}
if( bWasHot && !IsHot() )
if( IsHot() && score < TNS_GREAT )
fDeltaLife = -0.10f; // make it take a while to get back to "doing great"
m_fLifePercentage += fDeltaLife;
+3
View File
@@ -58,6 +58,8 @@ MenuElements::MenuElements()
m_Wipe.SetZ( -2 );
m_Wipe.SetOpened();
this->AddActor( &m_Wipe );
this->AddActor( &m_Invisible );
}
void MenuElements::Load( CString sBackgroundPath, CString sTopEdgePath, CString sHelpText )
@@ -200,6 +202,7 @@ void MenuElements::TweenOffScreenToBlack( ScreenMessage smSendWhenDone, bool bPl
{
TweenTopLayerOffScreen();
TweenBottomLayerOffScreen();
m_Invisible.CloseWipingRight( smSendWhenDone );
}
else
{
+2
View File
@@ -20,6 +20,7 @@
#include "MenuTimer.h"
#include "TransitionFadeWipe.h"
#include "TransitionKeepAlive.h"
#include "TransitionInvisible.h"
const float MENU_ELEMENTS_TWEEN_TIME = 0.30f;
@@ -70,6 +71,7 @@ protected:
TransitionFadeWipe m_Wipe;
TransitionKeepAlive m_KeepAlive;
TransitionInvisible m_Invisible;
RageSoundSample m_soundSwoosh;
RageSoundSample m_soundBack;
+3 -2
View File
@@ -1,11 +1,12 @@
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
File: MotionBlurSprite.h
Class: MotionBlurSprite
Desc: A graphic that appears to blur and come into focus.
Desc: See header.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
+4 -9
View File
@@ -1,17 +1,15 @@
#pragma once
/*
-----------------------------------------------------------------------------
File: MotionBlurSprite.h
Class: MotionBlurSprite
Desc: A graphic that appears to blur and come into focus.
Desc: A sprite that leaves a ghost trail.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#ifndef _MotionBlurSprite_H_
#define _MotionBlurSprite_H_
#include "Sprite.h"
#include "ActorFrame.h"
@@ -116,6 +114,3 @@ protected:
};
#endif
+1 -1
View File
@@ -659,7 +659,7 @@ void MusicWheel::NotesChanged( PlayerNumber pn ) // update grade graphics and to
Notes* m_pNotes = SONGMAN->GetCurrentNotes( pn );
if( m_pNotes )
m_HighScore[pn].SetScore( m_pNotes->m_iTopScore );
m_HighScore[pn].SetScore( (float)m_pNotes->m_iTopScore );
for( int i=0; i<NUM_WHEEL_ITEMS_TO_DRAW; i++ )
{
+2 -3
View File
@@ -552,10 +552,9 @@ void NoteData::Convert2sAnd3sToHoldNotes()
{
if( m_TapNotes[col][i] == '2' ) // this is a HoldNote begin marker
{
for( int j=i; j<MAX_TAP_NOTE_ROWS; j++ ) // search for end of HoldNote
for( int j=i+1; j<MAX_TAP_NOTE_ROWS; j++ ) // search for end of HoldNote
{
if( m_TapNotes[col][j] == '1' ||
m_TapNotes[col][j] == '3' ) // found it!
if( m_TapNotes[col][j] != '0' ) // end on the next note we see
{
HoldNote hn = { col, i, j };
AddHoldNote( hn );
+3 -1
View File
@@ -135,7 +135,9 @@ float NoteDataWithScoring::GetActualAirRadarValue( float fSongSeconds )
float NoteDataWithScoring::GetActualChaosRadarValue( float fSongSeconds )
{
// irregularity of steps
float fReturn = fabsf( GetActualStreamRadarValue(fSongSeconds) - GetActualVoltageRadarValue(fSongSeconds) ) * 2.5f;
float fReturn = GetChaosRadarValue(fSongSeconds) -
(GetStreamRadarValue(fSongSeconds)-GetActualStreamRadarValue(fSongSeconds)) -
(GetVoltageRadarValue(fSongSeconds)-GetActualVoltageRadarValue(fSongSeconds));
return min( fReturn, 1.2f );
}
+8 -3
View File
@@ -35,6 +35,8 @@ NoteField::NoteField()
m_Mode = MODE_DANCING;
m_fBeginMarker = m_fEndMarker = -1;
m_fOverrideAlpha = -1;
}
@@ -80,7 +82,9 @@ void NoteField::CreateTapNoteInstance( ColorNoteInstance &cni, const int iCol, c
const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset );
const float fRotation = ArrowGetRotation( m_PlayerOptions, iCol, fYOffset );
const float fXPos = ArrowGetXPos( m_PlayerOptions, iCol, fYOffset, m_fSongBeat );
const float fAlpha = ArrowGetAlpha( m_PlayerOptions, fYPos );
float fAlpha = ArrowGetAlpha( m_PlayerOptions, fYPos );
if( m_fOverrideAlpha != -1 )
fAlpha = m_fOverrideAlpha;
D3DXCOLOR colorLeading, colorTrailing; // of the color part. Alpha here be overwritten with fAlpha!
if( color.a == -1 ) // indicated "NULL"
@@ -104,8 +108,9 @@ void NoteField::CreateHoldNoteInstance( ColorNoteInstance &cni, const bool bActi
const float fYPos = ArrowGetYPos( m_PlayerOptions, fYOffset );
const float fRotation = ArrowGetRotation( m_PlayerOptions, iCol, fYOffset );
const float fXPos = ArrowGetXPos( m_PlayerOptions, iCol, fYOffset, m_fSongBeat );
const float fAlpha = ArrowGetAlpha( m_PlayerOptions, fYPos );
float fAlpha = ArrowGetAlpha( m_PlayerOptions, fYPos );
if( m_fOverrideAlpha != -1 )
fAlpha = m_fOverrideAlpha;
int iGrayPartFrameNo;
if( bActive && m_Mode == MODE_DANCING )
+2
View File
@@ -45,6 +45,8 @@ public:
float m_fBeginMarker, m_fEndMarker; // only used with MODE_EDIT
float m_fOverrideAlpha; // -1 of not overriding
protected:
inline void CreateTapNoteInstance( ColorNoteInstance &cni, const int iCol, const float fIndex, const D3DXCOLOR color = D3DXCOLOR(-1,-1,-1,-1) );
inline void CreateHoldNoteInstance( ColorNoteInstance &cni, const bool bActive, const float fIndex, const HoldNote &hn, const float fHoldNoteLife );
+118 -73
View File
@@ -106,50 +106,70 @@ void Notes::ReadFromCacheFile( FILE* file, bool bLoadNoteData )
}
}
// BMS encoding: tap-hold
// 4&8panel: Player1 Player2
// Left 11-51 21-61
// Down 13-53 23-63
// Up 15-55 25-65
// Right 16-56 26-66
// 6panel: Player1
// Left 11-51
// Left+Up 12-52
// Down 13-53
// Up 14-54
// Up+Right 15-55
// Right 16-56
//
// Notice that 15 and 25 have double meanings! What were they thinking???
// While reading in, use the 6 panel mapping. After reading in, detect if only 4 notes
// are used. If so, shift the Up+Right column back to the Up column
//
void mapBMSTrackToDanceNote( int iBMSTrack, int &iDanceColOut, char &cNoteCharOut )
{
if( iBMSTrack > 40 )
{
cNoteCharOut = '2';
iBMSTrack -= 40;
}
else
{
cNoteCharOut = '1';
}
switch( iBMSTrack )
{
case 11: iDanceColOut = DANCE_NOTE_PAD1_LEFT; break;
case 12: iDanceColOut = DANCE_NOTE_PAD1_UPLEFT; break;
case 13: iDanceColOut = DANCE_NOTE_PAD1_DOWN; break;
case 14: iDanceColOut = DANCE_NOTE_PAD1_UP; break;
case 15: iDanceColOut = DANCE_NOTE_PAD1_UPRIGHT; break;
case 16: iDanceColOut = DANCE_NOTE_PAD1_RIGHT; break;
case 21: iDanceColOut = DANCE_NOTE_PAD2_LEFT; break;
case 22: iDanceColOut = DANCE_NOTE_PAD2_UPLEFT; break;
case 23: iDanceColOut = DANCE_NOTE_PAD2_DOWN; break;
case 24: iDanceColOut = DANCE_NOTE_PAD2_UP; break;
case 25: iDanceColOut = DANCE_NOTE_PAD2_UPRIGHT; break;
case 26: iDanceColOut = DANCE_NOTE_PAD2_RIGHT; break;
default: iDanceColOut = -1; break;
}
}
bool Notes::LoadFromBMSFile( const CString &sPath )
{
LOG->WriteLine( "Notes::LoadFromBMSFile( '%s' )", sPath );
this->GetNoteData(); // make sure NoteData is loaded
// BMS encoding:
// 4&8panel: Player1 Player2
// Left 11 21
// Down 13 23
// Up 15 25
// Right 16 26
// 6panel: Player1 Player2
// Left 11 21
// Left+Up 12 22
// Down 13 23
// Up 14 24
// Up+Right 15 25
// Right 16 26
//
// Notice that 15 and 25 have double meanings! What were they thinking???
// While reading in, use the 6 panel mapping. After reading in, detect if only 4 notes
// are used. If so, shift the Up+Right column back to the Up column
//
CMap<int, int, int, int> mapBMSTrackToDanceNote;
mapBMSTrackToDanceNote[11] = DANCE_NOTE_PAD1_LEFT;
mapBMSTrackToDanceNote[12] = DANCE_NOTE_PAD1_UPLEFT;
mapBMSTrackToDanceNote[13] = DANCE_NOTE_PAD1_DOWN;
mapBMSTrackToDanceNote[14] = DANCE_NOTE_PAD1_UP;
mapBMSTrackToDanceNote[15] = DANCE_NOTE_PAD1_UPRIGHT;
mapBMSTrackToDanceNote[16] = DANCE_NOTE_PAD1_RIGHT;
mapBMSTrackToDanceNote[21] = DANCE_NOTE_PAD2_LEFT;
mapBMSTrackToDanceNote[22] = DANCE_NOTE_PAD2_UPLEFT;
mapBMSTrackToDanceNote[23] = DANCE_NOTE_PAD2_DOWN;
mapBMSTrackToDanceNote[24] = DANCE_NOTE_PAD2_UP;
mapBMSTrackToDanceNote[25] = DANCE_NOTE_PAD2_UPRIGHT;
mapBMSTrackToDanceNote[26] = DANCE_NOTE_PAD2_RIGHT;
bool tempNotes[MAX_NOTE_TRACKS][MAX_TAP_NOTE_ROWS];
int tempNotes[MAX_NOTE_TRACKS][MAX_TAP_NOTE_ROWS];
for( int t=0; t<MAX_NOTE_TRACKS; t++ )
{
for( int i=0; i<MAX_TAP_NOTE_ROWS; i++ )
tempNotes[t][i] = false;
tempNotes[t][i] = '0';
}
@@ -157,7 +177,7 @@ bool Notes::LoadFromBMSFile( const CString &sPath )
CStdioFile file;
if( !file.Open( sPath, CFile::modeRead|CFile::shareDenyNone ) )
{
throw RageException( ssprintf("Failed to open %s.", sPath) );
throw RageException( "Failed to open %s.", sPath );
return false;
}
@@ -232,8 +252,6 @@ bool Notes::LoadFromBMSFile( const CString &sPath )
if( -1 != value_name.Find("#playlevel") )
{
m_iMeter = atoi( value_data );
// Should we calculate m_DifficultyClass here?
}
else if( value_name.Left(1) == "#"
&& IsAnInt( value_name.Mid(1,3) )
@@ -262,9 +280,12 @@ bool Notes::LoadFromBMSFile( const CString &sPath )
const int iNoteIndex = (int) ( (iMeasureNo + fPercentThroughMeasure)
* BEATS_PER_MEASURE * ELEMENTS_PER_BEAT );
const int iColumnNumber = mapBMSTrackToDanceNote[iTrackNum];
int iColumnNumber;
char cNoteChar;
mapBMSTrackToDanceNote( iTrackNum, iColumnNumber, cNoteChar );
tempNotes[iColumnNumber][iNoteIndex] = true;
if( iColumnNumber != -1 )
tempNotes[iColumnNumber][iNoteIndex] = cNoteChar;
}
}
}
@@ -276,15 +297,15 @@ bool Notes::LoadFromBMSFile( const CString &sPath )
{
for( int i=0; i<MAX_TAP_NOTE_ROWS; i++ ) // for each TapNote
{
if( tempNotes[DANCE_NOTE_PAD1_UPRIGHT][i] ) // if up+right is a step
if( tempNotes[DANCE_NOTE_PAD1_UPRIGHT][i] != '0' ) // if up+right is a step
{
tempNotes[DANCE_NOTE_PAD1_UP][i] = true; // add up
tempNotes[DANCE_NOTE_PAD1_UPRIGHT][i] = false; // subtract up+right
tempNotes[DANCE_NOTE_PAD1_UP][i] = tempNotes[DANCE_NOTE_PAD1_UPRIGHT][i]; // add up
tempNotes[DANCE_NOTE_PAD1_UPRIGHT][i] = '0'; // subtract up+right
}
if( tempNotes[DANCE_NOTE_PAD2_UPRIGHT][i] ) // if up+right is a step
if( tempNotes[DANCE_NOTE_PAD2_UPRIGHT][i] != '0' ) // if up+right is a step
{
tempNotes[DANCE_NOTE_PAD2_UP][i] = true; // add up
tempNotes[DANCE_NOTE_PAD2_UPRIGHT][i] = false; // subtract up+right
tempNotes[DANCE_NOTE_PAD2_UP][i] = tempNotes[DANCE_NOTE_PAD2_UPRIGHT][i]; // add up
tempNotes[DANCE_NOTE_PAD2_UPRIGHT][i] = '0'; // subtract up+right
}
}
}
@@ -341,13 +362,14 @@ bool Notes::LoadFromBMSFile( const CString &sPath )
for( int i=0; i<MAX_TAP_NOTE_ROWS; i++ ) // foreach TapNote element
{
if( tempNotes[iTempCol][i] )
m_pNoteData->m_TapNotes[iNoteDataCol][i] = '1';
m_pNoteData->m_TapNotes[iNoteDataCol][i] = tempNotes[iTempCol][i];
}
}
m_pNoteData->m_iNumTracks = mapDanceNoteToNoteDataColumn.GetCount();
m_pNoteData->Convert2sAnd3sToHoldNotes();
// search for runs of 32nd notes of all the same note type, and convert them to freezes
for( int iCol=0; iCol<mapDanceNoteToNoteDataColumn.GetCount(); iCol++ )
@@ -402,6 +424,20 @@ bool Notes::LoadFromBMSFile( const CString &sPath )
}
m_DifficultyClass = DifficultyClassFromDescriptionAndMeter( m_sDescription, m_iMeter );
if( m_iMeter == 0 )
{
switch( m_DifficultyClass )
{
case CLASS_EASY: m_iMeter = 3; break;
case CLASS_MEDIUM: m_iMeter = 5; break;
case CLASS_HARD: m_iMeter = 8; break;
default: ASSERT(0);
}
}
return true;
}
@@ -503,17 +539,7 @@ bool Notes::LoadFromDWITokens(
m_iMeter = iNumFeet;
if( m_sDescription == "BASIC" ) m_DifficultyClass = CLASS_EASY;
else if( m_sDescription == "ANOTHER" ) m_DifficultyClass = CLASS_MEDIUM;
else if( m_sDescription == "MANIAC" ) m_DifficultyClass = CLASS_HARD;
else if( m_sDescription == "SMANIAC" ) m_DifficultyClass = CLASS_HARD;
else
{
// guess difficulty class from m_iMeter
if( m_iMeter <= 3 ) m_DifficultyClass = CLASS_EASY;
else if( m_iMeter <= 6 ) m_DifficultyClass = CLASS_MEDIUM;
else m_DifficultyClass = CLASS_HARD;
}
m_DifficultyClass = DifficultyClassFromDescriptionAndMeter( m_sDescription, m_iMeter );
m_sCredit = "";
@@ -702,23 +728,8 @@ bool Notes::LoadFromNotesFile( const CString &sPath )
else
LOG->WriteLine( "Unexpected value named '%s'", sValueName );
}
if ( stricmp(m_sDescription, "BASIC") == 0 ) m_DifficultyClass = CLASS_EASY;
else if( stricmp(m_sDescription, "TRICK") == 0 ) m_DifficultyClass = CLASS_MEDIUM;
else if( stricmp(m_sDescription, "STANDARD") == 0 ) m_DifficultyClass = CLASS_MEDIUM;
else if( stricmp(m_sDescription, "ANOTHER") == 0 ) m_DifficultyClass = CLASS_MEDIUM;
else if( stricmp(m_sDescription, "SSR") == 0 ) m_DifficultyClass = CLASS_HARD;
else if( stricmp(m_sDescription, "MANIAC") == 0 ) m_DifficultyClass = CLASS_HARD;
else if( stricmp(m_sDescription, "HEAVY") == 0 ) m_DifficultyClass = CLASS_HARD;
else if( stricmp(m_sDescription, "SMANIAC") == 0 ) m_DifficultyClass = CLASS_HARD;
else
{
// guess difficulty class from m_iMeter
if( m_iMeter <= 3 ) m_DifficultyClass = CLASS_EASY;
else if( m_iMeter <= 6 ) m_DifficultyClass = CLASS_MEDIUM;
else m_DifficultyClass = CLASS_HARD;
}
m_DifficultyClass = DifficultyClassFromDescriptionAndMeter( m_sDescription, m_iMeter );
return true;
}
@@ -751,6 +762,40 @@ void Notes::SaveToSMDir( CString sSongDir )
file.Close();
}
DifficultyClass Notes::DifficultyClassFromDescriptionAndMeter( CString sDifficulty, int iMeter )
{
sDifficulty.MakeLower();
const CString sDescriptionParts[NUM_DIFFICULTY_CLASSES][3] = {
{
"basic",
"light",
"SDFKSJDKFJS",
},
{
"another",
"trick",
"standard",
},
{
"ssr",
"maniac",
"heavy",
},
};
for( int i=0; i<NUM_DIFFICULTY_CLASSES; i++ )
for( int j=0; j<3; j++ )
if( sDifficulty.Find(sDescriptionParts[i][j]) != -1 )
return DifficultyClass(i);
// guess difficulty class from meter
if( iMeter <= 3 ) return CLASS_EASY;
else if( iMeter <= 6 ) return CLASS_MEDIUM;
else return CLASS_HARD;
}
bool Notes::IsNoteDataLoaded()
{
return m_pNoteData != NULL;
+3
View File
@@ -72,6 +72,9 @@ public:
void DeleteNoteData();
protected:
static DifficultyClass DifficultyClassFromDescriptionAndMeter( CString sDifficulty, int iMeter );
NoteData* m_pNoteData;
};
+2
View File
@@ -51,6 +51,8 @@ public:
GameplayStatistics GetGameplayStatistics();
void SetOverrideAlpha( float fAlpha ) { m_NoteField.m_fOverrideAlpha = fAlpha; };
float GetOverrideAlpha() { return m_NoteField.m_fOverrideAlpha; };
protected:
void OnRowDestroyed( float fSongBeat, int col, float fMaxBeatDiff, int iStepIndex );
+13 -1
View File
@@ -27,7 +27,7 @@ PrefsManager::PrefsManager()
m_bShowFPS = false;
m_visMode = VIS_MODE_ANIMATION;
m_bAnnouncer = true;
m_bEventMode = true;
m_bEventMode = false;
m_iNumArcadeStages = 3;
m_bAutoPlay = false;
m_fJudgeWindow = 0.10f;
@@ -64,6 +64,10 @@ void PrefsManager::ReadPrefsFromDisk()
ini.GetValueI( "Options", "NumArcadeStages", m_iNumArcadeStages );
ini.GetValueB( "Options", "AutoPlay", m_bAutoPlay );
ini.GetValueF( "Options", "JudgeWindow", m_fJudgeWindow );
CString sAdditionalSongFolders;
ini.GetValue( "Options", "SongFolders", sAdditionalSongFolders );
split( sAdditionalSongFolders, ",", m_asSongFolders, true );
}
@@ -84,6 +88,8 @@ void PrefsManager::SavePrefsToDisk()
ini.SetValueB( "Options", "AutoPlay", m_bAutoPlay );
ini.SetValueF( "Options", "JudgeWindow", m_fJudgeWindow );
ini.SetValue( "Options", "SongFolders", join(",", m_asSongFolders) );
ini.WriteFile();
}
@@ -94,16 +100,22 @@ int PrefsManager::GetStageIndex()
bool PrefsManager::IsFinalStage()
{
if( PREFSMAN->m_bEventMode )
return false;
return m_iCurrentStageIndex == m_iNumArcadeStages-1;
}
bool PrefsManager::IsExtraStage()
{
if( PREFSMAN->m_bEventMode )
return false;
return m_iCurrentStageIndex == m_iNumArcadeStages;
}
bool PrefsManager::IsExtraStage2()
{
if( PREFSMAN->m_bEventMode )
return false;
return m_iCurrentStageIndex == m_iNumArcadeStages+1;
}
+1
View File
@@ -43,6 +43,7 @@ public:
int m_iNumArcadeStages;
bool m_bAutoPlay;
float m_fJudgeWindow;
CStringArray m_asSongFolders;
void ReadPrefsFromDisk();
void SavePrefsToDisk();
+3
View File
@@ -76,6 +76,9 @@ CString vssprintf( LPCTSTR fmt, va_list argList)
//-----------------------------------------------------------------------------
CString join( const CString &Deliminator, const CStringArray& Source)
{
if( Source.GetSize() == 0 )
return "";
CString csReturn;
CString csTmp;
+20 -17
View File
@@ -40,13 +40,16 @@ void ScoreDisplayRolling::Init( PlayerNumber pn, PlayerOptions po, int iOriginal
m_PlayerOptions = po;
m_iTotalNotes = iOriginalNumNotes;
m_iNotesMeter = iNotesMeter;
//for( int i=0; i<iOriginalNumNotes; i++ )
// AddToScore( TNS_GREAT, i );
}
void ScoreDisplayRolling::SetScore( int iNewScore )
void ScoreDisplayRolling::SetScore( float fNewScore )
{
m_iScore = iNewScore;
m_fScore = fNewScore;
float fDelta = m_iScore - m_fTrailingScore;
float fDelta = (float)m_fScore - m_fTrailingScore;
m_fScoreVelocity = fDelta / SCORE_TWEEN_TIME; // in score units per second
}
@@ -54,7 +57,7 @@ void ScoreDisplayRolling::SetScore( int iNewScore )
int ScoreDisplayRolling::GetScore()
{
return m_iScore;
return (int)m_fScore;
}
@@ -62,13 +65,13 @@ void ScoreDisplayRolling::Update( float fDeltaTime )
{
BitmapText::Update( fDeltaTime );
float fDeltaBefore = m_iScore - m_fTrailingScore;
float fDeltaBefore = (float)m_fScore - m_fTrailingScore;
m_fTrailingScore += m_fScoreVelocity * fDeltaTime;
float fDeltaAfter = m_iScore - m_fTrailingScore;
float fDeltaAfter = (float)m_fScore - m_fTrailingScore;
if( fDeltaBefore * fDeltaAfter < 0 ) // the sign changed
{
m_fTrailingScore = (float)m_iScore;
m_fTrailingScore = (float)m_fScore;
m_fScoreVelocity = 0;
}
@@ -76,7 +79,7 @@ void ScoreDisplayRolling::Update( float fDeltaTime )
void ScoreDisplayRolling::Draw()
{
if( m_iScore == 0 )
if( m_fScore == 0 )
{
CString sFormat = ssprintf( "%%%d.0d", NUM_SCORE_DIGITS );
SetText( ssprintf(sFormat, 0) );
@@ -122,14 +125,14 @@ void ScoreDisplayRolling::AddToScore( TapNoteScore score, int iCurCombo )
static int iNumTimesCalled = 0;
iNumTimesCalled ++;
LOG->WriteLine("Called %d times.",iNumTimesCalled);
LOG->WriteLine("Called %d times - param %d.",iNumTimesCalled, iCurCombo);
int p; // score multiplier
switch( score )
{
case TNS_GREAT: p = 10; break;
case TNS_PERFECT: p = 5; break;
case TNS_PERFECT: p = 10; break;
case TNS_GREAT: p = 5; break;
default: p = 0; break;
}
@@ -140,12 +143,12 @@ void ScoreDisplayRolling::AddToScore( TapNoteScore score, int iCurCombo )
int one_step_score = roundf( p * (B/S) * n );
// HACK: The total score is off by a factor of 0.5. For now, multiply by two...
one_step_score *= 2;
m_fScore += one_step_score;
ASSERT( m_fScore >= 0 );
// HACK: The final total is slightly off because of rounding errors
if( fabsf(m_fScore-B*10) < 100.0f )
m_fScore = (float)B*10;
m_iScore += one_step_score;
ASSERT( m_iScore >= 0 );
this->SetScore( m_iScore );
this->SetScore( m_fScore );
}
+2 -2
View File
@@ -26,7 +26,7 @@ public:
void Init( PlayerNumber pn, PlayerOptions po, int iOriginalNumNotes, int iNotesMeter );
void SetScore( int iNewScore );
void SetScore( float fNewScore );
int GetScore();
void AddToScore( TapNoteScore score, int iCurCombo );
@@ -39,7 +39,7 @@ protected:
int m_iTotalNotes;
int m_iNotesMeter;
int m_iScore;
float m_fScore;
float m_fTrailingScore;
float m_fScoreVelocity;
+48 -21
View File
@@ -49,7 +49,9 @@ const float TRY_EXTRA_STAGE_X = CENTER_X;
const float TRY_EXTRA_STAGE_Y = SCREEN_BOTTOM - 60;
const ScreenMessage SM_GoToNextState = ScreenMessage(SM_User+1);
const ScreenMessage SM_GoToSelectMusic = ScreenMessage(SM_User+2);
const ScreenMessage SM_GoToFinalEvaluation = ScreenMessage(SM_User+3);
const ScreenMessage SM_GoToMusicScroll = ScreenMessage(SM_User+4);
ScreenEvaluation::ScreenEvaluation( bool bSummary )
@@ -331,8 +333,8 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
m_textJudgeNumbers[4][p].SetText( ssprintf("%4d", GS[p].miss) );
m_textJudgeNumbers[5][p].SetText( ssprintf("%4d", GS[p].ok) );
m_ScoreDisplay[p].SetScore( GS[p].max_combo * 1000 );
m_ScoreDisplay[p].SetScore( GS[p].score );
m_ScoreDisplay[p].SetScore( (float)GS[p].max_combo * 1000 );
m_ScoreDisplay[p].SetScore( (float)GS[p].score );
switch( m_ResultMode )
{
@@ -393,6 +395,9 @@ ScreenEvaluation::ScreenEvaluation( bool bSummary )
m_bTryExtraStage = true;
}
}
if( PREFSMAN->m_bEventMode )
m_bTryExtraStage = false;
for( p=0; p<NUM_PLAYERS; p++ )
@@ -636,23 +641,15 @@ void ScreenEvaluation::HandleScreenMessage( const ScreenMessage SM )
case SM_MenuTimer:
MenuStart( PLAYER_INVALID );
break;
case SM_GoToNextState:
switch( m_ResultMode )
{
case RM_ARCADE_SUMMARY:
SCREENMAN->SetNewScreen( new ScreenMusicScroll );
return;
case RM_ARCADE_STAGE:
if( m_bTryExtraStage )
SCREENMAN->SetNewScreen( new ScreenSelectMusic );
else
SCREENMAN->SetNewScreen( new ScreenEvaluation(true) );
return;
case RM_ONI:
SCREENMAN->SetNewScreen( new ScreenMusicScroll );
return;
case SM_GoToSelectMusic:
SCREENMAN->SetNewScreen( new ScreenSelectMusic );
break;
case SM_GoToMusicScroll:
SCREENMAN->SetNewScreen( new ScreenMusicScroll );
break;
case SM_GoToFinalEvaluation:
SCREENMAN->SetNewScreen( new ScreenEvaluation(true) );
break;
}
}
}
@@ -665,8 +662,38 @@ void ScreenEvaluation::MenuStart( const PlayerNumber p )
{
TweenOffScreen();
m_Menu.TweenOffScreenToMenu( SM_GoToNextState );
PREFSMAN->m_iCurrentStageIndex++; // increment the stage number before constructing the next screen
switch( m_ResultMode )
{
case RM_ARCADE_SUMMARY:
m_Menu.TweenOffScreenToBlack( SM_GoToMusicScroll, false );
return;
case RM_ARCADE_STAGE:
if( m_bTryExtraStage )
{
PREFSMAN->m_iCurrentStageIndex++;
m_Menu.TweenOffScreenToMenu( SM_GoToSelectMusic );
}
else if(
PREFSMAN->m_iCurrentStageIndex == PREFSMAN->m_iNumArcadeStages-1 ||
PREFSMAN->IsExtraStage() ||
PREFSMAN->IsExtraStage2() )
{
m_Menu.TweenOffScreenToMenu( SM_GoToFinalEvaluation );
}
else
{
PREFSMAN->m_iCurrentStageIndex++;
m_Menu.TweenOffScreenToMenu( SM_GoToSelectMusic );
}
return;
case RM_ONI:
m_Menu.TweenOffScreenToBlack( SM_GoToMusicScroll, false );
return;
default:
ASSERT(0);
}
}
+26 -16
View File
@@ -37,7 +37,7 @@ const float STAGE_NUMBER_LOCAL_Y = +20;
const float SCORE_LOCAL_X[NUM_PLAYERS] = { -214, +214 };
const float SCORE_LOCAL_Y[NUM_PLAYERS] = { -6, -6 };
const float PLAYER_OPTIONS_LOCAL_X[NUM_PLAYERS] = { -214, +214 };
const float PLAYER_OPTIONS_LOCAL_X[NUM_PLAYERS] = { -0, +0 };
const float PLAYER_OPTIONS_LOCAL_Y[NUM_PLAYERS] = { -10, +10 };
const float DIFFICULTY_X[NUM_PLAYERS] = { SCREEN_LEFT+60, SCREEN_RIGHT-60 };
@@ -324,7 +324,7 @@ void ScreenGameplay::LoadNextSong()
PREFSMAN->m_PlayerOptions[p],
&m_LifeMeter[p],
&m_ScoreDisplay[p],
pNotes[p]->GetNoteData()->GetNumTapNotes() + pNotes[p]->GetNoteData()->GetNumHoldNotes()
pNotes[p]->GetNoteData()->GetNumTapNotes()
);
}
@@ -504,6 +504,27 @@ void ScreenGameplay::Update( float fDeltaTime )
iRowLastCrossed = iRowNow;
}
//
if( m_bBothHaveFailed )
{
for( int p=0; p<NUM_PLAYERS; p++ )
{
if( !GAMEMAN->IsPlayerEnabled((PlayerNumber)p) )
continue;
float fOverrideAlpha = m_Player[p].GetOverrideAlpha();
if( fOverrideAlpha == -1 )
{
m_Player[p].SetOverrideAlpha( 0 );
}
else
{
float fNewAlpha = min( 1, fOverrideAlpha + fDeltaTime );
m_Player[p].SetOverrideAlpha( fNewAlpha );
}
}
}
}
@@ -559,21 +580,10 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
if( MenuI.IsValid() )
if( MenuI.IsValid() && MenuI.button == MENU_BUTTON_BACK && type == IET_FAST_REPEAT && m_DancingState == STATE_DANCING && !m_bBothHaveFailed )
{
switch( MenuI.button )
{
case MENU_BUTTON_BACK:
if( m_DancingState == STATE_DANCING
&& !m_bBothHaveFailed )
{
m_bBothHaveFailed = true;
SCREENMAN->SendMessageToTopScreen( SM_BeginFailed, 0 );
}
else
; // do not let user go back!
break;
}
m_bBothHaveFailed = true;
SCREENMAN->SendMessageToTopScreen( SM_BeginFailed, 0 );
}
const float fMaxBeatDifference = fBPS * PREFSMAN->m_fJudgeWindow * PREFSMAN->m_SongOptions.m_fMusicRate;
+2
View File
@@ -205,6 +205,8 @@ void ScreenSelectGroup::AfterChange()
if( m_iSelection == 0 ) arraySongs.Copy( SONGMAN->m_pSongs );
else SONGMAN->GetSongsInGroup( m_arrayGroupNames[m_iSelection], arraySongs );
SortSongPointerArrayByTitle( arraySongs );
for( int i=0; i<NUM_CONTENTS_COLUMNS; i++ )
{
CString sText;
+16 -1
View File
@@ -1,11 +1,12 @@
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
File: ScreenSelectStyle.cpp
Class: ScreenSelectStyle
Desc: Testing the Screen class.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
@@ -81,6 +82,20 @@ ScreenSelectStyle::ScreenSelectStyle()
m_sprInfo.SetXY( INFO_X, INFO_Y );
this->AddActor( &m_sprInfo );
// Load dummy Sprites
for( int i=0; i<m_aPossibleStyles.GetSize(); i++ )
{
ThemeElement te;
te = (ThemeElement)(GRAPHIC_SELECT_STYLE_PREVIEW_GAME_0_STYLE_0+m_aPossibleStyles[i]);
m_sprDummyPreview[i].Load( THEME->GetPathTo(te) );
te = (ThemeElement)(GRAPHIC_SELECT_STYLE_INFO_GAME_0_STYLE_0+m_aPossibleStyles[i]);
m_sprDummyInfo[i].Load( THEME->GetPathTo(te) );
}
m_Menu.Load(
THEME->GetPathTo(GRAPHIC_SELECT_STYLE_BACKGROUND),
THEME->GetPathTo(GRAPHIC_SELECT_STYLE_TOP_EDGE),
+6 -1
View File
@@ -1,10 +1,11 @@
/*
-----------------------------------------------------------------------------
File: ScreenSelectStyle.h
Class: ScreenSelectStyle
Desc: Select the game mode (single, versus, double).
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
@@ -46,6 +47,10 @@ private:
Sprite m_sprPreview;
Sprite m_sprInfo;
// Sprites that are never drawn. They exist to keep the style textures in memory
Sprite m_sprDummyPreview[NUM_STYLES];
Sprite m_sprDummyInfo[NUM_STYLES];
RandomSample m_soundChange;
RandomSample m_soundSelect;
+3 -2
View File
@@ -267,8 +267,9 @@ void ScreenTitleMenu::MenuStart( const PlayerNumber p )
}
return;
case CHOICE_SELECT_GAME:
m_soundSelect.PlayRandom();
m_Fade.CloseWipingRight( SM_GoToSelectGame );
m_soundInvalid.PlayRandom();
//m_soundSelect.PlayRandom();
//m_Fade.CloseWipingRight( SM_GoToSelectGame );
return;
case CHOICE_MAP_INSTRUMENTS:
m_soundSelect.PlayRandom();
+183 -35
View File
@@ -308,7 +308,7 @@ bool Song::LoadFromBMSDir( CString sDir )
GetDirListing( sDir + CString("*.bms"), arrayBMSFileNames );
if( arrayBMSFileNames.GetSize() == 0 )
throw RageException( ssprintf("Couldn't find any BMS files in '%s'", sDir) );
throw RageException( "Couldn't find any BMS files in '%s'", sDir );
// Load the Song info from the first BMS file. Silly BMS duplicates the song info in every
@@ -328,7 +328,7 @@ bool Song::LoadFromBMSDir( CString sDir )
CStdioFile file;
if( !file.Open( m_sSongFilePath, CFile::modeRead|CFile::shareDenyNone ) )
{
throw RageException( ssprintf("Failed to open %s.", m_sSongFilePath) );
throw RageException( "Failed to open %s.", m_sSongFilePath );
return false;
}
@@ -365,38 +365,36 @@ bool Song::LoadFromBMSDir( CString sDir )
// handle the data
if( -1 != value_name.Find("#title") )
if( value_name == "#title" )
{
// strip Notes type out of description leaving only song title (looks like 'B4U <BASIC>')
value_data.Replace( "(ANOTHER)", "" );
value_data.Replace( "(BASIC)", "" );
value_data.Replace( "(MANIAC)", "" );
value_data.Replace( "<ANOTHER>", "" );
value_data.Replace( "<BASIC>", "" );
value_data.Replace( "<MANIAC>", "" );
GetMainAndSubTitlesFromFullTitle( value_data, m_sMainTitle, m_sSubTitle );
// strip Notes type out of description leaving only song title - looks like 'B4U <BASIC>'
int iIndex = value_data.ReverseFind('<');
if( iIndex == -1 )
iIndex = value_data.ReverseFind('(');
if( iIndex != -1 )
{
value_data.Delete( iIndex, 10000 );
GetMainAndSubTitlesFromFullTitle( value_data, m_sMainTitle, m_sSubTitle );
}
else
m_sMainTitle = value_data;
}
else if( -1 != value_name.Find("#artist") )
else if( value_name == "#artist" )
{
m_sArtist = value_data;
}
else if( -1 != value_name.Find("#bpm") )
else if( value_name == "#bpm" )
{
BPMSegment new_seg;
new_seg.m_fStartBeat = 0;
new_seg.m_fBPM = (float)atof( value_data );
// add, then sort
m_BPMSegments.Add( new_seg );
SortBPMSegmentsArray( m_BPMSegments );
LOG->WriteLine( "Inserting new BPM change at beat %f, BPM %f", new_seg.m_fStartBeat, new_seg.m_fBPM );
BPMSegment newSeg( 0, (float)atof(value_data) );
AddBPMSegment( newSeg );
LOG->WriteLine( "Inserting new BPM change at beat %f, BPM %f", newSeg.m_fStartBeat, newSeg.m_fBPM );
}
else if( -1 != value_name.Find("#backbmp") )
else if( value_name == "#backbmp" )
{
m_sBackgroundPath = m_sSongDir + value_data;
}
else if( -1 != value_name.Find("#wav") )
else if( value_name == "#wav" )
{
m_sMusicPath = m_sSongDir + value_data;
}
@@ -405,7 +403,7 @@ bool Song::LoadFromBMSDir( CString sDir )
&& IsAnInt( value_name.Mid(4,2) ) ) // this is step or offset data. Looks like "#00705"
{
int iMeasureNo = atoi( value_name.Mid(1,3) );
int iTrackNum = atoi( value_name.Mid(4,2) );
int iBMSTrackNo = atoi( value_name.Mid(4,2) );
CString sNoteData = value_data;
CArray<int, int> arrayNotes;
@@ -419,8 +417,8 @@ bool Song::LoadFromBMSDir( CString sDir )
}
const int iNumNotesInThisMeasure = arrayNotes.GetSize();
//LOG->WriteLine( "%s:%s: iMeasureNo = %d, iTrackNum = %d, iNumNotesInThisMeasure = %d",
// valuename, sNoteData, iMeasureNo, iTrackNum, iNumNotesInThisMeasure );
//LOG->WriteLine( "%s:%s: iMeasureNo = %d, iBMSTrackNo = %d, iNumNotesInThisMeasure = %d",
// valuename, sNoteData, iMeasureNo, iBMSTrackNo, iNumNotesInThisMeasure );
for( int j=0; j<iNumNotesInThisMeasure; j++ )
{
if( arrayNotes[j] != 0 )
@@ -431,9 +429,9 @@ bool Song::LoadFromBMSDir( CString sDir )
int iStepIndex = (int) ( (iMeasureNo + fPercentThroughMeasure)
* BEATS_PER_MEASURE * ELEMENTS_PER_BEAT );
switch( iTrackNum )
switch( iBMSTrackNo )
{
case 01: // background music track
case 1: // background music track
float fBeatOffset;
fBeatOffset = NoteRowToBeat( (float)iStepIndex );
float fBPS;
@@ -441,13 +439,163 @@ bool Song::LoadFromBMSDir( CString sDir )
m_fOffsetInSeconds = fBeatOffset / fBPS;
//LOG->WriteLine( "Found offset to be index %d, beat %f", iStepIndex, NoteRowToBeat(iStepIndex) );
break;
case 03: // bpm
BPMSegment new_seg;
new_seg.m_fStartBeat = NoteRowToBeat( (float)iStepIndex );
new_seg.m_fBPM = (float)arrayNotes[j];
case 3: // bpm change
{
BPMSegment newSeg( NoteRowToBeat(iStepIndex), (float)arrayNotes[j] );
AddBPMSegment( newSeg );
LOG->WriteLine( "Inserting new BPM change at beat %f, BPM %f", newSeg.m_fStartBeat, newSeg.m_fBPM );
}
break;
m_BPMSegments.Add( new_seg ); // add to back for now (we'll sort later)
SortBPMSegmentsArray( m_BPMSegments );
// Let me just take a moment to express how frustrated I am with the new,
// poorly-designed changes to the BMS format.
//
//
// AAAAAAAAAAAAAAAAAAAAAAAAAAAAAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaahhhhhhhhhhhhhhhhhhhhhhhh!!!!!!!!!!!!!!!
//
// Thank you.
case 8: // indirect bpm
{
// This is a very inefficient way to parse, but it doesn't matter much
// because this is only parsed on the first run after the song is installed.
CString sTagToLookFor = ssprintf( "#BPM%02x", arrayNotes[j] );
float fBPM = -1;
// open the song file again and and look for this tag's value
CStdioFile file;
if( !file.Open( m_sSongFilePath, CFile::modeRead|CFile::shareDenyNone ) )
{
throw RageException( "Failed to open %s.", m_sSongFilePath );
return false;
}
CString line;
while( file.ReadString(line) ) // foreach line
{
CString value_name; // fill these in
CString value_data;
// BMS value names can be separated by a space or a colon.
int iIndexOfFirstColon = line.Find( ":" );
int iIndexOfFirstSpace = line.Find( " " );
if( iIndexOfFirstColon == -1 )
iIndexOfFirstColon = 10000;
if( iIndexOfFirstSpace == -1 )
iIndexOfFirstSpace = 10000;
int iIndexOfSeparator = min( iIndexOfFirstSpace, iIndexOfFirstColon );
if( iIndexOfSeparator != 10000 )
{
value_name = line.Mid( 0, iIndexOfSeparator );
value_data = line; // the rest
value_data.Delete(0,iIndexOfSeparator+1);
}
else // no separator
{
value_name = line;
}
if( stricmp(value_name, sTagToLookFor) == 0 )
{
fBPM = (float)atof( value_data );
break;
}
}
if( fBPM == -1 ) // we didn't find the line we were looking for
{
LOG->WriteLine( "WARNING: Couldn't find tag '%s' in '%s'.", sTagToLookFor, m_sSongFilePath );
}
else
{
BPMSegment newSeg( NoteRowToBeat(iStepIndex), fBPM );
AddBPMSegment( newSeg );
LOG->WriteLine( "Inserting new BPM change at beat %f, BPM %f", newSeg.m_fStartBeat, newSeg.m_fBPM );
}
}
break;
case 9: // freeze
{
// This is a very inefficient way to parse, but it doesn't
// matter much because this is only parsed on the first run after the song is installed.
CString sTagToLookFor = ssprintf( "#STOP%02x", arrayNotes[j] );
float fFreezeStartBeat = NoteRowToBeat(iStepIndex);
float fFreezeSecs = -1;
// open the song file again and and look for this tag's value
CStdioFile file;
if( !file.Open( m_sSongFilePath, CFile::modeRead|CFile::shareDenyNone ) )
{
throw RageException( "Failed to open %s.", m_sSongFilePath );
return false;
}
CString line;
while( file.ReadString(line) ) // foreach line
{
CString value_name; // fill these in
CString value_data;
// BMS value names can be separated by a space or a colon.
int iIndexOfFirstColon = line.Find( ":" );
int iIndexOfFirstSpace = line.Find( " " );
if( iIndexOfFirstColon == -1 )
iIndexOfFirstColon = 10000;
if( iIndexOfFirstSpace == -1 )
iIndexOfFirstSpace = 10000;
int iIndexOfSeparator = min( iIndexOfFirstSpace, iIndexOfFirstColon );
if( iIndexOfSeparator != 10000 )
{
value_name = line.Mid( 0, iIndexOfSeparator );
value_data = line; // the rest
value_data.Delete(0,iIndexOfSeparator+1);
}
else // no separator
{
value_name = line;
}
if( stricmp(value_name, sTagToLookFor) == 0 )
{
// find the BPM at the time of this freeze
float fBPM = -1;
for( int i=0; i<m_BPMSegments.GetSize()-1; i++ )
{
if( m_BPMSegments[i].m_fStartBeat <= fFreezeStartBeat &&
m_BPMSegments[i+1].m_fStartBeat > fFreezeStartBeat )
{
fBPM = m_BPMSegments[i].m_fBPM;
break;
}
}
// the BPM segment of this beat is the last BPM segment
if( fBPM == -1 )
fBPM = m_BPMSegments[m_BPMSegments.GetSize()-1].m_fBPM;
fFreezeSecs = (float)atof(value_data)/(fBPM*0.81f); // I have no idea what units these are in, so I experimented until finding this factor.
break;
}
}
if( fFreezeSecs == -1 ) // we didn't find the line we were looking for
{
LOG->WriteLine( "WARNING: Couldn't find tag '%s' in '%s'.", sTagToLookFor, m_sSongFilePath );
}
else
{
FreezeSegment newSeg( fFreezeStartBeat, fFreezeSecs );
AddFreezeSegment( newSeg );
LOG->WriteLine( "Inserting new Freeze at beat %f, secs %f", newSeg.m_fStartBeat, newSeg.m_fFreezeSeconds );
}
}
break;
}
}
+3 -1
View File
@@ -85,7 +85,9 @@ GameplayStatistics SongManager::GetLatestGameplayStatistics( PlayerNumber p )
void SongManager::InitSongArrayFromDisk()
{
LoadStepManiaSongDir( "Songs" );
//LoadDWISongDir( "DWI Support" );
for( int i=0; i<PREFSMAN->m_asSongFolders.GetSize(); i++ )
LoadStepManiaSongDir( PREFSMAN->m_asSongFolders[i] );
// compute group names
CArray<Song*, Song*> arraySongs;
+7
View File
@@ -6,6 +6,7 @@
Desc: A bitmap actor that animates and moves around.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
@@ -376,6 +377,12 @@ void Sprite::SetCustomTextureCoords( float fTexCoords[8] ) // order: bottom left
m_CustomTexCoords[i] = fTexCoords[i];
}
void Sprite::GetCustomTextureCoords( float fTexCoordsOut[8] ) // order: bottom left, top left, bottom right, top right
{
for( int i=0; i<8; i++ )
fTexCoordsOut[i] = m_CustomTexCoords[i];
}
void Sprite::SetCustomImageRect( FRECT rectImageCoords )
{
+2
View File
@@ -6,6 +6,7 @@
Desc: A bitmap Actor that animates and moves around.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
@@ -50,6 +51,7 @@ public:
void SetCustomTextureRect( FRECT new_texcoord_frect );
void SetCustomTextureCoords( float fTexCoords[8] );
void GetCustomTextureCoords( float fTexCoordsOut[8] );
void SetCustomSourceRect( FRECT rectSourceCoords ); // in source pixel space
void SetCustomImageRect( FRECT rectImageCoords ); // in image pixel space
void SetCustomImageCoords( float fImageCoords[8] );
+3 -7
View File
@@ -1,11 +1,12 @@
#include "stdafx.h"
/*
-----------------------------------------------------------------------------
File: TransitionInvisible.cpp
Class: TransitionInvisible
Desc: Fades out or in.
Desc: See header.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
@@ -21,11 +22,6 @@ TransitionInvisible::TransitionInvisible()
{
}
TransitionInvisible::~TransitionInvisible()
{
}
void TransitionInvisible::DrawPrimitives()
{
}
+4 -12
View File
@@ -1,18 +1,16 @@
#pragma once
/*
-----------------------------------------------------------------------------
File: TransitionInvisible.cpp
Class: TransitionInvisible
Desc: Fades out or in.
Desc: Doesn't draw anything. Only used for timing.
Copyright (c) 2001-2002 by the person(s) listed below. All rights reserved.
Chris Danford
-----------------------------------------------------------------------------
*/
#ifndef _TransitionInvisible_H_
#define _TransitionInvisible_H_
#include "Transition.h"
#include "RageDisplay.h"
#include "RageSound.h"
@@ -23,14 +21,8 @@ class TransitionInvisible : public Transition
{
public:
TransitionInvisible();
virtual ~TransitionInvisible();
virtual void DrawPrimitives();
protected:
};
#endif
+8 -26
View File
@@ -161,32 +161,14 @@ void CSmpackageDlg::OnButtonExport()
// Create a new zip file on the desktop
CString sZipFileName = sSongName + ".smzip";
sZipFileName.Replace( " ", "_" );
sZipFileName.Replace( "!", "_" );
sZipFileName.Replace( "@", "_" );
sZipFileName.Replace( "#", "_" );
sZipFileName.Replace( "$", "_" );
sZipFileName.Replace( "%", "_" );
sZipFileName.Replace( "^", "_" );
sZipFileName.Replace( "&", "_" );
sZipFileName.Replace( "*", "_" );
sZipFileName.Replace( "(", "_" );
sZipFileName.Replace( ")", "_" );
sZipFileName.Replace( "+", "_" );
sZipFileName.Replace( "=", "_" );
sZipFileName.Replace( "[", "_" );
sZipFileName.Replace( "]", "_" );
sZipFileName.Replace( "{", "_" );
sZipFileName.Replace( "}", "_" );
sZipFileName.Replace( "|", "_" );
sZipFileName.Replace( ":", "_" );
sZipFileName.Replace( "\'","_" );
sZipFileName.Replace( "\"","_" );
sZipFileName.Replace( "<", "_" );
sZipFileName.Replace( ">", "_" );
sZipFileName.Replace( ",", "_" );
sZipFileName.Replace( "?", "_" );
sZipFileName.Replace( "/", "_" );
const char charsToReplace[] = {
' ', '!', '@', '#', '$', '%', '^', '&', '*', '(', ')',
'+', '=', '[', ']', '{', '}', '|', ':', '\"', '\\',
'<', '>', ',', '?', '/'
};
for( int i=0; i<sizeof(charsToReplace[]); i++ )
sZipFileName.Replace( charsToReplace[i], '_' );
CString sZipFilePath = sDesktopPath + sZipFileName;
//MessageBox( ssprintf("sZipFilePath is '%s'", sZipFilePath), "", MB_OK );
try