Merge AJ's and Daisuke's work together.

Hopefully.
This commit is contained in:
Jason Felds
2010-07-21 14:26:07 -04:00
5 changed files with 193 additions and 123 deletions
+21 -12
View File
@@ -1,17 +1,19 @@
local Noteskin = ... or {} local Noteskin = {}
--bBlanks: --bBlanks:
Noteskin.bBlanks = { Noteskin.bBlanks = {
--["element"] = true|false; --["element"] = true|false;
["Hold Tail Active"] = true; ["Hold Tail Active"] = true;
["Roll Tail Active"] = true; ["Hold Tail Active"] = true;
["Roll Tail Inactive"] = true;
["Roll Tail Inactive"] = true;
} }
Noteskin.ElementRedirs = { Noteskin.ElementRedirs = {
--["element"] = "redirected_element"; --["element"] = "redirected_element";
["Hold Head Active"] = "Tap Note"; ["Hold Head Active"] = "Tap Note";
["Hold Head Inactive"] = "Tap Note"; ["Hold Head Inactive"] = "Tap Note";
["Roll Head Active"] = "Tap Note"; ["Roll Head Active"] = "Roll Head Active";
["Roll Head Inactive"] = "Tap Note"; ["Roll Head Inactive"] = "Roll Head Active";
["Tap Fake"] = "Tap Note"; ["Tap Fake"] = "Tap Note";
-- --
["Hold Topcap Inactive"] = "Hold Topcap Active"; ["Hold Topcap Inactive"] = "Hold Topcap Active";
@@ -19,17 +21,22 @@ Noteskin.ElementRedirs = {
["Hold Bottomcap Inactive"] = "Hold Bottomcap Active"; ["Hold Bottomcap Inactive"] = "Hold Bottomcap Active";
["Hold Tail Inactive"] = "Hold Tail Active"; ["Hold Tail Inactive"] = "Hold Tail Active";
-- --
["Roll Topcap Inactive"] = "Roll Topcap Active"; ["Roll Topcap Active"] = "Hold Topcap Active";
["Roll Body Inactive"] = "Roll Body Active"; ["Roll Body Active"] = "Hold Body Active";
["Roll Bottomcap Inactive"] = "Roll Bottomcap Active"; ["Roll Bottomcap Active"] = "Hold Bottomcap Active";
["Roll Tail Inactive"] = "Roll Tail Active"; ["Roll Tail Active"] = "Hold Tail Active";
--
["Roll Topcap Inactive"] = "Hold Topcap Active";
["Roll Body Inactive"] = "Hold Body Active";
["Roll Bottomcap Inactive"] = "Hold Bottomcap Active";
["Roll Tail Inactive"] = "Hold Tail Active";
} }
Noteskin.ButtonRedirs = { Noteskin.ButtonRedirs = {
Center = "Center"; Center = "Center";
UpLeft = "UpLeft"; UpLeft = "UpLeft";
UpRight = "UpLeft"; UpRight = "UpRight";
DownLeft = "DownLeft"; DownLeft = "DownLeft";
DownRight = "DownLeft"; DownRight = "DownRight";
} }
Noteskin.BaseRotX = { Noteskin.BaseRotX = {
Center = 0; Center = 0;
@@ -41,9 +48,9 @@ Noteskin.BaseRotX = {
Noteskin.BaseRotY = { Noteskin.BaseRotY = {
Center = 0; Center = 0;
UpLeft = 0; UpLeft = 0;
UpRight = 180; UpRight = 0;
DownLeft = 0; DownLeft = 0;
DownRight = 180; DownRight = 0;
} }
local function func() local function func()
@@ -71,6 +78,8 @@ local function func()
local path = NOTESKIN:GetPath(Noteskin.ButtonRedirs[sButton],ElementToLoad) local path = NOTESKIN:GetPath(Noteskin.ButtonRedirs[sButton],ElementToLoad)
--Graficos separados para holds y rolls --Graficos separados para holds y rolls
if string.find(sElement,"Hold") or string.find(sElement,"Roll") then if string.find(sElement,"Hold") or string.find(sElement,"Roll") then
--if ( string.find(sElement,"Hold") or string.find(sElement,"Roll") ) and not ( string.find(sElement,"Head") or string.find(sElement,"Tail") ) then
--if ( string.find(sElement,"Hold") or string.find(sElement,"Roll") ) and ( string.find(sElement,"Body") ) then
path = NOTESKIN:GetPath(sButton,ElementToLoad) path = NOTESKIN:GetPath(sButton,ElementToLoad)
end end
+37 -2
View File
@@ -1,4 +1,5 @@
return Def.ActorFrame { return Def.ActorFrame {
--note graphic
NOTESKIN:LoadActor(Var "Button", "Tap Note") .. { NOTESKIN:LoadActor(Var "Button", "Tap Note") .. {
InitCommand=cmd(blend,"BlendMode_Add";playcommand,"Glow"); InitCommand=cmd(blend,"BlendMode_Add";playcommand,"Glow");
W1Command=cmd(playcommand,"Glow"); W1Command=cmd(playcommand,"Glow");
@@ -6,10 +7,44 @@ return Def.ActorFrame {
W3Command=cmd(playcommand,"Glow"); W3Command=cmd(playcommand,"Glow");
W4Command=cmd(); W4Command=cmd();
W5Command=cmd(); W5Command=cmd();
HoldingOnCommand=cmd(playcommand,"Glow"); --HoldingOnCommand=cmd(playcommand,"Glow");
HitMineCommand=cmd(playcommand,"Glow");
GlowCommand=cmd(setstate,0;finishtweening;diffusealpha,1.0;zoom,1.0;linear,0.15;diffusealpha,0.9;zoom,1.15;linear,0.15;diffusealpha,0.0;zoom,1.3);
HeldCommand=cmd(playcommand,"Glow");
};
NOTESKIN:LoadActor(Var "Button", "Ready Receptor")..{
Name="Tap";
Frames = { { Frame = 2 } };
InitCommand=cmd(zoom,1;diffusealpha,0);
TapCommand=cmd(finishtweening;diffusealpha,1;zoom,1;linear,0.2;diffusealpha,0;zoom,1.2);
W1Command=cmd(playcommand,"Tap");
W2Command=cmd(playcommand,"Tap");
W3Command=cmd(playcommand,"Tap");
W4Command=cmd(playcommand,"Tap");
W5Command=cmd(playcommand,"Tap");
HitMineCommand=cmd(playcommand,"Tap");
HeldCommand=cmd(playcommand,"Tap");
--NONECommand=cmd(playcommand,"Tap");
--HeldCommand=NOTESKIN:GetMetricA(Var "Button", "TapHeldCommand");
--NOT WORKING!!
NoneCommand=cmd(linear,0.1;zoom,2);
};
--explosion
LoadActor("_flash")..{
InitCommand=cmd(blend,"BlendMode_Add";playcommand,"Glow");
W1Command=cmd(playcommand,"Glow");
W2Command=cmd(playcommand,"Glow");
W3Command=cmd(playcommand,"Glow");
W4Command=cmd();
W5Command=cmd();
--HoldingOnCommand=cmd(playcommand,"Glow");
HitMineCommand=cmd(playcommand,"Glow"); HitMineCommand=cmd(playcommand,"Glow");
HeldCommand=cmd(playcommand,"Glow"); HeldCommand=cmd(playcommand,"Glow");
GlowCommand=cmd(setstate,0;finishtweening;diffusealpha,1.0;zoom,1.0;linear,0.15;diffusealpha,0.9;zoom,1.1;linear,0.15;diffusealpha,0.0;zoom,1.2); GlowCommand=cmd(setstate,0;finishtweening;diffusealpha,1;zoom,1;linear,0.2;diffusealpha,0;zoom,1.2);
}; };
Def.Quad { Def.Quad {
InitCommand=cmd(diffuse,1,1,1,0;zoomto,SCREEN_WIDTH*100,SCREEN_HEIGHT*100;zoomz,SCREEN_WIDTH*SCREEN_HEIGHT); InitCommand=cmd(diffuse,1,1,1,0;zoomto,SCREEN_WIDTH*100,SCREEN_HEIGHT*100;zoomz,SCREEN_WIDTH*SCREEN_HEIGHT);
+26 -16
View File
@@ -1,39 +1,49 @@
local function Beat(self) local function Beat(self)
local this = self:GetChildren() local this = self:GetChildren()
--Yes, why not?
this.Base:pause();
this.Glow:pause();
this.Tap:pause();
this.Base:setstate(0);
this.Glow:setstate(1);
this.Tap:setstate(2);
this.Glow:blend('BlendMode_Add');
this.Glow:diffusealpha(0);
local beat = GAMESTATE:GetSongBeat() local beat = GAMESTATE:GetSongBeat()
local part = beat%1 local part = beat%1
part = clamp(part,0,0.5)
local eff = scale(part,0,0.5,1,0) local eff = scale(part,0,0.5,1,0)
if beat >= 0 then if (GAMESTATE:GetSongDelay() or false) and part == 0 then eff = 0 end
this.Glow:diffusealpha(eff); if beat < 0 then
eff = 0
end end
this.Glow:diffusealpha(eff);
end end
return Def.ActorFrame { return Def.ActorFrame {
-- COMMANDS -- -- COMMANDS --
InitCommand=cmd(SetUpdateFunction,Beat); InitCommand=cmd(SetUpdateFunction,Beat);
-- LAYERS -- -- LAYERS --
NOTESKIN:LoadActor("Center", "Outline Receptor")..{
Name="Outline";
Condition=Var "Button" == "Center";
--InitCommand=cmd(x,96);
};
NOTESKIN:LoadActor(Var "Button", "Ready Receptor")..{ NOTESKIN:LoadActor(Var "Button", "Ready Receptor")..{
Name="Base"; Name="Base";
InitCommand=cmd(); Frames = { { Frame = 0 } };
--PressCommand=cmd(finishtweening;glow,1,1,1,1;linear,0.1;glow,1,1,1,0);
}; };
NOTESKIN:LoadActor(Var "Button", "Ready Receptor")..{ NOTESKIN:LoadActor(Var "Button", "Ready Receptor")..{
Name="Glow"; Name="Glow";
InitCommand=cmd(); Frames = { { Frame = 1 } };
InitCommand=cmd(blend,'BlendMode_Add');
--PressCommand=cmd(finishtweening;linear,0.05;zoom,0.9;linear,0.1;zoom,1);
}; };
--[[
NOTESKIN:LoadActor(Var "Button", "Ready Receptor")..{ NOTESKIN:LoadActor(Var "Button", "Ready Receptor")..{
Name="Tap"; Name="Tap";
InitCommand=NOTESKIN:GetMetricA(Var "Button" ,"ReceptorTapInitCommand"); Frames = { { Frame = 2 } };
PressCommand=NOTESKIN:GetMetricA(Var "Button" ,"ReceptorTapPressCommand"); InitCommand=cmd(zoom,1;diffusealpha,0;glow,1,1,1,0);
--NOTESKIN:GetMetricA(Var "Button", "TapInitCommand");
--
PressCommand=cmd(finishtweening;glow,1,1,1,1;zoom,1;linear,0.2;glow,1,1,1,0;zoom,1.2);
--NOTESKIN:GetMetricA(Var "Button", "TapHeldCommand");
--
}; };
--]]
} }
+10 -24
View File
@@ -1,13 +1,15 @@
[NoteDisplay] [NoteDisplay]
TapNoteAnimationLength=1.25 AnimationIsBeatBased=0
TapMineAnimationLength=1.25
TapLiftAnimationLength=1.25
HoldHeadAnimationLength=1.25 TapNoteAnimationLength=0.25
HoldTopCapAnimationLength=1.25 TapMineAnimationLength=0.25
HoldBottomCapAnimationLength=1.25 TapLiftAnimationLength=0.25
HoldBodyAnimationLength=1.25 TapFakeAnimationLength=0.25
HoldTailAnimationLength=1.25 HoldHeadAnimationLength=0.25
HoldTopCapAnimationLength=0.25
HoldBottomCapAnimationLength=0.25
HoldBodyAnimationLength=0.25
HoldTailAnimationLength=0.25
HoldLetGoGrayPercent=1 HoldLetGoGrayPercent=1
ReverseDrawOrder=1111 ReverseDrawOrder=1111
@@ -17,23 +19,7 @@ FlipHoldBodyWhenReverse=1
TopHoldAnchorWhenReverse=0 TopHoldAnchorWhenReverse=0
HoldActiveIsAddLayer=0 HoldActiveIsAddLayer=0
;Explosion commands
ButtonTapCommand=setstate,0;finishtweening;diffusealpha,1.0;zoom,1.0;linear,0.15;diffusealpha,0.9;zoom,1.15;linear,0.15;diffusealpha,0.0;zoom,1.3
;you can go nuts now...
FlashTapCommand=finishtweening;diffusealpha,0.5;zoom,1.0;linear,0.15;diffusealpha,0.45;zoom,1.15;linear,0.15;diffusealpha,0.0;zoom,1.3
;if you want/need diferent commands for each button, write the previous commands
;under the correspondant button section in this metrics.ini
;ReceptorTap commands
ReceptorTapInitCommand=zoom,1;diffusealpha,0;glow,1,1,1,0
ReceptorTapPressCommand=finishtweening;glow,1,1,1,1;zoom,1;linear,0.2;glow,1,1,1,0;zoom,1.2
[Center] [Center]
TapNoteAnimationLength=1
HoldHeadAnimationLength=1
HoldTailAnimationLength=1
[DownLeft] [DownLeft]
+98 -68
View File
@@ -124,33 +124,48 @@ static bool LoadFromKSFFile( const RString &sPath, Steps &out, const Song &song,
sFName.MakeLower(); sFName.MakeLower();
out.SetDescription(sFName); out.SetDescription(sFName);
if( sFName.find("crazy") != string::npos || sFName.find("nightmare") != string::npos || //Check another before anything else... is this okay? -DaisuMaster
sFName.find("crazydouble") != string::npos ) if( sFName.find("another") != string::npos )
{
out.SetDifficulty( Difficulty_Edit );
if( !out.GetMeter() ) out.SetMeter( 25 );
}
else if( sFName.find("wild") != string::npos || sFName.find("wd") != string::npos || sFName.find("crazy+") != string::npos || sFName.find("cz+") != string::npos || sFName.find("hardcore") != string::npos )
{
out.SetDifficulty( Difficulty_Challenge );
if( !out.GetMeter() ) out.SetMeter( 20 );
}
else if( sFName.find("crazy") != string::npos || sFName.find("cz") != string::npos || sFName.find("nightmare") != string::npos || sFName.find("nm") != string::npos || sFName.find("crazydouble") != string::npos )
{ {
out.SetDifficulty( Difficulty_Hard ); out.SetDifficulty( Difficulty_Hard );
if( !out.GetMeter() ) out.SetMeter( 14 ); // Set the meters to the Pump scale, not DDR. if( !out.GetMeter() ) out.SetMeter( 14 ); // Set the meters to the Pump scale, not DDR.
} }
else if( sFName.find("hard") != string::npos || sFName.find("freestyle") != string::npos || else if( sFName.find("hard") != string::npos || sFName.find("hd") != string::npos || sFName.find("freestyle") != string::npos || sFName.find("fs") != string::npos || sFName.find("double") != string::npos )
sFName.find("double") != string::npos )
{ {
out.SetDifficulty( Difficulty_Medium ); out.SetDifficulty( Difficulty_Medium );
if( !out.GetMeter() ) out.SetMeter( 8 ); if( !out.GetMeter() ) out.SetMeter( 8 );
} }
else if( sFName.find("easy") != string::npos || sFName.find("normal") != string::npos ) else if( sFName.find("easy") != string::npos || sFName.find("ez") != string::npos || sFName.find("normal") != string::npos )
{ {
//I wonder if I should leave easy fall into the Beginner difficulty... -DaisuMaster
out.SetDifficulty( Difficulty_Easy ); out.SetDifficulty( Difficulty_Easy );
if( !out.GetMeter() ) out.SetMeter( 4 ); if( !out.GetMeter() ) out.SetMeter( 4 );
} }
else if( sFName.find("beginner") != string::npos || sFName.find("practice") != string::npos || sFName.find("pr") != string::npos )
{
out.SetDifficulty( Difficulty_Beginner );
if( !out.GetMeter() ) out.SetMeter( 4 );
}
else else
{ {
out.SetDifficulty( Difficulty_Medium ); out.SetDifficulty( Difficulty_Hard );
if( !out.GetMeter() ) out.SetMeter( 8 ); if( !out.GetMeter() ) out.SetMeter( 10 );
} }
out.m_StepsType = StepsType_pump_single; out.m_StepsType = StepsType_pump_single;
// Check for "halfdouble" before "double". // Check for "halfdouble" before "double".
if( sFName.find("halfdouble") != string::npos || sFName.find("h_double") != string::npos ) if( sFName.find("halfdouble") != string::npos || sFName.find("half-double") != string::npos || sFName.find("h_double") != string::npos )
out.m_StepsType = StepsType_pump_halfdouble; out.m_StepsType = StepsType_pump_halfdouble;
// Handle bDoublesChart from above as well. -aj // Handle bDoublesChart from above as well. -aj
else if( sFName.find("double") != string::npos || sFName.find("nightmare") != string::npos || sFName.find("freestyle") != string::npos || bDoublesChart ) else if( sFName.find("double") != string::npos || sFName.find("nightmare") != string::npos || sFName.find("freestyle") != string::npos || bDoublesChart )
@@ -211,13 +226,15 @@ static bool LoadFromKSFFile( const RString &sPath, Steps &out, const Song &song,
LOG->UserLog( "Song file", sPath, "has illegal syntax \"%s\" which can't be in KIU complient files.", LOG->UserLog( "Song file", sPath, "has illegal syntax \"%s\" which can't be in KIU complient files.",
sRowString.c_str() ); sRowString.c_str() );
return false; return false;
//In other words: you can't mix ksf's with DM05 tags and ksf's without any DM05 tags
//Either one set or another will be read...
} }
if( BeginsWith(sRowString, "|B") || BeginsWith(sRowString, "|D") || BeginsWith(sRowString, "|E") ) if( BeginsWith(sRowString, "|B") || BeginsWith(sRowString, "|D") || BeginsWith(sRowString, "|E") )
{ {
// These don't have to be worried about here: the changes and stops were already added. // These don't have to be worried about here: the changes and stops were already added.
continue; continue;
} }
if ( BeginsWith(sRowString, "|T") ) else if ( BeginsWith(sRowString, "|T") )
{ {
RString temp = sRowString.substr(2,sRowString.size()-3); RString temp = sRowString.substr(2,sRowString.size()-3);
newTick = atoi(temp); newTick = atoi(temp);
@@ -226,9 +243,11 @@ static bool LoadFromKSFFile( const RString &sPath, Steps &out, const Song &song,
} }
else else
{ {
LOG->UserLog( "Song file", sPath, "has a RowString with an improper length \"%s\"; corrupt notes ignored.", // Is this why improper ksf or some kiucompilant ksf mixed with dm05 ksf are ignored?? -DaisuMaster
sRowString.c_str() ); //LOG->UserLog( "Song file", sPath, "has a RowString with an improper length \"%s\"; corrupt notes ignored.",
return false; // sRowString.c_str() );
//return false;
continue;
} }
} }
@@ -271,6 +290,19 @@ static bool LoadFromKSFFile( const RString &sPath, Steps &out, const Song &song,
{ {
case '0': tap = TAP_EMPTY; break; case '0': tap = TAP_EMPTY; break;
case '1': tap = TAP_ORIGINAL_TAP; break; case '1': tap = TAP_ORIGINAL_TAP; break;
//allow setting more notetypes on ksf files, this may come in handy (it should) -DaisuMaster
case 'M':
case 'm':
tap = TAP_ORIGINAL_MINE;
break;
case 'F':
case 'f':
tap = TAP_ORIGINAL_FAKE;
break;
case 'L':
case 'l':
tap = TAP_ORIGINAL_LIFT;
break;
default: default:
LOG->UserLog( "Song file", sPath, "has an invalid row \"%s\"; corrupt notes ignored.", LOG->UserLog( "Song file", sPath, "has an invalid row \"%s\"; corrupt notes ignored.",
sRowString.c_str() ); sRowString.c_str() );
@@ -347,6 +379,18 @@ static bool LoadGlobalData( const RString &sPath, Song &out, bool &bKIUCompliant
return false; return false;
} }
// changed up there in case of something is found inside the SONGFILE tag in the head ksf -DaisuMaster
// search for music with song in the file name
vector<RString> arrayPossibleMusic;
GetDirListing( out.GetSongDir() + RString("song.mp3"), arrayPossibleMusic );
GetDirListing( out.GetSongDir() + RString("song.oga"), arrayPossibleMusic );
GetDirListing( out.GetSongDir() + RString("song.ogg"), arrayPossibleMusic );
GetDirListing( out.GetSongDir() + RString("song.wav"), arrayPossibleMusic );
if( !arrayPossibleMusic.empty() ) // we found a match
out.m_sMusicFile = arrayPossibleMusic[0];
// ^this was below, at the end
float SMGap1 = 0, SMGap2 = 0, BPM1 = -1, BPMPos2 = -1, BPM2 = -1, BPMPos3 = -1, BPM3 = -1; float SMGap1 = 0, SMGap2 = 0, BPM1 = -1, BPMPos2 = -1, BPM2 = -1, BPMPos3 = -1, BPM3 = -1;
int iTickCount = -1; int iTickCount = -1;
bKIUCompliant = false; bKIUCompliant = false;
@@ -412,7 +456,7 @@ static bool LoadGlobalData( const RString &sPath, Song &out, bool &bKIUCompliant
// CheckpointsUseTimeSignatures metric. -aj // CheckpointsUseTimeSignatures metric. -aj
TimeSignatureSegment seg; TimeSignatureSegment seg;
seg.m_iStartRow = BeatToNoteRow(0.0f); seg.m_iStartRow = BeatToNoteRow(0.0f);
seg.m_iNumerator = iTickCount; seg.m_iNumerator = CLAMP( iTickCount, 0, ROWS_PER_BEAT );
seg.m_iDenominator = 4; seg.m_iDenominator = 4;
out.m_Timing.AddTimeSignatureSegment( seg ); out.m_Timing.AddTimeSignatureSegment( seg );
} }
@@ -435,6 +479,22 @@ static bool LoadGlobalData( const RString &sPath, Song &out, bool &bKIUCompliant
{ {
out.m_fMusicSampleStartSeconds = HHMMSSToSeconds( sParams[1] ); out.m_fMusicSampleStartSeconds = HHMMSSToSeconds( sParams[1] );
} }
else if( 0==stricmp(sValueName,"TITLEFILE") )
{
out.m_sBackgroundFile = sParams[1];
}
else if( 0==stricmp(sValueName,"DISCFILE") )
{
out.m_sBannerFile = sParams[1];
}
else if( 0==stricmp(sValueName,"SONGFILE") )
{
out.m_sSongFileName = sParams[1];
}
//else if( 0==stricmp(sValueName,"INTROFILE") )
//{
// nothing to add...
//}
// end new cases // end new cases
else else
{ {
@@ -443,6 +503,9 @@ static bool LoadGlobalData( const RString &sPath, Song &out, bool &bKIUCompliant
} }
} }
//intro length in piu mixes is normally 7 seconds
out.m_fMusicSampleLengthSeconds = 7.0f;
/* BPM Change checks are done here. If bKIUCompliant, it's short and sweet. /* BPM Change checks are done here. If bKIUCompliant, it's short and sweet.
* Otherwise, the whole file has to be processed. Right now, this is only * Otherwise, the whole file has to be processed. Right now, this is only
* called once, for the initial file (often the Crazy steps). Hopefully that * called once, for the initial file (often the Crazy steps). Hopefully that
@@ -470,13 +533,8 @@ static bool LoadGlobalData( const RString &sPath, Song &out, bool &bKIUCompliant
} }
else else
{ {
int tickToChange = iTickCount;
float fCurBeat = 0.0f; float fCurBeat = 0.0f;
float speedToChange = 0.0f, timeToStop = 0.0f;
bool bDMRequired = false; bool bDMRequired = false;
bool bBPMChangeNeeded = false;
bool bBPMStopNeeded = false;
bool bTickChangeNeeded = false;
for( unsigned i=0; i < vNoteRows.size(); ++i ) for( unsigned i=0; i < vNoteRows.size(); ++i )
{ {
@@ -504,68 +562,50 @@ static bool LoadGlobalData( const RString &sPath, Song &out, bool &bKIUCompliant
float numTemp = StringToFloat(temp); float numTemp = StringToFloat(temp);
if (BeginsWith(NoteRowString, "|T")) if (BeginsWith(NoteRowString, "|T"))
{ {
bTickChangeNeeded = true; iTickCount = (int)numTemp;
tickToChange = (int)numTemp; TimeSignatureSegment seg;
seg.m_iStartRow = BeatToNoteRow(fCurBeat);
seg.m_iNumerator = CLAMP( iTickCount, 0, ROWS_PER_BEAT);
seg.m_iDenominator = 4;
out.m_Timing.AddTimeSignatureSegment( seg );
continue; continue;
} }
if (BeginsWith(NoteRowString, "|B")) else if (BeginsWith(NoteRowString, "|B"))
{ {
bBPMChangeNeeded = true; out.m_Timing.AddBPMSegment( BPMSegment( BeatToNoteRow(fCurBeat), (float)numTemp ) );
speedToChange = numTemp;
continue; continue;
} }
if (BeginsWith(NoteRowString, "|E")) else if (BeginsWith(NoteRowString, "|E"))
{ {
bBPMStopNeeded = true; //Finally! the |E| tag is working as it should. I can die happy now -DaisuMaster
timeToStop = 60 / out.m_Timing.GetBPMAtBeat(NoteRowToBeat(i)) * numTemp / (float)tickToChange; float fCurDelay = 60 / out.m_Timing.GetBPMAtBeat(fCurBeat) * (float)numTemp / iTickCount;
out.m_Timing.AddStopSegment( StopSegment( BeatToNoteRow(fCurBeat), fCurDelay, true ) );
continue; continue;
} }
if (BeginsWith(NoteRowString, "|D")) else if (BeginsWith(NoteRowString, "|D"))
{ {
bBPMStopNeeded = true; bool bDelay = true;
//bool bDelay = true; float fCurDelay = out.m_Timing.GetStopAtRow(i, bDelay);
timeToStop = numTemp / 1000.0f; // + out.m_Timing.GetStopAtRow(i-1, bDelay); out.m_Timing.AddStopSegment( StopSegment( BeatToNoteRow(fCurBeat), fCurDelay, true ) );
continue; continue;
} }
} }
else else
{ {
// Quit while we're ahead if any bad syntax is spotted. // Quit while we're ahead if any bad syntax is spotted.
LOG->UserLog( "Song file", sPath, "has an invalid RowString \"%s\".", //LOG->UserLog( "Song file", sPath, "has an invalid RowString \"%s\".",
NoteRowString.c_str() ); // NoteRowString.c_str() );
return false; //return false;
//how about no? :D -DaisuMaster
continue;
} }
} }
if( bTickChangeNeeded )
{
iTickCount = tickToChange;
LOG->Trace( "Adding time signature of %i/4 at beat %f", iTickCount, fCurBeat );
TimeSignatureSegment seg;
seg.m_iStartRow = BeatToNoteRow(fCurBeat);
seg.m_iNumerator = iTickCount;
seg.m_iDenominator = 4;
out.m_Timing.AddTimeSignatureSegment( seg );
bTickChangeNeeded = false;
}
if( bBPMChangeNeeded )
{
LOG->Trace( "Adding tempo change of %f BPM at beat %f", speedToChange, fCurBeat );
out.AddBPMSegment( BPMSegment(BeatToNoteRow(fCurBeat), speedToChange) );
bBPMChangeNeeded = false;
}
if( bBPMStopNeeded )
{
LOG->Trace( "Adding delay of %f seconds at beat %f", timeToStop, fCurBeat );
out.AddStopSegment( StopSegment(BeatToNoteRow(fCurBeat),timeToStop,true) );
bBPMStopNeeded = false;
}
fCurBeat += 1.0f / iTickCount; fCurBeat += 1.0f / iTickCount;
} }
} }
out.m_fMusicSampleLengthSeconds = 7.0f;
// Try to fill in missing bits of information from the pathname. // Try to fill in missing bits of information from the pathname.
{ {
vector<RString> asBits; vector<RString> asBits;
@@ -575,16 +615,6 @@ static bool LoadGlobalData( const RString &sPath, Song &out, bool &bKIUCompliant
LoadTags( asBits[asBits.size()-2], out ); LoadTags( asBits[asBits.size()-2], out );
} }
// search for music with song in the file name
vector<RString> arrayPossibleMusic;
GetDirListing( out.GetSongDir() + RString("song.mp3"), arrayPossibleMusic );
GetDirListing( out.GetSongDir() + RString("song.oga"), arrayPossibleMusic );
GetDirListing( out.GetSongDir() + RString("song.ogg"), arrayPossibleMusic );
GetDirListing( out.GetSongDir() + RString("song.wav"), arrayPossibleMusic );
if( !arrayPossibleMusic.empty() ) // we found a match
out.m_sMusicFile = arrayPossibleMusic[0];
return true; return true;
} }