[default -> loading window] YAM

This commit is contained in:
Henrik Andersson
2011-07-01 00:10:46 +02:00
29 changed files with 369 additions and 216 deletions
+5
View File
@@ -9,6 +9,11 @@ change to JSON, but it is unsure if this will be done.
Implement .ssc at your own risk. Implement .ssc at your own risk.
________________________________________________________________________________ ________________________________________________________________________________
[v0.73] - Wolfman2000
* Use #FIRSTSECOND, #LASTSECOND, and #LASTSECONDHINT instead of the BEAT
equivalents.
* Move #LASTSECONDHINT to after the Timing tags.
[v0.72] - Wolfman2000 [v0.72] - Wolfman2000
* Have #OFFSET come before #ATTACKS in the Step data. * Have #OFFSET come before #ATTACKS in the Step data.
+10 -1
View File
@@ -5,9 +5,18 @@ from StepMania 4 alpha 5 to sm-ssc v1.2.5, see Changelog_sm-ssc.txt.
________________________________________________________________________________ ________________________________________________________________________________
================================================================================ ================================================================================
StepMania 5.0 Preview 2 | 201106?? StepMania 5.0 Preview 2 | 201107??
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
2011/06/30
----------
* [NotesAll] Use #FIRSTSECOND, #LASTSECOND, and #LASTSECONDHINT instead of the
former BEAT equivalents. Split Timing has made this a necessity thanks to
certain files that abuse Stops/Delays more than usual. [Wolfman2000]
* [ScreenEdit] Add a function in the Area Menu to designate the current beat
as the last second of the song. Please try to be smart and not use this too
early. [Wolfman2000]
2011/06/28 2011/06/28
---------- ----------
* [ScreenEdit] Add a function to copy/paste the TimingData of a player's * [ScreenEdit] Add a function to copy/paste the TimingData of a player's
+2
View File
@@ -1244,9 +1244,11 @@
<Function name='GetDisplayMainTitle'/> <Function name='GetDisplayMainTitle'/>
<Function name='GetDisplaySubTitle'/> <Function name='GetDisplaySubTitle'/>
<Function name='GetFirstBeat'/> <Function name='GetFirstBeat'/>
<Function name='GetFirstSecond'/>
<Function name='GetGenre'/> <Function name='GetGenre'/>
<Function name='GetGroupName'/> <Function name='GetGroupName'/>
<Function name='GetLastBeat'/> <Function name='GetLastBeat'/>
<Function name='GetLastSecond'/>
<Function name='GetLyricsPath'/> <Function name='GetLyricsPath'/>
<Function name='GetMusicPath'/> <Function name='GetMusicPath'/>
<Function name='GetOneSteps'/> <Function name='GetOneSteps'/>
+6
View File
@@ -3084,6 +3084,9 @@
<Function name='GetFirstBeat' return='float' arguments=''> <Function name='GetFirstBeat' return='float' arguments=''>
Returns the first beat of the song. Returns the first beat of the song.
</Function> </Function>
<Function name='GetFirstSecond' return='float' arguments=''>
Returns the first second of the song.
</Function>
<Function name='GetGenre' return='string' arguments=''> <Function name='GetGenre' return='string' arguments=''>
Returns the genre of the song. Returns the genre of the song.
</Function> </Function>
@@ -3093,6 +3096,9 @@
<Function name='GetLastBeat' return='float' arguments=''> <Function name='GetLastBeat' return='float' arguments=''>
Returns the last beat of the song. Returns the last beat of the song.
</Function> </Function>
<Function name='GetLastSecond' return='float' arguments=''>
Returns the last second of the song.
</Function>
<Function name='GetLyricsPath' return='string' arguments=''> <Function name='GetLyricsPath' return='string' arguments=''>
Gets the path to the lyrics. Gets the path to the lyrics.
</Function> </Function>
+1 -1
View File
@@ -21,11 +21,11 @@
#DELAYS:; #DELAYS:;
#LABELS:; #LABELS:;
#TIMESIGNATURES:; #TIMESIGNATURES:;
#LASTBEATHINT:;
#SAMPLESTART:; #SAMPLESTART:;
#SAMPLELENGTH:; #SAMPLELENGTH:;
#DISPLAYBPM:[xxx][xxx:xxx]|[*]; #DISPLAYBPM:[xxx][xxx:xxx]|[*];
#SELECTABLE:; #SELECTABLE:;
#LASTBEATHINT:;
#BGCHANGES:; #BGCHANGES:;
#FGCHANGES:; #FGCHANGES:;
#KEYSOUNDS:; #KEYSOUNDS:;
+3 -2
View File
@@ -838,6 +838,7 @@ Delete=Delete
Delete beat and shift up=Delete beat and shift up Delete beat and shift up=Delete beat and shift up
Description=Description Description=Description
Designate as Music Preview=Designate as Music Preview Designate as Music Preview=Designate as Music Preview
Designate last second at current beat=Designate last second at current beat
Difficulty=Difficulty Difficulty=Difficulty
Display BPM=Display BPM Display BPM=Display BPM
DisplayAspectRatio=Aspect Ratio DisplayAspectRatio=Aspect Ratio
@@ -916,7 +917,7 @@ Insert Entry=Insert Entry
Jumps=Jumps Jumps=Jumps
Key Joy Mappings=Config Key/Joy Mappings Key Joy Mappings=Config Key/Joy Mappings
Language=Language Language=Language
Last beat hint=Last beat hint Last second hint=Last second hint
Layer=Layer Layer=Layer
LifeDifficulty=Life Difficulty LifeDifficulty=Life Difficulty
LifeType=Life Type LifeType=Life Type
@@ -1256,7 +1257,7 @@ Enter a new chart style.=Enter a new chart style (e.g. "Pad", "Keyboard").
Enter a new meter.=Enter the difficulty rating for this chart. Enter a new meter.=Enter the difficulty rating for this chart.
Enter the author who made this step pattern.=Enter the author who made this step pattern. Enter the author who made this step pattern.=Enter the author who made this step pattern.
Enter the offset for the song.=Enter the beat 0 offset for the song. Enter the offset for the song.=Enter the beat 0 offset for the song.
Enter a new last beat hint.=Enter a new last beat hint. Enter a new last second hint.=Enter a new last second hint.
Enter a new main title transliteration.=Enter a new main title transliteration. Enter a new main title transliteration.=Enter a new main title transliteration.
Enter a new main title.=Enter a new main title. Enter a new main title.=Enter a new main title.
Enter a new sub title transliteration.=Enter a new sub title transliteration. Enter a new sub title transliteration.=Enter a new sub title transliteration.
+7 -7
View File
@@ -3650,12 +3650,12 @@ PlayRecordHelpOnCommand=halign,0;valign,0;shadowlength,1
LoopOnChartEnd=true LoopOnChartEnd=true
CurrentBeatFormat="%s:\n %.5f\n" CurrentBeatFormat="%s:\n %.6f\n"
CurrentSecondFormat="%s:\n %.5f\n" CurrentSecondFormat="%s:\n %.6f\n"
SnapToFormat="%s: %s\n" SnapToFormat="%s: %s\n"
SelectionBeatBeginFormat="%s:\n %.5f" SelectionBeatBeginFormat="%s:\n %.6f"
SelectionBeatUnfinishedFormat=" ...\n" SelectionBeatUnfinishedFormat=" ...\n"
SelectionBeatEndFormat="-%.5f\n" SelectionBeatEndFormat="-%.6f\n"
DifficultyFormat="%s:\n %s\n" DifficultyFormat="%s:\n %s\n"
RoutinePlayerFormat="%s:\n %d\n" RoutinePlayerFormat="%s:\n %d\n"
DescriptionFormat="%s:\n %s\n" DescriptionFormat="%s:\n %s\n"
@@ -3674,9 +3674,9 @@ NumRollsFormat="%s: %d\n"
NumLiftsFormat="%s: %d\n" NumLiftsFormat="%s: %d\n"
NumFakesFormat="%s: %d\n" NumFakesFormat="%s: %d\n"
TimingModeFormat="%s:\n %s\n" TimingModeFormat="%s:\n %s\n"
Beat0OffsetFormat="%s:\n %.5f secs\n" Beat0OffsetFormat="%s:\n %.6f secs\n"
PreviewStartFormat="%s:\n %.5f secs\n" PreviewStartFormat="%s:\n %.6f secs\n"
PreviewLengthFormat="%s:\n %.5f secs\n" PreviewLengthFormat="%s:\n %.6f secs\n"
[ScreenPracticeMenu] [ScreenPracticeMenu]
Fallback="ScreenEditMenu" Fallback="ScreenEditMenu"
@@ -1,8 +1,13 @@
local function CreateStops(Player) local function CreateSegments(Player)
local t = Def.ActorFrame { }; local t = Def.ActorFrame { };
local bars = Def.ActorFrame{ }; local bars = Def.ActorFrame{ };
local bpmFrame = Def.ActorFrame{ Name="BPMFrame"; }; local bpmFrame = Def.ActorFrame{ Name="BPMFrame"; };
local stopFrame = Def.ActorFrame{ Name="StopFrame"; }; local stopFrame = Def.ActorFrame{ Name="StopFrame"; };
local delayFrame = Def.ActorFrame{ Name="DelayFrame"; };
local warpFrame = Def.ActorFrame{ Name="WarpFrame"; };
local fakeFrame = Def.ActorFrame{ Name="FakeFrame"; };
local scrollFrame = Def.ActorFrame{ Name="ScrollFrame"; };
local speedFrame = Def.ActorFrame{ Name="SpeedFrame"; };
local fFrameWidth = 380; local fFrameWidth = 380;
local fFrameHeight = 8; local fFrameHeight = 8;
@@ -19,32 +24,32 @@ local function CreateStops(Player)
if song then if song then
local songLen = song:MusicLengthSeconds(); local songLen = song:MusicLengthSeconds();
local firstBeatSecs = timingData:GetElapsedTimeFromBeat(song:GetFirstBeat()); local firstBeatSecs = song:GetFirstSecond();
local lastBeatSecs = timingData:GetElapsedTimeFromBeat(song:GetLastBeat()); local lastBeatSecs = song:GetLastSecond();
local bpms = timingData:GetBPMs();
local bpms = timingData:GetBPMsAndTimes();
local stops = timingData:GetStops(); local stops = timingData:GetStops();
for i=1,#stops do local delays = timingData:GetDelays();
local data = split("=",stops[i]); local warps = timingData:GetWarps();
local beat = data[1]; local fakes = timingData:GetFakes();
local secs = data[2]; local scrolls = timingData:GetScrolls();
local speeds = timingData:GetSpeeds();
local function CreateLine(beat, secs, firstShadow, firstDiffuse, secondShadow, firstEffect, secondEffect)
local beatTime = timingData:GetElapsedTimeFromBeat(beat); local beatTime = timingData:GetElapsedTimeFromBeat(beat);
if beatTime < 0 then beatTime = 0; end; if beatTime < 0 then beatTime = 0; end;
return Def.ActorFrame {
stopFrame[#stopFrame+1] = Def.ActorFrame {
Def.Quad { Def.Quad {
InitCommand=function(self) InitCommand=function(self)
--self:diffuse(HSVA(192,1,0.8,0.8));
self:shadowlength(0); self:shadowlength(0);
self:shadowcolor( color("#FFFFFF77") ); self:shadowcolor(color(firstShadow));
-- set width -- set width
self:zoomto(math.max((secs/songLen)*fFrameWidth, 1), fFrameHeight); self:zoomto(math.max((secs/songLen)*fFrameWidth, 1), fFrameHeight);
-- find location -- find location
self:x((scale(beatTime,firstBeatSecs,lastBeatSecs,-fFrameWidth/2,fFrameWidth/2))); self:x((scale(beatTime,firstBeatSecs,lastBeatSecs,-fFrameWidth/2,fFrameWidth/2)));
end; end;
OnCommand=function(self) OnCommand=function(self)
self:diffuse(Color("White")); self:diffuse(color(firstDiffuse));
self:sleep(beatTime+1); self:sleep(beatTime+1);
self:linear(2); self:linear(2);
self:diffusealpha(0); self:diffusealpha(0);
@@ -54,7 +59,7 @@ local function CreateStops(Player)
InitCommand=function(self) InitCommand=function(self)
--self:diffuse(HSVA(192,1,0.8,0.8)); --self:diffuse(HSVA(192,1,0.8,0.8));
self:shadowlength(0); self:shadowlength(0);
self:shadowcolor( color("#FFFFFF77") ); self:shadowcolor(color(secondShadow));
-- set width -- set width
self:zoomto(math.max((secs/songLen)*fFrameWidth, 1),fFrameHeight); self:zoomto(math.max((secs/songLen)*fFrameWidth, 1),fFrameHeight);
-- find location -- find location
@@ -63,25 +68,71 @@ local function CreateStops(Player)
OnCommand=function(self) OnCommand=function(self)
self:diffusealpha(1); self:diffusealpha(1);
self:diffuseshift(); self:diffuseshift();
self:effectcolor1(Color("Orange")); self:effectcolor1(color(firstEffect));
self:effectcolor2(Color("Red")); self:effectcolor2(color(secondEffect));
self:effectclock('beat'); self:effectclock('beat');
self:effectperiod(1/8); self:effectperiod(1/8);
-- --
self:diffusealpha(0); self:diffusealpha(0);
self:sleep(beatTime+1); self:sleep(beatTime+1);
-- self:linear(1);
self:diffusealpha(1); self:diffusealpha(1);
self:linear(4); self:linear(4);
self:diffusealpha(0); self:diffusealpha(0);
end; end;
}; };
--OnCommand=cmd(diffuse,Color("White");sleep,math.min(0.00001+(secs-5),0.00001);linear,1;diffuse,Color("Orange");sleep,4;linear,2;diffusealpha,0);
--OnCommand=cmd(diffuse,Color("White");linear,1;diffuse,Color("Orange"););
}; };
end; end;
for i=1,#bpms do
local data = split("=",bpms[i]);
bpmFrame[#bpmFrame+1] = CreateLine(data[1], 0,
"#00808077", "#00808077", "#00808077", "#FF634777", "#FF000077");
end; end;
for i=1,#delays do
local data = split("=",delays[i]);
delayFrame[#delayFrame+1] = CreateLine(data[1], data[2],
"#FFFF0077", "#FFFF0077", "#FFFF0077", "#00FF0077", "#FF000077");
end;
for i=1,#stops do
local data = split("=",stops[i]);
stopFrame[#stopFrame+1] = CreateLine(data[1], data[2],
"#FFFFFF77", "#FFFFFF77", "#FFFFFF77", "#FFA50077", "#FF000077");
end;
for i=1,#scrolls do
local data = split("=",scrolls[i]);
scrollFrame[#scrollFrame+1] = CreateLine(data[1], 0,
"#4169E177", "#4169E177", "#4169E177", "#0000FF77", "#FF000077");
end;
for i=1,#speeds do
local data = split("=",speeds[i]);
-- TODO: Turn beats into seconds for this calculation?
speedFrame[#speedFrame+1] = CreateLine(data[1], 0,
"#ADFF2F77", "#ADFF2F77", "#ADFF2F77", "#7CFC0077", "#FF000077");
end;
for i=1,#warps do
local data = split("=",warps[i]);
warpFrame[#warpFrame+1] = CreateLine(data[1], 0,
"#CC00CC77", "#CC00CC77", "#CC00CC77", "#FF33CC77", "#FF000077");
end;
for i=1,#fakes do
local data = split("=",fakes[i]);
fakeFrame[#fakeFrame+1] = CreateLine(data[1], 0,
"#BC8F8F77", "#BC8F8F77", "#BC8F8F77", "#F4A46077", "#FF000077");
end;
end;
bars[#bars+1] = bpmFrame;
bars[#bars+1] = scrollFrame;
bars[#bars+1] = speedFrame;
bars[#bars+1] = stopFrame; bars[#bars+1] = stopFrame;
bars[#bars+1] = delayFrame;
bars[#bars+1] = warpFrame;
bars[#bars+1] = fakeFrame;
t[#t+1] = bars; t[#t+1] = bars;
end end
return t return t
@@ -121,7 +172,7 @@ for pn in ivalues(PlayerNumber) do
}; };
Tip=LoadActor( THEME:GetPathG( 'SongMeterDisplay', 'tip ' .. PlayerNumberToString(pn) ) ) .. { InitCommand=cmd(visible,false); }; Tip=LoadActor( THEME:GetPathG( 'SongMeterDisplay', 'tip ' .. PlayerNumberToString(pn) ) ) .. { InitCommand=cmd(visible,false); };
}; };
CreateStops(pn) .. { CreateSegments(pn) .. {
-- InitCommand=cmd(draworder,10); -- InitCommand=cmd(draworder,10);
}; };
}; };
@@ -142,38 +193,6 @@ t[#t+1] = StandardDecorationFromFileOptional("BPMDisplay","BPMDisplay");
t[#t+1] = StandardDecorationFromFileOptional("StageDisplay","StageDisplay"); t[#t+1] = StandardDecorationFromFileOptional("StageDisplay","StageDisplay");
t[#t+1] = StandardDecorationFromFileOptional("SongTitle","SongTitle"); t[#t+1] = StandardDecorationFromFileOptional("SongTitle","SongTitle");
--[[ t[#t+1] = Def.ActorFrame {
InitCommand=function(self)
self:name("SongMeterDisplay");
ActorUtil.LoadAllCommandsAndSetXY(self,Var "LoadingScreen");
end;
LoadActor( THEME:GetPathG( 'SongMeterDisplay', 'frame ' .. PlayerNumberToString(PLAYER_1) ) ) .. {
InitCommand=function(self)
self:name('Frame');
ActorUtil.LoadAllCommandsAndSetXY(self,"SongMeterDisplay");
end;
};
Def.Quad {
InitCommand=cmd(zoomto,2,8);
OnCommand=cmd(x,scale(0.25,0,1,-380/2,380/2);diffuse,Color("Orange");diffusealpha,0.5);
};
Def.Quad {
InitCommand=cmd(zoomto,2,8);
OnCommand=cmd(x,scale(0.5,0,1,-380/2,380/2);diffuse,Color("Orange");diffusealpha,0.5);
};
Def.Quad {
InitCommand=cmd(zoomto,2,8);
OnCommand=cmd(x,scale(0.75,0,1,-380/2,380/2);diffuse,Color("Orange");diffusealpha,0.5);
};
Def.SongMeterDisplay {
InitCommand=cmd(SetStreamWidth,THEME:GetMetric( "SongMeterDisplay", 'StreamWidth' ));
Stream=LoadActor( THEME:GetPathG( 'SongMeterDisplay', 'stream ' .. PlayerNumberToString(PLAYER_1) ) )..{
InitCommand=cmd(diffuse,Color("Orange");diffusealpha,0.5;blend,Blend.Add;);
};
Tip=LoadActor( THEME:GetPathG( 'SongMeterDisplay', 'tip ' .. PlayerNumberToString(PLAYER_1) ) ) .. { InitCommand=cmd(visible,false); };
};
CreateStops();
}; --]]
if( not GAMESTATE:IsCourseMode() ) then if( not GAMESTATE:IsCourseMode() ) then
t[#t+1] = Def.Actor{ t[#t+1] = Def.Actor{
JudgmentMessageCommand = function(self, params) JudgmentMessageCommand = function(self, params)
+8
View File
@@ -104,6 +104,14 @@ vector<RString> AttackArray::ToVectorString() const
return ret; return ret;
} }
void AttackArray::UpdateStartTimes(float delta)
{
FOREACH(Attack, *this, a)
{
a->fStartSecond += delta;
}
}
/* /*
* (c) 2003-2004 Chris Danford * (c) 2003-2004 Chris Danford
* All rights reserved. * All rights reserved.
+5
View File
@@ -76,6 +76,11 @@ struct AttackArray : public vector<Attack>
* @brief Return a string representation used for simfiles. * @brief Return a string representation used for simfiles.
* @return the string representation. */ * @return the string representation. */
vector<RString> ToVectorString() const; vector<RString> ToVectorString() const;
/**
* @brief Adjust the starting time of all attacks.
* @param delta the amount to change. */
void UpdateStartTimes(float delta);
}; };
#endif #endif
+5 -3
View File
@@ -577,13 +577,15 @@ void BackgroundImpl::LoadFromSong( const Song* pSong )
else // pSong doesn't have an animation plan else // pSong doesn't have an animation plan
{ {
Layer &layer = m_Layer[0]; Layer &layer = m_Layer[0];
float firstBeat = pSong->GetFirstBeat();
float lastBeat = pSong->GetLastBeat();
LoadFromRandom( pSong->m_fFirstBeat, pSong->m_fLastBeat, BackgroundChange() ); LoadFromRandom( firstBeat, lastBeat, BackgroundChange() );
// end showing the static song background // end showing the static song background
BackgroundChange change; BackgroundChange change;
change.m_def = m_StaticBackgroundDef; change.m_def = m_StaticBackgroundDef;
change.m_fStartBeat = pSong->m_fLastBeat; change.m_fStartBeat = lastBeat;
layer.m_aBGChanges.push_back( change ); layer.m_aBGChanges.push_back( change );
} }
@@ -642,7 +644,7 @@ void BackgroundImpl::LoadFromSong( const Song* pSong )
continue; continue;
float fStartBeat = change.m_fStartBeat; float fStartBeat = change.m_fStartBeat;
float fEndBeat = pSong->m_fLastBeat; float fEndBeat = pSong->GetLastBeat();
if( i+1 < mainlayer.m_aBGChanges.size() ) if( i+1 < mainlayer.m_aBGChanges.size() )
fEndBeat = mainlayer.m_aBGChanges[i+1].m_fStartBeat; fEndBeat = mainlayer.m_aBGChanges[i+1].m_fStartBeat;
+3 -3
View File
@@ -166,7 +166,7 @@ void DancingCharacters::LoadNextSong()
m_fThisCameraEndBeat = 0; m_fThisCameraEndBeat = 0;
ASSERT( GAMESTATE->m_pCurSong ); ASSERT( GAMESTATE->m_pCurSong );
m_fThisCameraEndBeat = GAMESTATE->m_pCurSong->m_fFirstBeat; m_fThisCameraEndBeat = GAMESTATE->m_pCurSong->GetFirstBeat();
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
if( GAMESTATE->IsPlayerEnabled(p) ) if( GAMESTATE->IsPlayerEnabled(p) )
@@ -212,9 +212,9 @@ void DancingCharacters::Update( float fDelta )
bWasGameplayStarting = bGameplayStarting; bWasGameplayStarting = bGameplayStarting;
static float fLastBeat = GAMESTATE->m_Position.m_fSongBeat; static float fLastBeat = GAMESTATE->m_Position.m_fSongBeat;
float firstBeat = GAMESTATE->m_pCurSong->GetFirstBeat();
float fThisBeat = GAMESTATE->m_Position.m_fSongBeat; float fThisBeat = GAMESTATE->m_Position.m_fSongBeat;
if( fLastBeat < GAMESTATE->m_pCurSong->m_fFirstBeat && if( fLastBeat < firstBeat && fThisBeat >= firstBeat )
fThisBeat >= GAMESTATE->m_pCurSong->m_fFirstBeat )
{ {
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
m_pCharacter[p]->PlayAnimation( "dance" ); m_pCharacter[p]->PlayAnimation( "dance" );
+2 -1
View File
@@ -991,7 +991,8 @@ update player position code goes here
float GameState::GetSongPercent( float beat ) const float GameState::GetSongPercent( float beat ) const
{ {
// 0 = first step; 1 = last step // 0 = first step; 1 = last step
return (beat - m_pCurSong->m_fFirstBeat) / m_pCurSong->m_fLastBeat; float curTime = this->m_pCurSong->m_SongTiming.GetElapsedTimeFromBeat(beat);
return (curTime - m_pCurSong->GetFirstSecond()) / m_pCurSong->GetLastSecond();
} }
int GameState::GetNumStagesLeft( PlayerNumber pn ) const int GameState::GetNumStagesLeft( PlayerNumber pn ) const
+2 -2
View File
@@ -119,10 +119,10 @@ void Inventory::Update( float fDelta )
} }
} }
Song &song = *GAMESTATE->m_pCurSong;
// use items if this player is CPU-controlled // use items if this player is CPU-controlled
if( m_pPlayerState->m_PlayerController != PC_HUMAN && if( m_pPlayerState->m_PlayerController != PC_HUMAN &&
GAMESTATE->m_Position.m_fSongBeat < GAMESTATE->m_pCurSong->m_fLastBeat ) GAMESTATE->m_Position.m_fSongBeat < song.GetLastBeat() )
{ {
// every 1 seconds, try to use an item // every 1 seconds, try to use an item
int iLastSecond = (int)(RageTimer::GetTimeSinceStartFast() - fDelta); int iLastSecond = (int)(RageTimer::GetTimeSinceStartFast() - fDelta);
+1 -1
View File
@@ -59,7 +59,7 @@ void LyricDisplay::Update( float fDeltaTime )
if( m_iCurLyricNumber+1 < GAMESTATE->m_pCurSong->m_LyricSegments.size() ) if( m_iCurLyricNumber+1 < GAMESTATE->m_pCurSong->m_LyricSegments.size() )
fEndTime = pSong->m_LyricSegments[m_iCurLyricNumber+1].m_fStartTime; fEndTime = pSong->m_LyricSegments[m_iCurLyricNumber+1].m_fStartTime;
else else
fEndTime = pSong->m_SongTiming.GetElapsedTimeFromBeat( pSong->m_fLastBeat ); fEndTime = pSong->GetLastSecond();
const float fDistance = fEndTime - pSong->m_LyricSegments[m_iCurLyricNumber].m_fStartTime; const float fDistance = fEndTime - pSong->m_LyricSegments[m_iCurLyricNumber].m_fStartTime;
const float fTweenBufferTime = IN_LENGTH.GetValue() + OUT_LENGTH.GetValue(); const float fTweenBufferTime = IN_LENGTH.GetValue() + OUT_LENGTH.GetValue();
+2 -2
View File
@@ -73,8 +73,8 @@ void SongMeterDisplay::Update( float fDeltaTime )
{ {
if( GAMESTATE->m_pCurSong ) if( GAMESTATE->m_pCurSong )
{ {
float fSongStartSeconds = GAMESTATE->m_pCurSong->m_SongTiming.GetElapsedTimeFromBeat( GAMESTATE->m_pCurSong->m_fFirstBeat ); float fSongStartSeconds = GAMESTATE->m_pCurSong->GetFirstSecond();
float fSongEndSeconds = GAMESTATE->m_pCurSong->m_SongTiming.GetElapsedTimeFromBeat( GAMESTATE->m_pCurSong->m_fLastBeat ); float fSongEndSeconds = GAMESTATE->m_pCurSong->GetLastSecond();
float fPercentPositionSong = SCALE( GAMESTATE->m_Position.m_fMusicSeconds, fSongStartSeconds, fSongEndSeconds, 0.0f, 1.0f ); float fPercentPositionSong = SCALE( GAMESTATE->m_Position.m_fMusicSeconds, fSongStartSeconds, fSongEndSeconds, 0.0f, 1.0f );
CLAMP( fPercentPositionSong, 0, 1 ); CLAMP( fPercentPositionSong, 0, 1 );
-2
View File
@@ -150,8 +150,6 @@ static void Deserialize( Song &out, const Json::Value &root )
else if( sSelectable.EqualsNoCase("NO") ) else if( sSelectable.EqualsNoCase("NO") )
out.m_SelectionDisplay = out.SHOW_NEVER; out.m_SelectionDisplay = out.SHOW_NEVER;
out.m_fFirstBeat = (float)root["FirstBeat"].asDouble();
out.m_fLastBeat = (float)root["LastBeat"].asDouble();
out.m_sSongFileName = root["SongFileName"].asString(); out.m_sSongFileName = root["SongFileName"].asString();
out.m_bHasMusic = root["HasMusic"].asBool(); out.m_bHasMusic = root["HasMusic"].asBool();
out.m_bHasBanner = root["HasBanner"].asBool(); out.m_bHasBanner = root["HasBanner"].asBool();
+12 -28
View File
@@ -812,37 +812,19 @@ bool SMLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCache
} }
else if( sValueName=="LASTBEATHINT" ) else if( sValueName=="LASTBEATHINT" )
out.m_fSpecifiedLastBeat = StringToFloat( sParams[1] ); {
// unable to identify at this point: ignore
}
else if( sValueName=="MUSICBYTES" ) else if( sValueName=="MUSICBYTES" )
; /* ignore */ ; /* ignore */
/* We calculate these. Some SMs in circulation have bogus values for // cache tags from older SM files: ignore.
* these, so make sure we always calculate it ourself. */ else if(sValueName=="FIRSTBEAT" || sValueName=="LASTBEAT" ||
else if( sValueName=="FIRSTBEAT" ) sValueName=="SONGFILENAME" || sValueName=="HASMUSIC" ||
sValueName=="HASBANNER")
{ {
if( bFromCache ) ;
out.m_fFirstBeat = StringToFloat( sParams[1] );
}
else if( sValueName=="LASTBEAT" )
{
if( bFromCache )
out.m_fLastBeat = StringToFloat( sParams[1] );
}
else if( sValueName=="SONGFILENAME" )
{
if( bFromCache )
out.m_sSongFileName = sParams[1];
}
else if( sValueName=="HASMUSIC" )
{
if( bFromCache )
out.m_bHasMusic = StringToInt( sParams[1] ) != 0;
}
else if( sValueName=="HASBANNER" )
{
if( bFromCache )
out.m_bHasBanner = StringToInt( sParams[1] ) != 0;
} }
else if( sValueName=="SAMPLESTART" ) else if( sValueName=="SAMPLESTART" )
@@ -1108,9 +1090,10 @@ void SMLoader::TidyUpData( Song &song, bool bFromCache )
if( bFromCache ) if( bFromCache )
break; break;
float lastBeat = song.GetLastBeat();
/* If BGChanges already exist after the last beat, don't add the /* If BGChanges already exist after the last beat, don't add the
* background in the middle. */ * background in the middle. */
if( !bg.empty() && bg.back().m_fStartBeat-0.0001f >= song.m_fLastBeat ) if( !bg.empty() && bg.back().m_fStartBeat-0.0001f >= lastBeat )
break; break;
// If the last BGA is already the song BGA, don't add a duplicate. // If the last BGA is already the song BGA, don't add a duplicate.
@@ -1120,7 +1103,8 @@ void SMLoader::TidyUpData( Song &song, bool bFromCache )
if( !IsAFile( song.GetBackgroundPath() ) ) if( !IsAFile( song.GetBackgroundPath() ) )
break; break;
bg.push_back( BackgroundChange(song.m_fLastBeat,song.m_sBackgroundFile) );
bg.push_back( BackgroundChange(lastBeat,song.m_sBackgroundFile) );
} while(0); } while(0);
} }
song.TidyUpData( bFromCache ); song.TidyUpData( bFromCache );
+7 -21
View File
@@ -225,30 +225,16 @@ bool SMALoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
} }
else if( sValueName=="LASTBEATHINT" ) else if( sValueName=="LASTBEATHINT" )
out.m_fSpecifiedLastBeat = StringToFloat( sParams[1] ); {
// can't identify at this position: ignore.
}
else if( sValueName=="MUSICBYTES" ) else if( sValueName=="MUSICBYTES" )
; /* ignore */ ; /* ignore */
/* We calculate these. Some SMs in circulation have bogus values for // Cache tags: ignore.
* these, so make sure we always calculate it ourself. */ else if (sValueName=="FIRSTBEAT" || sValueName=="LASTBEAT" ||
else if( sValueName=="FIRSTBEAT" ) sValueName=="SONGFILENAME" || sValueName=="HASMUSIC" ||
{ sValueName=="HASBANNER" )
;
}
else if( sValueName=="LASTBEAT" )
{
;
}
else if( sValueName=="SONGFILENAME" )
{
;
}
else if( sValueName=="HASMUSIC" )
{
;
}
else if( sValueName=="HASBANNER" )
{ {
; ;
} }
+14 -5
View File
@@ -265,7 +265,12 @@ bool SSCLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
else if( sValueName=="LASTBEATHINT" ) else if( sValueName=="LASTBEATHINT" )
{ {
out.m_fSpecifiedLastBeat = StringToFloat( sParams[1] ); // unable to parse due to tag position. Ignore.
}
else if (sValueName == "LASTSECONDHINT")
{
out.SetSpecifiedLastSecond(StringToFloat(sParams[1]));
} }
else if( sValueName=="MUSICBYTES" ) else if( sValueName=="MUSICBYTES" )
@@ -395,16 +400,20 @@ bool SSCLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
/* The following are cache tags. Never fill their values /* The following are cache tags. Never fill their values
* directly: only from the cached version. */ * directly: only from the cached version. */
else if( sValueName=="FIRSTBEAT" ) else if( sValueName=="FIRSTBEAT" || sValueName=="LASTBEAT" )
{
// no longer used.
}
else if (sValueName=="FIRSTSECOND")
{ {
if( bFromCache ) if( bFromCache )
out.m_fFirstBeat = StringToFloat( sParams[1] ); out.SetFirstSecond(StringToFloat(sParams[1]));
} }
else if( sValueName=="LASTBEAT" ) else if( sValueName=="LASTSECOND" )
{ {
if( bFromCache ) if( bFromCache )
out.m_fLastBeat = StringToFloat( sParams[1] ); out.SetLastSecond(StringToFloat(sParams[1]));
} }
else if( sValueName=="SONGFILENAME" ) else if( sValueName=="SONGFILENAME" )
+2 -2
View File
@@ -147,8 +147,8 @@ bool NotesWriterJson::WriteSong( const RString &sFile, const Song &out, bool bWr
else else
root["Selectable"] = "YES"; root["Selectable"] = "YES";
root["FirstBeat"] = out.m_fFirstBeat; root["FirstBeat"] = out.GetFirstBeat();
root["LastBeat"] = out.m_fLastBeat; root["LastBeat"] = out.GetLastBeat();
root["SongFileName"] = out.m_sSongFileName; root["SongFileName"] = out.m_sSongFileName;
root["HasMusic"] = out.m_bHasMusic; root["HasMusic"] = out.m_bHasMusic;
root["HasBanner"] = out.m_bHasBanner; root["HasBanner"] = out.m_bHasBanner;
+3 -2
View File
@@ -66,8 +66,9 @@ static void WriteGlobalTags( RageFile &f, Song &out )
f.PutLine( ssprintf( "#OFFSET:%.3f;", out.m_SongTiming.m_fBeat0OffsetInSeconds ) ); f.PutLine( ssprintf( "#OFFSET:%.3f;", out.m_SongTiming.m_fBeat0OffsetInSeconds ) );
f.PutLine( ssprintf( "#SAMPLESTART:%.3f;", out.m_fMusicSampleStartSeconds ) ); f.PutLine( ssprintf( "#SAMPLESTART:%.3f;", out.m_fMusicSampleStartSeconds ) );
f.PutLine( ssprintf( "#SAMPLELENGTH:%.3f;", out.m_fMusicSampleLengthSeconds ) ); f.PutLine( ssprintf( "#SAMPLELENGTH:%.3f;", out.m_fMusicSampleLengthSeconds ) );
if( out.m_fSpecifiedLastBeat > 0 ) float specBeat = out.GetSpecifiedLastBeat();
f.PutLine( ssprintf("#LASTBEATHINT:%.3f;", out.m_fSpecifiedLastBeat) ); if( specBeat > 0 )
f.PutLine( ssprintf("#LASTBEATHINT:%.3f;", specBeat) );
f.Write( "#SELECTABLE:" ); f.Write( "#SELECTABLE:" );
switch(out.m_SelectionDisplay) switch(out.m_SelectionDisplay)
+6 -5
View File
@@ -203,8 +203,6 @@ static void WriteGlobalTags( RageFile &f, const Song &out )
f.PutLine( ssprintf( "#OFFSET:%.6f;", out.m_SongTiming.m_fBeat0OffsetInSeconds ) ); f.PutLine( ssprintf( "#OFFSET:%.6f;", out.m_SongTiming.m_fBeat0OffsetInSeconds ) );
f.PutLine( ssprintf( "#SAMPLESTART:%.6f;", out.m_fMusicSampleStartSeconds ) ); f.PutLine( ssprintf( "#SAMPLESTART:%.6f;", out.m_fMusicSampleStartSeconds ) );
f.PutLine( ssprintf( "#SAMPLELENGTH:%.6f;", out.m_fMusicSampleLengthSeconds ) ); f.PutLine( ssprintf( "#SAMPLELENGTH:%.6f;", out.m_fMusicSampleLengthSeconds ) );
if( out.m_fSpecifiedLastBeat > 0 )
f.PutLine( ssprintf("#LASTBEATHINT:%.6f;", out.m_fSpecifiedLastBeat) );
f.Write( "#SELECTABLE:" ); f.Write( "#SELECTABLE:" );
switch(out.m_SelectionDisplay) switch(out.m_SelectionDisplay)
@@ -234,6 +232,9 @@ static void WriteGlobalTags( RageFile &f, const Song &out )
WriteTimingTags( f, out.m_SongTiming, true ); WriteTimingTags( f, out.m_SongTiming, true );
if( out.GetSpecifiedLastSecond() > 0 )
f.PutLine( ssprintf("#LASTSECONDHINT:%.6f;", out.GetSpecifiedLastSecond()) );
FOREACH_BackgroundLayer( b ) FOREACH_BackgroundLayer( b )
{ {
if( b==0 ) if( b==0 )
@@ -367,12 +368,12 @@ bool NotesWriterSSC::Write( RString sPath, const Song &out, const vector<Steps*>
if( bSavingCache ) if( bSavingCache )
{ {
f.PutLine( ssprintf( "// cache tags:" ) ); f.PutLine( ssprintf( "// cache tags:" ) );
f.PutLine( ssprintf( "#FIRSTBEAT:%.3f;", out.m_fFirstBeat ) ); f.PutLine( ssprintf( "#FIRSTSECOND:%.6f;", out.GetFirstSecond() ) );
f.PutLine( ssprintf( "#LASTBEAT:%.3f;", out.m_fLastBeat ) ); f.PutLine( ssprintf( "#LASTSECOND:%.6f;", out.GetLastSecond() ) );
f.PutLine( ssprintf( "#SONGFILENAME:%s;", out.m_sSongFileName.c_str() ) ); f.PutLine( ssprintf( "#SONGFILENAME:%s;", out.m_sSongFileName.c_str() ) );
f.PutLine( ssprintf( "#HASMUSIC:%i;", out.m_bHasMusic ) ); f.PutLine( ssprintf( "#HASMUSIC:%i;", out.m_bHasMusic ) );
f.PutLine( ssprintf( "#HASBANNER:%i;", out.m_bHasBanner ) ); f.PutLine( ssprintf( "#HASBANNER:%i;", out.m_bHasBanner ) );
f.PutLine( ssprintf( "#MUSICLENGTH:%.3f;", out.m_fMusicLengthSeconds ) ); f.PutLine( ssprintf( "#MUSICLENGTH:%.6f;", out.m_fMusicLengthSeconds ) );
f.PutLine( ssprintf( "// end cache tags" ) ); f.PutLine( ssprintf( "// end cache tags" ) );
} }
+1 -1
View File
@@ -115,7 +115,7 @@ void TimingWindowSecondsInit( size_t /*TimingWindow*/ i, RString &sNameOut, floa
case TW_W5: defaultValueOut = 0.180f; break; case TW_W5: defaultValueOut = 0.180f; break;
case TW_Mine: defaultValueOut = 0.090f; break; // same as great case TW_Mine: defaultValueOut = 0.090f; break; // same as great
case TW_Hold: defaultValueOut = 0.500f; break; // allow enough time to take foot off and put back on case TW_Hold: defaultValueOut = 0.500f; break; // allow enough time to take foot off and put back on
case TW_Roll: defaultValueOut = 0.350f; break; case TW_Roll: defaultValueOut = 0.500f; break;
case TW_Attack: defaultValueOut = 0.135f; break; case TW_Attack: defaultValueOut = 0.135f; break;
} }
} }
+69 -39
View File
@@ -581,6 +581,7 @@ static MenuDef g_AreaMenu(
EditMode_Full, true, true, 0, NULL ), EditMode_Full, true, true, 0, NULL ),
MenuRowDef(ScreenEdit::convert_delay_to_beat, "Convert delay to beats", true, MenuRowDef(ScreenEdit::convert_delay_to_beat, "Convert delay to beats", true,
EditMode_Full, true, true, 0, NULL ), EditMode_Full, true, true, 0, NULL ),
MenuRowDef(ScreenEdit::last_second_at_beat, "Designate last second at current beat", true, EditMode_Full, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::undo, "Undo", true, EditMode_Practice, true, true, 0, NULL ), MenuRowDef( ScreenEdit::undo, "Undo", true, EditMode_Practice, true, true, 0, NULL ),
MenuRowDef(ScreenEdit::clear_clipboard, "Clear clipboard", true, MenuRowDef(ScreenEdit::clear_clipboard, "Clear clipboard", true,
EditMode_Practice, true, true, 0, NULL ) EditMode_Practice, true, true, 0, NULL )
@@ -618,7 +619,7 @@ static MenuDef g_SongInformation(
MenuRowDef( ScreenEdit::main_title_transliteration, "Main title transliteration", true, EditMode_Practice, true, true, 0, NULL ), MenuRowDef( ScreenEdit::main_title_transliteration, "Main title transliteration", true, EditMode_Practice, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::sub_title_transliteration, "Sub title transliteration", true, EditMode_Practice, true, true, 0, NULL ), MenuRowDef( ScreenEdit::sub_title_transliteration, "Sub title transliteration", true, EditMode_Practice, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::artist_transliteration, "Artist transliteration", true, EditMode_Practice, true, true, 0, NULL ), MenuRowDef( ScreenEdit::artist_transliteration, "Artist transliteration", true, EditMode_Practice, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::last_beat_hint, "Last beat hint", true, EditMode_Full, true, true, 0, NULL ), MenuRowDef( ScreenEdit::last_second_hint, "Last second hint", true, EditMode_Full, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::preview_start, "Preview Start", true, EditMode_Full, true, true, 0, NULL ), MenuRowDef( ScreenEdit::preview_start, "Preview Start", true, EditMode_Full, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::preview_length, "Preview Length", true, EditMode_Full, true, true, 0, NULL ), MenuRowDef( ScreenEdit::preview_length, "Preview Length", true, EditMode_Full, true, true, 0, NULL ),
MenuRowDef( ScreenEdit::display_bpm, "Display BPM", true, EditMode_Full, true, true, 0, "Actual", "Specified", "Random" ), MenuRowDef( ScreenEdit::display_bpm, "Display BPM", true, EditMode_Full, true, true, 0, "Actual", "Specified", "Random" ),
@@ -1935,6 +1936,14 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
} }
GetAppropriateTiming().m_fBeat0OffsetInSeconds += fDelta; GetAppropriateTiming().m_fBeat0OffsetInSeconds += fDelta;
(fDelta>0 ? m_soundValueIncrease : m_soundValueDecrease).Play(); (fDelta>0 ? m_soundValueIncrease : m_soundValueDecrease).Play();
if (GAMESTATE->m_bIsUsingStepTiming)
{
GAMESTATE->m_pCurSteps[PLAYER_1]->m_Attacks.UpdateStartTimes(fDelta);
}
else
{
GAMESTATE->m_pCurSong->m_Attacks.UpdateStartTimes(fDelta);
}
SetDirty( true ); SetDirty( true );
} }
break; break;
@@ -2127,7 +2136,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
if (index >= 0) if (index >= 0)
{ {
const RString sDuration = ssprintf( "%.5f", attacks[index].fSecsRemaining ); const RString sDuration = ssprintf( "%.6f", attacks[index].fSecsRemaining );
g_InsertCourseAttack.rows[remove].bEnabled = true; g_InsertCourseAttack.rows[remove].bEnabled = true;
if( g_InsertCourseAttack.rows[duration].choices.size() == 9 ) if( g_InsertCourseAttack.rows[duration].choices.size() == 9 )
@@ -2158,7 +2167,7 @@ void ScreenEdit::InputEdit( const InputEventPlus &input, EditButton EditB )
if( iAttack >= 0 ) if( iAttack >= 0 )
{ {
const RString sDuration = ssprintf( "%.5f", ce.attacks[iAttack].fSecsRemaining ); const RString sDuration = ssprintf( "%.6f", ce.attacks[iAttack].fSecsRemaining );
g_InsertCourseAttack.rows[remove].bEnabled = true; g_InsertCourseAttack.rows[remove].bEnabled = true;
if( g_InsertCourseAttack.rows[duration].choices.size() == 9 ) if( g_InsertCourseAttack.rows[duration].choices.size() == 9 )
@@ -3426,13 +3435,26 @@ static void ChangeArtistTranslit( const RString &sNew )
static void ChangeBeat0Offset( const RString &sNew ) static void ChangeBeat0Offset( const RString &sNew )
{ {
TimingData &timing = GAMESTATE->m_bIsUsingStepTiming ? GAMESTATE->m_pCurSteps[PLAYER_1]->m_Timing : GAMESTATE->m_pCurSong->m_SongTiming; TimingData &timing = (GAMESTATE->m_bIsUsingStepTiming ?
GAMESTATE->m_pCurSteps[PLAYER_1]->m_Timing :
GAMESTATE->m_pCurSong->m_SongTiming);
float old = timing.m_fBeat0OffsetInSeconds;
timing.m_fBeat0OffsetInSeconds = StringToFloat( sNew ); timing.m_fBeat0OffsetInSeconds = StringToFloat( sNew );
float delta = timing.m_fBeat0OffsetInSeconds - old;
if (GAMESTATE->m_bIsUsingStepTiming)
{
GAMESTATE->m_pCurSteps[PLAYER_1]->m_Attacks.UpdateStartTimes(delta);
}
else
{
GAMESTATE->m_pCurSong->m_Attacks.UpdateStartTimes(delta);
}
} }
static void ChangeLastBeatHint( const RString &sNew ) static void ChangeLastSecondHint( const RString &sNew )
{ {
GAMESTATE->m_pCurSong->m_fSpecifiedLastBeat = StringToFloat( sNew ); Song &s = *GAMESTATE->m_pCurSong;
s.SetSpecifiedLastSecond(StringToFloat(sNew));
} }
static void ChangePreviewStart( const RString &sNew ) static void ChangePreviewStart( const RString &sNew )
@@ -3507,23 +3529,23 @@ void ScreenEdit::DisplayTimingMenu()
TimingData &pTime = GetAppropriateTiming(); TimingData &pTime = GetAppropriateTiming();
bool bHasSpeedOnThisRow = pTime.GetSpeedSegmentAtBeat( fBeat ).GetBeat() == fBeat; bool bHasSpeedOnThisRow = pTime.GetSpeedSegmentAtBeat( fBeat ).GetBeat() == fBeat;
g_TimingDataInformation.rows[beat_0_offset].SetOneUnthemedChoice( ssprintf("%.5f", pTime.m_fBeat0OffsetInSeconds) ); g_TimingDataInformation.rows[beat_0_offset].SetOneUnthemedChoice( ssprintf("%.6f", pTime.m_fBeat0OffsetInSeconds) );
g_TimingDataInformation.rows[bpm].SetOneUnthemedChoice( ssprintf("%.5f", pTime.GetBPMAtBeat( fBeat ) ) ); g_TimingDataInformation.rows[bpm].SetOneUnthemedChoice( ssprintf("%.6f", pTime.GetBPMAtBeat( fBeat ) ) );
g_TimingDataInformation.rows[stop].SetOneUnthemedChoice( ssprintf("%.5f", pTime.GetStopAtBeat( fBeat ) ) ) ; g_TimingDataInformation.rows[stop].SetOneUnthemedChoice( ssprintf("%.6f", pTime.GetStopAtBeat( fBeat ) ) ) ;
g_TimingDataInformation.rows[delay].SetOneUnthemedChoice( ssprintf("%.5f", pTime.GetDelayAtBeat( fBeat ) ) ); g_TimingDataInformation.rows[delay].SetOneUnthemedChoice( ssprintf("%.6f", pTime.GetDelayAtBeat( fBeat ) ) );
g_TimingDataInformation.rows[time_signature].SetOneUnthemedChoice( ssprintf("%d / %d", pTime.GetTimeSignatureNumeratorAtBeat( fBeat ), pTime.GetTimeSignatureDenominatorAtBeat( fBeat ) ) ); g_TimingDataInformation.rows[time_signature].SetOneUnthemedChoice( ssprintf("%d / %d", pTime.GetTimeSignatureNumeratorAtBeat( fBeat ), pTime.GetTimeSignatureDenominatorAtBeat( fBeat ) ) );
g_TimingDataInformation.rows[label].SetOneUnthemedChoice( pTime.GetLabelAtBeat( fBeat ).c_str() ); g_TimingDataInformation.rows[label].SetOneUnthemedChoice( pTime.GetLabelAtBeat( fBeat ).c_str() );
g_TimingDataInformation.rows[tickcount].SetOneUnthemedChoice( ssprintf("%d", pTime.GetTickcountAtBeat( fBeat ) ) ); g_TimingDataInformation.rows[tickcount].SetOneUnthemedChoice( ssprintf("%d", pTime.GetTickcountAtBeat( fBeat ) ) );
g_TimingDataInformation.rows[combo].SetOneUnthemedChoice( ssprintf("%d", pTime.GetComboAtBeat( fBeat ) ) ); g_TimingDataInformation.rows[combo].SetOneUnthemedChoice( ssprintf("%d", pTime.GetComboAtBeat( fBeat ) ) );
g_TimingDataInformation.rows[warp].SetOneUnthemedChoice( ssprintf("%.5f", pTime.GetWarpAtBeat( fBeat ) ) ); g_TimingDataInformation.rows[warp].SetOneUnthemedChoice( ssprintf("%.6f", pTime.GetWarpAtBeat( fBeat ) ) );
g_TimingDataInformation.rows[speed_percent].SetOneUnthemedChoice( bHasSpeedOnThisRow ? ssprintf("%.5f", pTime.GetSpeedPercentAtBeat( fBeat ) ) : "---" ); g_TimingDataInformation.rows[speed_percent].SetOneUnthemedChoice( bHasSpeedOnThisRow ? ssprintf("%.6f", pTime.GetSpeedPercentAtBeat( fBeat ) ) : "---" );
g_TimingDataInformation.rows[speed_wait].SetOneUnthemedChoice( bHasSpeedOnThisRow ? ssprintf("%.5f", pTime.GetSpeedWaitAtBeat( fBeat ) ) : "---" ); g_TimingDataInformation.rows[speed_wait].SetOneUnthemedChoice( bHasSpeedOnThisRow ? ssprintf("%.6f", pTime.GetSpeedWaitAtBeat( fBeat ) ) : "---" );
RString starting = ( pTime.GetSpeedModeAtBeat( fBeat ) == 1 ? "Seconds" : "Beats" ); RString starting = ( pTime.GetSpeedModeAtBeat( fBeat ) == 1 ? "Seconds" : "Beats" );
g_TimingDataInformation.rows[speed_mode].SetOneUnthemedChoice( starting.c_str() ); g_TimingDataInformation.rows[speed_mode].SetOneUnthemedChoice( starting.c_str() );
g_TimingDataInformation.rows[scroll].SetOneUnthemedChoice( ssprintf("%.5f", pTime.GetScrollAtBeat( fBeat ) ) ); g_TimingDataInformation.rows[scroll].SetOneUnthemedChoice( ssprintf("%.6f", pTime.GetScrollAtBeat( fBeat ) ) );
g_TimingDataInformation.rows[fake].SetOneUnthemedChoice( ssprintf("%.5f", pTime.GetFakeAtBeat( fBeat ) ) ); g_TimingDataInformation.rows[fake].SetOneUnthemedChoice( ssprintf("%.6f", pTime.GetFakeAtBeat( fBeat ) ) );
g_TimingDataInformation.rows[tickcount].bEnabled = GAMESTATE->m_bIsUsingStepTiming; g_TimingDataInformation.rows[tickcount].bEnabled = GAMESTATE->m_bIsUsingStepTiming;
g_TimingDataInformation.rows[combo].bEnabled = GAMESTATE->m_bIsUsingStepTiming; g_TimingDataInformation.rows[combo].bEnabled = GAMESTATE->m_bIsUsingStepTiming;
@@ -3733,12 +3755,12 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
g_SongInformation.rows[main_title_transliteration].SetOneUnthemedChoice( pSong->m_sMainTitleTranslit ); g_SongInformation.rows[main_title_transliteration].SetOneUnthemedChoice( pSong->m_sMainTitleTranslit );
g_SongInformation.rows[sub_title_transliteration].SetOneUnthemedChoice( pSong->m_sSubTitleTranslit ); g_SongInformation.rows[sub_title_transliteration].SetOneUnthemedChoice( pSong->m_sSubTitleTranslit );
g_SongInformation.rows[artist_transliteration].SetOneUnthemedChoice( pSong->m_sArtistTranslit ); g_SongInformation.rows[artist_transliteration].SetOneUnthemedChoice( pSong->m_sArtistTranslit );
g_SongInformation.rows[last_beat_hint].SetOneUnthemedChoice( ssprintf("%.5f", pSong->m_fSpecifiedLastBeat) ); g_SongInformation.rows[last_second_hint].SetOneUnthemedChoice( ssprintf("%.6f", pSong->GetSpecifiedLastSecond()) );
g_SongInformation.rows[preview_start].SetOneUnthemedChoice( ssprintf("%.5f", pSong->m_fMusicSampleStartSeconds) ); g_SongInformation.rows[preview_start].SetOneUnthemedChoice( ssprintf("%.6f", pSong->m_fMusicSampleStartSeconds) );
g_SongInformation.rows[preview_length].SetOneUnthemedChoice( ssprintf("%.5f", pSong->m_fMusicSampleLengthSeconds) ); g_SongInformation.rows[preview_length].SetOneUnthemedChoice( ssprintf("%.6f", pSong->m_fMusicSampleLengthSeconds) );
g_SongInformation.rows[display_bpm].iDefaultChoice = pSong->m_DisplayBPMType; g_SongInformation.rows[display_bpm].iDefaultChoice = pSong->m_DisplayBPMType;
g_SongInformation.rows[min_bpm].SetOneUnthemedChoice( ssprintf("%.5f", pSong->m_fSpecifiedBPMMin) ); g_SongInformation.rows[min_bpm].SetOneUnthemedChoice( ssprintf("%.6f", pSong->m_fSpecifiedBPMMin) );
g_SongInformation.rows[max_bpm].SetOneUnthemedChoice( ssprintf("%.5f", pSong->m_fSpecifiedBPMMax) ); g_SongInformation.rows[max_bpm].SetOneUnthemedChoice( ssprintf("%.6f", pSong->m_fSpecifiedBPMMax) );
EditMiniMenu( &g_SongInformation, SM_BackFromSongInformation ); EditMiniMenu( &g_SongInformation, SM_BackFromSongInformation );
} }
@@ -4126,6 +4148,13 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, const vector<int> &iAns
timing.InsertRows(GetRow(), BeatToNoteRow(pauseBeats)); timing.InsertRows(GetRow(), BeatToNoteRow(pauseBeats));
break; break;
} }
case last_second_at_beat:
{
TimingData &timing = GetAppropriateTiming();
Song &s = *GAMESTATE->m_pCurSong;
s.SetSpecifiedLastSecond(timing.GetElapsedTimeFromBeat(GetBeat()));
break;
}
case undo: case undo:
Undo(); Undo();
break; break;
@@ -4206,7 +4235,7 @@ static LocalizedString ENTER_CREDIT ("ScreenEdit","Enter a new credit.");
static LocalizedString ENTER_MAIN_TITLE_TRANSLIT ("ScreenEdit","Enter a new main title transliteration."); static LocalizedString ENTER_MAIN_TITLE_TRANSLIT ("ScreenEdit","Enter a new main title transliteration.");
static LocalizedString ENTER_SUB_TITLE_TRANSLIT ("ScreenEdit","Enter a new sub title transliteration."); static LocalizedString ENTER_SUB_TITLE_TRANSLIT ("ScreenEdit","Enter a new sub title transliteration.");
static LocalizedString ENTER_ARTIST_TRANSLIT ("ScreenEdit","Enter a new artist transliteration."); static LocalizedString ENTER_ARTIST_TRANSLIT ("ScreenEdit","Enter a new artist transliteration.");
static LocalizedString ENTER_LAST_BEAT_HINT ("ScreenEdit","Enter a new last beat hint."); static LocalizedString ENTER_LAST_SECOND_HINT ("ScreenEdit","Enter a new last second hint.");
static LocalizedString ENTER_PREVIEW_START ("ScreenEdit","Enter a new preview start."); static LocalizedString ENTER_PREVIEW_START ("ScreenEdit","Enter a new preview start.");
static LocalizedString ENTER_PREVIEW_LENGTH ("ScreenEdit","Enter a new preview length."); static LocalizedString ENTER_PREVIEW_LENGTH ("ScreenEdit","Enter a new preview length.");
static LocalizedString ENTER_MIN_BPM ("ScreenEdit","Enter a new min BPM."); static LocalizedString ENTER_MIN_BPM ("ScreenEdit","Enter a new min BPM.");
@@ -4242,29 +4271,29 @@ void ScreenEdit::HandleSongInformationChoice( SongInformationChoice c, const vec
case artist_transliteration: case artist_transliteration:
ScreenTextEntry::TextEntry( SM_None, ENTER_ARTIST_TRANSLIT, pSong->m_sArtistTranslit, 100, NULL, ChangeArtistTranslit, NULL ); ScreenTextEntry::TextEntry( SM_None, ENTER_ARTIST_TRANSLIT, pSong->m_sArtistTranslit, 100, NULL, ChangeArtistTranslit, NULL );
break; break;
case last_beat_hint: case last_second_hint:
ScreenTextEntry::TextEntry( SM_None, ENTER_LAST_BEAT_HINT, ScreenTextEntry::TextEntry( SM_None, ENTER_LAST_SECOND_HINT,
ssprintf("%.5f", pSong->m_fSpecifiedLastBeat), 20, ssprintf("%.6f", pSong->GetSpecifiedLastSecond()), 20,
ScreenTextEntry::FloatValidate, ChangeLastBeatHint, NULL ); ScreenTextEntry::FloatValidate, ChangeLastSecondHint, NULL );
break; break;
case preview_start: case preview_start:
ScreenTextEntry::TextEntry( SM_None, ENTER_PREVIEW_START, ScreenTextEntry::TextEntry( SM_None, ENTER_PREVIEW_START,
ssprintf("%.5f", pSong->m_fMusicSampleStartSeconds), 20, ssprintf("%.6f", pSong->m_fMusicSampleStartSeconds), 20,
ScreenTextEntry::FloatValidate, ChangePreviewStart, NULL ); ScreenTextEntry::FloatValidate, ChangePreviewStart, NULL );
break; break;
case preview_length: case preview_length:
ScreenTextEntry::TextEntry( SM_None, ENTER_PREVIEW_LENGTH, ScreenTextEntry::TextEntry( SM_None, ENTER_PREVIEW_LENGTH,
ssprintf("%.5f", pSong->m_fMusicSampleLengthSeconds), 20, ssprintf("%.6f", pSong->m_fMusicSampleLengthSeconds), 20,
ScreenTextEntry::FloatValidate, ChangePreviewLength, NULL ); ScreenTextEntry::FloatValidate, ChangePreviewLength, NULL );
break; break;
case min_bpm: case min_bpm:
ScreenTextEntry::TextEntry( SM_None, ENTER_MIN_BPM, ScreenTextEntry::TextEntry( SM_None, ENTER_MIN_BPM,
ssprintf("%.5f", pSong->m_fSpecifiedBPMMin), 20, ssprintf("%.6f", pSong->m_fSpecifiedBPMMin), 20,
ScreenTextEntry::FloatValidate, ChangeMinBPM, NULL ); ScreenTextEntry::FloatValidate, ChangeMinBPM, NULL );
break; break;
case max_bpm: case max_bpm:
ScreenTextEntry::TextEntry( SM_None, ENTER_MAX_BPM, ScreenTextEntry::TextEntry( SM_None, ENTER_MAX_BPM,
ssprintf("%.5f", pSong->m_fSpecifiedBPMMax), 20, ssprintf("%.6f", pSong->m_fSpecifiedBPMMax), 20,
ScreenTextEntry::FloatValidate, ChangeMaxBPM, NULL ); ScreenTextEntry::FloatValidate, ChangeMaxBPM, NULL );
break; break;
}; };
@@ -4293,7 +4322,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
DEFAULT_FAIL( c ); DEFAULT_FAIL( c );
case beat_0_offset: case beat_0_offset:
ScreenTextEntry::TextEntry( SM_None, ENTER_BEAT_0_OFFSET, ScreenTextEntry::TextEntry( SM_None, ENTER_BEAT_0_OFFSET,
ssprintf("%.5f", GetAppropriateTiming().m_fBeat0OffsetInSeconds), 20, ssprintf("%.6f", GetAppropriateTiming().m_fBeat0OffsetInSeconds), 20,
ScreenTextEntry::FloatValidate, ChangeBeat0Offset, NULL ); ScreenTextEntry::FloatValidate, ChangeBeat0Offset, NULL );
break; break;
case bpm: case bpm:
@@ -4359,7 +4388,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry( ScreenTextEntry::TextEntry(
SM_BackFromWarpChange, SM_BackFromWarpChange,
ENTER_WARP_VALUE, ENTER_WARP_VALUE,
ssprintf( "%.4f", GetAppropriateTiming().GetWarpAtBeat( GetBeat() ) ), ssprintf( "%.6f", GetAppropriateTiming().GetWarpAtBeat( GetBeat() ) ),
10 10
); );
break; break;
@@ -4367,7 +4396,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry( ScreenTextEntry::TextEntry(
SM_BackFromSpeedPercentChange, SM_BackFromSpeedPercentChange,
ENTER_SPEED_PERCENT_VALUE, ENTER_SPEED_PERCENT_VALUE,
ssprintf( "%.5f", GetAppropriateTiming().GetSpeedSegmentAtBeat( GetBeat() ).GetRatio() ), ssprintf( "%.6f", GetAppropriateTiming().GetSpeedSegmentAtBeat( GetBeat() ).GetRatio() ),
10 10
); );
break; break;
@@ -4375,7 +4404,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry( ScreenTextEntry::TextEntry(
SM_BackFromScrollChange, SM_BackFromScrollChange,
ENTER_SCROLL_VALUE, ENTER_SCROLL_VALUE,
ssprintf( "%.5f", GetAppropriateTiming().GetScrollSegmentAtBeat( GetBeat() ).GetRatio() ), ssprintf( "%.6f", GetAppropriateTiming().GetScrollSegmentAtBeat( GetBeat() ).GetRatio() ),
10 10
); );
break; break;
@@ -4383,7 +4412,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry( ScreenTextEntry::TextEntry(
SM_BackFromSpeedWaitChange, SM_BackFromSpeedWaitChange,
ENTER_SPEED_WAIT_VALUE, ENTER_SPEED_WAIT_VALUE,
ssprintf( "%.5f", GetAppropriateTiming().GetSpeedSegmentAtBeat( GetBeat() ).GetLength() ), ssprintf( "%.6f", GetAppropriateTiming().GetSpeedSegmentAtBeat( GetBeat() ).GetLength() ),
10 10
); );
break; break;
@@ -4403,7 +4432,7 @@ void ScreenEdit::HandleTimingDataInformationChoice( TimingDataInformationChoice
ScreenTextEntry::TextEntry( ScreenTextEntry::TextEntry(
SM_BackFromFakeChange, SM_BackFromFakeChange,
ENTER_FAKE_VALUE, ENTER_FAKE_VALUE,
ssprintf("%.5f", GetAppropriateTiming().GetFakeAtBeat( GetBeat() ) ), ssprintf("%.6f", GetAppropriateTiming().GetFakeAtBeat( GetBeat() ) ),
10 10
); );
break; break;
@@ -4701,14 +4730,15 @@ float ScreenEdit::GetMaximumBeatForNewNote() const
case EditMode_CourseMods: case EditMode_CourseMods:
case EditMode_Home: case EditMode_Home:
{ {
float fEndBeat = GAMESTATE->m_pCurSong->m_fLastBeat; Song &s = *GAMESTATE->m_pCurSong;
float fEndBeat = s.GetLastBeat();
/* Round up to the next measure end. Some songs end on weird beats /* Round up to the next measure end. Some songs end on weird beats
* mid-measure, and it's odd to have movement capped to these weird * mid-measure, and it's odd to have movement capped to these weird
* beats. */ * beats. */
TimingData &songTiming = GAMESTATE->m_pCurSong->m_SongTiming; TimingData &timing = s.m_SongTiming;
float playerBeat = GetAppropriatePosition().m_fSongBeat; float playerBeat = GetAppropriatePosition().m_fSongBeat;
int beatsPerMeasure = songTiming.GetTimeSignatureSegmentAtBeat( playerBeat ).GetNum(); int beatsPerMeasure = timing.GetTimeSignatureSegmentAtBeat( playerBeat ).GetNum();
fEndBeat += beatsPerMeasure; fEndBeat += beatsPerMeasure;
fEndBeat = ftruncf( fEndBeat, (float)beatsPerMeasure ); fEndBeat = ftruncf( fEndBeat, (float)beatsPerMeasure );
@@ -4723,7 +4753,7 @@ float ScreenEdit::GetMaximumBeatForMoving() const
{ {
float fEndBeat = GetMaximumBeatForNewNote(); float fEndBeat = GetMaximumBeatForNewNote();
/* Jump to GetLastBeat even if it's past m_pCurSong->m_fLastBeat /* Jump to GetLastBeat even if it's past the song's last beat
* so that users can delete garbage steps past then end that they have * so that users can delete garbage steps past then end that they have
* have inserted in a text editor. Once they delete all steps on * have inserted in a text editor. Once they delete all steps on
* GetLastBeat() and move off of that beat, they won't be able to return. */ * GetLastBeat() and move off of that beat, they won't be able to return. */
+2 -1
View File
@@ -421,6 +421,7 @@ public:
shift_pauses_backward, shift_pauses_backward,
convert_pause_to_beat, convert_pause_to_beat,
convert_delay_to_beat, convert_delay_to_beat,
last_second_at_beat,
undo, undo,
clear_clipboard, clear_clipboard,
NUM_AREA_MENU_CHOICES NUM_AREA_MENU_CHOICES
@@ -529,7 +530,7 @@ public:
main_title_transliteration, main_title_transliteration,
sub_title_transliteration, sub_title_transliteration,
artist_transliteration, artist_transliteration,
last_beat_hint, last_second_hint,
preview_start, preview_start,
preview_length, preview_length,
display_bpm, display_bpm,
+9 -6
View File
@@ -1329,8 +1329,7 @@ void ScreenGameplay::StartPlayingSong( float fMinTimeToNotes, float fMinTimeToMu
p.StopMode = RageSoundParams::M_CONTINUE; p.StopMode = RageSoundParams::M_CONTINUE;
{ {
const float fFirstBeat = GAMESTATE->m_pCurSong->m_fFirstBeat; const float fFirstSecond = GAMESTATE->m_pCurSong->GetFirstSecond();
const float fFirstSecond = GAMESTATE->m_pCurSong->m_SongTiming.GetElapsedTimeFromBeat( fFirstBeat );
float fStartDelay = fMinTimeToNotes - fFirstSecond; float fStartDelay = fMinTimeToNotes - fFirstSecond;
fStartDelay = max( fStartDelay, fMinTimeToMusic ); fStartDelay = max( fStartDelay, fMinTimeToMusic );
p.m_StartSecond = -fStartDelay; p.m_StartSecond = -fStartDelay;
@@ -1413,7 +1412,7 @@ void ScreenGameplay::PlayAnnouncer( RString type, float fSeconds )
if( m_DancingState != STATE_DANCING ) if( m_DancingState != STATE_DANCING )
return; return;
if(GAMESTATE->m_pCurSong == NULL || // this will be true on ScreenDemonstration sometimes if(GAMESTATE->m_pCurSong == NULL || // this will be true on ScreenDemonstration sometimes
GAMESTATE->m_Position.m_fSongBeat < GAMESTATE->m_pCurSong->m_fFirstBeat ) GAMESTATE->m_Position.m_fSongBeat < GAMESTATE->m_pCurSong->GetFirstBeat())
return; return;
if( m_fTimeSinceLastDancingComment < fSeconds ) if( m_fTimeSinceLastDancingComment < fSeconds )
@@ -1488,7 +1487,7 @@ bool ScreenGameplay::AllAreFailing()
void ScreenGameplay::GetMusicEndTiming( float &fSecondsToStartFadingOutMusic, float &fSecondsToStartTransitioningOut ) void ScreenGameplay::GetMusicEndTiming( float &fSecondsToStartFadingOutMusic, float &fSecondsToStartTransitioningOut )
{ {
float fLastStepSeconds = GAMESTATE->m_pCurSong->m_SongTiming.GetElapsedTimeFromBeat( GAMESTATE->m_pCurSong->m_fLastBeat ); float fLastStepSeconds = GAMESTATE->m_pCurSong->GetLastSecond();
fLastStepSeconds += Player::GetMaxStepDistanceSeconds(); fLastStepSeconds += Player::GetMaxStepDistanceSeconds();
float fTransitionLength; float fTransitionLength;
@@ -1696,7 +1695,10 @@ void ScreenGameplay::Update( float fDeltaTime )
// update fGameplaySeconds // update fGameplaySeconds
STATSMAN->m_CurStageStats.m_fGameplaySeconds += fUnscaledDeltaTime; STATSMAN->m_CurStageStats.m_fGameplaySeconds += fUnscaledDeltaTime;
if( GAMESTATE->m_Position.m_fSongBeat >= GAMESTATE->m_pCurSong->m_fFirstBeat && GAMESTATE->m_Position.m_fSongBeat < GAMESTATE->m_pCurSong->m_fLastBeat ) float curBeat = GAMESTATE->m_Position.m_fSongBeat;
Song &s = *GAMESTATE->m_pCurSong;
if( curBeat >= s.GetFirstBeat() && curBeat < s.GetLastBeat() )
{ {
STATSMAN->m_CurStageStats.m_fStepsSeconds += fUnscaledDeltaTime; STATSMAN->m_CurStageStats.m_fStepsSeconds += fUnscaledDeltaTime;
@@ -1977,7 +1979,8 @@ void ScreenGameplay::UpdateLights()
} }
// Before the first beat of the song, all cabinet lights solid on (except for menu buttons). // Before the first beat of the song, all cabinet lights solid on (except for menu buttons).
bool bOverrideCabinetBlink = (GAMESTATE->m_Position.m_fSongBeat < GAMESTATE->m_pCurSong->m_fFirstBeat); Song &s = *GAMESTATE->m_pCurSong;
bool bOverrideCabinetBlink = (GAMESTATE->m_Position.m_fSongBeat < s.GetFirstBeat());
FOREACH_CabinetLight( cl ) FOREACH_CabinetLight( cl )
bBlinkCabinetLight[cl] |= bOverrideCabinetBlink; bBlinkCabinetLight[cl] |= bOverrideCabinetBlink;
+84 -17
View File
@@ -41,7 +41,7 @@
* @brief The internal version of the cache for StepMania. * @brief The internal version of the cache for StepMania.
* *
* Increment this value to invalidate the current cache. */ * Increment this value to invalidate the current cache. */
const int FILE_CACHE_VERSION = 185; const int FILE_CACHE_VERSION = 187;
/** @brief How long does a song sample last by default? */ /** @brief How long does a song sample last by default? */
const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f; const float DEFAULT_MUSIC_SAMPLE_LENGTH = 12.f;
@@ -69,9 +69,9 @@ Song::Song()
m_fMusicSampleStartSeconds = -1; m_fMusicSampleStartSeconds = -1;
m_fMusicSampleLengthSeconds = DEFAULT_MUSIC_SAMPLE_LENGTH; m_fMusicSampleLengthSeconds = DEFAULT_MUSIC_SAMPLE_LENGTH;
m_fMusicLengthSeconds = 0; m_fMusicLengthSeconds = 0;
m_fFirstBeat = -1; firstSecond = -1;
m_fLastBeat = -1; lastSecond = -1;
m_fSpecifiedLastBeat = -1; specifiedLastSecond = -1;
m_SelectionDisplay = SHOW_ALWAYS; m_SelectionDisplay = SHOW_ALWAYS;
m_bEnabled = true; m_bEnabled = true;
m_DisplayBPMType = DISPLAY_BPM_ACTUAL; m_DisplayBPMType = DISPLAY_BPM_ACTUAL;
@@ -100,6 +100,51 @@ void Song::DetachSteps()
m_vpStepsByType[st].clear(); m_vpStepsByType[st].clear();
} }
float Song::GetFirstSecond() const
{
return this->firstSecond;
}
float Song::GetFirstBeat() const
{
return this->m_SongTiming.GetBeatFromElapsedTime(this->firstSecond);
}
float Song::GetLastSecond() const
{
return this->lastSecond;
}
float Song::GetLastBeat() const
{
return this->m_SongTiming.GetBeatFromElapsedTime(this->lastSecond);
}
float Song::GetSpecifiedLastSecond() const
{
return this->specifiedLastSecond;
}
float Song::GetSpecifiedLastBeat() const
{
return this->m_SongTiming.GetBeatFromElapsedTime(this->specifiedLastSecond);
}
void Song::SetFirstSecond(const float f)
{
this->firstSecond = f;
}
void Song::SetLastSecond(const float f)
{
this->lastSecond = f;
}
void Song::SetSpecifiedLastSecond(const float f)
{
this->specifiedLastSecond = f;
}
// Reset to an empty song. // Reset to an empty song.
void Song::Reset() void Song::Reset()
{ {
@@ -508,7 +553,8 @@ void Song::TidyUpData( bool bFromCache )
if( m_fMusicSampleStartSeconds+m_fMusicSampleLengthSeconds > this->m_fMusicLengthSeconds ) if( m_fMusicSampleStartSeconds+m_fMusicSampleLengthSeconds > this->m_fMusicLengthSeconds )
{ {
int iBeat = lrintf( m_fLastBeat/2 ); // Attempt to get a reasonable default.
int iBeat = lrintf(this->m_SongTiming.GetBeatFromElapsedTime(this->GetLastSecond())/2);
iBeat -= iBeat%4; iBeat -= iBeat%4;
m_fMusicSampleStartSeconds = timing.GetElapsedTimeFromBeat( (float)iBeat ); m_fMusicSampleStartSeconds = timing.GetElapsedTimeFromBeat( (float)iBeat );
} }
@@ -797,7 +843,7 @@ void Song::TranslateTitles()
void Song::ReCalculateRadarValuesAndLastBeat( bool bFromCache ) void Song::ReCalculateRadarValuesAndLastBeat( bool bFromCache )
{ {
if( bFromCache && m_fFirstBeat >= 0 && m_fLastBeat > 0 ) if( bFromCache && this->GetFirstSecond() >= 0 && this->GetLastSecond() > 0 )
{ {
// this is loaded from cache, then we just have to calculate the radar values. // this is loaded from cache, then we just have to calculate the radar values.
for( unsigned i=0; i<m_vpSteps.size(); i++ ) for( unsigned i=0; i<m_vpSteps.size(); i++ )
@@ -805,8 +851,8 @@ void Song::ReCalculateRadarValuesAndLastBeat( bool bFromCache )
return; return;
} }
float fFirstBeat = FLT_MAX; // inf float localFirst = FLT_MAX; // inf
float fLastBeat = m_fSpecifiedLastBeat; // Make sure we're at least as long as the specified amount. float localLast = this->specifiedLastSecond; // Make sure we're at least as long as the specified amount.
for( unsigned i=0; i<m_vpSteps.size(); i++ ) for( unsigned i=0; i<m_vpSteps.size(); i++ )
{ {
@@ -814,7 +860,7 @@ void Song::ReCalculateRadarValuesAndLastBeat( bool bFromCache )
pSteps->CalculateRadarValues( m_fMusicLengthSeconds ); pSteps->CalculateRadarValues( m_fMusicLengthSeconds );
// calculate lastBeat // calculate lastSecond
// If it's autogen, then first/last beat will come from the parent. // If it's autogen, then first/last beat will come from the parent.
if( pSteps->IsAutogen() ) if( pSteps->IsAutogen() )
@@ -839,12 +885,14 @@ void Song::ReCalculateRadarValuesAndLastBeat( bool bFromCache )
if( tempNoteData.GetLastRow() == 0 ) if( tempNoteData.GetLastRow() == 0 )
continue; continue;
fFirstBeat = min( fFirstBeat, m_SongTiming.GetBeatFromElapsedTime(pSteps->m_Timing.GetElapsedTimeFromBeat(tempNoteData.GetFirstBeat())) ); localFirst = min(localFirst,
fLastBeat = max( fLastBeat, m_SongTiming.GetBeatFromElapsedTime(pSteps->m_Timing.GetElapsedTimeFromBeat(tempNoteData.GetLastBeat())) ); pSteps->m_Timing.GetElapsedTimeFromBeat(tempNoteData.GetFirstBeat()));
localLast = max(localLast,
pSteps->m_Timing.GetElapsedTimeFromBeat(tempNoteData.GetLastBeat()));
} }
m_fFirstBeat = fFirstBeat; this->firstSecond = localFirst;
m_fLastBeat = fLastBeat; this->lastSecond = localLast;
} }
// Return whether the song is playable in the given style. // Return whether the song is playable in the given style.
@@ -1458,8 +1506,7 @@ bool Song::HasSignificantBpmChangesOrStops() const
float Song::GetStepsSeconds() const float Song::GetStepsSeconds() const
{ {
const TimingData &timing = this->m_SongTiming; return this->GetLastSecond() - this->GetFirstSecond();
return timing.GetElapsedTimeFromBeat( m_fLastBeat ) - timing.GetElapsedTimeFromBeat( m_fFirstBeat );
} }
bool Song::IsLong() const bool Song::IsLong() const
@@ -1576,8 +1623,26 @@ public:
} }
static int GetStepsSeconds( T* p, lua_State *L ) { lua_pushnumber(L, p->GetStepsSeconds()); return 1; } static int GetStepsSeconds( T* p, lua_State *L ) { lua_pushnumber(L, p->GetStepsSeconds()); return 1; }
static int NormallyDisplayed( T* p, lua_State *L ){ lua_pushboolean(L, p->NormallyDisplayed()); return 1; } static int NormallyDisplayed( T* p, lua_State *L ){ lua_pushboolean(L, p->NormallyDisplayed()); return 1; }
static int GetFirstBeat( T* p, lua_State *L ) { lua_pushnumber(L, p->m_fFirstBeat); return 1; } static int GetFirstSecond(T* p, lua_State *L)
static int GetLastBeat( T* p, lua_State *L ) { lua_pushnumber(L, p->m_fLastBeat); return 1; } {
lua_pushnumber(L, p->GetFirstSecond());
return 1;
}
static int GetLastSecond(T* p, lua_State *L)
{
lua_pushnumber(L, p->GetLastSecond());
return 1;
}
static int GetFirstBeat( T* p, lua_State *L )
{
lua_pushnumber(L, p->GetFirstBeat());
return 1;
}
static int GetLastBeat( T* p, lua_State *L )
{
lua_pushnumber(L, p->GetLastBeat());
return 1;
}
static int HasAttacks( T* p, lua_State *L ) { lua_pushboolean(L, p->HasAttacks()); return 1; } static int HasAttacks( T* p, lua_State *L ) { lua_pushboolean(L, p->HasAttacks()); return 1; }
static int GetDisplayBpms( T* p, lua_State *L ) static int GetDisplayBpms( T* p, lua_State *L )
{ {
@@ -1654,7 +1719,9 @@ public:
ADD_METHOD( GetStepsSeconds ); ADD_METHOD( GetStepsSeconds );
ADD_METHOD( NormallyDisplayed ); ADD_METHOD( NormallyDisplayed );
ADD_METHOD( GetFirstBeat ); ADD_METHOD( GetFirstBeat );
ADD_METHOD( GetFirstSecond );
ADD_METHOD( GetLastBeat ); ADD_METHOD( GetLastBeat );
ADD_METHOD( GetLastSecond );
ADD_METHOD( HasAttacks ); ADD_METHOD( HasAttacks );
ADD_METHOD( GetDisplayBpms ); ADD_METHOD( GetDisplayBpms );
ADD_METHOD( IsDisplayBpmSecret ); ADD_METHOD( IsDisplayBpmSecret );
+19 -4
View File
@@ -20,7 +20,7 @@ void FixupPath( RString &path, const RString &sSongPath );
RString GetSongAssetPath( RString sPath, const RString &sSongPath ); RString GetSongAssetPath( RString sPath, const RString &sSongPath );
/** @brief The version of the .ssc file format. */ /** @brief The version of the .ssc file format. */
const static float STEPFILE_VERSION_NUMBER = 0.72f; const static float STEPFILE_VERSION_NUMBER = 0.73f;
/** @brief How many edits for this song can each profile have? */ /** @brief How many edits for this song can each profile have? */
const int MAX_EDITS_PER_SONG_PER_PROFILE = 15; const int MAX_EDITS_PER_SONG_PER_PROFILE = 15;
@@ -231,10 +231,8 @@ public:
RString m_sMusicFile; RString m_sMusicFile;
RString m_sInstrumentTrackFile[NUM_InstrumentTrack]; RString m_sInstrumentTrackFile[NUM_InstrumentTrack];
/** @brief The length of the music file. */
float m_fMusicLengthSeconds; float m_fMusicLengthSeconds;
float m_fFirstBeat; // beat of first note
float m_fLastBeat; // beat of last note
float m_fSpecifiedLastBeat; // specified last beat of the song
float m_fMusicSampleStartSeconds; float m_fMusicSampleStartSeconds;
float m_fMusicSampleLengthSeconds; float m_fMusicSampleLengthSeconds;
DisplayBPM m_DisplayBPMType; DisplayBPM m_DisplayBPMType;
@@ -290,8 +288,25 @@ public:
/** @brief The Song's TimingData. */ /** @brief The Song's TimingData. */
TimingData m_SongTiming; TimingData m_SongTiming;
float GetFirstBeat() const;
float GetFirstSecond() const;
float GetLastBeat() const;
float GetLastSecond() const;
float GetSpecifiedLastBeat() const;
float GetSpecifiedLastSecond() const;
void SetFirstSecond(const float f);
void SetLastSecond(const float f);
void SetSpecifiedLastSecond(const float f);
typedef vector<BackgroundChange> VBackgroundChange; typedef vector<BackgroundChange> VBackgroundChange;
private: private:
/** @brief The first second that a note is hit. */
float firstSecond;
/** @brief The last second that a note is hit. */
float lastSecond;
/** @brief The last second of the song for playing purposes. */
float specifiedLastSecond;
/** /**
* @brief The background changes (sorted by layer) that are for this Song. * @brief The background changes (sorted by layer) that are for this Song.
* *